summaryrefslogtreecommitdiff
path: root/cleopatre/application/spidnetsnmp/agent/mibgroup
diff options
context:
space:
mode:
authormars2009-09-09 15:56:58 +0000
committerNicolas Schodet2009-10-08 22:51:34 +0200
commitc035036269fa0a6cf98407c7f37f1fc95639b58b (patch)
treee6ebdd97d9dc91f1fbbfffd2004fbabfccf32470 /cleopatre/application/spidnetsnmp/agent/mibgroup
parent26376b68725188ab54b4f34483e5cfd1a51a9511 (diff)
[CLEO][APP] spidnetsnmp sources added to cleopatre/application
Diffstat (limited to 'cleopatre/application/spidnetsnmp/agent/mibgroup')
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Makefile.depend14542
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Makefile.in35
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/README113
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/README.smux52
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon.h54
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/README30
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/agutil.c314
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/agutil.h26
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/agutil_api.h93
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/alarm.c720
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/alarm.h31
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/event.c828
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/event.h31
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/history.c729
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/history.h31
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/row_api.h187
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/rows.c880
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/rows.h26
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/statistics.c548
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/statistics.h31
-rwxr-xr-xcleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/test_alarm.sh82
-rwxr-xr-xcleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/test_hist.sh88
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agent/extend.c1433
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agent/extend.h69
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsCache.c419
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsCache.h22
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsDebug.c459
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsDebug.h23
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsLogging.c469
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsLogging.h16
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsModuleTable.c320
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsModuleTable.h27
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsTransactionTable.c248
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsTransactionTable.h21
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsVacmAccessTable.c339
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsVacmAccessTable.h27
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agent_mibs.h7
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agentx.h6
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/agentx_config.c251
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/agentx_config.h18
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/client.c498
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/client.h42
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/master.c627
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/master.h16
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/master_admin.c599
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/master_admin.h12
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/protocol.c2038
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/protocol.h114
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/subagent.c995
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/subagent.h21
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/default_modules.h56
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman.h9
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event-mib.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event.h34
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEvent.c480
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEvent.h87
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventConf.c581
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventConf.h20
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventNotificationTable.c228
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventNotificationTable.h20
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventSetTable.c271
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventSetTable.h23
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventTable.c326
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventTable.h22
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjects.c434
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjects.h59
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjectsConf.c179
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjectsConf.h12
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjectsTable.c299
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjectsTable.h22
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteScalars.c135
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteScalars.h14
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTrigger.c1187
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTrigger.h199
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerBooleanTable.c276
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerBooleanTable.h24
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerConf.c1480
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerConf.h23
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerDeltaTable.c239
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerDeltaTable.h20
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerExistenceTable.c255
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerExistenceTable.h23
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerTable.c451
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerTable.h34
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerThresholdTable.c349
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerThresholdTable.h33
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expErrorTable.c114
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expErrorTable.h21
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpression.c365
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpression.h91
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpressionConf.c286
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpressionConf.h10
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpressionTable.c337
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpressionTable.h26
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObject.c346
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObject.h77
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObjectConf.c182
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObjectConf.h9
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObjectTable.c436
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObjectTable.h27
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expScalars.c97
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expScalars.h13
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expValue.c808
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expValue.h12
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expValueTable.c327
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expValueTable.h23
-rwxr-xr-xcleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/exp_enum.h60
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression-mib.h21
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression.h13
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expErrorTable.c138
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expErrorTable.h49
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expExpressionTable.c1162
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expExpressionTable.h139
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expObjectTable.c1447
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expObjectTable.h92
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expValueTable.c888
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expValueTable.h63
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteEventNotificationTable.c97
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteEventNotificationTable.h23
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteEventTable.c340
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteEventTable.h30
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteObjectsTable.c946
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteObjectsTable.h70
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerBooleanTable.c802
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerBooleanTable.h45
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerDeltaTable.c416
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerDeltaTable.h37
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerExistenceTable.c737
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerExistenceTable.h39
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerTable.c3716
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerTable.h254
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerThresholdTable.c1611
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerThresholdTable.h46
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup-mib.h20
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup/lookupCtlTable.c1554
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup/lookupCtlTable.h87
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup/lookupResultsTable.c309
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup/lookupResultsTable.h39
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/old-event-mib.h33
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping-mib.h20
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingCtlTable.c5804
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingCtlTable.h465
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingProbeHistoryTable.c338
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingProbeHistoryTable.h36
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingResultsTable.c414
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingResultsTable.h42
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule.h3
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedConf.c427
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedConf.h17
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedCore.c503
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedCore.h85
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedTable.c500
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedTable.h38
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute-mib.h21
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteCtlTable.c6258
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteCtlTable.h627
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteHopsTable.c409
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteHopsTable.h41
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteProbeHistoryTable.c408
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteProbeHistoryTable.h39
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteResultsTable.c407
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteResultsTable.h40
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples.h4
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/Makefile.dlmod34
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/data_set.c206
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/data_set.h15
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/delayed_instance.c256
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/delayed_instance.h16
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/example.c743
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/example.h67
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable.c566
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable.h40
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_access.c364
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_access.h48
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_checkfns.c197
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_checkfns.h47
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_checkfns_local.c117
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_checkfns_local.h36
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_columns.h16
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_enums.h37
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/notification.c175
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/notification.h17
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/scalar_int.c77
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/scalar_int.h14
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/ucdDemoPublic.c228
-rwxr-xr-xcleopatre/application/spidnetsnmp/agent/mibgroup/examples/ucdDemoPublic.cmds8
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/ucdDemoPublic.conf89
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/ucdDemoPublic.h38
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/watched.c104
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/examples/watched.h14
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu.h32
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu.c246
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_kerndata.c95
-rwxr-xr-xcleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_kerndata.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_kstat.c162
-rwxr-xr-xcleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_kstat.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_linux.c301
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_linux.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_mach.c113
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_mach.h4
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_nlist.c109
-rwxr-xr-xcleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_nlist.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_null.c38
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_null.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_pcp.c191
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_pcp.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_perfstat.c107
-rwxr-xr-xcleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_perfstat.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_pstat.c109
-rwxr-xr-xcleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_pstat.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_sysctl.c205
-rwxr-xr-xcleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_sysctl.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_sysinfo.c132
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_sysinfo.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory.h32
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/hw_mem.c94
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/hw_mem.h1
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_aix.c80
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_darwin.c215
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_dynix.c117
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_freebsd.c258
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_hpux.c132
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_irix.c87
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_linux.c207
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_linux.h1
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_netbsd.c139
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_null.c18
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_solaris.c172
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_win.c63
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/header_complex.c595
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/header_complex.h72
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host.h85
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_device.c350
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_device.h11
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_disk.c1024
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_disk.h17
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_filesys.c971
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_filesys.h18
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_network.c288
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_network.h14
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_other.c66
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_other.h12
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_partition.c312
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_partition.h14
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_print.c365
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_print.h14
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_proc.c229
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_proc.h14
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_storage.c780
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_storage.h43
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_swinst.c718
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_swinst.h12
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_swrun.c1545
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_swrun.h13
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_system.c681
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_system.h15
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/host_res.h88
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib.h7
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface.c783
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface.h56
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_ioctl.c494
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_ioctl.h52
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_linux.c856
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_solaris2.c358
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_sysctl.c565
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_sysctl.h31
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable.h5
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable.c2352
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable.h683
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_constants.h381
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_data_access.c480
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_data_access.h84
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_defs.h37
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_interface.c1980
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_interface.h101
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable.h6
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable.c2535
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable.h458
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_constants.h144
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_data_access.c104
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_data_access.h44
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_interface.c2160
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_interface.h105
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib.h7
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route.h31
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_common.c279
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_ioctl.c197
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_ioctl.h8
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_linux.c427
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_linux.h0
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable.h5
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable.c2676
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable.h537
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_constants.h216
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_data_access.c932
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_data_access.h86
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_interface.c2366
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_interface.h102
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable.h5
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable.c3358
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable.h501
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_constants.h172
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_data_access.c671
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_data_access.h82
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_interface.c2318
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_interface.h100
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib.h9
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/arp.h30
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/arp_common.c142
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/arp_linux.c194
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress.h30
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_common.c430
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c596
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.h44
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c338
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_linux.h22
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/scalars_common.h29
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/scalars_linux.c79
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/systemstats.h30
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/systemstats_common.c389
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/systemstats_linux.c376
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable.h8
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable.c1818
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable.h413
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_constants.h161
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.c619
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.h84
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface.c1994
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface.h103
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable.h5
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.c673
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.h316
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_constants.h139
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.c353
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.h76
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.c1038
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.h98
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable.h5
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c2445
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.h457
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_constants.h213
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.c708
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.h79
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_interface.c2057
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_interface.h100
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable.h8
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.c3182
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.h1205
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_constants.h159
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_data_access.c446
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_data_access.h105
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_interface.c1363
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_interface.h173
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ip_scalars.c153
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ip_scalars.h7
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable.h5
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable.c956
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable.h275
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_constants.h81
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_data_access.c302
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_data_access.h71
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface.c1308
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface.h106
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_subagent.c202
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable.h5
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable.c1418
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable.h970
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_constants.h104
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access.c390
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access.h92
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface.c1390
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface.h178
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ipfwchains/README4
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/kernel_sunos5.c2031
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/kernel_sunos5.h214
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII.h32
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/at.c1263
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/at.h45
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/icmp.c803
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/icmp.h45
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ifTable.h10
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/interfaces.c2847
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/interfaces.h124
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ip.c957
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ip.h80
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipAddr.c1072
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipAddr.h15
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable.c1131
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable.h34
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_access.c258
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_access.h57
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_checkfns.c267
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_checkfns.h33
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_columns.h27
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_enums.h46
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipv6.c2148
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipv6.h144
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/kernel_linux.c221
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/kernel_linux.h93
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/mibII_common.h111
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/mta_sendmail.c1536
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/mta_sendmail.h9
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/route_headers.h180
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/route_write.c759
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/route_write.h20
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/setSerialNo.c72
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/setSerialNo.h6
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/snmp_mib.c253
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/snmp_mib.h83
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/sysORTable.c344
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/sysORTable.h57
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/system_mib.c765
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/system_mib.h31
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/tcp.c793
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/tcp.h36
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/tcpTable.c903
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/tcpTable.h39
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/udp.c566
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/udp.h24
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/udpTable.c775
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/udpTable.h21
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_conf.c1490
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_conf.h47
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_context.c167
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_context.h6
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_vars.c1918
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_vars.h94
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/var_route.c2101
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/var_route.h26
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibdefs.h14
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mibincl.h52
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/misc/ipfwacc.c347
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/misc/ipfwacc.h54
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/notification-log-mib.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/notification-log-mib/notification_log.c758
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/notification-log-mib/notification_log.h20
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/notification.h4
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/notification/snmpNotifyFilterProfileTable.c828
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/notification/snmpNotifyFilterProfileTable.h67
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/notification/snmpNotifyTable.c1141
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/notification/snmpNotifyTable.h73
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib.h3
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocLocalAddrTable.c286
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocLocalAddrTable.h60
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocRemAddrTable.c333
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocRemAddrTable.h71
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocTable.c517
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocTable.h99
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupLocalPortTable.c273
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupLocalPortTable.h59
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemHostNameTable.c278
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemHostNameTable.h64
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemIPAddrTable.c277
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemIPAddrTable.h63
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemPortTable.c267
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemPortTable.h57
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemPrimIPAddrTable.c283
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemPrimIPAddrTable.h65
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars.c314
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars.h23
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars_common.c141
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars_common.h148
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars_linux.c185
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpTables.h24
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpTables_common.c441
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpTables_common.h112
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpTables_linux.c442
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/smux.h4
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/smux/smux.c2077
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/smux/smux.h82
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_bgp.c187
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_bgp.h38
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_ospf.c282
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_ospf.h123
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_rip2.c184
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_rip2.h37
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/smux_gated.h6
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable.h1
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.c1927
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.h933
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_constants.h131
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.c587
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.h133
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface.c2421
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface.h210
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib.h8
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHParameters.h6
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHParameters/usmDHParameters.c136
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHParameters/usmDHParameters.h17
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable.h6
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable.c225
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable.h226
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_access.c330
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_access.h74
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_get.c613
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_get.h99
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_set.c1279
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_set.h130
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_doxygen.conf51
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_enums.h39
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_interface.c1772
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_interface.h102
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_oids.h46
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/snmpEngine.c226
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/snmpEngine.h33
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/snmpMPDStats.c75
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/snmpMPDStats.h29
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmConf.c9
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmConf.h8
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmStats.c77
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmStats.h34
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmUser.c1589
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmUser.h67
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3mibs.h14
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/struct.h43
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/target.h5
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/target/snmpTargetAddrEntry.c1687
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/target/snmpTargetAddrEntry.h95
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/target/snmpTargetParamsEntry.c1401
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/target/snmpTargetParamsEntry.h77
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/target/target.c220
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/target/target.h24
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/target/target_counters.c80
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/target/target_counters.h7
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib.h7
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/Makefile26
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn.h28
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn_common.c267
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c395
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn_private.h6
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn_solaris2.c182
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnTable.h8
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable.h6
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable.c1135
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable.h620
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_constants.h138
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_data_access.c321
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_data_access.h105
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_interface.c1790
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_interface.h176
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable.h5
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable.c443
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable.h271
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_constants.h78
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_data_access.c320
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_data_access.h73
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_interface.c981
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_interface.h98
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/testhandler.c427
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/testhandler.h9
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tunnel.h6
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tunnel/tunnel.c998
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/tunnel/tunnel.h46
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/disk.c882
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/disk.h25
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/diskio.c1169
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/diskio.h38
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/dlmod.c592
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/dlmod.h60
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/errormib.c235
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/errormib.h17
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/extensible.c694
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/extensible.h32
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/file.c185
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/file.h36
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/hpux.c119
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/hpux.h21
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/lmSensors.c1062
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/lmSensors.h16
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/loadave.c379
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/loadave.h26
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/logmatch.c554
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/logmatch.h57
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory.c231
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory.h37
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_aix4.c249
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_aix4.h12
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_darwin7.c394
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_darwin7.h12
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_dynix.c227
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_dynix.h27
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_freebsd2.c371
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_freebsd2.h12
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_hpux.c291
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_hpux.h12
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_netbsd1.c255
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_netbsd1.h12
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_solaris2.c278
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_solaris2.h12
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/pass.c540
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/pass.h23
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/pass_persist.c800
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/pass_persist.h22
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/proc.c854
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/proc.h28
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/proxy.c667
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/proxy.h22
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/versioninfo.c224
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/versioninfo.h32
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat.c257
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat.h40
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_aix4.c654
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_aix4.h47
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_bsdi4.c281
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_bsdi4.h12
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_darwin7.c317
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_darwin7.h12
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_dynix.c790
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_dynix.h51
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.c322
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.h12
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_hpux.c714
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_hpux.h55
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_linux.c561
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_linux.h40
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_netbsd1.c315
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_netbsd1.h12
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_solaris2.c774
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_solaris2.h60
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/ucd_snmp.h17
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib.h5
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint.h27
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_common.c175
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c297
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_private.h7
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_solaris2.c198
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable.h5
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.c416
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h306
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_constants.h85
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.c356
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.h73
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.c1073
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.h97
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/util_funcs.c1190
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/util_funcs.h55
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/utilities.h3
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/execute.c456
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/execute.h12
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/iquery.c201
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/iquery.h19
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/override.c280
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/override.h7
-rwxr-xr-xcleopatre/application/spidnetsnmp/agent/mibgroup/winExtDLL.c1605
-rwxr-xr-xcleopatre/application/spidnetsnmp/agent/mibgroup/winExtDLL.h34
647 files changed, 238032 insertions, 0 deletions
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Makefile.depend b/cleopatre/application/spidnetsnmp/agent/mibgroup/Makefile.depend
new file mode 100644
index 0000000000..15d698254c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Makefile.depend
@@ -0,0 +1,14542 @@
+# DO NOT DELETE THIS LINE -- make depend depends on it.
+
+./header_complex.lo: ../../include/net-snmp/net-snmp-config.h
+./header_complex.lo: ../../include/net-snmp/system/linux.h
+./header_complex.lo: ../../include/net-snmp/system/sysv.h
+./header_complex.lo: ../../include/net-snmp/system/generic.h
+./header_complex.lo: ../../include/net-snmp/machine/generic.h
+./header_complex.lo: ../../include/net-snmp/net-snmp-includes.h
+./header_complex.lo: ../../include/net-snmp/definitions.h
+./header_complex.lo: ../../include/net-snmp/types.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_api.h
+./header_complex.lo: ../../include/net-snmp/library/asn1.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_impl.h
+./header_complex.lo: ../../include/net-snmp/library/snmp.h
+./header_complex.lo: ../../include/net-snmp/library/snmp-tc.h
+./header_complex.lo: ../../include/net-snmp/utilities.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_client.h
+./header_complex.lo: ../../include/net-snmp/library/system.h
+./header_complex.lo: ../../include/net-snmp/library/tools.h
+./header_complex.lo: ../../include/net-snmp/library/int64.h
+./header_complex.lo: ../../include/net-snmp/library/mt_support.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_alarm.h
+./header_complex.lo: ../../include/net-snmp/library/callback.h
+./header_complex.lo: ../../include/net-snmp/library/data_list.h
+./header_complex.lo: ../../include/net-snmp/library/oid_stash.h
+./header_complex.lo: ../../include/net-snmp/library/check_varbind.h
+./header_complex.lo: ../../include/net-snmp/library/container.h
+./header_complex.lo: ../../include/net-snmp/library/factory.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_logging.h
+./header_complex.lo: ../../include/net-snmp/library/container_binary_array.h
+./header_complex.lo: ../../include/net-snmp/library/container_list_ssll.h
+./header_complex.lo: ../../include/net-snmp/library/container_iterator.h
+./header_complex.lo: ../../include/net-snmp/library/container.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_assert.h
+./header_complex.lo: ../../include/net-snmp/version.h
+./header_complex.lo: ../../include/net-snmp/session_api.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_transport.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_service.h
+./header_complex.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./header_complex.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./header_complex.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./header_complex.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./header_complex.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./header_complex.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./header_complex.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./header_complex.lo: ../../include/net-snmp/library/ucd_compat.h
+./header_complex.lo: ../../include/net-snmp/pdu_api.h
+./header_complex.lo: ../../include/net-snmp/mib_api.h
+./header_complex.lo: ../../include/net-snmp/library/mib.h
+./header_complex.lo: ../../include/net-snmp/library/parse.h
+./header_complex.lo: ../../include/net-snmp/varbind_api.h
+./header_complex.lo: ../../include/net-snmp/config_api.h
+./header_complex.lo: ../../include/net-snmp/library/read_config.h
+./header_complex.lo: ../../include/net-snmp/library/default_store.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_enum.h
+./header_complex.lo: ../../include/net-snmp/library/vacm.h
+./header_complex.lo: ../../include/net-snmp/output_api.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_debug.h
+./header_complex.lo: ../../include/net-snmp/snmpv3_api.h
+./header_complex.lo: ../../include/net-snmp/library/snmpv3.h
+./header_complex.lo: ../../include/net-snmp/library/transform_oids.h
+./header_complex.lo: ../../include/net-snmp/library/keytools.h
+./header_complex.lo: ../../include/net-snmp/library/scapi.h
+./header_complex.lo: ../../include/net-snmp/library/lcd_time.h
+./header_complex.lo: ../../include/net-snmp/library/snmp_secmod.h
+./header_complex.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./header_complex.lo: ../../include/net-snmp/library/snmpusm.h
+./header_complex.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./header_complex.lo: ../../include/net-snmp/agent/mib_module_config.h
+./header_complex.lo: ../../include/net-snmp/agent/agent_module_config.h
+./header_complex.lo: ../../include/net-snmp/agent/snmp_agent.h
+./header_complex.lo: ../../include/net-snmp/agent/snmp_vars.h
+./header_complex.lo: ../../include/net-snmp/agent/agent_handler.h
+./header_complex.lo: ../../include/net-snmp/agent/var_struct.h
+./header_complex.lo: ../../include/net-snmp/agent/agent_registry.h
+./header_complex.lo: ../../include/net-snmp/library/fd_event_manager.h
+./header_complex.lo: ../../include/net-snmp/agent/ds_agent.h
+./header_complex.lo: ../../include/net-snmp/agent/agent_read_config.h
+./header_complex.lo: ../../include/net-snmp/agent/agent_trap.h
+./header_complex.lo: ../../include/net-snmp/agent/all_helpers.h
+./header_complex.lo: ../../include/net-snmp/agent/instance.h
+./header_complex.lo: ../../include/net-snmp/agent/baby_steps.h
+./header_complex.lo: ../../include/net-snmp/agent/scalar.h
+./header_complex.lo: ../../include/net-snmp/agent/scalar_group.h
+./header_complex.lo: ../../include/net-snmp/agent/watcher.h
+./header_complex.lo: ../../include/net-snmp/agent/multiplexer.h
+./header_complex.lo: ../../include/net-snmp/agent/null.h
+./header_complex.lo: ../../include/net-snmp/agent/debug_handler.h
+./header_complex.lo: ../../include/net-snmp/agent/cache_handler.h
+./header_complex.lo: ../../include/net-snmp/agent/old_api.h
+./header_complex.lo: ../../include/net-snmp/agent/read_only.h
+./header_complex.lo: ../../include/net-snmp/agent/row_merge.h
+./header_complex.lo: ../../include/net-snmp/agent/serialize.h
+./header_complex.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./header_complex.lo: ../../include/net-snmp/agent/mode_end_call.h
+./header_complex.lo: ../../include/net-snmp/agent/table.h
+./header_complex.lo: ../../include/net-snmp/agent/table_data.h
+./header_complex.lo: ../../include/net-snmp/agent/table_dataset.h
+./header_complex.lo: ../../include/net-snmp/agent/table_tdata.h
+./header_complex.lo: ../../include/net-snmp/agent/table_iterator.h
+./header_complex.lo: ../../include/net-snmp/agent/table_container.h
+./header_complex.lo: ../../include/net-snmp/agent/table_array.h
+./header_complex.lo: ../../include/net-snmp/agent/mfd.h header_complex.h
+./kernel_sunos5.lo: ../../include/net-snmp/net-snmp-config.h
+./kernel_sunos5.lo: ../../include/net-snmp/system/linux.h
+./kernel_sunos5.lo: ../../include/net-snmp/system/sysv.h
+./kernel_sunos5.lo: ../../include/net-snmp/system/generic.h
+./kernel_sunos5.lo: ../../include/net-snmp/machine/generic.h
+./testhandler.lo: ../../include/net-snmp/net-snmp-config.h
+./testhandler.lo: ../../include/net-snmp/system/linux.h
+./testhandler.lo: ../../include/net-snmp/system/sysv.h
+./testhandler.lo: ../../include/net-snmp/system/generic.h
+./testhandler.lo: ../../include/net-snmp/machine/generic.h
+./testhandler.lo: ../../include/net-snmp/net-snmp-includes.h
+./testhandler.lo: ../../include/net-snmp/definitions.h
+./testhandler.lo: ../../include/net-snmp/types.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_api.h
+./testhandler.lo: ../../include/net-snmp/library/asn1.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_impl.h
+./testhandler.lo: ../../include/net-snmp/library/snmp.h
+./testhandler.lo: ../../include/net-snmp/library/snmp-tc.h
+./testhandler.lo: ../../include/net-snmp/utilities.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_client.h
+./testhandler.lo: ../../include/net-snmp/library/system.h
+./testhandler.lo: ../../include/net-snmp/library/tools.h
+./testhandler.lo: ../../include/net-snmp/library/int64.h
+./testhandler.lo: ../../include/net-snmp/library/mt_support.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_alarm.h
+./testhandler.lo: ../../include/net-snmp/library/callback.h
+./testhandler.lo: ../../include/net-snmp/library/data_list.h
+./testhandler.lo: ../../include/net-snmp/library/oid_stash.h
+./testhandler.lo: ../../include/net-snmp/library/check_varbind.h
+./testhandler.lo: ../../include/net-snmp/library/container.h
+./testhandler.lo: ../../include/net-snmp/library/factory.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_logging.h
+./testhandler.lo: ../../include/net-snmp/library/container_binary_array.h
+./testhandler.lo: ../../include/net-snmp/library/container_list_ssll.h
+./testhandler.lo: ../../include/net-snmp/library/container_iterator.h
+./testhandler.lo: ../../include/net-snmp/library/container.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_assert.h
+./testhandler.lo: ../../include/net-snmp/version.h
+./testhandler.lo: ../../include/net-snmp/session_api.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_transport.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_service.h
+./testhandler.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./testhandler.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./testhandler.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./testhandler.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./testhandler.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./testhandler.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./testhandler.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./testhandler.lo: ../../include/net-snmp/library/ucd_compat.h
+./testhandler.lo: ../../include/net-snmp/pdu_api.h
+./testhandler.lo: ../../include/net-snmp/mib_api.h
+./testhandler.lo: ../../include/net-snmp/library/mib.h
+./testhandler.lo: ../../include/net-snmp/library/parse.h
+./testhandler.lo: ../../include/net-snmp/varbind_api.h
+./testhandler.lo: ../../include/net-snmp/config_api.h
+./testhandler.lo: ../../include/net-snmp/library/read_config.h
+./testhandler.lo: ../../include/net-snmp/library/default_store.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_enum.h
+./testhandler.lo: ../../include/net-snmp/library/vacm.h
+./testhandler.lo: ../../include/net-snmp/output_api.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_debug.h
+./testhandler.lo: ../../include/net-snmp/snmpv3_api.h
+./testhandler.lo: ../../include/net-snmp/library/snmpv3.h
+./testhandler.lo: ../../include/net-snmp/library/transform_oids.h
+./testhandler.lo: ../../include/net-snmp/library/keytools.h
+./testhandler.lo: ../../include/net-snmp/library/scapi.h
+./testhandler.lo: ../../include/net-snmp/library/lcd_time.h
+./testhandler.lo: ../../include/net-snmp/library/snmp_secmod.h
+./testhandler.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./testhandler.lo: ../../include/net-snmp/library/snmpusm.h
+./testhandler.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./testhandler.lo: ../../include/net-snmp/agent/mib_module_config.h
+./testhandler.lo: ../../include/net-snmp/agent/agent_module_config.h
+./testhandler.lo: ../../include/net-snmp/agent/snmp_agent.h
+./testhandler.lo: ../../include/net-snmp/agent/snmp_vars.h
+./testhandler.lo: ../../include/net-snmp/agent/agent_handler.h
+./testhandler.lo: ../../include/net-snmp/agent/var_struct.h
+./testhandler.lo: ../../include/net-snmp/agent/agent_registry.h
+./testhandler.lo: ../../include/net-snmp/library/fd_event_manager.h
+./testhandler.lo: ../../include/net-snmp/agent/ds_agent.h
+./testhandler.lo: ../../include/net-snmp/agent/agent_read_config.h
+./testhandler.lo: ../../include/net-snmp/agent/agent_trap.h
+./testhandler.lo: ../../include/net-snmp/agent/all_helpers.h
+./testhandler.lo: ../../include/net-snmp/agent/instance.h
+./testhandler.lo: ../../include/net-snmp/agent/baby_steps.h
+./testhandler.lo: ../../include/net-snmp/agent/scalar.h
+./testhandler.lo: ../../include/net-snmp/agent/scalar_group.h
+./testhandler.lo: ../../include/net-snmp/agent/watcher.h
+./testhandler.lo: ../../include/net-snmp/agent/multiplexer.h
+./testhandler.lo: ../../include/net-snmp/agent/null.h
+./testhandler.lo: ../../include/net-snmp/agent/debug_handler.h
+./testhandler.lo: ../../include/net-snmp/agent/cache_handler.h
+./testhandler.lo: ../../include/net-snmp/agent/old_api.h
+./testhandler.lo: ../../include/net-snmp/agent/read_only.h
+./testhandler.lo: ../../include/net-snmp/agent/row_merge.h
+./testhandler.lo: ../../include/net-snmp/agent/serialize.h
+./testhandler.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./testhandler.lo: ../../include/net-snmp/agent/mode_end_call.h
+./testhandler.lo: ../../include/net-snmp/agent/table.h
+./testhandler.lo: ../../include/net-snmp/agent/table_data.h
+./testhandler.lo: ../../include/net-snmp/agent/table_dataset.h
+./testhandler.lo: ../../include/net-snmp/agent/table_tdata.h
+./testhandler.lo: ../../include/net-snmp/agent/table_iterator.h
+./testhandler.lo: ../../include/net-snmp/agent/table_container.h
+./testhandler.lo: ../../include/net-snmp/agent/table_array.h
+./testhandler.lo: ../../include/net-snmp/agent/mfd.h testhandler.h
+./util_funcs.lo: ../../include/net-snmp/net-snmp-config.h
+./util_funcs.lo: ../../include/net-snmp/system/linux.h
+./util_funcs.lo: ../../include/net-snmp/system/sysv.h
+./util_funcs.lo: ../../include/net-snmp/system/generic.h
+./util_funcs.lo: ../../include/net-snmp/machine/generic.h
+./util_funcs.lo: ../../include/net-snmp/net-snmp-includes.h
+./util_funcs.lo: ../../include/net-snmp/definitions.h
+./util_funcs.lo: ../../include/net-snmp/types.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_api.h
+./util_funcs.lo: ../../include/net-snmp/library/asn1.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_impl.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp-tc.h
+./util_funcs.lo: ../../include/net-snmp/utilities.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_client.h
+./util_funcs.lo: ../../include/net-snmp/library/system.h
+./util_funcs.lo: ../../include/net-snmp/library/tools.h
+./util_funcs.lo: ../../include/net-snmp/library/int64.h
+./util_funcs.lo: ../../include/net-snmp/library/mt_support.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_alarm.h
+./util_funcs.lo: ../../include/net-snmp/library/callback.h
+./util_funcs.lo: ../../include/net-snmp/library/data_list.h
+./util_funcs.lo: ../../include/net-snmp/library/oid_stash.h
+./util_funcs.lo: ../../include/net-snmp/library/check_varbind.h
+./util_funcs.lo: ../../include/net-snmp/library/container.h
+./util_funcs.lo: ../../include/net-snmp/library/factory.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_logging.h
+./util_funcs.lo: ../../include/net-snmp/library/container_binary_array.h
+./util_funcs.lo: ../../include/net-snmp/library/container_list_ssll.h
+./util_funcs.lo: ../../include/net-snmp/library/container_iterator.h
+./util_funcs.lo: ../../include/net-snmp/library/container.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_assert.h
+./util_funcs.lo: ../../include/net-snmp/version.h
+./util_funcs.lo: ../../include/net-snmp/session_api.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_transport.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_service.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./util_funcs.lo: ../../include/net-snmp/library/ucd_compat.h
+./util_funcs.lo: ../../include/net-snmp/pdu_api.h
+./util_funcs.lo: ../../include/net-snmp/mib_api.h
+./util_funcs.lo: ../../include/net-snmp/library/mib.h
+./util_funcs.lo: ../../include/net-snmp/library/parse.h
+./util_funcs.lo: ../../include/net-snmp/varbind_api.h
+./util_funcs.lo: ../../include/net-snmp/config_api.h
+./util_funcs.lo: ../../include/net-snmp/library/read_config.h
+./util_funcs.lo: ../../include/net-snmp/library/default_store.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_enum.h
+./util_funcs.lo: ../../include/net-snmp/library/vacm.h
+./util_funcs.lo: ../../include/net-snmp/output_api.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_debug.h
+./util_funcs.lo: ../../include/net-snmp/snmpv3_api.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpv3.h
+./util_funcs.lo: ../../include/net-snmp/library/transform_oids.h
+./util_funcs.lo: ../../include/net-snmp/library/keytools.h
+./util_funcs.lo: ../../include/net-snmp/library/scapi.h
+./util_funcs.lo: ../../include/net-snmp/library/lcd_time.h
+./util_funcs.lo: ../../include/net-snmp/library/snmp_secmod.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./util_funcs.lo: ../../include/net-snmp/library/snmpusm.h
+./util_funcs.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./util_funcs.lo: ../../include/net-snmp/agent/mib_module_config.h
+./util_funcs.lo: ../../include/net-snmp/agent/agent_module_config.h
+./util_funcs.lo: ../../include/net-snmp/agent/snmp_agent.h
+./util_funcs.lo: ../../include/net-snmp/agent/snmp_vars.h
+./util_funcs.lo: ../../include/net-snmp/agent/agent_handler.h
+./util_funcs.lo: ../../include/net-snmp/agent/var_struct.h
+./util_funcs.lo: ../../include/net-snmp/agent/agent_registry.h
+./util_funcs.lo: ../../include/net-snmp/library/fd_event_manager.h
+./util_funcs.lo: ../../include/net-snmp/agent/ds_agent.h
+./util_funcs.lo: ../../include/net-snmp/agent/agent_read_config.h
+./util_funcs.lo: ../../include/net-snmp/agent/agent_trap.h
+./util_funcs.lo: ../../include/net-snmp/agent/all_helpers.h
+./util_funcs.lo: ../../include/net-snmp/agent/instance.h
+./util_funcs.lo: ../../include/net-snmp/agent/baby_steps.h
+./util_funcs.lo: ../../include/net-snmp/agent/scalar.h
+./util_funcs.lo: ../../include/net-snmp/agent/scalar_group.h
+./util_funcs.lo: ../../include/net-snmp/agent/watcher.h
+./util_funcs.lo: ../../include/net-snmp/agent/multiplexer.h
+./util_funcs.lo: ../../include/net-snmp/agent/null.h
+./util_funcs.lo: ../../include/net-snmp/agent/debug_handler.h
+./util_funcs.lo: ../../include/net-snmp/agent/cache_handler.h
+./util_funcs.lo: ../../include/net-snmp/agent/old_api.h
+./util_funcs.lo: ../../include/net-snmp/agent/read_only.h
+./util_funcs.lo: ../../include/net-snmp/agent/row_merge.h
+./util_funcs.lo: ../../include/net-snmp/agent/serialize.h
+./util_funcs.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./util_funcs.lo: ../../include/net-snmp/agent/mode_end_call.h
+./util_funcs.lo: ../../include/net-snmp/agent/table.h
+./util_funcs.lo: ../../include/net-snmp/agent/table_data.h
+./util_funcs.lo: ../../include/net-snmp/agent/table_dataset.h
+./util_funcs.lo: ../../include/net-snmp/agent/table_tdata.h
+./util_funcs.lo: ../../include/net-snmp/agent/table_iterator.h
+./util_funcs.lo: ../../include/net-snmp/agent/table_container.h
+./util_funcs.lo: ../../include/net-snmp/agent/table_array.h
+./util_funcs.lo: ../../include/net-snmp/agent/mfd.h struct.h util_funcs.h
+./util_funcs.lo: utilities/execute.h
+./util_funcs.lo: ucd-snmp/errormib.h mibdefs.h
+./winExtDLL.lo: ../../include/net-snmp/net-snmp-config.h
+./winExtDLL.lo: ../../include/net-snmp/system/linux.h
+./winExtDLL.lo: ../../include/net-snmp/system/sysv.h
+./winExtDLL.lo: ../../include/net-snmp/system/generic.h
+./winExtDLL.lo: ../../include/net-snmp/machine/generic.h
+./winExtDLL.lo: ../../include/net-snmp/net-snmp-includes.h
+./winExtDLL.lo: ../../include/net-snmp/definitions.h
+./winExtDLL.lo: ../../include/net-snmp/types.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmp_api.h
+./winExtDLL.lo: ../../include/net-snmp/library/asn1.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmp_impl.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmp.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmp-tc.h
+./winExtDLL.lo: ../../include/net-snmp/utilities.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmp_client.h
+./winExtDLL.lo: ../../include/net-snmp/library/system.h
+./winExtDLL.lo: ../../include/net-snmp/library/tools.h
+./winExtDLL.lo: ../../include/net-snmp/library/int64.h
+./winExtDLL.lo: ../../include/net-snmp/library/mt_support.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmp_alarm.h
+./winExtDLL.lo: ../../include/net-snmp/library/callback.h
+./winExtDLL.lo: ../../include/net-snmp/library/data_list.h
+./winExtDLL.lo: ../../include/net-snmp/library/oid_stash.h
+./winExtDLL.lo: ../../include/net-snmp/library/check_varbind.h
+./winExtDLL.lo: ../../include/net-snmp/library/container.h
+./winExtDLL.lo: ../../include/net-snmp/library/factory.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmp_logging.h
+./winExtDLL.lo: ../../include/net-snmp/library/container_binary_array.h
+./winExtDLL.lo: ../../include/net-snmp/library/container_list_ssll.h
+./winExtDLL.lo: ../../include/net-snmp/library/container_iterator.h
+./winExtDLL.lo: ../../include/net-snmp/library/container.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmp_assert.h
+./winExtDLL.lo: ../../include/net-snmp/version.h
+./winExtDLL.lo: ../../include/net-snmp/session_api.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmp_transport.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmp_service.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./winExtDLL.lo: ../../include/net-snmp/library/ucd_compat.h
+./winExtDLL.lo: ../../include/net-snmp/pdu_api.h
+./winExtDLL.lo: ../../include/net-snmp/mib_api.h
+./winExtDLL.lo: ../../include/net-snmp/library/mib.h
+./winExtDLL.lo: ../../include/net-snmp/library/parse.h
+./winExtDLL.lo: ../../include/net-snmp/varbind_api.h
+./winExtDLL.lo: ../../include/net-snmp/config_api.h
+./winExtDLL.lo: ../../include/net-snmp/library/read_config.h
+./winExtDLL.lo: ../../include/net-snmp/library/default_store.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmp_enum.h
+./winExtDLL.lo: ../../include/net-snmp/library/vacm.h
+./winExtDLL.lo: ../../include/net-snmp/output_api.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmp_debug.h
+./winExtDLL.lo: ../../include/net-snmp/snmpv3_api.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmpv3.h
+./winExtDLL.lo: ../../include/net-snmp/library/transform_oids.h
+./winExtDLL.lo: ../../include/net-snmp/library/keytools.h
+./winExtDLL.lo: ../../include/net-snmp/library/scapi.h
+./winExtDLL.lo: ../../include/net-snmp/library/lcd_time.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmp_secmod.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./winExtDLL.lo: ../../include/net-snmp/library/snmpusm.h
+./winExtDLL.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./winExtDLL.lo: ../../include/net-snmp/agent/mib_module_config.h
+./winExtDLL.lo: ../../include/net-snmp/agent/agent_module_config.h
+./winExtDLL.lo: ../../include/net-snmp/agent/snmp_agent.h
+./winExtDLL.lo: ../../include/net-snmp/agent/snmp_vars.h
+./winExtDLL.lo: ../../include/net-snmp/agent/agent_handler.h
+./winExtDLL.lo: ../../include/net-snmp/agent/var_struct.h
+./winExtDLL.lo: ../../include/net-snmp/agent/agent_registry.h
+./winExtDLL.lo: ../../include/net-snmp/library/fd_event_manager.h
+./winExtDLL.lo: ../../include/net-snmp/agent/ds_agent.h
+./winExtDLL.lo: ../../include/net-snmp/agent/agent_read_config.h
+./winExtDLL.lo: ../../include/net-snmp/agent/agent_trap.h
+./winExtDLL.lo: ../../include/net-snmp/agent/all_helpers.h
+./winExtDLL.lo: ../../include/net-snmp/agent/instance.h
+./winExtDLL.lo: ../../include/net-snmp/agent/baby_steps.h
+./winExtDLL.lo: ../../include/net-snmp/agent/scalar.h
+./winExtDLL.lo: ../../include/net-snmp/agent/scalar_group.h
+./winExtDLL.lo: ../../include/net-snmp/agent/watcher.h
+./winExtDLL.lo: ../../include/net-snmp/agent/multiplexer.h
+./winExtDLL.lo: ../../include/net-snmp/agent/null.h
+./winExtDLL.lo: ../../include/net-snmp/agent/debug_handler.h
+./winExtDLL.lo: ../../include/net-snmp/agent/cache_handler.h
+./winExtDLL.lo: ../../include/net-snmp/agent/old_api.h
+./winExtDLL.lo: ../../include/net-snmp/agent/read_only.h
+./winExtDLL.lo: ../../include/net-snmp/agent/row_merge.h
+./winExtDLL.lo: ../../include/net-snmp/agent/serialize.h
+./winExtDLL.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./winExtDLL.lo: ../../include/net-snmp/agent/mode_end_call.h
+./winExtDLL.lo: ../../include/net-snmp/agent/table.h
+./winExtDLL.lo: ../../include/net-snmp/agent/table_data.h
+./winExtDLL.lo: ../../include/net-snmp/agent/table_dataset.h
+./winExtDLL.lo: ../../include/net-snmp/agent/table_tdata.h
+./winExtDLL.lo: ../../include/net-snmp/agent/table_iterator.h
+./winExtDLL.lo: ../../include/net-snmp/agent/table_container.h
+./winExtDLL.lo: ../../include/net-snmp/agent/table_array.h
+./winExtDLL.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h struct.h
+./winExtDLL.lo: winExtDLL.h
+./Rmon/agutil.lo: ../../include/net-snmp/net-snmp-config.h
+./Rmon/agutil.lo: ../../include/net-snmp/system/linux.h
+./Rmon/agutil.lo: ../../include/net-snmp/system/sysv.h
+./Rmon/agutil.lo: ../../include/net-snmp/system/generic.h
+./Rmon/agutil.lo: ../../include/net-snmp/machine/generic.h
+./Rmon/agutil.lo: ../../include/net-snmp/net-snmp-includes.h
+./Rmon/agutil.lo: ../../include/net-snmp/definitions.h
+./Rmon/agutil.lo: ../../include/net-snmp/types.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/asn1.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_impl.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp-tc.h
+./Rmon/agutil.lo: ../../include/net-snmp/utilities.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_client.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/system.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/tools.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/int64.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/mt_support.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_alarm.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/callback.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/data_list.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/oid_stash.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/check_varbind.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/container.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/factory.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_logging.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/container_binary_array.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/container_list_ssll.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/container_iterator.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/container.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_assert.h
+./Rmon/agutil.lo: ../../include/net-snmp/version.h
+./Rmon/agutil.lo: ../../include/net-snmp/session_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_transport.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_service.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/ucd_compat.h
+./Rmon/agutil.lo: ../../include/net-snmp/pdu_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/mib_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/mib.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/parse.h
+./Rmon/agutil.lo: ../../include/net-snmp/varbind_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/config_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/read_config.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/default_store.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_enum.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/vacm.h
+./Rmon/agutil.lo: ../../include/net-snmp/output_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_debug.h
+./Rmon/agutil.lo: ../../include/net-snmp/snmpv3_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpv3.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/transform_oids.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/keytools.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/scapi.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/lcd_time.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmp_secmod.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/snmpusm.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/mib_module_config.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/agent_module_config.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/snmp_agent.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/snmp_vars.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/agent_handler.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/var_struct.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/agent_registry.h
+./Rmon/agutil.lo: ../../include/net-snmp/library/fd_event_manager.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/ds_agent.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/agent_read_config.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/agent_trap.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/all_helpers.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/instance.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/baby_steps.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/scalar.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/scalar_group.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/watcher.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/multiplexer.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/null.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/debug_handler.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/cache_handler.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/old_api.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/read_only.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/row_merge.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/serialize.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/mode_end_call.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/table.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/table_data.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/table_dataset.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/table_tdata.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/table_iterator.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/table_container.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/table_array.h
+./Rmon/agutil.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h struct.h
+./Rmon/agutil.lo: ./Rmon/agutil.h ./Rmon/agutil_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/net-snmp-config.h
+./Rmon/alarm.lo: ../../include/net-snmp/system/linux.h
+./Rmon/alarm.lo: ../../include/net-snmp/system/sysv.h
+./Rmon/alarm.lo: ../../include/net-snmp/system/generic.h
+./Rmon/alarm.lo: ../../include/net-snmp/machine/generic.h
+./Rmon/alarm.lo: ../../include/net-snmp/net-snmp-includes.h
+./Rmon/alarm.lo: ../../include/net-snmp/definitions.h
+./Rmon/alarm.lo: ../../include/net-snmp/types.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/asn1.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_impl.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp-tc.h
+./Rmon/alarm.lo: ../../include/net-snmp/utilities.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_client.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/system.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/tools.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/int64.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/mt_support.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_alarm.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/callback.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/data_list.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/oid_stash.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/check_varbind.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/container.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/factory.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_logging.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/container_binary_array.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/container_list_ssll.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/container_iterator.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/container.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_assert.h
+./Rmon/alarm.lo: ../../include/net-snmp/version.h
+./Rmon/alarm.lo: ../../include/net-snmp/session_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_transport.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_service.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/ucd_compat.h
+./Rmon/alarm.lo: ../../include/net-snmp/pdu_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/mib_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/mib.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/parse.h
+./Rmon/alarm.lo: ../../include/net-snmp/varbind_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/config_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/read_config.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/default_store.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_enum.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/vacm.h
+./Rmon/alarm.lo: ../../include/net-snmp/output_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_debug.h
+./Rmon/alarm.lo: ../../include/net-snmp/snmpv3_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpv3.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/transform_oids.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/keytools.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/scapi.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/lcd_time.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmp_secmod.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/snmpusm.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/mib_module_config.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/agent_module_config.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/snmp_agent.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/snmp_vars.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/agent_handler.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/var_struct.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/agent_registry.h
+./Rmon/alarm.lo: ../../include/net-snmp/library/fd_event_manager.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/ds_agent.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/agent_read_config.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/agent_trap.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/all_helpers.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/instance.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/baby_steps.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/scalar.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/scalar_group.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/watcher.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/multiplexer.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/null.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/debug_handler.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/cache_handler.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/old_api.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/read_only.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/row_merge.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/serialize.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/mode_end_call.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/table.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/table_data.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/table_dataset.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/table_tdata.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/table_iterator.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/table_container.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/table_array.h
+./Rmon/alarm.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h struct.h
+./Rmon/alarm.lo: ./Rmon/alarm.h ./Rmon/agutil_api.h ./Rmon/row_api.h
+./Rmon/event.lo: ../../include/net-snmp/net-snmp-config.h
+./Rmon/event.lo: ../../include/net-snmp/system/linux.h
+./Rmon/event.lo: ../../include/net-snmp/system/sysv.h
+./Rmon/event.lo: ../../include/net-snmp/system/generic.h
+./Rmon/event.lo: ../../include/net-snmp/machine/generic.h
+./Rmon/event.lo: ../../include/net-snmp/net-snmp-includes.h
+./Rmon/event.lo: ../../include/net-snmp/definitions.h
+./Rmon/event.lo: ../../include/net-snmp/types.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_api.h
+./Rmon/event.lo: ../../include/net-snmp/library/asn1.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_impl.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp-tc.h
+./Rmon/event.lo: ../../include/net-snmp/utilities.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_client.h
+./Rmon/event.lo: ../../include/net-snmp/library/system.h
+./Rmon/event.lo: ../../include/net-snmp/library/tools.h
+./Rmon/event.lo: ../../include/net-snmp/library/int64.h
+./Rmon/event.lo: ../../include/net-snmp/library/mt_support.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_alarm.h
+./Rmon/event.lo: ../../include/net-snmp/library/callback.h
+./Rmon/event.lo: ../../include/net-snmp/library/data_list.h
+./Rmon/event.lo: ../../include/net-snmp/library/oid_stash.h
+./Rmon/event.lo: ../../include/net-snmp/library/check_varbind.h
+./Rmon/event.lo: ../../include/net-snmp/library/container.h
+./Rmon/event.lo: ../../include/net-snmp/library/factory.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_logging.h
+./Rmon/event.lo: ../../include/net-snmp/library/container_binary_array.h
+./Rmon/event.lo: ../../include/net-snmp/library/container_list_ssll.h
+./Rmon/event.lo: ../../include/net-snmp/library/container_iterator.h
+./Rmon/event.lo: ../../include/net-snmp/library/container.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_assert.h
+./Rmon/event.lo: ../../include/net-snmp/version.h
+./Rmon/event.lo: ../../include/net-snmp/session_api.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_transport.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_service.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./Rmon/event.lo: ../../include/net-snmp/library/ucd_compat.h
+./Rmon/event.lo: ../../include/net-snmp/pdu_api.h
+./Rmon/event.lo: ../../include/net-snmp/mib_api.h
+./Rmon/event.lo: ../../include/net-snmp/library/mib.h
+./Rmon/event.lo: ../../include/net-snmp/library/parse.h
+./Rmon/event.lo: ../../include/net-snmp/varbind_api.h
+./Rmon/event.lo: ../../include/net-snmp/config_api.h
+./Rmon/event.lo: ../../include/net-snmp/library/read_config.h
+./Rmon/event.lo: ../../include/net-snmp/library/default_store.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_enum.h
+./Rmon/event.lo: ../../include/net-snmp/library/vacm.h
+./Rmon/event.lo: ../../include/net-snmp/output_api.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_debug.h
+./Rmon/event.lo: ../../include/net-snmp/snmpv3_api.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpv3.h
+./Rmon/event.lo: ../../include/net-snmp/library/transform_oids.h
+./Rmon/event.lo: ../../include/net-snmp/library/keytools.h
+./Rmon/event.lo: ../../include/net-snmp/library/scapi.h
+./Rmon/event.lo: ../../include/net-snmp/library/lcd_time.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmp_secmod.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./Rmon/event.lo: ../../include/net-snmp/library/snmpusm.h
+./Rmon/event.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./Rmon/event.lo: ../../include/net-snmp/agent/mib_module_config.h
+./Rmon/event.lo: ../../include/net-snmp/agent/agent_module_config.h
+./Rmon/event.lo: ../../include/net-snmp/agent/snmp_agent.h
+./Rmon/event.lo: ../../include/net-snmp/agent/snmp_vars.h
+./Rmon/event.lo: ../../include/net-snmp/agent/agent_handler.h
+./Rmon/event.lo: ../../include/net-snmp/agent/var_struct.h
+./Rmon/event.lo: ../../include/net-snmp/agent/agent_registry.h
+./Rmon/event.lo: ../../include/net-snmp/library/fd_event_manager.h
+./Rmon/event.lo: ../../include/net-snmp/agent/ds_agent.h
+./Rmon/event.lo: ../../include/net-snmp/agent/agent_read_config.h
+./Rmon/event.lo: ../../include/net-snmp/agent/agent_trap.h
+./Rmon/event.lo: ../../include/net-snmp/agent/all_helpers.h
+./Rmon/event.lo: ../../include/net-snmp/agent/instance.h
+./Rmon/event.lo: ../../include/net-snmp/agent/baby_steps.h
+./Rmon/event.lo: ../../include/net-snmp/agent/scalar.h
+./Rmon/event.lo: ../../include/net-snmp/agent/scalar_group.h
+./Rmon/event.lo: ../../include/net-snmp/agent/watcher.h
+./Rmon/event.lo: ../../include/net-snmp/agent/multiplexer.h
+./Rmon/event.lo: ../../include/net-snmp/agent/null.h
+./Rmon/event.lo: ../../include/net-snmp/agent/debug_handler.h
+./Rmon/event.lo: ../../include/net-snmp/agent/cache_handler.h
+./Rmon/event.lo: ../../include/net-snmp/agent/old_api.h
+./Rmon/event.lo: ../../include/net-snmp/agent/read_only.h
+./Rmon/event.lo: ../../include/net-snmp/agent/row_merge.h
+./Rmon/event.lo: ../../include/net-snmp/agent/serialize.h
+./Rmon/event.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./Rmon/event.lo: ../../include/net-snmp/agent/mode_end_call.h
+./Rmon/event.lo: ../../include/net-snmp/agent/table.h
+./Rmon/event.lo: ../../include/net-snmp/agent/table_data.h
+./Rmon/event.lo: ../../include/net-snmp/agent/table_dataset.h
+./Rmon/event.lo: ../../include/net-snmp/agent/table_tdata.h
+./Rmon/event.lo: ../../include/net-snmp/agent/table_iterator.h
+./Rmon/event.lo: ../../include/net-snmp/agent/table_container.h
+./Rmon/event.lo: ../../include/net-snmp/agent/table_array.h
+./Rmon/event.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h struct.h
+./Rmon/event.lo: ./Rmon/event.h ./Rmon/agutil_api.h ./Rmon/row_api.h
+./Rmon/history.lo: ../../include/net-snmp/net-snmp-config.h
+./Rmon/history.lo: ../../include/net-snmp/system/linux.h
+./Rmon/history.lo: ../../include/net-snmp/system/sysv.h
+./Rmon/history.lo: ../../include/net-snmp/system/generic.h
+./Rmon/history.lo: ../../include/net-snmp/machine/generic.h
+./Rmon/history.lo: ../../include/net-snmp/net-snmp-includes.h
+./Rmon/history.lo: ../../include/net-snmp/definitions.h
+./Rmon/history.lo: ../../include/net-snmp/types.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_api.h
+./Rmon/history.lo: ../../include/net-snmp/library/asn1.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_impl.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp-tc.h
+./Rmon/history.lo: ../../include/net-snmp/utilities.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_client.h
+./Rmon/history.lo: ../../include/net-snmp/library/system.h
+./Rmon/history.lo: ../../include/net-snmp/library/tools.h
+./Rmon/history.lo: ../../include/net-snmp/library/int64.h
+./Rmon/history.lo: ../../include/net-snmp/library/mt_support.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_alarm.h
+./Rmon/history.lo: ../../include/net-snmp/library/callback.h
+./Rmon/history.lo: ../../include/net-snmp/library/data_list.h
+./Rmon/history.lo: ../../include/net-snmp/library/oid_stash.h
+./Rmon/history.lo: ../../include/net-snmp/library/check_varbind.h
+./Rmon/history.lo: ../../include/net-snmp/library/container.h
+./Rmon/history.lo: ../../include/net-snmp/library/factory.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_logging.h
+./Rmon/history.lo: ../../include/net-snmp/library/container_binary_array.h
+./Rmon/history.lo: ../../include/net-snmp/library/container_list_ssll.h
+./Rmon/history.lo: ../../include/net-snmp/library/container_iterator.h
+./Rmon/history.lo: ../../include/net-snmp/library/container.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_assert.h
+./Rmon/history.lo: ../../include/net-snmp/version.h
+./Rmon/history.lo: ../../include/net-snmp/session_api.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_transport.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_service.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./Rmon/history.lo: ../../include/net-snmp/library/ucd_compat.h
+./Rmon/history.lo: ../../include/net-snmp/pdu_api.h
+./Rmon/history.lo: ../../include/net-snmp/mib_api.h
+./Rmon/history.lo: ../../include/net-snmp/library/mib.h
+./Rmon/history.lo: ../../include/net-snmp/library/parse.h
+./Rmon/history.lo: ../../include/net-snmp/varbind_api.h
+./Rmon/history.lo: ../../include/net-snmp/config_api.h
+./Rmon/history.lo: ../../include/net-snmp/library/read_config.h
+./Rmon/history.lo: ../../include/net-snmp/library/default_store.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_enum.h
+./Rmon/history.lo: ../../include/net-snmp/library/vacm.h
+./Rmon/history.lo: ../../include/net-snmp/output_api.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_debug.h
+./Rmon/history.lo: ../../include/net-snmp/snmpv3_api.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpv3.h
+./Rmon/history.lo: ../../include/net-snmp/library/transform_oids.h
+./Rmon/history.lo: ../../include/net-snmp/library/keytools.h
+./Rmon/history.lo: ../../include/net-snmp/library/scapi.h
+./Rmon/history.lo: ../../include/net-snmp/library/lcd_time.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmp_secmod.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./Rmon/history.lo: ../../include/net-snmp/library/snmpusm.h
+./Rmon/history.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./Rmon/history.lo: ../../include/net-snmp/agent/mib_module_config.h
+./Rmon/history.lo: ../../include/net-snmp/agent/agent_module_config.h
+./Rmon/history.lo: ../../include/net-snmp/agent/snmp_agent.h
+./Rmon/history.lo: ../../include/net-snmp/agent/snmp_vars.h
+./Rmon/history.lo: ../../include/net-snmp/agent/agent_handler.h
+./Rmon/history.lo: ../../include/net-snmp/agent/var_struct.h
+./Rmon/history.lo: ../../include/net-snmp/agent/agent_registry.h
+./Rmon/history.lo: ../../include/net-snmp/library/fd_event_manager.h
+./Rmon/history.lo: ../../include/net-snmp/agent/ds_agent.h
+./Rmon/history.lo: ../../include/net-snmp/agent/agent_read_config.h
+./Rmon/history.lo: ../../include/net-snmp/agent/agent_trap.h
+./Rmon/history.lo: ../../include/net-snmp/agent/all_helpers.h
+./Rmon/history.lo: ../../include/net-snmp/agent/instance.h
+./Rmon/history.lo: ../../include/net-snmp/agent/baby_steps.h
+./Rmon/history.lo: ../../include/net-snmp/agent/scalar.h
+./Rmon/history.lo: ../../include/net-snmp/agent/scalar_group.h
+./Rmon/history.lo: ../../include/net-snmp/agent/watcher.h
+./Rmon/history.lo: ../../include/net-snmp/agent/multiplexer.h
+./Rmon/history.lo: ../../include/net-snmp/agent/null.h
+./Rmon/history.lo: ../../include/net-snmp/agent/debug_handler.h
+./Rmon/history.lo: ../../include/net-snmp/agent/cache_handler.h
+./Rmon/history.lo: ../../include/net-snmp/agent/old_api.h
+./Rmon/history.lo: ../../include/net-snmp/agent/read_only.h
+./Rmon/history.lo: ../../include/net-snmp/agent/row_merge.h
+./Rmon/history.lo: ../../include/net-snmp/agent/serialize.h
+./Rmon/history.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./Rmon/history.lo: ../../include/net-snmp/agent/mode_end_call.h
+./Rmon/history.lo: ../../include/net-snmp/agent/table.h
+./Rmon/history.lo: ../../include/net-snmp/agent/table_data.h
+./Rmon/history.lo: ../../include/net-snmp/agent/table_dataset.h
+./Rmon/history.lo: ../../include/net-snmp/agent/table_tdata.h
+./Rmon/history.lo: ../../include/net-snmp/agent/table_iterator.h
+./Rmon/history.lo: ../../include/net-snmp/agent/table_container.h
+./Rmon/history.lo: ../../include/net-snmp/agent/table_array.h
+./Rmon/history.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h struct.h
+./Rmon/history.lo: ./Rmon/history.h ./Rmon/agutil_api.h ./Rmon/row_api.h
+./Rmon/rows.lo: ../../include/net-snmp/net-snmp-config.h
+./Rmon/rows.lo: ../../include/net-snmp/system/linux.h
+./Rmon/rows.lo: ../../include/net-snmp/system/sysv.h
+./Rmon/rows.lo: ../../include/net-snmp/system/generic.h
+./Rmon/rows.lo: ../../include/net-snmp/machine/generic.h
+./Rmon/rows.lo: ../../include/net-snmp/net-snmp-includes.h
+./Rmon/rows.lo: ../../include/net-snmp/definitions.h
+./Rmon/rows.lo: ../../include/net-snmp/types.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_api.h
+./Rmon/rows.lo: ../../include/net-snmp/library/asn1.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_impl.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp-tc.h
+./Rmon/rows.lo: ../../include/net-snmp/utilities.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_client.h
+./Rmon/rows.lo: ../../include/net-snmp/library/system.h
+./Rmon/rows.lo: ../../include/net-snmp/library/tools.h
+./Rmon/rows.lo: ../../include/net-snmp/library/int64.h
+./Rmon/rows.lo: ../../include/net-snmp/library/mt_support.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_alarm.h
+./Rmon/rows.lo: ../../include/net-snmp/library/callback.h
+./Rmon/rows.lo: ../../include/net-snmp/library/data_list.h
+./Rmon/rows.lo: ../../include/net-snmp/library/oid_stash.h
+./Rmon/rows.lo: ../../include/net-snmp/library/check_varbind.h
+./Rmon/rows.lo: ../../include/net-snmp/library/container.h
+./Rmon/rows.lo: ../../include/net-snmp/library/factory.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_logging.h
+./Rmon/rows.lo: ../../include/net-snmp/library/container_binary_array.h
+./Rmon/rows.lo: ../../include/net-snmp/library/container_list_ssll.h
+./Rmon/rows.lo: ../../include/net-snmp/library/container_iterator.h
+./Rmon/rows.lo: ../../include/net-snmp/library/container.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_assert.h
+./Rmon/rows.lo: ../../include/net-snmp/version.h
+./Rmon/rows.lo: ../../include/net-snmp/session_api.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_transport.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_service.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./Rmon/rows.lo: ../../include/net-snmp/library/ucd_compat.h
+./Rmon/rows.lo: ../../include/net-snmp/pdu_api.h
+./Rmon/rows.lo: ../../include/net-snmp/mib_api.h
+./Rmon/rows.lo: ../../include/net-snmp/library/mib.h
+./Rmon/rows.lo: ../../include/net-snmp/library/parse.h
+./Rmon/rows.lo: ../../include/net-snmp/varbind_api.h
+./Rmon/rows.lo: ../../include/net-snmp/config_api.h
+./Rmon/rows.lo: ../../include/net-snmp/library/read_config.h
+./Rmon/rows.lo: ../../include/net-snmp/library/default_store.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_enum.h
+./Rmon/rows.lo: ../../include/net-snmp/library/vacm.h
+./Rmon/rows.lo: ../../include/net-snmp/output_api.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_debug.h
+./Rmon/rows.lo: ../../include/net-snmp/snmpv3_api.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpv3.h
+./Rmon/rows.lo: ../../include/net-snmp/library/transform_oids.h
+./Rmon/rows.lo: ../../include/net-snmp/library/keytools.h
+./Rmon/rows.lo: ../../include/net-snmp/library/scapi.h
+./Rmon/rows.lo: ../../include/net-snmp/library/lcd_time.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmp_secmod.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./Rmon/rows.lo: ../../include/net-snmp/library/snmpusm.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/mib_module_config.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/agent_module_config.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/snmp_agent.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/snmp_vars.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/agent_handler.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/var_struct.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/agent_registry.h
+./Rmon/rows.lo: ../../include/net-snmp/library/fd_event_manager.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/ds_agent.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/agent_read_config.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/agent_trap.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/all_helpers.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/instance.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/baby_steps.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/scalar.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/scalar_group.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/watcher.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/multiplexer.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/null.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/debug_handler.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/cache_handler.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/old_api.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/read_only.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/row_merge.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/serialize.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/mode_end_call.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/table.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/table_data.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/table_dataset.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/table_tdata.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/table_iterator.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/table_container.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/table_array.h
+./Rmon/rows.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h struct.h
+./Rmon/rows.lo: ./Rmon/agutil_api.h ./Rmon/rows.h ./Rmon/row_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/net-snmp-config.h
+./Rmon/statistics.lo: ../../include/net-snmp/system/linux.h
+./Rmon/statistics.lo: ../../include/net-snmp/system/sysv.h
+./Rmon/statistics.lo: ../../include/net-snmp/system/generic.h
+./Rmon/statistics.lo: ../../include/net-snmp/machine/generic.h
+./Rmon/statistics.lo: ../../include/net-snmp/net-snmp-includes.h
+./Rmon/statistics.lo: ../../include/net-snmp/definitions.h
+./Rmon/statistics.lo: ../../include/net-snmp/types.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/asn1.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_impl.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp-tc.h
+./Rmon/statistics.lo: ../../include/net-snmp/utilities.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_client.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/system.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/tools.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/int64.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/mt_support.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_alarm.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/callback.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/data_list.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/oid_stash.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/check_varbind.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/container.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/factory.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_logging.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/container_binary_array.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/container_list_ssll.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/container_iterator.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/container.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_assert.h
+./Rmon/statistics.lo: ../../include/net-snmp/version.h
+./Rmon/statistics.lo: ../../include/net-snmp/session_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_transport.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_service.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/ucd_compat.h
+./Rmon/statistics.lo: ../../include/net-snmp/pdu_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/mib_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/mib.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/parse.h
+./Rmon/statistics.lo: ../../include/net-snmp/varbind_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/config_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/read_config.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/default_store.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_enum.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/vacm.h
+./Rmon/statistics.lo: ../../include/net-snmp/output_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_debug.h
+./Rmon/statistics.lo: ../../include/net-snmp/snmpv3_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpv3.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/transform_oids.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/keytools.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/scapi.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/lcd_time.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmp_secmod.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/snmpusm.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/mib_module_config.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/agent_module_config.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/snmp_agent.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/snmp_vars.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/agent_handler.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/var_struct.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/agent_registry.h
+./Rmon/statistics.lo: ../../include/net-snmp/library/fd_event_manager.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/ds_agent.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/agent_read_config.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/agent_trap.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/all_helpers.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/instance.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/baby_steps.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/scalar.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/scalar_group.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/watcher.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/multiplexer.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/null.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/debug_handler.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/cache_handler.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/old_api.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/read_only.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/row_merge.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/serialize.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/mode_end_call.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/table.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/table_data.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/table_dataset.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/table_tdata.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/table_iterator.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/table_container.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/table_array.h
+./Rmon/statistics.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h
+./Rmon/statistics.lo: struct.h ./Rmon/statistics.h ./Rmon/agutil_api.h
+./Rmon/statistics.lo: ./Rmon/row_api.h
+./agent/extend.lo: ../../include/net-snmp/net-snmp-config.h
+./agent/extend.lo: ../../include/net-snmp/system/linux.h
+./agent/extend.lo: ../../include/net-snmp/system/sysv.h
+./agent/extend.lo: ../../include/net-snmp/system/generic.h
+./agent/extend.lo: ../../include/net-snmp/machine/generic.h
+./agent/extend.lo: ../../include/net-snmp/net-snmp-includes.h
+./agent/extend.lo: ../../include/net-snmp/definitions.h
+./agent/extend.lo: ../../include/net-snmp/types.h
+./agent/extend.lo: ../../include/net-snmp/library/snmp_api.h
+./agent/extend.lo: ../../include/net-snmp/library/asn1.h
+./agent/extend.lo: ../../include/net-snmp/library/snmp_impl.h
+./agent/extend.lo: ../../include/net-snmp/library/snmp.h
+./agent/extend.lo: ../../include/net-snmp/library/snmp-tc.h
+./agent/extend.lo: ../../include/net-snmp/utilities.h
+./agent/extend.lo: ../../include/net-snmp/library/snmp_client.h
+./agent/extend.lo: ../../include/net-snmp/library/system.h
+./agent/extend.lo: ../../include/net-snmp/library/tools.h
+./agent/extend.lo: ../../include/net-snmp/library/int64.h
+./agent/extend.lo: ../../include/net-snmp/library/mt_support.h
+./agent/extend.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agent/extend.lo: ../../include/net-snmp/library/callback.h
+./agent/extend.lo: ../../include/net-snmp/library/data_list.h
+./agent/extend.lo: ../../include/net-snmp/library/oid_stash.h
+./agent/extend.lo: ../../include/net-snmp/library/check_varbind.h
+./agent/extend.lo: ../../include/net-snmp/library/container.h
+./agent/extend.lo: ../../include/net-snmp/library/factory.h
+./agent/extend.lo: ../../include/net-snmp/library/snmp_logging.h
+./agent/extend.lo: ../../include/net-snmp/library/container_binary_array.h
+./agent/extend.lo: ../../include/net-snmp/library/container_list_ssll.h
+./agent/extend.lo: ../../include/net-snmp/library/container_iterator.h
+./agent/extend.lo: ../../include/net-snmp/library/container.h
+./agent/extend.lo: ../../include/net-snmp/library/snmp_assert.h
+./agent/extend.lo: ../../include/net-snmp/version.h
+./agent/extend.lo: ../../include/net-snmp/session_api.h
+./agent/extend.lo: ../../include/net-snmp/library/snmp_transport.h
+./agent/extend.lo: ../../include/net-snmp/library/snmp_service.h
+./agent/extend.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agent/extend.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agent/extend.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agent/extend.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agent/extend.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agent/extend.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agent/extend.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agent/extend.lo: ../../include/net-snmp/library/ucd_compat.h
+./agent/extend.lo: ../../include/net-snmp/pdu_api.h
+./agent/extend.lo: ../../include/net-snmp/mib_api.h
+./agent/extend.lo: ../../include/net-snmp/library/mib.h
+./agent/extend.lo: ../../include/net-snmp/library/parse.h
+./agent/extend.lo: ../../include/net-snmp/varbind_api.h
+./agent/extend.lo: ../../include/net-snmp/config_api.h
+./agent/extend.lo: ../../include/net-snmp/library/read_config.h
+./agent/extend.lo: ../../include/net-snmp/library/default_store.h
+./agent/extend.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agent/extend.lo: ../../include/net-snmp/library/snmp_enum.h
+./agent/extend.lo: ../../include/net-snmp/library/vacm.h
+./agent/extend.lo: ../../include/net-snmp/output_api.h
+./agent/extend.lo: ../../include/net-snmp/library/snmp_debug.h
+./agent/extend.lo: ../../include/net-snmp/snmpv3_api.h
+./agent/extend.lo: ../../include/net-snmp/library/snmpv3.h
+./agent/extend.lo: ../../include/net-snmp/library/transform_oids.h
+./agent/extend.lo: ../../include/net-snmp/library/keytools.h
+./agent/extend.lo: ../../include/net-snmp/library/scapi.h
+./agent/extend.lo: ../../include/net-snmp/library/lcd_time.h
+./agent/extend.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agent/extend.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agent/extend.lo: ../../include/net-snmp/library/snmpusm.h
+./agent/extend.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agent/extend.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agent/extend.lo: ../../include/net-snmp/agent/agent_module_config.h
+./agent/extend.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agent/extend.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agent/extend.lo: ../../include/net-snmp/agent/agent_handler.h
+./agent/extend.lo: ../../include/net-snmp/agent/var_struct.h
+./agent/extend.lo: ../../include/net-snmp/agent/agent_registry.h
+./agent/extend.lo: ../../include/net-snmp/library/fd_event_manager.h
+./agent/extend.lo: ../../include/net-snmp/agent/ds_agent.h
+./agent/extend.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agent/extend.lo: ../../include/net-snmp/agent/agent_trap.h
+./agent/extend.lo: ../../include/net-snmp/agent/all_helpers.h
+./agent/extend.lo: ../../include/net-snmp/agent/instance.h
+./agent/extend.lo: ../../include/net-snmp/agent/baby_steps.h
+./agent/extend.lo: ../../include/net-snmp/agent/scalar.h
+./agent/extend.lo: ../../include/net-snmp/agent/scalar_group.h
+./agent/extend.lo: ../../include/net-snmp/agent/watcher.h
+./agent/extend.lo: ../../include/net-snmp/agent/multiplexer.h
+./agent/extend.lo: ../../include/net-snmp/agent/null.h
+./agent/extend.lo: ../../include/net-snmp/agent/debug_handler.h
+./agent/extend.lo: ../../include/net-snmp/agent/cache_handler.h
+./agent/extend.lo: ../../include/net-snmp/agent/old_api.h
+./agent/extend.lo: ../../include/net-snmp/agent/read_only.h
+./agent/extend.lo: ../../include/net-snmp/agent/row_merge.h
+./agent/extend.lo: ../../include/net-snmp/agent/serialize.h
+./agent/extend.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agent/extend.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agent/extend.lo: ../../include/net-snmp/agent/table.h
+./agent/extend.lo: ../../include/net-snmp/agent/table_data.h
+./agent/extend.lo: ../../include/net-snmp/agent/table_dataset.h
+./agent/extend.lo: ../../include/net-snmp/agent/table_tdata.h
+./agent/extend.lo: ../../include/net-snmp/agent/table_iterator.h
+./agent/extend.lo: ../../include/net-snmp/agent/table_container.h
+./agent/extend.lo: ../../include/net-snmp/agent/table_array.h
+./agent/extend.lo: ../../include/net-snmp/agent/mfd.h
+./agent/extend.lo: ../../include/net-snmp/agent/agent_callbacks.h
+./agent/extend.lo: agent/extend.h utilities/execute.h struct.h util_funcs.h
+./agent/extend.lo: mibdefs.h
+./agent/nsCache.lo: ../../include/net-snmp/net-snmp-config.h
+./agent/nsCache.lo: ../../include/net-snmp/system/linux.h
+./agent/nsCache.lo: ../../include/net-snmp/system/sysv.h
+./agent/nsCache.lo: ../../include/net-snmp/system/generic.h
+./agent/nsCache.lo: ../../include/net-snmp/machine/generic.h
+./agent/nsCache.lo: ../../include/net-snmp/net-snmp-includes.h
+./agent/nsCache.lo: ../../include/net-snmp/definitions.h
+./agent/nsCache.lo: ../../include/net-snmp/types.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmp_api.h
+./agent/nsCache.lo: ../../include/net-snmp/library/asn1.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmp_impl.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmp.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmp-tc.h
+./agent/nsCache.lo: ../../include/net-snmp/utilities.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmp_client.h
+./agent/nsCache.lo: ../../include/net-snmp/library/system.h
+./agent/nsCache.lo: ../../include/net-snmp/library/tools.h
+./agent/nsCache.lo: ../../include/net-snmp/library/int64.h
+./agent/nsCache.lo: ../../include/net-snmp/library/mt_support.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agent/nsCache.lo: ../../include/net-snmp/library/callback.h
+./agent/nsCache.lo: ../../include/net-snmp/library/data_list.h
+./agent/nsCache.lo: ../../include/net-snmp/library/oid_stash.h
+./agent/nsCache.lo: ../../include/net-snmp/library/check_varbind.h
+./agent/nsCache.lo: ../../include/net-snmp/library/container.h
+./agent/nsCache.lo: ../../include/net-snmp/library/factory.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmp_logging.h
+./agent/nsCache.lo: ../../include/net-snmp/library/container_binary_array.h
+./agent/nsCache.lo: ../../include/net-snmp/library/container_list_ssll.h
+./agent/nsCache.lo: ../../include/net-snmp/library/container_iterator.h
+./agent/nsCache.lo: ../../include/net-snmp/library/container.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmp_assert.h
+./agent/nsCache.lo: ../../include/net-snmp/version.h
+./agent/nsCache.lo: ../../include/net-snmp/session_api.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmp_transport.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmp_service.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agent/nsCache.lo: ../../include/net-snmp/library/ucd_compat.h
+./agent/nsCache.lo: ../../include/net-snmp/pdu_api.h
+./agent/nsCache.lo: ../../include/net-snmp/mib_api.h
+./agent/nsCache.lo: ../../include/net-snmp/library/mib.h
+./agent/nsCache.lo: ../../include/net-snmp/library/parse.h
+./agent/nsCache.lo: ../../include/net-snmp/varbind_api.h
+./agent/nsCache.lo: ../../include/net-snmp/config_api.h
+./agent/nsCache.lo: ../../include/net-snmp/library/read_config.h
+./agent/nsCache.lo: ../../include/net-snmp/library/default_store.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmp_enum.h
+./agent/nsCache.lo: ../../include/net-snmp/library/vacm.h
+./agent/nsCache.lo: ../../include/net-snmp/output_api.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmp_debug.h
+./agent/nsCache.lo: ../../include/net-snmp/snmpv3_api.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmpv3.h
+./agent/nsCache.lo: ../../include/net-snmp/library/transform_oids.h
+./agent/nsCache.lo: ../../include/net-snmp/library/keytools.h
+./agent/nsCache.lo: ../../include/net-snmp/library/scapi.h
+./agent/nsCache.lo: ../../include/net-snmp/library/lcd_time.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agent/nsCache.lo: ../../include/net-snmp/library/snmpusm.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/agent_module_config.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/agent_handler.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/var_struct.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/agent_registry.h
+./agent/nsCache.lo: ../../include/net-snmp/library/fd_event_manager.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/ds_agent.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/agent_trap.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/all_helpers.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/instance.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/baby_steps.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/scalar.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/scalar_group.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/watcher.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/multiplexer.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/null.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/debug_handler.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/cache_handler.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/old_api.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/read_only.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/row_merge.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/serialize.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/table.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/table_data.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/table_dataset.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/table_tdata.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/table_iterator.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/table_container.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/table_array.h
+./agent/nsCache.lo: ../../include/net-snmp/agent/mfd.h agent/nsCache.h
+./agent/nsCache.lo: util_funcs.h struct.h
+./agent/nsDebug.lo: ../../include/net-snmp/net-snmp-config.h
+./agent/nsDebug.lo: ../../include/net-snmp/system/linux.h
+./agent/nsDebug.lo: ../../include/net-snmp/system/sysv.h
+./agent/nsDebug.lo: ../../include/net-snmp/system/generic.h
+./agent/nsDebug.lo: ../../include/net-snmp/machine/generic.h
+./agent/nsDebug.lo: ../../include/net-snmp/net-snmp-includes.h
+./agent/nsDebug.lo: ../../include/net-snmp/definitions.h
+./agent/nsDebug.lo: ../../include/net-snmp/types.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmp_api.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/asn1.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmp_impl.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmp.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmp-tc.h
+./agent/nsDebug.lo: ../../include/net-snmp/utilities.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmp_client.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/system.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/tools.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/int64.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/mt_support.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/callback.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/data_list.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/oid_stash.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/check_varbind.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/container.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/factory.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmp_logging.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/container_binary_array.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/container_list_ssll.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/container_iterator.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/container.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmp_assert.h
+./agent/nsDebug.lo: ../../include/net-snmp/version.h
+./agent/nsDebug.lo: ../../include/net-snmp/session_api.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmp_transport.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmp_service.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/ucd_compat.h
+./agent/nsDebug.lo: ../../include/net-snmp/pdu_api.h
+./agent/nsDebug.lo: ../../include/net-snmp/mib_api.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/mib.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/parse.h
+./agent/nsDebug.lo: ../../include/net-snmp/varbind_api.h
+./agent/nsDebug.lo: ../../include/net-snmp/config_api.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/read_config.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/default_store.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmp_enum.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/vacm.h
+./agent/nsDebug.lo: ../../include/net-snmp/output_api.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmp_debug.h
+./agent/nsDebug.lo: ../../include/net-snmp/snmpv3_api.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmpv3.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/transform_oids.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/keytools.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/scapi.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/lcd_time.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/snmpusm.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/agent_module_config.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/agent_handler.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/var_struct.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/agent_registry.h
+./agent/nsDebug.lo: ../../include/net-snmp/library/fd_event_manager.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/ds_agent.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/agent_trap.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/all_helpers.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/instance.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/baby_steps.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/scalar.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/scalar_group.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/watcher.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/multiplexer.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/null.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/debug_handler.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/cache_handler.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/old_api.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/read_only.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/row_merge.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/serialize.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/table.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/table_data.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/table_dataset.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/table_tdata.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/table_iterator.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/table_container.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/table_array.h
+./agent/nsDebug.lo: ../../include/net-snmp/agent/mfd.h agent/nsDebug.h
+./agent/nsDebug.lo: util_funcs.h struct.h
+./agent/nsLogging.lo: ../../include/net-snmp/net-snmp-config.h
+./agent/nsLogging.lo: ../../include/net-snmp/system/linux.h
+./agent/nsLogging.lo: ../../include/net-snmp/system/sysv.h
+./agent/nsLogging.lo: ../../include/net-snmp/system/generic.h
+./agent/nsLogging.lo: ../../include/net-snmp/machine/generic.h
+./agent/nsLogging.lo: ../../include/net-snmp/net-snmp-includes.h
+./agent/nsLogging.lo: ../../include/net-snmp/definitions.h
+./agent/nsLogging.lo: ../../include/net-snmp/types.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmp_api.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/asn1.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmp_impl.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmp.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmp-tc.h
+./agent/nsLogging.lo: ../../include/net-snmp/utilities.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmp_client.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/system.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/tools.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/int64.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/mt_support.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/callback.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/data_list.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/oid_stash.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/check_varbind.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/container.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/factory.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmp_logging.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/container_binary_array.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/container_list_ssll.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/container_iterator.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/container.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmp_assert.h
+./agent/nsLogging.lo: ../../include/net-snmp/version.h
+./agent/nsLogging.lo: ../../include/net-snmp/session_api.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmp_transport.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmp_service.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/ucd_compat.h
+./agent/nsLogging.lo: ../../include/net-snmp/pdu_api.h
+./agent/nsLogging.lo: ../../include/net-snmp/mib_api.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/mib.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/parse.h
+./agent/nsLogging.lo: ../../include/net-snmp/varbind_api.h
+./agent/nsLogging.lo: ../../include/net-snmp/config_api.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/read_config.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/default_store.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmp_enum.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/vacm.h
+./agent/nsLogging.lo: ../../include/net-snmp/output_api.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmp_debug.h
+./agent/nsLogging.lo: ../../include/net-snmp/snmpv3_api.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmpv3.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/transform_oids.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/keytools.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/scapi.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/lcd_time.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/snmpusm.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/agent_module_config.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/agent_handler.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/var_struct.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/agent_registry.h
+./agent/nsLogging.lo: ../../include/net-snmp/library/fd_event_manager.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/ds_agent.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/agent_trap.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/all_helpers.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/instance.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/baby_steps.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/scalar.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/scalar_group.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/watcher.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/multiplexer.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/null.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/debug_handler.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/cache_handler.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/old_api.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/read_only.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/row_merge.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/serialize.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/table.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/table_data.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/table_dataset.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/table_tdata.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/table_iterator.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/table_container.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/table_array.h
+./agent/nsLogging.lo: ../../include/net-snmp/agent/mfd.h agent/nsLogging.h
+./agent/nsLogging.lo: util_funcs.h struct.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/net-snmp-config.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/system/linux.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/system/sysv.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/system/generic.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/machine/generic.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/definitions.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/types.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/asn1.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/utilities.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_client.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/system.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/tools.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/int64.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/mt_support.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/callback.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/data_list.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/oid_stash.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/check_varbind.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/container.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/factory.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/container_iterator.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/container.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/version.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/session_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_service.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/pdu_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/mib_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/mib.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/parse.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/varbind_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/config_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/read_config.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/default_store.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/vacm.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/output_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/snmpv3_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpv3.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/transform_oids.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/keytools.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/scapi.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/lcd_time.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/snmpusm.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/var_struct.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/instance.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/scalar.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/watcher.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/null.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/old_api.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/read_only.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/row_merge.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/serialize.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/table.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/table_data.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/table_container.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/table_array.h
+./agent/nsModuleTable.lo: ../../include/net-snmp/agent/mfd.h
+./agent/nsModuleTable.lo: ./agent/nsModuleTable.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/net-snmp-config.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/system/linux.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/system/sysv.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/system/generic.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/machine/generic.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/definitions.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/types.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/asn1.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/utilities.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_client.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/system.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/tools.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/int64.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/mt_support.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/callback.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/data_list.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/oid_stash.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/check_varbind.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/container.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/factory.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/container_iterator.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/container.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/version.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/session_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_service.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/pdu_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/mib_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/mib.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/parse.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/varbind_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/config_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/read_config.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/default_store.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/vacm.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/output_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/snmpv3_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpv3.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/transform_oids.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/keytools.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/scapi.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/lcd_time.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/snmpusm.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/var_struct.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/instance.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/scalar.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/watcher.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/null.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/old_api.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/read_only.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/row_merge.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/serialize.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/table.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/table_data.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/table_container.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/table_array.h
+./agent/nsTransactionTable.lo: ../../include/net-snmp/agent/mfd.h
+./agent/nsTransactionTable.lo: ./agent/nsTransactionTable.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/net-snmp-config.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/system/linux.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/system/sysv.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/system/generic.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/machine/generic.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/definitions.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/types.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmp_api.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/asn1.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmp.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/utilities.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmp_client.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/system.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/tools.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/int64.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/mt_support.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/callback.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/data_list.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/oid_stash.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/check_varbind.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/container.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/factory.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/container_iterator.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/container.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/version.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/session_api.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmp_service.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/pdu_api.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/mib_api.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/mib.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/parse.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/varbind_api.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/config_api.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/read_config.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/default_store.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/vacm.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/output_api.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/snmpv3_api.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmpv3.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/transform_oids.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/keytools.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/scapi.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/lcd_time.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/snmpusm.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/var_struct.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/instance.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/scalar.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/watcher.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/null.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/old_api.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/read_only.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/row_merge.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/serialize.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/table.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/table_data.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/table_container.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/table_array.h
+./agent/nsVacmAccessTable.lo: ../../include/net-snmp/agent/mfd.h
+./agent/nsVacmAccessTable.lo: ./agent/nsVacmAccessTable.h
+./agentx/agentx_config.lo: ../../include/net-snmp/net-snmp-config.h
+./agentx/agentx_config.lo: ../../include/net-snmp/system/linux.h
+./agentx/agentx_config.lo: ../../include/net-snmp/system/sysv.h
+./agentx/agentx_config.lo: ../../include/net-snmp/system/generic.h
+./agentx/agentx_config.lo: ../../include/net-snmp/machine/generic.h
+./agentx/agentx_config.lo: ../../include/net-snmp/net-snmp-includes.h
+./agentx/agentx_config.lo: ../../include/net-snmp/definitions.h
+./agentx/agentx_config.lo: ../../include/net-snmp/types.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/asn1.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_impl.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp-tc.h
+./agentx/agentx_config.lo: ../../include/net-snmp/utilities.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_client.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/system.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/tools.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/int64.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/mt_support.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/callback.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/data_list.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/oid_stash.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/check_varbind.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/container.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/factory.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_logging.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/container_binary_array.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/container_list_ssll.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/container_iterator.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/container.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_assert.h
+./agentx/agentx_config.lo: ../../include/net-snmp/version.h
+./agentx/agentx_config.lo: ../../include/net-snmp/session_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_transport.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_service.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/ucd_compat.h
+./agentx/agentx_config.lo: ../../include/net-snmp/pdu_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/mib_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/mib.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/parse.h
+./agentx/agentx_config.lo: ../../include/net-snmp/varbind_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/config_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/read_config.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/default_store.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_enum.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/vacm.h
+./agentx/agentx_config.lo: ../../include/net-snmp/output_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_debug.h
+./agentx/agentx_config.lo: ../../include/net-snmp/snmpv3_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpv3.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/transform_oids.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/keytools.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/scapi.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/lcd_time.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/snmpusm.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/agent_module_config.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/agent_handler.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/var_struct.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/agent_registry.h
+./agentx/agentx_config.lo: ../../include/net-snmp/library/fd_event_manager.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/ds_agent.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/agent_trap.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/all_helpers.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/instance.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/baby_steps.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/scalar.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/scalar_group.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/watcher.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/multiplexer.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/null.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/debug_handler.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/cache_handler.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/old_api.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/read_only.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/row_merge.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/serialize.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/table.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/table_data.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/table_dataset.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/table_tdata.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/table_iterator.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/table_container.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/table_array.h
+./agentx/agentx_config.lo: ../../include/net-snmp/agent/mfd.h
+./agentx/agentx_config.lo: ../../agent/snmpd.h agentx/agentx_config.h
+./agentx/agentx_config.lo: agentx/protocol.h
+./agentx/client.lo: ../../include/net-snmp/net-snmp-config.h
+./agentx/client.lo: ../../include/net-snmp/system/linux.h
+./agentx/client.lo: ../../include/net-snmp/system/sysv.h
+./agentx/client.lo: ../../include/net-snmp/system/generic.h
+./agentx/client.lo: ../../include/net-snmp/machine/generic.h
+./agentx/client.lo: ../../include/net-snmp/net-snmp-includes.h
+./agentx/client.lo: ../../include/net-snmp/definitions.h
+./agentx/client.lo: ../../include/net-snmp/types.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_api.h
+./agentx/client.lo: ../../include/net-snmp/library/asn1.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_impl.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp-tc.h
+./agentx/client.lo: ../../include/net-snmp/utilities.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_client.h
+./agentx/client.lo: ../../include/net-snmp/library/system.h
+./agentx/client.lo: ../../include/net-snmp/library/tools.h
+./agentx/client.lo: ../../include/net-snmp/library/int64.h
+./agentx/client.lo: ../../include/net-snmp/library/mt_support.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agentx/client.lo: ../../include/net-snmp/library/callback.h
+./agentx/client.lo: ../../include/net-snmp/library/data_list.h
+./agentx/client.lo: ../../include/net-snmp/library/oid_stash.h
+./agentx/client.lo: ../../include/net-snmp/library/check_varbind.h
+./agentx/client.lo: ../../include/net-snmp/library/container.h
+./agentx/client.lo: ../../include/net-snmp/library/factory.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_logging.h
+./agentx/client.lo: ../../include/net-snmp/library/container_binary_array.h
+./agentx/client.lo: ../../include/net-snmp/library/container_list_ssll.h
+./agentx/client.lo: ../../include/net-snmp/library/container_iterator.h
+./agentx/client.lo: ../../include/net-snmp/library/container.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_assert.h
+./agentx/client.lo: ../../include/net-snmp/version.h
+./agentx/client.lo: ../../include/net-snmp/session_api.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_transport.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_service.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agentx/client.lo: ../../include/net-snmp/library/ucd_compat.h
+./agentx/client.lo: ../../include/net-snmp/pdu_api.h
+./agentx/client.lo: ../../include/net-snmp/mib_api.h
+./agentx/client.lo: ../../include/net-snmp/library/mib.h
+./agentx/client.lo: ../../include/net-snmp/library/parse.h
+./agentx/client.lo: ../../include/net-snmp/varbind_api.h
+./agentx/client.lo: ../../include/net-snmp/config_api.h
+./agentx/client.lo: ../../include/net-snmp/library/read_config.h
+./agentx/client.lo: ../../include/net-snmp/library/default_store.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_enum.h
+./agentx/client.lo: ../../include/net-snmp/library/vacm.h
+./agentx/client.lo: ../../include/net-snmp/output_api.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_debug.h
+./agentx/client.lo: ../../include/net-snmp/snmpv3_api.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpv3.h
+./agentx/client.lo: ../../include/net-snmp/library/transform_oids.h
+./agentx/client.lo: ../../include/net-snmp/library/keytools.h
+./agentx/client.lo: ../../include/net-snmp/library/scapi.h
+./agentx/client.lo: ../../include/net-snmp/library/lcd_time.h
+./agentx/client.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agentx/client.lo: ../../include/net-snmp/library/snmpusm.h
+./agentx/client.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agentx/client.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agentx/client.lo: ../../include/net-snmp/agent/agent_module_config.h
+./agentx/client.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agentx/client.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agentx/client.lo: ../../include/net-snmp/agent/agent_handler.h
+./agentx/client.lo: ../../include/net-snmp/agent/var_struct.h
+./agentx/client.lo: ../../include/net-snmp/agent/agent_registry.h
+./agentx/client.lo: ../../include/net-snmp/library/fd_event_manager.h
+./agentx/client.lo: ../../include/net-snmp/agent/ds_agent.h
+./agentx/client.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agentx/client.lo: ../../include/net-snmp/agent/agent_trap.h
+./agentx/client.lo: ../../include/net-snmp/agent/all_helpers.h
+./agentx/client.lo: ../../include/net-snmp/agent/instance.h
+./agentx/client.lo: ../../include/net-snmp/agent/baby_steps.h
+./agentx/client.lo: ../../include/net-snmp/agent/scalar.h
+./agentx/client.lo: ../../include/net-snmp/agent/scalar_group.h
+./agentx/client.lo: ../../include/net-snmp/agent/watcher.h
+./agentx/client.lo: ../../include/net-snmp/agent/multiplexer.h
+./agentx/client.lo: ../../include/net-snmp/agent/null.h
+./agentx/client.lo: ../../include/net-snmp/agent/debug_handler.h
+./agentx/client.lo: ../../include/net-snmp/agent/cache_handler.h
+./agentx/client.lo: ../../include/net-snmp/agent/old_api.h
+./agentx/client.lo: ../../include/net-snmp/agent/read_only.h
+./agentx/client.lo: ../../include/net-snmp/agent/row_merge.h
+./agentx/client.lo: ../../include/net-snmp/agent/serialize.h
+./agentx/client.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agentx/client.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agentx/client.lo: ../../include/net-snmp/agent/table.h
+./agentx/client.lo: ../../include/net-snmp/agent/table_data.h
+./agentx/client.lo: ../../include/net-snmp/agent/table_dataset.h
+./agentx/client.lo: ../../include/net-snmp/agent/table_tdata.h
+./agentx/client.lo: ../../include/net-snmp/agent/table_iterator.h
+./agentx/client.lo: ../../include/net-snmp/agent/table_container.h
+./agentx/client.lo: ../../include/net-snmp/agent/table_array.h
+./agentx/client.lo: ../../include/net-snmp/agent/mfd.h
+./agentx/client.lo: ../../include/net-snmp/agent/agent_index.h
+./agentx/client.lo: agentx/protocol.h agentx/client.h agentx/subagent.h
+./agentx/master.lo: ../../include/net-snmp/net-snmp-config.h
+./agentx/master.lo: ../../include/net-snmp/system/linux.h
+./agentx/master.lo: ../../include/net-snmp/system/sysv.h
+./agentx/master.lo: ../../include/net-snmp/system/generic.h
+./agentx/master.lo: ../../include/net-snmp/machine/generic.h
+./agentx/master.lo: ../../include/net-snmp/net-snmp-includes.h
+./agentx/master.lo: ../../include/net-snmp/definitions.h
+./agentx/master.lo: ../../include/net-snmp/types.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_api.h
+./agentx/master.lo: ../../include/net-snmp/library/asn1.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_impl.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp-tc.h
+./agentx/master.lo: ../../include/net-snmp/utilities.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_client.h
+./agentx/master.lo: ../../include/net-snmp/library/system.h
+./agentx/master.lo: ../../include/net-snmp/library/tools.h
+./agentx/master.lo: ../../include/net-snmp/library/int64.h
+./agentx/master.lo: ../../include/net-snmp/library/mt_support.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agentx/master.lo: ../../include/net-snmp/library/callback.h
+./agentx/master.lo: ../../include/net-snmp/library/data_list.h
+./agentx/master.lo: ../../include/net-snmp/library/oid_stash.h
+./agentx/master.lo: ../../include/net-snmp/library/check_varbind.h
+./agentx/master.lo: ../../include/net-snmp/library/container.h
+./agentx/master.lo: ../../include/net-snmp/library/factory.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_logging.h
+./agentx/master.lo: ../../include/net-snmp/library/container_binary_array.h
+./agentx/master.lo: ../../include/net-snmp/library/container_list_ssll.h
+./agentx/master.lo: ../../include/net-snmp/library/container_iterator.h
+./agentx/master.lo: ../../include/net-snmp/library/container.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_assert.h
+./agentx/master.lo: ../../include/net-snmp/version.h
+./agentx/master.lo: ../../include/net-snmp/session_api.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_transport.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_service.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agentx/master.lo: ../../include/net-snmp/library/ucd_compat.h
+./agentx/master.lo: ../../include/net-snmp/pdu_api.h
+./agentx/master.lo: ../../include/net-snmp/mib_api.h
+./agentx/master.lo: ../../include/net-snmp/library/mib.h
+./agentx/master.lo: ../../include/net-snmp/library/parse.h
+./agentx/master.lo: ../../include/net-snmp/varbind_api.h
+./agentx/master.lo: ../../include/net-snmp/config_api.h
+./agentx/master.lo: ../../include/net-snmp/library/read_config.h
+./agentx/master.lo: ../../include/net-snmp/library/default_store.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_enum.h
+./agentx/master.lo: ../../include/net-snmp/library/vacm.h
+./agentx/master.lo: ../../include/net-snmp/output_api.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_debug.h
+./agentx/master.lo: ../../include/net-snmp/snmpv3_api.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpv3.h
+./agentx/master.lo: ../../include/net-snmp/library/transform_oids.h
+./agentx/master.lo: ../../include/net-snmp/library/keytools.h
+./agentx/master.lo: ../../include/net-snmp/library/scapi.h
+./agentx/master.lo: ../../include/net-snmp/library/lcd_time.h
+./agentx/master.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agentx/master.lo: ../../include/net-snmp/library/snmpusm.h
+./agentx/master.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agentx/master.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agentx/master.lo: ../../include/net-snmp/agent/agent_module_config.h
+./agentx/master.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agentx/master.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agentx/master.lo: ../../include/net-snmp/agent/agent_handler.h
+./agentx/master.lo: ../../include/net-snmp/agent/var_struct.h
+./agentx/master.lo: ../../include/net-snmp/agent/agent_registry.h
+./agentx/master.lo: ../../include/net-snmp/library/fd_event_manager.h
+./agentx/master.lo: ../../include/net-snmp/agent/ds_agent.h
+./agentx/master.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agentx/master.lo: ../../include/net-snmp/agent/agent_trap.h
+./agentx/master.lo: ../../include/net-snmp/agent/all_helpers.h
+./agentx/master.lo: ../../include/net-snmp/agent/instance.h
+./agentx/master.lo: ../../include/net-snmp/agent/baby_steps.h
+./agentx/master.lo: ../../include/net-snmp/agent/scalar.h
+./agentx/master.lo: ../../include/net-snmp/agent/scalar_group.h
+./agentx/master.lo: ../../include/net-snmp/agent/watcher.h
+./agentx/master.lo: ../../include/net-snmp/agent/multiplexer.h
+./agentx/master.lo: ../../include/net-snmp/agent/null.h
+./agentx/master.lo: ../../include/net-snmp/agent/debug_handler.h
+./agentx/master.lo: ../../include/net-snmp/agent/cache_handler.h
+./agentx/master.lo: ../../include/net-snmp/agent/old_api.h
+./agentx/master.lo: ../../include/net-snmp/agent/read_only.h
+./agentx/master.lo: ../../include/net-snmp/agent/row_merge.h
+./agentx/master.lo: ../../include/net-snmp/agent/serialize.h
+./agentx/master.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agentx/master.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agentx/master.lo: ../../include/net-snmp/agent/table.h
+./agentx/master.lo: ../../include/net-snmp/agent/table_data.h
+./agentx/master.lo: ../../include/net-snmp/agent/table_dataset.h
+./agentx/master.lo: ../../include/net-snmp/agent/table_tdata.h
+./agentx/master.lo: ../../include/net-snmp/agent/table_iterator.h
+./agentx/master.lo: ../../include/net-snmp/agent/table_container.h
+./agentx/master.lo: ../../include/net-snmp/agent/table_array.h
+./agentx/master.lo: ../../include/net-snmp/agent/mfd.h ../../agent/snmpd.h
+./agentx/master.lo: agentx/protocol.h agentx/master_admin.h
+./agentx/master_admin.lo: ../../include/net-snmp/net-snmp-config.h
+./agentx/master_admin.lo: ../../include/net-snmp/system/linux.h
+./agentx/master_admin.lo: ../../include/net-snmp/system/sysv.h
+./agentx/master_admin.lo: ../../include/net-snmp/system/generic.h
+./agentx/master_admin.lo: ../../include/net-snmp/machine/generic.h
+./agentx/master_admin.lo: ../../include/net-snmp/net-snmp-includes.h
+./agentx/master_admin.lo: ../../include/net-snmp/definitions.h
+./agentx/master_admin.lo: ../../include/net-snmp/types.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/asn1.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_impl.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp-tc.h
+./agentx/master_admin.lo: ../../include/net-snmp/utilities.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_client.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/system.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/tools.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/int64.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/mt_support.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/callback.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/data_list.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/oid_stash.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/check_varbind.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/container.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/factory.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_logging.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/container_binary_array.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/container_list_ssll.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/container_iterator.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/container.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_assert.h
+./agentx/master_admin.lo: ../../include/net-snmp/version.h
+./agentx/master_admin.lo: ../../include/net-snmp/session_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_transport.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_service.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/ucd_compat.h
+./agentx/master_admin.lo: ../../include/net-snmp/pdu_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/mib_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/mib.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/parse.h
+./agentx/master_admin.lo: ../../include/net-snmp/varbind_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/config_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/read_config.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/default_store.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_enum.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/vacm.h
+./agentx/master_admin.lo: ../../include/net-snmp/output_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_debug.h
+./agentx/master_admin.lo: ../../include/net-snmp/snmpv3_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpv3.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/transform_oids.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/keytools.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/scapi.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/lcd_time.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/snmpusm.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/agent_module_config.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/agent_handler.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/var_struct.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/agent_registry.h
+./agentx/master_admin.lo: ../../include/net-snmp/library/fd_event_manager.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/ds_agent.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/agent_trap.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/all_helpers.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/instance.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/baby_steps.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/scalar.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/scalar_group.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/watcher.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/multiplexer.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/null.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/debug_handler.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/cache_handler.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/old_api.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/read_only.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/row_merge.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/serialize.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/table.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/table_data.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/table_dataset.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/table_tdata.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/table_iterator.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/table_container.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/table_array.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/mfd.h
+./agentx/master_admin.lo: agentx/protocol.h agentx/client.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/agent_index.h
+./agentx/master_admin.lo: ../../include/net-snmp/agent/agent_callbacks.h
+./agentx/master_admin.lo: mibII/sysORTable.h ./agentx/master.h
+./agentx/protocol.lo: ../../include/net-snmp/net-snmp-config.h
+./agentx/protocol.lo: ../../include/net-snmp/system/linux.h
+./agentx/protocol.lo: ../../include/net-snmp/system/sysv.h
+./agentx/protocol.lo: ../../include/net-snmp/system/generic.h
+./agentx/protocol.lo: ../../include/net-snmp/machine/generic.h
+./agentx/protocol.lo: ../../include/net-snmp/net-snmp-includes.h
+./agentx/protocol.lo: ../../include/net-snmp/definitions.h
+./agentx/protocol.lo: ../../include/net-snmp/types.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_api.h
+./agentx/protocol.lo: ../../include/net-snmp/library/asn1.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_impl.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp-tc.h
+./agentx/protocol.lo: ../../include/net-snmp/utilities.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_client.h
+./agentx/protocol.lo: ../../include/net-snmp/library/system.h
+./agentx/protocol.lo: ../../include/net-snmp/library/tools.h
+./agentx/protocol.lo: ../../include/net-snmp/library/int64.h
+./agentx/protocol.lo: ../../include/net-snmp/library/mt_support.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agentx/protocol.lo: ../../include/net-snmp/library/callback.h
+./agentx/protocol.lo: ../../include/net-snmp/library/data_list.h
+./agentx/protocol.lo: ../../include/net-snmp/library/oid_stash.h
+./agentx/protocol.lo: ../../include/net-snmp/library/check_varbind.h
+./agentx/protocol.lo: ../../include/net-snmp/library/container.h
+./agentx/protocol.lo: ../../include/net-snmp/library/factory.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_logging.h
+./agentx/protocol.lo: ../../include/net-snmp/library/container_binary_array.h
+./agentx/protocol.lo: ../../include/net-snmp/library/container_list_ssll.h
+./agentx/protocol.lo: ../../include/net-snmp/library/container_iterator.h
+./agentx/protocol.lo: ../../include/net-snmp/library/container.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_assert.h
+./agentx/protocol.lo: ../../include/net-snmp/version.h
+./agentx/protocol.lo: ../../include/net-snmp/session_api.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_transport.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_service.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agentx/protocol.lo: ../../include/net-snmp/library/ucd_compat.h
+./agentx/protocol.lo: ../../include/net-snmp/pdu_api.h
+./agentx/protocol.lo: ../../include/net-snmp/mib_api.h
+./agentx/protocol.lo: ../../include/net-snmp/library/mib.h
+./agentx/protocol.lo: ../../include/net-snmp/library/parse.h
+./agentx/protocol.lo: ../../include/net-snmp/varbind_api.h
+./agentx/protocol.lo: ../../include/net-snmp/config_api.h
+./agentx/protocol.lo: ../../include/net-snmp/library/read_config.h
+./agentx/protocol.lo: ../../include/net-snmp/library/default_store.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_enum.h
+./agentx/protocol.lo: ../../include/net-snmp/library/vacm.h
+./agentx/protocol.lo: ../../include/net-snmp/output_api.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_debug.h
+./agentx/protocol.lo: ../../include/net-snmp/snmpv3_api.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpv3.h
+./agentx/protocol.lo: ../../include/net-snmp/library/transform_oids.h
+./agentx/protocol.lo: ../../include/net-snmp/library/keytools.h
+./agentx/protocol.lo: ../../include/net-snmp/library/scapi.h
+./agentx/protocol.lo: ../../include/net-snmp/library/lcd_time.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agentx/protocol.lo: ../../include/net-snmp/library/snmpusm.h
+./agentx/protocol.lo: agentx/protocol.h
+./agentx/subagent.lo: ../../include/net-snmp/net-snmp-config.h
+./agentx/subagent.lo: ../../include/net-snmp/system/linux.h
+./agentx/subagent.lo: ../../include/net-snmp/system/sysv.h
+./agentx/subagent.lo: ../../include/net-snmp/system/generic.h
+./agentx/subagent.lo: ../../include/net-snmp/machine/generic.h
+./agentx/subagent.lo: ../../include/net-snmp/net-snmp-includes.h
+./agentx/subagent.lo: ../../include/net-snmp/definitions.h
+./agentx/subagent.lo: ../../include/net-snmp/types.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_api.h
+./agentx/subagent.lo: ../../include/net-snmp/library/asn1.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_impl.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp-tc.h
+./agentx/subagent.lo: ../../include/net-snmp/utilities.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_client.h
+./agentx/subagent.lo: ../../include/net-snmp/library/system.h
+./agentx/subagent.lo: ../../include/net-snmp/library/tools.h
+./agentx/subagent.lo: ../../include/net-snmp/library/int64.h
+./agentx/subagent.lo: ../../include/net-snmp/library/mt_support.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_alarm.h
+./agentx/subagent.lo: ../../include/net-snmp/library/callback.h
+./agentx/subagent.lo: ../../include/net-snmp/library/data_list.h
+./agentx/subagent.lo: ../../include/net-snmp/library/oid_stash.h
+./agentx/subagent.lo: ../../include/net-snmp/library/check_varbind.h
+./agentx/subagent.lo: ../../include/net-snmp/library/container.h
+./agentx/subagent.lo: ../../include/net-snmp/library/factory.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_logging.h
+./agentx/subagent.lo: ../../include/net-snmp/library/container_binary_array.h
+./agentx/subagent.lo: ../../include/net-snmp/library/container_list_ssll.h
+./agentx/subagent.lo: ../../include/net-snmp/library/container_iterator.h
+./agentx/subagent.lo: ../../include/net-snmp/library/container.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_assert.h
+./agentx/subagent.lo: ../../include/net-snmp/version.h
+./agentx/subagent.lo: ../../include/net-snmp/session_api.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_transport.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_service.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./agentx/subagent.lo: ../../include/net-snmp/library/ucd_compat.h
+./agentx/subagent.lo: ../../include/net-snmp/pdu_api.h
+./agentx/subagent.lo: ../../include/net-snmp/mib_api.h
+./agentx/subagent.lo: ../../include/net-snmp/library/mib.h
+./agentx/subagent.lo: ../../include/net-snmp/library/parse.h
+./agentx/subagent.lo: ../../include/net-snmp/varbind_api.h
+./agentx/subagent.lo: ../../include/net-snmp/config_api.h
+./agentx/subagent.lo: ../../include/net-snmp/library/read_config.h
+./agentx/subagent.lo: ../../include/net-snmp/library/default_store.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_enum.h
+./agentx/subagent.lo: ../../include/net-snmp/library/vacm.h
+./agentx/subagent.lo: ../../include/net-snmp/output_api.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_debug.h
+./agentx/subagent.lo: ../../include/net-snmp/snmpv3_api.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpv3.h
+./agentx/subagent.lo: ../../include/net-snmp/library/transform_oids.h
+./agentx/subagent.lo: ../../include/net-snmp/library/keytools.h
+./agentx/subagent.lo: ../../include/net-snmp/library/scapi.h
+./agentx/subagent.lo: ../../include/net-snmp/library/lcd_time.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmp_secmod.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./agentx/subagent.lo: ../../include/net-snmp/library/snmpusm.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/mib_module_config.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/agent_module_config.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/snmp_agent.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/snmp_vars.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/agent_handler.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/var_struct.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/agent_registry.h
+./agentx/subagent.lo: ../../include/net-snmp/library/fd_event_manager.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/ds_agent.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/agent_read_config.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/agent_trap.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/all_helpers.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/instance.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/baby_steps.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/scalar.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/scalar_group.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/watcher.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/multiplexer.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/null.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/debug_handler.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/cache_handler.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/old_api.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/read_only.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/row_merge.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/serialize.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/mode_end_call.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/table.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/table_data.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/table_dataset.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/table_tdata.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/table_iterator.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/table_container.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/table_array.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/mfd.h ../../agent/snmpd.h
+./agentx/subagent.lo: agentx/protocol.h agentx/client.h
+./agentx/subagent.lo: agentx/agentx_config.h
+./agentx/subagent.lo: ../../include/net-snmp/agent/agent_callbacks.h
+./agentx/subagent.lo: mibII/sysORTable.h ./agentx/subagent.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/net-snmp-config.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/system/linux.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/system/sysv.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/system/generic.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/machine/generic.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/definitions.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/types.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/asn1.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/utilities.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_client.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/system.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/tools.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/int64.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/mt_support.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/callback.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/data_list.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/oid_stash.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/check_varbind.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/container.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/factory.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/container_iterator.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/container.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/version.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/session_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_service.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/pdu_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/mib_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/mib.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/parse.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/varbind_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/config_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/read_config.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/default_store.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/vacm.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/output_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/snmpv3_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpv3.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/transform_oids.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/keytools.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/scapi.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/lcd_time.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/snmpusm.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/var_struct.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/instance.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/scalar.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/watcher.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/null.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/old_api.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/read_only.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/row_merge.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/serialize.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/table.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/table_data.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/table_container.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/table_array.h
+./disman/mteEventNotificationTable.lo: ../../include/net-snmp/agent/mfd.h
+./disman/mteEventNotificationTable.lo: ./disman/mteEventNotificationTable.h
+./disman/mteEventTable.lo: ../../include/net-snmp/net-snmp-config.h
+./disman/mteEventTable.lo: ../../include/net-snmp/system/linux.h
+./disman/mteEventTable.lo: ../../include/net-snmp/system/sysv.h
+./disman/mteEventTable.lo: ../../include/net-snmp/system/generic.h
+./disman/mteEventTable.lo: ../../include/net-snmp/machine/generic.h
+./disman/mteEventTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./disman/mteEventTable.lo: ../../include/net-snmp/definitions.h
+./disman/mteEventTable.lo: ../../include/net-snmp/types.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/asn1.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./disman/mteEventTable.lo: ../../include/net-snmp/utilities.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_client.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/system.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/tools.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/int64.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/mt_support.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/callback.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/data_list.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/oid_stash.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/check_varbind.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/container.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/factory.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/container_iterator.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/container.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./disman/mteEventTable.lo: ../../include/net-snmp/version.h
+./disman/mteEventTable.lo: ../../include/net-snmp/session_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_service.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./disman/mteEventTable.lo: ../../include/net-snmp/pdu_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/mib_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/mib.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/parse.h
+./disman/mteEventTable.lo: ../../include/net-snmp/varbind_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/config_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/read_config.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/default_store.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/vacm.h
+./disman/mteEventTable.lo: ../../include/net-snmp/output_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./disman/mteEventTable.lo: ../../include/net-snmp/snmpv3_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpv3.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/transform_oids.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/keytools.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/scapi.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/lcd_time.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/snmpusm.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/var_struct.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./disman/mteEventTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/instance.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/scalar.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/watcher.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/null.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/old_api.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/read_only.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/row_merge.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/serialize.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/table.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/table_data.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/table_container.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/table_array.h
+./disman/mteEventTable.lo: ../../include/net-snmp/agent/mfd.h
+./disman/mteEventTable.lo: ./disman/mteTriggerTable.h
+./disman/mteEventTable.lo: ./disman/mteEventTable.h
+./disman/mteEventTable.lo: ./disman/mteEventNotificationTable.h
+./disman/mteEventTable.lo: ./disman/mteObjectsTable.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/net-snmp-config.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/system/linux.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/system/sysv.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/system/generic.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/machine/generic.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/definitions.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/types.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/asn1.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/utilities.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_client.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/system.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/tools.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/int64.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/mt_support.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/callback.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/data_list.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/oid_stash.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/check_varbind.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/container.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/factory.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/container_iterator.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/container.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/version.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/session_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_service.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/pdu_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/mib_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/mib.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/parse.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/varbind_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/config_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/read_config.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/default_store.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/vacm.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/output_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/snmpv3_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpv3.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/transform_oids.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/keytools.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/scapi.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/lcd_time.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/snmpusm.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/var_struct.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/instance.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/scalar.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/watcher.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/null.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/old_api.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/read_only.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/row_merge.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/serialize.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/table.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/table_data.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/table_container.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/table_array.h
+./disman/mteObjectsTable.lo: ../../include/net-snmp/agent/mfd.h
+./disman/mteObjectsTable.lo: header_complex.h ./disman/mteTriggerTable.h
+./disman/mteObjectsTable.lo: ./disman/mteObjectsTable.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/net-snmp-config.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/system/linux.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/system/sysv.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/system/generic.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/machine/generic.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/definitions.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/types.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/asn1.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/utilities.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_client.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/system.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/tools.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/int64.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/mt_support.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/callback.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/data_list.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/oid_stash.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/check_varbind.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/container.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/factory.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/container_iterator.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/container.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/version.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/session_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_service.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/pdu_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/mib_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/mib.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/parse.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/varbind_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/config_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/read_config.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/default_store.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/vacm.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/output_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/snmpv3_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpv3.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/transform_oids.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/keytools.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/scapi.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/lcd_time.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/snmpusm.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/var_struct.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/instance.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/scalar.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/watcher.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/null.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/old_api.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/read_only.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/row_merge.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/serialize.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/table.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/table_data.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/table_container.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/table_array.h
+./disman/mteTriggerBooleanTable.lo: ../../include/net-snmp/agent/mfd.h
+./disman/mteTriggerBooleanTable.lo: header_complex.h
+./disman/mteTriggerBooleanTable.lo: ./disman/mteTriggerBooleanTable.h
+./disman/mteTriggerBooleanTable.lo: ./disman/mteTriggerTable.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/net-snmp-config.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/system/linux.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/system/sysv.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/system/generic.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/machine/generic.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/definitions.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/types.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/asn1.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/utilities.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_client.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/system.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/tools.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/int64.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/mt_support.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/callback.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/data_list.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/oid_stash.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/check_varbind.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/container.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/factory.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/container_iterator.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/container.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/version.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/session_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_service.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/pdu_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/mib_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/mib.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/parse.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/varbind_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/config_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/read_config.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/default_store.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/vacm.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/output_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/snmpv3_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpv3.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/transform_oids.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/keytools.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/scapi.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/lcd_time.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/snmpusm.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/var_struct.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/instance.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/scalar.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/watcher.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/null.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/old_api.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/read_only.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/row_merge.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/serialize.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/table.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/table_data.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/table_container.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/table_array.h
+./disman/mteTriggerDeltaTable.lo: ../../include/net-snmp/agent/mfd.h
+./disman/mteTriggerDeltaTable.lo: header_complex.h
+./disman/mteTriggerDeltaTable.lo: ./disman/mteTriggerDeltaTable.h
+./disman/mteTriggerDeltaTable.lo: ./disman/mteTriggerTable.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/net-snmp-config.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/system/linux.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/system/sysv.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/system/generic.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/machine/generic.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/definitions.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/types.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/asn1.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/utilities.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_client.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/system.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/tools.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/int64.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/mt_support.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/callback.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/data_list.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/oid_stash.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/check_varbind.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/container.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/factory.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/container_iterator.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/container.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/version.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/session_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_service.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/pdu_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/mib_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/mib.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/parse.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/varbind_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/config_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/read_config.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/default_store.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/vacm.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/output_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/snmpv3_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpv3.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/transform_oids.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/keytools.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/scapi.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/lcd_time.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/snmpusm.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/var_struct.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/instance.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/scalar.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/watcher.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/null.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/old_api.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/read_only.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/row_merge.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/serialize.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/table.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/table_data.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/table_container.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/table_array.h
+./disman/mteTriggerExistenceTable.lo: ../../include/net-snmp/agent/mfd.h
+./disman/mteTriggerExistenceTable.lo: header_complex.h
+./disman/mteTriggerExistenceTable.lo: ./disman/mteTriggerExistenceTable.h
+./disman/mteTriggerExistenceTable.lo: ./disman/mteTriggerTable.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/net-snmp-config.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/system/linux.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/system/sysv.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/system/generic.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/machine/generic.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/definitions.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/types.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/asn1.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/utilities.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_client.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/system.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/tools.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/int64.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/mt_support.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/callback.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/data_list.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/oid_stash.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/check_varbind.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/container.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/factory.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/container_iterator.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/container.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/version.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/session_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_service.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/pdu_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/mib_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/mib.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/parse.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/varbind_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/config_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/read_config.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/default_store.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/vacm.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/output_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/snmpv3_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpv3.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/transform_oids.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/keytools.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/scapi.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/lcd_time.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/snmpusm.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/var_struct.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/instance.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/scalar.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/watcher.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/null.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/old_api.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/read_only.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/row_merge.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/serialize.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/table.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/table_data.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/table_container.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/table_array.h
+./disman/mteTriggerTable.lo: ../../include/net-snmp/agent/mfd.h
+./disman/mteTriggerTable.lo: header_complex.h ./disman/mteTriggerTable.h
+./disman/mteTriggerTable.lo: ./disman/mteTriggerBooleanTable.h
+./disman/mteTriggerTable.lo: ./disman/mteTriggerDeltaTable.h
+./disman/mteTriggerTable.lo: ./disman/mteTriggerExistenceTable.h
+./disman/mteTriggerTable.lo: ./disman/mteTriggerThresholdTable.h
+./disman/mteTriggerTable.lo: ./disman/mteEventTable.h
+./disman/mteTriggerTable.lo: ./disman/mteObjectsTable.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/net-snmp-config.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/system/linux.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/system/sysv.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/system/generic.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/machine/generic.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/definitions.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/types.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/asn1.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/utilities.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_client.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/system.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/tools.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/int64.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/mt_support.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/callback.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/data_list.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/oid_stash.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/check_varbind.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/container.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/factory.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/container_iterator.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/container.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/version.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/session_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_service.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/pdu_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/mib_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/mib.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/parse.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/varbind_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/config_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/read_config.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/default_store.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/vacm.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/output_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/snmpv3_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpv3.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/transform_oids.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/keytools.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/scapi.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/lcd_time.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/snmpusm.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/var_struct.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/instance.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/scalar.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/watcher.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/null.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/old_api.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/read_only.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/row_merge.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/serialize.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/table.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/table_data.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/table_container.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/table_array.h
+./disman/mteTriggerThresholdTable.lo: ../../include/net-snmp/agent/mfd.h
+./disman/mteTriggerThresholdTable.lo: header_complex.h
+./disman/mteTriggerThresholdTable.lo: ./disman/mteTriggerThresholdTable.h
+./disman/mteTriggerThresholdTable.lo: ./disman/mteTriggerTable.h
+./examples/data_set.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/data_set.lo: ../../include/net-snmp/system/linux.h
+./examples/data_set.lo: ../../include/net-snmp/system/sysv.h
+./examples/data_set.lo: ../../include/net-snmp/system/generic.h
+./examples/data_set.lo: ../../include/net-snmp/machine/generic.h
+./examples/data_set.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/data_set.lo: ../../include/net-snmp/definitions.h
+./examples/data_set.lo: ../../include/net-snmp/types.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/data_set.lo: ../../include/net-snmp/library/asn1.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/data_set.lo: ../../include/net-snmp/utilities.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/data_set.lo: ../../include/net-snmp/library/system.h
+./examples/data_set.lo: ../../include/net-snmp/library/tools.h
+./examples/data_set.lo: ../../include/net-snmp/library/int64.h
+./examples/data_set.lo: ../../include/net-snmp/library/mt_support.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/data_set.lo: ../../include/net-snmp/library/callback.h
+./examples/data_set.lo: ../../include/net-snmp/library/data_list.h
+./examples/data_set.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/data_set.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/data_set.lo: ../../include/net-snmp/library/container.h
+./examples/data_set.lo: ../../include/net-snmp/library/factory.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/data_set.lo: ../../include/net-snmp/library/container_binary_array.h
+./examples/data_set.lo: ../../include/net-snmp/library/container_list_ssll.h
+./examples/data_set.lo: ../../include/net-snmp/library/container_iterator.h
+./examples/data_set.lo: ../../include/net-snmp/library/container.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_assert.h
+./examples/data_set.lo: ../../include/net-snmp/version.h
+./examples/data_set.lo: ../../include/net-snmp/session_api.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_service.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/data_set.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/data_set.lo: ../../include/net-snmp/pdu_api.h
+./examples/data_set.lo: ../../include/net-snmp/mib_api.h
+./examples/data_set.lo: ../../include/net-snmp/library/mib.h
+./examples/data_set.lo: ../../include/net-snmp/library/parse.h
+./examples/data_set.lo: ../../include/net-snmp/varbind_api.h
+./examples/data_set.lo: ../../include/net-snmp/config_api.h
+./examples/data_set.lo: ../../include/net-snmp/library/read_config.h
+./examples/data_set.lo: ../../include/net-snmp/library/default_store.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/data_set.lo: ../../include/net-snmp/library/vacm.h
+./examples/data_set.lo: ../../include/net-snmp/output_api.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/data_set.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/data_set.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/data_set.lo: ../../include/net-snmp/library/keytools.h
+./examples/data_set.lo: ../../include/net-snmp/library/scapi.h
+./examples/data_set.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/data_set.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/data_set.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./examples/data_set.lo: ../../include/net-snmp/agent/mib_module_config.h
+./examples/data_set.lo: ../../include/net-snmp/agent/agent_module_config.h
+./examples/data_set.lo: ../../include/net-snmp/agent/snmp_agent.h
+./examples/data_set.lo: ../../include/net-snmp/agent/snmp_vars.h
+./examples/data_set.lo: ../../include/net-snmp/agent/agent_handler.h
+./examples/data_set.lo: ../../include/net-snmp/agent/var_struct.h
+./examples/data_set.lo: ../../include/net-snmp/agent/agent_registry.h
+./examples/data_set.lo: ../../include/net-snmp/library/fd_event_manager.h
+./examples/data_set.lo: ../../include/net-snmp/agent/ds_agent.h
+./examples/data_set.lo: ../../include/net-snmp/agent/agent_read_config.h
+./examples/data_set.lo: ../../include/net-snmp/agent/agent_trap.h
+./examples/data_set.lo: ../../include/net-snmp/agent/all_helpers.h
+./examples/data_set.lo: ../../include/net-snmp/agent/instance.h
+./examples/data_set.lo: ../../include/net-snmp/agent/baby_steps.h
+./examples/data_set.lo: ../../include/net-snmp/agent/scalar.h
+./examples/data_set.lo: ../../include/net-snmp/agent/scalar_group.h
+./examples/data_set.lo: ../../include/net-snmp/agent/watcher.h
+./examples/data_set.lo: ../../include/net-snmp/agent/multiplexer.h
+./examples/data_set.lo: ../../include/net-snmp/agent/null.h
+./examples/data_set.lo: ../../include/net-snmp/agent/debug_handler.h
+./examples/data_set.lo: ../../include/net-snmp/agent/cache_handler.h
+./examples/data_set.lo: ../../include/net-snmp/agent/old_api.h
+./examples/data_set.lo: ../../include/net-snmp/agent/read_only.h
+./examples/data_set.lo: ../../include/net-snmp/agent/row_merge.h
+./examples/data_set.lo: ../../include/net-snmp/agent/serialize.h
+./examples/data_set.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./examples/data_set.lo: ../../include/net-snmp/agent/mode_end_call.h
+./examples/data_set.lo: ../../include/net-snmp/agent/table.h
+./examples/data_set.lo: ../../include/net-snmp/agent/table_data.h
+./examples/data_set.lo: ../../include/net-snmp/agent/table_dataset.h
+./examples/data_set.lo: ../../include/net-snmp/agent/table_tdata.h
+./examples/data_set.lo: ../../include/net-snmp/agent/table_iterator.h
+./examples/data_set.lo: ../../include/net-snmp/agent/table_container.h
+./examples/data_set.lo: ../../include/net-snmp/agent/table_array.h
+./examples/data_set.lo: ../../include/net-snmp/agent/mfd.h
+./examples/delayed_instance.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/delayed_instance.lo: ../../include/net-snmp/system/linux.h
+./examples/delayed_instance.lo: ../../include/net-snmp/system/sysv.h
+./examples/delayed_instance.lo: ../../include/net-snmp/system/generic.h
+./examples/delayed_instance.lo: ../../include/net-snmp/machine/generic.h
+./examples/delayed_instance.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/delayed_instance.lo: ../../include/net-snmp/definitions.h
+./examples/delayed_instance.lo: ../../include/net-snmp/types.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/asn1.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/delayed_instance.lo: ../../include/net-snmp/utilities.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/system.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/tools.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/int64.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/mt_support.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/callback.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/data_list.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/container.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/factory.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/container_binary_array.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/container_list_ssll.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/container_iterator.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/container.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_assert.h
+./examples/delayed_instance.lo: ../../include/net-snmp/version.h
+./examples/delayed_instance.lo: ../../include/net-snmp/session_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_service.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/delayed_instance.lo: ../../include/net-snmp/pdu_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/mib_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/mib.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/parse.h
+./examples/delayed_instance.lo: ../../include/net-snmp/varbind_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/config_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/read_config.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/default_store.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/vacm.h
+./examples/delayed_instance.lo: ../../include/net-snmp/output_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/delayed_instance.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/keytools.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/scapi.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/mib_module_config.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/agent_module_config.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/snmp_agent.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/snmp_vars.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/agent_handler.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/var_struct.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/agent_registry.h
+./examples/delayed_instance.lo: ../../include/net-snmp/library/fd_event_manager.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/ds_agent.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/agent_read_config.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/agent_trap.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/all_helpers.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/instance.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/baby_steps.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/scalar.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/scalar_group.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/watcher.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/multiplexer.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/null.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/debug_handler.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/cache_handler.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/old_api.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/read_only.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/row_merge.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/serialize.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/mode_end_call.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/table.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/table_data.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/table_dataset.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/table_tdata.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/table_iterator.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/table_container.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/table_array.h
+./examples/delayed_instance.lo: ../../include/net-snmp/agent/mfd.h
+./examples/delayed_instance.lo: ./examples/delayed_instance.h
+./examples/example.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/example.lo: ../../include/net-snmp/system/linux.h
+./examples/example.lo: ../../include/net-snmp/system/sysv.h
+./examples/example.lo: ../../include/net-snmp/system/generic.h
+./examples/example.lo: ../../include/net-snmp/machine/generic.h
+./examples/example.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/example.lo: ../../include/net-snmp/definitions.h
+./examples/example.lo: ../../include/net-snmp/types.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/example.lo: ../../include/net-snmp/library/asn1.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/example.lo: ../../include/net-snmp/library/snmp.h
+./examples/example.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/example.lo: ../../include/net-snmp/utilities.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/example.lo: ../../include/net-snmp/library/system.h
+./examples/example.lo: ../../include/net-snmp/library/tools.h
+./examples/example.lo: ../../include/net-snmp/library/int64.h
+./examples/example.lo: ../../include/net-snmp/library/mt_support.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/example.lo: ../../include/net-snmp/library/callback.h
+./examples/example.lo: ../../include/net-snmp/library/data_list.h
+./examples/example.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/example.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/example.lo: ../../include/net-snmp/library/container.h
+./examples/example.lo: ../../include/net-snmp/library/factory.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/example.lo: ../../include/net-snmp/library/container_binary_array.h
+./examples/example.lo: ../../include/net-snmp/library/container_list_ssll.h
+./examples/example.lo: ../../include/net-snmp/library/container_iterator.h
+./examples/example.lo: ../../include/net-snmp/library/container.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_assert.h
+./examples/example.lo: ../../include/net-snmp/version.h
+./examples/example.lo: ../../include/net-snmp/session_api.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_service.h
+./examples/example.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/example.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/example.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/example.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/example.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/example.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/example.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/example.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/example.lo: ../../include/net-snmp/pdu_api.h
+./examples/example.lo: ../../include/net-snmp/mib_api.h
+./examples/example.lo: ../../include/net-snmp/library/mib.h
+./examples/example.lo: ../../include/net-snmp/library/parse.h
+./examples/example.lo: ../../include/net-snmp/varbind_api.h
+./examples/example.lo: ../../include/net-snmp/config_api.h
+./examples/example.lo: ../../include/net-snmp/library/read_config.h
+./examples/example.lo: ../../include/net-snmp/library/default_store.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/example.lo: ../../include/net-snmp/library/vacm.h
+./examples/example.lo: ../../include/net-snmp/output_api.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/example.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/example.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/example.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/example.lo: ../../include/net-snmp/library/keytools.h
+./examples/example.lo: ../../include/net-snmp/library/scapi.h
+./examples/example.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/example.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/example.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/example.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/example.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./examples/example.lo: ../../include/net-snmp/agent/mib_module_config.h
+./examples/example.lo: ../../include/net-snmp/agent/agent_module_config.h
+./examples/example.lo: ../../include/net-snmp/agent/snmp_agent.h
+./examples/example.lo: ../../include/net-snmp/agent/snmp_vars.h
+./examples/example.lo: ../../include/net-snmp/agent/agent_handler.h
+./examples/example.lo: ../../include/net-snmp/agent/var_struct.h
+./examples/example.lo: ../../include/net-snmp/agent/agent_registry.h
+./examples/example.lo: ../../include/net-snmp/library/fd_event_manager.h
+./examples/example.lo: ../../include/net-snmp/agent/ds_agent.h
+./examples/example.lo: ../../include/net-snmp/agent/agent_read_config.h
+./examples/example.lo: ../../include/net-snmp/agent/agent_trap.h
+./examples/example.lo: ../../include/net-snmp/agent/all_helpers.h
+./examples/example.lo: ../../include/net-snmp/agent/instance.h
+./examples/example.lo: ../../include/net-snmp/agent/baby_steps.h
+./examples/example.lo: ../../include/net-snmp/agent/scalar.h
+./examples/example.lo: ../../include/net-snmp/agent/scalar_group.h
+./examples/example.lo: ../../include/net-snmp/agent/watcher.h
+./examples/example.lo: ../../include/net-snmp/agent/multiplexer.h
+./examples/example.lo: ../../include/net-snmp/agent/null.h
+./examples/example.lo: ../../include/net-snmp/agent/debug_handler.h
+./examples/example.lo: ../../include/net-snmp/agent/cache_handler.h
+./examples/example.lo: ../../include/net-snmp/agent/old_api.h
+./examples/example.lo: ../../include/net-snmp/agent/read_only.h
+./examples/example.lo: ../../include/net-snmp/agent/row_merge.h
+./examples/example.lo: ../../include/net-snmp/agent/serialize.h
+./examples/example.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./examples/example.lo: ../../include/net-snmp/agent/mode_end_call.h
+./examples/example.lo: ../../include/net-snmp/agent/table.h
+./examples/example.lo: ../../include/net-snmp/agent/table_data.h
+./examples/example.lo: ../../include/net-snmp/agent/table_dataset.h
+./examples/example.lo: ../../include/net-snmp/agent/table_tdata.h
+./examples/example.lo: ../../include/net-snmp/agent/table_iterator.h
+./examples/example.lo: ../../include/net-snmp/agent/table_container.h
+./examples/example.lo: ../../include/net-snmp/agent/table_array.h
+./examples/example.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h
+./examples/example.lo: struct.h ./examples/example.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/system/linux.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/system/sysv.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/system/generic.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/machine/generic.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/definitions.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/types.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/asn1.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmp.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/utilities.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/system.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/tools.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/int64.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/mt_support.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/callback.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/data_list.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/container.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/factory.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/container_iterator.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/container.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/version.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/session_api.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmp_service.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/pdu_api.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/mib_api.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/mib.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/parse.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/varbind_api.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/config_api.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/read_config.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/default_store.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/vacm.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/output_api.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/keytools.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/scapi.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/var_struct.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/instance.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/scalar.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/watcher.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/null.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/old_api.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/read_only.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/row_merge.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/serialize.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/table.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/table_data.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/table_container.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/table_array.h
+./examples/netSnmpHostsTable.lo: ../../include/net-snmp/agent/mfd.h
+./examples/netSnmpHostsTable.lo: ./examples/netSnmpHostsTable.h
+./examples/netSnmpHostsTable.lo: ./examples/netSnmpHostsTable_columns.h
+./examples/netSnmpHostsTable.lo: ./examples/netSnmpHostsTable_enums.h
+./examples/netSnmpHostsTable.lo: ./examples/netSnmpHostsTable_checkfns.h
+./examples/netSnmpHostsTable.lo: ./examples/netSnmpHostsTable_access.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/system/linux.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/system/sysv.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/system/generic.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/machine/generic.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/definitions.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/types.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/asn1.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmp.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/utilities.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/system.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/tools.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/int64.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/mt_support.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/callback.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/data_list.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/container.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/factory.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/container_binary_array.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/container_list_ssll.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/container_iterator.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/container.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmp_assert.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/version.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/session_api.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmp_service.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/pdu_api.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/mib_api.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/mib.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/parse.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/varbind_api.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/config_api.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/read_config.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/default_store.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/vacm.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/output_api.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/keytools.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/scapi.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/mib_module_config.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/agent_module_config.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/snmp_agent.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/snmp_vars.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/agent_handler.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/var_struct.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/agent_registry.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/library/fd_event_manager.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/ds_agent.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/agent_read_config.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/agent_trap.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/all_helpers.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/instance.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/baby_steps.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/scalar.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/scalar_group.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/watcher.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/multiplexer.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/null.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/debug_handler.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/cache_handler.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/old_api.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/read_only.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/row_merge.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/serialize.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/mode_end_call.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/table.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/table_data.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/table_dataset.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/table_tdata.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/table_iterator.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/table_container.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/table_array.h
+./examples/netSnmpHostsTable_access.lo: ../../include/net-snmp/agent/mfd.h
+./examples/netSnmpHostsTable_access.lo: ./examples/netSnmpHostsTable_access.h
+./examples/netSnmpHostsTable_access.lo: ./examples/netSnmpHostsTable_enums.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/system/linux.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/system/sysv.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/system/generic.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/machine/generic.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/definitions.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/types.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/asn1.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmp.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/utilities.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/system.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/tools.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/int64.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/mt_support.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/callback.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/data_list.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/container.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/factory.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/container_binary_array.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/container_list_ssll.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/container_iterator.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/container.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmp_assert.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/version.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/session_api.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmp_service.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/pdu_api.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/mib_api.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/mib.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/parse.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/varbind_api.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/config_api.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/read_config.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/default_store.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/vacm.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/output_api.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/keytools.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/scapi.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/netSnmpHostsTable_checkfns.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/netSnmpHostsTable_checkfns.lo: ./examples/netSnmpHostsTable_checkfns.h
+./examples/netSnmpHostsTable_checkfns.lo: ./examples/netSnmpHostsTable_checkfns_local.h
+./examples/netSnmpHostsTable_checkfns.lo: ./examples/netSnmpHostsTable_enums.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/system/linux.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/system/sysv.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/system/generic.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/machine/generic.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/definitions.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/types.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/asn1.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmp.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/utilities.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/system.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/tools.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/int64.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/mt_support.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/callback.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/data_list.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/container.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/factory.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/container_binary_array.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/container_list_ssll.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/container_iterator.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/container.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmp_assert.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/version.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/session_api.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmp_service.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/pdu_api.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/mib_api.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/mib.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/parse.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/varbind_api.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/config_api.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/read_config.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/default_store.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/vacm.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/output_api.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/keytools.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/scapi.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ./examples/netSnmpHostsTable_checkfns.h
+./examples/netSnmpHostsTable_checkfns_local.lo: ./examples/netSnmpHostsTable_enums.h
+./examples/notification.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/notification.lo: ../../include/net-snmp/system/linux.h
+./examples/notification.lo: ../../include/net-snmp/system/sysv.h
+./examples/notification.lo: ../../include/net-snmp/system/generic.h
+./examples/notification.lo: ../../include/net-snmp/machine/generic.h
+./examples/notification.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/notification.lo: ../../include/net-snmp/definitions.h
+./examples/notification.lo: ../../include/net-snmp/types.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/notification.lo: ../../include/net-snmp/library/asn1.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/notification.lo: ../../include/net-snmp/utilities.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/notification.lo: ../../include/net-snmp/library/system.h
+./examples/notification.lo: ../../include/net-snmp/library/tools.h
+./examples/notification.lo: ../../include/net-snmp/library/int64.h
+./examples/notification.lo: ../../include/net-snmp/library/mt_support.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/notification.lo: ../../include/net-snmp/library/callback.h
+./examples/notification.lo: ../../include/net-snmp/library/data_list.h
+./examples/notification.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/notification.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/notification.lo: ../../include/net-snmp/library/container.h
+./examples/notification.lo: ../../include/net-snmp/library/factory.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/notification.lo: ../../include/net-snmp/library/container_binary_array.h
+./examples/notification.lo: ../../include/net-snmp/library/container_list_ssll.h
+./examples/notification.lo: ../../include/net-snmp/library/container_iterator.h
+./examples/notification.lo: ../../include/net-snmp/library/container.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_assert.h
+./examples/notification.lo: ../../include/net-snmp/version.h
+./examples/notification.lo: ../../include/net-snmp/session_api.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_service.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/notification.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/notification.lo: ../../include/net-snmp/pdu_api.h
+./examples/notification.lo: ../../include/net-snmp/mib_api.h
+./examples/notification.lo: ../../include/net-snmp/library/mib.h
+./examples/notification.lo: ../../include/net-snmp/library/parse.h
+./examples/notification.lo: ../../include/net-snmp/varbind_api.h
+./examples/notification.lo: ../../include/net-snmp/config_api.h
+./examples/notification.lo: ../../include/net-snmp/library/read_config.h
+./examples/notification.lo: ../../include/net-snmp/library/default_store.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/notification.lo: ../../include/net-snmp/library/vacm.h
+./examples/notification.lo: ../../include/net-snmp/output_api.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/notification.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/notification.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/notification.lo: ../../include/net-snmp/library/keytools.h
+./examples/notification.lo: ../../include/net-snmp/library/scapi.h
+./examples/notification.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/notification.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/notification.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/notification.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./examples/notification.lo: ../../include/net-snmp/agent/mib_module_config.h
+./examples/notification.lo: ../../include/net-snmp/agent/agent_module_config.h
+./examples/notification.lo: ../../include/net-snmp/agent/snmp_agent.h
+./examples/notification.lo: ../../include/net-snmp/agent/snmp_vars.h
+./examples/notification.lo: ../../include/net-snmp/agent/agent_handler.h
+./examples/notification.lo: ../../include/net-snmp/agent/var_struct.h
+./examples/notification.lo: ../../include/net-snmp/agent/agent_registry.h
+./examples/notification.lo: ../../include/net-snmp/library/fd_event_manager.h
+./examples/notification.lo: ../../include/net-snmp/agent/ds_agent.h
+./examples/notification.lo: ../../include/net-snmp/agent/agent_read_config.h
+./examples/notification.lo: ../../include/net-snmp/agent/agent_trap.h
+./examples/notification.lo: ../../include/net-snmp/agent/all_helpers.h
+./examples/notification.lo: ../../include/net-snmp/agent/instance.h
+./examples/notification.lo: ../../include/net-snmp/agent/baby_steps.h
+./examples/notification.lo: ../../include/net-snmp/agent/scalar.h
+./examples/notification.lo: ../../include/net-snmp/agent/scalar_group.h
+./examples/notification.lo: ../../include/net-snmp/agent/watcher.h
+./examples/notification.lo: ../../include/net-snmp/agent/multiplexer.h
+./examples/notification.lo: ../../include/net-snmp/agent/null.h
+./examples/notification.lo: ../../include/net-snmp/agent/debug_handler.h
+./examples/notification.lo: ../../include/net-snmp/agent/cache_handler.h
+./examples/notification.lo: ../../include/net-snmp/agent/old_api.h
+./examples/notification.lo: ../../include/net-snmp/agent/read_only.h
+./examples/notification.lo: ../../include/net-snmp/agent/row_merge.h
+./examples/notification.lo: ../../include/net-snmp/agent/serialize.h
+./examples/notification.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./examples/notification.lo: ../../include/net-snmp/agent/mode_end_call.h
+./examples/notification.lo: ../../include/net-snmp/agent/table.h
+./examples/notification.lo: ../../include/net-snmp/agent/table_data.h
+./examples/notification.lo: ../../include/net-snmp/agent/table_dataset.h
+./examples/notification.lo: ../../include/net-snmp/agent/table_tdata.h
+./examples/notification.lo: ../../include/net-snmp/agent/table_iterator.h
+./examples/notification.lo: ../../include/net-snmp/agent/table_container.h
+./examples/notification.lo: ../../include/net-snmp/agent/table_array.h
+./examples/notification.lo: ../../include/net-snmp/agent/mfd.h notification.h
+./examples/scalar_int.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/scalar_int.lo: ../../include/net-snmp/system/linux.h
+./examples/scalar_int.lo: ../../include/net-snmp/system/sysv.h
+./examples/scalar_int.lo: ../../include/net-snmp/system/generic.h
+./examples/scalar_int.lo: ../../include/net-snmp/machine/generic.h
+./examples/scalar_int.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/scalar_int.lo: ../../include/net-snmp/definitions.h
+./examples/scalar_int.lo: ../../include/net-snmp/types.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/asn1.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/scalar_int.lo: ../../include/net-snmp/utilities.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/system.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/tools.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/int64.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/mt_support.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/callback.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/data_list.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/container.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/factory.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/container_binary_array.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/container_list_ssll.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/container_iterator.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/container.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_assert.h
+./examples/scalar_int.lo: ../../include/net-snmp/version.h
+./examples/scalar_int.lo: ../../include/net-snmp/session_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_service.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/scalar_int.lo: ../../include/net-snmp/pdu_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/mib_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/mib.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/parse.h
+./examples/scalar_int.lo: ../../include/net-snmp/varbind_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/config_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/read_config.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/default_store.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/vacm.h
+./examples/scalar_int.lo: ../../include/net-snmp/output_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/scalar_int.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/keytools.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/scapi.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/mib_module_config.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/agent_module_config.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/snmp_agent.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/snmp_vars.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/agent_handler.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/var_struct.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/agent_registry.h
+./examples/scalar_int.lo: ../../include/net-snmp/library/fd_event_manager.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/ds_agent.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/agent_read_config.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/agent_trap.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/all_helpers.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/instance.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/baby_steps.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/scalar.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/scalar_group.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/watcher.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/multiplexer.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/null.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/debug_handler.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/cache_handler.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/old_api.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/read_only.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/row_merge.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/serialize.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/mode_end_call.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/table.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/table_data.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/table_dataset.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/table_tdata.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/table_iterator.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/table_container.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/table_array.h
+./examples/scalar_int.lo: ../../include/net-snmp/agent/mfd.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/system/linux.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/system/sysv.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/system/generic.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/machine/generic.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/definitions.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/types.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/asn1.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/utilities.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/system.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/tools.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/int64.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/mt_support.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/callback.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/data_list.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/container.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/factory.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/container_binary_array.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/container_list_ssll.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/container_iterator.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/container.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_assert.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/version.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/session_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_service.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/pdu_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/mib_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/mib.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/parse.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/varbind_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/config_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/read_config.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/default_store.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/vacm.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/output_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/keytools.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/scapi.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/mib_module_config.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/agent_module_config.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/snmp_agent.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/snmp_vars.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/agent_handler.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/var_struct.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/agent_registry.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/library/fd_event_manager.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/ds_agent.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/agent_read_config.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/agent_trap.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/all_helpers.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/instance.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/baby_steps.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/scalar.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/scalar_group.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/watcher.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/multiplexer.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/null.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/debug_handler.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/cache_handler.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/old_api.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/read_only.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/row_merge.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/serialize.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/mode_end_call.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/table.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/table_data.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/table_dataset.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/table_tdata.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/table_iterator.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/table_container.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/table_array.h
+./examples/ucdDemoPublic.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h
+./examples/ucdDemoPublic.lo: struct.h ./examples/ucdDemoPublic.h
+./examples/watched.lo: ../../include/net-snmp/net-snmp-config.h
+./examples/watched.lo: ../../include/net-snmp/system/linux.h
+./examples/watched.lo: ../../include/net-snmp/system/sysv.h
+./examples/watched.lo: ../../include/net-snmp/system/generic.h
+./examples/watched.lo: ../../include/net-snmp/machine/generic.h
+./examples/watched.lo: ../../include/net-snmp/net-snmp-includes.h
+./examples/watched.lo: ../../include/net-snmp/definitions.h
+./examples/watched.lo: ../../include/net-snmp/types.h
+./examples/watched.lo: ../../include/net-snmp/library/snmp_api.h
+./examples/watched.lo: ../../include/net-snmp/library/asn1.h
+./examples/watched.lo: ../../include/net-snmp/library/snmp_impl.h
+./examples/watched.lo: ../../include/net-snmp/library/snmp.h
+./examples/watched.lo: ../../include/net-snmp/library/snmp-tc.h
+./examples/watched.lo: ../../include/net-snmp/utilities.h
+./examples/watched.lo: ../../include/net-snmp/library/snmp_client.h
+./examples/watched.lo: ../../include/net-snmp/library/system.h
+./examples/watched.lo: ../../include/net-snmp/library/tools.h
+./examples/watched.lo: ../../include/net-snmp/library/int64.h
+./examples/watched.lo: ../../include/net-snmp/library/mt_support.h
+./examples/watched.lo: ../../include/net-snmp/library/snmp_alarm.h
+./examples/watched.lo: ../../include/net-snmp/library/callback.h
+./examples/watched.lo: ../../include/net-snmp/library/data_list.h
+./examples/watched.lo: ../../include/net-snmp/library/oid_stash.h
+./examples/watched.lo: ../../include/net-snmp/library/check_varbind.h
+./examples/watched.lo: ../../include/net-snmp/library/container.h
+./examples/watched.lo: ../../include/net-snmp/library/factory.h
+./examples/watched.lo: ../../include/net-snmp/library/snmp_logging.h
+./examples/watched.lo: ../../include/net-snmp/library/container_binary_array.h
+./examples/watched.lo: ../../include/net-snmp/library/container_list_ssll.h
+./examples/watched.lo: ../../include/net-snmp/library/container_iterator.h
+./examples/watched.lo: ../../include/net-snmp/library/container.h
+./examples/watched.lo: ../../include/net-snmp/library/snmp_assert.h
+./examples/watched.lo: ../../include/net-snmp/version.h
+./examples/watched.lo: ../../include/net-snmp/session_api.h
+./examples/watched.lo: ../../include/net-snmp/library/snmp_transport.h
+./examples/watched.lo: ../../include/net-snmp/library/snmp_service.h
+./examples/watched.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./examples/watched.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./examples/watched.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./examples/watched.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./examples/watched.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./examples/watched.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./examples/watched.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./examples/watched.lo: ../../include/net-snmp/library/ucd_compat.h
+./examples/watched.lo: ../../include/net-snmp/pdu_api.h
+./examples/watched.lo: ../../include/net-snmp/mib_api.h
+./examples/watched.lo: ../../include/net-snmp/library/mib.h
+./examples/watched.lo: ../../include/net-snmp/library/parse.h
+./examples/watched.lo: ../../include/net-snmp/varbind_api.h
+./examples/watched.lo: ../../include/net-snmp/config_api.h
+./examples/watched.lo: ../../include/net-snmp/library/read_config.h
+./examples/watched.lo: ../../include/net-snmp/library/default_store.h
+./examples/watched.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./examples/watched.lo: ../../include/net-snmp/library/snmp_enum.h
+./examples/watched.lo: ../../include/net-snmp/library/vacm.h
+./examples/watched.lo: ../../include/net-snmp/output_api.h
+./examples/watched.lo: ../../include/net-snmp/library/snmp_debug.h
+./examples/watched.lo: ../../include/net-snmp/snmpv3_api.h
+./examples/watched.lo: ../../include/net-snmp/library/snmpv3.h
+./examples/watched.lo: ../../include/net-snmp/library/transform_oids.h
+./examples/watched.lo: ../../include/net-snmp/library/keytools.h
+./examples/watched.lo: ../../include/net-snmp/library/scapi.h
+./examples/watched.lo: ../../include/net-snmp/library/lcd_time.h
+./examples/watched.lo: ../../include/net-snmp/library/snmp_secmod.h
+./examples/watched.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./examples/watched.lo: ../../include/net-snmp/library/snmpusm.h
+./examples/watched.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./examples/watched.lo: ../../include/net-snmp/agent/mib_module_config.h
+./examples/watched.lo: ../../include/net-snmp/agent/agent_module_config.h
+./examples/watched.lo: ../../include/net-snmp/agent/snmp_agent.h
+./examples/watched.lo: ../../include/net-snmp/agent/snmp_vars.h
+./examples/watched.lo: ../../include/net-snmp/agent/agent_handler.h
+./examples/watched.lo: ../../include/net-snmp/agent/var_struct.h
+./examples/watched.lo: ../../include/net-snmp/agent/agent_registry.h
+./examples/watched.lo: ../../include/net-snmp/library/fd_event_manager.h
+./examples/watched.lo: ../../include/net-snmp/agent/ds_agent.h
+./examples/watched.lo: ../../include/net-snmp/agent/agent_read_config.h
+./examples/watched.lo: ../../include/net-snmp/agent/agent_trap.h
+./examples/watched.lo: ../../include/net-snmp/agent/all_helpers.h
+./examples/watched.lo: ../../include/net-snmp/agent/instance.h
+./examples/watched.lo: ../../include/net-snmp/agent/baby_steps.h
+./examples/watched.lo: ../../include/net-snmp/agent/scalar.h
+./examples/watched.lo: ../../include/net-snmp/agent/scalar_group.h
+./examples/watched.lo: ../../include/net-snmp/agent/watcher.h
+./examples/watched.lo: ../../include/net-snmp/agent/multiplexer.h
+./examples/watched.lo: ../../include/net-snmp/agent/null.h
+./examples/watched.lo: ../../include/net-snmp/agent/debug_handler.h
+./examples/watched.lo: ../../include/net-snmp/agent/cache_handler.h
+./examples/watched.lo: ../../include/net-snmp/agent/old_api.h
+./examples/watched.lo: ../../include/net-snmp/agent/read_only.h
+./examples/watched.lo: ../../include/net-snmp/agent/row_merge.h
+./examples/watched.lo: ../../include/net-snmp/agent/serialize.h
+./examples/watched.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./examples/watched.lo: ../../include/net-snmp/agent/mode_end_call.h
+./examples/watched.lo: ../../include/net-snmp/agent/table.h
+./examples/watched.lo: ../../include/net-snmp/agent/table_data.h
+./examples/watched.lo: ../../include/net-snmp/agent/table_dataset.h
+./examples/watched.lo: ../../include/net-snmp/agent/table_tdata.h
+./examples/watched.lo: ../../include/net-snmp/agent/table_iterator.h
+./examples/watched.lo: ../../include/net-snmp/agent/table_container.h
+./examples/watched.lo: ../../include/net-snmp/agent/table_array.h
+./examples/watched.lo: ../../include/net-snmp/agent/mfd.h
+./host/hr_device.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_device.lo: ../../include/net-snmp/system/linux.h
+./host/hr_device.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_device.lo: ../../include/net-snmp/system/generic.h
+./host/hr_device.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_device.lo: host_res.h
+./host/hr_device.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_device.lo: ../../include/net-snmp/definitions.h
+./host/hr_device.lo: ../../include/net-snmp/types.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_device.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_device.lo: ../../include/net-snmp/utilities.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_device.lo: ../../include/net-snmp/library/system.h
+./host/hr_device.lo: ../../include/net-snmp/library/tools.h
+./host/hr_device.lo: ../../include/net-snmp/library/int64.h
+./host/hr_device.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_device.lo: ../../include/net-snmp/library/callback.h
+./host/hr_device.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_device.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_device.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_device.lo: ../../include/net-snmp/library/container.h
+./host/hr_device.lo: ../../include/net-snmp/library/factory.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_device.lo: ../../include/net-snmp/library/container_binary_array.h
+./host/hr_device.lo: ../../include/net-snmp/library/container_list_ssll.h
+./host/hr_device.lo: ../../include/net-snmp/library/container_iterator.h
+./host/hr_device.lo: ../../include/net-snmp/library/container.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_assert.h
+./host/hr_device.lo: ../../include/net-snmp/version.h
+./host/hr_device.lo: ../../include/net-snmp/session_api.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_service.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_device.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_device.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_device.lo: ../../include/net-snmp/mib_api.h
+./host/hr_device.lo: ../../include/net-snmp/library/mib.h
+./host/hr_device.lo: ../../include/net-snmp/library/parse.h
+./host/hr_device.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_device.lo: ../../include/net-snmp/config_api.h
+./host/hr_device.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_device.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_device.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_device.lo: ../../include/net-snmp/output_api.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_device.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_device.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_device.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_device.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_device.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_device.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_device.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_device.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_device.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_device.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_device.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_device.lo: ../../include/net-snmp/library/fd_event_manager.h
+./host/hr_device.lo: ./host/hr_device.h
+./host/hr_disk.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_disk.lo: ../../include/net-snmp/system/linux.h
+./host/hr_disk.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_disk.lo: ../../include/net-snmp/system/generic.h
+./host/hr_disk.lo: ../../include/net-snmp/machine/generic.h host_res.h
+./host/hr_disk.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_disk.lo: ../../include/net-snmp/definitions.h
+./host/hr_disk.lo: ../../include/net-snmp/types.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_disk.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_disk.lo: ../../include/net-snmp/utilities.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_disk.lo: ../../include/net-snmp/library/system.h
+./host/hr_disk.lo: ../../include/net-snmp/library/tools.h
+./host/hr_disk.lo: ../../include/net-snmp/library/int64.h
+./host/hr_disk.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_disk.lo: ../../include/net-snmp/library/callback.h
+./host/hr_disk.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_disk.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_disk.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_disk.lo: ../../include/net-snmp/library/container.h
+./host/hr_disk.lo: ../../include/net-snmp/library/factory.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_disk.lo: ../../include/net-snmp/library/container_binary_array.h
+./host/hr_disk.lo: ../../include/net-snmp/library/container_list_ssll.h
+./host/hr_disk.lo: ../../include/net-snmp/library/container_iterator.h
+./host/hr_disk.lo: ../../include/net-snmp/library/container.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_assert.h
+./host/hr_disk.lo: ../../include/net-snmp/version.h
+./host/hr_disk.lo: ../../include/net-snmp/session_api.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_service.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_disk.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_disk.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_disk.lo: ../../include/net-snmp/mib_api.h
+./host/hr_disk.lo: ../../include/net-snmp/library/mib.h
+./host/hr_disk.lo: ../../include/net-snmp/library/parse.h
+./host/hr_disk.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_disk.lo: ../../include/net-snmp/config_api.h
+./host/hr_disk.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_disk.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_disk.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_disk.lo: ../../include/net-snmp/output_api.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_disk.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_disk.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_disk.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_disk.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_disk.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_disk.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_disk.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_disk.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_disk.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_disk.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_disk.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_disk.lo: ../../include/net-snmp/library/fd_event_manager.h
+./host/hr_disk.lo: ./host/hr_disk.h
+./host/hr_disk.lo: ../../include/net-snmp/agent/agent_read_config.h
+./host/hr_filesys.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_filesys.lo: ../../include/net-snmp/system/linux.h
+./host/hr_filesys.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_filesys.lo: ../../include/net-snmp/system/generic.h
+./host/hr_filesys.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_filesys.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_filesys.lo: ../../include/net-snmp/definitions.h
+./host/hr_filesys.lo: ../../include/net-snmp/types.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_filesys.lo: ../../include/net-snmp/utilities.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/system.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/tools.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/int64.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/callback.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/container.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/factory.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/container_binary_array.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/container_list_ssll.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/container_iterator.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/container.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_assert.h
+./host/hr_filesys.lo: ../../include/net-snmp/version.h
+./host/hr_filesys.lo: ../../include/net-snmp/session_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_service.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_filesys.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/mib_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/mib.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/parse.h
+./host/hr_filesys.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/config_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_filesys.lo: ../../include/net-snmp/output_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_filesys.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/mib_module_config.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/agent_module_config.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_filesys.lo: ../../include/net-snmp/library/fd_event_manager.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/ds_agent.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/agent_read_config.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/agent_trap.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/all_helpers.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/instance.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/baby_steps.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/scalar.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/scalar_group.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/watcher.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/multiplexer.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/null.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/debug_handler.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/cache_handler.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/old_api.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/read_only.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/row_merge.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/serialize.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/mode_end_call.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/table.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/table_data.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/table_dataset.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/table_tdata.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/table_iterator.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/table_container.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/table_array.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/mfd.h
+./host/hr_filesys.lo: ../../include/net-snmp/agent/hardware/memory.h
+./host/hr_filesys.lo: host_res.h ./host/hr_filesys.h
+./host/hr_filesys.lo: ./host/hr_storage.h
+./host/hr_network.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_network.lo: ../../include/net-snmp/system/linux.h
+./host/hr_network.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_network.lo: ../../include/net-snmp/system/generic.h
+./host/hr_network.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_network.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_network.lo: ../../include/net-snmp/definitions.h
+./host/hr_network.lo: ../../include/net-snmp/types.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_network.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_network.lo: ../../include/net-snmp/utilities.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_network.lo: ../../include/net-snmp/library/system.h
+./host/hr_network.lo: ../../include/net-snmp/library/tools.h
+./host/hr_network.lo: ../../include/net-snmp/library/int64.h
+./host/hr_network.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_network.lo: ../../include/net-snmp/library/callback.h
+./host/hr_network.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_network.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_network.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_network.lo: ../../include/net-snmp/library/container.h
+./host/hr_network.lo: ../../include/net-snmp/library/factory.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_network.lo: ../../include/net-snmp/library/container_binary_array.h
+./host/hr_network.lo: ../../include/net-snmp/library/container_list_ssll.h
+./host/hr_network.lo: ../../include/net-snmp/library/container_iterator.h
+./host/hr_network.lo: ../../include/net-snmp/library/container.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_assert.h
+./host/hr_network.lo: ../../include/net-snmp/version.h
+./host/hr_network.lo: ../../include/net-snmp/session_api.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_service.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_network.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_network.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_network.lo: ../../include/net-snmp/mib_api.h
+./host/hr_network.lo: ../../include/net-snmp/library/mib.h
+./host/hr_network.lo: ../../include/net-snmp/library/parse.h
+./host/hr_network.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_network.lo: ../../include/net-snmp/config_api.h
+./host/hr_network.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_network.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_network.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_network.lo: ../../include/net-snmp/output_api.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_network.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_network.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_network.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_network.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_network.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_network.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_network.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./host/hr_network.lo: ../../include/net-snmp/agent/mib_module_config.h
+./host/hr_network.lo: ../../include/net-snmp/agent/agent_module_config.h
+./host/hr_network.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_network.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_network.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_network.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_network.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_network.lo: ../../include/net-snmp/library/fd_event_manager.h
+./host/hr_network.lo: ../../include/net-snmp/agent/ds_agent.h
+./host/hr_network.lo: ../../include/net-snmp/agent/agent_read_config.h
+./host/hr_network.lo: ../../include/net-snmp/agent/agent_trap.h
+./host/hr_network.lo: ../../include/net-snmp/agent/all_helpers.h
+./host/hr_network.lo: ../../include/net-snmp/agent/instance.h
+./host/hr_network.lo: ../../include/net-snmp/agent/baby_steps.h
+./host/hr_network.lo: ../../include/net-snmp/agent/scalar.h
+./host/hr_network.lo: ../../include/net-snmp/agent/scalar_group.h
+./host/hr_network.lo: ../../include/net-snmp/agent/watcher.h
+./host/hr_network.lo: ../../include/net-snmp/agent/multiplexer.h
+./host/hr_network.lo: ../../include/net-snmp/agent/null.h
+./host/hr_network.lo: ../../include/net-snmp/agent/debug_handler.h
+./host/hr_network.lo: ../../include/net-snmp/agent/cache_handler.h
+./host/hr_network.lo: ../../include/net-snmp/agent/old_api.h
+./host/hr_network.lo: ../../include/net-snmp/agent/read_only.h
+./host/hr_network.lo: ../../include/net-snmp/agent/row_merge.h
+./host/hr_network.lo: ../../include/net-snmp/agent/serialize.h
+./host/hr_network.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./host/hr_network.lo: ../../include/net-snmp/agent/mode_end_call.h
+./host/hr_network.lo: ../../include/net-snmp/agent/table.h
+./host/hr_network.lo: ../../include/net-snmp/agent/table_data.h
+./host/hr_network.lo: ../../include/net-snmp/agent/table_dataset.h
+./host/hr_network.lo: ../../include/net-snmp/agent/table_tdata.h
+./host/hr_network.lo: ../../include/net-snmp/agent/table_iterator.h
+./host/hr_network.lo: ../../include/net-snmp/agent/table_container.h
+./host/hr_network.lo: ../../include/net-snmp/agent/table_array.h
+./host/hr_network.lo: ../../include/net-snmp/agent/mfd.h
+./host/hr_network.lo: ../../include/net-snmp/data_access/interface.h
+./host/hr_network.lo: host_res.h mibII/interfaces.h
+./host/hr_network.lo: ./host/hr_network.h
+./host/hr_other.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_other.lo: ../../include/net-snmp/system/linux.h
+./host/hr_other.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_other.lo: ../../include/net-snmp/system/generic.h
+./host/hr_other.lo: ../../include/net-snmp/machine/generic.h host_res.h
+./host/hr_other.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_other.lo: ../../include/net-snmp/definitions.h
+./host/hr_other.lo: ../../include/net-snmp/types.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_other.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_other.lo: ../../include/net-snmp/utilities.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_other.lo: ../../include/net-snmp/library/system.h
+./host/hr_other.lo: ../../include/net-snmp/library/tools.h
+./host/hr_other.lo: ../../include/net-snmp/library/int64.h
+./host/hr_other.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_other.lo: ../../include/net-snmp/library/callback.h
+./host/hr_other.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_other.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_other.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_other.lo: ../../include/net-snmp/library/container.h
+./host/hr_other.lo: ../../include/net-snmp/library/factory.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_other.lo: ../../include/net-snmp/library/container_binary_array.h
+./host/hr_other.lo: ../../include/net-snmp/library/container_list_ssll.h
+./host/hr_other.lo: ../../include/net-snmp/library/container_iterator.h
+./host/hr_other.lo: ../../include/net-snmp/library/container.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_assert.h
+./host/hr_other.lo: ../../include/net-snmp/version.h
+./host/hr_other.lo: ../../include/net-snmp/session_api.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_service.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_other.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_other.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_other.lo: ../../include/net-snmp/mib_api.h
+./host/hr_other.lo: ../../include/net-snmp/library/mib.h
+./host/hr_other.lo: ../../include/net-snmp/library/parse.h
+./host/hr_other.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_other.lo: ../../include/net-snmp/config_api.h
+./host/hr_other.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_other.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_other.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_other.lo: ../../include/net-snmp/output_api.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_other.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_other.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_other.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_other.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_other.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_other.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_other.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_other.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_other.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_other.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_other.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_other.lo: ../../include/net-snmp/library/fd_event_manager.h
+./host/hr_other.lo: ./host/hr_other.h
+./host/hr_partition.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_partition.lo: ../../include/net-snmp/system/linux.h
+./host/hr_partition.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_partition.lo: ../../include/net-snmp/system/generic.h
+./host/hr_partition.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_partition.lo: host_res.h
+./host/hr_partition.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_partition.lo: ../../include/net-snmp/definitions.h
+./host/hr_partition.lo: ../../include/net-snmp/types.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_partition.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_partition.lo: ../../include/net-snmp/utilities.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_partition.lo: ../../include/net-snmp/library/system.h
+./host/hr_partition.lo: ../../include/net-snmp/library/tools.h
+./host/hr_partition.lo: ../../include/net-snmp/library/int64.h
+./host/hr_partition.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_partition.lo: ../../include/net-snmp/library/callback.h
+./host/hr_partition.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_partition.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_partition.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_partition.lo: ../../include/net-snmp/library/container.h
+./host/hr_partition.lo: ../../include/net-snmp/library/factory.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_partition.lo: ../../include/net-snmp/library/container_binary_array.h
+./host/hr_partition.lo: ../../include/net-snmp/library/container_list_ssll.h
+./host/hr_partition.lo: ../../include/net-snmp/library/container_iterator.h
+./host/hr_partition.lo: ../../include/net-snmp/library/container.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_assert.h
+./host/hr_partition.lo: ../../include/net-snmp/version.h
+./host/hr_partition.lo: ../../include/net-snmp/session_api.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_service.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_partition.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_partition.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_partition.lo: ../../include/net-snmp/mib_api.h
+./host/hr_partition.lo: ../../include/net-snmp/library/mib.h
+./host/hr_partition.lo: ../../include/net-snmp/library/parse.h
+./host/hr_partition.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_partition.lo: ../../include/net-snmp/config_api.h
+./host/hr_partition.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_partition.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_partition.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_partition.lo: ../../include/net-snmp/output_api.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_partition.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_partition.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_partition.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_partition.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_partition.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_partition.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_partition.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_partition.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_partition.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_partition.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_partition.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_partition.lo: ../../include/net-snmp/library/fd_event_manager.h
+./host/hr_partition.lo: ./host/hr_partition.h
+./host/hr_partition.lo: ./host/hr_filesys.h ./host/hr_disk.h
+./host/hr_print.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_print.lo: ../../include/net-snmp/system/linux.h
+./host/hr_print.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_print.lo: ../../include/net-snmp/system/generic.h
+./host/hr_print.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_print.lo: host_res.h
+./host/hr_print.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_print.lo: ../../include/net-snmp/definitions.h
+./host/hr_print.lo: ../../include/net-snmp/types.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_print.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_print.lo: ../../include/net-snmp/utilities.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_print.lo: ../../include/net-snmp/library/system.h
+./host/hr_print.lo: ../../include/net-snmp/library/tools.h
+./host/hr_print.lo: ../../include/net-snmp/library/int64.h
+./host/hr_print.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_print.lo: ../../include/net-snmp/library/callback.h
+./host/hr_print.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_print.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_print.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_print.lo: ../../include/net-snmp/library/container.h
+./host/hr_print.lo: ../../include/net-snmp/library/factory.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_print.lo: ../../include/net-snmp/library/container_binary_array.h
+./host/hr_print.lo: ../../include/net-snmp/library/container_list_ssll.h
+./host/hr_print.lo: ../../include/net-snmp/library/container_iterator.h
+./host/hr_print.lo: ../../include/net-snmp/library/container.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_assert.h
+./host/hr_print.lo: ../../include/net-snmp/version.h
+./host/hr_print.lo: ../../include/net-snmp/session_api.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_service.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_print.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_print.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_print.lo: ../../include/net-snmp/mib_api.h
+./host/hr_print.lo: ../../include/net-snmp/library/mib.h
+./host/hr_print.lo: ../../include/net-snmp/library/parse.h
+./host/hr_print.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_print.lo: ../../include/net-snmp/config_api.h
+./host/hr_print.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_print.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_print.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_print.lo: ../../include/net-snmp/output_api.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_print.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_print.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_print.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_print.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_print.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_print.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_print.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_print.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_print.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_print.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_print.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_print.lo: ../../include/net-snmp/library/fd_event_manager.h
+./host/hr_print.lo: ./host/hr_print.h struct.h
+./host/hr_print.lo: util_funcs.h
+./host/hr_proc.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_proc.lo: ../../include/net-snmp/system/linux.h
+./host/hr_proc.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_proc.lo: ../../include/net-snmp/system/generic.h
+./host/hr_proc.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_proc.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_proc.lo: ../../include/net-snmp/definitions.h
+./host/hr_proc.lo: ../../include/net-snmp/types.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_proc.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_proc.lo: ../../include/net-snmp/utilities.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_proc.lo: ../../include/net-snmp/library/system.h
+./host/hr_proc.lo: ../../include/net-snmp/library/tools.h
+./host/hr_proc.lo: ../../include/net-snmp/library/int64.h
+./host/hr_proc.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_proc.lo: ../../include/net-snmp/library/callback.h
+./host/hr_proc.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_proc.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_proc.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_proc.lo: ../../include/net-snmp/library/container.h
+./host/hr_proc.lo: ../../include/net-snmp/library/factory.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_proc.lo: ../../include/net-snmp/library/container_binary_array.h
+./host/hr_proc.lo: ../../include/net-snmp/library/container_list_ssll.h
+./host/hr_proc.lo: ../../include/net-snmp/library/container_iterator.h
+./host/hr_proc.lo: ../../include/net-snmp/library/container.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_assert.h
+./host/hr_proc.lo: ../../include/net-snmp/version.h
+./host/hr_proc.lo: ../../include/net-snmp/session_api.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_service.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_proc.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_proc.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_proc.lo: ../../include/net-snmp/mib_api.h
+./host/hr_proc.lo: ../../include/net-snmp/library/mib.h
+./host/hr_proc.lo: ../../include/net-snmp/library/parse.h
+./host/hr_proc.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_proc.lo: ../../include/net-snmp/config_api.h
+./host/hr_proc.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_proc.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_proc.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_proc.lo: ../../include/net-snmp/output_api.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_proc.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_proc.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_proc.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_proc.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_proc.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_proc.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/mib_module_config.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/agent_module_config.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_proc.lo: ../../include/net-snmp/library/fd_event_manager.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/ds_agent.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/agent_read_config.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/agent_trap.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/all_helpers.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/instance.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/baby_steps.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/scalar.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/scalar_group.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/watcher.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/multiplexer.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/null.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/debug_handler.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/cache_handler.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/old_api.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/read_only.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/row_merge.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/serialize.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/mode_end_call.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/table.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/table_data.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/table_dataset.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/table_tdata.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/table_iterator.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/table_container.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/table_array.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/mfd.h
+./host/hr_proc.lo: host_res.h ./host/hr_proc.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/auto_nlist.h
+./host/hr_proc.lo: ../../include/net-snmp/agent/hardware/cpu.h
+./host/hr_proc.lo: ucd-snmp/loadave.h mibdefs.h
+./host/hr_storage.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_storage.lo: ../../include/net-snmp/system/linux.h
+./host/hr_storage.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_storage.lo: ../../include/net-snmp/system/generic.h
+./host/hr_storage.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_storage.lo: host_res.h
+./host/hr_storage.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_storage.lo: ../../include/net-snmp/definitions.h
+./host/hr_storage.lo: ../../include/net-snmp/types.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_storage.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_storage.lo: ../../include/net-snmp/utilities.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_storage.lo: ../../include/net-snmp/library/system.h
+./host/hr_storage.lo: ../../include/net-snmp/library/tools.h
+./host/hr_storage.lo: ../../include/net-snmp/library/int64.h
+./host/hr_storage.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_storage.lo: ../../include/net-snmp/library/callback.h
+./host/hr_storage.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_storage.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_storage.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_storage.lo: ../../include/net-snmp/library/container.h
+./host/hr_storage.lo: ../../include/net-snmp/library/factory.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_storage.lo: ../../include/net-snmp/library/container_binary_array.h
+./host/hr_storage.lo: ../../include/net-snmp/library/container_list_ssll.h
+./host/hr_storage.lo: ../../include/net-snmp/library/container_iterator.h
+./host/hr_storage.lo: ../../include/net-snmp/library/container.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_assert.h
+./host/hr_storage.lo: ../../include/net-snmp/version.h
+./host/hr_storage.lo: ../../include/net-snmp/session_api.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_service.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_storage.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_storage.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_storage.lo: ../../include/net-snmp/mib_api.h
+./host/hr_storage.lo: ../../include/net-snmp/library/mib.h
+./host/hr_storage.lo: ../../include/net-snmp/library/parse.h
+./host/hr_storage.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_storage.lo: ../../include/net-snmp/config_api.h
+./host/hr_storage.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_storage.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_storage.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_storage.lo: ../../include/net-snmp/output_api.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_storage.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_storage.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_storage.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_storage.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_storage.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_storage.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_storage.lo: ../../include/net-snmp/library/fd_event_manager.h
+./host/hr_storage.lo: ./host/hr_storage.h
+./host/hr_storage.lo: ./host/hr_filesys.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/auto_nlist.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/mib_module_config.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/agent_module_config.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/ds_agent.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/agent_read_config.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/agent_trap.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/all_helpers.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/instance.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/baby_steps.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/scalar.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/scalar_group.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/watcher.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/multiplexer.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/null.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/debug_handler.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/cache_handler.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/old_api.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/read_only.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/row_merge.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/serialize.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/mode_end_call.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/table.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/table_data.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/table_dataset.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/table_tdata.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/table_iterator.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/table_container.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/table_array.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/mfd.h
+./host/hr_storage.lo: ../../include/net-snmp/agent/hardware/memory.h
+./host/hr_swinst.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_swinst.lo: ../../include/net-snmp/system/linux.h
+./host/hr_swinst.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_swinst.lo: ../../include/net-snmp/system/generic.h
+./host/hr_swinst.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_swinst.lo: host_res.h
+./host/hr_swinst.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_swinst.lo: ../../include/net-snmp/definitions.h
+./host/hr_swinst.lo: ../../include/net-snmp/types.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_swinst.lo: ../../include/net-snmp/utilities.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/system.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/tools.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/int64.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/callback.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/container.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/factory.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/container_binary_array.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/container_list_ssll.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/container_iterator.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/container.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_assert.h
+./host/hr_swinst.lo: ../../include/net-snmp/version.h
+./host/hr_swinst.lo: ../../include/net-snmp/session_api.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_service.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_swinst.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_swinst.lo: ../../include/net-snmp/mib_api.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/mib.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/parse.h
+./host/hr_swinst.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_swinst.lo: ../../include/net-snmp/config_api.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_swinst.lo: ../../include/net-snmp/output_api.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_swinst.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_swinst.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_swinst.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_swinst.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_swinst.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_swinst.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_swinst.lo: ../../include/net-snmp/library/fd_event_manager.h
+./host/hr_swinst.lo: ./host/hr_swinst.h
+./host/hr_swrun.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_swrun.lo: ../../include/net-snmp/system/linux.h
+./host/hr_swrun.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_swrun.lo: ../../include/net-snmp/system/generic.h
+./host/hr_swrun.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_swrun.lo: ../../include/net-snmp/output_api.h
+./host/hr_swrun.lo: ../../include/net-snmp/types.h
+./host/hr_swrun.lo: ../../include/net-snmp/definitions.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_swrun.lo: host_res.h
+./host/hr_swrun.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_swrun.lo: ../../include/net-snmp/utilities.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/system.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/tools.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/int64.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/callback.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/container.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/factory.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/container_binary_array.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/container_list_ssll.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/container_iterator.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/container.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_assert.h
+./host/hr_swrun.lo: ../../include/net-snmp/version.h
+./host/hr_swrun.lo: ../../include/net-snmp/session_api.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_service.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_swrun.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_swrun.lo: ../../include/net-snmp/mib_api.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/mib.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/parse.h
+./host/hr_swrun.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_swrun.lo: ../../include/net-snmp/config_api.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_swrun.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_swrun.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_swrun.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_swrun.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_swrun.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_swrun.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_swrun.lo: ../../include/net-snmp/library/fd_event_manager.h
+./host/hr_swrun.lo: ./host/hr_swrun.h
+./host/hr_swrun.lo: ../../include/net-snmp/agent/auto_nlist.h
+./host/hr_swrun.lo: ../../agent/kernel.h
+./host/hr_system.lo: ../../include/net-snmp/net-snmp-config.h
+./host/hr_system.lo: ../../include/net-snmp/system/linux.h
+./host/hr_system.lo: ../../include/net-snmp/system/sysv.h
+./host/hr_system.lo: ../../include/net-snmp/system/generic.h
+./host/hr_system.lo: ../../include/net-snmp/machine/generic.h
+./host/hr_system.lo: ../../include/net-snmp/net-snmp-includes.h
+./host/hr_system.lo: ../../include/net-snmp/definitions.h
+./host/hr_system.lo: ../../include/net-snmp/types.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_api.h
+./host/hr_system.lo: ../../include/net-snmp/library/asn1.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_impl.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp-tc.h
+./host/hr_system.lo: ../../include/net-snmp/utilities.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_client.h
+./host/hr_system.lo: ../../include/net-snmp/library/system.h
+./host/hr_system.lo: ../../include/net-snmp/library/tools.h
+./host/hr_system.lo: ../../include/net-snmp/library/int64.h
+./host/hr_system.lo: ../../include/net-snmp/library/mt_support.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_alarm.h
+./host/hr_system.lo: ../../include/net-snmp/library/callback.h
+./host/hr_system.lo: ../../include/net-snmp/library/data_list.h
+./host/hr_system.lo: ../../include/net-snmp/library/oid_stash.h
+./host/hr_system.lo: ../../include/net-snmp/library/check_varbind.h
+./host/hr_system.lo: ../../include/net-snmp/library/container.h
+./host/hr_system.lo: ../../include/net-snmp/library/factory.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_logging.h
+./host/hr_system.lo: ../../include/net-snmp/library/container_binary_array.h
+./host/hr_system.lo: ../../include/net-snmp/library/container_list_ssll.h
+./host/hr_system.lo: ../../include/net-snmp/library/container_iterator.h
+./host/hr_system.lo: ../../include/net-snmp/library/container.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_assert.h
+./host/hr_system.lo: ../../include/net-snmp/version.h
+./host/hr_system.lo: ../../include/net-snmp/session_api.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_transport.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_service.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./host/hr_system.lo: ../../include/net-snmp/library/ucd_compat.h
+./host/hr_system.lo: ../../include/net-snmp/pdu_api.h
+./host/hr_system.lo: ../../include/net-snmp/mib_api.h
+./host/hr_system.lo: ../../include/net-snmp/library/mib.h
+./host/hr_system.lo: ../../include/net-snmp/library/parse.h
+./host/hr_system.lo: ../../include/net-snmp/varbind_api.h
+./host/hr_system.lo: ../../include/net-snmp/config_api.h
+./host/hr_system.lo: ../../include/net-snmp/library/read_config.h
+./host/hr_system.lo: ../../include/net-snmp/library/default_store.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_enum.h
+./host/hr_system.lo: ../../include/net-snmp/library/vacm.h
+./host/hr_system.lo: ../../include/net-snmp/output_api.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_debug.h
+./host/hr_system.lo: ../../include/net-snmp/snmpv3_api.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpv3.h
+./host/hr_system.lo: ../../include/net-snmp/library/transform_oids.h
+./host/hr_system.lo: ../../include/net-snmp/library/keytools.h
+./host/hr_system.lo: ../../include/net-snmp/library/scapi.h
+./host/hr_system.lo: ../../include/net-snmp/library/lcd_time.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmp_secmod.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./host/hr_system.lo: ../../include/net-snmp/library/snmpusm.h
+./host/hr_system.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./host/hr_system.lo: ../../include/net-snmp/agent/mib_module_config.h
+./host/hr_system.lo: ../../include/net-snmp/agent/agent_module_config.h
+./host/hr_system.lo: ../../include/net-snmp/agent/snmp_agent.h
+./host/hr_system.lo: ../../include/net-snmp/agent/snmp_vars.h
+./host/hr_system.lo: ../../include/net-snmp/agent/agent_handler.h
+./host/hr_system.lo: ../../include/net-snmp/agent/var_struct.h
+./host/hr_system.lo: ../../include/net-snmp/agent/agent_registry.h
+./host/hr_system.lo: ../../include/net-snmp/library/fd_event_manager.h
+./host/hr_system.lo: ../../include/net-snmp/agent/ds_agent.h
+./host/hr_system.lo: ../../include/net-snmp/agent/agent_read_config.h
+./host/hr_system.lo: ../../include/net-snmp/agent/agent_trap.h
+./host/hr_system.lo: ../../include/net-snmp/agent/all_helpers.h
+./host/hr_system.lo: ../../include/net-snmp/agent/instance.h
+./host/hr_system.lo: ../../include/net-snmp/agent/baby_steps.h
+./host/hr_system.lo: ../../include/net-snmp/agent/scalar.h
+./host/hr_system.lo: ../../include/net-snmp/agent/scalar_group.h
+./host/hr_system.lo: ../../include/net-snmp/agent/watcher.h
+./host/hr_system.lo: ../../include/net-snmp/agent/multiplexer.h
+./host/hr_system.lo: ../../include/net-snmp/agent/null.h
+./host/hr_system.lo: ../../include/net-snmp/agent/debug_handler.h
+./host/hr_system.lo: ../../include/net-snmp/agent/cache_handler.h
+./host/hr_system.lo: ../../include/net-snmp/agent/old_api.h
+./host/hr_system.lo: ../../include/net-snmp/agent/read_only.h
+./host/hr_system.lo: ../../include/net-snmp/agent/row_merge.h
+./host/hr_system.lo: ../../include/net-snmp/agent/serialize.h
+./host/hr_system.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./host/hr_system.lo: ../../include/net-snmp/agent/mode_end_call.h
+./host/hr_system.lo: ../../include/net-snmp/agent/table.h
+./host/hr_system.lo: ../../include/net-snmp/agent/table_data.h
+./host/hr_system.lo: ../../include/net-snmp/agent/table_dataset.h
+./host/hr_system.lo: ../../include/net-snmp/agent/table_tdata.h
+./host/hr_system.lo: ../../include/net-snmp/agent/table_iterator.h
+./host/hr_system.lo: ../../include/net-snmp/agent/table_container.h
+./host/hr_system.lo: ../../include/net-snmp/agent/table_array.h
+./host/hr_system.lo: ../../include/net-snmp/agent/mfd.h host.h host_res.h
+./host/hr_system.lo: ./host/hr_system.h
+./host/hr_system.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/net-snmp-config.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/system/linux.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/system/sysv.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/system/generic.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/machine/generic.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/net-snmp-includes.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/definitions.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/types.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmp_api.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/asn1.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmp_impl.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmp.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmp-tc.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/utilities.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmp_client.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/system.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/tools.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/int64.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/mt_support.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/callback.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/data_list.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/oid_stash.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/check_varbind.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/container.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/factory.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmp_logging.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/container_binary_array.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/container_iterator.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/container.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmp_assert.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/version.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/session_api.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmp_transport.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmp_service.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/ucd_compat.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/pdu_api.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/mib_api.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/mib.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/parse.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/varbind_api.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/config_api.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/read_config.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/default_store.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmp_enum.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/vacm.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/output_api.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmp_debug.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/snmpv3_api.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmpv3.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/transform_oids.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/keytools.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/scapi.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/lcd_time.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/snmpusm.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/agent_handler.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/var_struct.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/agent_registry.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/ds_agent.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/agent_trap.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/all_helpers.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/instance.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/baby_steps.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/scalar.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/scalar_group.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/watcher.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/multiplexer.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/null.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/debug_handler.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/cache_handler.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/old_api.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/read_only.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/row_merge.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/serialize.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/table.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/table_data.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/table_dataset.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/table_tdata.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/table_iterator.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/table_container.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/table_array.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/agent/mfd.h
+./ip-mib/ip_scalars.lo: ../../include/net-snmp/data_access/ip_scalars.h
+./ip-mib/ip_scalars.lo: ./ip-mib/ip_scalars.h
+./mibII/at.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/at.lo: ../../include/net-snmp/system/linux.h
+./mibII/at.lo: ../../include/net-snmp/system/sysv.h
+./mibII/at.lo: ../../include/net-snmp/system/generic.h
+./mibII/at.lo: ../../include/net-snmp/machine/generic.h
+./mibII/at.lo: ./mibII/mibII_common.h
+./mibII/at.lo: ../../agent/kernel.h
+./mibII/at.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/at.lo: ../../include/net-snmp/definitions.h
+./mibII/at.lo: ../../include/net-snmp/types.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/at.lo: ../../include/net-snmp/library/asn1.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/at.lo: ../../include/net-snmp/utilities.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/at.lo: ../../include/net-snmp/library/system.h
+./mibII/at.lo: ../../include/net-snmp/library/tools.h
+./mibII/at.lo: ../../include/net-snmp/library/int64.h
+./mibII/at.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/at.lo: ../../include/net-snmp/library/callback.h
+./mibII/at.lo: ../../include/net-snmp/library/data_list.h
+./mibII/at.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/at.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/at.lo: ../../include/net-snmp/library/container.h
+./mibII/at.lo: ../../include/net-snmp/library/factory.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/at.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/at.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/at.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/at.lo: ../../include/net-snmp/library/container.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/at.lo: ../../include/net-snmp/version.h
+./mibII/at.lo: ../../include/net-snmp/session_api.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/at.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/at.lo: ../../include/net-snmp/pdu_api.h
+./mibII/at.lo: ../../include/net-snmp/mib_api.h
+./mibII/at.lo: ../../include/net-snmp/library/mib.h
+./mibII/at.lo: ../../include/net-snmp/library/parse.h
+./mibII/at.lo: ../../include/net-snmp/varbind_api.h
+./mibII/at.lo: ../../include/net-snmp/config_api.h
+./mibII/at.lo: ../../include/net-snmp/library/read_config.h
+./mibII/at.lo: ../../include/net-snmp/library/default_store.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/at.lo: ../../include/net-snmp/library/vacm.h
+./mibII/at.lo: ../../include/net-snmp/output_api.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/at.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/at.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/at.lo: ../../include/net-snmp/library/keytools.h
+./mibII/at.lo: ../../include/net-snmp/library/scapi.h
+./mibII/at.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/at.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/at.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/at.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/at.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/at.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/at.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/at.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/at.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/at.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/at.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/at.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/at.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/at.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/at.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/at.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/at.lo: ../../include/net-snmp/agent/instance.h
+./mibII/at.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/at.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/at.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/at.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/at.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/at.lo: ../../include/net-snmp/agent/null.h
+./mibII/at.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/at.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/at.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/at.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/at.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/at.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/at.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/at.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/at.lo: ../../include/net-snmp/agent/table.h
+./mibII/at.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/at.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/at.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/at.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/at.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/at.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/at.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/at.lo: ../../include/net-snmp/agent/auto_nlist.h ./mibII/at.h
+./mibII/at.lo: ./mibII/interfaces.h
+./mibII/at.lo: ../../include/net-snmp/data_access/interface.h
+./mibII/icmp.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/icmp.lo: ../../include/net-snmp/system/linux.h
+./mibII/icmp.lo: ../../include/net-snmp/system/sysv.h
+./mibII/icmp.lo: ../../include/net-snmp/system/generic.h
+./mibII/icmp.lo: ../../include/net-snmp/machine/generic.h
+./mibII/icmp.lo: ./mibII/mibII_common.h
+./mibII/icmp.lo: ../../agent/kernel.h
+./mibII/icmp.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/icmp.lo: ../../include/net-snmp/definitions.h
+./mibII/icmp.lo: ../../include/net-snmp/types.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/icmp.lo: ../../include/net-snmp/library/asn1.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/icmp.lo: ../../include/net-snmp/utilities.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/icmp.lo: ../../include/net-snmp/library/system.h
+./mibII/icmp.lo: ../../include/net-snmp/library/tools.h
+./mibII/icmp.lo: ../../include/net-snmp/library/int64.h
+./mibII/icmp.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/icmp.lo: ../../include/net-snmp/library/callback.h
+./mibII/icmp.lo: ../../include/net-snmp/library/data_list.h
+./mibII/icmp.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/icmp.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/icmp.lo: ../../include/net-snmp/library/container.h
+./mibII/icmp.lo: ../../include/net-snmp/library/factory.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/icmp.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/icmp.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/icmp.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/icmp.lo: ../../include/net-snmp/library/container.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/icmp.lo: ../../include/net-snmp/version.h
+./mibII/icmp.lo: ../../include/net-snmp/session_api.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/icmp.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/icmp.lo: ../../include/net-snmp/pdu_api.h
+./mibII/icmp.lo: ../../include/net-snmp/mib_api.h
+./mibII/icmp.lo: ../../include/net-snmp/library/mib.h
+./mibII/icmp.lo: ../../include/net-snmp/library/parse.h
+./mibII/icmp.lo: ../../include/net-snmp/varbind_api.h
+./mibII/icmp.lo: ../../include/net-snmp/config_api.h
+./mibII/icmp.lo: ../../include/net-snmp/library/read_config.h
+./mibII/icmp.lo: ../../include/net-snmp/library/default_store.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/icmp.lo: ../../include/net-snmp/library/vacm.h
+./mibII/icmp.lo: ../../include/net-snmp/output_api.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/icmp.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/icmp.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/icmp.lo: ../../include/net-snmp/library/keytools.h
+./mibII/icmp.lo: ../../include/net-snmp/library/scapi.h
+./mibII/icmp.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/icmp.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/icmp.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/instance.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/null.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/table.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/icmp.lo: ../../include/net-snmp/agent/auto_nlist.h util_funcs.h
+./mibII/icmp.lo: struct.h ./mibII/icmp.h ./mibII/sysORTable.h
+./mibII/interfaces.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/interfaces.lo: ../../include/net-snmp/system/linux.h
+./mibII/interfaces.lo: ../../include/net-snmp/system/sysv.h
+./mibII/interfaces.lo: ../../include/net-snmp/system/generic.h
+./mibII/interfaces.lo: ../../include/net-snmp/machine/generic.h
+./mibII/interfaces.lo: ../../agent/kernel.h
+./mibII/interfaces.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/interfaces.lo: ../../include/net-snmp/definitions.h
+./mibII/interfaces.lo: ../../include/net-snmp/types.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/asn1.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/interfaces.lo: ../../include/net-snmp/utilities.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/system.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/tools.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/int64.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/callback.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/data_list.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/container.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/factory.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/container.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/interfaces.lo: ../../include/net-snmp/version.h
+./mibII/interfaces.lo: ../../include/net-snmp/session_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/interfaces.lo: ../../include/net-snmp/pdu_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/mib_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/mib.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/parse.h
+./mibII/interfaces.lo: ../../include/net-snmp/varbind_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/config_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/read_config.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/default_store.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/vacm.h
+./mibII/interfaces.lo: ../../include/net-snmp/output_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/interfaces.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/keytools.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/scapi.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/interfaces.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/instance.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/null.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/table.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/interfaces.lo: ../../include/net-snmp/agent/auto_nlist.h
+./mibII/interfaces.lo: ../../include/net-snmp/data_access/interface.h
+./mibII/interfaces.lo: ./mibII/interfaces.h struct.h util_funcs.h
+./mibII/interfaces.lo: ./mibII/sysORTable.h
+./mibII/ip.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/ip.lo: ../../include/net-snmp/system/linux.h
+./mibII/ip.lo: ../../include/net-snmp/system/sysv.h
+./mibII/ip.lo: ../../include/net-snmp/system/generic.h
+./mibII/ip.lo: ../../include/net-snmp/machine/generic.h
+./mibII/ip.lo: ./mibII/mibII_common.h
+./mibII/ip.lo: ../../agent/kernel.h
+./mibII/ip.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/ip.lo: ../../include/net-snmp/definitions.h
+./mibII/ip.lo: ../../include/net-snmp/types.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/ip.lo: ../../include/net-snmp/library/asn1.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/ip.lo: ../../include/net-snmp/utilities.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/ip.lo: ../../include/net-snmp/library/system.h
+./mibII/ip.lo: ../../include/net-snmp/library/tools.h
+./mibII/ip.lo: ../../include/net-snmp/library/int64.h
+./mibII/ip.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/ip.lo: ../../include/net-snmp/library/callback.h
+./mibII/ip.lo: ../../include/net-snmp/library/data_list.h
+./mibII/ip.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/ip.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/ip.lo: ../../include/net-snmp/library/container.h
+./mibII/ip.lo: ../../include/net-snmp/library/factory.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/ip.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/ip.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/ip.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/ip.lo: ../../include/net-snmp/library/container.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/ip.lo: ../../include/net-snmp/version.h
+./mibII/ip.lo: ../../include/net-snmp/session_api.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/ip.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/ip.lo: ../../include/net-snmp/pdu_api.h
+./mibII/ip.lo: ../../include/net-snmp/mib_api.h
+./mibII/ip.lo: ../../include/net-snmp/library/mib.h
+./mibII/ip.lo: ../../include/net-snmp/library/parse.h
+./mibII/ip.lo: ../../include/net-snmp/varbind_api.h
+./mibII/ip.lo: ../../include/net-snmp/config_api.h
+./mibII/ip.lo: ../../include/net-snmp/library/read_config.h
+./mibII/ip.lo: ../../include/net-snmp/library/default_store.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/ip.lo: ../../include/net-snmp/library/vacm.h
+./mibII/ip.lo: ../../include/net-snmp/output_api.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/ip.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/ip.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/ip.lo: ../../include/net-snmp/library/keytools.h
+./mibII/ip.lo: ../../include/net-snmp/library/scapi.h
+./mibII/ip.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/ip.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/ip.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/ip.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/ip.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/ip.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/ip.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/ip.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/ip.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/ip.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/ip.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/ip.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/ip.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/ip.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/ip.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/ip.lo: ../../include/net-snmp/agent/instance.h
+./mibII/ip.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/ip.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/ip.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/ip.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/ip.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/ip.lo: ../../include/net-snmp/agent/null.h
+./mibII/ip.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/ip.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/ip.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/ip.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/ip.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/ip.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/ip.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/ip.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/ip.lo: ../../include/net-snmp/agent/table.h
+./mibII/ip.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/ip.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/ip.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/ip.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/ip.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/ip.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/ip.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/ip.lo: ../../include/net-snmp/agent/auto_nlist.h util_funcs.h
+./mibII/ip.lo: struct.h ./mibII/ip.h ./mibII/var_route.h
+./mibII/ip.lo: ./mibII/route_write.h ./mibII/at.h ./mibII/ipAddr.h
+./mibII/ip.lo: ./mibII/interfaces.h ./mibII/sysORTable.h
+./mibII/ipAddr.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/ipAddr.lo: ../../include/net-snmp/system/linux.h
+./mibII/ipAddr.lo: ../../include/net-snmp/system/sysv.h
+./mibII/ipAddr.lo: ../../include/net-snmp/system/generic.h
+./mibII/ipAddr.lo: ../../include/net-snmp/machine/generic.h
+./mibII/ipAddr.lo: ../../agent/kernel.h
+./mibII/ipAddr.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/ipAddr.lo: ../../include/net-snmp/definitions.h
+./mibII/ipAddr.lo: ../../include/net-snmp/types.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/asn1.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/ipAddr.lo: ../../include/net-snmp/utilities.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/system.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/tools.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/int64.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/callback.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/data_list.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/container.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/factory.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/container.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/ipAddr.lo: ../../include/net-snmp/version.h
+./mibII/ipAddr.lo: ../../include/net-snmp/session_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/ipAddr.lo: ../../include/net-snmp/pdu_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/mib_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/mib.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/parse.h
+./mibII/ipAddr.lo: ../../include/net-snmp/varbind_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/config_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/read_config.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/default_store.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/vacm.h
+./mibII/ipAddr.lo: ../../include/net-snmp/output_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/ipAddr.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/keytools.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/scapi.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/ipAddr.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/instance.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/null.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/table.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/ipAddr.lo: ../../include/net-snmp/agent/auto_nlist.h
+./mibII/ipAddr.lo: ../../include/net-snmp/data_access/interface.h
+./mibII/ipAddr.lo: ./mibII/ip.h ./mibII/var_route.h ./mibII/route_write.h
+./mibII/ipAddr.lo: ./mibII/at.h ./mibII/interfaces.h ./mibII/sysORTable.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/system/linux.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/system/sysv.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/system/generic.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/machine/generic.h
+./mibII/ipCidrRouteTable.lo: ./mibII/route_headers.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/definitions.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/types.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/asn1.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmp.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/utilities.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/system.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/tools.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/int64.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/callback.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/data_list.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/container.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/factory.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/container.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/version.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/session_api.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/pdu_api.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/mib_api.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/mib.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/parse.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/varbind_api.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/config_api.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/read_config.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/default_store.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/vacm.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/output_api.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/keytools.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/scapi.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/instance.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/null.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/table.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/ipCidrRouteTable.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/ipCidrRouteTable.lo: ./mibII/ipCidrRouteTable.h
+./mibII/ipCidrRouteTable.lo: ./mibII/ipCidrRouteTable_columns.h
+./mibII/ipCidrRouteTable.lo: ./mibII/ipCidrRouteTable_enums.h
+./mibII/ipCidrRouteTable.lo: ./mibII/ipCidrRouteTable_checkfns.h
+./mibII/ipCidrRouteTable.lo: ./mibII/ipCidrRouteTable_access.h
+./mibII/ipCidrRouteTable.lo: ./mibII/var_route.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/system/linux.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/system/sysv.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/system/generic.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/machine/generic.h
+./mibII/ipCidrRouteTable_access.lo: ./mibII/route_headers.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/definitions.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/types.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/asn1.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmp.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/utilities.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/system.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/tools.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/int64.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/callback.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/data_list.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/container.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/factory.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/container.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/version.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/session_api.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/pdu_api.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/mib_api.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/mib.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/parse.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/varbind_api.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/config_api.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/read_config.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/default_store.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/vacm.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/output_api.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/keytools.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/scapi.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/instance.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/null.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/table.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/ipCidrRouteTable_access.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/ipCidrRouteTable_access.lo: ./mibII/ipCidrRouteTable_access.h
+./mibII/ipCidrRouteTable_access.lo: ./mibII/ipCidrRouteTable_enums.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/system/linux.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/system/sysv.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/system/generic.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/machine/generic.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/definitions.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/types.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/asn1.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmp.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/utilities.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/system.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/tools.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/int64.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/callback.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/data_list.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/container.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/factory.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/container.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/version.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/session_api.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/pdu_api.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/mib_api.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/mib.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/parse.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/varbind_api.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/config_api.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/read_config.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/default_store.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/vacm.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/output_api.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/keytools.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/scapi.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/ipCidrRouteTable_checkfns.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/ipCidrRouteTable_checkfns.lo: ./mibII/ipCidrRouteTable_checkfns.h
+./mibII/ipCidrRouteTable_checkfns.lo: ./mibII/ipCidrRouteTable_enums.h
+./mibII/ipv6.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/ipv6.lo: ../../include/net-snmp/system/linux.h
+./mibII/ipv6.lo: ../../include/net-snmp/system/sysv.h
+./mibII/ipv6.lo: ../../include/net-snmp/system/generic.h
+./mibII/ipv6.lo: ../../include/net-snmp/machine/generic.h
+./mibII/ipv6.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/ipv6.lo: ../../include/net-snmp/definitions.h
+./mibII/ipv6.lo: ../../include/net-snmp/types.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/asn1.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/ipv6.lo: ../../include/net-snmp/utilities.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/system.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/tools.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/int64.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/callback.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/data_list.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/container.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/factory.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/container.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/ipv6.lo: ../../include/net-snmp/version.h
+./mibII/ipv6.lo: ../../include/net-snmp/session_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/ipv6.lo: ../../include/net-snmp/pdu_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/mib_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/mib.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/parse.h
+./mibII/ipv6.lo: ../../include/net-snmp/varbind_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/config_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/read_config.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/default_store.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/vacm.h
+./mibII/ipv6.lo: ../../include/net-snmp/output_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/ipv6.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/keytools.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/scapi.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/ipv6.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/instance.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/null.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/table.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/ipv6.lo: ../../include/net-snmp/agent/auto_nlist.h
+./mibII/ipv6.lo: ../../agent/kernel.h util_funcs.h struct.h ./mibII/ipv6.h
+./mibII/ipv6.lo: ./mibII/var_route.h ./mibII/route_write.h ./mibII/at.h
+./mibII/ipv6.lo: ./mibII/interfaces.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/system/linux.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/system/sysv.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/system/generic.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/machine/generic.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/definitions.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/types.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/asn1.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/utilities.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/system.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/tools.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/int64.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/callback.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/data_list.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/container.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/factory.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/container.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/version.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/session_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/pdu_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/mib_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/mib.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/parse.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/varbind_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/config_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/read_config.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/default_store.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/vacm.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/output_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/keytools.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/scapi.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/instance.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/null.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/table.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/kernel_linux.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h
+./mibII/kernel_linux.lo: struct.h
+./mibII/kernel_linux.lo: ./mibII/kernel_linux.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/system/linux.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/system/sysv.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/system/generic.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/machine/generic.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/definitions.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/types.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/asn1.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/utilities.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/system.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/tools.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/int64.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/callback.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/data_list.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/container.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/factory.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/container.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/version.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/session_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/pdu_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/mib_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/mib.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/parse.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/varbind_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/config_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/read_config.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/default_store.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/vacm.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/output_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/keytools.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/scapi.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/instance.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/null.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/table.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/mta_sendmail.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/mta_sendmail.lo: ./mibII/mta_sendmail.h
+./mibII/route_write.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/route_write.lo: ../../include/net-snmp/system/linux.h
+./mibII/route_write.lo: ../../include/net-snmp/system/sysv.h
+./mibII/route_write.lo: ../../include/net-snmp/system/generic.h
+./mibII/route_write.lo: ../../include/net-snmp/machine/generic.h
+./mibII/route_write.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/route_write.lo: ../../include/net-snmp/definitions.h
+./mibII/route_write.lo: ../../include/net-snmp/types.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/route_write.lo: ../../include/net-snmp/library/asn1.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/route_write.lo: ../../include/net-snmp/utilities.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/route_write.lo: ../../include/net-snmp/library/system.h
+./mibII/route_write.lo: ../../include/net-snmp/library/tools.h
+./mibII/route_write.lo: ../../include/net-snmp/library/int64.h
+./mibII/route_write.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/route_write.lo: ../../include/net-snmp/library/callback.h
+./mibII/route_write.lo: ../../include/net-snmp/library/data_list.h
+./mibII/route_write.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/route_write.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/route_write.lo: ../../include/net-snmp/library/container.h
+./mibII/route_write.lo: ../../include/net-snmp/library/factory.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/route_write.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/route_write.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/route_write.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/route_write.lo: ../../include/net-snmp/library/container.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/route_write.lo: ../../include/net-snmp/version.h
+./mibII/route_write.lo: ../../include/net-snmp/session_api.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/route_write.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/route_write.lo: ../../include/net-snmp/pdu_api.h
+./mibII/route_write.lo: ../../include/net-snmp/mib_api.h
+./mibII/route_write.lo: ../../include/net-snmp/library/mib.h
+./mibII/route_write.lo: ../../include/net-snmp/library/parse.h
+./mibII/route_write.lo: ../../include/net-snmp/varbind_api.h
+./mibII/route_write.lo: ../../include/net-snmp/config_api.h
+./mibII/route_write.lo: ../../include/net-snmp/library/read_config.h
+./mibII/route_write.lo: ../../include/net-snmp/library/default_store.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/route_write.lo: ../../include/net-snmp/library/vacm.h
+./mibII/route_write.lo: ../../include/net-snmp/output_api.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/route_write.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/route_write.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/route_write.lo: ../../include/net-snmp/library/keytools.h
+./mibII/route_write.lo: ../../include/net-snmp/library/scapi.h
+./mibII/route_write.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/route_write.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/route_write.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/instance.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/null.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/table.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/route_write.lo: ../../include/net-snmp/agent/mfd.h ./mibII/ip.h
+./mibII/route_write.lo: ./mibII/var_route.h ./mibII/route_write.h
+./mibII/route_write.lo: ./mibII/at.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/system/linux.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/system/sysv.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/system/generic.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/machine/generic.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/definitions.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/types.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/asn1.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/utilities.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/system.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/tools.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/int64.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/callback.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/data_list.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/container.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/factory.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/container.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/version.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/session_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/pdu_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/mib_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/mib.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/parse.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/varbind_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/config_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/read_config.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/default_store.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/vacm.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/output_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/keytools.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/scapi.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/instance.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/null.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/table.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/setSerialNo.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/setSerialNo.lo: ./mibII/setSerialNo.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/system/linux.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/system/sysv.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/system/generic.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/machine/generic.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/definitions.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/types.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/asn1.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/utilities.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/system.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/tools.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/int64.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/callback.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/data_list.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/container.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/factory.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/container.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/version.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/session_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/pdu_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/mib_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/mib.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/parse.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/varbind_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/config_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/read_config.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/default_store.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/vacm.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/output_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/keytools.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/scapi.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/instance.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/null.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/table.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/snmp_mib.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h struct.h
+./mibII/snmp_mib.lo: ./mibII/snmp_mib.h ./mibII/sysORTable.h
+./mibII/sysORTable.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/sysORTable.lo: ../../include/net-snmp/system/linux.h
+./mibII/sysORTable.lo: ../../include/net-snmp/system/sysv.h
+./mibII/sysORTable.lo: ../../include/net-snmp/system/generic.h
+./mibII/sysORTable.lo: ../../include/net-snmp/machine/generic.h
+./mibII/sysORTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/sysORTable.lo: ../../include/net-snmp/definitions.h
+./mibII/sysORTable.lo: ../../include/net-snmp/types.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/asn1.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/sysORTable.lo: ../../include/net-snmp/utilities.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/system.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/tools.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/int64.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/callback.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/data_list.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/container.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/factory.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/container.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/sysORTable.lo: ../../include/net-snmp/version.h
+./mibII/sysORTable.lo: ../../include/net-snmp/session_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/sysORTable.lo: ../../include/net-snmp/pdu_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/mib_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/mib.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/parse.h
+./mibII/sysORTable.lo: ../../include/net-snmp/varbind_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/config_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/read_config.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/default_store.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/vacm.h
+./mibII/sysORTable.lo: ../../include/net-snmp/output_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/sysORTable.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/keytools.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/scapi.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/sysORTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/instance.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/null.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/table.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/sysORTable.lo: ../../include/net-snmp/agent/agent_callbacks.h
+./mibII/sysORTable.lo: struct.h util_funcs.h ./mibII/sysORTable.h
+./mibII/sysORTable.lo: ../../agent/snmpd.h agentx/subagent.h agentx/client.h
+./mibII/system_mib.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/system_mib.lo: ../../include/net-snmp/system/linux.h
+./mibII/system_mib.lo: ../../include/net-snmp/system/sysv.h
+./mibII/system_mib.lo: ../../include/net-snmp/system/generic.h
+./mibII/system_mib.lo: ../../include/net-snmp/machine/generic.h
+./mibII/system_mib.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/system_mib.lo: ../../include/net-snmp/definitions.h
+./mibII/system_mib.lo: ../../include/net-snmp/types.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/asn1.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/system_mib.lo: ../../include/net-snmp/utilities.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/system.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/tools.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/int64.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/callback.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/data_list.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/container.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/factory.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/container.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/system_mib.lo: ../../include/net-snmp/version.h
+./mibII/system_mib.lo: ../../include/net-snmp/session_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/system_mib.lo: ../../include/net-snmp/pdu_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/mib_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/mib.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/parse.h
+./mibII/system_mib.lo: ../../include/net-snmp/varbind_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/config_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/read_config.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/default_store.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/vacm.h
+./mibII/system_mib.lo: ../../include/net-snmp/output_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/system_mib.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/keytools.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/scapi.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/system_mib.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/instance.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/null.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/table.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/system_mib.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h
+./mibII/system_mib.lo: struct.h ./mibII/system_mib.h ./mibII/sysORTable.h
+./mibII/tcp.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/tcp.lo: ../../include/net-snmp/system/linux.h
+./mibII/tcp.lo: ../../include/net-snmp/system/sysv.h
+./mibII/tcp.lo: ../../include/net-snmp/system/generic.h
+./mibII/tcp.lo: ../../include/net-snmp/machine/generic.h
+./mibII/tcp.lo: ./mibII/mibII_common.h
+./mibII/tcp.lo: ../../agent/kernel.h
+./mibII/tcp.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/tcp.lo: ../../include/net-snmp/definitions.h
+./mibII/tcp.lo: ../../include/net-snmp/types.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/tcp.lo: ../../include/net-snmp/library/asn1.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/tcp.lo: ../../include/net-snmp/utilities.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/tcp.lo: ../../include/net-snmp/library/system.h
+./mibII/tcp.lo: ../../include/net-snmp/library/tools.h
+./mibII/tcp.lo: ../../include/net-snmp/library/int64.h
+./mibII/tcp.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/tcp.lo: ../../include/net-snmp/library/callback.h
+./mibII/tcp.lo: ../../include/net-snmp/library/data_list.h
+./mibII/tcp.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/tcp.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/tcp.lo: ../../include/net-snmp/library/container.h
+./mibII/tcp.lo: ../../include/net-snmp/library/factory.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/tcp.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/tcp.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/tcp.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/tcp.lo: ../../include/net-snmp/library/container.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/tcp.lo: ../../include/net-snmp/version.h
+./mibII/tcp.lo: ../../include/net-snmp/session_api.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/tcp.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/tcp.lo: ../../include/net-snmp/pdu_api.h
+./mibII/tcp.lo: ../../include/net-snmp/mib_api.h
+./mibII/tcp.lo: ../../include/net-snmp/library/mib.h
+./mibII/tcp.lo: ../../include/net-snmp/library/parse.h
+./mibII/tcp.lo: ../../include/net-snmp/varbind_api.h
+./mibII/tcp.lo: ../../include/net-snmp/config_api.h
+./mibII/tcp.lo: ../../include/net-snmp/library/read_config.h
+./mibII/tcp.lo: ../../include/net-snmp/library/default_store.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/tcp.lo: ../../include/net-snmp/library/vacm.h
+./mibII/tcp.lo: ../../include/net-snmp/output_api.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/tcp.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/tcp.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/tcp.lo: ../../include/net-snmp/library/keytools.h
+./mibII/tcp.lo: ../../include/net-snmp/library/scapi.h
+./mibII/tcp.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/tcp.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/tcp.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/instance.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/null.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/table.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/tcp.lo: ../../include/net-snmp/agent/auto_nlist.h util_funcs.h
+./mibII/tcp.lo: struct.h ./mibII/tcp.h ./mibII/tcpTable.h
+./mibII/tcp.lo: ./mibII/sysORTable.h
+./mibII/tcpTable.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/tcpTable.lo: ../../include/net-snmp/system/linux.h
+./mibII/tcpTable.lo: ../../include/net-snmp/system/sysv.h
+./mibII/tcpTable.lo: ../../include/net-snmp/system/generic.h
+./mibII/tcpTable.lo: ../../include/net-snmp/machine/generic.h
+./mibII/tcpTable.lo: ./mibII/mibII_common.h
+./mibII/tcpTable.lo: ../../agent/kernel.h
+./mibII/tcpTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/tcpTable.lo: ../../include/net-snmp/definitions.h
+./mibII/tcpTable.lo: ../../include/net-snmp/types.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/asn1.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/tcpTable.lo: ../../include/net-snmp/utilities.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/system.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/tools.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/int64.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/callback.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/data_list.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/container.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/factory.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/container.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/tcpTable.lo: ../../include/net-snmp/version.h
+./mibII/tcpTable.lo: ../../include/net-snmp/session_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/tcpTable.lo: ../../include/net-snmp/pdu_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/mib_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/mib.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/parse.h
+./mibII/tcpTable.lo: ../../include/net-snmp/varbind_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/config_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/read_config.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/default_store.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/vacm.h
+./mibII/tcpTable.lo: ../../include/net-snmp/output_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/tcpTable.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/keytools.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/scapi.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/tcpTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/instance.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/null.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/table.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/tcpTable.lo: ../../include/net-snmp/agent/auto_nlist.h ./mibII/tcp.h
+./mibII/tcpTable.lo: ./mibII/tcpTable.h ./mibII/sysORTable.h
+./mibII/udp.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/udp.lo: ../../include/net-snmp/system/linux.h
+./mibII/udp.lo: ../../include/net-snmp/system/sysv.h
+./mibII/udp.lo: ../../include/net-snmp/system/generic.h
+./mibII/udp.lo: ../../include/net-snmp/machine/generic.h
+./mibII/udp.lo: ./mibII/mibII_common.h
+./mibII/udp.lo: ../../agent/kernel.h
+./mibII/udp.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/udp.lo: ../../include/net-snmp/definitions.h
+./mibII/udp.lo: ../../include/net-snmp/types.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/udp.lo: ../../include/net-snmp/library/asn1.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/udp.lo: ../../include/net-snmp/utilities.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/udp.lo: ../../include/net-snmp/library/system.h
+./mibII/udp.lo: ../../include/net-snmp/library/tools.h
+./mibII/udp.lo: ../../include/net-snmp/library/int64.h
+./mibII/udp.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/udp.lo: ../../include/net-snmp/library/callback.h
+./mibII/udp.lo: ../../include/net-snmp/library/data_list.h
+./mibII/udp.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/udp.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/udp.lo: ../../include/net-snmp/library/container.h
+./mibII/udp.lo: ../../include/net-snmp/library/factory.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/udp.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/udp.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/udp.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/udp.lo: ../../include/net-snmp/library/container.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/udp.lo: ../../include/net-snmp/version.h
+./mibII/udp.lo: ../../include/net-snmp/session_api.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/udp.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/udp.lo: ../../include/net-snmp/pdu_api.h
+./mibII/udp.lo: ../../include/net-snmp/mib_api.h
+./mibII/udp.lo: ../../include/net-snmp/library/mib.h
+./mibII/udp.lo: ../../include/net-snmp/library/parse.h
+./mibII/udp.lo: ../../include/net-snmp/varbind_api.h
+./mibII/udp.lo: ../../include/net-snmp/config_api.h
+./mibII/udp.lo: ../../include/net-snmp/library/read_config.h
+./mibII/udp.lo: ../../include/net-snmp/library/default_store.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/udp.lo: ../../include/net-snmp/library/vacm.h
+./mibII/udp.lo: ../../include/net-snmp/output_api.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/udp.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/udp.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/udp.lo: ../../include/net-snmp/library/keytools.h
+./mibII/udp.lo: ../../include/net-snmp/library/scapi.h
+./mibII/udp.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/udp.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/udp.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/udp.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/udp.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/udp.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/udp.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/udp.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/udp.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/udp.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/udp.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/udp.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/udp.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/udp.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/udp.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/udp.lo: ../../include/net-snmp/agent/instance.h
+./mibII/udp.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/udp.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/udp.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/udp.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/udp.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/udp.lo: ../../include/net-snmp/agent/null.h
+./mibII/udp.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/udp.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/udp.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/udp.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/udp.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/udp.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/udp.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/udp.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/udp.lo: ../../include/net-snmp/agent/table.h
+./mibII/udp.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/udp.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/udp.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/udp.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/udp.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/udp.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/udp.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/udp.lo: ../../include/net-snmp/agent/auto_nlist.h util_funcs.h
+./mibII/udp.lo: struct.h ./mibII/udp.h ./mibII/udpTable.h
+./mibII/udp.lo: ./mibII/sysORTable.h
+./mibII/udpTable.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/udpTable.lo: ../../include/net-snmp/system/linux.h
+./mibII/udpTable.lo: ../../include/net-snmp/system/sysv.h
+./mibII/udpTable.lo: ../../include/net-snmp/system/generic.h
+./mibII/udpTable.lo: ../../include/net-snmp/machine/generic.h
+./mibII/udpTable.lo: ./mibII/mibII_common.h
+./mibII/udpTable.lo: ../../agent/kernel.h
+./mibII/udpTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/udpTable.lo: ../../include/net-snmp/definitions.h
+./mibII/udpTable.lo: ../../include/net-snmp/types.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/asn1.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/udpTable.lo: ../../include/net-snmp/utilities.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/system.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/tools.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/int64.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/callback.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/data_list.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/container.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/factory.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/container.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/udpTable.lo: ../../include/net-snmp/version.h
+./mibII/udpTable.lo: ../../include/net-snmp/session_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/udpTable.lo: ../../include/net-snmp/pdu_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/mib_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/mib.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/parse.h
+./mibII/udpTable.lo: ../../include/net-snmp/varbind_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/config_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/read_config.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/default_store.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/vacm.h
+./mibII/udpTable.lo: ../../include/net-snmp/output_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/udpTable.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/keytools.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/scapi.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/udpTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/instance.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/null.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/table.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/udpTable.lo: ../../include/net-snmp/agent/auto_nlist.h ./mibII/udp.h
+./mibII/udpTable.lo: ./mibII/udpTable.h ./mibII/sysORTable.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/system/linux.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/system/sysv.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/system/generic.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/machine/generic.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/definitions.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/types.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/asn1.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmp.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/utilities.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/system.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/tools.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/int64.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/callback.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/data_list.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/container.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/factory.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/container.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/version.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/session_api.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/pdu_api.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/mib_api.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/mib.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/parse.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/varbind_api.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/config_api.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/read_config.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/default_store.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/vacm.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/output_api.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/keytools.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/scapi.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/instance.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/null.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/table.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/vacm_conf.lo: ../../include/net-snmp/agent/agent_callbacks.h
+./mibII/vacm_conf.lo: ./mibII/vacm_conf.h util_funcs.h struct.h
+./mibII/vacm_conf.lo: ./mibII/sysORTable.h ../../agent/snmpd.h
+./mibII/vacm_context.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/vacm_context.lo: ../../include/net-snmp/system/linux.h
+./mibII/vacm_context.lo: ../../include/net-snmp/system/sysv.h
+./mibII/vacm_context.lo: ../../include/net-snmp/system/generic.h
+./mibII/vacm_context.lo: ../../include/net-snmp/machine/generic.h
+./mibII/vacm_context.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/vacm_context.lo: ../../include/net-snmp/definitions.h
+./mibII/vacm_context.lo: ../../include/net-snmp/types.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/asn1.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/vacm_context.lo: ../../include/net-snmp/utilities.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/system.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/tools.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/int64.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/callback.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/data_list.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/container.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/factory.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/container.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/vacm_context.lo: ../../include/net-snmp/version.h
+./mibII/vacm_context.lo: ../../include/net-snmp/session_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/vacm_context.lo: ../../include/net-snmp/pdu_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/mib_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/mib.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/parse.h
+./mibII/vacm_context.lo: ../../include/net-snmp/varbind_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/config_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/read_config.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/default_store.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/vacm.h
+./mibII/vacm_context.lo: ../../include/net-snmp/output_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/vacm_context.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/keytools.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/scapi.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/vacm_context.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/instance.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/null.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/table.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/vacm_context.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/vacm_context.lo: ./mibII/vacm_context.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/system/linux.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/system/sysv.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/system/generic.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/machine/generic.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/definitions.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/types.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/asn1.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/utilities.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/system.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/tools.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/int64.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/callback.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/data_list.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/container.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/factory.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/container.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/version.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/session_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/pdu_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/mib_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/mib.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/parse.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/varbind_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/config_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/read_config.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/default_store.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/vacm.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/output_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/keytools.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/scapi.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/instance.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/null.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/table.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/vacm_vars.lo: ../../include/net-snmp/agent/agent_callbacks.h
+./mibII/vacm_vars.lo: ./mibII/vacm_vars.h util_funcs.h struct.h
+./mibII/vacm_vars.lo: ./mibII/sysORTable.h
+./mibII/var_route.lo: ../../include/net-snmp/net-snmp-config.h
+./mibII/var_route.lo: ../../include/net-snmp/system/linux.h
+./mibII/var_route.lo: ../../include/net-snmp/system/sysv.h
+./mibII/var_route.lo: ../../include/net-snmp/system/generic.h
+./mibII/var_route.lo: ../../include/net-snmp/machine/generic.h
+./mibII/var_route.lo: ./mibII/route_headers.h
+./mibII/var_route.lo: ../../include/net-snmp/net-snmp-includes.h
+./mibII/var_route.lo: ../../include/net-snmp/definitions.h
+./mibII/var_route.lo: ../../include/net-snmp/types.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_api.h
+./mibII/var_route.lo: ../../include/net-snmp/library/asn1.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_impl.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp-tc.h
+./mibII/var_route.lo: ../../include/net-snmp/utilities.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_client.h
+./mibII/var_route.lo: ../../include/net-snmp/library/system.h
+./mibII/var_route.lo: ../../include/net-snmp/library/tools.h
+./mibII/var_route.lo: ../../include/net-snmp/library/int64.h
+./mibII/var_route.lo: ../../include/net-snmp/library/mt_support.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_alarm.h
+./mibII/var_route.lo: ../../include/net-snmp/library/callback.h
+./mibII/var_route.lo: ../../include/net-snmp/library/data_list.h
+./mibII/var_route.lo: ../../include/net-snmp/library/oid_stash.h
+./mibII/var_route.lo: ../../include/net-snmp/library/check_varbind.h
+./mibII/var_route.lo: ../../include/net-snmp/library/container.h
+./mibII/var_route.lo: ../../include/net-snmp/library/factory.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_logging.h
+./mibII/var_route.lo: ../../include/net-snmp/library/container_binary_array.h
+./mibII/var_route.lo: ../../include/net-snmp/library/container_list_ssll.h
+./mibII/var_route.lo: ../../include/net-snmp/library/container_iterator.h
+./mibII/var_route.lo: ../../include/net-snmp/library/container.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_assert.h
+./mibII/var_route.lo: ../../include/net-snmp/version.h
+./mibII/var_route.lo: ../../include/net-snmp/session_api.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_transport.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_service.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./mibII/var_route.lo: ../../include/net-snmp/library/ucd_compat.h
+./mibII/var_route.lo: ../../include/net-snmp/pdu_api.h
+./mibII/var_route.lo: ../../include/net-snmp/mib_api.h
+./mibII/var_route.lo: ../../include/net-snmp/library/mib.h
+./mibII/var_route.lo: ../../include/net-snmp/library/parse.h
+./mibII/var_route.lo: ../../include/net-snmp/varbind_api.h
+./mibII/var_route.lo: ../../include/net-snmp/config_api.h
+./mibII/var_route.lo: ../../include/net-snmp/library/read_config.h
+./mibII/var_route.lo: ../../include/net-snmp/library/default_store.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_enum.h
+./mibII/var_route.lo: ../../include/net-snmp/library/vacm.h
+./mibII/var_route.lo: ../../include/net-snmp/output_api.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_debug.h
+./mibII/var_route.lo: ../../include/net-snmp/snmpv3_api.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpv3.h
+./mibII/var_route.lo: ../../include/net-snmp/library/transform_oids.h
+./mibII/var_route.lo: ../../include/net-snmp/library/keytools.h
+./mibII/var_route.lo: ../../include/net-snmp/library/scapi.h
+./mibII/var_route.lo: ../../include/net-snmp/library/lcd_time.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmp_secmod.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./mibII/var_route.lo: ../../include/net-snmp/library/snmpusm.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/mib_module_config.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/agent_module_config.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/snmp_agent.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/snmp_vars.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/agent_handler.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/var_struct.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/agent_registry.h
+./mibII/var_route.lo: ../../include/net-snmp/library/fd_event_manager.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/ds_agent.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/agent_read_config.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/agent_trap.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/all_helpers.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/instance.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/baby_steps.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/scalar.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/scalar_group.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/watcher.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/multiplexer.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/null.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/debug_handler.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/cache_handler.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/old_api.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/read_only.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/row_merge.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/serialize.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/mode_end_call.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/table.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/table_data.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/table_dataset.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/table_tdata.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/table_iterator.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/table_container.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/table_array.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/mfd.h
+./mibII/var_route.lo: ../../include/net-snmp/agent/auto_nlist.h
+./mibII/var_route.lo: ../../include/net-snmp/data_access/interface.h
+./mibII/var_route.lo: ./mibII/ip.h ./mibII/var_route.h ./mibII/route_write.h
+./mibII/var_route.lo: ./mibII/at.h ../../agent/kernel.h ./mibII/interfaces.h
+./mibII/var_route.lo: struct.h util_funcs.h
+./misc/ipfwacc.lo: ../../include/net-snmp/net-snmp-config.h
+./misc/ipfwacc.lo: ../../include/net-snmp/system/linux.h
+./misc/ipfwacc.lo: ../../include/net-snmp/system/sysv.h
+./misc/ipfwacc.lo: ../../include/net-snmp/system/generic.h
+./misc/ipfwacc.lo: ../../include/net-snmp/machine/generic.h
+./misc/ipfwacc.lo: ../../include/net-snmp/net-snmp-includes.h
+./misc/ipfwacc.lo: ../../include/net-snmp/definitions.h
+./misc/ipfwacc.lo: ../../include/net-snmp/types.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/asn1.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_impl.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp-tc.h
+./misc/ipfwacc.lo: ../../include/net-snmp/utilities.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_client.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/system.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/tools.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/int64.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/mt_support.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_alarm.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/callback.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/data_list.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/oid_stash.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/check_varbind.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/container.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/factory.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_logging.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/container_binary_array.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/container_list_ssll.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/container_iterator.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/container.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_assert.h
+./misc/ipfwacc.lo: ../../include/net-snmp/version.h
+./misc/ipfwacc.lo: ../../include/net-snmp/session_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_transport.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_service.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/ucd_compat.h
+./misc/ipfwacc.lo: ../../include/net-snmp/pdu_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/mib_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/mib.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/parse.h
+./misc/ipfwacc.lo: ../../include/net-snmp/varbind_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/config_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/read_config.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/default_store.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_enum.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/vacm.h
+./misc/ipfwacc.lo: ../../include/net-snmp/output_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_debug.h
+./misc/ipfwacc.lo: ../../include/net-snmp/snmpv3_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpv3.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/transform_oids.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/keytools.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/scapi.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/lcd_time.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmp_secmod.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/snmpusm.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/mib_module_config.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/agent_module_config.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/snmp_agent.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/snmp_vars.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/agent_handler.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/var_struct.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/agent_registry.h
+./misc/ipfwacc.lo: ../../include/net-snmp/library/fd_event_manager.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/ds_agent.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/agent_read_config.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/agent_trap.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/all_helpers.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/instance.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/baby_steps.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/scalar.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/scalar_group.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/watcher.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/multiplexer.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/null.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/debug_handler.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/cache_handler.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/old_api.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/read_only.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/row_merge.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/serialize.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/mode_end_call.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/table.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/table_data.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/table_dataset.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/table_tdata.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/table_iterator.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/table_container.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/table_array.h
+./misc/ipfwacc.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h struct.h
+./misc/ipfwacc.lo: ./misc/ipfwacc.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/net-snmp-config.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/system/linux.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/system/sysv.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/system/generic.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/machine/generic.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/net-snmp-includes.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/definitions.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/types.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmp_api.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/asn1.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmp_impl.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmp.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmp-tc.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/utilities.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmp_client.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/system.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/tools.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/int64.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/mt_support.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmp_alarm.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/callback.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/data_list.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/oid_stash.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/check_varbind.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/container.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/factory.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmp_logging.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/container_binary_array.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/container_list_ssll.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/container_iterator.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/container.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmp_assert.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/version.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/session_api.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmp_transport.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmp_service.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/ucd_compat.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/pdu_api.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/mib_api.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/mib.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/parse.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/varbind_api.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/config_api.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/read_config.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/default_store.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmp_enum.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/vacm.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/output_api.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmp_debug.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/snmpv3_api.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmpv3.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/transform_oids.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/keytools.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/scapi.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/lcd_time.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmp_secmod.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/snmpusm.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/mib_module_config.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/agent_module_config.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/snmp_agent.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/snmp_vars.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/agent_handler.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/var_struct.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/agent_registry.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/library/fd_event_manager.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/ds_agent.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/agent_read_config.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/agent_trap.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/all_helpers.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/instance.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/baby_steps.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/scalar.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/scalar_group.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/watcher.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/multiplexer.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/null.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/debug_handler.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/cache_handler.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/old_api.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/read_only.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/row_merge.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/serialize.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/mode_end_call.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/table.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/table_data.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/table_dataset.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/table_tdata.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/table_iterator.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/table_container.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/table_array.h
+./notification-log-mib/notification_log.lo: ../../include/net-snmp/agent/mfd.h
+./notification-log-mib/notification_log.lo: ./notification-log-mib/notification_log.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/net-snmp-config.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/system/linux.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/system/sysv.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/system/generic.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/machine/generic.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/definitions.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/types.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/asn1.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/utilities.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_client.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/system.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/tools.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/int64.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/mt_support.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/callback.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/data_list.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/oid_stash.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/check_varbind.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/container.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/factory.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/container_iterator.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/container.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/version.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/session_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_service.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/pdu_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/mib_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/mib.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/parse.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/varbind_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/config_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/read_config.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/default_store.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/vacm.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/output_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/snmpv3_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpv3.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/transform_oids.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/keytools.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/scapi.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/lcd_time.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/snmpusm.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/var_struct.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/instance.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/scalar.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/watcher.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/null.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/old_api.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/read_only.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/row_merge.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/serialize.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/table.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/table_data.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/table_container.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/table_array.h
+./notification/snmpNotifyFilterProfileTable.lo: ../../include/net-snmp/agent/mfd.h
+./notification/snmpNotifyFilterProfileTable.lo: header_complex.h
+./notification/snmpNotifyFilterProfileTable.lo: ./notification/snmpNotifyFilterProfileTable.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/net-snmp-config.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/system/linux.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/system/sysv.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/system/generic.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/machine/generic.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/definitions.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/types.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/asn1.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/utilities.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_client.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/system.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/tools.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/int64.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/mt_support.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/callback.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/data_list.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/oid_stash.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/check_varbind.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/container.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/factory.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/container_iterator.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/container.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/version.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/session_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_service.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/pdu_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/mib_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/mib.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/parse.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/varbind_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/config_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/read_config.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/default_store.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/vacm.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/output_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/snmpv3_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpv3.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/transform_oids.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/keytools.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/scapi.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/lcd_time.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/snmpusm.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/var_struct.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/instance.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/scalar.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/watcher.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/null.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/old_api.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/read_only.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/row_merge.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/serialize.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/table.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/table_data.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/table_container.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/table_array.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/mfd.h
+./notification/snmpNotifyTable.lo: header_complex.h
+./notification/snmpNotifyTable.lo: ./notification/snmpNotifyTable.h
+./notification/snmpNotifyTable.lo: ./notification/snmpNotifyFilterProfileTable.h
+./notification/snmpNotifyTable.lo: target/snmpTargetParamsEntry.h
+./notification/snmpNotifyTable.lo: target/snmpTargetAddrEntry.h
+./notification/snmpNotifyTable.lo: target/target.h
+./notification/snmpNotifyTable.lo: snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.h
+./notification/snmpNotifyTable.lo: snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_constants.h
+./notification/snmpNotifyTable.lo: snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface.h
+./notification/snmpNotifyTable.lo: snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.h
+./notification/snmpNotifyTable.lo: snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.h
+./notification/snmpNotifyTable.lo: ../../include/net-snmp/agent/agent_callbacks.h
+./notification/snmpNotifyTable.lo: notification-log-mib/notification_log.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/net-snmp-config.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/system/linux.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/system/sysv.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/system/generic.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/machine/generic.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/definitions.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/types.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmp_api.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/asn1.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmp.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/utilities.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmp_client.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/system.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/tools.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/int64.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/mt_support.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/callback.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/data_list.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/oid_stash.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/check_varbind.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/factory.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/container_iterator.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/version.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/session_api.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmp_service.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/pdu_api.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/mib_api.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/mib.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/parse.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/varbind_api.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/config_api.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/read_config.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/default_store.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/vacm.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/output_api.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/snmpv3_api.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmpv3.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/transform_oids.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/keytools.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/scapi.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/lcd_time.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/snmpusm.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/var_struct.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/instance.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/scalar.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/watcher.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/null.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/old_api.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/read_only.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/row_merge.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/serialize.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/table.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/table_data.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/table_container.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/table_array.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/agent/mfd.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ./sctp-mib/sctpAssocLocalAddrTable.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ./sctp-mib/sctpTables_common.h
+./sctp-mib/sctpAssocLocalAddrTable.lo: ../../include/net-snmp/net-snmp-config.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/net-snmp-config.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/definitions.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/types.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmp_api.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/asn1.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmp.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/utilities.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmp_client.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/system.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/tools.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/int64.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/mt_support.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/callback.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/data_list.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/oid_stash.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/check_varbind.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/factory.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/container_iterator.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/version.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/session_api.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmp_service.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/pdu_api.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/mib_api.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/mib.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/parse.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/varbind_api.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/config_api.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/read_config.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/default_store.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/vacm.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/output_api.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/snmpv3_api.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmpv3.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/transform_oids.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/keytools.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/scapi.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/lcd_time.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/snmpusm.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/var_struct.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/instance.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/scalar.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/watcher.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/null.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/old_api.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/read_only.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/row_merge.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/serialize.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/table.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/table_data.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/table_container.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/table_array.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ../../include/net-snmp/agent/mfd.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ./sctp-mib/sctpAssocRemAddrTable.h
+./sctp-mib/sctpAssocRemAddrTable.lo: ./sctp-mib/sctpTables_common.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/net-snmp-config.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/definitions.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/types.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmp_api.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/asn1.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmp.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/utilities.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmp_client.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/system.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/tools.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/int64.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/mt_support.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/callback.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/data_list.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/oid_stash.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/check_varbind.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/factory.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/container_iterator.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/version.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/session_api.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmp_service.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/pdu_api.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/mib_api.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/mib.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/parse.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/varbind_api.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/config_api.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/read_config.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/default_store.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/vacm.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/output_api.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/snmpv3_api.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmpv3.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/transform_oids.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/keytools.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/scapi.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/lcd_time.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/snmpusm.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/var_struct.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/instance.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/scalar.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/watcher.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/null.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/old_api.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/read_only.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/row_merge.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/serialize.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/table.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/table_data.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/table_container.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/table_array.h
+./sctp-mib/sctpAssocTable.lo: ../../include/net-snmp/agent/mfd.h
+./sctp-mib/sctpAssocTable.lo: ./sctp-mib/sctpAssocTable.h
+./sctp-mib/sctpAssocTable.lo: ./sctp-mib/sctpTables_common.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/net-snmp-config.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/definitions.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/types.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmp_api.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/asn1.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmp.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/utilities.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmp_client.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/system.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/tools.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/int64.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/mt_support.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/callback.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/data_list.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/oid_stash.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/check_varbind.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/factory.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/container_iterator.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/version.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/session_api.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmp_service.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/pdu_api.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/mib_api.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/mib.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/parse.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/varbind_api.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/config_api.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/read_config.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/default_store.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/vacm.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/output_api.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/snmpv3_api.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmpv3.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/transform_oids.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/keytools.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/scapi.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/lcd_time.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/snmpusm.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/var_struct.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/instance.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/scalar.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/watcher.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/null.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/old_api.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/read_only.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/row_merge.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/serialize.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/table.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/table_data.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/table_container.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/table_array.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ../../include/net-snmp/agent/mfd.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ./sctp-mib/sctpLookupLocalPortTable.h
+./sctp-mib/sctpLookupLocalPortTable.lo: ./sctp-mib/sctpTables_common.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/net-snmp-config.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/definitions.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/types.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmp_api.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/asn1.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmp.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/utilities.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmp_client.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/system.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/tools.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/int64.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/mt_support.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/callback.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/data_list.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/oid_stash.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/check_varbind.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/factory.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/container_iterator.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/version.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/session_api.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmp_service.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/pdu_api.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/mib_api.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/mib.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/parse.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/varbind_api.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/config_api.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/read_config.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/default_store.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/vacm.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/output_api.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/snmpv3_api.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmpv3.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/transform_oids.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/keytools.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/scapi.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/lcd_time.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/snmpusm.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/var_struct.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/instance.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/scalar.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/watcher.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/null.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/old_api.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/read_only.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/row_merge.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/serialize.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/table.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/table_data.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/table_container.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/table_array.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ../../include/net-snmp/agent/mfd.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ./sctp-mib/sctpLookupRemHostNameTable.h
+./sctp-mib/sctpLookupRemHostNameTable.lo: ./sctp-mib/sctpTables_common.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/net-snmp-config.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/definitions.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/types.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmp_api.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/asn1.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmp.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/utilities.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmp_client.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/system.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/tools.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/int64.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/mt_support.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/callback.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/data_list.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/oid_stash.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/check_varbind.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/factory.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/container_iterator.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/version.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/session_api.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmp_service.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/pdu_api.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/mib_api.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/mib.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/parse.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/varbind_api.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/config_api.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/read_config.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/default_store.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/vacm.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/output_api.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/snmpv3_api.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmpv3.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/transform_oids.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/keytools.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/scapi.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/lcd_time.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/snmpusm.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/var_struct.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/instance.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/scalar.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/watcher.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/null.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/old_api.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/read_only.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/row_merge.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/serialize.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/table.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/table_data.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/table_container.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/table_array.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ../../include/net-snmp/agent/mfd.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ./sctp-mib/sctpLookupRemIPAddrTable.h
+./sctp-mib/sctpLookupRemIPAddrTable.lo: ./sctp-mib/sctpTables_common.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/net-snmp-config.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/definitions.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/types.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmp_api.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/asn1.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmp.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/utilities.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmp_client.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/system.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/tools.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/int64.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/mt_support.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/callback.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/data_list.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/oid_stash.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/check_varbind.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/factory.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/container_iterator.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/version.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/session_api.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmp_service.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/pdu_api.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/mib_api.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/mib.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/parse.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/varbind_api.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/config_api.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/read_config.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/default_store.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/vacm.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/output_api.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/snmpv3_api.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmpv3.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/transform_oids.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/keytools.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/scapi.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/lcd_time.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/snmpusm.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/var_struct.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/instance.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/scalar.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/watcher.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/null.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/old_api.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/read_only.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/row_merge.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/serialize.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/table.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/table_data.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/table_container.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/table_array.h
+./sctp-mib/sctpLookupRemPortTable.lo: ../../include/net-snmp/agent/mfd.h
+./sctp-mib/sctpLookupRemPortTable.lo: ./sctp-mib/sctpLookupRemPortTable.h
+./sctp-mib/sctpLookupRemPortTable.lo: ./sctp-mib/sctpTables_common.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/net-snmp-config.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/net-snmp-includes.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/definitions.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/types.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmp_api.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/asn1.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmp_impl.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmp.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmp-tc.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/utilities.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmp_client.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/system.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/tools.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/int64.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/mt_support.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmp_alarm.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/callback.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/data_list.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/oid_stash.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/check_varbind.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/factory.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmp_logging.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/container_binary_array.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/container_list_ssll.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/container_iterator.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmp_assert.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/version.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/session_api.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmp_transport.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmp_service.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/ucd_compat.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/pdu_api.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/mib_api.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/mib.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/parse.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/varbind_api.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/config_api.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/read_config.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/default_store.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmp_enum.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/vacm.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/output_api.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmp_debug.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/snmpv3_api.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmpv3.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/transform_oids.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/keytools.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/scapi.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/lcd_time.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmp_secmod.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/snmpusm.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/mib_module_config.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/agent_module_config.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/snmp_agent.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/snmp_vars.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/agent_handler.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/var_struct.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/agent_registry.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/library/fd_event_manager.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/ds_agent.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/agent_read_config.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/agent_trap.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/all_helpers.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/instance.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/baby_steps.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/scalar.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/scalar_group.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/watcher.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/multiplexer.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/null.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/debug_handler.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/cache_handler.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/old_api.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/read_only.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/row_merge.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/serialize.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/mode_end_call.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/table.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/table_data.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/table_dataset.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/table_tdata.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/table_iterator.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/table_container.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/table_array.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ../../include/net-snmp/agent/mfd.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ./sctp-mib/sctpLookupRemPrimIPAddrTable.h
+./sctp-mib/sctpLookupRemPrimIPAddrTable.lo: ./sctp-mib/sctpTables_common.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/net-snmp-config.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/net-snmp-includes.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/definitions.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/types.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmp_api.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/asn1.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmp_impl.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmp.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmp-tc.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/utilities.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmp_client.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/system.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/tools.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/int64.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/mt_support.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmp_alarm.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/callback.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/data_list.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/oid_stash.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/check_varbind.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/factory.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmp_logging.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/container_binary_array.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/container_list_ssll.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/container_iterator.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmp_assert.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/version.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/session_api.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmp_transport.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmp_service.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/ucd_compat.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/pdu_api.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/mib_api.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/mib.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/parse.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/varbind_api.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/config_api.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/read_config.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/default_store.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmp_enum.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/vacm.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/output_api.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmp_debug.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/snmpv3_api.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmpv3.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/transform_oids.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/keytools.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/scapi.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/lcd_time.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmp_secmod.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/snmpusm.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/mib_module_config.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/agent_module_config.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/snmp_agent.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/snmp_vars.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/agent_handler.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/var_struct.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/agent_registry.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/library/fd_event_manager.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/ds_agent.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/agent_read_config.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/agent_trap.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/all_helpers.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/instance.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/baby_steps.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/scalar.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/scalar_group.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/watcher.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/multiplexer.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/null.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/debug_handler.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/cache_handler.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/old_api.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/read_only.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/row_merge.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/serialize.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/mode_end_call.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/table.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/table_data.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/table_dataset.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/table_tdata.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/table_iterator.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/table_container.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/table_array.h
+./sctp-mib/sctpScalars.lo: ../../include/net-snmp/agent/mfd.h
+./sctp-mib/sctpScalars.lo: ./sctp-mib/sctpScalars.h
+./sctp-mib/sctpScalars.lo: ./sctp-mib/sctpScalars_common.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/net-snmp-config.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/net-snmp-includes.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/definitions.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/types.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmp_api.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/asn1.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmp_impl.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmp.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmp-tc.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/utilities.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmp_client.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/system.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/tools.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/int64.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/mt_support.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmp_alarm.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/callback.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/data_list.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/oid_stash.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/check_varbind.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/factory.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmp_logging.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/container_binary_array.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/container_list_ssll.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/container_iterator.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmp_assert.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/version.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/session_api.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmp_transport.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmp_service.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/ucd_compat.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/pdu_api.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/mib_api.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/mib.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/parse.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/varbind_api.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/config_api.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/read_config.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/default_store.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmp_enum.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/vacm.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/output_api.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmp_debug.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/snmpv3_api.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmpv3.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/transform_oids.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/keytools.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/scapi.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/lcd_time.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmp_secmod.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/snmpusm.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/mib_module_config.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/agent_module_config.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/snmp_agent.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/snmp_vars.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/agent_handler.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/var_struct.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/agent_registry.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/library/fd_event_manager.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/ds_agent.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/agent_read_config.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/agent_trap.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/all_helpers.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/instance.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/baby_steps.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/scalar.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/scalar_group.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/watcher.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/multiplexer.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/null.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/debug_handler.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/cache_handler.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/old_api.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/read_only.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/row_merge.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/serialize.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/mode_end_call.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/table.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/table_data.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/table_dataset.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/table_tdata.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/table_iterator.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/table_container.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/table_array.h
+./sctp-mib/sctpScalars_common.lo: ../../include/net-snmp/agent/mfd.h
+./sctp-mib/sctpScalars_common.lo: ./sctp-mib/sctpScalars_common.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/net-snmp-config.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/net-snmp-includes.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/definitions.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/types.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmp_api.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/asn1.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmp_impl.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmp.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmp-tc.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/utilities.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmp_client.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/system.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/tools.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/int64.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/mt_support.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmp_alarm.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/callback.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/data_list.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/oid_stash.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/check_varbind.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/factory.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmp_logging.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/container_binary_array.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/container_list_ssll.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/container_iterator.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmp_assert.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/version.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/session_api.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmp_transport.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmp_service.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/ucd_compat.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/pdu_api.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/mib_api.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/mib.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/parse.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/varbind_api.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/config_api.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/read_config.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/default_store.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmp_enum.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/vacm.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/output_api.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmp_debug.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/snmpv3_api.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmpv3.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/transform_oids.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/keytools.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/scapi.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/lcd_time.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmp_secmod.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/snmpusm.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/mib_module_config.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/agent_module_config.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/snmp_agent.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/snmp_vars.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/agent_handler.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/var_struct.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/agent_registry.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/library/fd_event_manager.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/ds_agent.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/agent_read_config.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/agent_trap.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/all_helpers.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/instance.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/baby_steps.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/scalar.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/scalar_group.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/watcher.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/multiplexer.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/null.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/debug_handler.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/cache_handler.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/old_api.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/read_only.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/row_merge.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/serialize.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/mode_end_call.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/table.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/table_data.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/table_dataset.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/table_tdata.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/table_iterator.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/table_container.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/table_array.h
+./sctp-mib/sctpScalars_linux.lo: ../../include/net-snmp/agent/mfd.h
+./sctp-mib/sctpScalars_linux.lo: ./sctp-mib/sctpScalars_common.h
+./sctp-mib/sctpTables_common.lo: ./sctp-mib/sctpTables_common.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/net-snmp-config.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/net-snmp-includes.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/definitions.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/types.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmp_api.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/asn1.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmp_impl.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmp.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmp-tc.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/utilities.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmp_client.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/system.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/tools.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/int64.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/mt_support.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmp_alarm.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/callback.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/data_list.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/oid_stash.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/check_varbind.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/factory.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmp_logging.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/container_binary_array.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/container_list_ssll.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/container_iterator.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmp_assert.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/version.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/session_api.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmp_transport.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmp_service.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/ucd_compat.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/pdu_api.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/mib_api.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/mib.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/parse.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/varbind_api.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/config_api.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/read_config.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/default_store.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmp_enum.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/vacm.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/output_api.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmp_debug.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/snmpv3_api.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmpv3.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/transform_oids.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/keytools.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/scapi.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/lcd_time.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmp_secmod.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/snmpusm.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/mib_module_config.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/agent_module_config.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/snmp_agent.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/snmp_vars.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/agent_handler.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/var_struct.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/agent_registry.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/library/fd_event_manager.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/ds_agent.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/agent_read_config.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/agent_trap.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/all_helpers.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/instance.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/baby_steps.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/scalar.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/scalar_group.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/watcher.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/multiplexer.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/null.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/debug_handler.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/cache_handler.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/old_api.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/read_only.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/row_merge.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/serialize.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/mode_end_call.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/table.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/table_data.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/table_dataset.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/table_tdata.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/table_iterator.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/table_container.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/table_array.h
+./sctp-mib/sctpTables_common.lo: ../../include/net-snmp/agent/mfd.h
+./sctp-mib/sctpTables_common.lo: ./sctp-mib/sctpAssocTable.h
+./sctp-mib/sctpTables_common.lo: ./sctp-mib/sctpAssocRemAddrTable.h
+./sctp-mib/sctpTables_common.lo: ./sctp-mib/sctpAssocLocalAddrTable.h
+./sctp-mib/sctpTables_common.lo: ./sctp-mib/sctpLookupLocalPortTable.h
+./sctp-mib/sctpTables_common.lo: ./sctp-mib/sctpLookupRemPortTable.h
+./sctp-mib/sctpTables_common.lo: ./sctp-mib/sctpLookupRemHostNameTable.h
+./sctp-mib/sctpTables_common.lo: ./sctp-mib/sctpLookupRemPrimIPAddrTable.h
+./sctp-mib/sctpTables_common.lo: ./sctp-mib/sctpLookupRemIPAddrTable.h
+./sctp-mib/sctpTables_linux.lo: ./sctp-mib/sctpAssocTable.h
+./sctp-mib/sctpTables_linux.lo: ./sctp-mib/sctpTables_common.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/net-snmp-config.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/net-snmp-includes.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/definitions.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/types.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmp_api.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/asn1.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmp_impl.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmp.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmp-tc.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/utilities.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmp_client.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/system.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/tools.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/int64.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/mt_support.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmp_alarm.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/callback.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/data_list.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/oid_stash.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/check_varbind.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/factory.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmp_logging.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/container_binary_array.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/container_list_ssll.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/container_iterator.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/container.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmp_assert.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/version.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/session_api.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmp_transport.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmp_service.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/ucd_compat.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/pdu_api.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/mib_api.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/mib.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/parse.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/varbind_api.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/config_api.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/read_config.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/default_store.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmp_enum.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/vacm.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/output_api.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmp_debug.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/snmpv3_api.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmpv3.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/transform_oids.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/keytools.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/scapi.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/lcd_time.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmp_secmod.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/snmpusm.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/mib_module_config.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/agent_module_config.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/snmp_agent.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/snmp_vars.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/agent_handler.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/var_struct.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/agent_registry.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/library/fd_event_manager.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/ds_agent.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/agent_read_config.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/agent_trap.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/all_helpers.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/instance.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/baby_steps.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/scalar.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/scalar_group.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/watcher.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/multiplexer.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/null.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/debug_handler.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/cache_handler.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/old_api.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/read_only.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/row_merge.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/serialize.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/mode_end_call.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/table.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/table_data.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/table_dataset.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/table_tdata.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/table_iterator.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/table_container.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/table_array.h
+./sctp-mib/sctpTables_linux.lo: ../../include/net-snmp/agent/mfd.h
+./sctp-mib/sctpTables_linux.lo: ./sctp-mib/sctpAssocLocalAddrTable.h
+./sctp-mib/sctpTables_linux.lo: ./sctp-mib/sctpAssocRemAddrTable.h
+./sctp-mib/sctpTables_linux.lo: util_funcs.h struct.h
+./smux/smux.lo: ../../include/net-snmp/net-snmp-config.h
+./smux/smux.lo: ../../include/net-snmp/net-snmp-includes.h
+./smux/smux.lo: ../../include/net-snmp/definitions.h
+./smux/smux.lo: ../../include/net-snmp/types.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_api.h
+./smux/smux.lo: ../../include/net-snmp/library/asn1.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_impl.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp-tc.h
+./smux/smux.lo: ../../include/net-snmp/utilities.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_client.h
+./smux/smux.lo: ../../include/net-snmp/library/system.h
+./smux/smux.lo: ../../include/net-snmp/library/tools.h
+./smux/smux.lo: ../../include/net-snmp/library/int64.h
+./smux/smux.lo: ../../include/net-snmp/library/mt_support.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_alarm.h
+./smux/smux.lo: ../../include/net-snmp/library/callback.h
+./smux/smux.lo: ../../include/net-snmp/library/data_list.h
+./smux/smux.lo: ../../include/net-snmp/library/oid_stash.h
+./smux/smux.lo: ../../include/net-snmp/library/check_varbind.h
+./smux/smux.lo: ../../include/net-snmp/library/container.h
+./smux/smux.lo: ../../include/net-snmp/library/factory.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_logging.h
+./smux/smux.lo: ../../include/net-snmp/library/container_binary_array.h
+./smux/smux.lo: ../../include/net-snmp/library/container_list_ssll.h
+./smux/smux.lo: ../../include/net-snmp/library/container_iterator.h
+./smux/smux.lo: ../../include/net-snmp/library/container.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_assert.h
+./smux/smux.lo: ../../include/net-snmp/version.h
+./smux/smux.lo: ../../include/net-snmp/session_api.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_transport.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_service.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./smux/smux.lo: ../../include/net-snmp/library/ucd_compat.h
+./smux/smux.lo: ../../include/net-snmp/pdu_api.h
+./smux/smux.lo: ../../include/net-snmp/mib_api.h
+./smux/smux.lo: ../../include/net-snmp/library/mib.h
+./smux/smux.lo: ../../include/net-snmp/library/parse.h
+./smux/smux.lo: ../../include/net-snmp/varbind_api.h
+./smux/smux.lo: ../../include/net-snmp/config_api.h
+./smux/smux.lo: ../../include/net-snmp/library/read_config.h
+./smux/smux.lo: ../../include/net-snmp/library/default_store.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_enum.h
+./smux/smux.lo: ../../include/net-snmp/library/vacm.h
+./smux/smux.lo: ../../include/net-snmp/output_api.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_debug.h
+./smux/smux.lo: ../../include/net-snmp/snmpv3_api.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpv3.h
+./smux/smux.lo: ../../include/net-snmp/library/transform_oids.h
+./smux/smux.lo: ../../include/net-snmp/library/keytools.h
+./smux/smux.lo: ../../include/net-snmp/library/scapi.h
+./smux/smux.lo: ../../include/net-snmp/library/lcd_time.h
+./smux/smux.lo: ../../include/net-snmp/library/snmp_secmod.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./smux/smux.lo: ../../include/net-snmp/library/snmpusm.h
+./smux/smux.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./smux/smux.lo: ../../include/net-snmp/agent/mib_module_config.h
+./smux/smux.lo: ../../include/net-snmp/agent/agent_module_config.h
+./smux/smux.lo: ../../include/net-snmp/agent/snmp_agent.h
+./smux/smux.lo: ../../include/net-snmp/agent/snmp_vars.h
+./smux/smux.lo: ../../include/net-snmp/agent/agent_handler.h
+./smux/smux.lo: ../../include/net-snmp/agent/var_struct.h
+./smux/smux.lo: ../../include/net-snmp/agent/agent_registry.h
+./smux/smux.lo: ../../include/net-snmp/library/fd_event_manager.h
+./smux/smux.lo: ../../include/net-snmp/agent/ds_agent.h
+./smux/smux.lo: ../../include/net-snmp/agent/agent_read_config.h
+./smux/smux.lo: ../../include/net-snmp/agent/agent_trap.h
+./smux/smux.lo: ../../include/net-snmp/agent/all_helpers.h
+./smux/smux.lo: ../../include/net-snmp/agent/instance.h
+./smux/smux.lo: ../../include/net-snmp/agent/baby_steps.h
+./smux/smux.lo: ../../include/net-snmp/agent/scalar.h
+./smux/smux.lo: ../../include/net-snmp/agent/scalar_group.h
+./smux/smux.lo: ../../include/net-snmp/agent/watcher.h
+./smux/smux.lo: ../../include/net-snmp/agent/multiplexer.h
+./smux/smux.lo: ../../include/net-snmp/agent/null.h
+./smux/smux.lo: ../../include/net-snmp/agent/debug_handler.h
+./smux/smux.lo: ../../include/net-snmp/agent/cache_handler.h
+./smux/smux.lo: ../../include/net-snmp/agent/old_api.h
+./smux/smux.lo: ../../include/net-snmp/agent/read_only.h
+./smux/smux.lo: ../../include/net-snmp/agent/row_merge.h
+./smux/smux.lo: ../../include/net-snmp/agent/serialize.h
+./smux/smux.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./smux/smux.lo: ../../include/net-snmp/agent/mode_end_call.h
+./smux/smux.lo: ../../include/net-snmp/agent/table.h
+./smux/smux.lo: ../../include/net-snmp/agent/table_data.h
+./smux/smux.lo: ../../include/net-snmp/agent/table_dataset.h
+./smux/smux.lo: ../../include/net-snmp/agent/table_tdata.h
+./smux/smux.lo: ../../include/net-snmp/agent/table_iterator.h
+./smux/smux.lo: ../../include/net-snmp/agent/table_container.h
+./smux/smux.lo: ../../include/net-snmp/agent/table_array.h
+./smux/smux.lo: ../../include/net-snmp/agent/mfd.h smux.h util_funcs.h
+./smux/smux.lo: struct.h mibdefs.h ../../agent/snmpd.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/net-snmp-config.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/net-snmp-includes.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/definitions.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/types.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/asn1.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_impl.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp-tc.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/utilities.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_client.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/system.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/tools.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/int64.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/mt_support.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_alarm.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/callback.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/data_list.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/oid_stash.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/check_varbind.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/container.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/factory.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_logging.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/container_binary_array.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/container_list_ssll.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/container_iterator.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/container.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_assert.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/version.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/session_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_transport.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_service.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/ucd_compat.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/pdu_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/mib_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/mib.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/parse.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/varbind_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/config_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/read_config.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/default_store.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_enum.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/vacm.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/output_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_debug.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/snmpv3_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpv3.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/transform_oids.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/keytools.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/scapi.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/lcd_time.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmp_secmod.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/snmpusm.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/mib_module_config.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/agent_module_config.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/snmp_agent.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/snmp_vars.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/agent_handler.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/var_struct.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/agent_registry.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/library/fd_event_manager.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/ds_agent.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/agent_read_config.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/agent_trap.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/all_helpers.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/instance.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/baby_steps.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/scalar.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/scalar_group.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/watcher.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/multiplexer.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/null.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/debug_handler.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/cache_handler.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/old_api.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/read_only.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/row_merge.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/serialize.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/mode_end_call.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/table.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/table_data.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/table_dataset.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/table_tdata.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/table_iterator.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/table_container.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/table_array.h
+./smux/snmp_bgp.lo: ../../include/net-snmp/agent/mfd.h smux.h
+./smux/snmp_bgp.lo: ./smux/snmp_bgp.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/net-snmp-config.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/net-snmp-includes.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/definitions.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/types.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/asn1.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_impl.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp-tc.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/utilities.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_client.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/system.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/tools.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/int64.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/mt_support.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_alarm.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/callback.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/data_list.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/oid_stash.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/check_varbind.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/container.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/factory.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_logging.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/container_binary_array.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/container_list_ssll.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/container_iterator.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/container.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_assert.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/version.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/session_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_transport.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_service.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/ucd_compat.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/pdu_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/mib_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/mib.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/parse.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/varbind_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/config_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/read_config.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/default_store.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_enum.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/vacm.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/output_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_debug.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/snmpv3_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpv3.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/transform_oids.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/keytools.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/scapi.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/lcd_time.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmp_secmod.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/snmpusm.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/mib_module_config.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/agent_module_config.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/snmp_agent.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/snmp_vars.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/agent_handler.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/var_struct.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/agent_registry.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/library/fd_event_manager.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/ds_agent.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/agent_read_config.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/agent_trap.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/all_helpers.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/instance.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/baby_steps.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/scalar.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/scalar_group.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/watcher.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/multiplexer.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/null.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/debug_handler.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/cache_handler.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/old_api.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/read_only.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/row_merge.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/serialize.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/mode_end_call.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/table.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/table_data.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/table_dataset.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/table_tdata.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/table_iterator.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/table_container.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/table_array.h
+./smux/snmp_ospf.lo: ../../include/net-snmp/agent/mfd.h smux.h
+./smux/snmp_ospf.lo: ./smux/snmp_ospf.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/net-snmp-config.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/net-snmp-includes.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/definitions.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/types.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/asn1.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_impl.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp-tc.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/utilities.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_client.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/system.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/tools.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/int64.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/mt_support.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_alarm.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/callback.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/data_list.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/oid_stash.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/check_varbind.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/container.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/factory.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_logging.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/container_binary_array.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/container_list_ssll.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/container_iterator.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/container.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_assert.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/version.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/session_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_transport.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_service.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/ucd_compat.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/pdu_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/mib_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/mib.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/parse.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/varbind_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/config_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/read_config.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/default_store.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_enum.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/vacm.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/output_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_debug.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/snmpv3_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpv3.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/transform_oids.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/keytools.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/scapi.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/lcd_time.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmp_secmod.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/snmpusm.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/mib_module_config.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/agent_module_config.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/snmp_agent.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/snmp_vars.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/agent_handler.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/var_struct.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/agent_registry.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/library/fd_event_manager.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/ds_agent.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/agent_read_config.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/agent_trap.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/all_helpers.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/instance.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/baby_steps.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/scalar.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/scalar_group.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/watcher.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/multiplexer.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/null.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/debug_handler.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/cache_handler.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/old_api.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/read_only.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/row_merge.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/serialize.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/mode_end_call.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/table.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/table_data.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/table_dataset.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/table_tdata.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/table_iterator.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/table_container.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/table_array.h
+./smux/snmp_rip2.lo: ../../include/net-snmp/agent/mfd.h smux.h
+./smux/snmp_rip2.lo: ./smux/snmp_rip2.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/net-snmp-config.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/net-snmp-includes.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/definitions.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/types.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/asn1.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_impl.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp-tc.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/utilities.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_client.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/system.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/tools.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/int64.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/mt_support.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_alarm.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/callback.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/data_list.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/oid_stash.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/check_varbind.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/container.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/factory.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_logging.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/container_binary_array.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/container_list_ssll.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/container_iterator.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/container.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_assert.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/version.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/session_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_transport.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_service.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/ucd_compat.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/pdu_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/mib_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/mib.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/parse.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/varbind_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/config_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/read_config.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/default_store.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_enum.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/vacm.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/output_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_debug.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/snmpv3_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpv3.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/transform_oids.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/keytools.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/scapi.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/lcd_time.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmp_secmod.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/snmpusm.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/mib_module_config.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/agent_module_config.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/snmp_agent.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/snmp_vars.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/agent_handler.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/var_struct.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/agent_registry.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/library/fd_event_manager.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/ds_agent.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/agent_read_config.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/agent_trap.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/all_helpers.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/instance.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/baby_steps.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/scalar.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/scalar_group.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/watcher.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/multiplexer.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/null.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/debug_handler.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/cache_handler.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/old_api.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/read_only.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/row_merge.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/serialize.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/mode_end_call.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/table.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/table_data.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/table_dataset.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/table_tdata.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/table_iterator.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/table_container.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/table_array.h
+./snmpv3/snmpEngine.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h
+./snmpv3/snmpEngine.lo: struct.h mibII/sysORTable.h ./snmpv3/snmpEngine.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/net-snmp-config.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/net-snmp-includes.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/definitions.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/types.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/asn1.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_impl.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp-tc.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/utilities.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_client.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/system.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/tools.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/int64.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/mt_support.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_alarm.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/callback.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/data_list.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/oid_stash.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/check_varbind.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/container.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/factory.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_logging.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/container_binary_array.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/container_list_ssll.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/container_iterator.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/container.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_assert.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/version.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/session_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_transport.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_service.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/ucd_compat.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/pdu_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/mib_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/mib.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/parse.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/varbind_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/config_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/read_config.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/default_store.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_enum.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/vacm.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/output_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_debug.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/snmpv3_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpv3.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/transform_oids.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/keytools.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/scapi.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/lcd_time.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmp_secmod.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/snmpusm.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/mib_module_config.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/agent_module_config.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/snmp_agent.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/snmp_vars.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/agent_handler.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/var_struct.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/agent_registry.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/library/fd_event_manager.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/ds_agent.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/agent_read_config.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/agent_trap.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/all_helpers.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/instance.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/baby_steps.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/scalar.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/scalar_group.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/watcher.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/multiplexer.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/null.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/debug_handler.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/cache_handler.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/old_api.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/read_only.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/row_merge.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/serialize.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/mode_end_call.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/table.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/table_data.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/table_dataset.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/table_tdata.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/table_iterator.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/table_container.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/table_array.h
+./snmpv3/snmpMPDStats.lo: ../../include/net-snmp/agent/mfd.h
+./snmpv3/snmpMPDStats.lo: mibII/sysORTable.h ./snmpv3/snmpMPDStats.h
+./snmpv3/snmpMPDStats.lo: util_funcs.h struct.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/net-snmp-config.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/net-snmp-includes.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/definitions.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/types.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmp_api.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/asn1.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmp_impl.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmp.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmp-tc.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/utilities.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmp_client.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/system.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/tools.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/int64.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/mt_support.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmp_alarm.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/callback.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/data_list.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/oid_stash.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/check_varbind.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/container.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/factory.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmp_logging.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/container_binary_array.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/container_list_ssll.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/container_iterator.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/container.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmp_assert.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/version.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/session_api.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmp_transport.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmp_service.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/ucd_compat.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/pdu_api.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/mib_api.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/mib.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/parse.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/varbind_api.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/config_api.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/read_config.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/default_store.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmp_enum.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/vacm.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/output_api.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmp_debug.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/snmpv3_api.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmpv3.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/transform_oids.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/keytools.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/scapi.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/lcd_time.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmp_secmod.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/snmpusm.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/mib_module_config.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/agent_module_config.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/snmp_agent.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/snmp_vars.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/agent_handler.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/var_struct.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/agent_registry.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/library/fd_event_manager.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/ds_agent.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/agent_read_config.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/agent_trap.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/all_helpers.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/instance.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/baby_steps.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/scalar.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/scalar_group.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/watcher.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/multiplexer.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/null.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/debug_handler.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/cache_handler.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/old_api.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/read_only.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/row_merge.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/serialize.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/mode_end_call.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/table.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/table_data.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/table_dataset.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/table_tdata.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/table_iterator.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/table_container.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/table_array.h
+./snmpv3/usmConf.lo: ../../include/net-snmp/agent/mfd.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/net-snmp-config.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/net-snmp-includes.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/definitions.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/types.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/asn1.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_impl.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp-tc.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/utilities.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_client.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/system.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/tools.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/int64.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/mt_support.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_alarm.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/callback.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/data_list.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/oid_stash.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/check_varbind.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/container.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/factory.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_logging.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/container_binary_array.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/container_list_ssll.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/container_iterator.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/container.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_assert.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/version.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/session_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_transport.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_service.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/ucd_compat.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/pdu_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/mib_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/mib.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/parse.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/varbind_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/config_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/read_config.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/default_store.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_enum.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/vacm.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/output_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_debug.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/snmpv3_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpv3.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/transform_oids.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/keytools.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/scapi.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/lcd_time.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmp_secmod.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/snmpusm.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/mib_module_config.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/agent_module_config.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/snmp_agent.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/snmp_vars.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/agent_handler.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/var_struct.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/agent_registry.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/library/fd_event_manager.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/ds_agent.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/agent_read_config.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/agent_trap.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/all_helpers.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/instance.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/baby_steps.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/scalar.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/scalar_group.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/watcher.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/multiplexer.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/null.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/debug_handler.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/cache_handler.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/old_api.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/read_only.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/row_merge.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/serialize.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/mode_end_call.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/table.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/table_data.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/table_dataset.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/table_tdata.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/table_iterator.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/table_container.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/table_array.h
+./snmpv3/usmStats.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h
+./snmpv3/usmStats.lo: struct.h mibII/sysORTable.h ./snmpv3/usmStats.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/net-snmp-config.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/net-snmp-includes.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/definitions.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/types.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/asn1.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_impl.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp-tc.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/utilities.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_client.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/system.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/tools.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/int64.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/mt_support.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_alarm.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/callback.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/data_list.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/oid_stash.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/check_varbind.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/container.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/factory.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_logging.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/container_binary_array.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/container_list_ssll.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/container_iterator.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/container.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_assert.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/version.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/session_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_transport.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_service.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/ucd_compat.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/pdu_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/mib_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/mib.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/parse.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/varbind_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/config_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/read_config.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/default_store.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_enum.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/vacm.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/output_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_debug.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/snmpv3_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpv3.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/transform_oids.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/keytools.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/scapi.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/lcd_time.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmp_secmod.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/snmpusm.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/mib_module_config.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/agent_module_config.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/snmp_agent.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/snmp_vars.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/agent_handler.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/var_struct.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/agent_registry.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/library/fd_event_manager.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/ds_agent.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/agent_read_config.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/agent_trap.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/all_helpers.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/instance.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/baby_steps.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/scalar.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/scalar_group.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/watcher.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/multiplexer.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/null.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/debug_handler.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/cache_handler.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/old_api.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/read_only.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/row_merge.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/serialize.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/mode_end_call.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/table.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/table_data.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/table_dataset.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/table_tdata.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/table_iterator.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/table_container.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/table_array.h
+./snmpv3/usmUser.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h struct.h
+./snmpv3/usmUser.lo: ./snmpv3/usmUser.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/net-snmp-config.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/net-snmp-includes.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/definitions.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/types.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/asn1.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_impl.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp-tc.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/utilities.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_client.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/system.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/tools.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/int64.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/mt_support.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_alarm.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/callback.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/data_list.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/oid_stash.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/check_varbind.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/container.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/factory.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_logging.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/container_binary_array.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/container_list_ssll.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/container_iterator.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/container.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_assert.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/version.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/session_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_transport.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_service.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/ucd_compat.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/pdu_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/mib_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/mib.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/parse.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/varbind_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/config_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/read_config.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/default_store.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_enum.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/vacm.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/output_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_debug.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/snmpv3_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpv3.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/transform_oids.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/keytools.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/scapi.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/lcd_time.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmp_secmod.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/snmpusm.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/mib_module_config.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/agent_module_config.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/snmp_agent.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/snmp_vars.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/agent_handler.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/var_struct.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/agent_registry.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/library/fd_event_manager.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/ds_agent.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/agent_read_config.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/agent_trap.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/all_helpers.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/instance.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/baby_steps.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/scalar.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/scalar_group.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/watcher.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/multiplexer.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/null.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/debug_handler.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/cache_handler.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/old_api.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/read_only.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/row_merge.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/serialize.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/mode_end_call.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/table.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/table_data.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/table_dataset.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/table_tdata.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/table_iterator.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/table_container.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/table_array.h
+./target/snmpTargetAddrEntry.lo: ../../include/net-snmp/agent/mfd.h
+./target/snmpTargetAddrEntry.lo: ./target/snmpTargetAddrEntry.h util_funcs.h
+./target/snmpTargetAddrEntry.lo: struct.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/net-snmp-config.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/net-snmp-includes.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/definitions.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/types.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/asn1.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_impl.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp-tc.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/utilities.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_client.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/system.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/tools.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/int64.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/mt_support.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_alarm.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/callback.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/data_list.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/oid_stash.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/check_varbind.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/container.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/factory.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_logging.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/container_binary_array.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/container_list_ssll.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/container_iterator.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/container.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_assert.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/version.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/session_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_transport.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_service.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/ucd_compat.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/pdu_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/mib_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/mib.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/parse.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/varbind_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/config_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/read_config.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/default_store.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_enum.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/vacm.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/output_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_debug.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/snmpv3_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpv3.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/transform_oids.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/keytools.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/scapi.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/lcd_time.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmp_secmod.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/snmpusm.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/mib_module_config.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/agent_module_config.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/snmp_agent.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/snmp_vars.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/agent_handler.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/var_struct.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/agent_registry.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/library/fd_event_manager.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/ds_agent.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/agent_read_config.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/agent_trap.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/all_helpers.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/instance.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/baby_steps.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/scalar.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/scalar_group.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/watcher.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/multiplexer.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/null.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/debug_handler.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/cache_handler.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/old_api.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/read_only.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/row_merge.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/serialize.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/mode_end_call.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/table.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/table_data.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/table_dataset.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/table_tdata.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/table_iterator.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/table_container.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/table_array.h
+./target/snmpTargetParamsEntry.lo: ../../include/net-snmp/agent/mfd.h
+./target/snmpTargetParamsEntry.lo: ./target/snmpTargetParamsEntry.h
+./target/target.lo: ../../include/net-snmp/net-snmp-config.h
+./target/target.lo: ../../include/net-snmp/net-snmp-includes.h
+./target/target.lo: ../../include/net-snmp/definitions.h
+./target/target.lo: ../../include/net-snmp/types.h
+./target/target.lo: ../../include/net-snmp/library/snmp_api.h
+./target/target.lo: ../../include/net-snmp/library/asn1.h
+./target/target.lo: ../../include/net-snmp/library/snmp_impl.h
+./target/target.lo: ../../include/net-snmp/library/snmp.h
+./target/target.lo: ../../include/net-snmp/library/snmp-tc.h
+./target/target.lo: ../../include/net-snmp/utilities.h
+./target/target.lo: ../../include/net-snmp/library/snmp_client.h
+./target/target.lo: ../../include/net-snmp/library/system.h
+./target/target.lo: ../../include/net-snmp/library/tools.h
+./target/target.lo: ../../include/net-snmp/library/int64.h
+./target/target.lo: ../../include/net-snmp/library/mt_support.h
+./target/target.lo: ../../include/net-snmp/library/snmp_alarm.h
+./target/target.lo: ../../include/net-snmp/library/callback.h
+./target/target.lo: ../../include/net-snmp/library/data_list.h
+./target/target.lo: ../../include/net-snmp/library/oid_stash.h
+./target/target.lo: ../../include/net-snmp/library/check_varbind.h
+./target/target.lo: ../../include/net-snmp/library/container.h
+./target/target.lo: ../../include/net-snmp/library/factory.h
+./target/target.lo: ../../include/net-snmp/library/snmp_logging.h
+./target/target.lo: ../../include/net-snmp/library/container_binary_array.h
+./target/target.lo: ../../include/net-snmp/library/container_list_ssll.h
+./target/target.lo: ../../include/net-snmp/library/container_iterator.h
+./target/target.lo: ../../include/net-snmp/library/container.h
+./target/target.lo: ../../include/net-snmp/library/snmp_assert.h
+./target/target.lo: ../../include/net-snmp/version.h
+./target/target.lo: ../../include/net-snmp/session_api.h
+./target/target.lo: ../../include/net-snmp/library/snmp_transport.h
+./target/target.lo: ../../include/net-snmp/library/snmp_service.h
+./target/target.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./target/target.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./target/target.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./target/target.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./target/target.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./target/target.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./target/target.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./target/target.lo: ../../include/net-snmp/library/ucd_compat.h
+./target/target.lo: ../../include/net-snmp/pdu_api.h
+./target/target.lo: ../../include/net-snmp/mib_api.h
+./target/target.lo: ../../include/net-snmp/library/mib.h
+./target/target.lo: ../../include/net-snmp/library/parse.h
+./target/target.lo: ../../include/net-snmp/varbind_api.h
+./target/target.lo: ../../include/net-snmp/config_api.h
+./target/target.lo: ../../include/net-snmp/library/read_config.h
+./target/target.lo: ../../include/net-snmp/library/default_store.h
+./target/target.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./target/target.lo: ../../include/net-snmp/library/snmp_enum.h
+./target/target.lo: ../../include/net-snmp/library/vacm.h
+./target/target.lo: ../../include/net-snmp/output_api.h
+./target/target.lo: ../../include/net-snmp/library/snmp_debug.h
+./target/target.lo: ../../include/net-snmp/snmpv3_api.h
+./target/target.lo: ../../include/net-snmp/library/snmpv3.h
+./target/target.lo: ../../include/net-snmp/library/transform_oids.h
+./target/target.lo: ../../include/net-snmp/library/keytools.h
+./target/target.lo: ../../include/net-snmp/library/scapi.h
+./target/target.lo: ../../include/net-snmp/library/lcd_time.h
+./target/target.lo: ../../include/net-snmp/library/snmp_secmod.h
+./target/target.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./target/target.lo: ../../include/net-snmp/library/snmpusm.h
+./target/target.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./target/target.lo: ../../include/net-snmp/agent/mib_module_config.h
+./target/target.lo: ../../include/net-snmp/agent/agent_module_config.h
+./target/target.lo: ../../include/net-snmp/agent/snmp_agent.h
+./target/target.lo: ../../include/net-snmp/agent/snmp_vars.h
+./target/target.lo: ../../include/net-snmp/agent/agent_handler.h
+./target/target.lo: ../../include/net-snmp/agent/var_struct.h
+./target/target.lo: ../../include/net-snmp/agent/agent_registry.h
+./target/target.lo: ../../include/net-snmp/library/fd_event_manager.h
+./target/target.lo: ../../include/net-snmp/agent/ds_agent.h
+./target/target.lo: ../../include/net-snmp/agent/agent_read_config.h
+./target/target.lo: ../../include/net-snmp/agent/agent_trap.h
+./target/target.lo: ../../include/net-snmp/agent/all_helpers.h
+./target/target.lo: ../../include/net-snmp/agent/instance.h
+./target/target.lo: ../../include/net-snmp/agent/baby_steps.h
+./target/target.lo: ../../include/net-snmp/agent/scalar.h
+./target/target.lo: ../../include/net-snmp/agent/scalar_group.h
+./target/target.lo: ../../include/net-snmp/agent/watcher.h
+./target/target.lo: ../../include/net-snmp/agent/multiplexer.h
+./target/target.lo: ../../include/net-snmp/agent/null.h
+./target/target.lo: ../../include/net-snmp/agent/debug_handler.h
+./target/target.lo: ../../include/net-snmp/agent/cache_handler.h
+./target/target.lo: ../../include/net-snmp/agent/old_api.h
+./target/target.lo: ../../include/net-snmp/agent/read_only.h
+./target/target.lo: ../../include/net-snmp/agent/row_merge.h
+./target/target.lo: ../../include/net-snmp/agent/serialize.h
+./target/target.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./target/target.lo: ../../include/net-snmp/agent/mode_end_call.h
+./target/target.lo: ../../include/net-snmp/agent/table.h
+./target/target.lo: ../../include/net-snmp/agent/table_data.h
+./target/target.lo: ../../include/net-snmp/agent/table_dataset.h
+./target/target.lo: ../../include/net-snmp/agent/table_tdata.h
+./target/target.lo: ../../include/net-snmp/agent/table_iterator.h
+./target/target.lo: ../../include/net-snmp/agent/table_container.h
+./target/target.lo: ../../include/net-snmp/agent/table_array.h
+./target/target.lo: ../../include/net-snmp/agent/mfd.h
+./target/target.lo: ./target/snmpTargetAddrEntry.h
+./target/target.lo: ./target/snmpTargetParamsEntry.h target.h
+./target/target_counters.lo: ../../include/net-snmp/net-snmp-config.h
+./target/target_counters.lo: ../../include/net-snmp/net-snmp-includes.h
+./target/target_counters.lo: ../../include/net-snmp/definitions.h
+./target/target_counters.lo: ../../include/net-snmp/types.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_api.h
+./target/target_counters.lo: ../../include/net-snmp/library/asn1.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_impl.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp-tc.h
+./target/target_counters.lo: ../../include/net-snmp/utilities.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_client.h
+./target/target_counters.lo: ../../include/net-snmp/library/system.h
+./target/target_counters.lo: ../../include/net-snmp/library/tools.h
+./target/target_counters.lo: ../../include/net-snmp/library/int64.h
+./target/target_counters.lo: ../../include/net-snmp/library/mt_support.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_alarm.h
+./target/target_counters.lo: ../../include/net-snmp/library/callback.h
+./target/target_counters.lo: ../../include/net-snmp/library/data_list.h
+./target/target_counters.lo: ../../include/net-snmp/library/oid_stash.h
+./target/target_counters.lo: ../../include/net-snmp/library/check_varbind.h
+./target/target_counters.lo: ../../include/net-snmp/library/container.h
+./target/target_counters.lo: ../../include/net-snmp/library/factory.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_logging.h
+./target/target_counters.lo: ../../include/net-snmp/library/container_binary_array.h
+./target/target_counters.lo: ../../include/net-snmp/library/container_list_ssll.h
+./target/target_counters.lo: ../../include/net-snmp/library/container_iterator.h
+./target/target_counters.lo: ../../include/net-snmp/library/container.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_assert.h
+./target/target_counters.lo: ../../include/net-snmp/version.h
+./target/target_counters.lo: ../../include/net-snmp/session_api.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_transport.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_service.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./target/target_counters.lo: ../../include/net-snmp/library/ucd_compat.h
+./target/target_counters.lo: ../../include/net-snmp/pdu_api.h
+./target/target_counters.lo: ../../include/net-snmp/mib_api.h
+./target/target_counters.lo: ../../include/net-snmp/library/mib.h
+./target/target_counters.lo: ../../include/net-snmp/library/parse.h
+./target/target_counters.lo: ../../include/net-snmp/varbind_api.h
+./target/target_counters.lo: ../../include/net-snmp/config_api.h
+./target/target_counters.lo: ../../include/net-snmp/library/read_config.h
+./target/target_counters.lo: ../../include/net-snmp/library/default_store.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_enum.h
+./target/target_counters.lo: ../../include/net-snmp/library/vacm.h
+./target/target_counters.lo: ../../include/net-snmp/output_api.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_debug.h
+./target/target_counters.lo: ../../include/net-snmp/snmpv3_api.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpv3.h
+./target/target_counters.lo: ../../include/net-snmp/library/transform_oids.h
+./target/target_counters.lo: ../../include/net-snmp/library/keytools.h
+./target/target_counters.lo: ../../include/net-snmp/library/scapi.h
+./target/target_counters.lo: ../../include/net-snmp/library/lcd_time.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmp_secmod.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./target/target_counters.lo: ../../include/net-snmp/library/snmpusm.h
+./target/target_counters.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./target/target_counters.lo: ../../include/net-snmp/agent/mib_module_config.h
+./target/target_counters.lo: ../../include/net-snmp/agent/agent_module_config.h
+./target/target_counters.lo: ../../include/net-snmp/agent/snmp_agent.h
+./target/target_counters.lo: ../../include/net-snmp/agent/snmp_vars.h
+./target/target_counters.lo: ../../include/net-snmp/agent/agent_handler.h
+./target/target_counters.lo: ../../include/net-snmp/agent/var_struct.h
+./target/target_counters.lo: ../../include/net-snmp/agent/agent_registry.h
+./target/target_counters.lo: ../../include/net-snmp/library/fd_event_manager.h
+./target/target_counters.lo: ../../include/net-snmp/agent/ds_agent.h
+./target/target_counters.lo: ../../include/net-snmp/agent/agent_read_config.h
+./target/target_counters.lo: ../../include/net-snmp/agent/agent_trap.h
+./target/target_counters.lo: ../../include/net-snmp/agent/all_helpers.h
+./target/target_counters.lo: ../../include/net-snmp/agent/instance.h
+./target/target_counters.lo: ../../include/net-snmp/agent/baby_steps.h
+./target/target_counters.lo: ../../include/net-snmp/agent/scalar.h
+./target/target_counters.lo: ../../include/net-snmp/agent/scalar_group.h
+./target/target_counters.lo: ../../include/net-snmp/agent/watcher.h
+./target/target_counters.lo: ../../include/net-snmp/agent/multiplexer.h
+./target/target_counters.lo: ../../include/net-snmp/agent/null.h
+./target/target_counters.lo: ../../include/net-snmp/agent/debug_handler.h
+./target/target_counters.lo: ../../include/net-snmp/agent/cache_handler.h
+./target/target_counters.lo: ../../include/net-snmp/agent/old_api.h
+./target/target_counters.lo: ../../include/net-snmp/agent/read_only.h
+./target/target_counters.lo: ../../include/net-snmp/agent/row_merge.h
+./target/target_counters.lo: ../../include/net-snmp/agent/serialize.h
+./target/target_counters.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./target/target_counters.lo: ../../include/net-snmp/agent/mode_end_call.h
+./target/target_counters.lo: ../../include/net-snmp/agent/table.h
+./target/target_counters.lo: ../../include/net-snmp/agent/table_data.h
+./target/target_counters.lo: ../../include/net-snmp/agent/table_dataset.h
+./target/target_counters.lo: ../../include/net-snmp/agent/table_tdata.h
+./target/target_counters.lo: ../../include/net-snmp/agent/table_iterator.h
+./target/target_counters.lo: ../../include/net-snmp/agent/table_container.h
+./target/target_counters.lo: ../../include/net-snmp/agent/table_array.h
+./target/target_counters.lo: ../../include/net-snmp/agent/mfd.h
+./target/target_counters.lo: ./target/target_counters.h
+./tunnel/tunnel.lo: ../../include/net-snmp/net-snmp-config.h
+./tunnel/tunnel.lo: ../../include/net-snmp/net-snmp-includes.h
+./tunnel/tunnel.lo: ../../include/net-snmp/definitions.h
+./tunnel/tunnel.lo: ../../include/net-snmp/types.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/asn1.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_impl.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp-tc.h
+./tunnel/tunnel.lo: ../../include/net-snmp/utilities.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_client.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/system.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/tools.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/int64.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/mt_support.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_alarm.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/callback.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/data_list.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/oid_stash.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/check_varbind.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/container.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/factory.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_logging.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/container_binary_array.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/container_list_ssll.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/container_iterator.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/container.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_assert.h
+./tunnel/tunnel.lo: ../../include/net-snmp/version.h
+./tunnel/tunnel.lo: ../../include/net-snmp/session_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_transport.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_service.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/ucd_compat.h
+./tunnel/tunnel.lo: ../../include/net-snmp/pdu_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/mib_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/mib.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/parse.h
+./tunnel/tunnel.lo: ../../include/net-snmp/varbind_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/config_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/read_config.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/default_store.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_enum.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/vacm.h
+./tunnel/tunnel.lo: ../../include/net-snmp/output_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_debug.h
+./tunnel/tunnel.lo: ../../include/net-snmp/snmpv3_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpv3.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/transform_oids.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/keytools.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/scapi.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/lcd_time.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmp_secmod.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/snmpusm.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/mib_module_config.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/agent_module_config.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/snmp_agent.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/snmp_vars.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/agent_handler.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/var_struct.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/agent_registry.h
+./tunnel/tunnel.lo: ../../include/net-snmp/library/fd_event_manager.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/ds_agent.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/agent_read_config.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/agent_trap.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/all_helpers.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/instance.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/baby_steps.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/scalar.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/scalar_group.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/watcher.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/multiplexer.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/null.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/debug_handler.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/cache_handler.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/old_api.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/read_only.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/row_merge.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/serialize.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/mode_end_call.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/table.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/table_data.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/table_dataset.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/table_tdata.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/table_iterator.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/table_container.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/table_array.h
+./tunnel/tunnel.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h struct.h
+./tunnel/tunnel.lo: tunnel.h if-mib/ifTable/ifTable.h
+./tunnel/tunnel.lo: ../../include/net-snmp/data_access/interface.h
+./tunnel/tunnel.lo: if-mib/ifTable/ifTable_constants.h
+./tunnel/tunnel.lo: if-mib/ifTable/ifTable_interface.h
+./tunnel/tunnel.lo: if-mib/ifTable/ifTable.h
+./tunnel/tunnel.lo: if-mib/ifTable/ifTable_data_access.h
+./tunnel/tunnel.lo: if-mib/ifTable/ifTable_defs.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/types.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/version.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/disk.lo: ../../include/net-snmp/agent/auto_nlist.h struct.h
+./ucd-snmp/disk.lo: ./ucd-snmp/disk.h mibdefs.h util_funcs.h
+./ucd-snmp/disk.lo: ./ucd-snmp/errormib.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/types.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/version.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/diskio.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h
+./ucd-snmp/diskio.lo: struct.h ./ucd-snmp/diskio.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/types.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/version.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/dlmod.lo: ../../include/net-snmp/agent/mfd.h struct.h util_funcs.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/types.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/version.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/errormib.lo: ../../include/net-snmp/agent/auto_nlist.h struct.h
+./ucd-snmp/errormib.lo: ./ucd-snmp/errormib.h mibdefs.h util_funcs.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/types.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/version.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/extensible.lo: ../../include/net-snmp/agent/agent_callbacks.h
+./ucd-snmp/extensible.lo: struct.h ./ucd-snmp/extensible.h mibdefs.h
+./ucd-snmp/extensible.lo: utilities/execute.h util_funcs.h
+./ucd-snmp/file.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/file.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/file.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/file.lo: ../../include/net-snmp/types.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/file.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/file.lo: ../../include/net-snmp/version.h
+./ucd-snmp/file.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/file.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/file.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/file.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/file.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/file.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/file.lo: ../../include/net-snmp/agent/mfd.h struct.h
+./ucd-snmp/file.lo: ./ucd-snmp/file.h mibdefs.h util_funcs.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/types.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/version.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/hpux.lo: ../../include/net-snmp/agent/mfd.h ./ucd-snmp/hpux.h
+./ucd-snmp/hpux.lo: mibdefs.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/types.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/version.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/lmSensors.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h
+./ucd-snmp/lmSensors.lo: struct.h ./ucd-snmp/lmSensors.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/types.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/version.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/loadave.lo: ../../include/net-snmp/agent/auto_nlist.h struct.h
+./ucd-snmp/loadave.lo: ./ucd-snmp/loadave.h mibdefs.h util_funcs.h
+./ucd-snmp/loadave.lo: ../../agent/kernel.h
+./ucd-snmp/logmatch.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/types.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/version.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/memory.lo: ../../include/net-snmp/agent/hardware/memory.h
+./ucd-snmp/memory.lo: ./ucd-snmp/memory.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/types.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/version.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/memory_aix4.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/memory_aix4.lo: util_funcs.h struct.h ./ucd-snmp/memory.h
+./ucd-snmp/memory_aix4.lo: ./ucd-snmp/memory_aix4.h mibdefs.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/types.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/version.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/memory_darwin7.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/memory_darwin7.lo: util_funcs.h struct.h ./ucd-snmp/memory.h
+./ucd-snmp/memory_darwin7.lo: ./ucd-snmp/memory_darwin7.h mibdefs.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/types.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/version.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/memory_dynix.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/memory_dynix.lo: util_funcs.h struct.h ./ucd-snmp/memory.h
+./ucd-snmp/memory_dynix.lo: ./ucd-snmp/memory_dynix.h mibdefs.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/types.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/version.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/memory_freebsd2.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/memory_freebsd2.lo: util_funcs.h struct.h ./ucd-snmp/memory.h
+./ucd-snmp/memory_freebsd2.lo: ./ucd-snmp/memory_freebsd2.h mibdefs.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/types.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/version.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/memory_hpux.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/memory_hpux.lo: ./ucd-snmp/memory.h ./ucd-snmp/memory_hpux.h
+./ucd-snmp/memory_hpux.lo: mibdefs.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/types.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/version.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/memory_netbsd1.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/memory_netbsd1.lo: util_funcs.h struct.h ./ucd-snmp/memory.h
+./ucd-snmp/memory_netbsd1.lo: ./ucd-snmp/memory_netbsd1.h mibdefs.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/types.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/version.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/memory_solaris2.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/memory_solaris2.lo: util_funcs.h struct.h ./ucd-snmp/memory.h
+./ucd-snmp/memory_solaris2.lo: ./ucd-snmp/memory_solaris2.h mibdefs.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/types.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/version.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/pass.lo: ../../include/net-snmp/agent/mfd.h struct.h
+./ucd-snmp/pass.lo: ./ucd-snmp/pass.h mibdefs.h ./ucd-snmp/extensible.h
+./ucd-snmp/pass.lo: util_funcs.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/types.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/version.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/pass_persist.lo: ../../include/net-snmp/agent/mfd.h struct.h
+./ucd-snmp/pass_persist.lo: ./ucd-snmp/pass_persist.h mibdefs.h
+./ucd-snmp/pass_persist.lo: ./ucd-snmp/extensible.h util_funcs.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/types.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/version.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/proc.lo: ../../include/net-snmp/agent/mfd.h struct.h
+./ucd-snmp/proc.lo: ./ucd-snmp/proc.h mibdefs.h ./ucd-snmp/errormib.h
+./ucd-snmp/proc.lo: util_funcs.h ../../agent/kernel.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/types.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/version.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/proxy.lo: ../../include/net-snmp/agent/mfd.h ./ucd-snmp/proxy.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/types.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/version.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/versioninfo.lo: ../../include/net-snmp/agent/mfd.h struct.h
+./ucd-snmp/versioninfo.lo: ./ucd-snmp/versioninfo.h mibdefs.h util_funcs.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/vmstat.lo: ../../include/net-snmp/agent/hardware/cpu.h
+./ucd-snmp/vmstat.lo: ./ucd-snmp/vmstat.h mibdefs.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/vmstat_aix4.lo: ../../include/net-snmp/agent/mfd.h mibdefs.h
+./ucd-snmp/vmstat_aix4.lo: util_funcs.h struct.h ./ucd-snmp/vmstat.h
+./ucd-snmp/vmstat_aix4.lo: ./ucd-snmp/vmstat_aix4.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/vmstat_bsdi4.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/vmstat_bsdi4.lo: util_funcs.h struct.h ./ucd-snmp/vmstat.h
+./ucd-snmp/vmstat_bsdi4.lo: mibdefs.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/vmstat_darwin7.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/vmstat_darwin7.lo: util_funcs.h struct.h ./ucd-snmp/vmstat.h
+./ucd-snmp/vmstat_darwin7.lo: mibdefs.h ./ucd-snmp/vmstat_darwin7.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/vmstat_dynix.lo: ../../include/net-snmp/agent/mfd.h mibdefs.h
+./ucd-snmp/vmstat_dynix.lo: util_funcs.h struct.h ./ucd-snmp/vmstat.h
+./ucd-snmp/vmstat_dynix.lo: ./ucd-snmp/vmstat_dynix.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/vmstat_freebsd2.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/vmstat_freebsd2.lo: util_funcs.h struct.h ./ucd-snmp/vmstat.h
+./ucd-snmp/vmstat_freebsd2.lo: mibdefs.h ./ucd-snmp/vmstat_freebsd2.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/vmstat_hpux.lo: ../../include/net-snmp/agent/mfd.h mibdefs.h
+./ucd-snmp/vmstat_hpux.lo: util_funcs.h struct.h ./ucd-snmp/vmstat.h
+./ucd-snmp/vmstat_hpux.lo: ./ucd-snmp/vmstat_hpux.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/vmstat_linux.lo: ../../include/net-snmp/agent/hardware/cpu.h
+./ucd-snmp/vmstat_linux.lo: mibdefs.h struct.h util_funcs.h
+./ucd-snmp/vmstat_linux.lo: ./ucd-snmp/vmstat.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/mfd.h
+./ucd-snmp/vmstat_netbsd1.lo: ../../include/net-snmp/agent/auto_nlist.h
+./ucd-snmp/vmstat_netbsd1.lo: util_funcs.h struct.h ./ucd-snmp/vmstat.h
+./ucd-snmp/vmstat_netbsd1.lo: mibdefs.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/net-snmp-config.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/net-snmp-includes.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/definitions.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/types.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/asn1.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_impl.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp-tc.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/utilities.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_client.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/system.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/tools.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/int64.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/mt_support.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_alarm.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/callback.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/data_list.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/oid_stash.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/check_varbind.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/factory.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_logging.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/container_binary_array.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/container_list_ssll.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/container_iterator.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/container.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_assert.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/version.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/session_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_transport.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_service.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/ucd_compat.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/pdu_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/mib_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/mib.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/parse.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/varbind_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/config_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/read_config.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/default_store.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_enum.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/vacm.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/output_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_debug.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/snmpv3_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpv3.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/transform_oids.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/keytools.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/scapi.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/lcd_time.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmp_secmod.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/snmpusm.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/mib_module_config.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/agent_module_config.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/snmp_agent.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/snmp_vars.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/agent_handler.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/var_struct.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/agent_registry.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/library/fd_event_manager.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/ds_agent.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/agent_read_config.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/agent_trap.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/all_helpers.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/instance.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/baby_steps.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/scalar.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/scalar_group.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/watcher.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/multiplexer.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/null.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/debug_handler.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/cache_handler.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/old_api.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/read_only.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/row_merge.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/serialize.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/mode_end_call.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/table.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/table_data.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/table_dataset.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/table_tdata.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/table_iterator.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/table_container.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/table_array.h
+./ucd-snmp/vmstat_solaris2.lo: ../../include/net-snmp/agent/mfd.h mibdefs.h
+./ucd-snmp/vmstat_solaris2.lo: util_funcs.h struct.h ./ucd-snmp/vmstat.h
+./ucd-snmp/vmstat_solaris2.lo: ./ucd-snmp/vmstat_solaris2.h
+./utilities/execute.lo: ../../include/net-snmp/net-snmp-config.h
+./utilities/execute.lo: ../../include/net-snmp/net-snmp-includes.h
+./utilities/execute.lo: ../../include/net-snmp/definitions.h
+./utilities/execute.lo: ../../include/net-snmp/types.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmp_api.h
+./utilities/execute.lo: ../../include/net-snmp/library/asn1.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmp_impl.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmp.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmp-tc.h
+./utilities/execute.lo: ../../include/net-snmp/utilities.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmp_client.h
+./utilities/execute.lo: ../../include/net-snmp/library/system.h
+./utilities/execute.lo: ../../include/net-snmp/library/tools.h
+./utilities/execute.lo: ../../include/net-snmp/library/int64.h
+./utilities/execute.lo: ../../include/net-snmp/library/mt_support.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmp_alarm.h
+./utilities/execute.lo: ../../include/net-snmp/library/callback.h
+./utilities/execute.lo: ../../include/net-snmp/library/data_list.h
+./utilities/execute.lo: ../../include/net-snmp/library/oid_stash.h
+./utilities/execute.lo: ../../include/net-snmp/library/check_varbind.h
+./utilities/execute.lo: ../../include/net-snmp/library/container.h
+./utilities/execute.lo: ../../include/net-snmp/library/factory.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmp_logging.h
+./utilities/execute.lo: ../../include/net-snmp/library/container_binary_array.h
+./utilities/execute.lo: ../../include/net-snmp/library/container_list_ssll.h
+./utilities/execute.lo: ../../include/net-snmp/library/container_iterator.h
+./utilities/execute.lo: ../../include/net-snmp/library/container.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmp_assert.h
+./utilities/execute.lo: ../../include/net-snmp/version.h
+./utilities/execute.lo: ../../include/net-snmp/session_api.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmp_transport.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmp_service.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./utilities/execute.lo: ../../include/net-snmp/library/ucd_compat.h
+./utilities/execute.lo: ../../include/net-snmp/pdu_api.h
+./utilities/execute.lo: ../../include/net-snmp/mib_api.h
+./utilities/execute.lo: ../../include/net-snmp/library/mib.h
+./utilities/execute.lo: ../../include/net-snmp/library/parse.h
+./utilities/execute.lo: ../../include/net-snmp/varbind_api.h
+./utilities/execute.lo: ../../include/net-snmp/config_api.h
+./utilities/execute.lo: ../../include/net-snmp/library/read_config.h
+./utilities/execute.lo: ../../include/net-snmp/library/default_store.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmp_enum.h
+./utilities/execute.lo: ../../include/net-snmp/library/vacm.h
+./utilities/execute.lo: ../../include/net-snmp/output_api.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmp_debug.h
+./utilities/execute.lo: ../../include/net-snmp/snmpv3_api.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmpv3.h
+./utilities/execute.lo: ../../include/net-snmp/library/transform_oids.h
+./utilities/execute.lo: ../../include/net-snmp/library/keytools.h
+./utilities/execute.lo: ../../include/net-snmp/library/scapi.h
+./utilities/execute.lo: ../../include/net-snmp/library/lcd_time.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmp_secmod.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./utilities/execute.lo: ../../include/net-snmp/library/snmpusm.h
+./utilities/execute.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./utilities/execute.lo: ../../include/net-snmp/agent/mib_module_config.h
+./utilities/execute.lo: ../../include/net-snmp/agent/agent_module_config.h
+./utilities/execute.lo: ../../include/net-snmp/agent/snmp_agent.h
+./utilities/execute.lo: ../../include/net-snmp/agent/snmp_vars.h
+./utilities/execute.lo: ../../include/net-snmp/agent/agent_handler.h
+./utilities/execute.lo: ../../include/net-snmp/agent/var_struct.h
+./utilities/execute.lo: ../../include/net-snmp/agent/agent_registry.h
+./utilities/execute.lo: ../../include/net-snmp/library/fd_event_manager.h
+./utilities/execute.lo: ../../include/net-snmp/agent/ds_agent.h
+./utilities/execute.lo: ../../include/net-snmp/agent/agent_read_config.h
+./utilities/execute.lo: ../../include/net-snmp/agent/agent_trap.h
+./utilities/execute.lo: ../../include/net-snmp/agent/all_helpers.h
+./utilities/execute.lo: ../../include/net-snmp/agent/instance.h
+./utilities/execute.lo: ../../include/net-snmp/agent/baby_steps.h
+./utilities/execute.lo: ../../include/net-snmp/agent/scalar.h
+./utilities/execute.lo: ../../include/net-snmp/agent/scalar_group.h
+./utilities/execute.lo: ../../include/net-snmp/agent/watcher.h
+./utilities/execute.lo: ../../include/net-snmp/agent/multiplexer.h
+./utilities/execute.lo: ../../include/net-snmp/agent/null.h
+./utilities/execute.lo: ../../include/net-snmp/agent/debug_handler.h
+./utilities/execute.lo: ../../include/net-snmp/agent/cache_handler.h
+./utilities/execute.lo: ../../include/net-snmp/agent/old_api.h
+./utilities/execute.lo: ../../include/net-snmp/agent/read_only.h
+./utilities/execute.lo: ../../include/net-snmp/agent/row_merge.h
+./utilities/execute.lo: ../../include/net-snmp/agent/serialize.h
+./utilities/execute.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./utilities/execute.lo: ../../include/net-snmp/agent/mode_end_call.h
+./utilities/execute.lo: ../../include/net-snmp/agent/table.h
+./utilities/execute.lo: ../../include/net-snmp/agent/table_data.h
+./utilities/execute.lo: ../../include/net-snmp/agent/table_dataset.h
+./utilities/execute.lo: ../../include/net-snmp/agent/table_tdata.h
+./utilities/execute.lo: ../../include/net-snmp/agent/table_iterator.h
+./utilities/execute.lo: ../../include/net-snmp/agent/table_container.h
+./utilities/execute.lo: ../../include/net-snmp/agent/table_array.h
+./utilities/execute.lo: ../../include/net-snmp/agent/mfd.h
+./utilities/execute.lo: ucd-snmp/errormib.h mibdefs.h util_funcs.h struct.h
+./utilities/iquery.lo: ../../include/net-snmp/net-snmp-config.h
+./utilities/iquery.lo: ../../include/net-snmp/net-snmp-includes.h
+./utilities/iquery.lo: ../../include/net-snmp/definitions.h
+./utilities/iquery.lo: ../../include/net-snmp/types.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmp_api.h
+./utilities/iquery.lo: ../../include/net-snmp/library/asn1.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmp_impl.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmp.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmp-tc.h
+./utilities/iquery.lo: ../../include/net-snmp/utilities.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmp_client.h
+./utilities/iquery.lo: ../../include/net-snmp/library/system.h
+./utilities/iquery.lo: ../../include/net-snmp/library/tools.h
+./utilities/iquery.lo: ../../include/net-snmp/library/int64.h
+./utilities/iquery.lo: ../../include/net-snmp/library/mt_support.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmp_alarm.h
+./utilities/iquery.lo: ../../include/net-snmp/library/callback.h
+./utilities/iquery.lo: ../../include/net-snmp/library/data_list.h
+./utilities/iquery.lo: ../../include/net-snmp/library/oid_stash.h
+./utilities/iquery.lo: ../../include/net-snmp/library/check_varbind.h
+./utilities/iquery.lo: ../../include/net-snmp/library/container.h
+./utilities/iquery.lo: ../../include/net-snmp/library/factory.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmp_logging.h
+./utilities/iquery.lo: ../../include/net-snmp/library/container_binary_array.h
+./utilities/iquery.lo: ../../include/net-snmp/library/container_list_ssll.h
+./utilities/iquery.lo: ../../include/net-snmp/library/container_iterator.h
+./utilities/iquery.lo: ../../include/net-snmp/library/container.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmp_assert.h
+./utilities/iquery.lo: ../../include/net-snmp/version.h
+./utilities/iquery.lo: ../../include/net-snmp/session_api.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmp_transport.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmp_service.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./utilities/iquery.lo: ../../include/net-snmp/library/ucd_compat.h
+./utilities/iquery.lo: ../../include/net-snmp/pdu_api.h
+./utilities/iquery.lo: ../../include/net-snmp/mib_api.h
+./utilities/iquery.lo: ../../include/net-snmp/library/mib.h
+./utilities/iquery.lo: ../../include/net-snmp/library/parse.h
+./utilities/iquery.lo: ../../include/net-snmp/varbind_api.h
+./utilities/iquery.lo: ../../include/net-snmp/config_api.h
+./utilities/iquery.lo: ../../include/net-snmp/library/read_config.h
+./utilities/iquery.lo: ../../include/net-snmp/library/default_store.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmp_enum.h
+./utilities/iquery.lo: ../../include/net-snmp/library/vacm.h
+./utilities/iquery.lo: ../../include/net-snmp/output_api.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmp_debug.h
+./utilities/iquery.lo: ../../include/net-snmp/snmpv3_api.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmpv3.h
+./utilities/iquery.lo: ../../include/net-snmp/library/transform_oids.h
+./utilities/iquery.lo: ../../include/net-snmp/library/keytools.h
+./utilities/iquery.lo: ../../include/net-snmp/library/scapi.h
+./utilities/iquery.lo: ../../include/net-snmp/library/lcd_time.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmp_secmod.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./utilities/iquery.lo: ../../include/net-snmp/library/snmpusm.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/mib_module_config.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/agent_module_config.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/snmp_agent.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/snmp_vars.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/agent_handler.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/var_struct.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/agent_registry.h
+./utilities/iquery.lo: ../../include/net-snmp/library/fd_event_manager.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/ds_agent.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/agent_read_config.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/agent_trap.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/all_helpers.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/instance.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/baby_steps.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/scalar.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/scalar_group.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/watcher.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/multiplexer.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/null.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/debug_handler.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/cache_handler.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/old_api.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/read_only.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/row_merge.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/serialize.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/mode_end_call.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/table.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/table_data.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/table_dataset.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/table_tdata.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/table_iterator.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/table_container.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/table_array.h
+./utilities/iquery.lo: ../../include/net-snmp/agent/mfd.h utilities/iquery.h
+./utilities/override.lo: ../../include/net-snmp/net-snmp-config.h
+./utilities/override.lo: ../../include/net-snmp/net-snmp-includes.h
+./utilities/override.lo: ../../include/net-snmp/definitions.h
+./utilities/override.lo: ../../include/net-snmp/types.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_api.h
+./utilities/override.lo: ../../include/net-snmp/library/asn1.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_impl.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp-tc.h
+./utilities/override.lo: ../../include/net-snmp/utilities.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_client.h
+./utilities/override.lo: ../../include/net-snmp/library/system.h
+./utilities/override.lo: ../../include/net-snmp/library/tools.h
+./utilities/override.lo: ../../include/net-snmp/library/int64.h
+./utilities/override.lo: ../../include/net-snmp/library/mt_support.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_alarm.h
+./utilities/override.lo: ../../include/net-snmp/library/callback.h
+./utilities/override.lo: ../../include/net-snmp/library/data_list.h
+./utilities/override.lo: ../../include/net-snmp/library/oid_stash.h
+./utilities/override.lo: ../../include/net-snmp/library/check_varbind.h
+./utilities/override.lo: ../../include/net-snmp/library/container.h
+./utilities/override.lo: ../../include/net-snmp/library/factory.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_logging.h
+./utilities/override.lo: ../../include/net-snmp/library/container_binary_array.h
+./utilities/override.lo: ../../include/net-snmp/library/container_list_ssll.h
+./utilities/override.lo: ../../include/net-snmp/library/container_iterator.h
+./utilities/override.lo: ../../include/net-snmp/library/container.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_assert.h
+./utilities/override.lo: ../../include/net-snmp/version.h
+./utilities/override.lo: ../../include/net-snmp/session_api.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_transport.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_service.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpCallbackDomain.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpUnixDomain.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpUDPDomain.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpTCPDomain.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpUDPIPv6Domain.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpTCPIPv6Domain.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpIPXDomain.h
+./utilities/override.lo: ../../include/net-snmp/library/ucd_compat.h
+./utilities/override.lo: ../../include/net-snmp/pdu_api.h
+./utilities/override.lo: ../../include/net-snmp/mib_api.h
+./utilities/override.lo: ../../include/net-snmp/library/mib.h
+./utilities/override.lo: ../../include/net-snmp/library/parse.h
+./utilities/override.lo: ../../include/net-snmp/varbind_api.h
+./utilities/override.lo: ../../include/net-snmp/config_api.h
+./utilities/override.lo: ../../include/net-snmp/library/read_config.h
+./utilities/override.lo: ../../include/net-snmp/library/default_store.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_parse_args.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_enum.h
+./utilities/override.lo: ../../include/net-snmp/library/vacm.h
+./utilities/override.lo: ../../include/net-snmp/output_api.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_debug.h
+./utilities/override.lo: ../../include/net-snmp/snmpv3_api.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpv3.h
+./utilities/override.lo: ../../include/net-snmp/library/transform_oids.h
+./utilities/override.lo: ../../include/net-snmp/library/keytools.h
+./utilities/override.lo: ../../include/net-snmp/library/scapi.h
+./utilities/override.lo: ../../include/net-snmp/library/lcd_time.h
+./utilities/override.lo: ../../include/net-snmp/library/snmp_secmod.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpv3-security-includes.h
+./utilities/override.lo: ../../include/net-snmp/library/snmpusm.h
+./utilities/override.lo: ../../include/net-snmp/agent/net-snmp-agent-includes.h
+./utilities/override.lo: ../../include/net-snmp/agent/mib_module_config.h
+./utilities/override.lo: ../../include/net-snmp/agent/agent_module_config.h
+./utilities/override.lo: ../../include/net-snmp/agent/snmp_agent.h
+./utilities/override.lo: ../../include/net-snmp/agent/snmp_vars.h
+./utilities/override.lo: ../../include/net-snmp/agent/agent_handler.h
+./utilities/override.lo: ../../include/net-snmp/agent/var_struct.h
+./utilities/override.lo: ../../include/net-snmp/agent/agent_registry.h
+./utilities/override.lo: ../../include/net-snmp/library/fd_event_manager.h
+./utilities/override.lo: ../../include/net-snmp/agent/ds_agent.h
+./utilities/override.lo: ../../include/net-snmp/agent/agent_read_config.h
+./utilities/override.lo: ../../include/net-snmp/agent/agent_trap.h
+./utilities/override.lo: ../../include/net-snmp/agent/all_helpers.h
+./utilities/override.lo: ../../include/net-snmp/agent/instance.h
+./utilities/override.lo: ../../include/net-snmp/agent/baby_steps.h
+./utilities/override.lo: ../../include/net-snmp/agent/scalar.h
+./utilities/override.lo: ../../include/net-snmp/agent/scalar_group.h
+./utilities/override.lo: ../../include/net-snmp/agent/watcher.h
+./utilities/override.lo: ../../include/net-snmp/agent/multiplexer.h
+./utilities/override.lo: ../../include/net-snmp/agent/null.h
+./utilities/override.lo: ../../include/net-snmp/agent/debug_handler.h
+./utilities/override.lo: ../../include/net-snmp/agent/cache_handler.h
+./utilities/override.lo: ../../include/net-snmp/agent/old_api.h
+./utilities/override.lo: ../../include/net-snmp/agent/read_only.h
+./utilities/override.lo: ../../include/net-snmp/agent/row_merge.h
+./utilities/override.lo: ../../include/net-snmp/agent/serialize.h
+./utilities/override.lo: ../../include/net-snmp/agent/bulk_to_next.h
+./utilities/override.lo: ../../include/net-snmp/agent/mode_end_call.h
+./utilities/override.lo: ../../include/net-snmp/agent/table.h
+./utilities/override.lo: ../../include/net-snmp/agent/table_data.h
+./utilities/override.lo: ../../include/net-snmp/agent/table_dataset.h
+./utilities/override.lo: ../../include/net-snmp/agent/table_tdata.h
+./utilities/override.lo: ../../include/net-snmp/agent/table_iterator.h
+./utilities/override.lo: ../../include/net-snmp/agent/table_container.h
+./utilities/override.lo: ../../include/net-snmp/agent/table_array.h
+./utilities/override.lo: ../../include/net-snmp/agent/mfd.h util_funcs.h
+./utilities/override.lo: struct.h
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Makefile.in b/cleopatre/application/spidnetsnmp/agent/mibgroup/Makefile.in
new file mode 100644
index 0000000000..f641ab7077
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Makefile.in
@@ -0,0 +1,35 @@
+top_builddir=../..
+# currently assumes gcc: (XXX: fix via configure tests)
+DLFLAGS=-fPIC -shared
+
+# use GNU vpath, if available, to only set a path for source and headers
+# VPATH will pick up objects too, which is bad if you are sharing a
+# source dir...
+@GNU_vpath@ %.h $(srcdir)
+@GNU_vpath@ %.c $(srcdir)
+# fallback to regular VPATH for non-gnu...
+@NON_GNU_VPATH@ $(srcdir)
+
+
+CPPFLAGS= $(TOP_INCLUDES) -I. $(AGENT_INCLUDES) $(MIBGROUP_INCLUDES) \
+ $(SNMPLIB_INCLUDES) @CPPFLAGS@ $(LIB_CFLAGS)
+
+OTHERCLEANTARGETS=@dllcleans@
+
+# Need a special .c -> .o definition here to make sure we place the
+# object files in the sub directory.
+
+.c.o:
+ $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+@mib_module_list_o@
+@mib_module_list_lo@
+@mib_module_list_c@
+
+OBJS = $(mib_module_list_o)
+LOBJS = $(mib_module_list_lo)
+SRCS = $(mib_module_list_c)
+
+all: standardall $(LOBJS)
+
+@module_rules@
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/README b/cleopatre/application/spidnetsnmp/agent/mibgroup/README
new file mode 100644
index 0000000000..7d83806d6c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/README
@@ -0,0 +1,113 @@
+This directory holds the implementation of individual MIB groups.
+Currently, this contains the eight MIB-2 groups, plus a basic template
+for new MIB groups (examples/example.c and examples/example.h)
+
+Additionally, you may wish to check out the 'mib2c' perl script in the
+SRCDIR/local directory that can convert a written mib into C template
+files for use with this package as mib modules.
+
+Each group consists of two files:
+
+ examples/example.h: interface information
+
+ - declaration of the initialisation function 'init_example'
+ (optional)
+ - declaration of the function(s) for retrieving variable
+ information 'var_example'
+ - declaration of the function(s) for setting variable
+ information (if appropriate)
+
+ - declaration of the function(s) for parsing the snmpd.conf file
+ (optional)
+ - a call to config_parse_dot_conf() to explain to the .conf
+ parser which tokens we want to parse.
+ (optional)
+
+ - definitions of the MIB group 'magic numbers'
+ declarations of the 'public' functions
+
+ - a list of the variables in the group, including
+ type information, mapping between magic numbers
+ and OID sub-identifiers within the group,
+ accessibility information, and the relevant
+ function for retrieving this variable's value.
+ They *must* be listed in the mib-descending order.
+ - a call to 'config_load_mib', identifying the location of
+ this MIB group within the general MIB structure.
+ - a call to 'config_require' to identify any other files
+ that are required by the implementation of this group.
+ (optional)
+
+ (these last three are only visible within the 'glue' file 'snmp_vars.c'
+ (if at all), but are declared here for ease of maintainance)
+
+
+
+ examples/example.c: implementation code
+ (can be non-existant if only the .h file is needed)
+
+ - a list of kernel information needed to report
+ on this group
+ - an initialisation function (optional)
+ - a routine to parse an snmpd.conf line.
+ - a routine to free resources from above and return to
+ default settings.
+ - 'header' function(s) to map the OID requested
+ to the next appropriate OID
+ (and similar system-independent setup)
+ - function(s) (possibly system-specific) to
+ determine and return the value of the
+ variable requested.
+ - (optionally) functions used to set values
+ - other functions used internally
+
+
+To implement a new MIB group, copy the two files 'example.c'
+and 'example.h' to appropriate new files ({MODULENAME}.c and {MODULENAME}.h),
+and edit them as follows:
+
+ example.h:
+ globally change "example" to the new module name
+ and update the initial comment.
+ replace the EXAMPLE* defines with the list of
+ variables within this new group
+ fill in the 'MODULENAME_variables' structure with these
+ new variables, updating the type, accessibility
+ and sub-identifier information as appropriate.
+ replace 'variableN' with the maximum size of the
+ returned OID (omitting the group prefix).
+ For non-table values, this will probably be one
+ greater than the length of the sub-identifier.
+ update or remove the 'config_parse_dot_conf' call if
+ you need to handle lines in the snmpd.conf files.
+ update the 'config_load_mib' call with the appropriate
+ location within the global MIB structure, and
+ its length (note that 'MIB' has length 6)
+ provide a suitable 'config_require' call if this
+ code uses routines from any other files within
+ the 'mibgroup' directory (such as 'util_funcs.c')
+
+
+
+ example.c:
+ globally change "example" to the new module name
+ and update the initial comment.
+ replace the 'MODULENAME_nl' name list with any necessary
+ kernel variables, and update the associated #define's
+ replace the name length definition within the 'header'
+ function with the length of the requesting OID
+ (i.e. the sum of the lengths given in the subtree
+ definition, and the variable structure above).
+ replace the basic 'switch' structure within the
+ 'var_MODULENAME' function with the necessary code
+ to calculate the required information.
+ (plus any other internal functions as needed).
+
+ It will then be necessary to (re-)run the configure script with the
+option
+ --with-mib-modules="MODULENAME"
+
+(where MODULENAME matches the name of the .c/.h file pair exactly).
+Note that if anything in the config_* macros changes, or the init function
+is added or removed, then the configure script will need to be re-run.
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/README.smux b/cleopatre/application/spidnetsnmp/agent/mibgroup/README.smux
new file mode 100644
index 0000000000..b977f2b891
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/README.smux
@@ -0,0 +1,52 @@
+[1] What is SMUX?
+
+SMUX is the snmp multiplexing protocol (RFC 1227). It can be used by an
+snmp agent to query variables maintained by another user-level process.
+
+[2] Why is it relevant to net-snmp?
+
+The original ucd-snmp agent needed a mechanism to query statistics from
+GateD. GateD has traditionally supported this functionality via SMUX.
+Hence SMUX was implemented within the ucd-snmp framework to extract
+routing protocol statistics from GateD.
+
+net-snmp continues to support smux, and many applications still use it.
+
+[3] What is GateD?
+
+GateD is the 'Gateway Daemon' which implements a variety of routing
+protocols on a variety of platforms (OSes). This was formerly available
+as open source, but has since been made closed and entirely un-free.
+Other routing protocol daemons such a quagga (http://www.quagga.net)
+support SMUX.
+
+[4] Can SMUX extract statistics from other user-level processes?
+
+Yes, the current implementation allows for the registration of any MIB
+that might be registered by a SMUX peer.
+
+[5] How does it work?
+
+Assuming 'snmpd' is already up and running, when the SMUX peer comes up,
+it identifies itself with an oid identifier and string password, and
+registers any MIBs it would like to implement. When 'snmpd' receives
+queries for these MIBs, it passes these queries to the peer.
+
+[6] Who implemented SMUX for ucd-snmp?
+
+SMUX was implemented by Rohit Dube. He had oodles of help from
+ucd-snmp-coders (Dave, Niels, Wes, Simon, Felix, Leonti) and gated-people
+(Acee, Feiyi, Larry, Sue). [If I missed somebody, sorry in advance and
+do let me know]. Later, Nick Amato re-write the entire SMUX package so
+the code today is mostly his.
+
+[7] How do I find out more about SMUX?
+
+Read the RFC and the code, mainly, but only for legacy code.
+
+*New* sub-agent development should use the AgentX protocol instead,
+which is not only standardized (RFC 2741 + 2742), but is outright superior
+to smux in a number of important ways (handles SET requests reliably,
+able to handle overlapping registrations, aware of SNMPv3 contexts, etc.)
+
+Only build new smux support if you have to.
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon.h
new file mode 100644
index 0000000000..847eaa9ebc
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon.h
@@ -0,0 +1,54 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+/*
+ * $Log$
+ * Revision 5.0 2002/04/20 07:30:00 hardaker
+ * cvs file version number change
+ *
+ * Revision 1.2 2002/04/20 07:07:34 hardaker
+ * White space, oh glorious white space.
+ * How great our though?
+ * The code is fine.
+ * We agree on functionality easily.
+ * What really troubles us?
+ * Something we can't see.
+ * Something between the code.
+ * We bow down to your magnificence,
+ * For you are everywhere,
+ * Between everything.
+ * Pretty nothingness you are.
+ *
+ * Revision 1.1 2001/05/09 19:36:13 slif
+ * Include Alex Rozin's Rmon.
+ *
+ * Revision 1.1.2.1 2001/04/16 14:45:05 alex
+ * Rmon1 : first edition
+ *
+ */
+
+config_require(Rmon/rows)
+config_require(Rmon/agutil)
+config_require(Rmon/statistics)
+config_require(Rmon/alarm)
+config_require(Rmon/history)
+config_require(Rmon/event)
+config_add_mib(RMON-MIB)
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/README b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/README
new file mode 100644
index 0000000000..c5269ecef1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/README
@@ -0,0 +1,30 @@
+
+Important notes.
+===============
+1. This implementation is actually a system independent
+ template. It means that the question "Where and how
+ may I collect the monitored statistics ?" is taken out
+ from the scope. Actually, it is emulated with random values.
+ You are free to rewrite the function 'get_history_data'
+ for your system. Don't forget also to insert DataSourse
+ checking in 'history_Validate' function. (Both functions
+ are in the file history.c).
+
+2. This implementation has two RMON mib understanding extensions
+ (I hope it does not break anything; nevertheless you may use
+ it in completely standard way).
+
+ 2.1. I permit to set VALID entryStatus when entry doesn't exit;
+ in this case PDU has to have the necessary & valid set
+ of non-default values
+
+ 2.2. I permit to travel from VALID to 'UNDER_CREATION' state:
+ these ways a manager can change control entry and validate
+ it once more.
+
+
+THANKS
+======
+ Mr. Michael J. Slifcak of Internet Security Systems, Inc has provided
+ a number of remarks, I implemented ALL of them.
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/agutil.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/agutil.c
new file mode 100644
index 0000000000..3b0c87a615
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/agutil.c
@@ -0,0 +1,314 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+
+#include "agutil.h"
+#include "agutil_api.h"
+
+#ifndef OPTICALL_ACESS /* in OpticalAccess case : find them in ~agent/mibgroup/nbase directory */
+void
+ag_trace(const char *format, ...)
+{
+#define AG_MAX_MSG_LEN 120
+ char msg[AG_MAX_MSG_LEN];
+ va_list args;
+
+ /*
+ * create msg
+ */
+ va_start(args, format);
+ vsnprintf(msg, AG_MAX_MSG_LEN - 1, format, args);
+
+ snmp_log(LOG_INFO, "%s\n", msg);
+ va_end(args);
+}
+
+int
+AGUTIL_advance_index_name(struct variable *vp, oid * name,
+ size_t * length, int exact)
+{
+ int result;
+
+ if (exact)
+ return 0;
+
+ if (*length <= vp->namelen) {
+ result =
+ snmp_oid_compare(name, *length, vp->name, (int) vp->namelen);
+ memcpy((char *) name, (char *) vp->name,
+ ((int) vp->namelen) * sizeof(oid));
+ *length = vp->namelen;
+ } else {
+ /*
+ * If the name is given with indexes - compare only the oids.
+ */
+ result =
+ snmp_oid_compare(name, (int) vp->namelen, vp->name,
+ (int) vp->namelen);
+ /*
+ * If it's not the same oid - change name to the new oid
+ */
+ if (result < 0) {
+ memcpy((char *) name, (char *) vp->name,
+ ((int) vp->namelen) * sizeof(oid));
+ *length = vp->namelen;
+ }
+ }
+
+ if (result > 0) {
+ ag_trace("*length=%d result=%d !!!", (int) *length, (int) result);
+ return -1;
+ }
+ return 0;
+}
+
+/*********************************************************************
+ * Function: AGUTIL_get_int_value
+ *
+ * Description:
+ * Check/Get long value from the PDU..
+ * The parameters 'min_value' & 'max_value' allow to check the diaposon
+ * of the value. If (max_value <= min_value) we avoid this checking.
+ *
+ * Returns:
+ * SNMP_ERR_NOERROR
+ * SNMP_ERR_WRONGTYPE
+ * SNMP_ERR_WRONGLENGTH
+ * SNMP_ERR_WRONGENCODING
+ * SNMP_ERR_BADVALUE
+ *********************************************************************/
+int
+AGUTIL_get_int_value(u_char * var_val, u_char var_val_type,
+ size_t var_val_len, long min_value, long max_value,
+ long *long_tmp)
+{
+ if (var_val_type != ASN_INTEGER && var_val_type != ASN_TIMETICKS) {
+ ag_trace("not ASN_INTEGER 0x%lx", (long) var_val_type);
+ return SNMP_ERR_WRONGTYPE;
+ }
+
+ if (var_val_len > sizeof(long)) {
+ ag_trace("wrong len=%d", (int) var_val_len);
+ return SNMP_ERR_WRONGLENGTH;
+ }
+
+ *long_tmp = *((long *) var_val);
+
+ if (max_value > min_value) {
+ if (*long_tmp < min_value) {
+ ag_trace("%ld=long_tmp < min=%ld", (long) *long_tmp,
+ (long) min_value);
+ return SNMP_ERR_BADVALUE;
+ }
+
+ if (*long_tmp > max_value) {
+ ag_trace("%ld=long_tmp > max=%ld", (long) *long_tmp,
+ (long) max_value);
+ return SNMP_ERR_BADVALUE;
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+/*********************************************************************
+ * Function: AGUTIL_get_string_value
+ *
+ * Description:
+ * Check/Get 'DisplayString' value from the PDU..
+ *
+ * Returns:
+ * SNMP_ERR_NOERROR
+ * SNMP_ERR_WRONGTYPE
+ * SNMP_ERR_WRONGLENGTH
+ * SNMP_ERR_WRONGENCODING
+ * SNMP_ERR_BADVALUE
+ *********************************************************************/
+int
+AGUTIL_get_string_value(u_char * var_val, u_char var_val_type,
+ size_t var_val_len, size_t buffer_max_size,
+ u_char should_zero_limited,
+ size_t * buffer_actual_size, char *buffer)
+{
+ if (var_val_type != ASN_OCTET_STR) {
+ ag_trace("not ASN_OCTET_STR 0x%lx", (long) var_val_type);
+ return SNMP_ERR_WRONGTYPE;
+ }
+
+ if (var_val_len > buffer_max_size) {
+ ag_trace("wrong len=%d > %d", (int) var_val_len, buffer_max_size);
+ return SNMP_ERR_WRONGLENGTH;
+ }
+
+ if (buffer_actual_size)
+ *buffer_actual_size = var_val_len;
+
+ memcpy(buffer, var_val, var_val_len);
+ if (should_zero_limited) {
+ buffer[var_val_len] = 0;
+ if (buffer_actual_size)
+ *buffer_actual_size += 1;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+#endif
+
+int
+AGUTIL_get_oid_value(u_char * var_val, u_char var_val_type,
+ size_t var_val_len, VAR_OID_T * data_source_ptr)
+{
+ register int iii;
+ register oid *oid_var;
+
+ if (var_val_len > MAX_OID_LEN) {
+ ag_trace("wrong len=%d > %d", (int) var_val_len, MAX_OID_LEN);
+ return SNMP_ERR_WRONGLENGTH;
+ }
+
+ var_val_len /= sizeof(oid);
+ data_source_ptr->length = var_val_len;
+ oid_var = (oid *) var_val;
+ for (iii = 0; iii < (int)data_source_ptr->length; iii++)
+ data_source_ptr->objid[iii] = oid_var[iii];
+
+ return SNMP_ERR_NOERROR;
+}
+
+u_long
+AGUTIL_sys_up_time(void)
+{
+ struct timeval current, delta;
+ extern struct timeval starttime;
+
+ gettimeofday(&current, NULL);
+ current.tv_sec--;
+ current.tv_usec += 1000000L;
+ delta.tv_sec = current.tv_sec - starttime.tv_sec;
+ delta.tv_usec = current.tv_usec - starttime.tv_usec;
+ if (delta.tv_usec > 1000000L) {
+ delta.tv_usec -= 1000000L;
+ delta.tv_sec++;
+ }
+
+ return delta.tv_sec * 100 + delta.tv_usec / 10000;
+}
+
+/*
+ * NOTE: this function is a template for system dependent
+ * implementation. Actually it (in debug purposes) returns
+ * random (but likely) data */
+void
+SYSTEM_get_eth_statistics(VAR_OID_T * data_source, ETH_STATS_T * where)
+{
+#if OPTICALL_ACESS
+ where->ifIndex = data_source->objid[data_source->length - 1];
+ agent_get_Rmon_ethernet_statistics(where->ifIndex, 1, /* exact */
+ where);
+#else /* OPTICALL_ACESS */
+ static ETH_STATS_T prev = { -1, -1 };
+ static time_t ifLastRead = 0;
+ time_t curr_time;
+ u_char need_to_read;
+ u_long rc;
+
+ where->ifIndex = data_source->objid[data_source->length - 1];
+ need_to_read = (where->ifIndex != prev.ifIndex);
+ if (!need_to_read) {
+ curr_time = time(NULL);
+ need_to_read = (curr_time - ifLastRead > 1);
+ }
+
+ if (need_to_read) {
+ rc = (u_long) (1.0 +
+ ((double) rand() / (double) RAND_MAX) * 100.0);
+ ifLastRead = time(NULL);
+ prev.ifIndex = where->ifIndex;
+ } else
+ rc = 0;
+
+ memcpy(where, &prev, sizeof(ETH_STATS_T));
+ where->octets += rc * 100 * 200;
+ where->packets += rc * 100;
+ where->bcast_pkts += rc * 2;
+ where->mcast_pkts += rc * 3;
+ where->crc_align += rc;
+ where->undersize += 0;
+ where->oversize += 0;
+ where->fragments += rc / 2;
+ where->jabbers += 0;
+ where->collisions += rc / 4;
+
+ where->pkts_64 += rc * 10;
+ where->pkts_65_127 += rc * 50;
+ where->pkts_128_255 += rc * 20;
+ where->pkts_256_511 += rc * 10;
+ where->pkts_512_1023 += rc * 15;
+ where->pkts_1024_1518 += rc * 5;
+
+ need_to_read = prev.ifIndex;
+ memcpy(&prev, where, sizeof(ETH_STATS_T));
+ prev.ifIndex = need_to_read;
+#endif /* OPTICALL_ACESS */
+}
+
+#if 0 /* for memory debug */
+static u_long dbg_mem_cnt = 0;
+
+void *
+dbg_f_AGMALLOC(size_t size)
+{
+ dbg_mem_cnt++;
+ return malloc(size);
+}
+
+void
+dbg_f_AGFREE(void *ptr)
+{
+ dbg_mem_cnt--;
+ free(ptr);
+}
+
+char *
+dbg_f_AGSTRDUP(const char *s)
+{
+ dbg_mem_cnt++;
+ return strdup(s);
+}
+
+void
+dbg_f_AG_MEM_REPORT(void)
+{
+ ag_trace("dbg_mem_cnt=%ld", (long) dbg_mem_cnt);
+}
+
+#endif
+
+void
+init_agutil(void)
+{
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/agutil.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/agutil.h
new file mode 100644
index 0000000000..4eb3bf7bc2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/agutil.h
@@ -0,0 +1,26 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#ifndef _agutil_h_included__
+#define _agutil_h_included__
+
+void init_agutil(void);
+
+#endif /* _agutil_h_included__ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/agutil_api.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/agutil_api.h
new file mode 100644
index 0000000000..3959fab0d1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/agutil_api.h
@@ -0,0 +1,93 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#ifndef _agutil_api_h_included__
+#define _agutil_api_h_included__
+
+#include <string.h>
+
+#if 0 /* for debug */
+#warning MEMORY DEBUG VERSION
+void *dbg_f_AGMALLOC(size_t size);
+void dbg_f_AGFREE(void *ptr);
+char *dbg_f_AGSTRDUP(const char *s);
+void dbg_f_AG_MEM_REPORT(void);
+# define AGMALLOC(X) dbg_f_AGMALLOC(X)
+# define AGFREE(X) { dbg_f_AGFREE(X); X = NULL; }
+# define AGSTRDUP(X) dbg_f_AGSTRDUP(X)
+#else
+# define AGMALLOC(X) malloc(X)
+# define AGFREE(X) { free(X); X = NULL; }
+# define AGSTRDUP(X) strdup(X)
+#endif
+
+typedef struct {
+ size_t length;
+ oid objid[MAX_OID_LEN];
+} VAR_OID_T;
+
+void ag_trace(const char *format, ...);
+
+int AGUTIL_advance_index_name(struct variable *vp, oid * name,
+ size_t * length, int exact);
+int AGUTIL_get_int_value(u_char * var_val, u_char var_val_type,
+ size_t var_val_len, long min_value,
+ long max_value, long *long_tmp);
+int AGUTIL_get_string_value(u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ size_t buffer_max_size,
+ u_char should_zero_limited,
+ size_t * buffer_actual_size,
+ char *buffer);
+int AGUTIL_get_oid_value(u_char * var_val, u_char var_val_type,
+ size_t var_val_len,
+ VAR_OID_T * data_source_ptr);
+
+u_long AGUTIL_sys_up_time(void);
+
+#if OPTICALL_ACESS
+#define ETH_STATS_T UID_PORT_STATISTICS_T
+#else
+typedef struct {
+ u_int ifIndex;
+ u_long octets;
+ u_long packets;
+ u_long bcast_pkts;
+ u_long mcast_pkts;
+ u_long crc_align;
+ u_long undersize;
+ u_long oversize;
+ u_long fragments;
+ u_long jabbers;
+ u_long collisions;
+ u_long pkts_64;
+ u_long pkts_65_127;
+ u_long pkts_128_255;
+ u_long pkts_256_511;
+ u_long pkts_512_1023;
+ u_long pkts_1024_1518;
+} ETH_STATS_T;
+#endif
+
+void SYSTEM_get_eth_statistics(VAR_OID_T * data_source,
+ ETH_STATS_T * where);
+
+#endif /* _agutil_api_h_included__ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/alarm.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/alarm.c
new file mode 100644
index 0000000000..a04d415b1c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/alarm.c
@@ -0,0 +1,720 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "util_funcs.h"
+#include "alarm.h"
+ /*
+ * Implementation headers
+ */
+#include "agutil_api.h"
+#include "row_api.h"
+ /*
+ * File scope definitions section
+ */
+ /*
+ * from MIB compilation
+ */
+#define alarmEntryFirstIndexBegin 11
+#define MMM_MAX 0xFFFFFFFFl
+#define IDalarmIndex 1
+#define IDalarmInterval 2
+#define IDalarmVariable 3
+#define IDalarmSampleType 4
+#define IDalarmValue 5
+#define IDalarmStartupAlarm 6
+#define IDalarmRisingThreshold 7
+#define IDalarmFallingThreshold 8
+#define IDalarmRisingEventIndex 9
+#define IDalarmFallingEventIndex 10
+#define IDalarmOwner 11
+#define IDalarmStatus 12
+#define MIN_alarmEventIndex 0
+#define MAX_alarmEventIndex 65535
+ typedef enum {
+ SAMPLE_TYPE_ABSOLUTE =
+ 1,
+ SAMPLE_TYPE_DELTE
+ } SAMPLE_TYPE_T;
+
+ typedef enum {
+ ALARM_NOTHING =
+ 0,
+ ALARM_RISING,
+ ALARM_FALLING,
+ ALARM_BOTH
+ } ALARM_TYPE_T;
+
+ typedef struct {
+ u_long
+ interval;
+ u_long
+ timer_id;
+ VAR_OID_T
+ var_name;
+ SAMPLE_TYPE_T
+ sample_type;
+ ALARM_TYPE_T
+ startup_type; /* RISING | FALLING | BOTH */
+
+ u_long
+ rising_threshold;
+ u_long
+ falling_threshold;
+ u_long
+ rising_event_index;
+ u_long
+ falling_event_index;
+
+ u_long
+ last_abs_value;
+ u_long
+ value;
+ ALARM_TYPE_T
+ prev_alarm; /* NOTHING | RISING | FALLING */
+ } CRTL_ENTRY_T;
+
+/*
+ * Main section
+ */
+
+ static TABLE_DEFINTION_T
+ AlarmCtrlTable;
+ static TABLE_DEFINTION_T *
+ table_ptr = &
+ AlarmCtrlTable;
+
+#if 0 /* KUKU */
+ static u_long
+ kuku_sum =
+ 0,
+ kuku_cnt =
+ 0;
+#endif
+
+/*
+ * find & enjoy it in event.c
+ */
+ extern int
+ event_api_send_alarm(u_char is_rising,
+ u_long alarm_index,
+ u_long event_index,
+ oid * alarmed_var,
+ size_t alarmed_var_length,
+ u_long sample_type,
+ u_long value,
+ u_long the_threshold, char *alarm_descr);
+
+static int
+fetch_var_val(oid * name, size_t namelen, u_long * new_value)
+{
+ netsnmp_subtree *tree_ptr;
+ size_t var_len;
+ WriteMethod *write_method;
+ struct variable called_var;
+ register struct variable *s_var_ptr = NULL;
+ register u_char *access;
+
+
+ tree_ptr = netsnmp_subtree_find(name, namelen, NULL, "");
+ if (!tree_ptr) {
+ ag_trace("tree_ptr is NULL");
+ return SNMP_ERR_NOSUCHNAME;
+ }
+
+
+ memcpy(called_var.name, tree_ptr->name_a,
+ tree_ptr->namelen * sizeof(oid));
+
+ if (tree_ptr->reginfo &&
+ tree_ptr->reginfo->handler &&
+ tree_ptr->reginfo->handler->next &&
+ tree_ptr->reginfo->handler->next->myvoid) {
+ s_var_ptr = (struct variable *)tree_ptr->reginfo->handler->next->myvoid;
+ }
+
+ if (s_var_ptr) {
+ if (s_var_ptr->namelen) {
+ called_var.namelen =
+ tree_ptr->namelen;
+ called_var.type = s_var_ptr->type;
+ called_var.magic = s_var_ptr->magic;
+ called_var.acl = s_var_ptr->acl;
+ called_var.findVar = s_var_ptr->findVar;
+ access =
+ (*(s_var_ptr->findVar)) (&called_var, name, &namelen,
+ 1, &var_len, &write_method);
+
+ if (access
+ && snmp_oid_compare(name, namelen, tree_ptr->end_a,
+ tree_ptr->end_len) > 0) {
+ memcpy(name, tree_ptr->end_a, tree_ptr->end_len);
+ access = 0;
+ ag_trace("access := 0");
+ }
+
+ if (access) {
+
+ /*
+ * check 'var_len' ?
+ */
+
+ /*
+ * check type
+ */
+ switch (called_var.type) {
+ case ASN_INTEGER:
+ case ASN_COUNTER:
+ case ASN_TIMETICKS:
+ case ASN_GAUGE:
+ case ASN_COUNTER64:
+ break;
+ default:
+ ag_trace("invalid type: %d",
+ (int) called_var.type);
+ return SNMP_ERR_GENERR;
+ }
+ *new_value = *(u_long *) access;
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ }
+
+ return SNMP_ERR_NOSUCHNAME;
+}
+
+static void
+alarm_check_var(unsigned int clientreg, void *clientarg)
+{
+ RMON_ENTRY_T *hdr_ptr;
+ CRTL_ENTRY_T *body;
+ u_long new_value;
+ int ierr;
+
+ hdr_ptr = (RMON_ENTRY_T *) clientarg;
+ if (!hdr_ptr) {
+ ag_trace
+ ("Err: history_get_backet: hdr_ptr=NULL ? (Inserted in shock)");
+ return;
+ }
+
+ body = (CRTL_ENTRY_T *) hdr_ptr->body;
+ if (!body) {
+ ag_trace
+ ("Err: history_get_backet: body=NULL ? (Inserted in shock)");
+ return;
+ }
+
+ if (RMON1_ENTRY_VALID != hdr_ptr->status) {
+ ag_trace("Err: history_get_backet when entry %d is not valid ?!!",
+ (int) hdr_ptr->ctrl_index);
+ snmp_alarm_unregister(body->timer_id);
+ return;
+ }
+
+ ierr = fetch_var_val(body->var_name.objid,
+ body->var_name.length, &new_value);
+ if (SNMP_ERR_NOERROR != ierr) {
+ ag_trace("Err: Can't fetch var_name");
+ return;
+ }
+
+ body->value = (SAMPLE_TYPE_ABSOLUTE == body->sample_type) ?
+ new_value : new_value - body->last_abs_value;
+ body->last_abs_value = new_value;
+ /*
+ * ag_trace ("fetched value=%ld check %ld", (long) new_value, (long) body->value);
+ */
+#if 0 /* KUKU */
+ kuku_sum += body->value;
+ kuku_cnt++;
+#endif
+
+ if (ALARM_RISING != body->prev_alarm &&
+ body->value >= body->rising_threshold &&
+ SNMP_ERR_NOERROR == event_api_send_alarm(1, hdr_ptr->ctrl_index,
+ body->rising_event_index,
+ body->var_name.objid,
+ body->var_name.length,
+ ALARM_RISING, body->value,
+ body->rising_threshold,
+ "Rising"))
+ body->prev_alarm = ALARM_RISING;
+ else if (ALARM_FALLING != body->prev_alarm &&
+ body->value <= body->falling_threshold &&
+ SNMP_ERR_NOERROR == event_api_send_alarm(0,
+ hdr_ptr->ctrl_index,
+ body->
+ falling_event_index,
+ body->var_name.objid,
+ body->var_name.
+ length, ALARM_RISING,
+ body->value,
+ body->
+ falling_threshold,
+ "Falling"))
+ body->prev_alarm = ALARM_FALLING;
+}
+
+/*
+ * Control Table RowApi Callbacks
+ */
+
+int
+alarm_Create(RMON_ENTRY_T * eptr)
+{ /* create the body: alloc it and set defaults */
+ CRTL_ENTRY_T *body;
+ static VAR_OID_T DEFAULT_VAR = { 12, /* etherStatsPkts.1 */
+ {1, 3, 6, 1, 2, 1, 16, 1, 1, 1, 5, 1}
+ };
+
+
+ eptr->body = AGMALLOC(sizeof(CRTL_ENTRY_T));
+ if (!eptr->body)
+ return -3;
+ body = (CRTL_ENTRY_T *) eptr->body;
+
+ /*
+ * set defaults
+ */
+ body->interval = 1;
+ memcpy(&body->var_name, &DEFAULT_VAR, sizeof(VAR_OID_T));
+ body->sample_type = SAMPLE_TYPE_ABSOLUTE;
+ body->startup_type = ALARM_BOTH;
+ body->rising_threshold = MMM_MAX;
+ body->falling_threshold = 0;
+ body->rising_event_index = body->falling_event_index = 0;
+
+ body->prev_alarm = ALARM_NOTHING;
+
+ return 0;
+}
+
+int
+alarm_Validate(RMON_ENTRY_T * eptr)
+{
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) eptr->body;
+
+ if (body->rising_threshold <= body->falling_threshold) {
+ ag_trace("alarm_Validate failed: %lu must be > %lu",
+ body->rising_threshold, body->falling_threshold);
+ return SNMP_ERR_BADVALUE;
+ }
+
+ return 0;
+}
+
+int
+alarm_Activate(RMON_ENTRY_T * eptr)
+{
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) eptr->body;
+ int ierr;
+
+#if 0 /* KUKU */
+ kuku_sum = 0;
+ kuku_cnt = 0;
+#endif
+ ierr = fetch_var_val(body->var_name.objid,
+ body->var_name.length, &body->last_abs_value);
+ if (SNMP_ERR_NOERROR != ierr) {
+ ag_trace("Can't fetch var_name");
+ return ierr;
+ }
+
+ if (SAMPLE_TYPE_ABSOLUTE != body->sample_type) {
+ /*
+ * check startup alarm
+ */
+ if (ALARM_RISING == body->startup_type ||
+ ALARM_BOTH == body->startup_type) {
+ if (body->last_abs_value >= body->rising_threshold) {
+ event_api_send_alarm(1, eptr->ctrl_index,
+ body->rising_event_index,
+ body->var_name.objid,
+ body->var_name.length,
+ ALARM_RISING, body->value,
+ body->rising_threshold,
+ "Startup Rising");
+ }
+ }
+
+ if (ALARM_FALLING == body->startup_type ||
+ ALARM_BOTH == body->startup_type) {
+ if (body->last_abs_value <= body->falling_threshold) {
+ event_api_send_alarm(0, eptr->ctrl_index,
+ body->falling_event_index,
+ body->var_name.objid,
+ body->var_name.length,
+ ALARM_RISING, body->value,
+ body->falling_threshold,
+ "Startup Falling");
+ }
+ }
+
+ }
+
+ body->timer_id = snmp_alarm_register(body->interval, SA_REPEAT,
+ alarm_check_var, eptr);
+ return 0;
+}
+
+int
+alarm_Deactivate(RMON_ENTRY_T * eptr)
+{
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) eptr->body;
+
+ snmp_alarm_unregister(body->timer_id);
+#if 0 /* KUKU */
+ ag_trace("kuku_sum=%ld kuku_cnt=%ld sp=%ld",
+ (long) kuku_sum, (long) kuku_cnt,
+ (long) (kuku_sum / kuku_cnt));
+#endif
+ return 0;
+}
+
+int
+alarm_Copy(RMON_ENTRY_T * eptr)
+{
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) eptr->body;
+ CRTL_ENTRY_T *clone = (CRTL_ENTRY_T *) eptr->tmp;
+
+ if (RMON1_ENTRY_VALID == eptr->status &&
+ clone->rising_threshold <= clone->falling_threshold) {
+ ag_trace("alarm_Copy failed: invalid thresholds");
+ return SNMP_ERR_BADVALUE;
+ }
+
+ if (clone->interval != body->interval) {
+ if (RMON1_ENTRY_VALID == eptr->status) {
+ snmp_alarm_unregister(body->timer_id);
+ body->timer_id =
+ snmp_alarm_register(clone->interval, SA_REPEAT,
+ alarm_check_var, eptr);
+ }
+ body->interval = clone->interval;
+ }
+
+ if (snmp_oid_compare(clone->var_name.objid, clone->var_name.length,
+ body->var_name.objid, body->var_name.length)) {
+ memcpy(&body->var_name, &clone->var_name, sizeof(VAR_OID_T));
+ }
+
+ body->sample_type = clone->sample_type;
+ body->startup_type = clone->startup_type;
+ body->sample_type = clone->sample_type;
+ body->rising_threshold = clone->rising_threshold;
+ body->falling_threshold = clone->falling_threshold;
+ body->rising_event_index = clone->rising_event_index;
+ body->falling_event_index = clone->falling_event_index;
+ /*
+ * ag_trace ("alarm_Copy: rising_threshold=%lu falling_threshold=%lu",
+ * body->rising_threshold, body->falling_threshold);
+ */
+ return 0;
+}
+
+static int
+write_alarmEntry(int action, u_char * var_val, u_char var_val_type,
+ size_t var_val_len, u_char * statP,
+ oid * name, size_t name_len)
+{
+ long long_tmp;
+ int leaf_id, snmp_status;
+ static int prev_action = COMMIT;
+ RMON_ENTRY_T *hdr;
+ CRTL_ENTRY_T *cloned_body;
+ CRTL_ENTRY_T *body;
+
+ switch (action) {
+ case RESERVE1:
+ case FREE:
+ case UNDO:
+ case ACTION:
+ case COMMIT:
+ default:
+ return ROWAPI_do_another_action(name, alarmEntryFirstIndexBegin,
+ action, &prev_action,
+ table_ptr, sizeof(CRTL_ENTRY_T));
+ case RESERVE2:
+ /*
+ * get values from PDU, check them and save them in the cloned entry
+ */
+ long_tmp = name[alarmEntryFirstIndexBegin];
+ leaf_id = (int) name[alarmEntryFirstIndexBegin - 1];
+ hdr = ROWAPI_find(table_ptr, long_tmp); /* it MUST be OK */
+ cloned_body = (CRTL_ENTRY_T *) hdr->tmp;
+ body = (CRTL_ENTRY_T *) hdr->body;
+ switch (leaf_id) {
+ case IDalarmInterval:
+ snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+ var_val_len,
+ 0, MMM_MAX, &long_tmp);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+ cloned_body->interval = long_tmp;
+ break;
+ case IDalarmVariable:
+ snmp_status = AGUTIL_get_oid_value(var_val, var_val_type,
+ var_val_len,
+ &cloned_body->var_name);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+ if (RMON1_ENTRY_UNDER_CREATION != hdr->status &&
+ snmp_oid_compare(cloned_body->var_name.objid,
+ cloned_body->var_name.length,
+ body->var_name.objid,
+ body->var_name.length))
+ return SNMP_ERR_BADVALUE;
+ break;
+
+ break;
+ case IDalarmSampleType:
+ snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+ var_val_len,
+ SAMPLE_TYPE_ABSOLUTE,
+ SAMPLE_TYPE_DELTE,
+ &long_tmp);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+ cloned_body->sample_type = long_tmp;
+ break;
+ case IDalarmStartupAlarm:
+ snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+ var_val_len,
+ ALARM_RISING,
+ ALARM_BOTH, &long_tmp);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+ cloned_body->startup_type = long_tmp;
+ break;
+ case IDalarmRisingThreshold:
+ snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+ var_val_len,
+ 0, MMM_MAX, &long_tmp);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+ cloned_body->rising_threshold = long_tmp;
+ break;
+ case IDalarmFallingThreshold:
+ snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+ var_val_len,
+ 0, 0xFFFFFFFFl, &long_tmp);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+ cloned_body->falling_threshold = long_tmp;
+ break;
+ case IDalarmRisingEventIndex:
+ snmp_status = AGUTIL_get_int_value(var_val, var_val_type, var_val_len, 0, /* min. value */
+ 0, /* max. value */
+ &long_tmp);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+ cloned_body->rising_event_index = long_tmp;
+ break;
+ case IDalarmFallingEventIndex:
+ snmp_status = AGUTIL_get_int_value(var_val, var_val_type, var_val_len, 0, /* min. value */
+ 0, /* max. value */
+ &long_tmp);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+ cloned_body->falling_event_index = long_tmp;
+ break;
+ case IDalarmOwner:
+ if (hdr->new_owner)
+ AGFREE(hdr->new_owner);
+ hdr->new_owner = AGMALLOC(MAX_OWNERSTRING);;
+ if (!hdr->new_owner)
+ return SNMP_ERR_TOOBIG;
+ snmp_status = AGUTIL_get_string_value(var_val, var_val_type,
+ var_val_len,
+ MAX_OWNERSTRING,
+ 1, NULL, hdr->new_owner);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+
+ break;
+ case IDalarmStatus:
+ snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+ var_val_len,
+ RMON1_ENTRY_VALID,
+ RMON1_ENTRY_INVALID,
+ &long_tmp);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+ hdr->new_status = long_tmp;
+ break;
+ default:
+ ag_trace("%s:unknown leaf_id=%d\n", table_ptr->name,
+ (int) leaf_id);
+ return SNMP_ERR_NOSUCHNAME;
+ } /* of switch by 'leaf_id' */
+
+ break;
+ } /* of switch by actions */
+
+ prev_action = action;
+ return SNMP_ERR_NOERROR;
+}
+
+u_char *
+var_alarmEntry(struct variable * vp, oid * name, size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_return;
+ static CRTL_ENTRY_T theEntry;
+ RMON_ENTRY_T *hdr;
+
+ *write_method = write_alarmEntry;
+ hdr = ROWAPI_header_ControlEntry(vp, name, length, exact, var_len,
+ table_ptr,
+ &theEntry, sizeof(CRTL_ENTRY_T));
+ if (!hdr)
+ return NULL;
+
+ *var_len = sizeof(long); /* default */
+
+ switch (vp->magic) {
+ case IDalarmIndex:
+ long_return = hdr->ctrl_index;
+ return (u_char *) & long_return;
+ case IDalarmInterval:
+ long_return = theEntry.interval;
+ return (u_char *) & long_return;
+ case IDalarmVariable:
+ *var_len = sizeof(oid) * theEntry.var_name.length;
+ return (unsigned char *) theEntry.var_name.objid;
+ return (u_char *) & long_return;
+ case IDalarmSampleType:
+ long_return = theEntry.sample_type;
+ return (u_char *) & long_return;
+ case IDalarmValue:
+ long_return = theEntry.value;
+ return (u_char *) & long_return;
+ case IDalarmStartupAlarm:
+ long_return = theEntry.startup_type;
+ return (u_char *) & long_return;
+ case IDalarmRisingThreshold:
+ long_return = theEntry.rising_threshold;
+ return (u_char *) & long_return;
+ case IDalarmFallingThreshold:
+ long_return = theEntry.falling_threshold;
+ return (u_char *) & long_return;
+ case IDalarmRisingEventIndex:
+ long_return = theEntry.rising_event_index;
+ return (u_char *) & long_return;
+ case IDalarmFallingEventIndex:
+ long_return = theEntry.falling_event_index;
+ return (u_char *) & long_return;
+ case IDalarmOwner:
+ if (hdr->owner) {
+ *var_len = strlen(hdr->owner);
+ return (unsigned char *) hdr->owner;
+ } else {
+ *var_len = 0;
+ return (unsigned char *) "";
+ }
+
+ case IDalarmStatus:
+ long_return = hdr->status;
+ return (u_char *) & long_return;
+ default:
+ ag_trace("%s: unknown vp->magic=%d", table_ptr->name,
+ (int) vp->magic);
+ ERROR_MSG("");
+ }; /* of switch by 'vp->magic' */
+
+ return NULL;
+}
+
+/*
+ * Registration & Initializatio section
+ */
+
+oid oidalarmVariablesOid[] = { 1, 3, 6, 1, 2, 1, 16, 3 };
+
+struct variable7 oidalarmVariables[] = {
+ {IDalarmIndex, ASN_INTEGER, RONLY, var_alarmEntry, 3, {1, 1, 1}},
+ {IDalarmInterval, ASN_INTEGER, RWRITE, var_alarmEntry, 3, {1, 1, 2}},
+ {IDalarmVariable, ASN_OBJECT_ID, RWRITE, var_alarmEntry, 3, {1, 1, 3}},
+ {IDalarmSampleType, ASN_INTEGER, RWRITE, var_alarmEntry, 3, {1, 1, 4}},
+ {IDalarmValue, ASN_INTEGER, RONLY, var_alarmEntry, 3, {1, 1, 5}},
+ {IDalarmStartupAlarm, ASN_INTEGER, RWRITE, var_alarmEntry, 3,
+ {1, 1, 6}},
+ {IDalarmRisingThreshold, ASN_INTEGER, RWRITE, var_alarmEntry, 3,
+ {1, 1, 7}},
+ {IDalarmFallingThreshold, ASN_INTEGER, RWRITE, var_alarmEntry, 3,
+ {1, 1, 8}},
+ {IDalarmRisingEventIndex, ASN_INTEGER, RWRITE, var_alarmEntry, 3,
+ {1, 1, 9}},
+ {IDalarmFallingEventIndex, ASN_INTEGER, RWRITE, var_alarmEntry, 3,
+ {1, 1, 10}},
+ {IDalarmOwner, ASN_OCTET_STR, RWRITE, var_alarmEntry, 3, {1, 1, 11}},
+ {IDalarmStatus, ASN_INTEGER, RWRITE, var_alarmEntry, 3, {1, 1, 12}}
+};
+
+void
+init_alarm(void)
+{
+ REGISTER_MIB("alarmTable", oidalarmVariables, variable7,
+ oidalarmVariablesOid);
+
+ ROWAPI_init_table(&AlarmCtrlTable, "Alarm", 0, &alarm_Create, NULL, /* &alarm_Clone, */
+ NULL, /* &alarm_Delete, */
+ &alarm_Validate,
+ &alarm_Activate, &alarm_Deactivate, &alarm_Copy);
+}
+
+/*
+ * end of file alarm.c
+ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/alarm.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/alarm.h
new file mode 100644
index 0000000000..ae48c2ded5
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/alarm.h
@@ -0,0 +1,31 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#ifndef _MIBGROUP_ALARM_H
+#define _MIBGROUP_ALARM_H
+
+config_require(util_funcs)
+
+ /*
+ * function prototypes
+ */
+ void init_alarm(void);
+
+#endif /* _MIBGROUP_ALARM_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/event.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/event.c
new file mode 100644
index 0000000000..6001ea9865
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/event.c
@@ -0,0 +1,828 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <ctype.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+
+#include "event.h"
+
+/*
+ * Implementation headers
+ */
+#include "agutil_api.h"
+#include "row_api.h"
+
+/*
+ * File scope definitions section
+ */
+
+/*
+ * from MIB compilation
+ */
+#define eventEntryFirstIndexBegin 11
+
+#define EVENTINDEX 3
+#define EVENTDESCRIPTION 4
+#define EVENTTYPE 5
+#define EVENTCOMMUNITY 6
+#define EVENTLASTTIMESENT 7
+#define EVENTOWNER 8
+#define EVENTSTATUS 9
+
+#define Leaf_event_description 2
+#define MIN_event_description 0
+#define MAX_event_description 127
+#define Leaf_event_type 3
+#define Leaf_event_community 4
+#define MIN_event_community 0
+#define MAX_event_community 127
+#define Leaf_event_last_time_sent 5
+#define Leaf_eventOwner 6
+#define Leaf_eventStatus 7
+
+
+#define LOGEVENTINDEX 3
+#define LOGINDEX 4
+#define LOGTIME 5
+#define LOGDESCRIPTION 6
+
+
+/*
+ * defaults & limitations
+ */
+
+#define MAX_LOG_ENTRIES_PER_CTRL 200
+
+typedef struct data_struct_t {
+ struct data_struct_t *next;
+ u_long data_index;
+ u_long log_time;
+ char *log_description;
+} DATA_ENTRY_T;
+
+typedef enum {
+ EVENT_NONE = 1,
+ EVENT_LOG,
+ EVENT_TRAP,
+ EVENT_LOG_AND_TRAP
+} EVENT_TYPE_T;
+
+typedef struct {
+ char *event_description;
+ char *event_community;
+ EVENT_TYPE_T event_type;
+ u_long event_last_time_sent;
+
+ SCROLLER_T scrlr;
+#if 0
+ u_long event_last_logged_index;
+ u_long event_number_of_log_entries;
+ DATA_ENTRY_T *log_list;
+ DATA_ENTRY_T *last_log_ptr;
+#endif
+} CRTL_ENTRY_T;
+
+/*
+ * Main section
+ */
+
+static TABLE_DEFINTION_T EventCtrlTable;
+static TABLE_DEFINTION_T *table_ptr = &EventCtrlTable;
+
+/*
+ * Control Table RowApi Callbacks
+ */
+
+static int
+data_destructor(SCROLLER_T * scrlr, void *free_me)
+{
+ DATA_ENTRY_T *lptr = free_me;
+
+ if (lptr->log_description)
+ AGFREE(lptr->log_description);
+
+ return 0;
+}
+
+int
+event_Create(RMON_ENTRY_T * eptr)
+{ /* create the body: alloc it and set defaults */
+ CRTL_ENTRY_T *body;
+
+ eptr->body = AGMALLOC(sizeof(CRTL_ENTRY_T));
+ if (!eptr->body)
+ return -3;
+ body = (CRTL_ENTRY_T *) eptr->body;
+
+ /*
+ * set defaults
+ */
+
+ body->event_description = NULL;
+ body->event_community = AGSTRDUP("public");
+ /*
+ * ag_trace ("Dbg: created event_community=<%s>", body->event_community);
+ */
+ body->event_type = EVENT_NONE;
+ ROWDATAAPI_init(&body->scrlr,
+ MAX_LOG_ENTRIES_PER_CTRL,
+ MAX_LOG_ENTRIES_PER_CTRL,
+ sizeof(DATA_ENTRY_T), &data_destructor);
+
+
+ return 0;
+}
+
+int
+event_Clone(RMON_ENTRY_T * eptr)
+{ /* copy entry_bod -> clone */
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) eptr->body;
+ CRTL_ENTRY_T *clone = (CRTL_ENTRY_T *) eptr->tmp;
+
+ if (body->event_description)
+ clone->event_description = AGSTRDUP(body->event_description);
+
+ if (body->event_community)
+ clone->event_community = AGSTRDUP(body->event_community);
+ return 0;
+}
+
+int
+event_Copy(RMON_ENTRY_T * eptr)
+{
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) eptr->body;
+ CRTL_ENTRY_T *clone = (CRTL_ENTRY_T *) eptr->tmp;
+
+ if (body->event_type != clone->event_type) {
+ body->event_type = clone->event_type;
+ }
+
+ if (clone->event_description) {
+ if (body->event_description)
+ AGFREE(body->event_description);
+ body->event_description = AGSTRDUP(clone->event_description);
+ }
+
+ if (clone->event_community) {
+ if (body->event_community)
+ AGFREE(body->event_community);
+ body->event_community = AGSTRDUP(clone->event_community);
+ }
+
+ return 0;
+}
+
+int
+event_Delete(RMON_ENTRY_T * eptr)
+{
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) eptr;
+
+ if (body->event_description)
+ AGFREE(body->event_description);
+
+ if (body->event_community)
+ AGFREE(body->event_community);
+
+ return 0;
+}
+
+int
+event_Activate(RMON_ENTRY_T * eptr)
+{ /* init logTable */
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) eptr->body;
+
+ ROWDATAAPI_set_size(&body->scrlr,
+ body->scrlr.data_requested,
+ (u_char)(RMON1_ENTRY_VALID == eptr->status) );
+
+ return 0;
+}
+
+int
+event_Deactivate(RMON_ENTRY_T * eptr)
+{ /* free logTable */
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) eptr->body;
+
+ /*
+ * free data list
+ */
+ ROWDATAAPI_descructor(&body->scrlr);
+
+ return 0;
+}
+
+static int
+write_eventControl(int action, u_char * var_val, u_char var_val_type,
+ size_t var_val_len, u_char * statP,
+ oid * name, size_t name_len)
+{
+ long long_temp;
+ char *char_temp;
+ int leaf_id, snmp_status;
+ static int prev_action = COMMIT;
+ RMON_ENTRY_T *hdr;
+ CRTL_ENTRY_T *cloned_body;
+ CRTL_ENTRY_T *body;
+
+ switch (action) {
+ case RESERVE1:
+ case FREE:
+ case UNDO:
+ case ACTION:
+ case COMMIT:
+ default:
+ return ROWAPI_do_another_action(name, eventEntryFirstIndexBegin,
+ action, &prev_action,
+ table_ptr, sizeof(CRTL_ENTRY_T));
+
+ case RESERVE2:
+ /*
+ * get values from PDU, check them and save them in the cloned entry
+ */
+ long_temp = name[eventEntryFirstIndexBegin];
+ leaf_id = (int) name[eventEntryFirstIndexBegin - 1];
+ hdr = ROWAPI_find(table_ptr, long_temp); /* it MUST be OK */
+ cloned_body = (CRTL_ENTRY_T *) hdr->tmp;
+ body = (CRTL_ENTRY_T *) hdr->body;
+ switch (leaf_id) {
+ case Leaf_event_description:
+ char_temp = AGMALLOC(1 + MAX_event_description);
+ if (!char_temp)
+ return SNMP_ERR_TOOBIG;
+ snmp_status = AGUTIL_get_string_value(var_val, var_val_type,
+ var_val_len,
+ MAX_event_description,
+ 1, NULL, char_temp);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ AGFREE(char_temp);
+ return snmp_status;
+ }
+
+ if (cloned_body->event_description)
+ AGFREE(cloned_body->event_description);
+
+ cloned_body->event_description = AGSTRDUP(char_temp);
+ /*
+ * ag_trace ("rx: event_description=<%s>", cloned_body->event_description);
+ */
+ AGFREE(char_temp);
+
+ break;
+ case Leaf_event_type:
+ snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+ var_val_len,
+ EVENT_NONE,
+ EVENT_LOG_AND_TRAP,
+ &long_temp);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+ cloned_body->event_type = long_temp;
+ break;
+ case Leaf_event_community:
+ char_temp = AGMALLOC(1 + MAX_event_community);
+ if (!char_temp)
+ return SNMP_ERR_TOOBIG;
+ snmp_status = AGUTIL_get_string_value(var_val, var_val_type,
+ var_val_len,
+ MAX_event_community,
+ 1, NULL, char_temp);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ AGFREE(char_temp);
+ return snmp_status;
+ }
+
+ if (cloned_body->event_community)
+ AGFREE(cloned_body->event_community);
+
+ cloned_body->event_community = AGSTRDUP(char_temp);
+ AGFREE(char_temp);
+
+ break;
+ case Leaf_eventOwner:
+ if (hdr->new_owner)
+ AGFREE(hdr->new_owner);
+ hdr->new_owner = AGMALLOC(MAX_OWNERSTRING);;
+ if (!hdr->new_owner)
+ return SNMP_ERR_TOOBIG;
+ snmp_status = AGUTIL_get_string_value(var_val, var_val_type,
+ var_val_len,
+ MAX_OWNERSTRING,
+ 1, NULL, hdr->new_owner);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+
+ break;
+ case Leaf_eventStatus:
+ snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+ var_val_len,
+ RMON1_ENTRY_VALID,
+ RMON1_ENTRY_INVALID,
+ &long_temp);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+ hdr->new_status = long_temp;
+ break;
+ default:
+ ag_trace("%s:unknown leaf_id=%d\n", table_ptr->name,
+ (int) leaf_id);
+ return SNMP_ERR_NOSUCHNAME;
+ } /* of switch by 'leaf_id' */
+ break;
+ } /* of switch by actions */
+
+ prev_action = action;
+ return SNMP_ERR_NOERROR;
+}
+
+unsigned char *
+var_eventTable(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+ static CRTL_ENTRY_T theEntry;
+ RMON_ENTRY_T *hdr;
+
+ *write_method = write_eventControl;
+ hdr = ROWAPI_header_ControlEntry(vp, name, length, exact, var_len,
+ table_ptr,
+ &theEntry, sizeof(CRTL_ENTRY_T));
+ if (!hdr)
+ return NULL;
+
+ *var_len = sizeof(long); /* default */
+
+ switch (vp->magic) {
+ case EVENTINDEX:
+ long_ret = hdr->ctrl_index;
+ return (unsigned char *) &long_ret;
+ case EVENTDESCRIPTION:
+ if (theEntry.event_description) {
+ *var_len = strlen(theEntry.event_description);
+ return (unsigned char *) theEntry.event_description;
+ } else {
+ *var_len = 0;
+ return (unsigned char *) "";
+ }
+ case EVENTTYPE:
+ long_ret = theEntry.event_type;
+ return (unsigned char *) &long_ret;
+ case EVENTCOMMUNITY:
+ if (theEntry.event_community) {
+ *var_len = strlen(theEntry.event_community);
+ return (unsigned char *) theEntry.event_community;
+ } else {
+ *var_len = 0;
+ return (unsigned char *) "";
+ }
+ case EVENTLASTTIMESENT:
+ long_ret = theEntry.event_last_time_sent;
+ return (unsigned char *) &long_ret;
+ case EVENTOWNER:
+ if (hdr->owner) {
+ *var_len = strlen(hdr->owner);
+ return (unsigned char *) hdr->owner;
+ } else {
+ *var_len = 0;
+ return (unsigned char *) "";
+ }
+ case EVENTSTATUS:
+ long_ret = hdr->status;
+ return (unsigned char *) &long_ret;
+ default:
+ ag_trace("EventControlTable: unknown vp->magic=%d",
+ (int) vp->magic);
+ ERROR_MSG("");
+ }
+ return NULL;
+}
+
+static SCROLLER_T *
+event_extract_scroller(void *v_body)
+{
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) v_body;
+ return &body->scrlr;
+}
+
+unsigned char *
+var_logTable(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+ static DATA_ENTRY_T theEntry;
+ RMON_ENTRY_T *hdr;
+ CRTL_ENTRY_T *ctrl;
+
+ *write_method = NULL;
+ hdr = ROWDATAAPI_header_DataEntry(vp, name, length, exact, var_len,
+ table_ptr,
+ &event_extract_scroller,
+ sizeof(DATA_ENTRY_T), &theEntry);
+ if (!hdr)
+ return NULL;
+
+ ctrl = (CRTL_ENTRY_T *) hdr->body;
+
+ *var_len = sizeof(long); /* default */
+
+ switch (vp->magic) {
+ case LOGEVENTINDEX:
+ long_ret = hdr->ctrl_index;
+ return (unsigned char *) &long_ret;
+ case LOGINDEX:
+ long_ret = theEntry.data_index;
+ return (unsigned char *) &long_ret;
+ case LOGTIME:
+ long_ret = theEntry.log_time;
+ return (unsigned char *) &long_ret;
+ case LOGDESCRIPTION:
+ if (theEntry.log_description) {
+ *var_len = strlen(theEntry.log_description);
+ return (unsigned char *) theEntry.log_description;
+ } else {
+ *var_len = 0;
+ return (unsigned char *) "";
+ }
+ default:
+ ERROR_MSG("");
+ }
+
+ return NULL;
+}
+
+/*
+ * External API section
+ */
+
+static char *
+create_explanaition(CRTL_ENTRY_T * evptr, u_char is_rising,
+ u_long alarm_index, u_long event_index,
+ oid * alarmed_var,
+ size_t alarmed_var_length,
+ u_long value, u_long the_threshold,
+ u_long sample_type, char *alarm_descr)
+{
+#define UNEQ_LENGTH (1 + 11 + 4 + 11 + 1 + 20)
+ char expl[UNEQ_LENGTH];
+ static char c_oid[SPRINT_MAX_LEN];
+ size_t sz;
+ char *descr;
+ register char *pch;
+ register char *tmp;
+
+
+ snprint_objid(c_oid, sizeof(c_oid)-1, alarmed_var, alarmed_var_length);
+ c_oid[sizeof(c_oid)-1] = '\0';
+ for (pch = c_oid;;) {
+ tmp = strchr(pch, '.');
+ if (!tmp)
+ break;
+ if (isdigit(tmp[1]) || '"' == tmp[1])
+ break;
+ pch = tmp + 1;
+ }
+
+ snprintf(expl, UNEQ_LENGTH, "=%ld %s= %ld :%ld, %ld",
+ (unsigned long) value,
+ is_rising ? ">" : "<",
+ (unsigned long) the_threshold,
+ (long) alarm_index, (long) event_index);
+ sz = 3 + strlen(expl) + strlen(pch);
+ if (alarm_descr)
+ sz += strlen(alarm_descr);
+
+ descr = AGMALLOC(sz);
+ if (!descr) {
+ ag_trace("Can't allocate event description");
+ return NULL;
+ }
+
+ if (alarm_descr) {
+ strcpy(descr, alarm_descr);
+ strcat(descr, ":");
+ } else
+ *descr = '\0';
+
+ strcat(descr, pch);
+ strcat(descr, expl);
+ return descr;
+}
+
+extern void send_enterprise_trap_vars(int, int, oid *, int,
+ netsnmp_variable_list *);
+
+static netsnmp_variable_list *
+oa_bind_var(netsnmp_variable_list * prev,
+ void *value, int type, size_t sz_val, oid * oid, size_t sz_oid)
+{
+ netsnmp_variable_list *var;
+
+ var = (netsnmp_variable_list *) malloc(sizeof(netsnmp_variable_list));
+ if (!var) {
+ ag_trace("FATAL: cannot malloc in oa_bind_var\n");
+ exit(-1); /* Sorry :( */
+ }
+ memset(var, 0, sizeof(netsnmp_variable_list));
+ var->next_variable = prev;
+ snmp_set_var_objid(var, oid, sz_oid);
+ snmp_set_var_value(var, (u_char *) value, sz_val);
+ var->type = type;
+
+ return var;
+}
+
+static void
+event_send_trap(CRTL_ENTRY_T * evptr, u_char is_rising,
+ u_int alarm_index,
+ u_int value, u_int the_threshold,
+ oid * alarmed_var, size_t alarmed_var_length,
+ u_int sample_type)
+{
+ static oid rmon1_trap_oid[] = { 1, 3, 6, 1, 2, 1, 16, 0, 0 };
+ static oid alarm_index_oid[] =
+ { 1, 3, 6, 1, 2, 1, 16, 3, 1, 1, 1 };
+ static oid alarmed_var_oid[] =
+ { 1, 3, 6, 1, 2, 1, 16, 3, 1, 1, 3 };
+ static oid sample_type_oid[] =
+ { 1, 3, 6, 1, 2, 1, 16, 3, 1, 1, 4 };
+ static oid value_oid[] = { 1, 3, 6, 1, 2, 1, 16, 3, 1, 1, 5 };
+ static oid threshold_oid[] = { 1, 3, 6, 1, 2, 1, 16, 3, 1, 1, 7 }; /* rising case */
+ netsnmp_variable_list *top = NULL;
+ register int iii;
+
+ /*
+ * set the last 'oid' : risingAlarm or fallingAlarm
+ */
+ if (is_rising) {
+ iii = OID_LENGTH(rmon1_trap_oid);
+ rmon1_trap_oid[iii - 1] = 1;
+ iii = OID_LENGTH(threshold_oid);
+ threshold_oid[iii - 1] = 7;
+ } else {
+ iii = OID_LENGTH(rmon1_trap_oid);
+ rmon1_trap_oid[iii - 1] = 0;
+ iii = OID_LENGTH(threshold_oid);
+ threshold_oid[iii - 1] = 8;
+ }
+
+ /*
+ * build the var list
+ */
+ top = oa_bind_var(top, &alarm_index, ASN_INTEGER, sizeof(u_int),
+ alarm_index_oid, OID_LENGTH(alarm_index_oid));
+
+ top =
+ oa_bind_var(top, alarmed_var, ASN_OBJECT_ID,
+ sizeof(oid) * alarmed_var_length, alarmed_var_oid,
+ OID_LENGTH(alarmed_var_oid));
+
+ top = oa_bind_var(top, &sample_type, ASN_INTEGER, sizeof(u_int),
+ sample_type_oid, OID_LENGTH(sample_type_oid));
+
+ top = oa_bind_var(top, &value, ASN_INTEGER, sizeof(u_int),
+ value_oid, OID_LENGTH(value_oid));
+
+ top = oa_bind_var(top, &the_threshold, ASN_INTEGER, sizeof(u_int),
+ threshold_oid, OID_LENGTH(threshold_oid));
+
+
+ send_enterprise_trap_vars(SNMP_TRAP_ENTERPRISESPECIFIC, 0,
+ rmon1_trap_oid,
+ OID_LENGTH(rmon1_trap_oid), top);
+ ag_trace("rmon trap has been sent");
+ snmp_free_varbind(top);
+
+}
+
+
+static void
+event_save_log(CRTL_ENTRY_T * body, char *event_descr)
+{
+ register DATA_ENTRY_T *lptr;
+
+ lptr = ROWDATAAPI_locate_new_data(&body->scrlr);
+ if (!lptr) {
+ ag_trace("Err: event_save_log:cannot locate ?");
+ return;
+ }
+
+ lptr->log_time = body->event_last_time_sent;
+ if (lptr->log_description)
+ AGFREE(lptr->log_description);
+ lptr->log_description = AGSTRDUP(event_descr);
+ lptr->data_index = ROWDATAAPI_get_total_number(&body->scrlr);
+
+ /*
+ * ag_trace ("log has been saved, data_index=%d", (int) lptr->data_index);
+ */
+}
+
+int
+event_api_send_alarm(u_char is_rising,
+ u_long alarm_index,
+ u_long event_index,
+ oid * alarmed_var,
+ size_t alarmed_var_length,
+ u_long sample_type,
+ u_long value, u_long the_threshold, char *alarm_descr)
+{
+ RMON_ENTRY_T *eptr;
+ CRTL_ENTRY_T *evptr;
+
+ if (!event_index)
+ return SNMP_ERR_NOSUCHNAME;
+
+#if 0
+ ag_trace("event_api_send_alarm(%d,%d,%d,'%s')",
+ (int) is_rising, (int) alarm_index, (int) event_index,
+ alarm_descr);
+#endif
+ eptr = ROWAPI_find(table_ptr, event_index);
+ if (!eptr) {
+ /*
+ * ag_trace ("event cannot find entry %ld", event_index);
+ */
+ return SNMP_ERR_NOSUCHNAME;
+ }
+
+ evptr = (CRTL_ENTRY_T *) eptr->body;
+ evptr->event_last_time_sent = AGUTIL_sys_up_time();
+
+
+ if (EVENT_TRAP == evptr->event_type
+ || EVENT_LOG_AND_TRAP == evptr->event_type) {
+ event_send_trap(evptr, is_rising, alarm_index, value,
+ the_threshold, alarmed_var, alarmed_var_length,
+ sample_type);
+ }
+
+ if (EVENT_LOG == evptr->event_type
+ || EVENT_LOG_AND_TRAP == evptr->event_type) {
+ register char *explain;
+
+ explain = create_explanaition(evptr, is_rising,
+ alarm_index, event_index,
+ alarmed_var, alarmed_var_length,
+ value, the_threshold,
+ sample_type, alarm_descr);
+ /*
+ * if (explain) ag_trace ("Dbg:'%s'", explain);
+ */
+ event_save_log(evptr, explain);
+ if (explain)
+ AGFREE(explain);
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+#if 1 /* debug, but may be used for init. TBD: may be token snmpd.conf ? */
+int
+add_event_entry(int ctrl_index,
+ char *event_description,
+ EVENT_TYPE_T event_type, char *event_community)
+{
+ register RMON_ENTRY_T *eptr;
+ register CRTL_ENTRY_T *body;
+ int ierr;
+
+ ierr = ROWAPI_new(table_ptr, ctrl_index);
+ if (ierr) {
+ ag_trace("ROWAPI_new failed with %d", ierr);
+ return ierr;
+ }
+
+ eptr = ROWAPI_find(table_ptr, ctrl_index);
+ if (!eptr) {
+ ag_trace("ROWAPI_find failed");
+ return -4;
+ }
+
+ body = (CRTL_ENTRY_T *) eptr->body;
+
+ /*
+ * set parameters
+ */
+
+ if (event_description) {
+ if (body->event_description)
+ AGFREE(body->event_description);
+ body->event_description = AGSTRDUP(event_description);
+ }
+
+ if (event_community) {
+ if (body->event_community)
+ AGFREE(body->event_community);
+ body->event_community = AGSTRDUP(event_community);
+ }
+
+ body->event_type = event_type;
+
+ eptr->new_status = RMON1_ENTRY_VALID;
+ ierr = ROWAPI_commit(table_ptr, ctrl_index);
+ if (ierr) {
+ ag_trace("ROWAPI_commit failed with %d", ierr);
+ }
+
+ return ierr;
+}
+#endif
+
+/*
+ * Registration & Initializatio section
+ */
+
+oid eventTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 16, 9, 1 };
+oid logTable_variables_oid[] = { 1, 3, 6, 1, 2, 1, 16, 9, 2 };
+
+struct variable2 eventTable_variables[] = {
+ /*
+ * magic number , variable type, ro/rw , callback fn , L, oidsuffix
+ */
+ {EVENTINDEX, ASN_INTEGER, RONLY, var_eventTable, 2, {1, 1}},
+ {EVENTDESCRIPTION, ASN_OCTET_STR, RWRITE, var_eventTable, 2, {1, 2}},
+ {EVENTTYPE, ASN_INTEGER, RWRITE, var_eventTable, 2, {1, 3}},
+ {EVENTCOMMUNITY, ASN_OCTET_STR, RWRITE, var_eventTable, 2, {1, 4}},
+ {EVENTLASTTIMESENT, ASN_TIMETICKS, RONLY, var_eventTable, 2, {1, 5}},
+ {EVENTOWNER, ASN_OCTET_STR, RWRITE, var_eventTable, 2, {1, 6}},
+ {EVENTSTATUS, ASN_INTEGER, RWRITE, var_eventTable, 2, {1, 7}}
+};
+
+struct variable2 logTable_variables[] = {
+ /*
+ * magic number , variable type, ro/rw , callback fn , L, oidsuffix
+ */
+ {LOGEVENTINDEX, ASN_INTEGER, RONLY, var_logTable, 2, {1, 1}},
+ {LOGINDEX, ASN_INTEGER, RONLY, var_logTable, 2, {1, 2}},
+ {LOGTIME, ASN_TIMETICKS, RONLY, var_logTable, 2, {1, 3}},
+ {LOGDESCRIPTION, ASN_OCTET_STR, RONLY, var_logTable, 2, {1, 4}}
+
+};
+
+void
+init_event(void)
+{
+ REGISTER_MIB("eventTable", eventTable_variables, variable2,
+ eventTable_variables_oid);
+ REGISTER_MIB("logTable", logTable_variables, variable2,
+ logTable_variables_oid);
+
+ ROWAPI_init_table(&EventCtrlTable, "Event", 0, &event_Create, &event_Clone, &event_Delete, NULL, /* &event_Validate, */
+ &event_Activate, &event_Deactivate, &event_Copy);
+#if 0
+ add_event_entry(3, "Alarm", EVENT_LOG_AND_TRAP, NULL);
+ /*
+ * add_event_entry (5, ">=", EVENT_LOG_AND_TRAP, NULL);
+ */
+#endif
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/event.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/event.h
new file mode 100644
index 0000000000..e7993f484b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/event.h
@@ -0,0 +1,31 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#ifndef _MIBGROUP_EVENT_H
+#define _MIBGROUP_EVENT_H
+
+config_require(util_funcs)
+
+ /*
+ * function prototypes
+ */
+ void init_event(void);
+
+#endif /* _MIBGROUP_EVENT_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/history.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/history.c
new file mode 100644
index 0000000000..937c5591df
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/history.c
@@ -0,0 +1,729 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+
+#include "history.h"
+
+/*
+ * Implementation headers
+ */
+#include "agutil_api.h"
+#include "row_api.h"
+
+/*
+ * File scope definitions section
+ */
+
+#define historyControlEntryFirstIndexBegin 11
+
+#define CTRL_INDEX 3
+#define CTRL_DATASOURCE 4
+#define CTRL_BUCKETSREQUESTED 5
+#define CTRL_BUCKETSGRANTED 6
+#define CTRL_INTERVAL 7
+#define CTRL_OWNER 8
+#define CTRL_STATUS 9
+
+#define DATA_INDEX 3
+#define DATA_SAMPLEINDEX 4
+#define DATA_INTERVALSTART 5
+#define DATA_DROPEVENTS 6
+#define DATA_OCTETS 7
+#define DATA_PKTS 8
+#define DATA_BROADCASTPKTS 9
+#define DATA_MULTICASTPKTS 10
+#define DATA_CRCALIGNERRORS 11
+#define DATA_UNDERSIZEPKTS 12
+#define DATA_OVERSIZEPKTS 13
+#define DATA_FRAGMENTS 14
+#define DATA_JABBERS 15
+#define DATA_COLLISIONS 16
+#define DATA_UTILIZATION 17
+
+/*
+ * defaults & limitations
+ */
+
+#define MAX_BUCKETS_IN_CRTL_ENTRY 50
+#define HIST_DEF_BUCK_REQ 50
+#define HIST_DEF_INTERVAL 1800
+static VAR_OID_T DEFAULT_DATA_SOURCE = { 11, /* ifIndex.1 */
+ {1, 3, 6, 1, 2, 1, 2, 2, 1, 1, 1}
+};
+
+typedef struct data_struct_t {
+ struct data_struct_t *next;
+ u_long data_index;
+ u_long start_interval;
+ u_long utilization;
+ ETH_STATS_T EthData;
+} DATA_ENTRY_T;
+
+typedef struct {
+ u_long interval;
+ u_long timer_id;
+ VAR_OID_T data_source;
+
+ u_long coeff;
+ DATA_ENTRY_T previous_bucket;
+ SCROLLER_T scrlr;
+
+} CRTL_ENTRY_T;
+
+static TABLE_DEFINTION_T HistoryCtrlTable;
+static TABLE_DEFINTION_T *table_ptr = &HistoryCtrlTable;
+
+/*
+ * Main section
+ */
+
+# define Leaf_historyControlDataSource 2
+# define Leaf_historyControlBucketsRequested 3
+# define Leaf_historyControlInterval 5
+# define Leaf_historyControlOwner 6
+# define Leaf_historyControlStatus 7
+# define MIN_historyControlBucketsRequested 1
+# define MAX_historyControlBucketsRequested 65535
+# define MIN_historyControlInterval 1
+# define MAX_historyControlInterval 3600
+
+static int
+write_historyControl(int action, u_char * var_val, u_char var_val_type,
+ size_t var_val_len, u_char * statP,
+ oid * name, size_t name_len)
+{
+ long long_temp;
+ int leaf_id, snmp_status;
+ static int prev_action = COMMIT;
+ RMON_ENTRY_T *hdr;
+ CRTL_ENTRY_T *cloned_body;
+ CRTL_ENTRY_T *body;
+
+ switch (action) {
+ case RESERVE1:
+ case FREE:
+ case UNDO:
+ case ACTION:
+ case COMMIT:
+ default:
+ return ROWAPI_do_another_action(name,
+ historyControlEntryFirstIndexBegin,
+ action, &prev_action, table_ptr,
+ sizeof(CRTL_ENTRY_T));
+ case RESERVE2:
+ /*
+ * get values from PDU, check them and save them in the cloned entry
+ */
+ long_temp = name[historyControlEntryFirstIndexBegin];
+ leaf_id = (int) name[historyControlEntryFirstIndexBegin - 1];
+ hdr = ROWAPI_find(table_ptr, long_temp); /* it MUST be OK */
+ cloned_body = (CRTL_ENTRY_T *) hdr->tmp;
+ body = (CRTL_ENTRY_T *) hdr->body;
+ switch (leaf_id) {
+ case Leaf_historyControlDataSource:
+ snmp_status = AGUTIL_get_oid_value(var_val, var_val_type,
+ var_val_len,
+ &cloned_body->data_source);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ ag_trace("can't browse historyControlDataSource");
+ return snmp_status;
+ }
+ if (RMON1_ENTRY_UNDER_CREATION != hdr->status &&
+ snmp_oid_compare(cloned_body->data_source.objid,
+ cloned_body->data_source.length,
+ body->data_source.objid,
+ body->data_source.length)) {
+ ag_trace
+ ("can't change historyControlDataSource - not Creation");
+ return SNMP_ERR_BADVALUE;
+ }
+ break;
+ case Leaf_historyControlBucketsRequested:
+ snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+ var_val_len,
+ MIN_historyControlBucketsRequested,
+ MAX_historyControlBucketsRequested,
+ &cloned_body->scrlr.
+ data_requested);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+#if 0
+ if (RMON1_ENTRY_UNDER_CREATION != hdr->status &&
+ cloned_body->scrlr.data_requested !=
+ body->scrlr.data_requested)
+ return SNMP_ERR_BADVALUE;
+#endif
+ break;
+ case Leaf_historyControlInterval:
+ snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+ var_val_len,
+ MIN_historyControlInterval,
+ MAX_historyControlInterval,
+ &cloned_body->interval);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+#if 0
+ if (RMON1_ENTRY_UNDER_CREATION != hdr->status &&
+ cloned_body->interval != body->interval)
+ return SNMP_ERR_BADVALUE;
+#endif
+ break;
+ case Leaf_historyControlOwner:
+ if (hdr->new_owner)
+ AGFREE(hdr->new_owner);
+ hdr->new_owner = AGMALLOC(MAX_OWNERSTRING);;
+ if (!hdr->new_owner)
+ return SNMP_ERR_TOOBIG;
+ snmp_status = AGUTIL_get_string_value(var_val, var_val_type,
+ var_val_len,
+ MAX_OWNERSTRING,
+ 1, NULL, hdr->new_owner);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+
+ break;
+ case Leaf_historyControlStatus:
+ snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+ var_val_len,
+ RMON1_ENTRY_VALID,
+ RMON1_ENTRY_INVALID,
+ &long_temp);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+ hdr->new_status = long_temp;
+ break;
+ default:
+ ag_trace("%s:unknown leaf_id=%d\n", table_ptr->name,
+ (int) leaf_id);
+ return SNMP_ERR_NOSUCHNAME;
+ } /* of switch by 'leaf_id' */
+ break;
+
+ } /* of switch by actions */
+
+ prev_action = action;
+ return SNMP_ERR_NOERROR;
+}
+
+/*
+ * var_historyControlTable():
+ */
+unsigned char *
+var_historyControlTable(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+ static CRTL_ENTRY_T theEntry;
+ RMON_ENTRY_T *hdr;
+
+ *write_method = write_historyControl;
+ hdr = ROWAPI_header_ControlEntry(vp, name, length, exact, var_len,
+ table_ptr,
+ &theEntry, sizeof(CRTL_ENTRY_T));
+ if (!hdr)
+ return NULL;
+
+ *var_len = sizeof(long); /* default */
+
+ switch (vp->magic) {
+ case CTRL_INDEX:
+ long_ret = hdr->ctrl_index;
+ return (unsigned char *) &long_ret;
+
+ case CTRL_DATASOURCE:
+ *var_len = sizeof(oid) * theEntry.data_source.length;
+ return (unsigned char *) theEntry.data_source.objid;
+
+ case CTRL_BUCKETSREQUESTED:
+ long_ret = theEntry.scrlr.data_requested;
+ return (unsigned char *) &long_ret;
+
+ case CTRL_BUCKETSGRANTED:
+
+ long_ret = theEntry.scrlr.data_granted;
+ return (unsigned char *) &long_ret;
+
+ case CTRL_INTERVAL:
+ long_ret = theEntry.interval;
+ return (unsigned char *) &long_ret;
+
+ case CTRL_OWNER:
+ if (hdr->owner) {
+ *var_len = strlen(hdr->owner);
+ return (unsigned char *) hdr->owner;
+ } else {
+ *var_len = 0;
+ return (unsigned char *) "";
+ }
+
+ case CTRL_STATUS:
+ long_ret = hdr->status;
+ return (unsigned char *) &long_ret;
+
+ default:
+ ag_trace("HistoryControlTable: unknown vp->magic=%d",
+ (int) vp->magic);
+ ERROR_MSG("");
+ }
+ return NULL;
+}
+
+/*
+ * history row management control callbacks
+ */
+
+static void
+compute_delta(ETH_STATS_T * delta,
+ ETH_STATS_T * newval, ETH_STATS_T * prevval)
+{
+#define CNT_DIF(X) delta->X = newval->X - prevval->X
+
+ CNT_DIF(octets);
+ CNT_DIF(packets);
+ CNT_DIF(bcast_pkts);
+ CNT_DIF(mcast_pkts);
+ CNT_DIF(crc_align);
+ CNT_DIF(undersize);
+ CNT_DIF(oversize);
+ CNT_DIF(fragments);
+ CNT_DIF(jabbers);
+ CNT_DIF(collisions);
+}
+
+static void
+history_get_backet(unsigned int clientreg, void *clientarg)
+{
+ RMON_ENTRY_T *hdr_ptr;
+ CRTL_ENTRY_T *body;
+ DATA_ENTRY_T *bptr;
+ ETH_STATS_T newSample;
+
+ /*
+ * ag_trace ("history_get_backet: timer_id=%d", (int) clientreg);
+ */
+ hdr_ptr = (RMON_ENTRY_T *) clientarg;
+ if (!hdr_ptr) {
+ ag_trace
+ ("Err: history_get_backet: hdr_ptr=NULL ? (Inserted in shock)");
+ return;
+ }
+
+ body = (CRTL_ENTRY_T *) hdr_ptr->body;
+ if (!body) {
+ ag_trace
+ ("Err: history_get_backet: body=NULL ? (Inserted in shock)");
+ return;
+ }
+
+ if (RMON1_ENTRY_VALID != hdr_ptr->status) {
+ ag_trace("Err: history_get_backet when entry %d is not valid ?!!",
+ (int) hdr_ptr->ctrl_index);
+ /*
+ * snmp_alarm_print_list ();
+ */
+ snmp_alarm_unregister(body->timer_id);
+ ag_trace("Err: unregistered %ld", (long) body->timer_id);
+ return;
+ }
+
+ SYSTEM_get_eth_statistics(&body->data_source, &newSample);
+
+ bptr = ROWDATAAPI_locate_new_data(&body->scrlr);
+ if (!bptr) {
+ ag_trace
+ ("Err: history_get_backet for %d: empty bucket's list !??\n",
+ (int) hdr_ptr->ctrl_index);
+ return;
+ }
+
+ bptr->data_index = ROWDATAAPI_get_total_number(&body->scrlr);
+
+ bptr->start_interval = body->previous_bucket.start_interval;
+
+ compute_delta(&bptr->EthData, &newSample,
+ &body->previous_bucket.EthData);
+
+ bptr->utilization =
+ bptr->EthData.octets * 8 + bptr->EthData.packets * (96 + 64);
+ bptr->utilization /= body->coeff;
+
+ /*
+ * update previous_bucket
+ */
+ body->previous_bucket.start_interval = AGUTIL_sys_up_time();
+ memcpy(&body->previous_bucket.EthData, &newSample,
+ sizeof(ETH_STATS_T));
+}
+
+/*
+ * Control Table RowApi Callbacks
+ */
+
+int
+history_Create(RMON_ENTRY_T * eptr)
+{ /* create the body: alloc it and set defaults */
+ CRTL_ENTRY_T *body;
+
+ eptr->body = AGMALLOC(sizeof(CRTL_ENTRY_T));
+ if (!eptr->body)
+ return -3;
+ body = (CRTL_ENTRY_T *) eptr->body;
+
+ /*
+ * set defaults
+ */
+ body->interval = HIST_DEF_INTERVAL;
+ body->timer_id = 0;
+ memcpy(&body->data_source, &DEFAULT_DATA_SOURCE, sizeof(VAR_OID_T));
+
+ ROWDATAAPI_init(&body->scrlr, HIST_DEF_BUCK_REQ,
+ MAX_BUCKETS_IN_CRTL_ENTRY, sizeof(DATA_ENTRY_T), NULL);
+
+ return 0;
+}
+
+int
+history_Validate(RMON_ENTRY_T * eptr)
+{
+ /*
+ * T.B.D. (system dependent) check valid inteface in body->data_source;
+ */
+ return 0;
+}
+
+int
+history_Activate(RMON_ENTRY_T * eptr)
+{
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) eptr->body;
+
+ body->coeff = 100000L * (long) body->interval;
+
+ ROWDATAAPI_set_size(&body->scrlr,
+ body->scrlr.data_requested,
+ (u_char)(RMON1_ENTRY_VALID == eptr->status) );
+
+ SYSTEM_get_eth_statistics(&body->data_source,
+ &body->previous_bucket.EthData);
+ body->previous_bucket.start_interval = AGUTIL_sys_up_time();
+
+ body->scrlr.current_data_ptr = body->scrlr.first_data_ptr;
+ /*
+ * ag_trace ("Dbg: registered in history_Activate");
+ */
+ body->timer_id = snmp_alarm_register(body->interval, SA_REPEAT,
+ history_get_backet, eptr);
+ return 0;
+}
+
+int
+history_Deactivate(RMON_ENTRY_T * eptr)
+{
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) eptr->body;
+
+ snmp_alarm_unregister(body->timer_id);
+ /*
+ * ag_trace ("Dbg: unregistered in history_Deactivate timer_id=%d",
+ * (int) body->timer_id);
+ */
+
+ /*
+ * free data list
+ */
+ ROWDATAAPI_descructor(&body->scrlr);
+
+ return 0;
+}
+
+int
+history_Copy(RMON_ENTRY_T * eptr)
+{
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) eptr->body;
+ CRTL_ENTRY_T *clone = (CRTL_ENTRY_T *) eptr->tmp;
+
+ if (body->scrlr.data_requested != clone->scrlr.data_requested) {
+ ROWDATAAPI_set_size(&body->scrlr, clone->scrlr.data_requested,
+ (u_char)(RMON1_ENTRY_VALID == eptr->status) );
+ }
+
+ if (body->interval != clone->interval) {
+ if (RMON1_ENTRY_VALID == eptr->status) {
+ snmp_alarm_unregister(body->timer_id);
+ body->timer_id =
+ snmp_alarm_register(clone->interval, SA_REPEAT,
+ history_get_backet, eptr);
+ }
+
+ body->interval = clone->interval;
+ }
+
+ if (snmp_oid_compare
+ (clone->data_source.objid, clone->data_source.length,
+ body->data_source.objid, body->data_source.length)) {
+ memcpy(&body->data_source, &clone->data_source, sizeof(VAR_OID_T));
+ }
+
+ return 0;
+}
+
+static SCROLLER_T *
+history_extract_scroller(void *v_body)
+{
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) v_body;
+ return &body->scrlr;
+}
+
+/*
+ * var_etherHistoryTable():
+ */
+unsigned char *
+var_etherHistoryTable(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+ static DATA_ENTRY_T theBucket;
+ RMON_ENTRY_T *hdr;
+ CRTL_ENTRY_T *ctrl;
+
+ *write_method = NULL;
+ hdr = ROWDATAAPI_header_DataEntry(vp, name, length, exact, var_len,
+ table_ptr,
+ &history_extract_scroller,
+ sizeof(DATA_ENTRY_T), &theBucket);
+ if (!hdr)
+ return NULL;
+
+ *var_len = sizeof(long); /* default */
+
+ ctrl = (CRTL_ENTRY_T *) hdr->body;
+
+ switch (vp->magic) {
+ case DATA_INDEX:
+ long_ret = hdr->ctrl_index;
+ return (unsigned char *) &long_ret;
+ case DATA_SAMPLEINDEX:
+ long_ret = theBucket.data_index;
+ return (unsigned char *) &long_ret;
+ case DATA_INTERVALSTART:
+ long_ret = 0;
+ return (unsigned char *) &theBucket.start_interval;
+ case DATA_DROPEVENTS:
+ long_ret = 0;
+ return (unsigned char *) &long_ret;
+ case DATA_OCTETS:
+ long_ret = 0;
+ return (unsigned char *) &theBucket.EthData.octets;
+ case DATA_PKTS:
+ long_ret = 0;
+ return (unsigned char *) &theBucket.EthData.packets;
+ case DATA_BROADCASTPKTS:
+ long_ret = 0;
+ return (unsigned char *) &theBucket.EthData.bcast_pkts;
+ case DATA_MULTICASTPKTS:
+ long_ret = 0;
+ return (unsigned char *) &theBucket.EthData.mcast_pkts;
+ case DATA_CRCALIGNERRORS:
+ long_ret = 0;
+ return (unsigned char *) &theBucket.EthData.crc_align;
+ case DATA_UNDERSIZEPKTS:
+ long_ret = 0;
+ return (unsigned char *) &theBucket.EthData.undersize;
+ case DATA_OVERSIZEPKTS:
+ long_ret = 0;
+ return (unsigned char *) &theBucket.EthData.oversize;
+ case DATA_FRAGMENTS:
+ long_ret = 0;
+ return (unsigned char *) &theBucket.EthData.fragments;
+ case DATA_JABBERS:
+ long_ret = 0;
+ return (unsigned char *) &theBucket.EthData.jabbers;
+ case DATA_COLLISIONS:
+ long_ret = 0;
+ return (unsigned char *) &theBucket.EthData.collisions;
+ case DATA_UTILIZATION:
+ long_ret = 0;
+ return (unsigned char *) &theBucket.utilization;
+ default:
+ ag_trace("etherHistoryTable: unknown vp->magic=%d",
+ (int) vp->magic);
+ ERROR_MSG("");
+ }
+ return NULL;
+}
+
+#if 1 /* debug, but may be used for init. TBD: may be token snmpd.conf ? */
+int
+add_hist_entry(int ctrl_index, int ifIndex,
+ u_long interval, u_long requested)
+{
+ register RMON_ENTRY_T *eptr;
+ register CRTL_ENTRY_T *body;
+ int ierr;
+
+ ierr = ROWAPI_new(table_ptr, ctrl_index);
+ if (ierr) {
+ ag_trace("ROWAPI_new failed with %d", ierr);
+ return ierr;
+ }
+
+ eptr = ROWAPI_find(table_ptr, ctrl_index);
+ if (!eptr) {
+ ag_trace("ROWAPI_find failed");
+ return -4;
+ }
+
+ body = (CRTL_ENTRY_T *) eptr->body;
+
+ /*
+ * set parameters
+ */
+
+ body->data_source.objid[body->data_source.length - 1] = ifIndex;
+ body->interval = interval;
+ body->scrlr.data_requested = requested;
+
+ eptr->new_status = RMON1_ENTRY_VALID;
+ ierr = ROWAPI_commit(table_ptr, ctrl_index);
+ if (ierr) {
+ ag_trace("ROWAPI_commit failed with %d", ierr);
+ }
+
+ return ierr;
+
+}
+
+#endif
+
+/*
+ * Registration & Initializatio section
+ */
+
+oid historyControlTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 16, 2, 1 };
+
+struct variable2 historyControlTable_variables[] = {
+ /*
+ * magic number , variable type, ro/rw , callback fn , L, oidsuffix
+ */
+ {CTRL_INDEX, ASN_INTEGER, RONLY, var_historyControlTable, 2, {1, 1}},
+ {CTRL_DATASOURCE, ASN_OBJECT_ID, RWRITE, var_historyControlTable, 2,
+ {1, 2}},
+ {CTRL_BUCKETSREQUESTED, ASN_INTEGER, RWRITE, var_historyControlTable,
+ 2, {1, 3}},
+ {CTRL_BUCKETSGRANTED, ASN_INTEGER, RONLY, var_historyControlTable, 2,
+ {1, 4}},
+ {CTRL_INTERVAL, ASN_INTEGER, RWRITE, var_historyControlTable, 2,
+ {1, 5}},
+ {CTRL_OWNER, ASN_OCTET_STR, RWRITE, var_historyControlTable, 2,
+ {1, 6}},
+ {CTRL_STATUS, ASN_INTEGER, RWRITE, var_historyControlTable, 2, {1, 7}},
+
+};
+
+oid etherHistoryTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 16, 2, 2 };
+
+struct variable2 etherHistoryTable_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+ {DATA_INDEX, ASN_INTEGER, RONLY, var_etherHistoryTable, 2, {1, 1}},
+ {DATA_SAMPLEINDEX, ASN_INTEGER, RONLY, var_etherHistoryTable, 2,
+ {1, 2}},
+ {DATA_INTERVALSTART, ASN_TIMETICKS, RONLY, var_etherHistoryTable, 2,
+ {1, 3}},
+ {DATA_DROPEVENTS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2,
+ {1, 4}},
+ {DATA_OCTETS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2, {1, 5}},
+ {DATA_PKTS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2, {1, 6}},
+ {DATA_BROADCASTPKTS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2,
+ {1, 7}},
+ {DATA_MULTICASTPKTS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2,
+ {1, 8}},
+ {DATA_CRCALIGNERRORS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2,
+ {1, 9}},
+ {DATA_UNDERSIZEPKTS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2,
+ {1, 10}},
+ {DATA_OVERSIZEPKTS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2,
+ {1, 11}},
+ {DATA_FRAGMENTS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2,
+ {1, 12}},
+ {DATA_JABBERS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2, {1, 13}},
+ {DATA_COLLISIONS, ASN_COUNTER, RONLY, var_etherHistoryTable, 2,
+ {1, 14}},
+ {DATA_UTILIZATION, ASN_INTEGER, RONLY, var_etherHistoryTable, 2,
+ {1, 15}},
+
+};
+
+void
+init_history(void)
+{
+ REGISTER_MIB("historyControlTable", historyControlTable_variables,
+ variable2, historyControlTable_variables_oid);
+ REGISTER_MIB("etherHistoryTable", etherHistoryTable_variables,
+ variable2, etherHistoryTable_variables_oid);
+
+ ROWAPI_init_table(&HistoryCtrlTable, "History", 0, &history_Create, NULL, /* &history_Clone, */
+ NULL, /* &history_Delete, */
+ &history_Validate,
+ &history_Activate,
+ &history_Deactivate, &history_Copy);
+
+ /*
+ * add_hist_entry (2, 3, 4, 2);
+ */
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/history.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/history.h
new file mode 100644
index 0000000000..094bee49d5
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/history.h
@@ -0,0 +1,31 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#ifndef _MIBGROUP_HISTORY_H
+#define _MIBGROUP_HISTORY_H
+
+config_require(util_funcs)
+
+ /*
+ * function prototypes
+ */
+ void init_history(void);
+
+#endif /* _MIBGROUP_HISTORY_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/row_api.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/row_api.h
new file mode 100644
index 0000000000..bc986a0333
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/row_api.h
@@ -0,0 +1,187 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#ifndef _row_api_h_included__
+#define _row_api_h_included__
+
+/*
+ * control tables API section
+ */
+
+typedef enum {
+ RMON1_ENTRY_VALID = 1,
+ RMON1_ENTRY_CREATE_REQUEST,
+ RMON1_ENTRY_UNDER_CREATION,
+ RMON1_ENTRY_INVALID
+} RMON1_ENTRY_STATUS_T;
+
+#define MAX_OWNERSTRING 128
+
+/*
+ * structure for entry of all 'control' tables
+ */
+typedef struct tagEntry {
+ /*
+ * begin of the header
+ */
+ struct tagEntry *next;
+ void *table_ptr; /* do casting to (TABLE_DEFINTION_T*) */
+ RMON1_ENTRY_STATUS_T status;
+ RMON1_ENTRY_STATUS_T new_status;
+ u_long ctrl_index;
+ u_long timer_id;
+ char *owner;
+ char *new_owner;
+ u_char only_just_created;
+
+ /*
+ * end of the header
+ */
+
+ void *body;
+ void *tmp;
+} RMON_ENTRY_T;
+
+typedef int (ENTRY_CALLBACK_T) (RMON_ENTRY_T *);
+
+typedef struct {
+ char *name;
+ RMON_ENTRY_T *first;
+ u_long max_number_of_entries; /* '<0' means without limit */
+ u_long current_number_of_entries;
+ ENTRY_CALLBACK_T *ClbkCreate;
+ ENTRY_CALLBACK_T *ClbkClone;
+ ENTRY_CALLBACK_T *ClbkValidate;
+ ENTRY_CALLBACK_T *ClbkActivate;
+ ENTRY_CALLBACK_T *ClbkDeactivate;
+ ENTRY_CALLBACK_T *ClbkDelete;
+ ENTRY_CALLBACK_T *ClbkCopy;
+} TABLE_DEFINTION_T;
+
+/*
+ * Api prototypes
+ */
+void ROWAPI_init_table(TABLE_DEFINTION_T * table_ptr,
+ char *name,
+ u_long max_number_of_entries,
+ ENTRY_CALLBACK_T * ClbkCreate,
+ ENTRY_CALLBACK_T * ClbkClone,
+ ENTRY_CALLBACK_T * ClbkDelete,
+ ENTRY_CALLBACK_T * ClbkValidate,
+ ENTRY_CALLBACK_T * ClbkActivate,
+ ENTRY_CALLBACK_T * ClbkDeactivate,
+ ENTRY_CALLBACK_T * ClbkCopy);
+
+int ROWAPI_new(TABLE_DEFINTION_T * table_ptr,
+ u_long ctrl_index);
+
+RMON_ENTRY_T *ROWAPI_get_clone(TABLE_DEFINTION_T * table_ptr,
+ u_long ctrl_index, size_t body_size);
+
+void ROWAPI_delete_clone(TABLE_DEFINTION_T * table_ptr,
+ u_long ctrl_index);
+
+RMON_ENTRY_T *ROWAPI_first(TABLE_DEFINTION_T * table_ptr);
+
+RMON_ENTRY_T *ROWAPI_next(TABLE_DEFINTION_T * table_ptr,
+ u_long prev_index);
+
+RMON_ENTRY_T *ROWAPI_find(TABLE_DEFINTION_T * table_ptr,
+ u_long ctrl_index);
+
+int ROWAPI_action_check(TABLE_DEFINTION_T * table_ptr,
+ u_long ctrl_index);
+
+int ROWAPI_commit(TABLE_DEFINTION_T * table_ptr,
+ u_long ctrl_index);
+
+RMON_ENTRY_T *ROWAPI_header_ControlEntry(struct variable *vp, oid * name,
+ size_t * length, int exact,
+ size_t * var_len,
+ TABLE_DEFINTION_T * table_ptr,
+ void *entry_ptr,
+ size_t entry_size);
+
+int ROWAPI_do_another_action(oid * name,
+ int tbl_first_index_begin,
+ int action, int *prev_action,
+ TABLE_DEFINTION_T * table_ptr,
+ size_t entry_size);
+
+/*
+ * data tables API section
+ */
+
+typedef int (SCROLLER_ENTRY_DESCRUCTOR_T) (void *);
+
+typedef struct nexted_void_t {
+ struct nexted_void_t *next;
+ u_long data_index;
+} NEXTED_PTR_T;
+
+typedef struct data_scroller {
+ u_long max_number_of_entries;
+ u_long data_requested;
+ u_long data_granted;
+ u_long data_created; /* number of allocated data entries */
+ u_long data_stored; /* number of data, currently stored */
+ u_long data_total_number; /* number of data entries, stored after validation */
+
+ /*
+ * these 3 pointers make casting to private (DATA_ENTRY_T*)
+ */
+ void *first_data_ptr;
+ NEXTED_PTR_T *last_data_ptr;
+ void *current_data_ptr;
+
+ size_t data_size;
+ int (*data_destructor) (struct data_scroller *, void *);
+} SCROLLER_T;
+
+int ROWDATAAPI_init(SCROLLER_T * scrlr,
+ u_long max_number_of_entries,
+ u_long data_requested,
+ size_t data_size,
+ int (*data_destructor) (struct
+ data_scroller *,
+ void *));
+
+void
+ ROWDATAAPI_set_size(SCROLLER_T * scrlr,
+ u_long data_requested,
+ u_char do_allocation);
+
+void ROWDATAAPI_descructor(SCROLLER_T * scrlr);
+
+void *ROWDATAAPI_locate_new_data(SCROLLER_T * scrlr);
+
+u_long ROWDATAAPI_get_total_number(SCROLLER_T * scrlr);
+
+RMON_ENTRY_T *ROWDATAAPI_header_DataEntry(struct variable *vp,
+ oid * name, size_t * length,
+ int exact, size_t * var_len,
+ TABLE_DEFINTION_T * table_ptr,
+ SCROLLER_T *
+ (*extract_scroller) (void
+ *body),
+ size_t data_size,
+ void *entry_ptr);
+
+#endif /* _row_api_h_included__ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/rows.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/rows.c
new file mode 100644
index 0000000000..d8c3cc1064
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/rows.c
@@ -0,0 +1,880 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+#include <stddef.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+
+#include "agutil_api.h"
+#include "rows.h"
+#include "row_api.h"
+
+#define MAX_CREATION_TIME 60
+
+/*
+ * ***************************
+ */
+/*
+ * static file scope functions
+ */
+/*
+ * ***************************
+ */
+
+static void
+rowapi_delete(RMON_ENTRY_T * eold)
+{
+ register RMON_ENTRY_T *eptr;
+ register RMON_ENTRY_T *prev = NULL;
+ TABLE_DEFINTION_T *table_ptr;
+
+ table_ptr = (TABLE_DEFINTION_T *) eold->table_ptr;
+
+ /*
+ * delete timout scheduling
+ */
+ snmp_alarm_unregister(eold->timer_id);
+ ag_trace("Entry %ld in %s has been deleted",
+ eold->ctrl_index, table_ptr->name);
+
+ /*
+ * It it was valid entry => deactivate it
+ */
+ if (RMON1_ENTRY_VALID == eold->status) {
+ if (table_ptr->ClbkDeactivate)
+ table_ptr->ClbkDeactivate(eold);
+ }
+
+ /*
+ * delete it in users's sence
+ */
+ if (table_ptr->ClbkDelete)
+ table_ptr->ClbkDelete((RMON_ENTRY_T *) eold->body);
+
+ if (eold->body) {
+ AGFREE(eold->body);
+ }
+
+ if (eold->owner)
+ AGFREE(eold->owner);
+
+ /*
+ * delete it from the list in table
+ */
+
+ table_ptr->current_number_of_entries--;
+
+ for (eptr = table_ptr->first; eptr; eptr = eptr->next) {
+ if (eptr == eold)
+ break;
+ prev = eptr;
+ }
+
+ if (prev)
+ prev->next = eold->next;
+ else
+ table_ptr->first = eold->next;
+
+ AGFREE(eold);
+}
+
+static void
+rowapi_too_long_creation_callback(unsigned int clientreg, void *clientarg)
+{
+ RMON_ENTRY_T *eptr;
+ TABLE_DEFINTION_T *table_ptr;
+
+ eptr = (RMON_ENTRY_T *) clientarg;
+ table_ptr = (TABLE_DEFINTION_T *) eptr->table_ptr;
+ if (RMON1_ENTRY_VALID != eptr->status) {
+ ag_trace("row #%d in %s was under creation more then %ld sec.",
+ eptr->ctrl_index, table_ptr->name,
+ (long) MAX_CREATION_TIME);
+ rowapi_delete(eptr);
+ } else {
+ snmp_alarm_unregister(eptr->timer_id);
+ }
+}
+
+static int
+rowapi_deactivate(TABLE_DEFINTION_T * table_ptr, RMON_ENTRY_T * eptr)
+{
+ if (RMON1_ENTRY_UNDER_CREATION == eptr->status) {
+ /*
+ * nothing to do
+ */
+ return SNMP_ERR_NOERROR;
+ }
+
+ if (table_ptr->ClbkDeactivate)
+ table_ptr->ClbkDeactivate(eptr);
+ eptr->status = RMON1_ENTRY_UNDER_CREATION;
+ eptr->timer_id = snmp_alarm_register(MAX_CREATION_TIME, 0,
+ rowapi_too_long_creation_callback,
+ eptr);
+ ag_trace("Entry %ld in %s has been deactivated",
+ eptr->ctrl_index, table_ptr->name);
+
+ return SNMP_ERR_NOERROR;
+}
+
+static int
+rowapi_activate(TABLE_DEFINTION_T * table_ptr, RMON_ENTRY_T * eptr)
+{
+ RMON1_ENTRY_STATUS_T prev_status = eptr->status;
+
+ eptr->status = RMON1_ENTRY_VALID;
+
+ if (table_ptr->ClbkActivate) {
+ if (0 != table_ptr->ClbkActivate(eptr)) {
+ ag_trace("Can't activate entry #%ld in %s",
+ eptr->ctrl_index, table_ptr->name);
+ eptr->status = prev_status;
+ return SNMP_ERR_BADVALUE;
+ }
+ }
+
+ snmp_alarm_unregister(eptr->timer_id);
+ eptr->timer_id = 0;
+ ag_trace("Entry %ld in %s has been activated",
+ eptr->ctrl_index, table_ptr->name);
+ return SNMP_ERR_NOERROR;
+}
+
+/*
+ * creates an entry, locats it in proper sorted order by index
+ * Row is initialized to zero,
+ * except: 'next', 'table_ptr', 'index',
+ * 'timer_id' & 'status'=(RMON1_ENTRY_UNDER_CREATION)
+ * Calls (if need) ClbkCreate.
+ * Schedules for timeout under entry creation (id of this
+ * scheduling is saved in 'timer_id').
+ * Returns 0: OK,
+ -1:max. number exedes;
+ -2:malloc failed;
+ -3:ClbkCreate failed */
+int
+ROWAPI_new(TABLE_DEFINTION_T * table_ptr, u_long ctrl_index)
+{
+ register RMON_ENTRY_T *eptr;
+ register RMON_ENTRY_T *prev = NULL;
+ register RMON_ENTRY_T *enew;
+
+ /*
+ * check on 'max.number'
+ */
+ if (table_ptr->max_number_of_entries > 0 &&
+ table_ptr->current_number_of_entries >=
+ table_ptr->max_number_of_entries)
+ return -1;
+
+ /*
+ * allocate memory for the header
+ */
+ enew = (RMON_ENTRY_T *) AGMALLOC(sizeof(RMON_ENTRY_T));
+ if (!enew)
+ return -2;
+
+ /*
+ * init the header
+ */
+ memset(enew, 0, sizeof(RMON_ENTRY_T));
+ enew->ctrl_index = ctrl_index;
+ enew->table_ptr = (void *) table_ptr;
+ enew->status = RMON1_ENTRY_UNDER_CREATION;
+ enew->only_just_created = 1;
+
+ /*
+ * create the body: alloc it and set defaults
+ */
+ if (table_ptr->ClbkCreate) {
+ if (0 != table_ptr->ClbkCreate(enew)) {
+ AGFREE(enew);
+ return -3;
+ }
+ }
+
+ table_ptr->current_number_of_entries++;
+
+ /*
+ * find the place : before 'eptr' and after 'prev'
+ */
+ for (eptr = table_ptr->first; eptr; eptr = eptr->next) {
+ if (ctrl_index < eptr->ctrl_index)
+ break;
+ prev = eptr;
+ }
+
+ /*
+ * insert it
+ */
+ enew->next = eptr;
+ if (prev)
+ prev->next = enew;
+ else
+ table_ptr->first = enew;
+
+ enew->timer_id = snmp_alarm_register(MAX_CREATION_TIME, 0,
+ rowapi_too_long_creation_callback,
+ enew);
+ ag_trace("Entry %ld in %s has been created",
+ enew->ctrl_index, table_ptr->name);
+ return 0;
+}
+
+/*
+ * ******************************
+ */
+/*
+ * external usage (API) functions
+ */
+/*
+ * ******************************
+ */
+
+void
+ROWAPI_init_table(TABLE_DEFINTION_T * table_ptr,
+ char *name,
+ u_long max_number_of_entries,
+ ENTRY_CALLBACK_T * ClbkCreate,
+ ENTRY_CALLBACK_T * ClbkClone,
+ ENTRY_CALLBACK_T * ClbkDelete,
+ ENTRY_CALLBACK_T * ClbkValidate,
+ ENTRY_CALLBACK_T * ClbkActivate,
+ ENTRY_CALLBACK_T * ClbkDeactivate,
+ ENTRY_CALLBACK_T * ClbkCopy)
+{
+ table_ptr->name = name;
+ if (!table_ptr->name)
+ table_ptr->name = "Unknown";
+
+ table_ptr->max_number_of_entries = max_number_of_entries;
+ table_ptr->ClbkCreate = ClbkCreate;
+ table_ptr->ClbkClone = ClbkClone;
+ table_ptr->ClbkDelete = ClbkDelete;
+ table_ptr->ClbkValidate = ClbkValidate;
+ table_ptr->ClbkActivate = ClbkActivate;
+ table_ptr->ClbkDeactivate = ClbkDeactivate;
+ table_ptr->ClbkCopy = ClbkCopy;
+
+ table_ptr->first = NULL;
+ table_ptr->current_number_of_entries = 0;
+}
+
+void
+ROWAPI_delete_clone(TABLE_DEFINTION_T * table_ptr, u_long ctrl_index)
+{
+ register RMON_ENTRY_T *eptr;
+
+ eptr = ROWAPI_find(table_ptr, ctrl_index);
+ if (eptr) {
+ if (eptr->new_owner)
+ AGFREE(eptr->new_owner);
+
+ if (eptr->tmp) {
+ if (table_ptr->ClbkDelete)
+ table_ptr->ClbkDelete((RMON_ENTRY_T *) eptr->tmp);
+ AGFREE(eptr->tmp);
+ }
+
+ if (eptr->only_just_created) {
+ rowapi_delete(eptr);
+ }
+ }
+}
+
+RMON_ENTRY_T *
+ROWAPI_get_clone(TABLE_DEFINTION_T * table_ptr,
+ u_long ctrl_index, size_t body_size)
+{
+ register RMON_ENTRY_T *eptr;
+
+ if (ctrl_index < 1 || ctrl_index > 0xFFFFu) {
+ ag_trace("%s: index %ld out of range (1..65535)",
+ table_ptr->name, (long) ctrl_index);
+ return NULL;
+ }
+
+ /*
+ * get it
+ */
+ eptr = ROWAPI_find(table_ptr, ctrl_index);
+
+ if (!eptr) { /* try to create */
+ if (0 != ROWAPI_new(table_ptr, ctrl_index)) {
+ return NULL;
+ }
+
+ /*
+ * get it
+ */
+ eptr = ROWAPI_find(table_ptr, ctrl_index);
+ if (!eptr) /* it is unbelievable, but ... :( */
+ return NULL;
+ }
+
+ eptr->new_status = eptr->status;
+
+ eptr->tmp = AGMALLOC(body_size);
+ if (!eptr->tmp) {
+ if (eptr->only_just_created)
+ rowapi_delete(eptr);
+ return NULL;
+ }
+
+ memcpy(eptr->tmp, eptr->body, body_size);
+ if (table_ptr->ClbkClone)
+ table_ptr->ClbkClone(eptr);
+
+ if (eptr->new_owner)
+ AGFREE(eptr->new_owner);
+ return eptr->tmp;
+}
+
+RMON_ENTRY_T *
+ROWAPI_first(TABLE_DEFINTION_T * table_ptr)
+{
+ return table_ptr->first;
+}
+
+/*
+ * returns an entry with the smallest index
+ * which index > prev_index
+ */
+RMON_ENTRY_T *
+ROWAPI_next(TABLE_DEFINTION_T * table_ptr, u_long prev_index)
+{
+ register RMON_ENTRY_T *eptr;
+
+ for (eptr = table_ptr->first; eptr; eptr = eptr->next)
+ if (eptr->ctrl_index > prev_index)
+ return eptr;
+
+ return NULL;
+}
+
+RMON_ENTRY_T *
+ROWAPI_find(TABLE_DEFINTION_T * table_ptr, u_long ctrl_index)
+{
+ register RMON_ENTRY_T *eptr;
+
+ for (eptr = table_ptr->first; eptr; eptr = eptr->next) {
+ if (eptr->ctrl_index == ctrl_index)
+ return eptr;
+ if (eptr->ctrl_index > ctrl_index)
+ break;
+ }
+
+ return NULL;
+}
+
+int
+ROWAPI_action_check(TABLE_DEFINTION_T * table_ptr, u_long ctrl_index)
+{
+ register RMON_ENTRY_T *eptr;
+
+ eptr = ROWAPI_find(table_ptr, ctrl_index);
+ if (!eptr) {
+ ag_trace("Smth wrong ?");
+ return SNMP_ERR_GENERR;
+ }
+
+ /*
+ * test owner string
+ */
+ if (RMON1_ENTRY_UNDER_CREATION != eptr->status) {
+ /*
+ * Only the same value is allowed
+ */
+ if (eptr->new_owner &&
+ (!eptr->owner
+ || strncmp(eptr->new_owner, eptr->owner, MAX_OWNERSTRING))) {
+ ag_trace("invalid owner string in ROWAPI_action_check");
+ ag_trace("eptr->new_owner=%p eptr->owner=%p", eptr->new_owner,
+ eptr->owner);
+ return SNMP_ERR_BADVALUE;
+ }
+ }
+
+ switch (eptr->new_status) { /* this status we want to set */
+ case RMON1_ENTRY_CREATE_REQUEST:
+ if (RMON1_ENTRY_UNDER_CREATION != eptr->status)
+ return SNMP_ERR_BADVALUE;
+ break;
+ case RMON1_ENTRY_INVALID:
+ break;
+ case RMON1_ENTRY_VALID:
+ if (RMON1_ENTRY_VALID == eptr->status) {
+ break; /* nothing to do */
+ }
+ if (RMON1_ENTRY_UNDER_CREATION != eptr->status) {
+ ag_trace("Validate %s: entry %ld has wrong status %d",
+ table_ptr->name, (long) ctrl_index,
+ (int) eptr->status);
+ return SNMP_ERR_BADVALUE;
+ }
+
+ /*
+ * Our MIB understanding extension: we permit to set
+ * VALID when entry doesn't exit, in this case PDU has to have
+ * the nessessary & valid set of non-default values
+ */
+ if (table_ptr->ClbkValidate) {
+ return table_ptr->ClbkValidate(eptr);
+ }
+ break;
+ case RMON1_ENTRY_UNDER_CREATION:
+ /*
+ * Our MIB understanding extension: we permit to travel from
+ * VALID to 'UNDER_CREATION' state
+ */
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+ROWAPI_commit(TABLE_DEFINTION_T * table_ptr, u_long ctrl_index)
+{
+ register RMON_ENTRY_T *eptr;
+
+ eptr = ROWAPI_find(table_ptr, ctrl_index);
+ if (!eptr) {
+ ag_trace("Smth wrong ?");
+ return SNMP_ERR_GENERR;
+ }
+
+ eptr->only_just_created = 0;
+
+ switch (eptr->new_status) { /* this status we want to set */
+ case RMON1_ENTRY_CREATE_REQUEST: /* copy tmp => eprt */
+ if (eptr->new_owner) {
+ if (eptr->owner)
+ AGFREE(eptr->owner);
+ eptr->owner = AGSTRDUP(eptr->new_owner);
+ }
+
+ if (table_ptr->ClbkCopy && eptr->tmp)
+ table_ptr->ClbkCopy(eptr);
+ break;
+ case RMON1_ENTRY_INVALID:
+ ROWAPI_delete_clone(table_ptr, ctrl_index);
+ rowapi_delete(eptr);
+#if 0 /* for debug */
+ dbg_f_AG_MEM_REPORT();
+#endif
+ break;
+ case RMON1_ENTRY_VALID: /* copy tmp => eprt and activate */
+ /*
+ * Our MIB understanding extension: we permit to set
+ * VALID when entry doesn't exit, in this case PDU has to have
+ * the nessessary & valid set of non-default values
+ */
+ if (eptr->new_owner) {
+ if (eptr->owner)
+ AGFREE(eptr->owner);
+ eptr->owner = AGSTRDUP(eptr->new_owner);
+ }
+ if (table_ptr->ClbkCopy && eptr->tmp)
+ table_ptr->ClbkCopy(eptr);
+ if (RMON1_ENTRY_VALID != eptr->status) {
+ rowapi_activate(table_ptr, eptr);
+ }
+ break;
+ case RMON1_ENTRY_UNDER_CREATION: /* deactivate (if need) and copy tmp => eprt */
+ /*
+ * Our MIB understanding extension: we permit to travel from
+ * VALID to 'UNDER_CREATION' state
+ */
+ rowapi_deactivate(table_ptr, eptr);
+ if (eptr->new_owner) {
+ if (eptr->owner)
+ AGFREE(eptr->owner);
+ eptr->owner = AGSTRDUP(eptr->new_owner);
+ }
+ if (table_ptr->ClbkCopy && eptr->tmp)
+ table_ptr->ClbkCopy(eptr);
+ break;
+ }
+
+ ROWAPI_delete_clone(table_ptr, ctrl_index);
+ return SNMP_ERR_NOERROR;
+}
+
+RMON_ENTRY_T *
+ROWAPI_header_ControlEntry(struct variable * vp, oid * name,
+ size_t * length, int exact,
+ size_t * var_len,
+ TABLE_DEFINTION_T * table_ptr,
+ void *entry_ptr, size_t entry_size)
+{
+ long ctrl_index;
+ RMON_ENTRY_T *hdr = NULL;
+
+ if (0 != AGUTIL_advance_index_name(vp, name, length, exact)) {
+ ag_trace("cannot advance_index_name");
+ return NULL;
+ }
+
+ ctrl_index = vp->namelen >= *length ? 0 : name[vp->namelen];
+
+ if (exact) {
+ if (ctrl_index)
+ hdr = ROWAPI_find(table_ptr, ctrl_index);
+ } else {
+ if (ctrl_index)
+ hdr = ROWAPI_next(table_ptr, ctrl_index);
+ else
+ hdr = ROWAPI_first(table_ptr);
+
+ if (hdr) { /* set new index */
+ name[vp->namelen] = hdr->ctrl_index;
+ *length = vp->namelen + 1;
+ }
+ }
+
+ if (hdr)
+ memcpy(entry_ptr, hdr->body, entry_size);
+ return hdr;
+}
+
+int
+ROWAPI_do_another_action(oid * name, int tbl_first_index_begin,
+ int action, int *prev_action,
+ TABLE_DEFINTION_T * table_ptr, size_t entry_size)
+{
+ long long_temp;
+ RMON_ENTRY_T *tmp;
+
+ if (action == *prev_action)
+ return SNMP_ERR_NOERROR; /* I want to process it only once ! */
+ *prev_action = action;
+
+ long_temp = name[tbl_first_index_begin];
+
+ switch (action) {
+ case RESERVE1:
+ tmp = ROWAPI_get_clone(table_ptr, long_temp, entry_size);
+ if (!tmp) {
+ ag_trace("RESERVE1: cannot get clone\n");
+ return SNMP_ERR_TOOBIG;
+ }
+ break;
+
+ case FREE: /* if RESERVEx failed: release any resources that have been allocated */
+ case UNDO: /* if ACTION failed: release any resources that have been allocated */
+ ROWAPI_delete_clone(table_ptr, long_temp);
+ break;
+
+ case ACTION:
+ long_temp = ROWAPI_action_check(table_ptr, long_temp);
+ if (0 != long_temp)
+ return long_temp;
+ break;
+
+ case COMMIT:
+ long_temp = ROWAPI_commit(table_ptr, long_temp);
+ if (0 != long_temp) /* it MUST NOT be */
+ return long_temp;
+ break;
+ default:
+ ag_trace("Unknown action %d", (int) action);
+ return SNMP_ERR_GENERR;
+ } /* of switch by actions */
+
+ return SNMP_ERR_NOERROR;
+}
+
+/*
+ * data tables API section
+ */
+
+int
+ROWDATAAPI_init(SCROLLER_T * scrlr,
+ u_long data_requested,
+ u_long max_number_of_entries,
+ size_t data_size,
+ int (*data_destructor) (struct data_scroller *, void *))
+{
+ scrlr->data_granted = 0;
+ scrlr->data_created = 0;
+ scrlr->data_total_number = 0;
+ scrlr->first_data_ptr =
+ scrlr->last_data_ptr = scrlr->current_data_ptr = NULL;
+
+ scrlr->max_number_of_entries = max_number_of_entries;
+ scrlr->data_size = data_size;
+
+ scrlr->data_destructor = data_destructor;
+
+ ROWDATAAPI_set_size(scrlr, data_requested, 0);
+
+ return 0;
+}
+
+static int
+delete_data_entry(SCROLLER_T * scrlr, void *delete_me)
+{
+ NEXTED_PTR_T *data_ptr = delete_me;
+ register NEXTED_PTR_T *tmp;
+
+ if (data_ptr == scrlr->first_data_ptr) {
+ scrlr->first_data_ptr = data_ptr->next;
+ if (data_ptr == scrlr->last_data_ptr)
+ scrlr->last_data_ptr = NULL;
+ } else { /* not first */
+ for (tmp = scrlr->first_data_ptr; tmp; tmp = tmp->next) {
+ if (tmp->next == data_ptr) {
+ if (data_ptr == scrlr->last_data_ptr)
+ scrlr->last_data_ptr = tmp;
+ tmp->next = data_ptr->next;
+ break;
+ }
+ } /* for */
+ } /* not first */
+
+ if (data_ptr == scrlr->current_data_ptr)
+ scrlr->current_data_ptr = data_ptr->next;
+
+ if (scrlr->data_destructor)
+ scrlr->data_destructor(scrlr, data_ptr);
+ AGFREE(data_ptr);
+ scrlr->data_created--;
+ scrlr->data_stored--;
+
+ return 0;
+}
+
+static void
+realloc_number_of_data(SCROLLER_T * scrlr, long dlong)
+{
+ void *bptr; /* DATA_ENTRY_T */
+ NEXTED_PTR_T *prev = NULL;
+ void *first = NULL;
+
+ if (dlong > 0) {
+ for (; dlong; dlong--, prev = bptr, scrlr->data_created++) {
+ bptr = AGMALLOC(scrlr->data_size);
+ if (!bptr) {
+ ag_trace("Err: no memory for data");
+ break;
+ }
+ memset(bptr, 0, scrlr->data_size);
+ if (prev)
+ prev->next = bptr;
+ else
+ first = bptr;
+ } /* of loop by malloc bucket */
+
+ if (!scrlr->current_data_ptr)
+ scrlr->current_data_ptr = first;
+ if (scrlr->last_data_ptr) {
+ scrlr->last_data_ptr->next = first;
+ } else
+ scrlr->first_data_ptr = first;
+
+ scrlr->last_data_ptr = bptr;
+
+ } else {
+ for (; dlong && scrlr->data_created > 0; dlong++) {
+ if (scrlr->current_data_ptr)
+ delete_data_entry(scrlr, scrlr->current_data_ptr);
+ else
+ delete_data_entry(scrlr, scrlr->first_data_ptr);
+ }
+ }
+}
+
+void
+ROWDATAAPI_set_size(SCROLLER_T * scrlr,
+ u_long data_requested, u_char do_allocation)
+{
+ long dlong;
+
+ scrlr->data_requested = data_requested;
+ scrlr->data_granted = (data_requested < scrlr->max_number_of_entries) ?
+ data_requested : scrlr->max_number_of_entries;
+ if (do_allocation) {
+ dlong = (long) scrlr->data_granted - (long) scrlr->data_created;
+ realloc_number_of_data(scrlr, dlong);
+ }
+}
+
+void
+ROWDATAAPI_descructor(SCROLLER_T * scrlr)
+{
+ register NEXTED_PTR_T *bptr;
+ register void *next;
+
+ for (bptr = scrlr->first_data_ptr; bptr; bptr = next) {
+ next = bptr->next;
+ if (scrlr->data_destructor)
+ scrlr->data_destructor(scrlr, bptr);
+ AGFREE(bptr);
+ }
+ scrlr->data_created = 0;
+ scrlr->data_granted = 0;
+ scrlr->first_data_ptr =
+ scrlr->last_data_ptr = scrlr->current_data_ptr = NULL;
+}
+
+void *
+ROWDATAAPI_locate_new_data(SCROLLER_T * scrlr)
+{
+ register NEXTED_PTR_T *bptr;
+
+ if (!scrlr->current_data_ptr) { /* there was wrap */
+ bptr = scrlr->first_data_ptr;
+ if (!bptr) {
+ ag_trace("Err: SCROLLER_T:locate_new_data: internal error :(");
+ return NULL;
+ }
+ scrlr->first_data_ptr = bptr->next;
+ scrlr->last_data_ptr->next = bptr;
+ scrlr->last_data_ptr = (NEXTED_PTR_T *) bptr;
+ bptr->next = 0;
+ } else {
+ bptr = scrlr->current_data_ptr;
+ scrlr->current_data_ptr = bptr->next;
+ ++scrlr->data_stored;
+ }
+
+ scrlr->data_total_number++;
+
+ return bptr;
+}
+
+u_long
+ROWDATAAPI_get_total_number(SCROLLER_T * scrlr)
+{
+ return scrlr->data_total_number;
+}
+
+RMON_ENTRY_T *
+ROWDATAAPI_header_DataEntry(struct variable * vp, oid * name,
+ size_t * length, int exact,
+ size_t * var_len,
+ TABLE_DEFINTION_T * table_ptr,
+ SCROLLER_T * (*extract_scroller) (void *body),
+ size_t data_size, void *entry_ptr)
+{
+ long ctrl_indx, data_index;
+ RMON_ENTRY_T *hdr = NULL;
+ SCROLLER_T *scrlr;
+ NEXTED_PTR_T *bptr = NULL;
+ register u_long iii;
+
+ if (0 != AGUTIL_advance_index_name(vp, name, length, exact)) {
+ ag_trace("cannot advance_index_name");
+ return NULL;
+ }
+
+ ctrl_indx = vp->namelen >= *length ? 0 : name[vp->namelen];
+ if (ctrl_indx)
+ data_index =
+ ((int)(vp->namelen + 1) >= (int)*length) ? 0 : name[vp->namelen + 1];
+ else
+ data_index = 0;
+
+ if (exact) {
+ if (ctrl_indx && data_index) {
+ hdr = ROWAPI_find(table_ptr, ctrl_indx);
+ if (hdr) {
+ scrlr = extract_scroller(hdr->body);
+ bptr = scrlr->first_data_ptr;
+ for (iii = 0; iii < scrlr->data_stored && bptr;
+ iii++, bptr = bptr->next) {
+ if ((long)bptr->data_index == data_index)
+ break;
+ }
+ if (!bptr)
+ hdr = NULL;
+ }
+ }
+ } else {
+ if (ctrl_indx)
+ hdr = ROWAPI_find(table_ptr, ctrl_indx);
+ else
+ hdr = ROWAPI_first(table_ptr);
+
+ if (hdr) {
+ scrlr = extract_scroller(hdr->body);
+ /*
+ * ag_trace ("get next after (%d %d)", (int) ctrl_indx, (int) data_index);
+ */
+ bptr = scrlr->first_data_ptr;
+ for (iii = 0; iii < scrlr->data_stored && bptr;
+ iii++, bptr = bptr->next) {
+ if (bptr->data_index && (long)bptr->data_index > data_index)
+ break;
+ }
+
+ if (bptr && (long)bptr->data_index <= data_index)
+ bptr = NULL;
+
+ if (!bptr) { /* travel to next row */
+ /*
+ * ag_trace ("Dbg: travel to next row");
+ */
+ for (hdr = hdr->next; hdr; hdr = hdr->next) {
+ if (RMON1_ENTRY_VALID != hdr->status)
+ continue;
+
+ scrlr = extract_scroller(hdr->body);
+ if (scrlr->data_stored <= 0)
+ continue;
+ for (bptr = scrlr->first_data_ptr; bptr;
+ bptr = bptr->next) {
+ if (bptr->data_index)
+ break;
+ }
+
+ if (bptr)
+ break;
+ }
+ }
+ if (bptr) { /* set new index */
+ /*
+ * ag_trace ("Dbg: So (%d %d)", (int) hdr->index, (int) bptr->data_index);
+ */
+ name[vp->namelen] = hdr->ctrl_index;
+ name[vp->namelen + 1] = bptr->data_index;
+ *length = vp->namelen + 2;
+ } else
+ hdr = NULL;
+ }
+ }
+
+ if (hdr)
+ memcpy(entry_ptr, bptr, data_size);
+ return hdr;
+}
+
+void
+init_rows(void)
+{
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/rows.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/rows.h
new file mode 100644
index 0000000000..a099e6be67
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/rows.h
@@ -0,0 +1,26 @@
+/**************************************************************
+ * Copyright (C) 2001 Alex Rozin, Optical Access
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * ALEX ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#ifndef _rows_h_included__
+#define _rows_h_included__
+
+void init_rows(void);
+
+#endif /* _rows_h_included__ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/statistics.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/statistics.c
new file mode 100644
index 0000000000..687a43c79f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/statistics.c
@@ -0,0 +1,548 @@
+/**************************************************************
+ * Copyright (C) 2001 Tali Rozin, Optical Access
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * TALI ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB
+#include <stdlib.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "util_funcs.h"
+#include "statistics.h"
+ /*
+ * Implementation headers
+ */
+#include "agutil_api.h"
+#include "row_api.h"
+ /*
+ * File scope definitions section
+ */
+ /*
+ * from MIB compilation
+ */
+#define MIB_DESCR "EthStat"
+#define etherStatsEntryFirstIndexBegin 11
+#define IDetherStatsDroppedFrames 1
+#define IDetherStatsCreateTime 2
+#define IDetherStatsIndex 3
+#define IDetherStatsDataSource 4
+#define IDetherStatsDropEvents 5
+#define IDetherStatsOctets 6
+#define IDetherStatsPkts 7
+#define IDetherStatsBroadcastPkts 8
+#define IDetherStatsMulticastPkts 9
+#define IDetherStatsCRCAlignErrors 10
+#define IDetherStatsUndersizePkts 11
+#define IDetherStatsOversizePkts 12
+#define IDetherStatsFragments 13
+#define IDetherStatsJabbers 14
+#define IDetherStatsCollisions 15
+#define IDetherStatsPkts64Octets 16
+#define IDetherStatsPkts65to127Octets 17
+#define IDetherStatsPkts128to255Octets 18
+#define IDetherStatsPkts256to511Octets 19
+#define IDetherStatsPkts512to1023Octets 20
+#define IDetherStatsPkts1024to1518Octets 21
+#define IDetherStatsOwner 22
+#define IDetherStatsStatus 23
+#define Leaf_etherStatsDataSource 2
+#define Leaf_etherStatsOwner 20
+#define Leaf_etherStatsStatus 21
+#define MIN_etherStatsIndex 1
+#define MAX_etherStatsIndex 65535
+ typedef struct {
+ VAR_OID_T
+ data_source;
+ u_long
+ etherStatsCreateTime;
+ ETH_STATS_T
+ eth;
+ } CRTL_ENTRY_T;
+
+/*
+ * Main section
+ */
+
+ static TABLE_DEFINTION_T
+ StatCtrlTable;
+ static TABLE_DEFINTION_T *
+ table_ptr = &
+ StatCtrlTable;
+
+/*
+ * Control Table RowApi Callbacks
+ */
+
+ int
+ stat_Create(RMON_ENTRY_T * eptr)
+{ /* create the body: alloc it and set defaults */
+ CRTL_ENTRY_T *body;
+ static VAR_OID_T data_src_if_index_1 =
+ { 11, {1, 3, 6, 1, 2, 1, 2, 2, 1, 1, 1} };
+
+ eptr->body = AGMALLOC(sizeof(CRTL_ENTRY_T));
+ if (!eptr->body)
+ return -3;
+ body = (CRTL_ENTRY_T *) eptr->body;
+
+ /*
+ * set defaults
+ */
+ memcpy(&body->data_source, &data_src_if_index_1, sizeof(VAR_OID_T));
+ body->data_source.objid[body->data_source.length - 1] =
+ eptr->ctrl_index;
+ eptr->owner = AGSTRDUP("Startup Mgmt");
+ memset(&body->eth, 0, sizeof(ETH_STATS_T));
+
+ return 0;
+}
+
+int
+stat_Validate(RMON_ENTRY_T * eptr)
+{
+ /*
+ * T.B.D. (system dependent) check valid inteface in body->data_source;
+ */
+
+ return 0;
+}
+
+int
+stat_Activate(RMON_ENTRY_T * eptr)
+{
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) eptr->body;
+
+ body->etherStatsCreateTime = AGUTIL_sys_up_time();
+
+ return 0;
+}
+
+int
+stat_Copy(RMON_ENTRY_T * eptr)
+{
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) eptr->body;
+ CRTL_ENTRY_T *clone = (CRTL_ENTRY_T *) eptr->tmp;
+
+ if (snmp_oid_compare
+ (clone->data_source.objid, clone->data_source.length,
+ body->data_source.objid, body->data_source.length)) {
+ memcpy(&body->data_source, &clone->data_source, sizeof(VAR_OID_T));
+ }
+
+ return 0;
+}
+
+int
+stat_Deactivate(RMON_ENTRY_T * eptr)
+{
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) eptr->body;
+ memset(&body->eth, 0, sizeof(ETH_STATS_T));
+ return 0;
+}
+
+
+/***************************************************
+ * Function:var_etherStats2Entry
+ * Purpose: Handles the request for etherStats2Entry variable instances
+ ***************************************************/
+u_char *
+var_etherStats2Entry(struct variable * vp, oid * name, size_t * length,
+ int exact, size_t * var_len,
+ WriteMethod ** write_method)
+{
+ static long long_return;
+ static CRTL_ENTRY_T theEntry;
+ RMON_ENTRY_T *hdr;
+
+ *write_method = NULL;
+
+ hdr = ROWAPI_header_ControlEntry(vp, name, length, exact, var_len,
+ table_ptr,
+ &theEntry, sizeof(CRTL_ENTRY_T));
+ if (!hdr)
+ return NULL;
+
+ *var_len = sizeof(long); /* default */
+
+ switch (vp->magic) {
+ case IDetherStatsDroppedFrames:
+ long_return = 0;
+ return (u_char *) & long_return;
+ case IDetherStatsCreateTime:
+ long_return = theEntry.etherStatsCreateTime;
+ return (u_char *) & long_return;
+ default:
+ ag_trace("%s: unknown vp->magic=%d", table_ptr->name,
+ (int) vp->magic);
+ ERROR_MSG("");
+ }; /* of switch by 'vp->magic' */
+
+ return NULL;
+}
+
+
+/***************************************************
+ * Function:write_etherStatsEntry
+ ***************************************************/
+static int
+write_etherStatsEntry(int action, u_char * var_val, u_char var_val_type,
+ size_t var_val_len, u_char * statP,
+ oid * name, size_t name_len)
+{
+ long long_temp;
+ int leaf_id, snmp_status;
+ static int prev_action = COMMIT;
+ RMON_ENTRY_T *hdr;
+ CRTL_ENTRY_T *cloned_body;
+ CRTL_ENTRY_T *body;
+
+ switch (action) {
+ case RESERVE1:
+ case FREE:
+ case UNDO:
+ case ACTION:
+ case COMMIT:
+ default:
+ snmp_status =
+ ROWAPI_do_another_action(name, etherStatsEntryFirstIndexBegin,
+ action, &prev_action, table_ptr,
+ sizeof(CRTL_ENTRY_T));
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ ag_trace("failed action %d with %d", action, snmp_status);
+ }
+ break;
+
+ case RESERVE2:
+ /*
+ * get values from PDU, check them and save them in the cloned entry
+ */
+ long_temp = name[etherStatsEntryFirstIndexBegin];
+ leaf_id = (int) name[etherStatsEntryFirstIndexBegin - 1];
+ hdr = ROWAPI_find(table_ptr, long_temp); /* it MUST be OK */
+ cloned_body = (CRTL_ENTRY_T *) hdr->tmp;
+ body = (CRTL_ENTRY_T *) hdr->body;
+ switch (leaf_id) {
+ case Leaf_etherStatsDataSource:
+ snmp_status = AGUTIL_get_oid_value(var_val, var_val_type,
+ var_val_len,
+ &cloned_body->data_source);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+ if (RMON1_ENTRY_UNDER_CREATION != hdr->status &&
+ snmp_oid_compare(cloned_body->data_source.objid,
+ cloned_body->data_source.length,
+ body->data_source.objid,
+ body->data_source.length))
+ return SNMP_ERR_BADVALUE;
+ break;
+
+ break;
+ case Leaf_etherStatsOwner:
+ if (hdr->new_owner)
+ AGFREE(hdr->new_owner);
+ hdr->new_owner = AGMALLOC(MAX_OWNERSTRING);;
+ if (!hdr->new_owner)
+ return SNMP_ERR_TOOBIG;
+ snmp_status = AGUTIL_get_string_value(var_val, var_val_type,
+ var_val_len,
+ MAX_OWNERSTRING,
+ 1, NULL, hdr->new_owner);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ return snmp_status;
+ }
+ break;
+ case Leaf_etherStatsStatus:
+ snmp_status = AGUTIL_get_int_value(var_val, var_val_type,
+ var_val_len,
+ RMON1_ENTRY_VALID,
+ RMON1_ENTRY_INVALID,
+ &long_temp);
+ if (SNMP_ERR_NOERROR != snmp_status) {
+ ag_trace("cannot browse etherStatsStatus");
+ return snmp_status;
+ }
+ hdr->new_status = long_temp;
+ break;
+ break;
+ default:
+ ag_trace("%s:unknown leaf_id=%d\n", table_ptr->name,
+ (int) leaf_id);
+ return SNMP_ERR_NOSUCHNAME;
+ } /* of switch by 'leaf_id' */
+ break;
+ } /* of switch by 'action' */
+
+ prev_action = action;
+ return SNMP_ERR_NOERROR;
+}
+
+/***************************************************
+ * Function:var_etherStatsEntry
+ * Purpose: Handles the request for etherStatsEntry variable instances
+ ***************************************************/
+u_char *
+var_etherStatsEntry(struct variable * vp, oid * name, size_t * length,
+ int exact, size_t * var_len,
+ WriteMethod ** write_method)
+{
+ static long long_return;
+ static CRTL_ENTRY_T theEntry;
+ RMON_ENTRY_T *hdr;
+
+ *write_method = write_etherStatsEntry;
+ hdr = ROWAPI_header_ControlEntry(vp, name, length, exact, var_len,
+ table_ptr,
+ &theEntry, sizeof(CRTL_ENTRY_T));
+ if (!hdr)
+ return NULL;
+
+ if (RMON1_ENTRY_VALID == hdr->status)
+ SYSTEM_get_eth_statistics(&theEntry.data_source, &theEntry.eth);
+
+ *var_len = sizeof(long);
+
+ switch (vp->magic) {
+ case IDetherStatsIndex:
+ long_return = hdr->ctrl_index;
+ return (u_char *) & long_return;
+ case IDetherStatsDataSource:
+ *var_len = sizeof(oid) * theEntry.data_source.length;
+ return (unsigned char *) theEntry.data_source.objid;
+ case IDetherStatsDropEvents:
+ long_return = 0; /* theEntry.eth.etherStatsDropEvents; */
+ return (u_char *) & long_return;
+ case IDetherStatsOctets:
+ long_return = theEntry.eth.octets;
+ return (u_char *) & long_return;
+ case IDetherStatsPkts:
+ long_return = theEntry.eth.packets;
+ return (u_char *) & long_return;
+ case IDetherStatsBroadcastPkts:
+ long_return = theEntry.eth.bcast_pkts;
+ return (u_char *) & long_return;
+ case IDetherStatsMulticastPkts:
+ long_return = theEntry.eth.mcast_pkts;
+ return (u_char *) & long_return;
+ case IDetherStatsCRCAlignErrors:
+ long_return = theEntry.eth.crc_align;
+ return (u_char *) & long_return;
+ case IDetherStatsUndersizePkts:
+ long_return = theEntry.eth.undersize;
+ return (u_char *) & long_return;
+ case IDetherStatsOversizePkts:
+ long_return = theEntry.eth.oversize;
+ return (u_char *) & long_return;
+ case IDetherStatsFragments:
+ long_return = theEntry.eth.fragments;
+ return (u_char *) & long_return;
+ case IDetherStatsJabbers:
+ long_return = theEntry.eth.jabbers;
+ return (u_char *) & long_return;
+ case IDetherStatsCollisions:
+ long_return = theEntry.eth.collisions;
+ return (u_char *) & long_return;
+ case IDetherStatsPkts64Octets:
+ long_return = theEntry.eth.pkts_64;
+ return (u_char *) & long_return;
+ case IDetherStatsPkts65to127Octets:
+ long_return = theEntry.eth.pkts_65_127;
+ return (u_char *) & long_return;
+ case IDetherStatsPkts128to255Octets:
+ long_return = theEntry.eth.pkts_128_255;
+ return (u_char *) & long_return;
+ case IDetherStatsPkts256to511Octets:
+ long_return = theEntry.eth.pkts_256_511;
+ return (u_char *) & long_return;
+ case IDetherStatsPkts512to1023Octets:
+ long_return = theEntry.eth.pkts_512_1023;
+ return (u_char *) & long_return;
+ case IDetherStatsPkts1024to1518Octets:
+ long_return = theEntry.eth.pkts_1024_1518;
+ return (u_char *) & long_return;
+ case IDetherStatsOwner:
+ if (hdr->owner) {
+ *var_len = strlen(hdr->owner);
+ return (unsigned char *) hdr->owner;
+ } else {
+ *var_len = 0;
+ return (unsigned char *) "";
+ }
+ case IDetherStatsStatus:
+ long_return = hdr->status;
+ return (u_char *) & long_return;
+ default:
+ ERROR_MSG("");
+ }; /* of switch by 'vp->magic' */
+
+ return NULL;
+}
+
+#if 1 /* debug, but may be used for init. TBD: may be token snmpd.conf ? */
+int
+add_statistics_entry(int ctrl_index, int ifIndex)
+{
+ int ierr;
+
+ ierr = ROWAPI_new(table_ptr, ctrl_index);
+ switch (ierr) {
+ case -1:
+ ag_trace("max. number exedes\n");
+ break;
+ case -2:
+ ag_trace("malloc failed");
+ break;
+ case -3:
+ ag_trace("ClbkCreate failed");
+ break;
+ case 0:
+ break;
+ default:
+ ag_trace("Unknown code %d", ierr);
+ break;
+ }
+
+ if (!ierr) {
+ register RMON_ENTRY_T *eptr = ROWAPI_find(table_ptr, ctrl_index);
+ if (!eptr) {
+ ag_trace("cannot find it");
+ ierr = -4;
+ } else {
+ CRTL_ENTRY_T *body = (CRTL_ENTRY_T *) eptr->body;
+
+ body->data_source.objid[body->data_source.length - 1] =
+ ifIndex;
+
+ eptr->new_status = RMON1_ENTRY_VALID;
+ ierr = ROWAPI_commit(table_ptr, ctrl_index);
+ if (ierr) {
+ ag_trace("ROWAPI_commit returned %d", ierr);
+ }
+ }
+ }
+
+ return ierr;
+}
+#endif
+
+/***************************************************
+ * define Variables callbacks
+ ***************************************************/
+oid oidstatisticsVariablesOid[] = { 1, 3, 6, 1, 2, 1, 16, 1 };
+
+struct variable7 oidstatisticsVariables[] = {
+ {IDetherStatsIndex, ASN_INTEGER, RONLY, var_etherStatsEntry, 3,
+ {1, 1, 1}},
+ {IDetherStatsDataSource, ASN_OBJECT_ID, RWRITE, var_etherStatsEntry, 3,
+ {1, 1, 2}},
+ {IDetherStatsDropEvents, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+ {1, 1, 3}},
+ {IDetherStatsOctets, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+ {1, 1, 4}},
+ {IDetherStatsPkts, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+ {1, 1, 5}},
+ {IDetherStatsBroadcastPkts, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+ {1, 1, 6}},
+ {IDetherStatsMulticastPkts, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+ {1, 1, 7}},
+ {IDetherStatsCRCAlignErrors, ASN_COUNTER, RONLY, var_etherStatsEntry,
+ 3, {1, 1, 8}},
+ {IDetherStatsUndersizePkts, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+ {1, 1, 9}},
+ {IDetherStatsOversizePkts, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+ {1, 1, 10}},
+ {IDetherStatsFragments, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+ {1, 1, 11}},
+ {IDetherStatsJabbers, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+ {1, 1, 12}},
+ {IDetherStatsCollisions, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+ {1, 1, 13}},
+ {IDetherStatsPkts64Octets, ASN_COUNTER, RONLY, var_etherStatsEntry, 3,
+ {1, 1, 14}},
+ {IDetherStatsPkts65to127Octets, ASN_COUNTER, RONLY,
+ var_etherStatsEntry, 3, {1, 1, 15}},
+ {IDetherStatsPkts128to255Octets, ASN_COUNTER, RONLY,
+ var_etherStatsEntry, 3, {1, 1, 16}},
+ {IDetherStatsPkts256to511Octets, ASN_COUNTER, RONLY,
+ var_etherStatsEntry, 3, {1, 1, 17}},
+ {IDetherStatsPkts512to1023Octets, ASN_COUNTER, RONLY,
+ var_etherStatsEntry, 3, {1, 1, 18}},
+ {IDetherStatsPkts1024to1518Octets, ASN_COUNTER, RONLY,
+ var_etherStatsEntry, 3, {1, 1, 19}},
+ {IDetherStatsOwner, ASN_OCTET_STR, RWRITE, var_etherStatsEntry, 3,
+ {1, 1, 20}},
+ {IDetherStatsStatus, ASN_INTEGER, RWRITE, var_etherStatsEntry, 3,
+ {1, 1, 21}},
+ {IDetherStatsDroppedFrames, ASN_COUNTER, RONLY, var_etherStats2Entry,
+ 3, {4, 1, 1}},
+ {IDetherStatsCreateTime, ASN_TIMETICKS, RONLY, var_etherStats2Entry, 3,
+ {4, 1, 2}},
+};
+
+/***************************************************
+ * Function:init_statistics
+ * Purpose: register statistics objects in the agent
+ ***************************************************/
+void
+init_statistics(void)
+{
+ REGISTER_MIB(MIB_DESCR, oidstatisticsVariables, variable7,
+ oidstatisticsVariablesOid);
+
+ ROWAPI_init_table(&StatCtrlTable, MIB_DESCR, 0, &stat_Create, NULL, /* &stat_Clone, */
+ NULL, /* &stat_Delete, */
+ &stat_Validate,
+ &stat_Activate, &stat_Deactivate, &stat_Copy);
+
+#if 0 /* debug */
+ {
+ int iii;
+ for (iii = 1; iii < 6; iii++) {
+ add_statistics_entry(iii, iii);
+ }
+
+ add_statistics_entry(10, 16);
+ add_statistics_entry(12, 11);
+ }
+#endif
+}
+
+/*
+ * end of file statistics.c
+ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/statistics.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/statistics.h
new file mode 100644
index 0000000000..8c6d91db64
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/statistics.h
@@ -0,0 +1,31 @@
+/**************************************************************
+ * Copyright (C) 2001 Tali Rozin, Optical Access
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * TALI ROZIN DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * ALEX ROZIN BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ ******************************************************************/
+
+#ifndef _statistics_h_included__
+#define _statistics_h_included__
+
+config_require(util_funcs)
+ void init_statistics(void);
+
+#endif /* _statistics_h_included__ */
+
+/*
+ * end of file statistics.h
+ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/test_alarm.sh b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/test_alarm.sh
new file mode 100755
index 0000000000..b6046c7e5d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/test_alarm.sh
@@ -0,0 +1,82 @@
+:
+
+# Rmon Alarms/Events testing script
+# $Log$
+# Revision 5.0 2002/04/20 07:30:01 hardaker
+# cvs file version number change
+#
+# Revision 1.1 2001/05/09 19:36:13 slif
+# Include Alex Rozin's Rmon.
+#
+#
+
+#Only parameter: number of interface (ifIndex) to be tested.
+#Default: 1
+
+TSTIF=1
+COMPAR="-m ALL localhost public"
+
+if [ "X"${1} = "X" ] ; then
+ echo got default parameter : $TSTIF
+else
+ TSTIF=$1
+fi
+
+#testing parameters:
+ETHIND=3
+EVNIND=7
+ALRIND=2
+LOWLIMIT=4800
+HILIMIT =4900
+INTERVAL=3
+WAITTIME=17
+
+echo interface ifIndex.$TSTIF will be tested
+
+echo " "
+echo 1. Create etherStatsEntry
+snmpset $COMPAR \
+ etherStatsStatus.$ETHIND i 2 \
+ etherStatsDataSource.$ETHIND o interfaces.ifTable.ifEntry.ifIndex.$TSTIF
+snmpset $COMPAR etherStatsStatus.$ETHIND i 1
+snmpwalk $COMPAR statistics
+
+echo 2. Create event control entry
+snmpset $COMPAR \
+ eventStatus.$EVNIND i 1 \
+ eventDescription.$EVNIND s "Alarms" \
+ eventType.$EVNIND i 4 \
+ eventOwner.$EVNIND s "Alex"
+#snmpwalk $COMPAR eventTable
+
+echo 3. Create alarm entry
+snmpset $COMPAR \
+ alarmStatus.$ALRIND i 1 \
+ alarmInterval.$ALRIND i $INTERVAL \
+ alarmVariable.$ALRIND o rmon.statistics.etherStatsTable.etherStatsEntry.etherStatsPkts.$ETHIND \
+ alarmSampleType.$ALRIND i 2 \
+ alarmFallingThreshold.$ALRIND i $LOWLIMIT \
+ alarmRisingThreshold.$ALRIND i $HILIMIT \
+ alarmRisingEventIndex.$ALRIND i $EVNIND \
+ alarmFallingEventIndex.$ALRIND i $EVNIND
+snmpwalk $COMPAR alarm
+
+echo 4. Sleep $WAITTIME to collect log.
+echo This $WAITTIME seconds you may enjoy with Rmon traps.
+sleep $WAITTIME
+
+echo 5. Check log:
+snmpwalk $COMPAR logTable
+snmptable $COMPAR logTable
+snmpwalk $COMPAR eventTable
+
+echo 6. clean everything
+snmpset $COMPAR alarmStatus.$ALRIND i 4
+snmpset $COMPAR eventStatus.$EVNIND i 4
+snmpset $COMPAR etherStatsStatus.$ETHIND i 4
+snmpwalk $COMPAR rmon
+
+echo " "
+echo "Goodbye, I'm a gonner"
+echo " "
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/test_hist.sh b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/test_hist.sh
new file mode 100755
index 0000000000..52bdd884c4
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/Rmon/test_hist.sh
@@ -0,0 +1,88 @@
+:
+# Rmon History testing script
+# $Log$
+# Revision 5.0 2002/04/20 07:30:01 hardaker
+# cvs file version number change
+#
+# Revision 1.1 2001/05/09 19:36:13 slif
+# Include Alex Rozin's Rmon.
+#
+#
+
+#Only parameter: number of interface (ifIndex) to be tested.
+#Default: 1
+
+TSTIF=1
+COMPAR="-m ALL localhost public"
+
+if [ "X"${1} = "X" ] ; then
+ echo got default parameter : $TSTIF
+else
+ TSTIF=$1
+fi
+
+echo interface ifIndex.$TSTIF will be tested
+
+echo " "
+echo 1. create control entry
+snmpset $COMPAR historyControlBucketsRequested.4 i 4 historyControlInterval.4 i 3 \
+historyControlDataSource.4 o interfaces.ifTable.ifEntry.ifIndex.$TSTIF \
+historyControlStatus.4 i 2
+
+snmpwalk $COMPAR historyControlTable
+echo " "
+echo 2. validate it
+snmpset $COMPAR historyControlStatus.4 i 1
+snmpwalk $COMPAR historyControlTable
+echo "Sleep 3, take it chance to get something"
+sleep 3
+snmpwalk $COMPAR etherHistoryTable
+echo "Sleep 6, take it chance to advance"
+sleep 6
+snmpwalk $COMPAR etherHistoryTable
+
+
+echo " "
+echo 3. change requested number of buckets
+snmpset $COMPAR historyControlBucketsRequested.4 i 2
+echo "Sleep 9, take it chance to get something"
+sleep 9
+snmpwalk $COMPAR etherHistoryTable
+
+echo " "
+echo 4. invalidate it
+snmpset $COMPAR historyControlStatus.4 i 4
+snmpwalk $COMPAR history
+
+
+echo " "
+echo 5. create and validate 2 control entries
+snmpset $COMPAR historyControlBucketsRequested.4 i 3 historyControlInterval.4 i 2 \
+historyControlDataSource.4 o interfaces.ifTable.ifEntry.ifIndex.$TSTIF \
+historyControlStatus.4 i 1
+snmpset $COMPAR historyControlBucketsRequested.2 i 2 historyControlInterval.2 i 4 \
+historyControlStatus.2 i 1
+snmptable $COMPAR historyControlTable
+echo "Sleep 12, take them chance to get something"
+sleep 12
+snmpwalk $COMPAR etherHistoryTable
+
+echo " "
+echo 6. create entry and let it to be aged
+snmpset $COMPAR historyControlStatus.3 i 2
+snmptable $COMPAR historyControlTable
+echo "Sleep 61, take it chance to be aged"
+sleep 61
+snmptable $COMPAR historyControlTable
+
+echo " "
+echo 7. clean everything
+snmpset $COMPAR historyControlStatus.2 i 4
+snmpset $COMPAR historyControlStatus.4 i 4
+snmpwalk $COMPAR history
+
+
+echo " "
+echo "Goodbye, I'm a gonner"
+echo " "
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/extend.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/extend.c
new file mode 100644
index 0000000000..9ec43baafc
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/extend.c
@@ -0,0 +1,1433 @@
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/watcher.h>
+#include <net-snmp/agent/agent_callbacks.h>
+
+#include "agent/extend.h"
+#include "utilities/execute.h"
+#include "struct.h"
+
+#ifndef USING_UCD_SNMP_EXTENSIBLE_MODULE
+#include "util_funcs.h"
+#include "mibdefs.h"
+#define SHELLCOMMAND 3
+#endif
+
+oid ns_extend_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 1, 3, 2 };
+oid extend_count_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 1, 3, 2, 1 };
+oid extend_config_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 1, 3, 2, 2 };
+oid extend_out1_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 1, 3, 2, 3 };
+oid extend_out2_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 1, 3, 2, 4 };
+
+typedef struct extend_registration_block_s {
+ netsnmp_table_data *dinfo;
+ oid *root_oid;
+ size_t oid_len;
+ long num_entries;
+ netsnmp_extend *ehead;
+ netsnmp_handler_registration *reg[3];
+ struct extend_registration_block_s *next;
+} extend_registration_block;
+extend_registration_block *ereg_head = NULL;
+
+
+#ifndef USING_UCD_SNMP_EXTENSIBLE_MODULE
+typedef struct netsnmp_old_extend_s {
+ int idx;
+ netsnmp_extend *exec_entry;
+ netsnmp_extend *efix_entry;
+} netsnmp_old_extend;
+
+int num_compatability_entries = 0;
+int max_compatability_entries = 50;
+netsnmp_old_extend *compatability_entries;
+
+WriteMethod fixExec2Error;
+FindVarMethod var_extensible_old;
+oid old_extensible_variables_oid[] = { NETSNMP_UCDAVIS_MIB, NETSNMP_SHELLMIBNUM, 1 };
+struct variable2 old_extensible_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_old, 1, {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_old, 1, {ERRORNAME}},
+ {SHELLCOMMAND, ASN_OCTET_STR, RONLY, var_extensible_old, 1, {SHELLCOMMAND}},
+ {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_old, 1, {ERRORFLAG}},
+ {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_old, 1, {ERRORMSG}},
+ {ERRORFIX, ASN_INTEGER, RWRITE, var_extensible_old, 1, {ERRORFIX}},
+ {ERRORFIXCMD, ASN_OCTET_STR, RONLY, var_extensible_old, 1, {ERRORFIXCMD}}
+};
+#endif
+
+
+ /*************************
+ *
+ * Main initialisation routine
+ *
+ *************************/
+
+extend_registration_block *
+_find_extension_block( oid *name, size_t name_len )
+{
+ extend_registration_block *eptr;
+ size_t len;
+ for ( eptr=ereg_head; eptr; eptr=eptr->next ) {
+ len = SNMP_MIN(name_len, eptr->oid_len);
+ if (!snmp_oid_compare( name, len, eptr->root_oid, eptr->oid_len))
+ return eptr;
+ }
+ return NULL;
+}
+
+extend_registration_block *
+_register_extend( oid *base, size_t len )
+{
+ extend_registration_block *eptr;
+ oid oid_buf[MAX_OID_LEN];
+
+ netsnmp_table_data *dinfo;
+ netsnmp_table_registration_info *tinfo;
+ netsnmp_watcher_info *winfo;
+ netsnmp_handler_registration *reg;
+
+ for ( eptr=ereg_head; eptr; eptr=eptr->next ) {
+ if (!snmp_oid_compare( base, len, eptr->root_oid, eptr->oid_len))
+ return eptr;
+ }
+ if (!eptr) {
+ eptr = SNMP_MALLOC_TYPEDEF( extend_registration_block );
+ eptr->root_oid = snmp_duplicate_objid( base, len );
+ eptr->oid_len = len;
+ eptr->num_entries = 0;
+ eptr->ehead = NULL;
+ eptr->dinfo = netsnmp_create_table_data( "nsExtendTable" );
+ eptr->next = ereg_head;
+ ereg_head = eptr;
+ }
+
+ dinfo = eptr->dinfo;
+ memcpy( oid_buf, base, len*sizeof(oid) );
+
+ /*
+ * Register the configuration table
+ */
+ tinfo = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
+ netsnmp_table_helper_add_indexes( tinfo, ASN_OCTET_STR, 0 );
+ tinfo->min_column = COLUMN_EXTCFG_FIRST_COLUMN;
+ tinfo->max_column = COLUMN_EXTCFG_LAST_COLUMN;
+ oid_buf[len] = 2;
+ reg = netsnmp_create_handler_registration(
+ "nsExtendConfigTable", handle_nsExtendConfigTable,
+ oid_buf, len+1, HANDLER_CAN_RWRITE);
+ netsnmp_register_table_data( reg, dinfo, tinfo );
+ eptr->reg[0] = reg;
+
+ /*
+ * Register the main output table
+ * using the same table_data handle.
+ * This is sufficient to link the two tables,
+ * and implement the AUGMENTS behaviour
+ */
+ tinfo = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
+ netsnmp_table_helper_add_indexes( tinfo, ASN_OCTET_STR, 0 );
+ tinfo->min_column = COLUMN_EXTOUT1_FIRST_COLUMN;
+ tinfo->max_column = COLUMN_EXTOUT1_LAST_COLUMN;
+ oid_buf[len] = 3;
+ reg = netsnmp_create_handler_registration(
+ "nsExtendOut1Table", handle_nsExtendOutput1Table,
+ oid_buf, len+1, HANDLER_CAN_RONLY);
+ netsnmp_register_table_data( reg, dinfo, tinfo );
+ eptr->reg[1] = reg;
+
+ /*
+ * Register the multi-line output table
+ * using a simple table helper.
+ * This handles extracting the indexes from
+ * the request OID, but leaves most of
+ * the work to our handler routine.
+ * Still, it was nice while it lasted...
+ */
+ tinfo = SNMP_MALLOC_TYPEDEF( netsnmp_table_registration_info );
+ netsnmp_table_helper_add_indexes( tinfo, ASN_OCTET_STR, ASN_INTEGER, 0 );
+ tinfo->min_column = COLUMN_EXTOUT2_FIRST_COLUMN;
+ tinfo->max_column = COLUMN_EXTOUT2_LAST_COLUMN;
+ oid_buf[len] = 4;
+ reg = netsnmp_create_handler_registration(
+ "nsExtendOut2Table", handle_nsExtendOutput2Table,
+ oid_buf, len+1, HANDLER_CAN_RONLY);
+ netsnmp_register_table( reg, tinfo );
+ eptr->reg[2] = reg;
+
+ /*
+ * Register a watched scalar to keep track of the number of entries
+ */
+ oid_buf[len] = 1;
+ reg = netsnmp_create_handler_registration(
+ "nsExtendNumEntries", NULL,
+ oid_buf, len+1, HANDLER_CAN_RONLY);
+ winfo = netsnmp_create_watcher_info(
+ &(eptr->num_entries), sizeof(eptr->num_entries),
+ ASN_INTEGER, WATCHER_FIXED_SIZE);
+ netsnmp_register_watched_scalar( reg, winfo );
+
+ return eptr;
+}
+
+int
+extend_clear_callback(int majorID, int minorID,
+ void *serverarg, void *clientarg)
+{
+ extend_registration_block *eptr, *enext = NULL;
+
+ for ( eptr=ereg_head; eptr; eptr=enext ) {
+ enext=eptr->next;
+ netsnmp_unregister_handler( eptr->reg[0] );
+ netsnmp_unregister_handler( eptr->reg[1] );
+ netsnmp_unregister_handler( eptr->reg[2] );
+ SNMP_FREE(eptr);
+ }
+ ereg_head = NULL;
+ return 0;
+}
+
+void init_extend( void )
+{
+ snmpd_register_config_handler("extend", extend_parse_config, NULL, NULL);
+ snmpd_register_config_handler("extend-sh", extend_parse_config, NULL, NULL);
+ snmpd_register_config_handler("extendfix", extend_parse_config, NULL, NULL);
+ snmpd_register_config_handler("exec2", extend_parse_config, NULL, NULL);
+ snmpd_register_config_handler("sh2", extend_parse_config, NULL, NULL);
+ snmpd_register_config_handler("execFix2", extend_parse_config, NULL, NULL);
+ (void)_register_extend( ns_extend_oid, OID_LENGTH(ns_extend_oid));
+
+#ifndef USING_UCD_SNMP_EXTENSIBLE_MODULE
+ snmpd_register_config_handler("exec", extend_parse_config, NULL, NULL);
+ snmpd_register_config_handler("sh", extend_parse_config, NULL, NULL);
+ snmpd_register_config_handler("execFix", extend_parse_config, NULL, NULL);
+ compatability_entries = calloc( max_compatability_entries,
+ sizeof(netsnmp_old_extend));
+ REGISTER_MIB("ucd-extensible", old_extensible_variables,
+ variable2, old_extensible_variables_oid);
+#endif
+
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_PRE_UPDATE_CONFIG,
+ extend_clear_callback, NULL);
+}
+
+ /*************************
+ *
+ * Cached-data hooks
+ * see 'cache_handler' helper
+ *
+ *************************/
+
+int
+extend_load_cache(netsnmp_cache *cache, void *magic)
+{
+ int out_len = 1024*100;
+ char out_buf[ 1024*100 ];
+ int cmd_len = 255*2 + 2; /* 2 * DisplayStrings */
+ char cmd_buf[ 255*2 + 2 ];
+ int ret;
+ char *cp;
+ char *line_buf[ 1024 ];
+ netsnmp_extend *extension = (netsnmp_extend *)magic;
+
+ if (!magic)
+ return -1;
+ DEBUGMSGTL(( "nsExtendTable:cache", "load %s", extension->token ));
+ if ( extension->args )
+ snprintf( cmd_buf, cmd_len, "%s %s", extension->command, extension->args );
+ else
+ snprintf( cmd_buf, cmd_len, "%s", extension->command );
+ if ( extension->flags & NS_EXTEND_FLAGS_SHELL )
+ ret = run_shell_command( cmd_buf, extension->input, out_buf, &out_len);
+ else
+ ret = run_exec_command( cmd_buf, extension->input, out_buf, &out_len);
+ DEBUGMSG(( "nsExtendTable:cache", ": %s : %d\n", cmd_buf, ret));
+ if (ret >= 0) {
+ if (out_buf[ out_len-1 ] == '\n')
+ out_buf[ --out_len ] = '\0'; /* Stomp on trailing newline */
+ extension->output = strdup( out_buf );
+ extension->out_len = out_len;
+ /*
+ * Now we need to pick the output apart into separate lines.
+ * Start by counting how many lines we've got, and keeping
+ * track of where each line starts in a static buffer
+ */
+ extension->numlines = 1;
+ line_buf[ 0 ] = extension->output;
+ for (cp=extension->output; *cp; cp++) {
+ if (*cp == '\n') {
+ line_buf[ extension->numlines++ ] = cp+1;
+ }
+ }
+ if ( extension->numlines > 1 ) {
+ extension->lines = calloc( sizeof(char *), extension->numlines );
+ memcpy( extension->lines, line_buf,
+ sizeof(char *) * extension->numlines );
+ } else {
+ extension->lines = &extension->output;
+ }
+ }
+ extension->result = ret;
+ return ret;
+}
+
+void
+extend_free_cache(netsnmp_cache *cache, void *magic)
+{
+ netsnmp_extend *extension = (netsnmp_extend *)magic;
+ if (!magic)
+ return;
+
+ DEBUGMSGTL(( "nsExtendTable:cache", "free %s\n", extension->token ));
+ if (extension->output) {
+ SNMP_FREE(extension->output);
+ extension->output = NULL;
+ }
+ if ( extension->numlines > 1 ) {
+ SNMP_FREE(extension->lines);
+ }
+ extension->lines = NULL;
+ extension->out_len = 0;
+ extension->numlines = 0;
+}
+
+
+ /*************************
+ *
+ * Utility routines for setting up a new entry
+ * (either via SET requests, or the config file)
+ *
+ *************************/
+
+void
+_free_extension( netsnmp_extend *extension, extend_registration_block *ereg )
+{
+ netsnmp_extend *eptr = NULL;
+ netsnmp_extend *eprev = NULL;
+
+ if (!extension)
+ return;
+
+ if (ereg) {
+ /* Unlink from 'ehead' list */
+ for (eptr=ereg->ehead; eptr; eptr=eptr->next) {
+ if (eptr == extension)
+ break;
+ eprev = eptr;
+ }
+ if (!eptr) {
+ snmp_log(LOG_ERR,
+ "extend: fell off end of list before finding extension\n");
+ return;
+ }
+ if (eprev)
+ eprev->next = eptr->next;
+ else
+ ereg->ehead = eptr->next;
+ }
+
+ netsnmp_table_data_remove_and_delete_row( ereg->dinfo, extension->row);
+ SNMP_FREE( extension->token );
+ SNMP_FREE( extension->cache );
+ SNMP_FREE( extension->command );
+ SNMP_FREE( extension->args );
+ SNMP_FREE( extension->input );
+ SNMP_FREE( extension );
+ return;
+}
+
+netsnmp_extend *
+_new_extension( char *exec_name, int exec_flags, extend_registration_block *ereg )
+{
+ netsnmp_extend *extension;
+ netsnmp_table_row *row;
+ netsnmp_extend *eptr1, *eptr2;
+ netsnmp_table_data *dinfo = ereg->dinfo;
+
+ if (!exec_name)
+ return NULL;
+ extension = SNMP_MALLOC_TYPEDEF( netsnmp_extend );
+ if (!extension)
+ return NULL;
+ extension->token = strdup( exec_name );
+ extension->flags = exec_flags;
+ extension->cache = netsnmp_cache_create( 0, extend_load_cache,
+ extend_free_cache, NULL, 0 );
+ if (extension->cache)
+ extension->cache->magic = extension;
+
+ row = netsnmp_create_table_data_row();
+ if (!row || !extension->cache) {
+ _free_extension( extension, ereg );
+ SNMP_FREE( row );
+ return NULL;
+ }
+ row->data = (void *)extension;
+ extension->row = row;
+ netsnmp_table_row_add_index( row, ASN_OCTET_STR,
+ exec_name, strlen(exec_name));
+ if ( netsnmp_table_data_add_row( dinfo, row) != SNMPERR_SUCCESS ) {
+ /* _free_extension( extension, ereg ); */
+ SNMP_FREE( extension ); /* Probably not sufficient */
+ SNMP_FREE( row );
+ return NULL;
+ }
+
+ ereg->num_entries++;
+ /*
+ * Now add this structure to a private linked list.
+ * We don't need this for the main tables - the
+ * 'table_data' helper will take care of those.
+ * But it's probably easier to handle the multi-line
+ * output table ourselves, for which we need access
+ * to the underlying data.
+ * So we'll keep a list internally as well.
+ */
+ for ( eptr1 = ereg->ehead, eptr2 = NULL;
+ eptr1;
+ eptr2 = eptr1, eptr1 = eptr1->next ) {
+
+ if (strlen( eptr1->token ) > strlen( exec_name ))
+ break;
+ if (strlen( eptr1->token ) == strlen( exec_name ) &&
+ strcmp( eptr1->token, exec_name ) > 0 )
+ break;
+ }
+ if ( eptr2 )
+ eptr2->next = extension;
+ else
+ ereg->ehead = extension;
+ extension->next = eptr1;
+ return extension;
+}
+
+void
+extend_parse_config(const char *token, char *cptr)
+{
+ netsnmp_extend *extension;
+ char exec_name[STRMAX];
+ char exec_command[STRMAX];
+ oid oid_buf[MAX_OID_LEN];
+ size_t oid_len;
+ extend_registration_block *eptr;
+ int flags;
+
+ cptr = copy_nword(cptr, exec_name, sizeof(exec_name));
+ if ( *exec_name == '.' ) {
+ oid_len = MAX_OID_LEN - 2;
+ if (0 == read_objid( exec_name, oid_buf, &oid_len )) {
+ config_perror("ERROR: Unrecognised OID" );
+ return;
+ }
+ cptr = copy_nword(cptr, exec_name, sizeof(exec_name));
+ if (!strcmp( token, "sh" ) ||
+ !strcmp( token, "exec" )) {
+ config_perror("ERROR: This output format has been deprecated - Please use the 'extend' directive instead" );
+ return;
+ }
+ } else {
+ memcpy( oid_buf, ns_extend_oid, sizeof(ns_extend_oid));
+ oid_len = OID_LENGTH(ns_extend_oid);
+ }
+ cptr = copy_nword(cptr, exec_command, sizeof(exec_command));
+ /* XXX - check 'exec_command' exists & is executable */
+ flags = (NS_EXTEND_FLAGS_ACTIVE | NS_EXTEND_FLAGS_CONFIG);
+ if (!strcmp( token, "sh" ) ||
+ !strcmp( token, "extend-sh" ) ||
+ !strcmp( token, "sh2" ))
+ flags |= NS_EXTEND_FLAGS_SHELL;
+ if (!strcmp( token, "execFix" ) ||
+ !strcmp( token, "extendfix" ) ||
+ !strcmp( token, "execFix2" )) {
+ strcat( exec_name, "Fix" );
+ flags |= NS_EXTEND_FLAGS_WRITEABLE;
+ /* XXX - Check for shell... */
+ }
+
+ eptr = _register_extend( oid_buf, oid_len );
+ extension = _new_extension( exec_name, flags, eptr );
+ if (extension) {
+ extension->command = strdup( exec_command );
+ if (cptr)
+ extension->args = strdup( cptr );
+ } else {
+ snmp_log(LOG_ERR, "Failed to register extend entry '%s' - possibly duplicate name.\n", exec_name );
+ return;
+ }
+
+#ifndef USING_UCD_SNMP_EXTENSIBLE_MODULE
+ /*
+ * Compatability with the UCD extTable
+ */
+ if (!strcmp( token, "execFix" )) {
+ int i;
+ for ( i=0; i < num_compatability_entries; i++ ) {
+ if (!strcmp( exec_name,
+ compatability_entries[i].exec_entry->token))
+ break;
+ }
+ if ( i == num_compatability_entries )
+ config_perror("No matching exec entry" );
+ else
+ compatability_entries[ i ].efix_entry = extension;
+
+ } else if (!strcmp( token, "sh" ) ||
+ !strcmp( token, "exec" )) {
+ if ( num_compatability_entries == max_compatability_entries )
+ /* XXX - should really use dynamic allocation */
+ config_perror("No further UCD-compatible entries" );
+ else
+ compatability_entries[
+ num_compatability_entries++ ].exec_entry = extension;
+ }
+#endif
+}
+
+ /*************************
+ *
+ * Main table handlers
+ * Most of the work is handled
+ * by the 'table_data' helper.
+ *
+ *************************/
+
+int
+handle_nsExtendConfigTable(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ netsnmp_extend *extension;
+ extend_registration_block *eptr;
+ int i;
+ int need_to_validate = 0;
+
+ for ( request=requests; request; request=request->next ) {
+ if (request->processed)
+ continue;
+ table_info = netsnmp_extract_table_info( request );
+ extension = (netsnmp_extend*)netsnmp_extract_table_row_data( request );
+
+ DEBUGMSGTL(( "nsExtendTable:config", "varbind: "));
+ DEBUGMSGOID(("nsExtendTable:config", request->requestvb->name,
+ request->requestvb->name_length));
+ DEBUGMSG(( "nsExtendTable:config", " (%s)\n",
+ se_find_label_in_slist("agent_mode", reqinfo->mode)));
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ switch (table_info->colnum) {
+ case COLUMN_EXTCFG_COMMAND:
+ snmp_set_var_typed_value(
+ request->requestvb, ASN_OCTET_STR,
+ extension->command,
+ (extension->command)?strlen(extension->command):0);
+ break;
+ case COLUMN_EXTCFG_ARGS:
+ snmp_set_var_typed_value(
+ request->requestvb, ASN_OCTET_STR,
+ extension->args,
+ (extension->args)?strlen(extension->args):0);
+ break;
+ case COLUMN_EXTCFG_INPUT:
+ snmp_set_var_typed_value(
+ request->requestvb, ASN_OCTET_STR,
+ extension->input,
+ (extension->input)?strlen(extension->input):0);
+ break;
+ case COLUMN_EXTCFG_CACHETIME:
+ snmp_set_var_typed_value(
+ request->requestvb, ASN_INTEGER,
+ (u_char*)&extension->cache->timeout, sizeof(int));
+ break;
+ case COLUMN_EXTCFG_EXECTYPE:
+ i = ((extension->flags & NS_EXTEND_FLAGS_SHELL) ?
+ NS_EXTEND_ETYPE_SHELL :
+ NS_EXTEND_ETYPE_EXEC);
+ snmp_set_var_typed_value(
+ request->requestvb, ASN_INTEGER,
+ (u_char*)&i, sizeof(i));
+ break;
+ case COLUMN_EXTCFG_RUNTYPE:
+ i = ((extension->flags & NS_EXTEND_FLAGS_WRITEABLE) ?
+ NS_EXTEND_RTYPE_RWRITE :
+ NS_EXTEND_RTYPE_RONLY);
+ snmp_set_var_typed_value(
+ request->requestvb, ASN_INTEGER,
+ (u_char*)&i, sizeof(i));
+ break;
+
+ case COLUMN_EXTCFG_STORAGE:
+ i = ((extension->flags & NS_EXTEND_FLAGS_CONFIG) ?
+ ST_PERMANENT : ST_VOLATILE);
+ snmp_set_var_typed_value(
+ request->requestvb, ASN_INTEGER,
+ (u_char*)&i, sizeof(i));
+ break;
+ case COLUMN_EXTCFG_STATUS:
+ i = ((extension->flags & NS_EXTEND_FLAGS_ACTIVE) ?
+ RS_ACTIVE :
+ RS_NOTINSERVICE);
+ snmp_set_var_typed_value(
+ request->requestvb, ASN_INTEGER,
+ (u_char*)&i, sizeof(i));
+ break;
+
+ default:
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+ }
+ break;
+
+ /**********
+ *
+ * Start of SET handling
+ *
+ * All config objects are potentially writable except
+ * nsExtendStorage which is fixed as either 'permanent'
+ * (if read from a config file) or 'volatile' (if set via SNMP)
+ * The string-based settings of a 'permanent' entry cannot
+ * be changed - neither can the execution or run type.
+ * Such entries can be (temporarily) marked as inactive,
+ * and the cache timeout adjusted, but these changes are
+ * not persistent.
+ *
+ **********/
+
+ case MODE_SET_RESERVE1:
+ /*
+ * Validate the new assignments
+ */
+ switch (table_info->colnum) {
+ case COLUMN_EXTCFG_COMMAND:
+ if (request->requestvb->type != ASN_OCTET_STR) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ /*
+ * Must have a full path to the command
+ * XXX - Assumes Unix-style paths
+ */
+ if (request->requestvb->val_len == 0 ||
+ request->requestvb->val.string[0] != '/') {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ /*
+ * XXX - need to check this file exists
+ * (and is executable)
+ */
+
+ if (extension && extension->flags & NS_EXTEND_FLAGS_CONFIG) {
+ /*
+ * config entries are "permanent" so can't be changed
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ break;
+
+ case COLUMN_EXTCFG_ARGS:
+ case COLUMN_EXTCFG_INPUT:
+ if (request->requestvb->type != ASN_OCTET_STR) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+
+ if (extension && extension->flags & NS_EXTEND_FLAGS_CONFIG) {
+ /*
+ * config entries are "permanent" so can't be changed
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ break;
+
+ case COLUMN_EXTCFG_CACHETIME:
+ if (request->requestvb->type != ASN_INTEGER) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ i = *request->requestvb->val.integer;
+ /*
+ * -1 is a special value indicating "don't cache"
+ * [[ XXX - should this be 0 ?? ]]
+ * Otherwise, cache times must be non-negative
+ */
+ if (i < -1 ) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+
+ case COLUMN_EXTCFG_EXECTYPE:
+ if (request->requestvb->type != ASN_INTEGER) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ i = *request->requestvb->val.integer;
+ if (i<1 || i>2) { /* 'exec(1)' or 'shell(2)' only */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ if (extension && extension->flags & NS_EXTEND_FLAGS_CONFIG) {
+ /*
+ * config entries are "permanent" so can't be changed
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ break;
+
+ case COLUMN_EXTCFG_RUNTYPE:
+ if (request->requestvb->type != ASN_INTEGER) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ /*
+ * 'run-on-read(1)', 'run-on-set(2)'
+ * or 'run-command(3)' only
+ */
+ i = *request->requestvb->val.integer;
+ if (i<1 || i>3) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ /*
+ * 'run-command(3)' can only be used with
+ * a pre-existing 'run-on-set(2)' entry.
+ */
+ if (i==3 && !(extension && (extension->flags & NS_EXTEND_FLAGS_WRITEABLE))) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ /*
+ * 'run-command(3)' is the only valid assignment
+ * for permanent (i.e. config) entries
+ */
+ if ((extension && extension->flags & NS_EXTEND_FLAGS_CONFIG)
+ && i!=3 ) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ break;
+
+ case COLUMN_EXTCFG_STATUS:
+ if (request->requestvb->type != ASN_INTEGER) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ i = *request->requestvb->val.integer;
+ switch (i) {
+ case RS_ACTIVE:
+ case RS_NOTINSERVICE:
+ if (!extension) {
+ /* Must be used with existing rows */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ break; /* OK */
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ if (extension) {
+ /* Can only be used to create new rows */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ break;
+ case RS_DESTROY:
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ switch (table_info->colnum) {
+ case COLUMN_EXTCFG_STATUS:
+ i = *request->requestvb->val.integer;
+ switch (i) {
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ eptr = _find_extension_block( request->requestvb->name,
+ request->requestvb->name_length );
+ extension = _new_extension( table_info->indexes->val.string,
+ 0, eptr );
+ if (!extension) { /* failed */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ netsnmp_insert_table_row( request, extension->row );
+ }
+ }
+ break;
+
+ case MODE_SET_FREE:
+ switch (table_info->colnum) {
+ case COLUMN_EXTCFG_STATUS:
+ i = *request->requestvb->val.integer;
+ switch (i) {
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ eptr = _find_extension_block( request->requestvb->name,
+ request->requestvb->name_length );
+ _free_extension( extension, eptr );
+ }
+ }
+ break;
+
+ case MODE_SET_ACTION:
+ switch (table_info->colnum) {
+ case COLUMN_EXTCFG_COMMAND:
+ extension->old_command = extension->command;
+ extension->command = netsnmp_strdup_and_null(
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_EXTCFG_ARGS:
+ extension->old_args = extension->args;
+ extension->args = netsnmp_strdup_and_null(
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_EXTCFG_INPUT:
+ extension->old_input = extension->input;
+ extension->input = netsnmp_strdup_and_null(
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_EXTCFG_STATUS:
+ i = *request->requestvb->val.integer;
+ switch (i) {
+ case RS_ACTIVE:
+ case RS_CREATEANDGO:
+ need_to_validate = 1;
+ }
+ break;
+ }
+ break;
+
+ case MODE_SET_UNDO:
+ switch (table_info->colnum) {
+ case COLUMN_EXTCFG_COMMAND:
+ if ( extension && extension->old_command ) {
+ SNMP_FREE(extension->command);
+ extension->command = extension->old_command;
+ extension->old_command = NULL;
+ }
+ break;
+ case COLUMN_EXTCFG_ARGS:
+ if ( extension && extension->old_args ) {
+ SNMP_FREE(extension->args);
+ extension->args = extension->old_args;
+ extension->old_args = NULL;
+ }
+ break;
+ case COLUMN_EXTCFG_INPUT:
+ if ( extension && extension->old_input ) {
+ SNMP_FREE(extension->input);
+ extension->input = extension->old_input;
+ extension->old_input = NULL;
+ }
+ break;
+ case COLUMN_EXTCFG_STATUS:
+ i = *request->requestvb->val.integer;
+ switch (i) {
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ eptr = _find_extension_block( request->requestvb->name,
+ request->requestvb->name_length );
+ _free_extension( extension, eptr );
+ }
+ break;
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ switch (table_info->colnum) {
+ case COLUMN_EXTCFG_CACHETIME:
+ i = *request->requestvb->val.integer;
+ extension->cache->timeout = i;
+ break;
+
+ case COLUMN_EXTCFG_RUNTYPE:
+ i = *request->requestvb->val.integer;
+ switch (i) {
+ case 1:
+ extension->flags &= ~NS_EXTEND_FLAGS_WRITEABLE;
+ break;
+ case 2:
+ extension->flags |= NS_EXTEND_FLAGS_WRITEABLE;
+ break;
+ case 3:
+ (void)netsnmp_cache_check_and_reload( extension->cache );
+ break;
+ }
+ break;
+
+ case COLUMN_EXTCFG_EXECTYPE:
+ i = *request->requestvb->val.integer;
+ if ( i == NS_EXTEND_ETYPE_SHELL )
+ extension->flags |= NS_EXTEND_FLAGS_SHELL;
+ else
+ extension->flags &= ~NS_EXTEND_FLAGS_SHELL;
+ break;
+
+ case COLUMN_EXTCFG_STATUS:
+ i = *request->requestvb->val.integer;
+ switch (i) {
+ case RS_ACTIVE:
+ case RS_CREATEANDGO:
+ extension->flags |= NS_EXTEND_FLAGS_ACTIVE;
+ break;
+ case RS_NOTINSERVICE:
+ case RS_CREATEANDWAIT:
+ extension->flags &= ~NS_EXTEND_FLAGS_ACTIVE;
+ break;
+ case RS_DESTROY:
+ eptr = _find_extension_block( request->requestvb->name,
+ request->requestvb->name_length );
+ _free_extension( extension, eptr );
+ break;
+ }
+ }
+ break;
+
+ default:
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_GENERR);
+ return SNMP_ERR_GENERR;
+ }
+ }
+
+ /*
+ * If we're marking a given row as active,
+ * then we need to check that it's ready.
+ */
+ if (need_to_validate) {
+ for ( request=requests; request; request=request->next ) {
+ if (request->processed)
+ continue;
+ table_info = netsnmp_extract_table_info( request );
+ extension = (netsnmp_extend*)netsnmp_extract_table_row_data( request );
+ switch (table_info->colnum) {
+ case COLUMN_EXTCFG_STATUS:
+ i = *request->requestvb->val.integer;
+ if (( i == RS_ACTIVE || i == RS_CREATEANDGO ) &&
+ !(extension && extension->command &&
+ extension->command[0] == '/' /* &&
+ is_executable(extension->command) */)) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ }
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+handle_nsExtendOutput1Table(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ netsnmp_extend *extension;
+ int len;
+
+ for ( request=requests; request; request=request->next ) {
+ if (request->processed)
+ continue;
+ table_info = netsnmp_extract_table_info( request );
+ extension = (netsnmp_extend*)netsnmp_extract_table_row_data( request );
+
+ DEBUGMSGTL(( "nsExtendTable:output1", "varbind: "));
+ DEBUGMSGOID(("nsExtendTable:output1", request->requestvb->name,
+ request->requestvb->name_length));
+ DEBUGMSG(( "nsExtendTable:output1", "\n"));
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ if (!extension || !(extension->flags & NS_EXTEND_FLAGS_ACTIVE)) {
+ /*
+ * If this row is inactive, then skip it.
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ if (!(extension->flags & NS_EXTEND_FLAGS_WRITEABLE) &&
+ (netsnmp_cache_check_and_reload( extension->cache ) < 0 )) {
+ /*
+ * If reloading the output cache of a 'run-on-read'
+ * entry fails, then skip it.
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ if ((extension->flags & NS_EXTEND_FLAGS_WRITEABLE) &&
+ (netsnmp_cache_check_expired( extension->cache ) == 1 )) {
+ /*
+ * If the output cache of a 'run-on-write'
+ * entry has expired, then skip it.
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+
+ switch (table_info->colnum) {
+ case COLUMN_EXTOUT1_OUTLEN:
+ snmp_set_var_typed_value(
+ request->requestvb, ASN_INTEGER,
+ (u_char*)&extension->out_len, sizeof(int));
+ break;
+ case COLUMN_EXTOUT1_OUTPUT1:
+ /*
+ * If we've got more than one line,
+ * find the length of the first one.
+ * Otherwise find the length of the whole string.
+ */
+ if (extension->numlines > 1) {
+ len = (extension->lines[1])-(extension->output) -1;
+ } else if (extension->output) {
+ len = strlen(extension->output);
+ } else {
+ len = 0;
+ }
+ snmp_set_var_typed_value(
+ request->requestvb, ASN_OCTET_STR,
+ extension->output, len);
+ break;
+ case COLUMN_EXTOUT1_OUTPUT2:
+ snmp_set_var_typed_value(
+ request->requestvb, ASN_OCTET_STR,
+ extension->output,
+ (extension->output)?extension->out_len:0);
+ break;
+ case COLUMN_EXTOUT1_NUMLINES:
+ snmp_set_var_typed_value(
+ request->requestvb, ASN_INTEGER,
+ (u_char*)&extension->numlines, sizeof(int));
+ break;
+ case COLUMN_EXTOUT1_RESULT:
+ snmp_set_var_typed_value(
+ request->requestvb, ASN_INTEGER,
+ (u_char*)&extension->result, sizeof(int));
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+ }
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_GENERR);
+ return SNMP_ERR_GENERR;
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+ /*************************
+ *
+ * Multi-line output table handler
+ * Most of the work is handled here.
+ *
+ *************************/
+
+
+/*
+ * Locate the appropriate entry for a given request
+ */
+netsnmp_extend *
+_extend_find_entry( netsnmp_request_info *request,
+ netsnmp_table_request_info *table_info,
+ int mode )
+{
+ netsnmp_extend *eptr;
+ extend_registration_block *ereg;
+ int line_idx;
+ oid oid_buf[MAX_OID_LEN];
+ int oid_len;
+ int i;
+ char *token;
+ int token_len;
+
+ if (!request || !table_info || !table_info->indexes
+ || !table_info->indexes->next_variable) {
+ DEBUGMSGTL(( "nsExtendTable:output2", "invalid invocation\n"));
+ return NULL;
+ }
+
+ ereg = _find_extension_block( request->requestvb->name,
+ request->requestvb->name_length );
+
+ /***
+ * GET handling - find the exact entry being requested
+ ***/
+ if ( mode == MODE_GET ) {
+ DEBUGMSGTL(( "nsExtendTable:output2", "GET: %s / %d\n ",
+ table_info->indexes->val.string,
+ *table_info->indexes->next_variable->val.integer));
+ for ( eptr = ereg->ehead; eptr; eptr = eptr->next ) {
+ if ( !strcmp( eptr->token, table_info->indexes->val.string ))
+ break;
+ }
+
+ if ( eptr ) {
+ /*
+ * Ensure the output is available...
+ */
+ if (!(eptr->flags & NS_EXTEND_FLAGS_ACTIVE) ||
+ (netsnmp_cache_check_and_reload( eptr->cache ) < 0 ))
+ return NULL;
+
+ /*
+ * ...and check the line requested is valid
+ */
+ line_idx = *table_info->indexes->next_variable->val.integer;
+ if (eptr->numlines < line_idx)
+ return NULL;
+ }
+ return eptr;
+ }
+
+ /***
+ * GETNEXT handling - find the first suitable entry
+ ***/
+ else {
+ if (!table_info->indexes->val_len ) {
+ DEBUGMSGTL(( "nsExtendTable:output2", "GETNEXT: first entry\n"));
+ /*
+ * Beginning of the table - find the first active
+ * (and successful) entry, and use the first line of it
+ */
+ for (eptr = ereg->ehead; eptr; eptr = eptr->next ) {
+ if ((eptr->flags & NS_EXTEND_FLAGS_ACTIVE) &&
+ (netsnmp_cache_check_and_reload( eptr->cache ) >= 0 )) {
+ line_idx = 1;
+ break;
+ }
+ }
+ } else {
+ token = table_info->indexes->val.string;
+ token_len = table_info->indexes->val_len;
+ line_idx = *table_info->indexes->next_variable->val.integer;
+ DEBUGMSGTL(( "nsExtendTable:output2", "GETNEXT: %s / %d\n ",
+ token, line_idx ));
+ /*
+ * Otherwise, find the first entry not earlier
+ * than the requested token...
+ */
+ for (eptr = ereg->ehead; eptr; eptr = eptr->next ) {
+ if ( strlen(eptr->token) > token_len )
+ break;
+ if ( strlen(eptr->token) == token_len &&
+ strcmp(eptr->token, token) >= 0 )
+ break;
+ }
+ if (!eptr)
+ return NULL; /* (assuming there is one) */
+
+ /*
+ * ... and make sure it's active & the output is available
+ * (or use the first following entry that is)
+ */
+ for ( ; eptr; eptr = eptr->next ) {
+ if ((eptr->flags & NS_EXTEND_FLAGS_ACTIVE) &&
+ (netsnmp_cache_check_and_reload( eptr->cache ) >= 0 )) {
+ break;
+ }
+ line_idx = 1;
+ }
+
+ if (!eptr)
+ return NULL; /* (assuming there is one) */
+
+ /*
+ * If we're working with the same entry that was requested,
+ * see whether we've reached the end of the output...
+ */
+ if (!strcmp( eptr->token, token )) {
+ if ( eptr->numlines <= line_idx ) {
+ /*
+ * ... and if so, move on to the first line
+ * of the next (active and successful) entry.
+ */
+ line_idx = 1;
+ for (eptr = eptr->next ; eptr; eptr = eptr->next ) {
+ if ((eptr->flags & NS_EXTEND_FLAGS_ACTIVE) &&
+ (netsnmp_cache_check_and_reload( eptr->cache ) >= 0 )) {
+ break;
+ }
+ }
+ } else {
+ /*
+ * Otherwise just use the next line of this entry.
+ */
+ line_idx++;
+ }
+ }
+ else {
+ /*
+ * If this is not the same entry that was requested,
+ * then we should return the first line.
+ */
+ line_idx = 1;
+ }
+ }
+ if (eptr) {
+ DEBUGMSGTL(( "nsExtendTable:output2", "GETNEXT -> %s / %d\n ",
+ eptr->token, line_idx));
+ /*
+ * Since we're processing a GETNEXT request,
+ * now we've found the appropriate entry (and line),
+ * we need to update the varbind OID ...
+ */
+ memset(oid_buf, 0, sizeof(oid_buf));
+ oid_len = ereg->oid_len;
+ memcpy( oid_buf, ereg->root_oid, oid_len*sizeof(oid));
+ oid_buf[ oid_len++ ] = 4; /* nsExtendOutput2Table */
+ oid_buf[ oid_len++ ] = 1; /* nsExtendOutput2Entry */
+ oid_buf[ oid_len++ ] = COLUMN_EXTOUT2_OUTLINE;
+ /* string token index */
+ oid_buf[ oid_len++ ] = strlen(eptr->token);
+ for ( i=0; i < (int)strlen(eptr->token); i++ )
+ oid_buf[ oid_len+i ] = eptr->token[i];
+ oid_len += strlen( eptr->token );
+ /* plus line number */
+ oid_buf[ oid_len++ ] = line_idx;
+ snmp_set_var_objid( request->requestvb, oid_buf, oid_len );
+ /*
+ * ... and index values to match.
+ */
+ snmp_set_var_value( table_info->indexes,
+ eptr->token, strlen(eptr->token));
+ snmp_set_var_value( table_info->indexes->next_variable,
+ &line_idx, sizeof(line_idx));
+ }
+ return eptr; /* Finally, signal success */
+ }
+ return NULL;
+}
+
+/*
+ * Multi-line output handler
+ * Locate the appropriate entry (using _extend_find_entry)
+ * and return the appropriate output line
+ */
+int
+handle_nsExtendOutput2Table(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ netsnmp_extend *extension;
+ char *cp;
+ int line_idx;
+ int len;
+
+ for ( request=requests; request; request=request->next ) {
+ if (request->processed)
+ continue;
+
+ table_info = netsnmp_extract_table_info( request );
+ extension = _extend_find_entry( request, table_info, reqinfo->mode );
+
+ DEBUGMSGTL(( "nsExtendTable:output2", "varbind: "));
+ DEBUGMSGOID(("nsExtendTable:output2", request->requestvb->name,
+ request->requestvb->name_length));
+ DEBUGMSG(( "nsExtendTable:output2", " (%s)\n",
+ (extension) ? extension->token : "[none]"));
+
+ if (!extension) {
+ if (reqinfo->mode == MODE_GET)
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
+ else
+ netsnmp_set_request_error(reqinfo, request, SNMP_ENDOFMIBVIEW);
+ continue;
+ }
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ case MODE_GETNEXT:
+ switch (table_info->colnum) {
+ case COLUMN_EXTOUT2_OUTLINE:
+ /*
+ * Determine which line we've been asked for....
+ */
+ line_idx = *table_info->indexes->next_variable->val.integer;
+ cp = extension->lines[line_idx-1];
+
+ /*
+ * ... and how long it is.
+ */
+ if ( extension->numlines > line_idx )
+ len = (extension->lines[line_idx])-cp -1;
+ else if (cp)
+ len = strlen(cp);
+ else
+ len = 0;
+
+ snmp_set_var_typed_value( request->requestvb,
+ ASN_OCTET_STR, cp, len );
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+ }
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_GENERR);
+ return SNMP_ERR_GENERR;
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+#ifndef USING_UCD_SNMP_EXTENSIBLE_MODULE
+ /*************************
+ *
+ * Compatability with the UCD extTable
+ *
+ *************************/
+
+u_char *
+var_extensible_old(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ netsnmp_old_extend *exten = NULL;
+ static long long_ret;
+ int idx;
+
+ if (header_simple_table
+ (vp, name, length, exact, var_len, write_method, num_compatability_entries))
+ return (NULL);
+
+ idx = name[*length-1] -1;
+ exten = &compatability_entries[ idx ];
+ if (exten) {
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = name[*length - 1];
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* name defined in config file */
+ *var_len = strlen(exten->exec_entry->token);
+ return ((u_char *) (exten->exec_entry->token));
+ case SHELLCOMMAND:
+ *var_len = strlen(exten->exec_entry->command);
+ return ((u_char *) (exten->exec_entry->command));
+ case ERRORFLAG: /* return code from the process */
+ netsnmp_cache_check_and_reload( exten->exec_entry->cache );
+ long_ret = exten->exec_entry->result;
+ return ((u_char *) (&long_ret));
+ case ERRORMSG: /* first line of text returned from the process */
+ netsnmp_cache_check_and_reload( exten->exec_entry->cache );
+ if (exten->exec_entry->numlines > 1) {
+ *var_len = (exten->exec_entry->lines[1])-
+ (exten->exec_entry->output) -1;
+ } else if (exten->exec_entry->output) {
+ *var_len = strlen(exten->exec_entry->output);
+ } else {
+ *var_len = 0;
+ }
+ return ((u_char *) (exten->exec_entry->output));
+ case ERRORFIX:
+ *write_method = fixExec2Error;
+ long_return = 0;
+ return ((u_char *) &long_return);
+
+ case ERRORFIXCMD:
+ if (exten->efix_entry) {
+ *var_len = strlen(exten->efix_entry->command);
+ return ((u_char *) exten->efix_entry->command);
+ } else {
+ *var_len = 0;
+ return ((u_char *) &long_return); /* Just needs to be non-null! */
+ }
+ }
+ return NULL;
+ }
+ return NULL;
+}
+
+
+int
+fixExec2Error(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ netsnmp_old_extend *exten = NULL;
+ int idx;
+
+ idx = name[name_len-1] -1;
+ exten = &compatability_entries[ idx ];
+
+ switch (action) {
+ case MODE_SET_RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR, "Wrong type != int\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ idx = *((long *) var_val);
+ if (idx != 1) {
+ snmp_log(LOG_ERR, "Wrong value != 1\n");
+ return SNMP_ERR_WRONGVALUE;
+ }
+ if (!exten || !exten->efix_entry) {
+ snmp_log(LOG_ERR, "No command to run\n");
+ return SNMP_ERR_GENERR;
+ }
+ return SNMP_ERR_NOERROR;
+
+ case MODE_SET_COMMIT:
+ netsnmp_cache_check_and_reload( exten->efix_entry->cache );
+ }
+ return SNMP_ERR_NOERROR;
+}
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/extend.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/extend.h
new file mode 100644
index 0000000000..8f19db3474
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/extend.h
@@ -0,0 +1,69 @@
+#ifndef NETSNMP_EXTEND_H
+#define NETSNMP_EXTEND_H
+
+config_require( util_funcs )
+config_require( utilities/execute )
+config_add_mib(NET-SNMP-EXTEND-MIB)
+
+typedef struct netsnmp_extend_s {
+ char *token;
+ char *command;
+ char *args;
+ char *input;
+ char *old_command;
+ char *old_args;
+ char *old_input;
+
+ int out_len;
+ char *output;
+ int numlines;
+ char **lines;
+ int result;
+
+ int flags;
+ netsnmp_cache *cache;
+ netsnmp_table_row *row;
+ netsnmp_table_data *dinfo;
+ struct netsnmp_extend_s *next;
+} netsnmp_extend;
+
+void init_extend(void);
+Netsnmp_Node_Handler handle_nsExtendConfigTable;
+Netsnmp_Node_Handler handle_nsExtendOutput1Table;
+Netsnmp_Node_Handler handle_nsExtendOutput2Table;
+void extend_parse_config(const char*, char*);
+
+#define COLUMN_EXTCFG_COMMAND 2
+#define COLUMN_EXTCFG_ARGS 3
+#define COLUMN_EXTCFG_INPUT 4
+#define COLUMN_EXTCFG_CACHETIME 5
+#define COLUMN_EXTCFG_EXECTYPE 6
+#define COLUMN_EXTCFG_RUNTYPE 7
+#define COLUMN_EXTCFG_STORAGE 20
+#define COLUMN_EXTCFG_STATUS 21
+#define COLUMN_EXTCFG_FIRST_COLUMN COLUMN_EXTCFG_COMMAND
+#define COLUMN_EXTCFG_LAST_COLUMN COLUMN_EXTCFG_STATUS
+
+#define COLUMN_EXTOUT1_OUTLEN 0 /* DROPPED */
+#define COLUMN_EXTOUT1_OUTPUT1 1 /* First Line */
+#define COLUMN_EXTOUT1_OUTPUT2 2 /* Full Output */
+#define COLUMN_EXTOUT1_NUMLINES 3
+#define COLUMN_EXTOUT1_RESULT 4
+#define COLUMN_EXTOUT1_FIRST_COLUMN COLUMN_EXTOUT1_OUTPUT1
+#define COLUMN_EXTOUT1_LAST_COLUMN COLUMN_EXTOUT1_RESULT
+
+#define COLUMN_EXTOUT2_OUTLINE 2
+#define COLUMN_EXTOUT2_FIRST_COLUMN COLUMN_EXTOUT2_OUTLINE
+#define COLUMN_EXTOUT2_LAST_COLUMN COLUMN_EXTOUT2_OUTLINE
+
+#define NS_EXTEND_FLAGS_ACTIVE 0x01
+#define NS_EXTEND_FLAGS_SHELL 0x02
+#define NS_EXTEND_FLAGS_WRITEABLE 0x04
+#define NS_EXTEND_FLAGS_CONFIG 0x08
+
+#define NS_EXTEND_ETYPE_EXEC 1
+#define NS_EXTEND_ETYPE_SHELL 2
+#define NS_EXTEND_RTYPE_RONLY 1
+#define NS_EXTEND_RTYPE_RWRITE 2
+
+#endif /* NETSNMP_EXTEND_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsCache.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsCache.c
new file mode 100644
index 0000000000..f8e73f045a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsCache.c
@@ -0,0 +1,419 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/scalar.h>
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/agent/cache_handler.h>
+#include "agent/nsCache.h"
+#include "util_funcs.h"
+
+
+/*
+ * use unadvertised function to get cache head. You really should not
+ * do this, since the internal storage mechanism might change.
+ */
+extern netsnmp_cache *netsnmp_cache_get_head(void);
+
+
+/*
+ * OIDs for the cacheging control scalar objects
+ *
+ * Note that these we're registering the full object rather
+ * than the (sole) valid instance in each case, in order
+ * to handle requests for invalid instances properly.
+ */
+oid nsCacheTimeout_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 1, 5, 1};
+oid nsCacheEnabled_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 1, 5, 2};
+
+/*
+ * ... and for the cache table.
+ */
+
+#define NSCACHE_TIMEOUT 2
+#define NSCACHE_STATUS 3
+
+#define NSCACHE_STATUS_ENABLED 1
+#define NSCACHE_STATUS_DISABLED 2
+#define NSCACHE_STATUS_EMPTY 3
+#define NSCACHE_STATUS_ACTIVE 4
+#define NSCACHE_STATUS_EXPIRED 5
+
+oid nsCacheTable_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 1, 5, 3};
+
+extern struct snmp_alarm *
+sa_find_specific(unsigned int clientreg);
+
+
+void
+init_nsCache(void)
+{
+ netsnmp_table_registration_info *table_info;
+ netsnmp_iterator_info *iinfo;
+
+ /*
+ * Register the scalar objects...
+ */
+ DEBUGMSGTL(("nsCacheScalars", "Initializing\n"));
+ netsnmp_register_scalar(
+ netsnmp_create_handler_registration(
+ "nsCacheTimeout", handle_nsCacheTimeout,
+ nsCacheTimeout_oid, OID_LENGTH(nsCacheTimeout_oid),
+ HANDLER_CAN_RWRITE)
+ );
+ netsnmp_register_scalar(
+ netsnmp_create_handler_registration(
+ "nsCacheEnabled", handle_nsCacheEnabled,
+ nsCacheEnabled_oid, OID_LENGTH(nsCacheEnabled_oid),
+ HANDLER_CAN_RWRITE)
+ );
+
+ /*
+ * ... and the table.
+ * We need to define the column structure and indexing....
+ */
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ if (!table_info) {
+ return;
+ }
+ netsnmp_table_helper_add_indexes(table_info, ASN_PRIV_IMPLIED_OBJECT_ID, 0);
+ table_info->min_column = NSCACHE_TIMEOUT;
+ table_info->max_column = NSCACHE_STATUS;
+
+
+ /*
+ * .... and the iteration information ....
+ */
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+ if (!iinfo) {
+ return;
+ }
+ iinfo->get_first_data_point = get_first_cache_entry;
+ iinfo->get_next_data_point = get_next_cache_entry;
+ iinfo->table_reginfo = table_info;
+
+
+ /*
+ * .... and register the table with the agent.
+ */
+ netsnmp_register_table_iterator(
+ netsnmp_create_handler_registration(
+ "tzCacheTable", handle_nsCacheTable,
+ nsCacheTable_oid, OID_LENGTH(nsCacheTable_oid),
+ HANDLER_CAN_RWRITE),
+ iinfo);
+}
+
+
+/*
+ * nsCache scalar handling
+ */
+
+int
+handle_nsCacheTimeout(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long cache_default_timeout =
+ netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_CACHE_TIMEOUT);
+ netsnmp_request_info *request=NULL;
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ for (request = requests; request; request=request->next) {
+ snmp_set_var_typed_value(request->requestvb, ASN_INTEGER,
+ (u_char*)&cache_default_timeout,
+ sizeof(cache_default_timeout));
+ }
+ break;
+
+
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request=request->next) {
+ if ( request->status != 0 ) {
+ return SNMP_ERR_NOERROR; /* Already got an error */
+ }
+ if ( request->requestvb->type != ASN_INTEGER ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if ( *request->requestvb->val.integer < 0 ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_CACHE_TIMEOUT,
+ *requests->requestvb->val.integer);
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+handle_nsCacheEnabled(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long enabled;
+ netsnmp_request_info *request=NULL;
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ enabled = (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_NO_CACHING)
+ ? NSCACHE_STATUS_ENABLED /* Actually True/False */
+ : NSCACHE_STATUS_DISABLED );
+ for (request = requests; request; request=request->next) {
+ snmp_set_var_typed_value(request->requestvb, ASN_INTEGER,
+ (u_char*)&enabled, sizeof(enabled));
+ }
+ break;
+
+
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request=request->next) {
+ if ( request->status != 0 ) {
+ return SNMP_ERR_NOERROR; /* Already got an error */
+ }
+ if ( request->requestvb->type != ASN_INTEGER ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if ((*request->requestvb->val.integer != NSCACHE_STATUS_ENABLED) &&
+ (*request->requestvb->val.integer != NSCACHE_STATUS_DISABLED)) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ enabled = *requests->requestvb->val.integer;
+ if (enabled == NSCACHE_STATUS_DISABLED)
+ enabled = 0;
+ netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_NO_CACHING, enabled);
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+/*
+ * nsCacheTable handling
+ */
+
+netsnmp_variable_list *
+get_first_cache_entry(void **loop_context, void **data_context,
+ netsnmp_variable_list *index,
+ netsnmp_iterator_info *data)
+{
+ netsnmp_cache *cache_head = netsnmp_cache_get_head();
+
+ if ( !cache_head )
+ return NULL;
+
+ snmp_set_var_value(index, (u_char*)cache_head->rootoid,
+ sizeof(oid) * cache_head->rootoid_len);
+ *loop_context = (void*)cache_head;
+ *data_context = (void*)cache_head;
+ return index;
+}
+
+netsnmp_variable_list *
+get_next_cache_entry(void **loop_context, void **data_context,
+ netsnmp_variable_list *index,
+ netsnmp_iterator_info *data)
+{
+ netsnmp_cache *cache = (netsnmp_cache *)*loop_context;
+ cache = cache->next;
+
+ if ( !cache )
+ return NULL;
+
+ snmp_set_var_value(index, (u_char*)cache->rootoid,
+ sizeof(oid) * cache->rootoid_len);
+ *loop_context = (void*)cache;
+ *data_context = (void*)cache;
+ return index;
+}
+
+
+int
+handle_nsCacheTable(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long status;
+ netsnmp_request_info *request = NULL;
+ netsnmp_table_request_info *table_info = NULL;
+ netsnmp_cache *cache_entry = NULL;
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ for (request=requests; request; request=request->next) {
+ if (request->processed != 0)
+ continue;
+
+ cache_entry = (netsnmp_cache*)netsnmp_extract_iterator_context(request);
+ table_info = netsnmp_extract_table_info(request);
+
+ switch (table_info->colnum) {
+ case NSCACHE_TIMEOUT:
+ if (!cache_entry) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ status = cache_entry->timeout;
+ snmp_set_var_typed_value(request->requestvb, ASN_INTEGER,
+ (u_char*)&status, sizeof(status));
+ break;
+
+ case NSCACHE_STATUS:
+ if (!cache_entry) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ status = (cache_entry->enabled ?
+ (cache_entry->timestamp ?
+ (!atime_ready(cache_entry->timestamp,
+ 1000*cache_entry->timeout) ?
+ NSCACHE_STATUS_ACTIVE:
+ NSCACHE_STATUS_EXPIRED) :
+ NSCACHE_STATUS_EMPTY) :
+ NSCACHE_STATUS_DISABLED);
+ snmp_set_var_typed_value(request->requestvb, ASN_INTEGER,
+ (u_char*)&status, sizeof(status));
+ break;
+
+ default:
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+ }
+ }
+ break;
+
+
+ case MODE_SET_RESERVE1:
+ for (request=requests; request; request=request->next) {
+ if (request->processed != 0)
+ continue;
+ if ( request->status != 0 ) {
+ return SNMP_ERR_NOERROR; /* Already got an error */
+ }
+ cache_entry = (netsnmp_cache*)netsnmp_extract_iterator_context(request);
+ table_info = netsnmp_extract_table_info(request);
+
+ switch (table_info->colnum) {
+ case NSCACHE_TIMEOUT:
+ if (!cache_entry) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_NOCREATION);
+ return SNMP_ERR_NOCREATION;
+ }
+ if ( request->requestvb->type != ASN_INTEGER ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (*request->requestvb->val.integer < 0 ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+
+ case NSCACHE_STATUS:
+ if (!cache_entry) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_NOCREATION);
+ return SNMP_ERR_NOCREATION;
+ }
+ if ( request->requestvb->type != ASN_INTEGER ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ status = *request->requestvb->val.integer;
+ if (!((status == NSCACHE_STATUS_ENABLED ) ||
+ (status == NSCACHE_STATUS_DISABLED ) ||
+ (status == NSCACHE_STATUS_EMPTY ))) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+
+ default:
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_NOCREATION);
+ return SNMP_ERR_NOCREATION; /* XXX - is this right ? */
+ continue;
+ }
+ }
+ break;
+
+
+ case MODE_SET_COMMIT:
+ for (request=requests; request; request=request->next) {
+ if (request->processed != 0)
+ continue;
+ if ( request->status != 0 ) {
+ return SNMP_ERR_NOERROR; /* Already got an error */
+ }
+ cache_entry = (netsnmp_cache*)netsnmp_extract_iterator_context(request);
+ if (!cache_entry) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_COMMITFAILED);
+ return SNMP_ERR_COMMITFAILED; /* Shouldn't happen! */
+ }
+ table_info = netsnmp_extract_table_info(request);
+
+ switch (table_info->colnum) {
+ case NSCACHE_TIMEOUT:
+ cache_entry->timeout = *request->requestvb->val.integer;
+ /*
+ * check for auto repeat
+ */
+ if (cache_entry->timer_id) {
+ struct snmp_alarm * sa =
+ sa_find_specific(cache_entry->timer_id);
+ if (NULL != sa)
+ sa->t.tv_sec = cache_entry->timeout;
+ }
+ break;
+
+ case NSCACHE_STATUS:
+ switch (*request->requestvb->val.integer) {
+ case NSCACHE_STATUS_ENABLED:
+ cache_entry->enabled = 1;
+ break;
+ case NSCACHE_STATUS_DISABLED:
+ cache_entry->enabled = 0;
+ break;
+ case NSCACHE_STATUS_EMPTY:
+ cache_entry->free_cache(cache_entry, cache_entry->magic);
+ free(cache_entry->timestamp);
+ cache_entry->timestamp = NULL;
+ break;
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsCache.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsCache.h
new file mode 100644
index 0000000000..ab63bc9db8
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsCache.h
@@ -0,0 +1,22 @@
+#ifndef NSCACHE_H
+#define NSCACHE_H
+
+/*
+ * function declarations
+ */
+void init_nsCache(void);
+
+/*
+ * Handlers for the scalar objects
+ */
+Netsnmp_Node_Handler handle_nsCacheTimeout;
+Netsnmp_Node_Handler handle_nsCacheEnabled;
+
+/*
+ * Handler and iterators for the cache table
+ */
+Netsnmp_Node_Handler handle_nsCacheTable;
+Netsnmp_First_Data_Point get_first_cache_entry;
+Netsnmp_Next_Data_Point get_next_cache_entry;
+
+#endif /* NSCACHE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsDebug.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsDebug.c
new file mode 100644
index 0000000000..4e92f9d9fb
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsDebug.c
@@ -0,0 +1,459 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/scalar.h>
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include "agent/nsDebug.h"
+#include "util_funcs.h"
+
+
+
+/*
+ * OIDs for the debugging control scalar objects
+ *
+ * Note that these we're registering the full object rather
+ * than the (sole) valid instance in each case, in order
+ * to handle requests for invalid instances properly.
+ */
+oid nsDebugEnabled_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 1, 7, 1, 1};
+oid nsDebugOutputAll_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 1, 7, 1, 2};
+oid nsDebugDumpPdu_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 1, 7, 1, 3};
+
+/*
+ * ... and for the token table.
+ */
+
+#define DBGTOKEN_PREFIX 2
+#define DBGTOKEN_ENABLED 3
+#define DBGTOKEN_STATUS 4
+oid nsDebugTokenTable_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 1, 7, 1, 4};
+
+
+void
+init_nsDebug(void)
+{
+ netsnmp_table_registration_info *table_info;
+ netsnmp_iterator_info *iinfo;
+
+ /*
+ * Register the scalar objects...
+ */
+ DEBUGMSGTL(("nsDebugScalars", "Initializing\n"));
+ netsnmp_register_scalar(
+ netsnmp_create_handler_registration(
+ "nsDebugEnabled", handle_nsDebugEnabled,
+ nsDebugEnabled_oid, OID_LENGTH(nsDebugEnabled_oid),
+ HANDLER_CAN_RWRITE)
+ );
+ netsnmp_register_scalar(
+ netsnmp_create_handler_registration(
+ "nsDebugOutputAll", handle_nsDebugOutputAll,
+ nsDebugOutputAll_oid, OID_LENGTH(nsDebugOutputAll_oid),
+ HANDLER_CAN_RWRITE)
+ );
+ netsnmp_register_scalar(
+ netsnmp_create_handler_registration(
+ "nsDebugDumpPdu", handle_nsDebugDumpPdu,
+ nsDebugDumpPdu_oid, OID_LENGTH(nsDebugDumpPdu_oid),
+ HANDLER_CAN_RWRITE)
+ );
+
+ /*
+ * ... and the table.
+ * We need to define the column structure and indexing....
+ */
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ if (!table_info) {
+ return;
+ }
+ netsnmp_table_helper_add_indexes(table_info, ASN_PRIV_IMPLIED_OCTET_STR, 0);
+ table_info->min_column = DBGTOKEN_STATUS;
+ table_info->max_column = DBGTOKEN_STATUS;
+
+
+ /*
+ * .... and the iteration information ....
+ */
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+ if (!iinfo) {
+ return;
+ }
+ iinfo->get_first_data_point = get_first_debug_entry;
+ iinfo->get_next_data_point = get_next_debug_entry;
+ iinfo->table_reginfo = table_info;
+
+
+ /*
+ * .... and register the table with the agent.
+ */
+ netsnmp_register_table_iterator(
+ netsnmp_create_handler_registration(
+ "tzDebugTable", handle_nsDebugTable,
+ nsDebugTokenTable_oid, OID_LENGTH(nsDebugTokenTable_oid),
+ HANDLER_CAN_RWRITE),
+ iinfo);
+}
+
+
+int
+handle_nsDebugEnabled(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long enabled;
+ netsnmp_request_info *request=NULL;
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ enabled = snmp_get_do_debugging();
+ if ( enabled==0 )
+ enabled=2; /* false */
+ for (request = requests; request; request=request->next) {
+ if (request->processed != 0)
+ continue;
+ snmp_set_var_typed_value(request->requestvb, ASN_INTEGER,
+ (u_char*)&enabled, sizeof(enabled));
+ }
+ break;
+
+
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request=request->next) {
+ if (request->processed != 0)
+ continue;
+ if ( request->status != 0 ) {
+ return SNMP_ERR_NOERROR; /* Already got an error */
+ }
+ if ( request->requestvb->type != ASN_INTEGER ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (( *request->requestvb->val.integer != 1 ) &&
+ ( *request->requestvb->val.integer != 2 )) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ enabled = *requests->requestvb->val.integer;
+ if (enabled == 2 ) /* false */
+ enabled = 0;
+ snmp_set_do_debugging( enabled );
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+handle_nsDebugOutputAll(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long enabled;
+ netsnmp_request_info *request=NULL;
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ enabled = snmp_get_do_debugging();
+ if ( enabled==0 )
+ enabled=2; /* false */
+ for (request = requests; request; request=request->next) {
+ if (request->processed != 0)
+ continue;
+ snmp_set_var_typed_value(request->requestvb, ASN_INTEGER,
+ (u_char*)&enabled, sizeof(enabled));
+ }
+ break;
+
+
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request=request->next) {
+ if (request->processed != 0)
+ continue;
+ if ( request->status != 0 ) {
+ return SNMP_ERR_NOERROR; /* Already got an error */
+ }
+ if ( request->requestvb->type != ASN_INTEGER ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (( *request->requestvb->val.integer != 1 ) &&
+ ( *request->requestvb->val.integer != 2 )) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ enabled = *requests->requestvb->val.integer;
+ if (enabled == 2 ) /* false */
+ enabled = 0;
+ snmp_set_do_debugging( enabled );
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+handle_nsDebugDumpPdu(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long enabled;
+ netsnmp_request_info *request=NULL;
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ enabled = netsnmp_ds_get_boolean(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_DUMP_PACKET);
+ if ( enabled==0 )
+ enabled=2; /* false */
+ for (request = requests; request; request=request->next) {
+ if (request->processed != 0)
+ continue;
+ snmp_set_var_typed_value(request->requestvb, ASN_INTEGER,
+ (u_char*)&enabled, sizeof(enabled));
+ }
+ break;
+
+
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request=request->next) {
+ if (request->processed != 0)
+ continue;
+ if ( request->status != 0 ) {
+ return SNMP_ERR_NOERROR; /* Already got an error */
+ }
+ if ( request->requestvb->type != ASN_INTEGER ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (( *request->requestvb->val.integer != 1 ) &&
+ ( *request->requestvb->val.integer != 2 )) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ enabled = *requests->requestvb->val.integer;
+ if (enabled == 2 ) /* false */
+ enabled = 0;
+ netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_DUMP_PACKET, enabled);
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+/*
+ * var_tzIntTableFixed():
+ * Handle the tzIntTable as a fixed table of NUMBER_TZ_ENTRIES rows,
+ * with the timezone offset hardwired to be the same as the index.
+ */
+
+netsnmp_variable_list *
+get_first_debug_entry(void **loop_context, void **data_context,
+ netsnmp_variable_list *index,
+ netsnmp_iterator_info *data)
+{
+ int i;
+
+ for (i=0; i<debug_num_tokens; i++) {
+ /* skip excluded til mib is updated */
+ if (dbg_tokens[i].token_name && (dbg_tokens[i].enabled != 2))
+ break;
+ }
+ if ( i==debug_num_tokens )
+ return NULL;
+
+ snmp_set_var_value(index, dbg_tokens[i].token_name,
+ strlen(dbg_tokens[i].token_name));
+ *loop_context = (void*)(intptr_t)i;
+ *data_context = (void*)&dbg_tokens[i];
+ return index;
+}
+
+netsnmp_variable_list *
+get_next_debug_entry(void **loop_context, void **data_context,
+ netsnmp_variable_list *index,
+ netsnmp_iterator_info *data)
+{
+ int i = (int)(intptr_t)*loop_context;
+
+ for (i++; i<debug_num_tokens; i++) {
+ /* skip excluded til mib is updated */
+ if (dbg_tokens[i].token_name && (dbg_tokens[i].enabled != 2))
+ break;
+ }
+ if ( i==debug_num_tokens )
+ return NULL;
+
+ snmp_set_var_value(index, dbg_tokens[i].token_name,
+ strlen(dbg_tokens[i].token_name));
+ *loop_context = (void*)(intptr_t)i;
+ *data_context = (void*)&dbg_tokens[i];
+ return index;
+}
+
+
+int
+handle_nsDebugTable(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long status;
+ netsnmp_request_info *request =NULL;
+ netsnmp_table_request_info *table_info =NULL;
+ netsnmp_token_descr *debug_entry=NULL;
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ for (request=requests; request; request=request->next) {
+ if (request->processed != 0)
+ continue;
+ debug_entry = (netsnmp_token_descr*)
+ netsnmp_extract_iterator_context(request);
+ if (!debug_entry)
+ continue;
+ status = (debug_entry->enabled ? RS_ACTIVE : RS_NOTINSERVICE);
+ snmp_set_var_typed_value(request->requestvb, ASN_INTEGER,
+ (u_char*)&status, sizeof(status));
+ }
+ break;
+
+
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request=request->next) {
+ if (request->processed != 0)
+ continue;
+ if ( request->status != 0 ) {
+ return SNMP_ERR_NOERROR; /* Already got an error */
+ }
+ if ( request->requestvb->type != ASN_INTEGER ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+
+ debug_entry = (netsnmp_token_descr*)
+ netsnmp_extract_iterator_context(request);
+ switch (*request->requestvb->val.integer) {
+ case RS_ACTIVE:
+ case RS_NOTINSERVICE:
+ /*
+ * These operations require an existing row
+ */
+ if (!debug_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ break;
+
+ case RS_CREATEANDWAIT:
+ case RS_CREATEANDGO:
+ /*
+ * These operations assume the row doesn't already exist
+ */
+ if (debug_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ break;
+
+ case RS_DESTROY:
+ /*
+ * This operation can work regardless
+ */
+ break;
+
+ case RS_NOTREADY:
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ }
+ break;
+
+
+ case MODE_SET_COMMIT:
+ for (request = requests; request; request=request->next) {
+ if (request->processed != 0)
+ continue;
+ if ( request->status != 0 ) {
+ return SNMP_ERR_NOERROR; /* Already got an error */
+ }
+
+ switch (*request->requestvb->val.integer) {
+ case RS_ACTIVE:
+ case RS_NOTINSERVICE:
+ /*
+ * Update the enabled field appropriately
+ */
+ debug_entry = (netsnmp_token_descr*)
+ netsnmp_extract_iterator_context(request);
+ debug_entry->enabled =
+ (*request->requestvb->val.integer == RS_ACTIVE);
+ break;
+
+ case RS_CREATEANDWAIT:
+ case RS_CREATEANDGO:
+ /*
+ * Create the entry, and set the enabled field appropriately
+ */
+ table_info = netsnmp_extract_table_info(request);
+ debug_register_tokens(table_info->indexes->val.string);
+#ifdef UMMMMM
+ if (*request->requestvb->val.integer == RS_CREATEANDWAIT) {
+ /* XXX - how to locate the entry ?? */
+ debug_entry->enabled = 0;
+ }
+#endif
+ break;
+
+ case RS_DESTROY:
+ /*
+ * XXX - there's no "remove" API :-(
+ */
+ debug_entry = (netsnmp_token_descr*)
+ netsnmp_extract_iterator_context(request);
+ if (debug_entry) {
+ debug_entry->enabled = 0;
+ free(debug_entry->token_name);
+ debug_entry->token_name = NULL;
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsDebug.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsDebug.h
new file mode 100644
index 0000000000..55614ce831
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsDebug.h
@@ -0,0 +1,23 @@
+#ifndef NSDEBUG_H
+#define NSDEBUG_H
+
+/*
+ * function declarations
+ */
+void init_nsDebug(void);
+
+/*
+ * Handlers for the scalar objects
+ */
+Netsnmp_Node_Handler handle_nsDebugEnabled;
+Netsnmp_Node_Handler handle_nsDebugOutputAll;
+Netsnmp_Node_Handler handle_nsDebugDumpPdu;
+
+/*
+ * Handler and iterators for the debug table
+ */
+Netsnmp_Node_Handler handle_nsDebugTable;
+Netsnmp_First_Data_Point get_first_debug_entry;
+Netsnmp_Next_Data_Point get_next_debug_entry;
+
+#endif /* NSDEBUG_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsLogging.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsLogging.c
new file mode 100644
index 0000000000..a8563b37d5
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsLogging.c
@@ -0,0 +1,469 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/scalar.h>
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/library/snmp_logging.h>
+#include "agent/nsLogging.h"
+#include "util_funcs.h"
+
+
+
+/*
+ * OID and columns for the logging table.
+ */
+
+#define NSLOGGING_TYPE 3
+#define NSLOGGING_MAXLEVEL 4
+#define NSLOGGING_STATUS 5
+
+oid nsLoggingTable_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 1, 7, 2, 1};
+
+
+void
+init_nsLogging(void)
+{
+ netsnmp_table_registration_info *table_info;
+ netsnmp_iterator_info *iinfo;
+
+ /*
+ * Register the table.
+ * We need to define the column structure and indexing....
+ */
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ if (!table_info) {
+ return;
+ }
+ netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER,
+ ASN_PRIV_IMPLIED_OCTET_STR, 0);
+ table_info->min_column = NSLOGGING_TYPE;
+ table_info->max_column = NSLOGGING_STATUS;
+
+
+ /*
+ * .... and the iteration information ....
+ */
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+ if (!iinfo) {
+ return;
+ }
+ iinfo->get_first_data_point = get_first_logging_entry;
+ iinfo->get_next_data_point = get_next_logging_entry;
+ iinfo->table_reginfo = table_info;
+
+
+ /*
+ * .... and register the table with the agent.
+ */
+ netsnmp_register_table_iterator(
+ netsnmp_create_handler_registration(
+ "tzLoggingTable", handle_nsLoggingTable,
+ nsLoggingTable_oid, OID_LENGTH(nsLoggingTable_oid),
+ HANDLER_CAN_RWRITE),
+ iinfo);
+}
+
+
+/*
+ * nsLoggingTable handling
+ */
+
+netsnmp_variable_list *
+get_first_logging_entry(void **loop_context, void **data_context,
+ netsnmp_variable_list *index,
+ netsnmp_iterator_info *data)
+{
+ long temp;
+ netsnmp_log_handler *logh_head = get_logh_head();
+ if ( !logh_head )
+ return NULL;
+
+ temp = logh_head->priority;
+ snmp_set_var_value(index, (u_char*)&temp,
+ sizeof(temp));
+ if ( logh_head->token )
+ snmp_set_var_value(index->next_variable, (const u_char*)logh_head->token,
+ strlen(logh_head->token));
+ else
+ snmp_set_var_value(index->next_variable, NULL, 0);
+ *loop_context = (void*)logh_head;
+ *data_context = (void*)logh_head;
+ return index;
+}
+
+netsnmp_variable_list *
+get_next_logging_entry(void **loop_context, void **data_context,
+ netsnmp_variable_list *index,
+ netsnmp_iterator_info *data)
+{
+ long temp;
+ netsnmp_log_handler *logh = (netsnmp_log_handler *)*loop_context;
+ logh = logh->next;
+
+ if ( !logh )
+ return NULL;
+
+ temp = logh->priority;
+ snmp_set_var_value(index, (u_char*)&temp,
+ sizeof(temp));
+ if ( logh->token )
+ snmp_set_var_value(index->next_variable, (const u_char*)logh->token,
+ strlen(logh->token));
+ else
+ snmp_set_var_value(index->next_variable, NULL, 0);
+ *loop_context = (void*)logh;
+ *data_context = (void*)logh;
+ return index;
+}
+
+
+int
+handle_nsLoggingTable(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ long temp;
+ netsnmp_request_info *request = NULL;
+ netsnmp_table_request_info *table_info = NULL;
+ netsnmp_log_handler *logh = NULL;
+ netsnmp_variable_list *idx = NULL;
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ for (request=requests; request; request=request->next) {
+ if (request->processed != 0)
+ continue;
+ logh = (netsnmp_log_handler*)netsnmp_extract_iterator_context(request);
+ table_info = netsnmp_extract_table_info(request);
+
+ switch (table_info->colnum) {
+ case NSLOGGING_TYPE:
+ if (!logh) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ temp = logh->type;
+ snmp_set_var_typed_value(request->requestvb, ASN_INTEGER,
+ (u_char*)&temp,
+ sizeof(temp));
+ break;
+
+ case NSLOGGING_MAXLEVEL:
+ if (!logh) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ temp = logh->pri_max;
+ snmp_set_var_typed_value(request->requestvb, ASN_INTEGER,
+ (u_char*)&temp,
+ sizeof(temp));
+ break;
+
+ case NSLOGGING_STATUS:
+ if (!logh) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ temp = (logh->type ?
+ (logh->enabled ?
+ RS_ACTIVE:
+ RS_NOTINSERVICE) :
+ RS_NOTREADY);
+ snmp_set_var_typed_value(request->requestvb, ASN_INTEGER,
+ (u_char*)&temp, sizeof(temp));
+ break;
+
+ default:
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+ }
+ }
+ break;
+
+
+ case MODE_SET_RESERVE1:
+ for (request=requests; request; request=request->next) {
+ if ( request->status != 0 ) {
+ return SNMP_ERR_NOERROR; /* Already got an error */
+ }
+ logh = (netsnmp_log_handler*)netsnmp_extract_iterator_context(request);
+ table_info = netsnmp_extract_table_info(request);
+
+ switch (table_info->colnum) {
+ case NSLOGGING_TYPE:
+ if ( request->requestvb->type != ASN_INTEGER ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (*request->requestvb->val.integer < 0 ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ /*
+ * It's OK to create a new logging entry
+ * (either in one go, or built up using createAndWait)
+ * but it's not possible to change the type of an entry
+ * once it's been created.
+ */
+ if (logh && logh->type) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ break;
+
+ case NSLOGGING_MAXLEVEL:
+ if ( request->requestvb->type != ASN_INTEGER ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (*request->requestvb->val.integer < 0 ||
+ *request->requestvb->val.integer > 7 ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+
+ case NSLOGGING_STATUS:
+ if ( request->requestvb->type != ASN_INTEGER ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_WRONGTYPE;
+ }
+ switch ( *request->requestvb->val.integer ) {
+ case RS_ACTIVE:
+ case RS_NOTINSERVICE:
+ /*
+ * Can only work on existing rows
+ */
+ if (!logh) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ break;
+
+ case RS_CREATEANDWAIT:
+ case RS_CREATEANDGO:
+ /*
+ * Can only work with new rows
+ */
+ if (logh) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ /*
+ * Normally, we'd create the row at a later stage
+ * (probably during the RESERVE2 or ACTION passes)
+ *
+ * But we need to check that the values are
+ * consistent during the ACTION pass (which is the
+ * latest that an error can be safely handled),
+ * so the values all need to be set up before this
+ * (i.e. during the RESERVE2 pass)
+ * So the new row needs to be created before that
+ * in order to have somewhere to put them.
+ *
+ * That's why we're doing this here.
+ */
+ idx = table_info->indexes;
+ logh = netsnmp_register_loghandler(
+ /* not really, but we need a valid type */
+ NETSNMP_LOGHANDLER_STDOUT,
+ *idx->val.integer);
+ if (!logh) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_GENERR); /* ??? */
+ return SNMP_ERR_GENERR;
+ }
+ idx = idx->next_variable;
+ logh->type = 0;
+ logh->token = strdup(idx->val.string);
+ netsnmp_insert_iterator_context(request, (void*)logh);
+ break;
+
+ case RS_DESTROY:
+ /*
+ * Can work with new or existing rows
+ */
+ break;
+
+ case RS_NOTREADY:
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_WRONGVALUE);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+
+ default:
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ return SNMP_NOSUCHOBJECT;
+ continue;
+ }
+ }
+ break;
+
+
+ case MODE_SET_RESERVE2:
+ for (request=requests; request; request=request->next) {
+ if ( request->status != 0 ) {
+ return SNMP_ERR_NOERROR; /* Already got an error */
+ }
+ logh = (netsnmp_log_handler*)netsnmp_extract_iterator_context(request);
+ table_info = netsnmp_extract_table_info(request);
+
+ switch (table_info->colnum) {
+ case NSLOGGING_TYPE:
+ /*
+ * If we're creating a row using createAndGo,
+ * we need to set the type early, so that we
+ * can validate it in the ACTION pass.
+ *
+ * Remember that we need to be able to reverse this
+ */
+ if ( logh )
+ logh->type = *request->requestvb->val.integer;
+ break;
+ /*
+ * Don't need to handle nsLogToken or nsLogStatus in this pass
+ */
+ }
+ }
+ break;
+
+ case MODE_SET_ACTION:
+ for (request=requests; request; request=request->next) {
+ if (request->processed != 0)
+ continue;
+ if ( request->status != 0 ) {
+ return SNMP_ERR_NOERROR; /* Already got an error */
+ }
+ logh = (netsnmp_log_handler*)netsnmp_extract_iterator_context(request);
+ table_info = netsnmp_extract_table_info(request);
+
+ switch (table_info->colnum) {
+ case NSLOGGING_STATUS:
+ /*
+ * This is where we can check the internal consistency
+ * of the request. Basically, for a row to be marked
+ * 'active', then there needs to be a valid type value.
+ */
+ switch ( *request->requestvb->val.integer ) {
+ case RS_ACTIVE:
+ case RS_CREATEANDGO:
+ if ( !logh->type ) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ break;
+ }
+ break;
+ /*
+ * Don't need to handle nsLogToken or nsLogType in this pass
+ */
+ }
+ }
+ break;
+
+ case MODE_SET_FREE:
+ case MODE_SET_UNDO:
+ /*
+ * If any resources were allocated in either of the
+ * two RESERVE passes, they need to be released here,
+ * and any assignments (in RESERVE2) reversed.
+ *
+ * Nothing additional will have been done during ACTION
+ * so this same code can do for UNDO as well.
+ */
+ for (request=requests; request; request=request->next) {
+ if (request->processed != 0)
+ continue;
+ logh = (netsnmp_log_handler*)netsnmp_extract_iterator_context(request);
+ table_info = netsnmp_extract_table_info(request);
+
+ switch (table_info->colnum) {
+ case NSLOGGING_TYPE:
+ /*
+ * If we've been setting the type, and the request
+ * has failed, then revert to an unset type.
+ *
+ * We need to be careful here - if the reason it failed is
+ * that the type was already set, then we shouldn't "undo"
+ * the assignment (since it won't actually have been made).
+ *
+ * Check the current value against the 'new' one. If they're
+ * the same, then this is probably a successful assignment,
+ * and the failure was elsewhere, so we need to undo it.
+ * (Or else there was an attempt to write the same value!)
+ */
+ if ( logh && logh->type == *request->requestvb->val.integer )
+ logh->type = 0;
+ break;
+
+ case NSLOGGING_STATUS:
+ temp = *request->requestvb->val.integer;
+ if ( logh && ( temp == RS_CREATEANDGO ||
+ temp == RS_CREATEANDWAIT)) {
+ netsnmp_remove_loghandler( logh );
+ }
+ break;
+ /*
+ * Don't need to handle nsLogToken in this pass
+ */
+ }
+ }
+ break;
+
+
+ case MODE_SET_COMMIT:
+ for (request=requests; request; request=request->next) {
+ if (request->processed != 0)
+ continue;
+ if ( request->status != 0 ) {
+ return SNMP_ERR_NOERROR; /* Already got an error */
+ }
+ logh = (netsnmp_log_handler*)netsnmp_extract_iterator_context(request);
+ if (!logh) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_ERR_COMMITFAILED);
+ return SNMP_ERR_COMMITFAILED; /* Shouldn't happen! */
+ }
+ table_info = netsnmp_extract_table_info(request);
+
+ switch (table_info->colnum) {
+ case NSLOGGING_MAXLEVEL:
+ logh->pri_max = *request->requestvb->val.integer;
+ break;
+
+ case NSLOGGING_STATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_ACTIVE:
+ case RS_CREATEANDGO:
+ logh->enabled = 1;
+ break;
+ case RS_NOTINSERVICE:
+ case RS_CREATEANDWAIT:
+ logh->enabled = 0;
+ break;
+ case RS_DESTROY:
+ netsnmp_remove_loghandler( logh );
+ break;
+ }
+ break;
+ }
+ }
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsLogging.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsLogging.h
new file mode 100644
index 0000000000..093feccaaf
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsLogging.h
@@ -0,0 +1,16 @@
+#ifndef NSLOGGING_H
+#define NSLOGGING_H
+
+/*
+ * function declarations
+ */
+void init_nsLogging(void);
+
+/*
+ * Handler and iterators for the logging table
+ */
+Netsnmp_Node_Handler handle_nsLoggingTable;
+Netsnmp_First_Data_Point get_first_logging_entry;
+Netsnmp_Next_Data_Point get_next_logging_entry;
+
+#endif /* NSLOGGING_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsModuleTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsModuleTable.c
new file mode 100644
index 0000000000..4f4ea00dee
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsModuleTable.c
@@ -0,0 +1,320 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 1.5 2001/12/04 21:36:27 hardaker Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "nsModuleTable.h"
+
+void
+nsModuleTable_free(void *context, netsnmp_iterator_info *dont_care)
+{
+ free(context);
+}
+
+/** Initialize the nsModuleTable table by defining it's contents and how it's structured */
+void
+initialize_table_nsModuleTable(void)
+{
+ static oid nsModuleTable_oid[] =
+ { 1, 3, 6, 1, 4, 1, 8072, 1, 2, 1 };
+ netsnmp_table_registration_info *table_info;
+ netsnmp_handler_registration *my_handler;
+ netsnmp_iterator_info *iinfo;
+
+ /*
+ * create the table structure itself
+ */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+ /*
+ * if your table is read only, it's easiest to change the
+ * HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY
+ */
+ my_handler = netsnmp_create_handler_registration("nsModuleTable",
+ nsModuleTable_handler,
+ nsModuleTable_oid,
+ OID_LENGTH
+ (nsModuleTable_oid),
+ HANDLER_CAN_RWRITE);
+
+ if (!my_handler || !table_info || !iinfo) {
+ if (my_handler)
+ netsnmp_handler_registration_free(my_handler);
+ SNMP_FREE(table_info);
+ SNMP_FREE(iinfo);
+ return; /* mallocs failed */
+ }
+
+ /***************************************************
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(table_info, ASN_OCTET_STR, /* context name */
+ ASN_OBJECT_ID, /* reg point */
+ ASN_INTEGER, /* priority */
+ 0);
+
+ table_info->min_column = 4;
+ table_info->max_column = 6;
+
+ /*
+ * iterator access routines
+ */
+ iinfo->get_first_data_point = nsModuleTable_get_first_data_point;
+ iinfo->get_next_data_point = nsModuleTable_get_next_data_point;
+ iinfo->free_loop_context_at_end = nsModuleTable_free;
+ iinfo->table_reginfo = table_info;
+
+ /***************************************************
+ * registering the table with the master agent
+ */
+ DEBUGMSGTL(("initialize_table_nsModuleTable",
+ "Registering table nsModuleTable as a table iterator\n"));
+ netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/** Initialzies the nsModuleTable module */
+void
+init_nsModuleTable(void)
+{
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ initialize_table_nsModuleTable();
+}
+
+/** returns the first data point within the nsModuleTable table data.
+
+ Set the my_loop_context variable to the first data point structure
+ of your choice (from which you can find the next one). This could
+ be anything from the first node in a linked list, to an integer
+ pointer containing the beginning of an array variable.
+
+ Set the my_data_context variable to something to be returned to
+ you later that will provide you with the data to return in a given
+ row. This could be the same pointer as what my_loop_context is
+ set to, or something different.
+
+ The put_index_data variable contains a list of snmp variable
+ bindings, one for each index in your table. Set the values of
+ each appropriately according to the data matching the first row
+ and return the put_index_data variable at the end of the function.
+*/
+typedef struct context_tree_ptr_s {
+ netsnmp_subtree *tree;
+ subtree_context_cache *context_ptr;
+} context_tree_ptr;
+
+netsnmp_variable_list *
+nsModuleTable_get_first_data_point(void **my_loop_context,
+ void **my_data_context,
+ netsnmp_variable_list * put_index_data,
+ netsnmp_iterator_info *otherstuff)
+{
+
+ struct variable_list *vptr;
+ u_long ultmp;
+ context_tree_ptr *ctree;
+
+ ctree = SNMP_MALLOC_TYPEDEF(context_tree_ptr);
+
+ ctree->context_ptr = get_top_context_cache();
+ /* Skip empty context registrations */
+ while (!ctree->context_ptr->first_subtree) {
+ ctree->context_ptr = ctree->context_ptr->next;
+ if (!ctree->context_ptr) {
+ SNMP_FREE(ctree);
+ return NULL;
+ }
+ }
+ ctree->tree = ctree->context_ptr->first_subtree;
+
+ *my_loop_context = ctree;
+ *my_data_context = ctree->tree;
+
+ vptr = put_index_data;
+ snmp_set_var_value(vptr, (u_char *) ctree->context_ptr->context_name,
+ strlen(ctree->context_ptr->context_name));
+
+ vptr = vptr->next_variable;
+ snmp_set_var_value(vptr,
+ (u_char *)ctree->context_ptr->first_subtree->name_a,
+ ctree->context_ptr->first_subtree->namelen *
+ sizeof(oid));
+
+ ultmp = ctree->context_ptr->first_subtree->priority;
+ vptr = vptr->next_variable;
+ snmp_set_var_value(vptr, (u_char *) & ultmp, sizeof(ultmp));
+
+ return put_index_data;
+}
+
+/** functionally the same as nsModuleTable_get_first_data_point, but
+ my_loop_context has already been set to a previous value and should
+ be updated to the next in the list. For example, if it was a
+ linked list, you might want to cast it and the return
+ my_loop_context->next. The my_data_context pointer should be set
+ to something you need later and the indexes in put_index_data
+ updated again. */
+
+struct variable_list *
+nsModuleTable_get_next_data_point(void **my_loop_context,
+ void **my_data_context,
+ struct variable_list *put_index_data,
+ netsnmp_iterator_info *otherstuff)
+{
+
+ struct variable_list *vptr;
+ context_tree_ptr *ctree = (context_tree_ptr *) * my_loop_context;
+ u_long ultmp;
+
+ if (ctree->tree->next)
+ ctree->tree = ctree->tree->next;
+ else {
+ ctree->context_ptr = ctree->context_ptr->next;
+ if (!ctree->context_ptr) {
+ return NULL;
+ }
+ ctree->tree = ctree->context_ptr->first_subtree;
+ }
+
+ *my_data_context = ctree->tree;
+
+ vptr = put_index_data;
+ snmp_set_var_value(vptr, (u_char *) ctree->context_ptr->context_name,
+ strlen(ctree->context_ptr->context_name));
+
+ vptr = vptr->next_variable;
+ snmp_set_var_value(vptr, (u_char *) ctree->tree->name_a,
+ ctree->tree->namelen * sizeof(oid));
+
+ ultmp = ctree->tree->priority;
+ vptr = vptr->next_variable;
+ snmp_set_var_value(vptr, (u_char *) & ultmp, sizeof(ultmp));
+
+ return put_index_data;
+}
+
+/** handles requests for the nsModuleTable table, if anything else needs to be done */
+int
+nsModuleTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_table_request_info *table_info;
+ netsnmp_request_info *request;
+ netsnmp_variable_list *var;
+ netsnmp_subtree *tree;
+ u_long ultmp;
+ u_char modes[1];
+
+ for (request = requests; request; request = request->next) {
+ var = request->requestvb;
+ if (request->processed != 0)
+ continue;
+
+ /*
+ * perform anything here that you need to do. The request have
+ * already been processed by the master table_dataset handler, but
+ * this gives you chance to act on the request in some other way if
+ * need be.
+ */
+
+ /*
+ * the following extracts the my_data_context pointer set in the
+ * loop functions above. You can then use the results to help
+ * return data for the columns of the nsModuleTable table in
+ * question
+ */
+ tree = (netsnmp_subtree *)netsnmp_extract_iterator_context(request);
+ if (tree == NULL) {
+ if (reqinfo->mode == MODE_GET) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ /*
+ * XXX: no row existed, if you support creation and this is a
+ * set, start dealing with it here, else continue
+ */
+ }
+
+ /*
+ * extracts the information about the table from the request
+ */
+ table_info = netsnmp_extract_table_info(request);
+
+ /*
+ * table_info->colnum contains the column number requested
+ */
+ /*
+ * table_info->indexes contains a linked list of snmp variable
+ * bindings for the indexes of the table. Values in the list have
+ * been set corresponding to the indexes of the request
+ */
+ if (table_info == NULL) {
+ continue;
+ }
+
+ switch (reqinfo->mode) {
+ /*
+ * the table_iterator helper should change all GETNEXTs into
+ * GETs for you automatically, so you don't have to worry
+ * about the GETNEXT case. Only GETs and SETs need to be
+ * dealt with here
+ */
+ case MODE_GET:
+ switch (table_info->colnum) {
+ case COLUMN_NSMODULENAME:
+ if (tree->reginfo->handlerName) {
+ snmp_set_var_typed_value(var, ASN_OCTET_STR,
+ tree->reginfo->handlerName,
+ strlen(tree->reginfo->handlerName));
+ } else {
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, "", 0);
+ }
+ break;
+
+ case COLUMN_NSMODULEMODES:
+ /*
+ * basically, these BITS needs to be inverted in order
+ */
+ modes[0] =
+ ((HANDLER_CAN_GETANDGETNEXT & tree->reginfo->
+ modes) << 7) | ((HANDLER_CAN_SET & tree->reginfo->
+ modes) << 5) | ((HANDLER_CAN_GETBULK
+ & tree->reginfo->
+ modes) << 3);
+ /* yuck */
+ snmp_set_var_typed_value(var, ASN_OCTET_STR, modes, 1);
+ break;
+
+ case COLUMN_NSMODULETIMEOUT:
+ ultmp = tree->timeout;
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (u_char *) & ultmp,
+ sizeof(u_long));
+ break;
+
+ default:
+ /*
+ * We shouldn't get here
+ */
+ snmp_log(LOG_ERR,
+ "problem encountered in nsModuleTable_handler: unknown column\n");
+ }
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "problem encountered in nsModuleTable_handler: unsupported mode\n");
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsModuleTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsModuleTable.h
new file mode 100644
index 0000000000..2a0e63c19b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsModuleTable.h
@@ -0,0 +1,27 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 1.5 2001/12/04 21:36:27 hardaker Exp $
+ */
+#ifndef NSMODULETABLE_H
+#define NSMODULETABLE_H
+
+/*
+ * function declarations
+ */
+void init_nsModuleTable(void);
+void initialize_table_nsModuleTable(void);
+Netsnmp_Node_Handler nsModuleTable_handler;
+
+Netsnmp_First_Data_Point nsModuleTable_get_first_data_point;
+Netsnmp_Next_Data_Point nsModuleTable_get_next_data_point;
+
+/*
+ * column number definitions for table nsModuleTable
+ */
+#define COLUMN_NSMCONTEXTNAME 1
+#define COLUMN_NSMREGISTRATIONPOINT 2
+#define COLUMN_NSMREGISTRATIONPRIORITY 3
+#define COLUMN_NSMODULENAME 4
+#define COLUMN_NSMODULEMODES 5
+#define COLUMN_NSMODULETIMEOUT 6
+#endif /* NSMODULETABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsTransactionTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsTransactionTable.c
new file mode 100644
index 0000000000..71f41887f7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsTransactionTable.c
@@ -0,0 +1,248 @@
+/*
+ * Note: this file originally auto-generated by mib2c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/table_iterator.h>
+#include "nsTransactionTable.h"
+
+/** Initialize the nsTransactionTable table by defining it's contents
+ and how it's structured */
+void
+initialize_table_nsTransactionTable(void)
+{
+ static oid nsTransactionTable_oid[] =
+ { 1, 3, 6, 1, 4, 1, 8072, 1, 8, 1 };
+ size_t nsTransactionTable_oid_len =
+ OID_LENGTH(nsTransactionTable_oid);
+ netsnmp_table_registration_info *table_info;
+ netsnmp_handler_registration *my_handler;
+ netsnmp_iterator_info *iinfo;
+
+ /*
+ * create the table structure itself
+ */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+ /*
+ * if your table is read only, it's easiest to change the
+ * HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY
+ */
+ my_handler = netsnmp_create_handler_registration("nsTransactionTable",
+ nsTransactionTable_handler,
+ nsTransactionTable_oid,
+ nsTransactionTable_oid_len,
+ HANDLER_CAN_RONLY);
+
+ if (!my_handler || !table_info || !iinfo) {
+ if (my_handler)
+ netsnmp_handler_registration_free(my_handler);
+ SNMP_FREE(table_info);
+ SNMP_FREE(iinfo);
+ return; /* mallocs failed */
+ }
+
+ /***************************************************
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_index(table_info, ASN_INTEGER); /* index:
+ * * nsTransactionID
+ */
+
+ table_info->min_column = 2;
+ table_info->max_column = 2;
+ iinfo->get_first_data_point = nsTransactionTable_get_first_data_point;
+ iinfo->get_next_data_point = nsTransactionTable_get_next_data_point;
+ iinfo->table_reginfo = table_info;
+
+ /***************************************************
+ * registering the table with the master agent
+ */
+ DEBUGMSGTL(("initialize_table_nsTransactionTable",
+ "Registering table nsTransactionTable as a table iterator\n"));
+ netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/** Initialzies the nsTransactionTable module */
+void
+init_nsTransactionTable(void)
+{
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ initialize_table_nsTransactionTable();
+}
+
+/** returns the first data point within the nsTransactionTable table data.
+
+ Set the my_loop_context variable to the first data point structure
+ of your choice (from which you can find the next one). This could
+ be anything from the first node in a linked list, to an integer
+ pointer containing the beginning of an array variable.
+
+ Set the my_data_context variable to something to be returned to
+ you later that will provide you with the data to return in a given
+ row. This could be the same pointer as what my_loop_context is
+ set to, or something different.
+
+ The put_index_data variable contains a list of snmp variable
+ bindings, one for each index in your table. Set the values of
+ each appropriately according to the data matching the first row
+ and return the put_index_data variable at the end of the function.
+*/
+extern netsnmp_agent_session *agent_delegated_list;
+
+netsnmp_variable_list *
+nsTransactionTable_get_first_data_point(void **my_loop_context,
+ void **my_data_context,
+ netsnmp_variable_list
+ * put_index_data,
+ netsnmp_iterator_info *iinfo)
+{
+
+ netsnmp_variable_list *vptr;
+
+ if (!agent_delegated_list)
+ return NULL;
+
+ *my_loop_context = (void *) agent_delegated_list;
+ *my_data_context = (void *) agent_delegated_list;
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr,
+ (u_char *) & agent_delegated_list->pdu->transid,
+ sizeof(agent_delegated_list->pdu->transid));
+
+ return put_index_data;
+}
+
+/** functionally the same as nsTransactionTable_get_first_data_point, but
+ my_loop_context has already been set to a previous value and should
+ be updated to the next in the list. For example, if it was a
+ linked list, you might want to cast it and the return
+ my_loop_context->next. The my_data_context pointer should be set
+ to something you need later and the indexes in put_index_data
+ updated again. */
+
+netsnmp_variable_list *
+nsTransactionTable_get_next_data_point(void **my_loop_context,
+ void **my_data_context,
+ netsnmp_variable_list
+ * put_index_data,
+ netsnmp_iterator_info *iinfo)
+{
+
+ netsnmp_variable_list *vptr;
+ netsnmp_agent_session *alist = (netsnmp_agent_session *)
+ *my_loop_context;
+
+ if (!alist->next)
+ return NULL;
+
+ alist = alist->next;
+
+ *my_loop_context = (void *) alist;
+ *my_data_context = (void *) alist;
+
+ vptr = put_index_data;
+
+ snmp_set_var_value(vptr, (u_char *) & alist->pdu->transid,
+ sizeof(alist->pdu->transid));
+ return put_index_data;
+}
+
+/** handles requests for the nsTransactionTable table, if anything
+ else needs to be done */
+int
+nsTransactionTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_table_request_info *table_info;
+ netsnmp_variable_list *var;
+ netsnmp_agent_session *asp;
+
+ for (; requests; requests = requests->next) {
+ var = requests->requestvb;
+ if (requests->processed != 0)
+ continue;
+
+ /*
+ * perform anything here that you need to do. The requests have
+ * already been processed by the master table_dataset handler, but
+ * this gives you chance to act on the request in some other way if
+ * need be.
+ */
+
+ /*
+ * the following extracts the my_data_context pointer set in the
+ * loop functions above. You can then use the results to help
+ * return data for the columns of the nsTransactionTable table in
+ * question
+ */
+ asp =
+ (netsnmp_agent_session *)
+ netsnmp_extract_iterator_context(requests);
+ if (asp == NULL) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_NOSUCHINSTANCE);
+ }
+
+ /*
+ * extracts the information about the table from the request
+ */
+ table_info = netsnmp_extract_table_info(requests);
+
+ /*
+ * table_info->colnum contains the column number requested
+ */
+ /*
+ * table_info->indexes contains a linked list of snmp variable
+ * bindings for the indexes of the table. Values in the list have
+ * been set corresponding to the indexes of the request
+ */
+ if (table_info == NULL) {
+ continue;
+ }
+
+ switch (reqinfo->mode) {
+ /*
+ * the table_iterator helper should change all GETNEXTs into
+ * GETs for you automatically, so you don't have to worry
+ * about the GETNEXT case. Only GETs and SETs need to be
+ * dealt with here
+ */
+ case MODE_GET:
+ switch (table_info->colnum) {
+
+ case COLUMN_NSTRANSACTIONMODE:
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (u_char *) & asp->mode,
+ sizeof(asp->mode));
+ break;
+
+ default:
+ /*
+ * We shouldn't get here
+ */
+ snmp_log(LOG_ERR,
+ "problem encountered in nsTransactionTable_handler: unknown column\n");
+ }
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "problem encountered in nsTransactionTable_handler: unsupported mode\n");
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsTransactionTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsTransactionTable.h
new file mode 100644
index 0000000000..db997dfced
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsTransactionTable.h
@@ -0,0 +1,21 @@
+/*
+ * Note: this file originally auto-generated by mib2c
+ */
+#ifndef NSTRANSACTIONTABLE_H
+#define NSTRANSACTIONTABLE_H
+
+/*
+ * function declarations
+ */
+void init_nsTransactionTable(void);
+void initialize_table_nsTransactionTable(void);
+Netsnmp_Node_Handler nsTransactionTable_handler;
+Netsnmp_First_Data_Point nsTransactionTable_get_first_data_point;
+Netsnmp_Next_Data_Point nsTransactionTable_get_next_data_point;
+
+/*
+ * column number definitions for table nsTransactionTable
+ */
+#define COLUMN_NSTRANSACTIONID 1
+#define COLUMN_NSTRANSACTIONMODE 2
+#endif /* NSTRANSACTIONTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsVacmAccessTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsVacmAccessTable.c
new file mode 100644
index 0000000000..599bf80071
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsVacmAccessTable.c
@@ -0,0 +1,339 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 5.17 2005/05/09 08:13:45 dts12 Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/library/vacm.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "nsVacmAccessTable.h"
+
+/** Initializes the nsVacmAccessTable module */
+void
+init_register_nsVacm_context(const char *context)
+{
+ /*
+ * Initialize the nsVacmAccessTable table by defining its
+ * contents and how it's structured
+ */
+ static oid nsVacmAccessTable_oid[] = { 1,3,6,1,4,1,8072,1,9,1 };
+ size_t nsVacmAccessTable_oid_len = OID_LENGTH(nsVacmAccessTable_oid);
+ netsnmp_handler_registration *reg;
+ netsnmp_iterator_info *iinfo;
+ netsnmp_table_registration_info *table_info;
+
+ reg = netsnmp_create_handler_registration("nsVacmAccessTable",
+ nsVacmAccessTable_handler,
+ nsVacmAccessTable_oid,
+ nsVacmAccessTable_oid_len,
+ HANDLER_CAN_RWRITE);
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_OCTET_STR, /* index: vacmGroupName */
+ ASN_OCTET_STR, /* index: vacmAccessContextPrefix */
+ ASN_INTEGER, /* index: vacmAccessSecurityModel */
+ ASN_INTEGER, /* index: vacmAccessSecurityLevel */
+ ASN_OCTET_STR, /* index: nsVacmAuthType */
+ 0);
+ table_info->min_column = COLUMN_NSVACMCONTEXTMATCH;
+ table_info->max_column = COLUMN_NSVACMACCESSSTATUS;
+
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+ iinfo->get_first_data_point = nsVacmAccessTable_get_first_data_point;
+ iinfo->get_next_data_point = nsVacmAccessTable_get_next_data_point;
+ iinfo->table_reginfo = table_info;
+
+ if ( context && context[0] )
+ reg->contextName = strdup(context);
+
+ netsnmp_register_table_iterator(reg, iinfo);
+}
+
+void
+init_nsVacmAccessTable(void)
+{
+ init_register_nsVacm_context("");
+}
+
+
+/*
+ * Iterator hook routines
+ */
+static int nsViewIdx; /* This should really be handled via the 'loop_context'
+ parameter, but it's easier (read lazier) to use a
+ global variable as well. Bad David! */
+
+netsnmp_variable_list *
+nsVacmAccessTable_get_first_data_point(void **my_loop_context,
+ void **my_data_context,
+ netsnmp_variable_list *put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+ vacm_scanAccessInit();
+ *my_loop_context = vacm_scanAccessNext();
+ nsViewIdx = 0;
+ return nsVacmAccessTable_get_next_data_point(my_loop_context,
+ my_data_context,
+ put_index_data, mydata);
+}
+
+netsnmp_variable_list *
+nsVacmAccessTable_get_next_data_point(void **my_loop_context,
+ void **my_data_context,
+ netsnmp_variable_list *put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+ struct vacm_accessEntry *entry =
+ (struct vacm_accessEntry *) *my_loop_context;
+ netsnmp_variable_list *idx;
+ int len;
+ char *cp;
+
+newView:
+ idx = put_index_data;
+ if ( nsViewIdx == VACM_MAX_VIEWS ) {
+ entry = vacm_scanAccessNext();
+ nsViewIdx = 0;
+ }
+ if (entry) {
+ len = entry->groupName[0];
+ snmp_set_var_value(idx, (u_char *)entry->groupName+1, len);
+ idx = idx->next_variable;
+ len = entry->contextPrefix[0];
+ snmp_set_var_value(idx, (u_char *)entry->contextPrefix+1, len);
+ idx = idx->next_variable;
+ snmp_set_var_value(idx, (u_char *)&entry->securityModel,
+ sizeof(entry->securityModel));
+ idx = idx->next_variable;
+ snmp_set_var_value(idx, (u_char *)&entry->securityLevel,
+ sizeof(entry->securityLevel));
+ /*
+ * Find the next valid authType view - skipping unused entries
+ */
+ idx = idx->next_variable;
+ for (; nsViewIdx < VACM_MAX_VIEWS; nsViewIdx++) {
+ if ( entry->views[ nsViewIdx ][0] )
+ break;
+ }
+ if ( nsViewIdx == VACM_MAX_VIEWS )
+ goto newView;
+ cp = se_find_label_in_slist(VACM_VIEW_ENUM_NAME, nsViewIdx++);
+ DEBUGMSGTL(("nsVacm", "nextDP %s:%s (%d)\n", entry->groupName+1, cp, nsViewIdx-1));
+ snmp_set_var_value(idx, (u_char *)cp, strlen(cp));
+ idx = idx->next_variable;
+ *my_data_context = (void *) entry;
+ *my_loop_context = (void *) entry;
+ return put_index_data;
+ } else {
+ return NULL;
+ }
+}
+
+
+/** handles requests for the nsVacmAccessTable table */
+int
+nsVacmAccessTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ netsnmp_variable_list *idx;
+ struct vacm_accessEntry *entry;
+ char atype[20];
+ int viewIdx, ret;
+ char *gName, *cPrefix;
+ int model, level;
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ entry = (struct vacm_accessEntry *)
+ netsnmp_extract_iterator_context(request);
+ table_info = netsnmp_extract_table_info(request);
+
+ /* Extract the authType token from the list of indexes */
+ idx = table_info->indexes->next_variable->next_variable->next_variable->next_variable;
+ memset(atype, 0, sizeof(atype));
+ strncpy(atype, (char *)idx->val.string, idx->val_len);
+ viewIdx = se_find_value_in_slist(VACM_VIEW_ENUM_NAME, atype);
+ DEBUGMSGTL(("nsVacm", "GET %s (%d)\n", idx->val.string, viewIdx));
+
+ if (!entry)
+ continue;
+
+ switch (table_info->colnum) {
+ case COLUMN_NSVACMCONTEXTMATCH:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->contextMatch);
+ break;
+ case COLUMN_NSVACMVIEWNAME:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *)entry->views[ viewIdx ],
+ strlen(entry->views[ viewIdx ]));
+ break;
+ case COLUMN_VACMACCESSSTORAGETYPE:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->storageType);
+ break;
+ case COLUMN_NSVACMACCESSSTATUS:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->status);
+ break;
+ }
+ }
+ break;
+
+ /*
+ * Write-support
+ */
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request = request->next) {
+ entry = (struct vacm_accessEntry *)
+ netsnmp_extract_iterator_context(request);
+ table_info = netsnmp_extract_table_info(request);
+ ret = SNMP_ERR_NOERROR;
+
+ switch (table_info->colnum) {
+ case COLUMN_NSVACMCONTEXTMATCH:
+ ret = netsnmp_check_vb_int_range(request->requestvb, 1, 2);
+ break;
+ case COLUMN_NSVACMVIEWNAME:
+ ret = netsnmp_check_vb_type_and_max_size(request->requestvb,
+ ASN_OCTET_STR,
+ VACM_MAX_STRING);
+ break;
+ case COLUMN_VACMACCESSSTORAGETYPE:
+ ret = netsnmp_check_vb_storagetype(request->requestvb,
+ (/*entry ? entry->storageType :*/ SNMP_STORAGE_NONE));
+ break;
+ case COLUMN_NSVACMACCESSSTATUS:
+ /*
+ * The usual 'check_vb_rowstatus' call is too simplistic
+ * to be used here. Because we're implementing a table
+ * within an existing table, it's quite possible for a
+ * the vacmAccessTable entry to exist, even if this is
+ * a "new" nsVacmAccessEntry.
+ *
+ * We can check that the value being assigned is suitable
+ * for a RowStatus syntax object, but the transition
+ * checks need to be done explicitly.
+ */
+ ret = netsnmp_check_vb_rowstatus_value(request->requestvb);
+ if ( ret != SNMP_ERR_NOERROR )
+ break;
+
+ /*
+ * Extract the authType token from the list of indexes
+ */
+ idx = table_info->indexes->next_variable->next_variable->next_variable->next_variable;
+ memset(atype, 0, sizeof(atype));
+ strncpy(atype, (char *)idx->val.string, idx->val_len);
+ viewIdx = se_find_value_in_slist(VACM_VIEW_ENUM_NAME, atype);
+ if ( viewIdx < 0 ) {
+ ret = SNMP_ERR_NOCREATION;
+ break;
+ }
+ switch ( *request->requestvb->val.integer ) {
+ case RS_ACTIVE:
+ case RS_NOTINSERVICE:
+ /* Check that this particular view is already set */
+ if ( !entry || !entry->views[viewIdx][0] )
+ ret = SNMP_ERR_INCONSISTENTVALUE;
+ break;
+ case RS_CREATEANDWAIT:
+ case RS_CREATEANDGO:
+ /* Check that this particular view is not yet set */
+ if ( entry && entry->views[viewIdx][0] )
+ ret = SNMP_ERR_INCONSISTENTVALUE;
+ break;
+ }
+ break;
+ } /* switch(colnum) */
+ if ( ret != SNMP_ERR_NOERROR ) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ for (request = requests; request; request = request->next) {
+ entry = (struct vacm_accessEntry *)
+ netsnmp_extract_iterator_context(request);
+ table_info = netsnmp_extract_table_info(request);
+
+ switch (table_info->colnum) {
+ case COLUMN_NSVACMACCESSSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ if (!entry) {
+ idx = table_info->indexes; gName = (char*)idx->val.string;
+ idx = idx->next_variable; cPrefix = (char*)idx->val.string;
+ idx = idx->next_variable; model = *idx->val.integer;
+ idx = idx->next_variable; level = *idx->val.integer;
+ entry = vacm_createAccessEntry( gName, cPrefix, model, level );
+ entry->storageType = ST_NONVOLATILE;
+ netsnmp_insert_iterator_context(request, (void*)entry);
+ }
+ }
+ }
+ }
+ break;
+
+ case MODE_SET_FREE:
+ case MODE_SET_UNDO:
+ /* XXX - TODO */
+ break;
+
+ case MODE_SET_ACTION:
+ /* ??? Empty ??? */
+ break;
+
+ case MODE_SET_COMMIT:
+ for (request = requests; request; request = request->next) {
+ entry = (struct vacm_accessEntry *)
+ netsnmp_extract_iterator_context(request);
+ table_info = netsnmp_extract_table_info(request);
+ if ( !entry )
+ continue; /* Shouldn't happen */
+
+ /* Extract the authType token from the list of indexes */
+ idx = table_info->indexes->next_variable->next_variable->next_variable->next_variable;
+ memset(atype, 0, sizeof(atype));
+ strncpy(atype, (char *)idx->val.string, idx->val_len);
+ viewIdx = se_find_value_in_slist(VACM_VIEW_ENUM_NAME, atype);
+
+ switch (table_info->colnum) {
+ case COLUMN_NSVACMCONTEXTMATCH:
+ entry->contextMatch = *request->requestvb->val.integer;
+ break;
+ case COLUMN_NSVACMVIEWNAME:
+ memset( entry->views[viewIdx], 0, VACMSTRINGLEN );
+ memcpy( entry->views[viewIdx], request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_VACMACCESSSTORAGETYPE:
+ entry->storageType = *request->requestvb->val.integer;
+ break;
+ case COLUMN_NSVACMACCESSSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_DESTROY:
+ memset( entry->views[viewIdx], 0, VACMSTRINGLEN );
+ break;
+ }
+ break;
+ }
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsVacmAccessTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsVacmAccessTable.h
new file mode 100644
index 0000000000..e7a7e2090e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent/nsVacmAccessTable.h
@@ -0,0 +1,27 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 5.17 2005/05/09 08:13:45 dts12 Exp $
+ */
+#ifndef NSVACMACCESSTABLE_H
+#define NSVACMACCESSTABLE_H
+
+config_add_mib(NET-SNMP-VACM-MIB)
+
+/*
+ * function declarations
+ */
+void init_nsVacmAccessTable(void);
+void initialize_table_nsVacmAccessTable(void);
+Netsnmp_Node_Handler nsVacmAccessTable_handler;
+Netsnmp_First_Data_Point nsVacmAccessTable_get_first_data_point;
+Netsnmp_Next_Data_Point nsVacmAccessTable_get_next_data_point;
+
+/*
+ * column number definitions for table nsVacmAccessTable
+ */
+#define COLUMN_NSVACMTOKEN 1
+#define COLUMN_NSVACMCONTEXTMATCH 2
+#define COLUMN_NSVACMVIEWNAME 3
+#define COLUMN_VACMACCESSSTORAGETYPE 4
+#define COLUMN_NSVACMACCESSSTATUS 5
+#endif /* NSVACMACCESSTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agent_mibs.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent_mibs.h
new file mode 100644
index 0000000000..8c0de1c2a4
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agent_mibs.h
@@ -0,0 +1,7 @@
+config_require(agent/nsTransactionTable)
+config_require(agent/nsModuleTable)
+config_require(agent/nsDebug)
+config_require(agent/nsCache)
+config_require(agent/nsLogging)
+config_require(agent/nsVacmAccessTable)
+config_add_mib(NET-SNMP-AGENT-MIB)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx.h
new file mode 100644
index 0000000000..de47fa8e89
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx.h
@@ -0,0 +1,6 @@
+#ifndef _AGENTX_MIBGROUP_H
+#define _AGENTX_MIBGROUP_H
+
+config_require(agentx/master)
+config_require(agentx/subagent)
+#endif /* _AGENTX_MIBGROUP_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/agentx_config.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/agentx_config.c
new file mode 100644
index 0000000000..90901ecf3c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/agentx_config.c
@@ -0,0 +1,251 @@
+/*
+ * AgentX Configuration
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if HAVE_PWD_H
+#include <pwd.h>
+#endif
+#if HAVE_GRP_H
+#include <grp.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "snmpd.h"
+#include "agentx/agentx_config.h"
+#include "agentx/protocol.h"
+
+/* ---------------------------------------------------------------------
+ *
+ * Common master and sub-agent
+ */
+void
+agentx_parse_agentx_socket(const char *token, char *cptr)
+{
+ DEBUGMSGTL(("agentx/config", "port spec: %s\n", cptr));
+ netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_X_SOCKET, cptr);
+}
+
+/* ---------------------------------------------------------------------
+ *
+ * Master agent
+ */
+#ifdef USING_AGENTX_MASTER_MODULE
+void
+agentx_parse_master(const char *token, char *cptr)
+{
+ int i = -1;
+ char buf[BUFSIZ];
+
+ if (!strcmp(cptr, "agentx") ||
+ !strcmp(cptr, "all") ||
+ !strcmp(cptr, "yes") || !strcmp(cptr, "on")) {
+ i = 1;
+ snmp_log(LOG_INFO, "Turning on AgentX master support.\n");
+ } else if (!strcmp(cptr, "no") || !strcmp(cptr, "off"))
+ i = 0;
+ else
+ i = atoi(cptr);
+
+ if (i < 0 || i > 1) {
+ sprintf(buf, "master '%s' unrecognised", cptr);
+ config_perror(buf);
+ } else
+ netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_AGENTX_MASTER, i);
+}
+
+void
+agentx_parse_agentx_perms(const char *token, char *cptr)
+{
+ char *socket_perm, *dir_perm, *socket_user, *socket_group;
+ int uid = -1;
+ int gid = -1;
+ int s_perm = -1;
+ int d_perm = -1;
+ char *st;
+#if HAVE_GETPWNAM && HAVE_PWD_H
+ struct passwd *pwd;
+#endif
+#if HAVE_GETGRNAM && HAVE_GRP_H
+ struct group *grp;
+#endif
+
+ DEBUGMSGTL(("agentx/config", "port permissions: %s\n", cptr));
+ socket_perm = strtok_r(cptr, " \t", &st);
+ dir_perm = strtok_r(NULL, " \t", &st);
+ socket_user = strtok_r(NULL, " \t", &st);
+ socket_group = strtok_r(NULL, " \t", &st);
+
+ if (socket_perm) {
+ s_perm = strtol(socket_perm, NULL, 8);
+ netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_X_SOCK_PERM, s_perm);
+ DEBUGMSGTL(("agentx/config", "socket permissions: %o (%d)\n",
+ s_perm, s_perm));
+ }
+ if (dir_perm) {
+ d_perm = strtol(dir_perm, NULL, 8);
+ netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_X_DIR_PERM, d_perm);
+ DEBUGMSGTL(("agentx/config", "directory permissions: %o (%d)\n",
+ d_perm, d_perm));
+ }
+
+ /*
+ * Try to handle numeric UIDs or user names for the socket owner
+ */
+ if (socket_user) {
+ uid = atoi(socket_user);
+ if ( uid == 0 ) {
+#if HAVE_GETPWNAM && HAVE_PWD_H
+ pwd = getpwnam( socket_user );
+ if (pwd)
+ uid = pwd->pw_uid;
+ else
+#endif
+ snmp_log(LOG_WARNING, "Can't identify AgentX socket user (%s).\n", socket_user);
+ }
+ if ( uid != 0 )
+ netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_X_SOCK_USER, uid);
+ DEBUGMSGTL(("agentx/config", "socket owner: %s (%d)\n",
+ socket_user, uid));
+ }
+
+ /*
+ * and similarly for the socket group ownership
+ */
+ if (socket_group) {
+ gid = atoi(socket_group);
+ if ( gid == 0 ) {
+#if HAVE_GETGRNAM && HAVE_GRP_H
+ grp = getgrnam( socket_group );
+ if (grp)
+ gid = grp->gr_gid;
+ else
+#endif
+ snmp_log(LOG_WARNING, "Can't identify AgentX socket group (%s).\n", socket_group);
+ }
+ if ( gid != 0 )
+ netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_X_SOCK_GROUP, gid);
+ DEBUGMSGTL(("agentx/config", "socket group: %s (%d)\n",
+ socket_group, gid));
+ }
+}
+
+void
+agentx_parse_agentx_timeout(const char *token, char *cptr)
+{
+ int x = atoi(cptr);
+ DEBUGMSGTL(("agentx/config/timeout", "%s\n", cptr));
+ netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_AGENTX_TIMEOUT, x * ONE_SEC);
+}
+
+void
+agentx_parse_agentx_retries(const char *token, char *cptr)
+{
+ int x = atoi(cptr);
+ DEBUGMSGTL(("agentx/config/retries", "%s\n", cptr));
+ netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_AGENTX_RETRIES, x);
+}
+#endif /* USING_AGENTX_MASTER_MODULE */
+
+/* ---------------------------------------------------------------------
+ *
+ * Sub-agent
+ */
+
+
+/* ---------------------------------------------------------------------
+ *
+ * Utility support routines
+ */
+void
+agentx_register_config_handler(const char *token,
+ void (*parser) (const char *, char *),
+ void (*releaser) (void), const char *help)
+{
+ DEBUGMSGTL(("agentx_register_app_config_handler",
+ "registering .conf token for \"%s\"\n", token));
+ register_config_handler(":agentx", token, parser, releaser, help);
+}
+
+void
+agentx_unregister_config_handler(const char *token)
+{
+ unregister_config_handler(":agentx", token);
+}
+
+void
+agentx_config_init(void)
+{
+ int agent_role = netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_ROLE);
+
+ /*
+ * Common tokens for master/subagent
+ */
+ netsnmp_register_default_domain("agentx", "unix tcp");
+ netsnmp_register_default_target("agentx", "unix", NETSNMP_AGENTX_SOCKET);
+#define val(x) __STRING(x)
+ netsnmp_register_default_target("agentx", "tcp", ":" val(AGENTX_PORT));
+#undef val
+ agentx_register_config_handler("agentxsocket",
+ agentx_parse_agentx_socket, NULL,
+ "AgentX bind address");
+#ifdef USING_AGENTX_MASTER_MODULE
+ /*
+ * tokens for master agent
+ */
+ if (MASTER_AGENT == agent_role) {
+ snmpd_register_config_handler("master",
+ agentx_parse_master, NULL,
+ "specify 'agentx' for AgentX support");
+ agentx_register_config_handler("agentxperms",
+ agentx_parse_agentx_perms, NULL,
+ "AgentX socket permissions: socket_perms [directory_perms [username|userid [groupname|groupid]]]");
+ agentx_register_config_handler("agentxRetries",
+ agentx_parse_agentx_retries, NULL,
+ "AgentX Retries");
+ agentx_register_config_handler("agentxTimeout",
+ agentx_parse_agentx_timeout, NULL,
+ "AgentX Timeout (seconds)");
+ }
+#endif /* USING_AGENTX_MASTER_MODULE */
+
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+ /*
+ * tokens for master agent
+ */
+ if (SUB_AGENT == agent_role) {
+ /*
+ * set up callbacks to initiate master agent pings for this session
+ */
+ netsnmp_ds_register_config(ASN_INTEGER,
+ netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_APPTYPE),
+ "agentxPingInterval",
+ NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL);
+ /* ping and/or reconnect by default every 15 seconds */
+ netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, 15);
+
+ }
+#endif /* USING_AGENTX_SUBAGENT_MODULE */
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/agentx_config.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/agentx_config.h
new file mode 100644
index 0000000000..9496a471ae
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/agentx_config.h
@@ -0,0 +1,18 @@
+#ifndef __AGENTX_CONFIG_H__
+#define __AGENTX_CONFIG_H__
+
+config_belongs_in(agent_module)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ void agentx_parse_master(const char *token, char *cptr);
+ void agentx_parse_agentx_socket(const char *token,
+ char *cptr);
+ void agentx_config_init(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __AGENTX_CONFIG_H__ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/client.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/client.c
new file mode 100644
index 0000000000..b77fc84d89
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/client.c
@@ -0,0 +1,498 @@
+/*
+ * AgentX utility routines
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <errno.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/agent_index.h>
+
+#include "agentx/protocol.h"
+#include "agentx/client.h"
+#include "agentx/subagent.h"
+
+extern struct timeval starttime;
+
+ /*
+ * AgentX handling utility routines
+ *
+ * Mostly wrappers round, or re-writes of
+ * the SNMP equivalents
+ */
+
+int
+agentx_synch_input(int op,
+ netsnmp_session * session,
+ int reqid, netsnmp_pdu *pdu, void *magic)
+{
+ struct synch_state *state = (struct synch_state *) magic;
+ struct timeval now, diff;
+
+ if (reqid != state->reqid) {
+ return handle_agentx_packet(op, session, reqid, pdu, magic);
+ }
+
+ DEBUGMSGTL(("agentx/subagent", "synching input, op 0x%02x\n", op));
+ state->waiting = 0;
+ if (op == NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE) {
+ if (pdu->command == AGENTX_MSG_RESPONSE) {
+ state->pdu = snmp_clone_pdu(pdu);
+ state->status = STAT_SUCCESS;
+ session->s_snmp_errno = SNMPERR_SUCCESS;
+
+ /*
+ * Synchronise sysUpTime with the master agent
+ */
+ gettimeofday(&now, NULL);
+ now.tv_sec--;
+ now.tv_usec += 1000000L;
+ diff.tv_sec = pdu->time / 100;
+ diff.tv_usec = (pdu->time - (diff.tv_sec * 100)) * 10000;
+ starttime.tv_sec = now.tv_sec - diff.tv_sec;
+ starttime.tv_usec = now.tv_usec - diff.tv_usec;
+ if (starttime.tv_usec > 1000000L) {
+ starttime.tv_usec -= 1000000L;
+ starttime.tv_sec++;
+ }
+ }
+ } else if (op == NETSNMP_CALLBACK_OP_TIMED_OUT) {
+ state->pdu = NULL;
+ state->status = STAT_TIMEOUT;
+ session->s_snmp_errno = SNMPERR_TIMEOUT;
+ } else if (op == NETSNMP_CALLBACK_OP_DISCONNECT) {
+ return handle_agentx_packet(op, session, reqid, pdu, magic);
+ }
+
+ return 1;
+}
+
+
+
+int
+agentx_synch_response(netsnmp_session * ss, netsnmp_pdu *pdu,
+ netsnmp_pdu **response)
+{
+ return snmp_synch_response_cb(ss, pdu, response, agentx_synch_input);
+}
+
+
+ /*
+ * AgentX PofE convenience functions
+ */
+
+int
+agentx_open_session(netsnmp_session * ss)
+{
+ netsnmp_pdu *pdu, *response;
+ extern oid version_sysoid[];
+ extern int version_sysoid_len;
+
+ DEBUGMSGTL(("agentx/subagent", "opening session \n"));
+ if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+ return 0;
+ }
+
+ pdu = snmp_pdu_create(AGENTX_MSG_OPEN);
+ if (pdu == NULL)
+ return 0;
+ pdu->time = 0;
+ snmp_add_var(pdu, version_sysoid, version_sysoid_len,
+ 's', "Net-SNMP AgentX sub-agent");
+
+ if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS)
+ return 0;
+
+ if (response->errstat != SNMP_ERR_NOERROR) {
+ snmp_free_pdu(response);
+ return 0;
+ }
+
+ ss->sessid = response->sessid;
+ snmp_free_pdu(response);
+
+ DEBUGMSGTL(("agentx/subagent", "open \n"));
+ return 1;
+}
+
+int
+agentx_close_session(netsnmp_session * ss, int why)
+{
+ netsnmp_pdu *pdu, *response;
+ DEBUGMSGTL(("agentx/subagent", "closing session\n"));
+
+ if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+ return 0;
+ }
+
+ pdu = snmp_pdu_create(AGENTX_MSG_CLOSE);
+ if (pdu == NULL)
+ return 0;
+ pdu->time = 0;
+ pdu->errstat = why;
+ pdu->sessid = ss->sessid;
+
+ if (agentx_synch_response(ss, pdu, &response) == STAT_SUCCESS)
+ snmp_free_pdu(response);
+ DEBUGMSGTL(("agentx/subagent", "closed\n"));
+
+ return 1;
+}
+
+int
+agentx_register(netsnmp_session * ss, oid start[], size_t startlen,
+ int priority, int range_subid, oid range_ubound,
+ int timeout, u_char flags, const char *contextName)
+{
+ netsnmp_pdu *pdu, *response;
+
+ DEBUGMSGTL(("agentx/subagent", "registering: "));
+ DEBUGMSGOIDRANGE(("agentx/subagent", start, startlen, range_subid,
+ range_ubound));
+ DEBUGMSG(("agentx/subagent", "\n"));
+
+ if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+ return 0;
+ }
+
+ pdu = snmp_pdu_create(AGENTX_MSG_REGISTER);
+ if (pdu == NULL) {
+ return 0;
+ }
+ pdu->time = timeout;
+ pdu->priority = priority;
+ pdu->sessid = ss->sessid;
+ pdu->range_subid = range_subid;
+ if (contextName) {
+ pdu->flags |= AGENTX_MSG_FLAG_NON_DEFAULT_CONTEXT;
+ pdu->community = strdup(contextName);
+ pdu->community_len = strlen(contextName);
+ }
+
+ if (flags & FULLY_QUALIFIED_INSTANCE) {
+ pdu->flags |= AGENTX_MSG_FLAG_INSTANCE_REGISTER;
+ }
+
+ if (range_subid) {
+ snmp_pdu_add_variable(pdu, start, startlen, ASN_OBJECT_ID,
+ (u_char *) start, startlen * sizeof(oid));
+ pdu->variables->val.objid[range_subid - 1] = range_ubound;
+ } else {
+ snmp_add_null_var(pdu, start, startlen);
+ }
+
+ if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS) {
+ DEBUGMSGTL(("agentx/subagent", "registering failed!\n"));
+ return 0;
+ }
+
+ if (response->errstat != SNMP_ERR_NOERROR) {
+ snmp_log(LOG_ERR,"registering pdu failed: %d!\n", response->errstat);
+ snmp_free_pdu(response);
+ return 0;
+ }
+
+ snmp_free_pdu(response);
+ DEBUGMSGTL(("agentx/subagent", "registered\n"));
+ return 1;
+}
+
+int
+agentx_unregister(netsnmp_session * ss, oid start[], size_t startlen,
+ int priority, int range_subid, oid range_ubound,
+ const char *contextName)
+{
+ netsnmp_pdu *pdu, *response;
+
+ if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+ return 0;
+ }
+
+ DEBUGMSGTL(("agentx/subagent", "unregistering: "));
+ DEBUGMSGOIDRANGE(("agentx/subagent", start, startlen, range_subid,
+ range_ubound));
+ DEBUGMSG(("agentx/subagent", "\n"));
+ pdu = snmp_pdu_create(AGENTX_MSG_UNREGISTER);
+ if (pdu == NULL) {
+ return 0;
+ }
+ pdu->time = 0;
+ pdu->priority = priority;
+ pdu->sessid = ss->sessid;
+ pdu->range_subid = range_subid;
+ if (contextName) {
+ pdu->flags |= AGENTX_MSG_FLAG_NON_DEFAULT_CONTEXT;
+ pdu->community = strdup(contextName);
+ pdu->community_len = strlen(contextName);
+ }
+
+ if (range_subid) {
+ snmp_pdu_add_variable(pdu, start, startlen, ASN_OBJECT_ID,
+ (u_char *) start, startlen * sizeof(oid));
+ pdu->variables->val.objid[range_subid - 1] = range_ubound;
+ } else {
+ snmp_add_null_var(pdu, start, startlen);
+ }
+
+ if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS)
+ return 0;
+
+ if (response->errstat != SNMP_ERR_NOERROR) {
+ snmp_free_pdu(response);
+ return 0;
+ }
+
+ snmp_free_pdu(response);
+ DEBUGMSGTL(("agentx/subagent", "unregistered\n"));
+ return 1;
+}
+
+netsnmp_variable_list *
+agentx_register_index(netsnmp_session * ss,
+ netsnmp_variable_list * varbind, int flags)
+{
+ netsnmp_pdu *pdu, *response;
+ netsnmp_variable_list *varbind2;
+
+ if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+ return NULL;
+ }
+
+ /*
+ * Make a copy of the index request varbind
+ * for the AgentX request PDU
+ * (since the pdu structure will be freed)
+ */
+ varbind2 =
+ (netsnmp_variable_list *) malloc(sizeof(netsnmp_variable_list));
+ if (varbind2 == NULL)
+ return NULL;
+ if (snmp_clone_var(varbind, varbind2)) {
+ snmp_free_varbind(varbind2);
+ return NULL;
+ }
+ if (varbind2->val.string == NULL)
+ varbind2->val.string = varbind2->buf; /* ensure it points somewhere */
+
+ pdu = snmp_pdu_create(AGENTX_MSG_INDEX_ALLOCATE);
+ if (pdu == NULL) {
+ snmp_free_varbind(varbind2);
+ return NULL;
+ }
+ pdu->time = 0;
+ pdu->sessid = ss->sessid;
+ if (flags == ALLOCATE_ANY_INDEX)
+ pdu->flags |= AGENTX_MSG_FLAG_ANY_INSTANCE;
+ if (flags == ALLOCATE_NEW_INDEX)
+ pdu->flags |= AGENTX_MSG_FLAG_NEW_INSTANCE;
+
+ /*
+ * Just send a single index request varbind.
+ * Although the AgentX protocol supports
+ * multiple index allocations in a single
+ * request, the model used in the net-snmp agent
+ * doesn't currently take advantage of this.
+ * I believe this is our prerogative - just as
+ * long as the master side Index request handler
+ * can cope with multiple index requests.
+ */
+ pdu->variables = varbind2;
+
+ if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS)
+ return NULL;
+
+ if (response->errstat != SNMP_ERR_NOERROR) {
+ snmp_free_pdu(response);
+ return NULL;
+ }
+
+ /*
+ * Unlink the (single) response varbind to return
+ * to the main driving index request routine.
+ *
+ * This is a memory leak, as nothing will ever
+ * release this varbind. If this becomes a problem,
+ * we'll need to keep a list of these here, and
+ * free the memory in the "index release" routine.
+ * But the master side never frees these either (by
+ * design, since it still needs them), so expecting
+ * the subagent to is discrimination, pure & simple :-)
+ */
+ varbind2 = response->variables;
+ response->variables = NULL;
+ snmp_free_pdu(response);
+ return varbind2;
+}
+
+int
+agentx_unregister_index(netsnmp_session * ss,
+ netsnmp_variable_list * varbind)
+{
+ netsnmp_pdu *pdu, *response;
+ netsnmp_variable_list *varbind2;
+
+ if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+ return -1;
+ }
+
+ /*
+ * Make a copy of the index request varbind
+ * for the AgentX request PDU
+ * (since the pdu structure will be freed)
+ */
+ varbind2 =
+ (netsnmp_variable_list *) malloc(sizeof(netsnmp_variable_list));
+ if (varbind2 == NULL)
+ return -1;
+ if (snmp_clone_var(varbind, varbind2)) {
+ snmp_free_varbind(varbind2);
+ return -1;
+ }
+
+ pdu = snmp_pdu_create(AGENTX_MSG_INDEX_DEALLOCATE);
+ if (pdu == NULL) {
+ snmp_free_varbind(varbind2);
+ return -1;
+ }
+ pdu->time = 0;
+ pdu->sessid = ss->sessid;
+
+ /*
+ * Just send a single index release varbind.
+ * (as above)
+ */
+ pdu->variables = varbind2;
+
+ if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS)
+ return -1;
+
+ if (response->errstat != SNMP_ERR_NOERROR) {
+ snmp_free_pdu(response);
+ return -1; /* XXX - say why */
+ }
+
+ snmp_free_pdu(response);
+ return SNMP_ERR_NOERROR;
+}
+
+int
+agentx_add_agentcaps(netsnmp_session * ss,
+ oid * agent_cap, size_t agent_caplen,
+ const char *descr)
+{
+ netsnmp_pdu *pdu, *response;
+
+ if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+ return 0;
+ }
+
+ pdu = snmp_pdu_create(AGENTX_MSG_ADD_AGENT_CAPS);
+ if (pdu == NULL)
+ return 0;
+ pdu->time = 0;
+ pdu->sessid = ss->sessid;
+ snmp_add_var(pdu, agent_cap, agent_caplen, 's', descr);
+
+ if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS)
+ return 0;
+
+ if (response->errstat != SNMP_ERR_NOERROR) {
+ snmp_free_pdu(response);
+ return 0;
+ }
+
+ snmp_free_pdu(response);
+ return 1;
+}
+
+int
+agentx_remove_agentcaps(netsnmp_session * ss,
+ oid * agent_cap, size_t agent_caplen)
+{
+ netsnmp_pdu *pdu, *response;
+
+ if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+ return 0;
+ }
+
+ pdu = snmp_pdu_create(AGENTX_MSG_REMOVE_AGENT_CAPS);
+ if (pdu == NULL)
+ return 0;
+ pdu->time = 0;
+ pdu->sessid = ss->sessid;
+ snmp_add_null_var(pdu, agent_cap, agent_caplen);
+
+ if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS)
+ return 0;
+
+ if (response->errstat != SNMP_ERR_NOERROR) {
+ snmp_free_pdu(response);
+ return 0;
+ }
+
+ snmp_free_pdu(response);
+ return 1;
+}
+
+int
+agentx_send_ping(netsnmp_session * ss)
+{
+ netsnmp_pdu *pdu, *response;
+
+ if (ss == NULL || !IS_AGENTX_VERSION(ss->version)) {
+ return 0;
+ }
+
+ pdu = snmp_pdu_create(AGENTX_MSG_PING);
+ if (pdu == NULL)
+ return 0;
+ pdu->time = 0;
+ pdu->sessid = ss->sessid;
+
+ if (agentx_synch_response(ss, pdu, &response) != STAT_SUCCESS)
+ return 0;
+
+ if (response->errstat != SNMP_ERR_NOERROR) {
+ snmp_free_pdu(response);
+ return 0;
+ }
+
+ snmp_free_pdu(response);
+ return 1;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/client.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/client.h
new file mode 100644
index 0000000000..cedeec0c05
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/client.h
@@ -0,0 +1,42 @@
+#ifndef AGENTX_CLIENT_H
+#define AGENTX_CLIENT_H
+
+config_belongs_in(agent_module)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ /*
+ * Utility functions for Agent Extensibility Protocol (RFC 2257)
+ *
+ */
+
+
+ int agentx_open_session(netsnmp_session *);
+ int agentx_close_session(netsnmp_session *, int);
+ int agentx_register(netsnmp_session *, oid *, size_t, int,
+ int, oid, int, u_char, const char *);
+ int agentx_unregister(netsnmp_session *, oid *, size_t,
+ int, int, oid, const char *);
+ netsnmp_variable_list *agentx_register_index(netsnmp_session *,
+ netsnmp_variable_list *,
+ int);
+ int agentx_unregister_index(netsnmp_session *,
+ netsnmp_variable_list *);
+ int agentx_add_agentcaps(netsnmp_session *, oid *, size_t,
+ const char *);
+ int agentx_remove_agentcaps(netsnmp_session *, oid *,
+ size_t);
+ int agentx_send_ping(netsnmp_session *);
+
+#define AGENTX_CLOSE_OTHER 1
+#define AGENTX_CLOSE_PARSE 2
+#define AGENTX_CLOSE_PROTOCOL 3
+#define AGENTX_CLOSE_TIMEOUT 4
+#define AGENTX_CLOSE_SHUTDOWN 5
+#define AGENTX_CLOSE_MANAGER 6
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* AGENTX_CLIENT_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/master.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/master.c
new file mode 100644
index 0000000000..1a66b72aff
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/master.c
@@ -0,0 +1,627 @@
+/*
+ * AgentX master agent
+ */
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_IO_H
+#include <io.h>
+#endif
+
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#include <errno.h>
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#define SNMP_NEED_REQUEST_LIST
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "snmpd.h"
+#include "agentx/protocol.h"
+#include "agentx/master_admin.h"
+
+void
+real_init_master(void)
+{
+ netsnmp_session sess, *session = NULL;
+ char *agentx_sockets;
+ char *cp1;
+
+#ifdef NETSNMP_TRANSPORT_UNIX_DOMAIN
+ int agentx_dir_perm;
+ int agentx_sock_perm;
+ int agentx_sock_user;
+ int agentx_sock_group;
+#endif
+
+ if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE) != MASTER_AGENT)
+ return;
+
+ if (netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_X_SOCKET)) {
+ agentx_sockets = strdup(netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_X_SOCKET));
+#ifdef NETSNMP_AGENTX_DOM_SOCK_ONLY
+ if (agentx_sockets[0] != '/') {
+ /* unix:/path */
+ if (agentx_sockets[5] != '/') {
+ snmp_log(LOG_ERR,
+ "Error: %s transport is not supported, disabling agentx/master.\n", agentx_sockets);
+ SNMP_FREE(agentx_sockets);
+ return;
+ }
+ }
+#endif
+ } else {
+ agentx_sockets = strdup("");
+ }
+
+
+ DEBUGMSGTL(("agentx/master", "initializing...\n"));
+ snmp_sess_init(&sess);
+ sess.version = AGENTX_VERSION_1;
+ sess.flags |= SNMP_FLAGS_STREAM_SOCKET;
+ sess.timeout = netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_AGENTX_TIMEOUT);
+ sess.retries = netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_AGENTX_RETRIES);
+ cp1 = agentx_sockets;
+ while (cp1) {
+ netsnmp_transport *t;
+ /*
+ * If the AgentX socket string contains multiple descriptors,
+ * then pick this apart and handle them one by one.
+ *
+ */
+ sess.peername = cp1;
+ cp1 = strchr(sess.peername, ',');
+ if (cp1 != NULL) {
+ *cp1++ = '\0';
+ }
+
+ if (sess.peername[0] == '/') {
+#ifdef NETSNMP_TRANSPORT_UNIX_DOMAIN
+ /*
+ * If this is a Unix pathname,
+ * try and create the directory first.
+ */
+ agentx_dir_perm = netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_X_DIR_PERM);
+ if (agentx_dir_perm == 0)
+ agentx_dir_perm = NETSNMP_AGENT_DIRECTORY_MODE;
+ if (mkdirhier(sess.peername, (mode_t)agentx_dir_perm, 1)) {
+ snmp_log(LOG_ERR,
+ "Failed to create the directory for the agentX socket: %s\n",
+ sess.peername);
+ }
+#else
+ netsnmp_sess_log_error(LOG_WARNING,
+ "unix domain support not available\n",
+ &sess);
+#endif
+ }
+
+ /*
+ * Otherwise, let 'snmp_open' interpret the string.
+ */
+ sess.local_port = AGENTX_PORT; /* Indicate server & set default port */
+ sess.remote_port = 0;
+ sess.callback = handle_master_agentx_packet;
+ errno = 0;
+ t = netsnmp_transport_open_server("agentx", sess.peername);
+ if (t == NULL && errno == EADDRINUSE) {
+ /*
+ * Could be a left-over socket (now deleted)
+ * Try again
+ */
+ t = netsnmp_transport_open_server("agentx", sess.peername);
+ }
+ if (t == NULL) {
+ /*
+ * diagnose snmp_open errors with the input netsnmp_session
+ * pointer.
+ */
+ char buf[1024];
+ if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+ snprintf(buf, sizeof(buf),
+ "Error: Couldn't open a master agentx socket to "
+ "listen on (%s)", sess.peername);
+ snmp_sess_perror(buf, &sess);
+ exit(1);
+ } else {
+ snprintf(buf, sizeof(buf),
+ "Warning: Couldn't open a master agentx socket to "
+ "listen on (%s)", sess.peername);
+ netsnmp_sess_log_error(LOG_WARNING, buf, &sess);
+ }
+ } else {
+#ifdef NETSNMP_TRANSPORT_UNIX_DOMAIN
+ if (t->domain == netsnmp_UnixDomain && t->local != NULL) {
+ char name[sizeof(struct sockaddr_un) + 1];
+ memcpy(name, t->local, t->local_length);
+ name[t->local_length] = '\0';
+ /*
+ * Apply any settings to the ownership/permissions of the
+ * AgentX socket
+ */
+ agentx_sock_perm =
+ netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_X_SOCK_PERM);
+ agentx_sock_user =
+ netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_X_SOCK_USER);
+ agentx_sock_group =
+ netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_X_SOCK_GROUP);
+
+ if (agentx_sock_perm != 0)
+ chmod(name, agentx_sock_perm);
+
+ if (agentx_sock_user || agentx_sock_group) {
+ /*
+ * If either of user or group haven't been set,
+ * then leave them unchanged.
+ */
+ if (agentx_sock_user == 0 )
+ agentx_sock_user = -1;
+ if (agentx_sock_group == 0 )
+ agentx_sock_group = -1;
+ chown(name, agentx_sock_user, agentx_sock_group);
+ }
+ }
+#endif
+ session =
+ snmp_add_full(&sess, t, NULL, agentx_parse, NULL, NULL,
+ agentx_realloc_build, agentx_check_packet, NULL);
+ }
+ if (session == NULL) {
+ netsnmp_transport_free(t);
+ }
+ }
+
+ SNMP_FREE(agentx_sockets);
+ DEBUGMSGTL(("agentx/master", "initializing... DONE\n"));
+}
+
+ /*
+ * Handle the response from an AgentX subagent,
+ * merging the answers back into the original query
+ */
+int
+agentx_got_response(int operation,
+ netsnmp_session * session,
+ int reqid, netsnmp_pdu *pdu, void *magic)
+{
+ netsnmp_delegated_cache *cache = (netsnmp_delegated_cache *) magic;
+ int i, ret;
+ netsnmp_request_info *requests, *request;
+ netsnmp_variable_list *var;
+ netsnmp_session *ax_session;
+
+ cache = netsnmp_handler_check_cache(cache);
+ if (!cache) {
+ DEBUGMSGTL(("agentx/master", "response too late on session %08p\n",
+ session));
+ return 0;
+ }
+ requests = cache->requests;
+
+ switch (operation) {
+ case NETSNMP_CALLBACK_OP_TIMED_OUT:{
+ void *s = snmp_sess_pointer(session);
+ DEBUGMSGTL(("agentx/master", "timeout on session %08p\n",
+ session));
+
+ netsnmp_handler_mark_requests_as_delegated(requests,
+ REQUEST_IS_NOT_DELEGATED);
+ netsnmp_set_request_error(cache->reqinfo, requests,
+ /* XXXWWW: should be index=0 */
+ SNMP_ERR_GENERR);
+
+ /*
+ * This is a bit sledgehammer because the other sessions on this
+ * transport may be okay (e.g. some thread in the subagent has
+ * wedged, but the others are alright). OTOH the overwhelming
+ * probability is that the whole agent has died somehow.
+ */
+
+ if (s != NULL) {
+ netsnmp_transport *t = snmp_sess_transport(s);
+ close_agentx_session(session, -1);
+
+ if (t != NULL) {
+ DEBUGMSGTL(("agentx/master", "close transport\n"));
+ t->f_close(t);
+ } else {
+ DEBUGMSGTL(("agentx/master", "NULL transport??\n"));
+ }
+ } else {
+ DEBUGMSGTL(("agentx/master", "NULL sess_pointer??\n"));
+ }
+ ax_session = (netsnmp_session *) cache->localinfo;
+ netsnmp_free_agent_snmp_session_by_session(ax_session, NULL);
+ netsnmp_free_delegated_cache(cache);
+ return 0;
+ }
+
+ case NETSNMP_CALLBACK_OP_DISCONNECT:
+ case NETSNMP_CALLBACK_OP_SEND_FAILED:
+ if (operation == NETSNMP_CALLBACK_OP_DISCONNECT) {
+ DEBUGMSGTL(("agentx/master", "disconnect on session %08p\n",
+ session));
+ } else {
+ DEBUGMSGTL(("agentx/master", "send failed on session %08p\n",
+ session));
+ }
+ close_agentx_session(session, -1);
+ netsnmp_handler_mark_requests_as_delegated(requests,
+ REQUEST_IS_NOT_DELEGATED);
+ netsnmp_set_request_error(cache->reqinfo, requests, /* XXXWWW: should be index=0 */
+ SNMP_ERR_GENERR);
+ netsnmp_free_delegated_cache(cache);
+ return 0;
+
+ case NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE:
+ /*
+ * This session is alive
+ */
+ CLEAR_SNMP_STRIKE_FLAGS(session->flags);
+ break;
+ default:
+ snmp_log(LOG_ERR, "Unknown operation %d in agentx_got_response\n",
+ operation);
+ netsnmp_free_delegated_cache(cache);
+ return 0;
+ }
+
+ DEBUGMSGTL(("agentx/master", "got response errstat=%d, (req=0x%x,trans="
+ "0x%x,sess=0x%x)\n",
+ pdu->errstat,pdu->reqid,pdu->transid, pdu->sessid));
+
+ if (pdu->errstat != AGENTX_ERR_NOERROR) {
+ /* [RFC 2471 - 7.2.5.2.]
+ *
+ * 1) For any received AgentX response PDU, if res.error is
+ * not `noError', the SNMP response PDU's error code is
+ * set to this value. If res.error contains an AgentX
+ * specific value (e.g. `parseError'), the SNMP response
+ * PDU's error code is set to a value of genErr instead.
+ * Also, the SNMP response PDU's error index is set to
+ * the index of the variable binding corresponding to the
+ * failed VarBind in the subagent's AgentX response PDU.
+ *
+ * All other AgentX response PDUs received due to
+ * processing this SNMP request are ignored. Processing
+ * is complete; the SNMP Response PDU is ready to be sent
+ * (see section 7.2.6, "Sending the SNMP Response-PDU").
+ */
+ int err;
+
+ DEBUGMSGTL(("agentx/master",
+ "agentx_got_response() error branch\n"));
+
+ switch (pdu->errstat) {
+ case AGENTX_ERR_PARSE_FAILED:
+ case AGENTX_ERR_REQUEST_DENIED:
+ case AGENTX_ERR_PROCESSING_ERROR:
+ err = SNMP_ERR_GENERR;
+ break;
+ default:
+ err = pdu->errstat;
+ }
+
+ ret = 0;
+ for (request = requests, i = 1; request;
+ request = request->next, i++) {
+ if (i == pdu->errindex) {
+ /*
+ * Mark this varbind as the one generating the error.
+ * Note that the AgentX errindex may not match the
+ * position in the original SNMP PDU (request->index)
+ */
+ netsnmp_set_request_error(cache->reqinfo, request,
+ err);
+ ret = 1;
+ }
+ request->delegated = REQUEST_IS_NOT_DELEGATED;
+ }
+ if (!ret) {
+ /*
+ * ack, unknown, mark the first one
+ */
+ netsnmp_set_request_error(cache->reqinfo, requests,
+ SNMP_ERR_GENERR);
+ }
+ netsnmp_free_delegated_cache(cache);
+ DEBUGMSGTL(("agentx/master", "end error branch\n"));
+ return 1;
+ } else if (cache->reqinfo->mode == MODE_GET ||
+ cache->reqinfo->mode == MODE_GETNEXT ||
+ cache->reqinfo->mode == MODE_GETBULK) {
+ /*
+ * Replace varbinds for data request types, but not SETs.
+ */
+ DEBUGMSGTL(("agentx/master",
+ "agentx_got_response() beginning...\n"));
+ for (var = pdu->variables, request = requests; request && var;
+ request = request->next, var = var->next_variable) {
+ /*
+ * Otherwise, process successful requests
+ */
+ DEBUGMSGTL(("agentx/master",
+ " handle_agentx_response: processing: "));
+ DEBUGMSGOID(("agentx/master", var->name, var->name_length));
+ DEBUGMSG(("agentx/master", "\n"));
+ if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_VERBOSE)) {
+ DEBUGMSGTL(("snmp_agent", " >> "));
+ DEBUGMSGVAR(("snmp_agent", var));
+ DEBUGMSG(("snmp_agent", "\n"));
+ }
+
+ /*
+ * update the oid in the original request
+ */
+ if (var->type != SNMP_ENDOFMIBVIEW) {
+ snmp_set_var_typed_value(request->requestvb, var->type,
+ var->val.string, var->val_len);
+ snmp_set_var_objid(request->requestvb, var->name,
+ var->name_length);
+ }
+ request->delegated = REQUEST_IS_NOT_DELEGATED;
+ }
+
+ if (request || var) {
+ /*
+ * ack, this is bad. The # of varbinds don't match and
+ * there is no way to fix the problem
+ */
+ snmp_log(LOG_ERR,
+ "response to agentx request illegal. bailing out.\n");
+ netsnmp_set_request_error(cache->reqinfo, requests,
+ SNMP_ERR_GENERR);
+ }
+
+ if (cache->reqinfo->mode == MODE_GETBULK)
+ netsnmp_bulk_to_next_fix_requests(requests);
+ } else {
+ /*
+ * mark set requests as handled
+ */
+ for (request = requests; request; request = request->next) {
+ request->delegated = REQUEST_IS_NOT_DELEGATED;
+ }
+ }
+ DEBUGMSGTL(("agentx/master",
+ "handle_agentx_response() finishing...\n"));
+ netsnmp_free_delegated_cache(cache);
+ return 1;
+}
+
+/*
+ *
+ * AgentX State diagram. [mode] = internal mode it's mapped from:
+ *
+ * TESTSET -success-> COMMIT -success-> CLEANUP
+ * [RESERVE1] [ACTION] [COMMIT]
+ * | |
+ * | \--failure-> UNDO
+ * | [UNDO]
+ * |
+ * --failure-> CLEANUP
+ * [FREE]
+ */
+int
+agentx_master_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ netsnmp_session *ax_session = (netsnmp_session *) handler->myvoid;
+ netsnmp_request_info *request = requests;
+ netsnmp_pdu *pdu;
+ void *cb_data;
+ int result;
+
+ DEBUGMSGTL(("agentx/master",
+ "agentx master handler starting, mode = 0x%02x\n",
+ reqinfo->mode));
+
+ if (!ax_session) {
+ netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_GENERR);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * build a new pdu based on the pdu type coming in
+ */
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ pdu = snmp_pdu_create(AGENTX_MSG_GET);
+ break;
+
+ case MODE_GETNEXT:
+ pdu = snmp_pdu_create(AGENTX_MSG_GETNEXT);
+ break;
+
+ case MODE_GETBULK: /* WWWXXX */
+ pdu = snmp_pdu_create(AGENTX_MSG_GETNEXT);
+ break;
+
+ case MODE_SET_RESERVE1:
+ pdu = snmp_pdu_create(AGENTX_MSG_TESTSET);
+ break;
+
+ case MODE_SET_RESERVE2:
+ /*
+ * don't do anything here for AgentX. Assume all is fine
+ * and go on since AgentX only has one test phase.
+ */
+ return SNMP_ERR_NOERROR;
+
+ case MODE_SET_ACTION:
+ pdu = snmp_pdu_create(AGENTX_MSG_COMMITSET);
+ break;
+
+ case MODE_SET_UNDO:
+ pdu = snmp_pdu_create(AGENTX_MSG_UNDOSET);
+ break;
+
+ case MODE_SET_COMMIT:
+ case MODE_SET_FREE:
+ pdu = snmp_pdu_create(AGENTX_MSG_CLEANUPSET);
+ break;
+
+ default:
+ snmp_log(LOG_WARNING,
+ "unsupported mode for agentx/master called\n");
+ return SNMP_ERR_NOERROR;
+ }
+
+ if (!pdu) {
+ netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_GENERR);
+ return SNMP_ERR_NOERROR;
+ }
+
+ pdu->version = AGENTX_VERSION_1;
+ pdu->reqid = snmp_get_next_transid();
+ pdu->transid = reqinfo->asp->pdu->transid;
+ pdu->sessid = ax_session->subsession->sessid;
+ if (reginfo->contextName) {
+ pdu->community = strdup(reginfo->contextName);
+ pdu->community_len = strlen(reginfo->contextName);
+ pdu->flags |= AGENTX_MSG_FLAG_NON_DEFAULT_CONTEXT;
+ }
+ if (ax_session->subsession->flags & AGENTX_MSG_FLAG_NETWORK_BYTE_ORDER)
+ pdu->flags |= AGENTX_MSG_FLAG_NETWORK_BYTE_ORDER;
+
+ while (request) {
+
+ size_t nlen = request->requestvb->name_length;
+ oid *nptr = request->requestvb->name;
+
+ DEBUGMSGTL(("agentx/master","request for variable ("));
+ DEBUGMSGOID(("agentx/master", nptr, nlen));
+ DEBUGMSG(("agentx/master", ")\n"));
+
+ /*
+ * loop through all the requests and create agentx ones out of them
+ */
+
+ if (reqinfo->mode == MODE_GETNEXT || reqinfo->mode == MODE_GETBULK) {
+
+ if (snmp_oid_compare(nptr, nlen, request->subtree->start_a,
+ request->subtree->start_len) < 0) {
+ DEBUGMSGTL(("agentx/master","inexact request preceeding region ("));
+ DEBUGMSGOID(("agentx/master", request->subtree->start_a,
+ request->subtree->start_len));
+ DEBUGMSG(("agentx/master", ")\n"));
+ nptr = request->subtree->start_a;
+ nlen = request->subtree->start_len;
+ request->inclusive = 1;
+ }
+
+ if (request->inclusive) {
+ DEBUGMSGTL(("agentx/master", "INCLUSIVE varbind "));
+ DEBUGMSGOID(("agentx/master", nptr, nlen));
+ DEBUGMSG(("agentx/master", " scoped to "));
+ DEBUGMSGOID(("agentx/master", request->range_end,
+ request->range_end_len));
+ DEBUGMSG(("agentx/master", "\n"));
+ snmp_pdu_add_variable(pdu, nptr, nlen, ASN_PRIV_INCL_RANGE,
+ (u_char *) request->range_end,
+ request->range_end_len *
+ sizeof(oid));
+ request->inclusive = 0;
+ } else {
+ DEBUGMSGTL(("agentx/master", "EXCLUSIVE varbind "));
+ DEBUGMSGOID(("agentx/master", nptr, nlen));
+ DEBUGMSG(("agentx/master", " scoped to "));
+ DEBUGMSGOID(("agentx/master", request->range_end,
+ request->range_end_len));
+ DEBUGMSG(("agentx/master", "\n"));
+ snmp_pdu_add_variable(pdu, nptr, nlen, ASN_PRIV_EXCL_RANGE,
+ (u_char *) request->range_end,
+ request->range_end_len *
+ sizeof(oid));
+ }
+ } else {
+ snmp_pdu_add_variable(pdu, request->requestvb->name,
+ request->requestvb->name_length,
+ request->requestvb->type,
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ }
+
+ /*
+ * mark the request as delayed
+ */
+ if (pdu->command != AGENTX_MSG_CLEANUPSET)
+ request->delegated = REQUEST_IS_DELEGATED;
+ else
+ request->delegated = REQUEST_IS_NOT_DELEGATED;
+
+ /*
+ * next...
+ */
+ request = request->next;
+ }
+
+ /*
+ * When the master sends a CleanupSet PDU, it will never get a response
+ * back from the subagent. So we shouldn't allocate the
+ * netsnmp_delegated_cache structure in this case.
+ */
+ if (pdu->command != AGENTX_MSG_CLEANUPSET)
+ cb_data = netsnmp_create_delegated_cache(handler, reginfo,
+ reqinfo, requests,
+ (void *) ax_session);
+ else
+ cb_data = NULL;
+
+ /*
+ * send the requests out.
+ */
+ DEBUGMSGTL(("agentx", "sending pdu (req=0x%x,trans=0x%x,sess=0x%x)\n",
+ pdu->reqid,pdu->transid, pdu->sessid));
+ result = snmp_async_send(ax_session, pdu, agentx_got_response, cb_data);
+
+ if (result == 0 ) {
+ snmp_free_pdu( pdu );
+ }
+
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/master.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/master.h
new file mode 100644
index 0000000000..b6a7f6bbc4
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/master.h
@@ -0,0 +1,16 @@
+#ifndef _AGENTX_MASTER_H
+#define _AGENTX_MASTER_H
+
+config_belongs_in(agent_module)
+
+config_require(agentx/protocol)
+config_require(agentx/client)
+config_require(agentx/master_admin)
+config_require(agentx/agentx_config)
+config_require(mibII/sysORTable)
+
+ void init_master(void);
+ void real_init_master(void);
+ Netsnmp_Node_Handler agentx_master_handler;
+
+#endif /* _AGENTX_MASTER_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/master_admin.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/master_admin.c
new file mode 100644
index 0000000000..a04b18a52c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/master_admin.c
@@ -0,0 +1,599 @@
+/*
+ * AgentX Administrative request handling
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "agentx/protocol.h"
+#include "agentx/client.h"
+
+#include <net-snmp/agent/agent_index.h>
+#include <net-snmp/agent/agent_trap.h>
+#include <net-snmp/agent/agent_callbacks.h>
+#include "mibII/sysORTable.h"
+#include "master.h"
+
+extern struct timeval starttime;
+
+
+
+netsnmp_session *
+find_agentx_session(netsnmp_session * session, int sessid)
+{
+ netsnmp_session *sp;
+ for (sp = session->subsession; sp != NULL; sp = sp->next) {
+ if (sp->sessid == sessid)
+ return sp;
+ }
+ return NULL;
+}
+
+
+int
+open_agentx_session(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+ netsnmp_session *sp;
+ struct timeval now;
+
+ DEBUGMSGTL(("agentx/master", "open %08p\n", session));
+ sp = (netsnmp_session *) malloc(sizeof(netsnmp_session));
+ if (sp == NULL) {
+ session->s_snmp_errno = AGENTX_ERR_OPEN_FAILED;
+ return -1;
+ }
+
+ memcpy(sp, session, sizeof(netsnmp_session));
+ sp->sessid = snmp_get_next_sessid();
+ sp->version = pdu->version;
+ sp->timeout = pdu->time;
+
+ /*
+ * Be careful with fields: if these aren't zeroed, they will get free()d
+ * more than once when the session is closed -- once in the main session,
+ * and once in each subsession. Basically, if it's not being used for
+ * some AgentX-specific purpose, it ought to be zeroed here.
+ */
+
+ sp->community = NULL;
+ sp->peername = NULL;
+ sp->contextEngineID = NULL;
+ sp->contextName = NULL;
+ sp->securityEngineID = NULL;
+ sp->securityPrivProto = NULL;
+
+ /*
+ * This next bit utilises unused SNMPv3 fields
+ * to store the subagent OID and description.
+ * This really ought to use AgentX-specific fields,
+ * but it hardly seems worth it for a one-off use.
+ *
+ * But I'm willing to be persuaded otherwise.... */
+ sp->securityAuthProto = snmp_duplicate_objid(pdu->variables->name,
+ pdu->variables->
+ name_length);
+ sp->securityAuthProtoLen = pdu->variables->name_length;
+ sp->securityName = strdup((char *) pdu->variables->val.string);
+ gettimeofday(&now, NULL);
+ sp->engineTime = calculate_time_diff(&now, &starttime);
+
+ sp->subsession = session; /* link back to head */
+ sp->flags |= SNMP_FLAGS_SUBSESSION;
+ sp->flags &= ~AGENTX_MSG_FLAG_NETWORK_BYTE_ORDER;
+ sp->flags |= (pdu->flags & AGENTX_MSG_FLAG_NETWORK_BYTE_ORDER);
+ sp->next = session->subsession;
+ session->subsession = sp;
+ DEBUGMSGTL(("agentx/master", "opened %08p = %d with flags = %02x\n",
+ sp, sp->sessid, sp->flags & AGENTX_MSG_FLAGS_MASK));
+
+ return sp->sessid;
+}
+
+int
+close_agentx_session(netsnmp_session * session, int sessid)
+{
+ netsnmp_session *sp, **prevNext;
+
+ if (!session)
+ return AGENTX_ERR_NOT_OPEN;
+
+ DEBUGMSGTL(("agentx/master", "close %08p, %d\n", session, sessid));
+ if (sessid == -1) {
+ /*
+ * The following is necessary to avoid locking up the agent when
+ * a sugagent dies during a set request. We must clean up the
+ * requests, so that the delegated request will be completed and
+ * further requests can be processed
+ */
+ netsnmp_remove_delegated_requests_for_session(session);
+ if (session->subsession != NULL) {
+ netsnmp_session *subsession = session->subsession;
+ for(; subsession; subsession = subsession->next) {
+ netsnmp_remove_delegated_requests_for_session(subsession);
+ }
+ }
+
+ unregister_mibs_by_session(session);
+ unregister_index_by_session(session);
+ snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_REQ_UNREG_SYSOR_SESS,
+ (void*)session);
+ SNMP_FREE(session->myvoid);
+ return AGENTX_ERR_NOERROR;
+ }
+
+ prevNext = &(session->subsession);
+
+ for (sp = session->subsession; sp != NULL; sp = sp->next) {
+
+ if (sp->sessid == sessid) {
+ unregister_mibs_by_session(sp);
+ unregister_index_by_session(sp);
+ snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_REQ_UNREG_SYSOR_SESS,
+ (void*)sp);
+
+ *prevNext = sp->next;
+
+ if (sp->securityAuthProto != NULL) {
+ free(sp->securityAuthProto);
+ }
+ if (sp->securityName != NULL) {
+ free(sp->securityName);
+ }
+ free(sp);
+ sp = NULL;
+
+ DEBUGMSGTL(("agentx/master", "closed %08p, %d okay\n",
+ session, sessid));
+ return AGENTX_ERR_NOERROR;
+ }
+
+ prevNext = &(sp->next);
+ }
+
+ DEBUGMSGTL(("agentx/master", "sessid %d not found\n", sessid));
+ return AGENTX_ERR_NOT_OPEN;
+}
+
+int
+register_agentx_list(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+ netsnmp_session *sp;
+ char buf[128];
+ oid ubound = 0;
+ u_long flags = 0;
+ netsnmp_handler_registration *reg;
+ int rc = 0;
+ int cacheid;
+
+ DEBUGMSGTL(("agentx/master", "in register_agentx_list\n"));
+
+ sp = find_agentx_session(session, pdu->sessid);
+ if (sp == NULL)
+ return AGENTX_ERR_NOT_OPEN;
+
+ sprintf(buf, "AgentX subagent %ld, session %8p, subsession %8p",
+ sp->sessid, session, sp);
+ /*
+ * * TODO: registration timeout
+ * * registration context
+ */
+ if (pdu->range_subid) {
+ ubound = pdu->variables->val.objid[pdu->range_subid - 1];
+ }
+
+ if (pdu->flags & AGENTX_MSG_FLAG_INSTANCE_REGISTER) {
+ flags = FULLY_QUALIFIED_INSTANCE;
+ }
+
+ reg = netsnmp_create_handler_registration(buf, agentx_master_handler, pdu->variables->name, pdu->variables->name_length, HANDLER_CAN_RWRITE | HANDLER_CAN_GETBULK); /* fake it */
+ if (!session->myvoid) {
+ session->myvoid = malloc(sizeof(cacheid));
+ cacheid = netsnmp_allocate_globalcacheid();
+ *((int *) session->myvoid) = cacheid;
+ } else {
+ cacheid = *((int *) session->myvoid);
+ }
+
+ reg->handler->myvoid = session;
+ reg->global_cacheid = cacheid;
+ if (NULL != pdu->community)
+ reg->contextName = strdup(pdu->community);
+
+ /*
+ * register mib. Note that for failure cases, the registration info
+ * (reg) will be freed, and thus is no longer a valid pointer.
+ */
+ switch (netsnmp_register_mib(buf, NULL, 0, 1,
+ pdu->variables->name,
+ pdu->variables->name_length,
+ pdu->priority, pdu->range_subid, ubound,
+ sp, (char *) pdu->community, pdu->time,
+ flags, reg, 1)) {
+
+ case MIB_REGISTERED_OK:
+ DEBUGMSGTL(("agentx/master", "registered ok\n"));
+ return AGENTX_ERR_NOERROR;
+
+ case MIB_DUPLICATE_REGISTRATION:
+ DEBUGMSGTL(("agentx/master", "duplicate registration\n"));
+ rc = AGENTX_ERR_DUPLICATE_REGISTRATION;
+ break;
+
+ case MIB_REGISTRATION_FAILED:
+ default:
+ rc = AGENTX_ERR_REQUEST_DENIED;
+ DEBUGMSGTL(("agentx/master", "failed registration\n"));
+ }
+ return rc;
+}
+
+int
+unregister_agentx_list(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+ netsnmp_session *sp;
+ int rc = 0;
+
+ sp = find_agentx_session(session, pdu->sessid);
+ if (sp == NULL) {
+ return AGENTX_ERR_NOT_OPEN;
+ }
+
+ if (pdu->range_subid != 0) {
+ oid ubound =
+ pdu->variables->val.objid[pdu->range_subid - 1];
+ rc = netsnmp_unregister_mib_table_row(pdu->variables->name,
+ pdu->variables->name_length,
+ pdu->priority,
+ pdu->range_subid, ubound,
+ (char *) pdu->community);
+ } else {
+ rc = unregister_mib_context(pdu->variables->name,
+ pdu->variables->name_length,
+ pdu->priority, 0, 0,
+ (char *) pdu->community);
+ }
+
+ switch (rc) {
+ case MIB_UNREGISTERED_OK:
+ return AGENTX_ERR_NOERROR;
+ case MIB_NO_SUCH_REGISTRATION:
+ return AGENTX_ERR_UNKNOWN_REGISTRATION;
+ case MIB_UNREGISTRATION_FAILED:
+ default:
+ return AGENTX_ERR_REQUEST_DENIED;
+ }
+}
+
+int
+allocate_idx_list(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+ netsnmp_session *sp;
+ netsnmp_variable_list *vp, *vp2, *next, *res;
+ int flags = 0;
+
+ sp = find_agentx_session(session, pdu->sessid);
+ if (sp == NULL)
+ return AGENTX_ERR_NOT_OPEN;
+
+ if (pdu->flags & AGENTX_MSG_FLAG_ANY_INSTANCE)
+ flags |= ALLOCATE_ANY_INDEX;
+ if (pdu->flags & AGENTX_MSG_FLAG_NEW_INSTANCE)
+ flags |= ALLOCATE_NEW_INDEX;
+
+ /*
+ * XXX - what about errors?
+ *
+ * If any allocations fail, then we need to
+ * *fully* release the earlier ones.
+ * (i.e. remove them completely from the index registry,
+ * not simply mark them as available for re-use)
+ *
+ * For now - assume they all succeed.
+ */
+ for (vp = pdu->variables; vp != NULL; vp = next) {
+ next = vp->next_variable;
+ res = register_index(vp, flags, session);
+ if (res == NULL) {
+ /*
+ * If any allocations fail, we need to *fully* release
+ * all previous ones (i.e. remove them completely
+ * from the index registry)
+ */
+ for (vp2 = pdu->variables; vp2 != vp; vp2 = vp2->next_variable) {
+ remove_index(vp2, session);
+ }
+ return AGENTX_ERR_INDEX_NONE_AVAILABLE; /* XXX */
+ } else {
+ (void) snmp_clone_var(res, vp);
+ free(res);
+ }
+ vp->next_variable = next;
+ }
+ return AGENTX_ERR_NOERROR;
+}
+
+int
+release_idx_list(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+ netsnmp_session *sp;
+ netsnmp_variable_list *vp, *vp2, *rv = NULL;
+ int res;
+
+ sp = find_agentx_session(session, pdu->sessid);
+ if (sp == NULL)
+ return AGENTX_ERR_NOT_OPEN;
+
+ for (vp = pdu->variables; vp != NULL; vp = vp->next_variable) {
+ res = unregister_index(vp, TRUE, session);
+ /*
+ * If any releases fail,
+ * we need to reinstate all previous ones.
+ */
+ if (res != SNMP_ERR_NOERROR) {
+ for (vp2 = pdu->variables; vp2 != vp; vp2 = vp2->next_variable) {
+ rv = register_index(vp2, ALLOCATE_THIS_INDEX, session);
+ free(rv);
+ }
+ return AGENTX_ERR_INDEX_NOT_ALLOCATED; /* Probably */
+ }
+ }
+ return AGENTX_ERR_NOERROR;
+}
+
+int
+add_agent_caps_list(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+ netsnmp_session *sp;
+ struct sysORTable parms;
+
+ sp = find_agentx_session(session, pdu->sessid);
+ if (sp == NULL)
+ return AGENTX_ERR_NOT_OPEN;
+
+ parms.OR_oid = pdu->variables->name;
+ parms.OR_oidlen = pdu->variables->name_length;
+ parms.OR_descr = netsnmp_strdup_and_null(pdu->variables->val.string,
+ pdu->variables->val_len);
+ parms.OR_sess = sp;
+ snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_REQ_REG_SYSOR, (void*)&parms);
+ free(parms.OR_descr);
+ return AGENTX_ERR_NOERROR;
+}
+
+int
+remove_agent_caps_list(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+ netsnmp_session *sp;
+ struct sysORTable parms;
+
+ sp = find_agentx_session(session, pdu->sessid);
+ if (sp == NULL)
+ return AGENTX_ERR_NOT_OPEN;
+
+ parms.OR_oid = pdu->variables->name;
+ parms.OR_oidlen = pdu->variables->name_length;
+ parms.OR_sess = sp;
+ snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_REQ_UNREG_SYSOR, (void*)&parms);
+ /*
+ * no easy way to get an error code...
+ * if (rc < 0)
+ * return AGENTX_ERR_UNKNOWN_AGENTCAPS;
+ */
+ return AGENTX_ERR_NOERROR;
+}
+
+int
+agentx_notify(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+ netsnmp_session *sp;
+ netsnmp_variable_list *var;
+ int got_sysuptime = 0;
+ extern oid sysuptime_oid[], snmptrap_oid[];
+ extern size_t sysuptime_oid_len, snmptrap_oid_len;
+
+ sp = find_agentx_session(session, pdu->sessid);
+ if (sp == NULL)
+ return AGENTX_ERR_NOT_OPEN;
+
+ var = pdu->variables;
+ if (!var)
+ return AGENTX_ERR_PROCESSING_ERROR;
+
+ if (snmp_oid_compare(var->name, var->name_length,
+ sysuptime_oid, sysuptime_oid_len) == 0) {
+ got_sysuptime = 1;
+ var = var->next_variable;
+ }
+
+ if (!var || snmp_oid_compare(var->name, var->name_length,
+ snmptrap_oid, snmptrap_oid_len) != 0)
+ return AGENTX_ERR_PROCESSING_ERROR;
+
+ /*
+ * If sysUptime isn't the first varbind, don't worry.
+ * send_trap_vars() will add it if necessary.
+ *
+ * Note that if this behaviour is altered, it will
+ * be necessary to add sysUptime here,
+ * as this is valid AgentX syntax.
+ */
+
+ send_trap_vars(-1, -1, pdu->variables);
+ return AGENTX_ERR_NOERROR;
+}
+
+
+int
+agentx_ping_response(netsnmp_session * session, netsnmp_pdu *pdu)
+{
+ netsnmp_session *sp;
+
+ sp = find_agentx_session(session, pdu->sessid);
+ if (sp == NULL)
+ return AGENTX_ERR_NOT_OPEN;
+ else
+ return AGENTX_ERR_NOERROR;
+}
+
+int
+handle_master_agentx_packet(int operation,
+ netsnmp_session * session,
+ int reqid, netsnmp_pdu *pdu, void *magic)
+{
+ netsnmp_agent_session *asp;
+ struct timeval now;
+
+ if (operation == NETSNMP_CALLBACK_OP_DISCONNECT) {
+ DEBUGMSGTL(("agentx/master",
+ "transport disconnect on session %08p\n", session));
+ /*
+ * Shut this session down gracefully.
+ */
+ close_agentx_session(session, -1);
+ return 1;
+ } else if (operation != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE) {
+ DEBUGMSGTL(("agentx/master", "unexpected callback op %d\n",
+ operation));
+ return 1;
+ }
+
+ /*
+ * Okay, it's a NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE op.
+ */
+
+ if (magic) {
+ asp = (netsnmp_agent_session *) magic;
+ } else {
+ asp = init_agent_snmp_session(session, pdu);
+ }
+
+ DEBUGMSGTL(("agentx/master", "handle pdu (req=0x%x,trans=0x%x,sess=0x%x)\n",
+ pdu->reqid,pdu->transid, pdu->sessid));
+
+ switch (pdu->command) {
+ case AGENTX_MSG_OPEN:
+ asp->pdu->sessid = open_agentx_session(session, pdu);
+ if (asp->pdu->sessid == -1)
+ asp->status = session->s_snmp_errno;
+ break;
+
+ case AGENTX_MSG_CLOSE:
+ asp->status = close_agentx_session(session, pdu->sessid);
+ break;
+
+ case AGENTX_MSG_REGISTER:
+ asp->status = register_agentx_list(session, pdu);
+ break;
+
+ case AGENTX_MSG_UNREGISTER:
+ asp->status = unregister_agentx_list(session, pdu);
+ break;
+
+ case AGENTX_MSG_INDEX_ALLOCATE:
+ asp->status = allocate_idx_list(session, asp->pdu);
+ if (asp->status != AGENTX_ERR_NOERROR) {
+ snmp_free_pdu(asp->pdu);
+ asp->pdu = snmp_clone_pdu(pdu);
+ }
+ break;
+
+ case AGENTX_MSG_INDEX_DEALLOCATE:
+ asp->status = release_idx_list(session, pdu);
+ break;
+
+ case AGENTX_MSG_ADD_AGENT_CAPS:
+ asp->status = add_agent_caps_list(session, pdu);
+ break;
+
+ case AGENTX_MSG_REMOVE_AGENT_CAPS:
+ asp->status = remove_agent_caps_list(session, pdu);
+ break;
+
+ case AGENTX_MSG_NOTIFY:
+ asp->status = agentx_notify(session, pdu);
+ break;
+
+ case AGENTX_MSG_PING:
+ asp->status = agentx_ping_response(session, pdu);
+ break;
+
+ /*
+ * TODO: Other admin packets
+ */
+
+ case AGENTX_MSG_GET:
+ case AGENTX_MSG_GETNEXT:
+ case AGENTX_MSG_GETBULK:
+ case AGENTX_MSG_TESTSET:
+ case AGENTX_MSG_COMMITSET:
+ case AGENTX_MSG_UNDOSET:
+ case AGENTX_MSG_CLEANUPSET:
+ case AGENTX_MSG_RESPONSE:
+ /*
+ * Shouldn't be handled here
+ */
+ break;
+
+ default:
+ asp->status = AGENTX_ERR_PARSE_FAILED;
+ break;
+ }
+
+ gettimeofday(&now, NULL);
+ asp->pdu->time = calculate_time_diff(&now, &starttime);
+ asp->pdu->command = AGENTX_MSG_RESPONSE;
+ asp->pdu->errstat = asp->status;
+ DEBUGMSGTL(("agentx/master", "send response, stat %d (req=0x%x,trans="
+ "0x%x,sess=0x%x)\n",
+ asp->status, pdu->reqid,pdu->transid, pdu->sessid));
+ if (!snmp_send(asp->session, asp->pdu)) {
+ char *eb = NULL;
+ int pe, pse;
+ snmp_error(asp->session, &pe, &pse, &eb);
+ snmp_free_pdu(asp->pdu);
+ DEBUGMSGTL(("agentx/master", "FAILED %d %d %s\n", pe, pse, eb));
+ free(eb);
+ }
+ asp->pdu = NULL;
+ free_agent_snmp_session(asp);
+
+ return 1;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/master_admin.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/master_admin.h
new file mode 100644
index 0000000000..8f1a6cc394
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/master_admin.h
@@ -0,0 +1,12 @@
+#ifndef _AGENTX_MASTER_ADMIN_H
+#define _AGENTX_MASTER_ADMIN_H
+
+config_belongs_in(agent_module)
+
+int handle_master_agentx_packet(int, netsnmp_session *,
+ int, netsnmp_pdu *, void *);
+
+int close_agentx_session(netsnmp_session * session,
+ int sessid);
+
+#endif /* _AGENTX_MASTER_ADMIN_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/protocol.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/protocol.c
new file mode 100644
index 0000000000..eaa9b0cef9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/protocol.c
@@ -0,0 +1,2038 @@
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#include <errno.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+
+#include "agentx/protocol.h"
+
+const char *
+agentx_cmd(u_char code)
+{
+ switch (code) {
+ case AGENTX_MSG_OPEN:
+ return "Open";
+ case AGENTX_MSG_CLOSE:
+ return "Close";
+ case AGENTX_MSG_REGISTER:
+ return "Register";
+ case AGENTX_MSG_UNREGISTER:
+ return "Unregister";
+ case AGENTX_MSG_GET:
+ return "Get";
+ case AGENTX_MSG_GETNEXT:
+ return "Get Next";
+ case AGENTX_MSG_GETBULK:
+ return "Get Bulk";
+ case AGENTX_MSG_TESTSET:
+ return "Test Set";
+ case AGENTX_MSG_COMMITSET:
+ return "Commit Set";
+ case AGENTX_MSG_UNDOSET:
+ return "Undo Set";
+ case AGENTX_MSG_CLEANUPSET:
+ return "Cleanup Set";
+ case AGENTX_MSG_NOTIFY:
+ return "Notify";
+ case AGENTX_MSG_PING:
+ return "Ping";
+ case AGENTX_MSG_INDEX_ALLOCATE:
+ return "Index Allocate";
+ case AGENTX_MSG_INDEX_DEALLOCATE:
+ return "Index Deallocate";
+ case AGENTX_MSG_ADD_AGENT_CAPS:
+ return "Add Agent Caps";
+ case AGENTX_MSG_REMOVE_AGENT_CAPS:
+ return "Remove Agent Caps";
+ case AGENTX_MSG_RESPONSE:
+ return "Response";
+ default:
+ return "Unknown";
+ }
+}
+
+int
+agentx_realloc_build_int(u_char ** buf, size_t * buf_len, size_t * out_len,
+ int allow_realloc,
+ unsigned int value, int network_order)
+{
+ unsigned int ivalue = value;
+ size_t ilen = *out_len;
+#ifdef WORDS_BIGENDIAN
+ unsigned int i = 0;
+#endif
+
+ while ((*out_len + 4) >= *buf_len) {
+ if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+ return 0;
+ }
+ }
+
+ if (network_order) {
+#ifndef WORDS_BIGENDIAN
+ value = ntohl(value);
+#endif
+ memmove((*buf + *out_len), &value, 4);
+ *out_len += 4;
+ } else {
+#ifndef WORDS_BIGENDIAN
+ memmove((*buf + *out_len), &value, 4);
+ *out_len += 4;
+#else
+ for (i = 0; i < 4; i++) {
+ *(*buf + *out_len) = (u_char) value & 0xff;
+ (*out_len)++;
+ value >>= 8;
+ }
+#endif
+ }
+ DEBUGDUMPSETUP("send", (*buf + ilen), 4);
+ DEBUGMSG(("dumpv_send", " Integer:\t%lu (0x%.2lX)\n", ivalue,
+ ivalue));
+ return 1;
+}
+
+void
+agentx_build_int(u_char * bufp, u_int value, int network_byte_order)
+{
+ u_char *orig_bufp = bufp;
+ u_int orig_val = value;
+
+ if (network_byte_order) {
+#ifndef WORDS_BIGENDIAN
+ value = ntohl(value);
+#endif
+ memmove(bufp, &value, 4);
+ } else {
+#ifndef WORDS_BIGENDIAN
+ memmove(bufp, &value, 4);
+#else
+ *bufp = (u_char) value & 0xff;
+ value >>= 8;
+ bufp++;
+ *bufp = (u_char) value & 0xff;
+ value >>= 8;
+ bufp++;
+ *bufp = (u_char) value & 0xff;
+ value >>= 8;
+ bufp++;
+ *bufp = (u_char) value & 0xff;
+#endif
+ }
+ DEBUGDUMPSETUP("send", orig_bufp, 4);
+ DEBUGMSG(("dumpv_send", " Integer:\t%ld (0x%.2X)\n", orig_val,
+ orig_val));
+}
+
+int
+agentx_realloc_build_short(u_char ** buf, size_t * buf_len,
+ size_t * out_len, int allow_realloc,
+ unsigned short value, int network_order)
+{
+ unsigned short ivalue = value;
+ size_t ilen = *out_len;
+#ifdef WORDS_BIGENDIAN
+ unsigned short i = 0;
+#endif
+
+ while ((*out_len + 2) >= *buf_len) {
+ if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+ return 0;
+ }
+ }
+
+ if (network_order) {
+#ifndef WORDS_BIGENDIAN
+ value = ntohs(value);
+#endif
+ memmove((*buf + *out_len), &value, 2);
+ *out_len += 2;
+ } else {
+#ifndef WORDS_BIGENDIAN
+ memmove((*buf + *out_len), &value, 2);
+ *out_len += 2;
+#else
+ for (i = 0; i < 2; i++) {
+ *(*buf + *out_len) = (u_char) value & 0xff;
+ (*out_len)++;
+ value >>= 8;
+ }
+#endif
+ }
+ DEBUGDUMPSETUP("send", (*buf + ilen), 2);
+ DEBUGMSG(("dumpv_send", " Short:\t%hu (0x%.2hX)\n", ivalue, ivalue));
+ return 1;
+}
+
+int
+agentx_realloc_build_oid(u_char ** buf, size_t * buf_len, size_t * out_len,
+ int allow_realloc,
+ int inclusive, oid * name, size_t name_len,
+ int network_order)
+{
+ size_t ilen = *out_len, i = 0;
+ int prefix = 0;
+
+ DEBUGPRINTINDENT("dumpv_send");
+ DEBUGMSG(("dumpv_send", "OID: "));
+ DEBUGMSGOID(("dumpv_send", name, name_len));
+ DEBUGMSG(("dumpv_send", "\n"));
+
+ /*
+ * Updated clarification from the AgentX mailing list.
+ * The "null Object Identifier" mentioned in RFC 2471,
+ * section 5.1 is a special placeholder value, and
+ * should only be used when explicitly mentioned in
+ * this RFC. In particular, it does *not* mean {0, 0}
+ */
+ if (name_len == 0)
+ inclusive = 0;
+
+ /*
+ * 'Compact' internet OIDs
+ */
+ if (name_len >= 5 && (name[0] == 1 && name[1] == 3 &&
+ name[2] == 6 && name[3] == 1 &&
+ name[4] > 0 && name[4] < 256)) {
+ prefix = name[4];
+ name += 5;
+ name_len -= 5;
+ }
+
+ while ((*out_len + 4 + (4 * name_len)) >= *buf_len) {
+ if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+ return 0;
+ }
+ }
+
+ *(*buf + *out_len) = (u_char) name_len;
+ (*out_len)++;
+ *(*buf + *out_len) = (u_char) prefix;
+ (*out_len)++;
+ *(*buf + *out_len) = (u_char) inclusive;
+ (*out_len)++;
+ *(*buf + *out_len) = (u_char) 0x00;
+ (*out_len)++;
+
+ DEBUGDUMPHEADER("send", "OID Header");
+ DEBUGDUMPSETUP("send", (*buf + ilen), 4);
+ DEBUGMSG(("dumpv_send", " # subids:\t%d (0x%.2X)\n", name_len,
+ name_len));
+ DEBUGPRINTINDENT("dumpv_send");
+ DEBUGMSG(("dumpv_send", " prefix:\t%d (0x%.2X)\n", prefix, prefix));
+ DEBUGPRINTINDENT("dumpv_send");
+ DEBUGMSG(("dumpv_send", " inclusive:\t%d (0x%.2X)\n", inclusive,
+ inclusive));
+ DEBUGINDENTLESS();
+ DEBUGDUMPHEADER("send", "OID Segments");
+
+ for (i = 0; i < name_len; i++) {
+ if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+ name[i], network_order)) {
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ }
+ DEBUGINDENTLESS();
+
+ return 1;
+}
+
+int
+agentx_realloc_build_string(u_char ** buf, size_t * buf_len,
+ size_t * out_len, int allow_realloc,
+ u_char * string, size_t string_len,
+ int network_order)
+{
+ size_t ilen = *out_len, i = 0;
+
+ while ((*out_len + 4 + (4 * ((string_len + 3) / 4))) >= *buf_len) {
+ if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+ return 0;
+ }
+ }
+
+ DEBUGDUMPHEADER("send", "Build String");
+ DEBUGDUMPHEADER("send", "length");
+ if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+ string_len, network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+
+ if (string_len == 0) {
+ DEBUGMSG(("dumpv_send", " String: <empty>\n"));
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 1;
+ }
+
+ memmove((*buf + *out_len), string, string_len);
+ *out_len += string_len;
+
+ /*
+ * Pad to a multiple of 4 bytes if necessary (per RFC 2741).
+ */
+
+ if (string_len % 4 != 0) {
+ for (i = 0; i < 4 - (string_len % 4); i++) {
+ *(*buf + *out_len) = 0;
+ (*out_len)++;
+ }
+ }
+
+ DEBUGDUMPSETUP("send", (*buf + ilen + 4), ((string_len + 3) / 4) * 4);
+ DEBUGMSG(("dumpv_send", " String:\t%s\n", string));
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 1;
+}
+
+#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
+int
+agentx_realloc_build_double(u_char ** buf, size_t * buf_len,
+ size_t * out_len, int allow_realloc,
+ double double_val, int network_order)
+{
+ union {
+ double doubleVal;
+ int intVal[2];
+ char c[sizeof(double)];
+ } du;
+ int tmp;
+ u_char opaque_buffer[3 + sizeof(double)];
+
+ opaque_buffer[0] = ASN_OPAQUE_TAG1;
+ opaque_buffer[1] = ASN_OPAQUE_DOUBLE;
+ opaque_buffer[2] = sizeof(double);
+
+ du.doubleVal = double_val;
+ tmp = htonl(du.intVal[0]);
+ du.intVal[0] = htonl(du.intVal[1]);
+ du.intVal[1] = tmp;
+ memcpy(&opaque_buffer[3], &du.c[0], sizeof(double));
+
+ return agentx_realloc_build_string(buf, buf_len, out_len,
+ allow_realloc, opaque_buffer,
+ 3 + sizeof(double), network_order);
+}
+
+int
+agentx_realloc_build_float(u_char ** buf, size_t * buf_len,
+ size_t * out_len, int allow_realloc,
+ float float_val, int network_order)
+{
+ union {
+ float floatVal;
+ int intVal;
+ char c[sizeof(float)];
+ } fu;
+ u_char opaque_buffer[3 + sizeof(float)];
+
+ opaque_buffer[0] = ASN_OPAQUE_TAG1;
+ opaque_buffer[1] = ASN_OPAQUE_FLOAT;
+ opaque_buffer[2] = sizeof(float);
+
+ fu.floatVal = float_val;
+ fu.intVal = htonl(fu.intVal);
+ memcpy(&opaque_buffer[3], &fu.c[0], sizeof(float));
+
+ return agentx_realloc_build_string(buf, buf_len, out_len,
+ allow_realloc, opaque_buffer,
+ 3 + sizeof(float), network_order);
+}
+#endif
+
+int
+agentx_realloc_build_varbind(u_char ** buf, size_t * buf_len,
+ size_t * out_len, int allow_realloc,
+ netsnmp_variable_list * vp, int network_order)
+{
+ DEBUGDUMPHEADER("send", "VarBind");
+ DEBUGDUMPHEADER("send", "type");
+#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
+ if ((vp->type == ASN_OPAQUE_FLOAT) || (vp->type == ASN_OPAQUE_DOUBLE)
+ || (vp->type == ASN_OPAQUE_I64) || (vp->type == ASN_OPAQUE_U64)
+ || (vp->type == ASN_OPAQUE_COUNTER64)) {
+ if (!agentx_realloc_build_short
+ (buf, buf_len, out_len, allow_realloc,
+ (unsigned short) ASN_OPAQUE, network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ } else
+#endif
+ if (vp->type == ASN_PRIV_INCL_RANGE || vp->type == ASN_PRIV_EXCL_RANGE) {
+ if (!agentx_realloc_build_short
+ (buf, buf_len, out_len, allow_realloc,
+ (unsigned short) ASN_OBJECT_ID, network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ } else {
+ if (!agentx_realloc_build_short
+ (buf, buf_len, out_len, allow_realloc,
+ (unsigned short) vp->type, network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ }
+
+ while ((*out_len + 2) >= *buf_len) {
+ if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ }
+
+ *(*buf + *out_len) = 0;
+ (*out_len)++;
+ *(*buf + *out_len) = 0;
+ (*out_len)++;
+ DEBUGINDENTLESS();
+
+ DEBUGDUMPHEADER("send", "name");
+ if (!agentx_realloc_build_oid(buf, buf_len, out_len, allow_realloc, 0,
+ vp->name, vp->name_length,
+ network_order)) {
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+
+ DEBUGDUMPHEADER("send", "value");
+ switch (vp->type) {
+
+ case ASN_INTEGER:
+ case ASN_COUNTER:
+ case ASN_GAUGE:
+ case ASN_TIMETICKS:
+ if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+ *(vp->val.integer), network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ break;
+
+#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
+ case ASN_OPAQUE_FLOAT:
+ DEBUGDUMPHEADER("send", "Build Opaque Float");
+ DEBUGPRINTINDENT("dumpv_send");
+ DEBUGMSG(("dumpv_send", " Float:\t%f\n", *(vp->val.floatVal)));
+ if (!agentx_realloc_build_float
+ (buf, buf_len, out_len, allow_realloc, *(vp->val.floatVal),
+ network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+ break;
+
+ case ASN_OPAQUE_DOUBLE:
+ DEBUGDUMPHEADER("send", "Build Opaque Double");
+ DEBUGPRINTINDENT("dumpv_send");
+ DEBUGMSG(("dumpv_send", " Double:\t%lf\n", *(vp->val.doubleVal)));
+ if (!agentx_realloc_build_double
+ (buf, buf_len, out_len, allow_realloc, *(vp->val.doubleVal),
+ network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+ break;
+
+ case ASN_OPAQUE_I64:
+ case ASN_OPAQUE_U64:
+ case ASN_OPAQUE_COUNTER64:
+ /*
+ * XXX - TODO - encode as raw OPAQUE for now (so fall through
+ * here).
+ */
+#endif
+
+ case ASN_OCTET_STR:
+ case ASN_IPADDRESS:
+ case ASN_OPAQUE:
+ if (!agentx_realloc_build_string
+ (buf, buf_len, out_len, allow_realloc, vp->val.string,
+ vp->val_len, network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ break;
+
+ case ASN_OBJECT_ID:
+ case ASN_PRIV_EXCL_RANGE:
+ case ASN_PRIV_INCL_RANGE:
+ if (!agentx_realloc_build_oid
+ (buf, buf_len, out_len, allow_realloc, 1, vp->val.objid,
+ vp->val_len / sizeof(oid), network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ break;
+
+ case ASN_COUNTER64:
+ if (network_order) {
+ DEBUGDUMPHEADER("send", "Build Counter64 (high, low)");
+ if (!agentx_realloc_build_int
+ (buf, buf_len, out_len, allow_realloc,
+ vp->val.counter64->high, network_order)
+ || !agentx_realloc_build_int(buf, buf_len, out_len,
+ allow_realloc,
+ vp->val.counter64->low,
+ network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ } else {
+ DEBUGDUMPHEADER("send", "Build Counter64 (low, high)");
+ if (!agentx_realloc_build_int
+ (buf, buf_len, out_len, allow_realloc,
+ vp->val.counter64->low, network_order)
+ || !agentx_realloc_build_int(buf, buf_len, out_len,
+ allow_realloc,
+ vp->val.counter64->high,
+ network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ }
+ break;
+
+ case ASN_NULL:
+ case SNMP_NOSUCHOBJECT:
+ case SNMP_NOSUCHINSTANCE:
+ case SNMP_ENDOFMIBVIEW:
+ break;
+
+ default:
+ DEBUGMSGTL(("agentx_build_varbind", "unknown type %d (0x%02x)\n",
+ vp->type, vp->type));
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 1;
+}
+
+int
+agentx_realloc_build_header(u_char ** buf, size_t * buf_len,
+ size_t * out_len, int allow_realloc,
+ netsnmp_pdu *pdu)
+{
+ size_t ilen = *out_len;
+ const int network_order =
+ pdu->flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER;
+
+ while ((*out_len + 4) >= *buf_len) {
+ if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+ return 0;
+ }
+ }
+
+ /*
+ * First 4 bytes are version, pdu type, flags, and a 0 reserved byte.
+ */
+
+ *(*buf + *out_len) = 1;
+ (*out_len)++;
+ *(*buf + *out_len) = pdu->command;
+ (*out_len)++;
+ *(*buf + *out_len) = (u_char) (pdu->flags & AGENTX_MSG_FLAGS_MASK);
+ (*out_len)++;
+ *(*buf + *out_len) = 0;
+ (*out_len)++;
+
+ DEBUGDUMPHEADER("send", "AgentX Header");
+ DEBUGDUMPSETUP("send", (*buf + ilen), 4);
+ DEBUGMSG(("dumpv_send", " Version:\t%d\n", (int) *(*buf + ilen)));
+ DEBUGPRINTINDENT("dumpv_send");
+ DEBUGMSG(("dumpv_send", " Command:\t%d (%s)\n", pdu->command,
+ agentx_cmd((u_char)pdu->command)));
+ DEBUGPRINTINDENT("dumpv_send");
+ DEBUGMSG(("dumpv_send", " Flags:\t%02x\n", (int) *(*buf + ilen + 2)));
+
+ DEBUGDUMPHEADER("send", "Session ID");
+ if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+ pdu->sessid, network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+
+ DEBUGDUMPHEADER("send", "Transaction ID");
+ if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+ pdu->transid, network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+
+ DEBUGDUMPHEADER("send", "Request ID");
+ if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+ pdu->reqid, network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+
+ DEBUGDUMPHEADER("send", "Dummy Length :-(");
+ if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+ 0, network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+
+ if (pdu->flags & AGENTX_MSG_FLAG_NON_DEFAULT_CONTEXT) {
+ DEBUGDUMPHEADER("send", "Community");
+ if (!agentx_realloc_build_string
+ (buf, buf_len, out_len, allow_realloc, pdu->community,
+ pdu->community_len, network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+ }
+
+ DEBUGINDENTLESS();
+ return 1;
+}
+
+static int
+_agentx_realloc_build(u_char ** buf, size_t * buf_len, size_t * out_len,
+ int allow_realloc,
+ netsnmp_session * session, netsnmp_pdu *pdu)
+{
+ size_t ilen = *out_len, prefix_offset = 0;
+ netsnmp_variable_list *vp;
+ int inc, i = 0;
+ const int network_order =
+ pdu->flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER;
+
+ session->s_snmp_errno = 0;
+ session->s_errno = 0;
+
+ /*
+ * Various PDU types don't include context information (RFC 2741, p. 20).
+ */
+ switch (pdu->command) {
+ case AGENTX_MSG_OPEN:
+ case AGENTX_MSG_CLOSE:
+ case AGENTX_MSG_RESPONSE:
+ case AGENTX_MSG_COMMITSET:
+ case AGENTX_MSG_UNDOSET:
+ case AGENTX_MSG_CLEANUPSET:
+ pdu->flags &= ~(AGENTX_MSG_FLAG_NON_DEFAULT_CONTEXT);
+ }
+
+ /*
+ * Build the header (and context if appropriate).
+ */
+ if (!agentx_realloc_build_header
+ (buf, buf_len, out_len, allow_realloc, pdu)) {
+ return 0;
+ }
+
+ /*
+ * Everything causes a response, except for agentx-Response-PDU and
+ * agentx-CleanupSet-PDU.
+ */
+
+ pdu->flags |= UCD_MSG_FLAG_EXPECT_RESPONSE;
+
+ DEBUGDUMPHEADER("send", "AgentX Payload");
+ switch (pdu->command) {
+
+ case AGENTX_MSG_OPEN:
+ /*
+ * Timeout
+ */
+ while ((*out_len + 4) >= *buf_len) {
+ if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ }
+ *(*buf + *out_len) = (u_char) pdu->time;
+ (*out_len)++;
+ for (i = 0; i < 3; i++) {
+ *(*buf + *out_len) = 0;
+ (*out_len)++;
+ }
+ DEBUGDUMPHEADER("send", "Open Timeout");
+ DEBUGDUMPSETUP("send", (*buf + *out_len - 4), 4);
+ DEBUGMSG(("dumpv_send", " Timeout:\t%d\n",
+ (int) *(*buf + *out_len - 4)));
+ DEBUGINDENTLESS();
+
+ DEBUGDUMPHEADER("send", "Open ID");
+ if (!agentx_realloc_build_oid
+ (buf, buf_len, out_len, allow_realloc, 0, pdu->variables->name,
+ pdu->variables->name_length, network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+ DEBUGDUMPHEADER("send", "Open Description");
+ if (!agentx_realloc_build_string
+ (buf, buf_len, out_len, allow_realloc,
+ pdu->variables->val.string, pdu->variables->val_len,
+ network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+ break;
+
+ case AGENTX_MSG_CLOSE:
+ /*
+ * Reason
+ */
+ while ((*out_len + 4) >= *buf_len) {
+ if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ }
+ *(*buf + *out_len) = (u_char) pdu->errstat;
+ (*out_len)++;
+ for (i = 0; i < 3; i++) {
+ *(*buf + *out_len) = 0;
+ (*out_len)++;
+ }
+ DEBUGDUMPHEADER("send", "Close Reason");
+ DEBUGDUMPSETUP("send", (*buf + *out_len - 4), 4);
+ DEBUGMSG(("dumpv_send", " Reason:\t%d\n",
+ (int) *(*buf + *out_len - 4)));
+ DEBUGINDENTLESS();
+ break;
+
+ case AGENTX_MSG_REGISTER:
+ case AGENTX_MSG_UNREGISTER:
+ while ((*out_len + 4) >= *buf_len) {
+ if (!(allow_realloc && snmp_realloc(buf, buf_len))) {
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ }
+ if (pdu->command == AGENTX_MSG_REGISTER) {
+ *(*buf + *out_len) = (u_char) pdu->time;
+ } else {
+ *(*buf + *out_len) = 0;
+ }
+ (*out_len)++;
+ *(*buf + *out_len) = (u_char) pdu->priority;
+ (*out_len)++;
+ *(*buf + *out_len) = (u_char) pdu->range_subid;
+ (*out_len)++;
+ *(*buf + *out_len) = (u_char) 0;
+ (*out_len)++;
+
+ DEBUGDUMPHEADER("send", "(Un)Register Header");
+ DEBUGDUMPSETUP("send", (*buf + *out_len - 4), 4);
+ if (pdu->command == AGENTX_MSG_REGISTER) {
+ DEBUGMSG(("dumpv_send", " Timeout:\t%d\n",
+ (int) *(*buf + *out_len - 4)));
+ DEBUGPRINTINDENT("dumpv_send");
+ }
+ DEBUGMSG(("dumpv_send", " Priority:\t%d\n",
+ (int) *(*buf + *out_len - 3)));
+ DEBUGPRINTINDENT("dumpv_send");
+ DEBUGMSG(("dumpv_send", " Range SubID:\t%d\n",
+ (int) *(*buf + *out_len - 2)));
+ DEBUGINDENTLESS();
+
+ vp = pdu->variables;
+ prefix_offset = *out_len + 1;
+ DEBUGDUMPHEADER("send", "(Un)Register Prefix");
+ if (!agentx_realloc_build_oid
+ (buf, buf_len, out_len, allow_realloc, 0, vp->name,
+ vp->name_length, network_order)) {
+
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+
+ if (pdu->range_subid) {
+ DEBUGDUMPHEADER("send", "(Un)Register Range");
+ if (!agentx_realloc_build_int
+ (buf, buf_len, out_len, allow_realloc,
+ vp->val.objid[pdu->range_subid - 1], network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+ }
+ break;
+
+ case AGENTX_MSG_GETBULK:
+ DEBUGDUMPHEADER("send", "GetBulk Non-Repeaters");
+ if (!agentx_realloc_build_short
+ (buf, buf_len, out_len, allow_realloc,
+ (u_short)pdu->non_repeaters,
+ network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+
+ DEBUGDUMPHEADER("send", "GetBulk Max-Repetitions");
+ if (!agentx_realloc_build_short
+ (buf, buf_len, out_len, allow_realloc,
+ (u_short)pdu->max_repetitions,
+ network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+
+ /*
+ * Fallthrough
+ */
+
+ case AGENTX_MSG_GET:
+ case AGENTX_MSG_GETNEXT:
+ DEBUGDUMPHEADER("send", "Get* Variable List");
+ for (vp = pdu->variables; vp != NULL; vp = vp->next_variable) {
+ inc = (vp->type == ASN_PRIV_INCL_RANGE);
+ if (!agentx_realloc_build_oid
+ (buf, buf_len, out_len, allow_realloc, inc, vp->name,
+ vp->name_length, network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ if (!agentx_realloc_build_oid
+ (buf, buf_len, out_len, allow_realloc, 0, vp->val.objid,
+ vp->val_len / sizeof(oid), network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ }
+ DEBUGINDENTLESS();
+ break;
+
+ case AGENTX_MSG_RESPONSE:
+ pdu->flags &= ~(UCD_MSG_FLAG_EXPECT_RESPONSE);
+ if (!agentx_realloc_build_int(buf, buf_len, out_len, allow_realloc,
+ pdu->time, network_order)) {
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGDUMPHEADER("send", "Response");
+ DEBUGDUMPSETUP("send", (*buf + *out_len - 4), 4);
+ DEBUGMSG(("dumpv_send", " sysUpTime:\t%d\n", pdu->time));
+ DEBUGINDENTLESS();
+
+ if (!agentx_realloc_build_short
+ (buf, buf_len, out_len, allow_realloc,
+ (u_short)pdu->errstat,
+ network_order)
+ || !agentx_realloc_build_short(buf, buf_len, out_len,
+ allow_realloc,
+ (u_short)pdu->errindex,
+ network_order)) {
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGDUMPHEADER("send", "Response errors");
+ DEBUGDUMPSETUP("send", (*buf + *out_len - 4), 4);
+ DEBUGMSG(("dumpv_send", " errstat:\t%d\n", pdu->errstat));
+ DEBUGPRINTINDENT("dumpv_send");
+ DEBUGMSG(("dumpv_send", " errindex:\t%d\n", pdu->errindex));
+ DEBUGINDENTLESS();
+
+ /*
+ * Fallthrough
+ */
+
+ case AGENTX_MSG_INDEX_ALLOCATE:
+ case AGENTX_MSG_INDEX_DEALLOCATE:
+ case AGENTX_MSG_NOTIFY:
+ case AGENTX_MSG_TESTSET:
+ DEBUGDUMPHEADER("send", "Get* Variable List");
+ for (vp = pdu->variables; vp != NULL; vp = vp->next_variable) {
+ if (!agentx_realloc_build_varbind
+ (buf, buf_len, out_len, allow_realloc, vp,
+ network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ }
+ DEBUGINDENTLESS();
+ break;
+
+ case AGENTX_MSG_COMMITSET:
+ case AGENTX_MSG_UNDOSET:
+ case AGENTX_MSG_PING:
+ /*
+ * "Empty" packet.
+ */
+ break;
+
+ case AGENTX_MSG_CLEANUPSET:
+ pdu->flags &= ~(UCD_MSG_FLAG_EXPECT_RESPONSE);
+ break;
+
+ case AGENTX_MSG_ADD_AGENT_CAPS:
+ DEBUGDUMPHEADER("send", "AgentCaps OID");
+ if (!agentx_realloc_build_oid
+ (buf, buf_len, out_len, allow_realloc, 0, pdu->variables->name,
+ pdu->variables->name_length, network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+
+ DEBUGDUMPHEADER("send", "AgentCaps Description");
+ if (!agentx_realloc_build_string
+ (buf, buf_len, out_len, allow_realloc,
+ pdu->variables->val.string, pdu->variables->val_len,
+ network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+ break;
+
+ case AGENTX_MSG_REMOVE_AGENT_CAPS:
+ DEBUGDUMPHEADER("send", "AgentCaps OID");
+ if (!agentx_realloc_build_oid
+ (buf, buf_len, out_len, allow_realloc, 0, pdu->variables->name,
+ pdu->variables->name_length, network_order)) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return 0;
+ }
+ DEBUGINDENTLESS();
+ break;
+
+ default:
+ session->s_snmp_errno = SNMPERR_UNKNOWN_PDU;
+ return 0;
+ }
+ DEBUGINDENTLESS();
+
+ /*
+ * Fix the payload length (ignoring the 20-byte header).
+ */
+
+ agentx_build_int((*buf + 16), (*out_len - ilen) - 20, network_order);
+
+ DEBUGMSGTL(("agentx_build", "packet built okay\n"));
+ return 1;
+}
+
+int
+agentx_realloc_build(netsnmp_session * session, netsnmp_pdu *pdu,
+ u_char ** buf, size_t * buf_len, size_t * out_len)
+{
+ if (session == NULL || buf_len == NULL ||
+ out_len == NULL || pdu == NULL || buf == NULL) {
+ return -1;
+ }
+ if (!_agentx_realloc_build(buf, buf_len, out_len, 1, session, pdu)) {
+ if (session->s_snmp_errno == 0) {
+ session->s_snmp_errno = SNMPERR_BAD_ASN1_BUILD;
+ }
+ return -1;
+ }
+
+ return 0;
+}
+
+ /***********************
+ *
+ * Utility functions for parsing an AgentX packet
+ *
+ ***********************/
+
+int
+agentx_parse_int(u_char * data, u_int network_byte_order)
+{
+ u_int value = 0;
+
+ /*
+ * Note - this doesn't handle 'PDP_ENDIAN' systems
+ * If anyone needs this added, contact the coders list
+ */
+ DEBUGDUMPSETUP("recv", data, 4);
+ if (network_byte_order) {
+ memmove(&value, data, 4);
+#ifndef WORDS_BIGENDIAN
+ value = ntohl(value);
+#endif
+ } else {
+#ifndef WORDS_BIGENDIAN
+ memmove(&value, data, 4);
+#else
+ /*
+ * The equivalent of the 'ntohl()' macro,
+ * except this macro is null on big-endian systems
+ */
+ value += data[3];
+ value <<= 8;
+ value += data[2];
+ value <<= 8;
+ value += data[1];
+ value <<= 8;
+ value += data[0];
+#endif
+ }
+ DEBUGMSG(("dumpv_recv", " Integer:\t%ld (0x%.2X)\n", value, value));
+
+ return value;
+}
+
+
+int
+agentx_parse_short(u_char * data, u_int network_byte_order)
+{
+ u_short value = 0;
+
+ if (network_byte_order) {
+ memmove(&value, data, 2);
+#ifndef WORDS_BIGENDIAN
+ value = ntohs(value);
+#endif
+ } else {
+#ifndef WORDS_BIGENDIAN
+ memmove(&value, data, 2);
+#else
+ /*
+ * The equivalent of the 'ntohs()' macro,
+ * except this macro is null on big-endian systems
+ */
+ value += data[1];
+ value <<= 8;
+ value += data[0];
+#endif
+ }
+
+ DEBUGDUMPSETUP("recv", data, 2);
+ DEBUGMSG(("dumpv_recv", " Short:\t%ld (0x%.2X)\n", value, value));
+ return value;
+}
+
+
+u_char *
+agentx_parse_oid(u_char * data, size_t * length, int *inc,
+ oid * oid_buf, size_t * oid_len, u_int network_byte_order)
+{
+ u_int n_subid;
+ u_int prefix;
+ int i;
+ int int_offset;
+ u_int *int_ptr = (u_int *)oid_buf;
+ u_char *buf_ptr = data;
+
+ if (*length < 4) {
+ DEBUGMSGTL(("agentx", "Incomplete Object ID"));
+ return NULL;
+ }
+
+ DEBUGDUMPHEADER("recv", "OID Header");
+ DEBUGDUMPSETUP("recv", data, 4);
+ DEBUGMSG(("dumpv_recv", " # subids:\t%d (0x%.2X)\n", data[0],
+ data[0]));
+ DEBUGPRINTINDENT("dumpv_recv");
+ DEBUGMSG(("dumpv_recv", " prefix: \t%d (0x%.2X)\n", data[1],
+ data[1]));
+ DEBUGPRINTINDENT("dumpv_recv");
+ DEBUGMSG(("dumpv_recv", " inclusive:\t%d (0x%.2X)\n", data[2],
+ data[2]));
+
+ DEBUGINDENTLESS();
+ DEBUGDUMPHEADER("recv", "OID Segments");
+
+ n_subid = data[0];
+ prefix = data[1];
+ if (inc)
+ *inc = data[2];
+ int_offset = sizeof(oid)/4;
+
+ buf_ptr += 4;
+ *length -= 4;
+
+ DEBUGMSG(("djp", " parse_oid\n"));
+ DEBUGMSG(("djp", " sizeof(oid) = %d\n", sizeof(oid)));
+ if (n_subid == 0 && prefix == 0) {
+ /*
+ * Null OID
+ */
+ *int_ptr = 0;
+ int_ptr++;
+ *int_ptr = 0;
+ int_ptr++;
+ *oid_len = 2;
+ DEBUGPRINTINDENT("dumpv_recv");
+ DEBUGMSG(("dumpv_recv", "OID: NULL (0.0)\n"));
+ DEBUGINDENTLESS();
+ return buf_ptr;
+ }
+
+
+#ifdef WORDS_BIGENDIAN
+# define endianoff 1
+#else
+# define endianoff 0
+#endif
+ if (*length < 4 * n_subid) {
+ DEBUGMSGTL(("agentx", "Incomplete Object ID"));
+ return NULL;
+ }
+
+ if (prefix) {
+ if (int_offset == 2) { /* align OID values in 64 bit agent */
+ memset(int_ptr, 0, 10*sizeof(int_ptr[0]));
+ int_ptr[0+endianoff] = 1;
+ int_ptr[2+endianoff] = 3;
+ int_ptr[4+endianoff] = 6;
+ int_ptr[6+endianoff] = 1;
+ int_ptr[8+endianoff] = prefix;
+ } else { /* assume int_offset == 1 */
+ int_ptr[0] = 1;
+ int_ptr[1] = 3;
+ int_ptr[2] = 6;
+ int_ptr[3] = 1;
+ int_ptr[4] = prefix;
+ }
+ int_ptr = int_ptr + (int_offset * 5);
+ }
+
+ for (i = 0; i < (int) (int_offset * n_subid); i = i + int_offset) {
+ int x;
+
+ x = agentx_parse_int(buf_ptr, network_byte_order);
+ if (int_offset == 2) {
+ int_ptr[i+0] = 0;
+ int_ptr[i+1] = 0;
+ int_ptr[i+endianoff]=x;
+ } else {
+ int_ptr[i] = x;
+ }
+ buf_ptr += 4;
+ *length -= 4;
+ }
+
+ *oid_len = (prefix ? n_subid + 5 : n_subid);
+
+ DEBUGINDENTLESS();
+ DEBUGPRINTINDENT("dumpv_recv");
+ DEBUGMSG(("dumpv_recv", "OID: "));
+ DEBUGMSGOID(("dumpv_recv", oid_buf, *oid_len));
+ DEBUGMSG(("dumpv_recv", "\n"));
+
+ return buf_ptr;
+}
+
+
+
+u_char *
+agentx_parse_string(u_char * data, size_t * length,
+ u_char * string, size_t * str_len,
+ u_int network_byte_order)
+{
+ u_int len;
+
+ if (*length < 4) {
+ DEBUGMSGTL(("agentx", "Incomplete string (too short: %d)",
+ *length));
+ return NULL;
+ }
+
+ len = agentx_parse_int(data, network_byte_order);
+ if (*length < len + 4) {
+ DEBUGMSGTL(("agentx", "Incomplete string (still too short: %d)",
+ *length));
+ return NULL;
+ }
+ if (len > *str_len) {
+ DEBUGMSGTL(("agentx", "String too long (too long)"));
+ return NULL;
+ }
+ memmove(string, data + 4, len);
+ string[len] = '\0';
+ *str_len = len;
+
+ len += 3; /* Extend the string length to include the padding */
+ len >>= 2;
+ len <<= 2;
+
+ *length -= (len + 4);
+ DEBUGDUMPSETUP("recv", data, (len + 4));
+ DEBUGIF("dumpv_recv") {
+ u_char *buf = NULL;
+ size_t buf_len = 0, out_len = 0;
+
+ if (sprint_realloc_asciistring(&buf, &buf_len, &out_len, 1,
+ string, len)) {
+ DEBUGMSG(("dumpv_recv", "String: %s\n", buf));
+ } else {
+ DEBUGMSG(("dumpv_recv", "String: %s [TRUNCATED]\n", buf));
+ }
+ if (buf != NULL) {
+ free(buf);
+ }
+ }
+ return data + (len + 4);
+}
+
+u_char *
+agentx_parse_opaque(u_char * data, size_t * length, int *type,
+ u_char * opaque_buf, size_t * opaque_len,
+ u_int network_byte_order)
+{
+ union {
+ float floatVal;
+ double doubleVal;
+ int intVal[2];
+ char c[sizeof(double)];
+ } fu;
+ int tmp;
+ u_char *buf;
+ u_char *cp;
+
+ cp = agentx_parse_string(data, length,
+ opaque_buf, opaque_len, network_byte_order);
+ if (cp == NULL)
+ return NULL;
+
+ buf = opaque_buf;
+
+#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
+ if ((buf[0] != ASN_OPAQUE_TAG1) || (*opaque_len <= 3))
+ return cp; /* Unrecognised opaque type */
+
+ switch (buf[1]) {
+ case ASN_OPAQUE_FLOAT:
+ if ((*opaque_len != (3 + sizeof(float))) ||
+ (buf[2] != sizeof(float)))
+ return cp; /* Encoding isn't right for FLOAT */
+
+ memcpy(&fu.c[0], &buf[3], sizeof(float));
+ fu.intVal[0] = ntohl(fu.intVal[0]);
+ *opaque_len = sizeof(float);
+ memcpy(opaque_buf, &fu.c[0], sizeof(float));
+ *type = ASN_OPAQUE_FLOAT;
+ DEBUGMSG(("dumpv_recv", "Float: %f\n", fu.floatVal));
+ return cp;
+
+ case ASN_OPAQUE_DOUBLE:
+ if ((*opaque_len != (3 + sizeof(double))) ||
+ (buf[2] != sizeof(double)))
+ return cp; /* Encoding isn't right for DOUBLE */
+
+ memcpy(&fu.c[0], &buf[3], sizeof(double));
+ tmp = ntohl(fu.intVal[1]);
+ fu.intVal[1] = ntohl(fu.intVal[0]);
+ fu.intVal[0] = tmp;
+ *opaque_len = sizeof(double);
+ memcpy(opaque_buf, &fu.c[0], sizeof(double));
+ *type = ASN_OPAQUE_DOUBLE;
+ DEBUGMSG(("dumpv_recv", "Double: %lf\n", fu.doubleVal));
+ return cp;
+
+ case ASN_OPAQUE_I64:
+ case ASN_OPAQUE_U64:
+ case ASN_OPAQUE_COUNTER64:
+ default:
+ return cp; /* Unrecognised opaque sub-type */
+ }
+#else
+ return cp;
+#endif
+}
+
+
+u_char *
+agentx_parse_varbind(u_char * data, size_t * length, int *type,
+ oid * oid_buf, size_t * oid_len,
+ u_char * data_buf, size_t * data_len,
+ u_int network_byte_order)
+{
+ u_char *bufp = data;
+ u_int int_val;
+ int int_offset;
+ u_int *int_ptr = (u_int *) data_buf;
+ struct counter64 tmp64;
+
+ DEBUGDUMPHEADER("recv", "VarBind:");
+ DEBUGDUMPHEADER("recv", "Type");
+ *type = agentx_parse_short(bufp, network_byte_order);
+ DEBUGINDENTLESS();
+ bufp += 4;
+ *length -= 4;
+
+ bufp = agentx_parse_oid(bufp, length, NULL, oid_buf, oid_len,
+ network_byte_order);
+ if (bufp == NULL) {
+ DEBUGINDENTLESS();
+ return NULL;
+ }
+
+ switch (*type) {
+ case ASN_INTEGER:
+ case ASN_COUNTER:
+ case ASN_GAUGE:
+ case ASN_TIMETICKS:
+ int_val = agentx_parse_int(bufp, network_byte_order);
+ memmove(data_buf, &int_val, 4);
+ *data_len = 4;
+ bufp += 4;
+ *length -= 4;
+ break;
+
+ case ASN_OCTET_STR:
+ case ASN_IPADDRESS:
+ bufp = agentx_parse_string(bufp, length, data_buf, data_len,
+ network_byte_order);
+ break;
+
+ case ASN_OPAQUE:
+ bufp = agentx_parse_opaque(bufp, length, type, data_buf, data_len,
+ network_byte_order);
+ break;
+
+ case ASN_PRIV_INCL_RANGE:
+ case ASN_PRIV_EXCL_RANGE:
+ case ASN_OBJECT_ID:
+ bufp =
+ agentx_parse_oid(bufp, length, NULL, (oid *) data_buf,
+ data_len, network_byte_order);
+ *data_len *= sizeof(oid);
+ /*
+ * 'agentx_parse_oid()' returns the number of sub_ids
+ */
+ break;
+
+ case ASN_COUNTER64:
+ memset(&tmp64, 0, sizeof(tmp64));
+ if (network_byte_order) {
+ tmp64.high = agentx_parse_int(bufp, network_byte_order);
+ tmp64.low = agentx_parse_int(bufp+4, network_byte_order);
+ } else {
+ tmp64.high = agentx_parse_int(bufp+4, network_byte_order);
+ tmp64.low = agentx_parse_int(bufp, network_byte_order);
+ }
+
+ memcpy(data_buf, &tmp64, sizeof(tmp64));
+ *data_len = sizeof(tmp64);
+ bufp += 8;
+ *length -= 8;
+ break;
+
+ case ASN_NULL:
+ case SNMP_NOSUCHOBJECT:
+ case SNMP_NOSUCHINSTANCE:
+ case SNMP_ENDOFMIBVIEW:
+ /*
+ * No data associated with these types.
+ */
+ *data_len = 0;
+ break;
+
+ default:
+ DEBUGINDENTLESS();
+ return NULL;
+ }
+ DEBUGINDENTLESS();
+ return bufp;
+}
+
+/*
+ * AgentX header:
+ *
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | h.version | h.type | h.flags | <reserved> |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | h.sessionID |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | h.transactionID |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | h.packetID |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | h.payload_length |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ * Total length = 20 bytes
+ *
+ * If we don't seem to have the full packet, return NULL
+ * and let the driving code go back for the rest.
+ * Don't report this as an error, as it's quite "normal"
+ * with a connection-oriented service.
+ *
+ * Note that once the header has been successfully processed
+ * (and hence we should have the full packet), any subsequent
+ * "running out of room" is indeed an error.
+ */
+u_char *
+agentx_parse_header(netsnmp_pdu *pdu, u_char * data, size_t * length)
+{
+ register u_char *bufp = data;
+ size_t payload;
+
+ if (*length < 20) { /* Incomplete header */
+ return NULL;
+ }
+
+ DEBUGDUMPHEADER("recv", "AgentX Header");
+ DEBUGDUMPHEADER("recv", "Version");
+ DEBUGDUMPSETUP("recv", bufp, 1);
+ pdu->version = AGENTX_VERSION_BASE | *bufp;
+ DEBUGMSG(("dumpv_recv", " Version:\t%d\n", *bufp));
+ DEBUGINDENTLESS();
+ bufp++;
+
+ DEBUGDUMPHEADER("recv", "Command");
+ DEBUGDUMPSETUP("recv", bufp, 1);
+ pdu->command = *bufp;
+ DEBUGMSG(("dumpv_recv", " Command:\t%d (%s)\n", *bufp,
+ agentx_cmd(*bufp)));
+ DEBUGINDENTLESS();
+ bufp++;
+
+ DEBUGDUMPHEADER("recv", "Flags");
+ DEBUGDUMPSETUP("recv", bufp, 1);
+ pdu->flags |= *bufp;
+ DEBUGMSG(("dumpv_recv", " Flags:\t0x%x\n", *bufp));
+ DEBUGINDENTLESS();
+ bufp++;
+
+ DEBUGDUMPHEADER("recv", "Reserved Byte");
+ DEBUGDUMPSETUP("recv", bufp, 1);
+ DEBUGMSG(("dumpv_recv", " Reserved:\t0x%x\n", *bufp));
+ DEBUGINDENTLESS();
+ bufp++;
+
+ DEBUGDUMPHEADER("recv", "Session ID");
+ pdu->sessid = agentx_parse_int(bufp,
+ pdu->
+ flags &
+ AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ DEBUGINDENTLESS();
+ bufp += 4;
+
+ DEBUGDUMPHEADER("recv", "Transaction ID");
+ pdu->transid = agentx_parse_int(bufp,
+ pdu->
+ flags &
+ AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ DEBUGINDENTLESS();
+ bufp += 4;
+
+ DEBUGDUMPHEADER("recv", "Packet ID");
+ pdu->reqid = agentx_parse_int(bufp,
+ pdu->
+ flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ DEBUGINDENTLESS();
+ bufp += 4;
+
+ DEBUGDUMPHEADER("recv", "Payload Length");
+ payload = agentx_parse_int(bufp,
+ pdu->
+ flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ DEBUGINDENTLESS();
+ bufp += 4;
+
+ *length -= 20;
+ if (*length != payload) { /* Short payload */
+ return NULL;
+ }
+ return bufp;
+}
+
+
+int
+agentx_parse(netsnmp_session * session, netsnmp_pdu *pdu, u_char * data,
+ size_t len)
+{
+ register u_char *bufp = data;
+ u_char buffer[SNMP_MAX_MSG_SIZE];
+ u_char *prefix_ptr;
+ oid oid_buffer[MAX_OID_LEN], end_oid_buf[MAX_OID_LEN];
+ size_t buf_len = sizeof(buffer);
+ size_t oid_buf_len = MAX_OID_LEN;
+ size_t end_oid_buf_len = MAX_OID_LEN;
+
+ int range_bound; /* OID-range upper bound */
+ int inc; /* Inclusive SearchRange flag */
+ int type; /* VarBind data type */
+ size_t *length = &len;
+
+ if (pdu == NULL) {
+ /*
+ * Dump the packet in a formatted style
+ */
+ pdu = (netsnmp_pdu *) malloc(sizeof(netsnmp_pdu));
+ free(pdu);
+ return (0);
+ }
+ if (!IS_AGENTX_VERSION(session->version))
+ return SNMPERR_BAD_VERSION;
+
+#ifndef SNMPERR_INCOMPLETE_PACKET
+ /*
+ * Ideally, "short" packets on stream connections should
+ * be handled specially, and the driving code set up to
+ * keep reading until the full packet is received.
+ *
+ * For now, lets assume that all packets are read in one go.
+ * I've probably inflicted enough damage on the UCD library
+ * for one week!
+ *
+ * I'll come back to this once Wes is speaking to me again.
+ */
+#define SNMPERR_INCOMPLETE_PACKET SNMPERR_ASN_PARSE_ERR
+#endif
+
+
+ /*
+ * Handle (common) header ....
+ */
+ bufp = agentx_parse_header(pdu, bufp, length);
+ if (bufp == NULL)
+ return SNMPERR_INCOMPLETE_PACKET; /* i.e. wait for the rest */
+
+ /*
+ * Control PDU handling
+ */
+ pdu->flags |= UCD_MSG_FLAG_ALWAYS_IN_VIEW;
+ pdu->flags |= UCD_MSG_FLAG_FORCE_PDU_COPY;
+ pdu->flags &= (~UCD_MSG_FLAG_RESPONSE_PDU);
+
+ /*
+ * ... and (not-un-common) context
+ */
+ if (pdu->flags & AGENTX_MSG_FLAG_NON_DEFAULT_CONTEXT) {
+ DEBUGDUMPHEADER("recv", "Context");
+ bufp = agentx_parse_string(bufp, length, buffer, &buf_len,
+ pdu->flags &
+ AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ DEBUGINDENTLESS();
+ if (bufp == NULL)
+ return SNMPERR_ASN_PARSE_ERR;
+
+ pdu->community_len = buf_len;
+ snmp_clone_mem((void **) &pdu->community,
+ (void *) buffer, (unsigned) buf_len);
+ buf_len = sizeof(buffer);
+ }
+
+ DEBUGDUMPHEADER("recv", "PDU");
+ DEBUGINDENTMORE();
+ switch (pdu->command) {
+ case AGENTX_MSG_OPEN:
+ pdu->time = *bufp; /* Timeout */
+ bufp += 4;
+ *length -= 4;
+
+ /*
+ * Store subagent OID & description in a VarBind
+ */
+ DEBUGDUMPHEADER("recv", "Subagent OID");
+ bufp = agentx_parse_oid(bufp, length, NULL,
+ oid_buffer, &oid_buf_len,
+ pdu->flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ DEBUGINDENTLESS();
+ if (bufp == NULL) {
+ DEBUGINDENTLESS();
+ return SNMPERR_ASN_PARSE_ERR;
+ }
+ DEBUGDUMPHEADER("recv", "Subagent Description");
+ bufp = agentx_parse_string(bufp, length, buffer, &buf_len,
+ pdu->flags &
+ AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ DEBUGINDENTLESS();
+ if (bufp == NULL) {
+ DEBUGINDENTLESS();
+ return SNMPERR_ASN_PARSE_ERR;
+ }
+ snmp_pdu_add_variable(pdu, oid_buffer, oid_buf_len,
+ ASN_OCTET_STR, buffer, buf_len);
+
+ oid_buf_len = MAX_OID_LEN;
+ buf_len = sizeof(buffer);
+ break;
+
+ case AGENTX_MSG_CLOSE:
+ pdu->errstat = *bufp; /* Reason */
+ bufp += 4;
+ *length -= 4;
+
+ break;
+
+ case AGENTX_MSG_UNREGISTER:
+ case AGENTX_MSG_REGISTER:
+ DEBUGDUMPHEADER("recv", "Registration Header");
+ if (pdu->command == AGENTX_MSG_REGISTER) {
+ pdu->time = *bufp; /* Timeout (Register only) */
+ DEBUGDUMPSETUP("recv", bufp, 1);
+ DEBUGMSG(("dumpv_recv", " Timeout: \t%d\n", *bufp));
+ }
+ bufp++;
+ pdu->priority = *bufp;
+ DEBUGDUMPSETUP("recv", bufp, 1);
+ DEBUGMSG(("dumpv_recv", " Priority: \t%d\n", *bufp));
+ bufp++;
+ pdu->range_subid = *bufp;
+ DEBUGDUMPSETUP("recv", bufp, 1);
+ DEBUGMSG(("dumpv_recv", " Range Sub-Id:\t%d\n", *bufp));
+ bufp++;
+ bufp++;
+ *length -= 4;
+ DEBUGINDENTLESS();
+
+ prefix_ptr = bufp + 1;
+ DEBUGDUMPHEADER("recv", "Registration OID");
+ bufp = agentx_parse_oid(bufp, length, NULL,
+ oid_buffer, &oid_buf_len,
+ pdu->flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ DEBUGINDENTLESS();
+ if (bufp == NULL) {
+ DEBUGINDENTLESS();
+ return SNMPERR_ASN_PARSE_ERR;
+ }
+
+ if (pdu->range_subid) {
+ range_bound = agentx_parse_int(bufp, pdu->flags &
+ AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ bufp += 4;
+ *length -= 4;
+
+ /*
+ * Construct the end-OID.
+ */
+ end_oid_buf_len = oid_buf_len * sizeof(oid);
+ memcpy(end_oid_buf, oid_buffer, end_oid_buf_len);
+ end_oid_buf[pdu->range_subid - 1] = range_bound;
+
+ snmp_pdu_add_variable(pdu, oid_buffer, oid_buf_len,
+ ASN_PRIV_INCL_RANGE,
+ (u_char *) end_oid_buf, end_oid_buf_len);
+ } else {
+ snmp_add_null_var(pdu, oid_buffer, oid_buf_len);
+ }
+
+ oid_buf_len = MAX_OID_LEN;
+ break;
+
+ case AGENTX_MSG_GETBULK:
+ DEBUGDUMPHEADER("recv", "Non-repeaters");
+ pdu->non_repeaters = agentx_parse_short(bufp, pdu->flags &
+ AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ DEBUGINDENTLESS();
+ DEBUGDUMPHEADER("recv", "Max-repeaters");
+ pdu->max_repetitions = agentx_parse_short(bufp + 2, pdu->flags &
+ AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ DEBUGINDENTLESS();
+ bufp += 4;
+ *length -= 4;
+ /*
+ * Fallthrough - SearchRange handling is the same
+ */
+
+ case AGENTX_MSG_GETNEXT:
+ case AGENTX_MSG_GET:
+
+ /*
+ * * SearchRange List
+ * * Keep going while we have data left
+ */
+ DEBUGDUMPHEADER("recv", "Search Range");
+ while (*length > 0) {
+ bufp = agentx_parse_oid(bufp, length, &inc,
+ oid_buffer, &oid_buf_len,
+ pdu->flags &
+ AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ if (bufp == NULL) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return SNMPERR_ASN_PARSE_ERR;
+ }
+ bufp = agentx_parse_oid(bufp, length, NULL,
+ end_oid_buf, &end_oid_buf_len,
+ pdu->flags &
+ AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ if (bufp == NULL) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return SNMPERR_ASN_PARSE_ERR;
+ }
+ end_oid_buf_len *= sizeof(oid);
+ /*
+ * 'agentx_parse_oid()' returns the number of sub_ids
+ */
+
+ if (inc) {
+ snmp_pdu_add_variable(pdu, oid_buffer, oid_buf_len,
+ ASN_PRIV_INCL_RANGE,
+ (u_char *) end_oid_buf,
+ end_oid_buf_len);
+ } else {
+ snmp_pdu_add_variable(pdu, oid_buffer, oid_buf_len,
+ ASN_PRIV_EXCL_RANGE,
+ (u_char *) end_oid_buf,
+ end_oid_buf_len);
+ }
+ }
+
+ DEBUGINDENTLESS();
+ oid_buf_len = MAX_OID_LEN;
+ end_oid_buf_len = MAX_OID_LEN;
+ break;
+
+
+ case AGENTX_MSG_RESPONSE:
+
+ pdu->flags |= UCD_MSG_FLAG_RESPONSE_PDU;
+
+ /*
+ * sysUpTime
+ */
+ pdu->time = agentx_parse_int(bufp, pdu->flags &
+ AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ bufp += 4;
+ *length -= 4;
+
+ pdu->errstat = agentx_parse_short(bufp, pdu->flags &
+ AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ pdu->errindex =
+ agentx_parse_short(bufp + 2,
+ pdu->flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ bufp += 4;
+ *length -= 4;
+ /*
+ * Fallthrough - VarBind handling is the same
+ */
+
+ case AGENTX_MSG_INDEX_ALLOCATE:
+ case AGENTX_MSG_INDEX_DEALLOCATE:
+ case AGENTX_MSG_NOTIFY:
+ case AGENTX_MSG_TESTSET:
+
+ /*
+ * * VarBind List
+ * * Keep going while we have data left
+ */
+
+ DEBUGDUMPHEADER("recv", "VarBindList");
+ while (*length > 0) {
+ bufp = agentx_parse_varbind(bufp, length, &type,
+ oid_buffer, &oid_buf_len,
+ buffer, &buf_len,
+ pdu->flags &
+ AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ if (bufp == NULL) {
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return SNMPERR_ASN_PARSE_ERR;
+ }
+ snmp_pdu_add_variable(pdu, oid_buffer, oid_buf_len,
+ (u_char) type, buffer, buf_len);
+
+ oid_buf_len = MAX_OID_LEN;
+ buf_len = sizeof(buffer);
+ }
+ DEBUGINDENTLESS();
+ break;
+
+ case AGENTX_MSG_COMMITSET:
+ case AGENTX_MSG_UNDOSET:
+ case AGENTX_MSG_CLEANUPSET:
+ case AGENTX_MSG_PING:
+
+ /*
+ * "Empty" packet
+ */
+ break;
+
+
+ case AGENTX_MSG_ADD_AGENT_CAPS:
+ /*
+ * Store AgentCap OID & description in a VarBind
+ */
+ bufp = agentx_parse_oid(bufp, length, NULL,
+ oid_buffer, &oid_buf_len,
+ pdu->flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ if (bufp == NULL)
+ return SNMPERR_ASN_PARSE_ERR;
+ bufp = agentx_parse_string(bufp, length, buffer, &buf_len,
+ pdu->flags &
+ AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ if (bufp == NULL)
+ return SNMPERR_ASN_PARSE_ERR;
+ snmp_pdu_add_variable(pdu, oid_buffer, oid_buf_len,
+ ASN_OCTET_STR, buffer, buf_len);
+
+ oid_buf_len = MAX_OID_LEN;
+ buf_len = sizeof(buffer);
+ break;
+
+ case AGENTX_MSG_REMOVE_AGENT_CAPS:
+ /*
+ * Store AgentCap OID & description in a VarBind
+ */
+ bufp = agentx_parse_oid(bufp, length, NULL,
+ oid_buffer, &oid_buf_len,
+ pdu->flags & AGENTX_FLAGS_NETWORK_BYTE_ORDER);
+ if (bufp == NULL)
+ return SNMPERR_ASN_PARSE_ERR;
+ snmp_add_null_var(pdu, oid_buffer, oid_buf_len);
+
+ oid_buf_len = MAX_OID_LEN;
+ break;
+
+ default:
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ DEBUGMSGTL(("agentx", "Unrecognised PDU type: %d\n",
+ pdu->command));
+ return SNMPERR_UNKNOWN_PDU;
+ }
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ DEBUGINDENTLESS();
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+#ifdef TESTING
+
+testit(netsnmp_pdu *pdu1)
+{
+ char packet1[BUFSIZ];
+ char packet2[BUFSIZ];
+ int len1, len2;
+ netsnmp_pdu pdu2;
+ netsnmp_session sess;
+
+ memset(&pdu2, 0, sizeof(netsnmp_pdu));
+ memset(packet1, 0, BUFSIZ);
+ memset(packet2, 0, BUFSIZ);
+
+ /*
+ * Encode this into a "packet"
+ */
+ len1 = BUFSIZ;
+ if (agentx_build(&sess, pdu1, packet1, &len1) < 0) {
+ DEBUGMSGTL(("agentx", "First build failed"));
+ exit(1);
+ }
+
+ DEBUGMSGTL(("agentx", "First build succeeded:\n"));
+ xdump(packet1, len1, "Ax1> ");
+
+ /*
+ * Unpack this into a PDU
+ */
+ len2 = len1;
+ if (agentx_parse(&pdu2, packet1, &len2, (u_char **) NULL) < 0) {
+ DEBUGMSGTL(("agentx", "First parse failed\n"));
+ exit(1);
+ }
+ DEBUGMSGTL(("agentx", "First parse succeeded:\n"));
+ if (len2 != 0)
+ DEBUGMSGTL(("agentx",
+ "Warning - parsed packet has %d bytes left\n", len2));
+
+ /*
+ * Encode this into another "packet"
+ */
+ len2 = BUFSIZ;
+ if (agentx_build(&sess, &pdu2, packet2, &len2) < 0) {
+ DEBUGMSGTL(("agentx", "Second build failed\n"));
+ exit(1);
+ }
+
+ DEBUGMSGTL(("agentx", "Second build succeeded:\n"));
+ xdump(packet2, len2, "Ax2> ");
+
+ /*
+ * Compare the results
+ */
+ if (len1 != len2) {
+ DEBUGMSGTL(("agentx",
+ "Error: first build (%d) is different to second (%d)\n",
+ len1, len2));
+ exit(1);
+ }
+ if (memcmp(packet1, packet2, len1) != 0) {
+ DEBUGMSGTL(("agentx",
+ "Error: first build data is different to second\n"));
+ exit(1);
+ }
+
+ DEBUGMSGTL(("agentx", "OK\n"));
+}
+
+
+
+main()
+{
+ netsnmp_pdu pdu1;
+ oid oid_buf[] = { 1, 3, 6, 1, 2, 1, 10 };
+ oid oid_buf2[] = { 1, 3, 6, 1, 2, 1, 20 };
+ oid null_oid[] = { 0, 0 };
+ char *string = "Example string";
+ char *context = "LUCS";
+
+
+ /*
+ * Create an example AgentX pdu structure
+ */
+
+ memset(&pdu1, 0, sizeof(netsnmp_pdu));
+ pdu1.command = AGENTX_MSG_TESTSET;
+ pdu1.flags = 0;
+ pdu1.sessid = 16;
+ pdu1.transid = 24;
+ pdu1.reqid = 132;
+
+ pdu1.time = 10;
+ pdu1.non_repeaters = 3;
+ pdu1.max_repetitions = 32;
+ pdu1.priority = 5;
+ pdu1.range_subid = 0;
+
+ snmp_pdu_add_variable(&pdu1, oid_buf, sizeof(oid_buf) / sizeof(oid),
+ ASN_OBJECT_ID, (char *) oid_buf2,
+ sizeof(oid_buf2));
+ snmp_pdu_add_variable(&pdu1, oid_buf, sizeof(oid_buf) / sizeof(oid),
+ ASN_INTEGER, (char *) &pdu1.reqid,
+ sizeof(pdu1.reqid));
+ snmp_pdu_add_variable(&pdu1, oid_buf, sizeof(oid_buf) / sizeof(oid),
+ ASN_OCTET_STR, (char *) string, strlen(string));
+
+ printf("Test with non-network order.....\n");
+ testit(&pdu1);
+
+ printf("\nTest with network order.....\n");
+ pdu1.flags |= AGENTX_FLAGS_NETWORK_BYTE_ORDER;
+ testit(&pdu1);
+
+ pdu1.community = context;
+ pdu1.community_len = strlen(context);
+ pdu1.flags |= AGENTX_FLAGS_NON_DEFAULT_CONTEXT;
+ printf("Test with non-default context.....\n");
+ testit(&pdu1);
+
+
+}
+#endif
+
+/*
+ * returns the proper length of an incoming agentx packet.
+ */
+/*
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | h.version | h.type | h.flags | <reserved> |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | h.sessionID |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | h.transactionID |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | h.packetID |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | h.payload_length |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * 20 bytes in header
+ */
+
+int
+agentx_check_packet(u_char * packet, size_t packet_len)
+{
+
+ if (packet_len < 20)
+ return 0; /* minimum header length == 20 */
+
+ return agentx_parse_int(packet + 16,
+ *(packet +
+ 2) & AGENTX_FLAGS_NETWORK_BYTE_ORDER) + 20;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/protocol.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/protocol.h
new file mode 100644
index 0000000000..341923ea3f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/protocol.h
@@ -0,0 +1,114 @@
+#ifndef AGENTX_PROTOCOL_H
+#define AGENTX_PROTOCOL_H
+
+config_belongs_in(agent_module)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ /*
+ * Definitions for Agent Extensibility Protocol (RFC 2257)
+ *
+ */
+
+#define AGENTX_PORT 705
+#ifndef NETSNMP_AGENTX_SOCKET
+#define NETSNMP_AGENTX_SOCKET "/var/agentx/master"
+#endif
+
+ /*
+ * AgentX versions
+ */
+ /*
+ * Use values distinct from those used to represent SNMP versions
+ */
+
+#define AGENTX_VERSION_BASE 192 /* Binary: 11xxxxxx */
+#define AGENTX_VERSION_1 (AGENTX_VERSION_BASE | 0x1)
+
+#define IS_AGENTX_VERSION(v) (((v)&AGENTX_VERSION_BASE) == AGENTX_VERSION_BASE)
+
+
+ /*
+ * PDU types in AgentX
+ */
+#define AGENTX_MSG_OPEN ((u_char)1)
+#define AGENTX_MSG_CLOSE ((u_char)2)
+#define AGENTX_MSG_REGISTER ((u_char)3)
+#define AGENTX_MSG_UNREGISTER ((u_char)4)
+#define AGENTX_MSG_GET ((u_char)5)
+#define AGENTX_MSG_GETNEXT ((u_char)6)
+#define AGENTX_MSG_GETBULK ((u_char)7)
+#define AGENTX_MSG_TESTSET ((u_char)8)
+#define AGENTX_MSG_COMMITSET ((u_char)9)
+#define AGENTX_MSG_UNDOSET ((u_char)10)
+#define AGENTX_MSG_CLEANUPSET ((u_char)11)
+#define AGENTX_MSG_NOTIFY ((u_char)12)
+#define AGENTX_MSG_PING ((u_char)13)
+#define AGENTX_MSG_INDEX_ALLOCATE ((u_char)14)
+#define AGENTX_MSG_INDEX_DEALLOCATE ((u_char)15)
+#define AGENTX_MSG_ADD_AGENT_CAPS ((u_char)16)
+#define AGENTX_MSG_REMOVE_AGENT_CAPS ((u_char)17)
+#define AGENTX_MSG_RESPONSE ((u_char)18)
+
+
+ /*
+ * Error codes from RFC 2257
+ */
+#define AGENTX_ERR_OPEN_FAILED (256)
+#define AGENTX_ERR_NOT_OPEN (257)
+#define AGENTX_ERR_INDEX_WRONG_TYPE (258)
+#define AGENTX_ERR_INDEX_ALREADY_ALLOCATED (259)
+#define AGENTX_ERR_INDEX_NONE_AVAILABLE (260)
+#define AGENTX_ERR_INDEX_NOT_ALLOCATED (261)
+#define AGENTX_ERR_UNSUPPORTED_CONTEXT (262)
+#define AGENTX_ERR_DUPLICATE_REGISTRATION (263)
+#define AGENTX_ERR_UNKNOWN_REGISTRATION (264)
+#define AGENTX_ERR_UNKNOWN_AGENTCAPS (265)
+
+ /*
+ * added in 1999 revision
+ */
+#define AGENTX_ERR_NOERROR SNMP_ERR_NOERROR
+#define AGENTX_ERR_PARSE_FAILED (266)
+#define AGENTX_ERR_REQUEST_DENIED (267)
+#define AGENTX_ERR_PROCESSING_ERROR (268)
+
+ /*
+ * Message processing models
+ */
+#define AGENTX_MP_MODEL_AGENTXv1 (257)
+
+
+ /*
+ * PDU Flags - see also 'UCD_MSG_FLAG_xxx' in snmp.h
+ */
+#define AGENTX_MSG_FLAG_INSTANCE_REGISTER 0x01
+#define AGENTX_MSG_FLAG_NEW_INSTANCE 0x02
+#define AGENTX_MSG_FLAG_ANY_INSTANCE 0x04
+#define AGENTX_MSG_FLAG_NON_DEFAULT_CONTEXT 0x08
+#define AGENTX_MSG_FLAG_NETWORK_BYTE_ORDER 0x10
+
+#define AGENTX_MSG_FLAGS_MASK 0xff
+
+ /*
+ * Session Flags - see also 'UCD_FLAGS_xxx' in snmp.h
+ */
+#define AGENTX_FLAGS_NETWORK_BYTE_ORDER AGENTX_MSG_FLAG_NETWORK_BYTE_ORDER
+
+
+
+ int agentx_build(netsnmp_session *, netsnmp_pdu *,
+ u_char *, size_t *);
+ int agentx_realloc_build(netsnmp_session * session,
+ netsnmp_pdu *pdu, u_char ** buf,
+ size_t * buf_len,
+ size_t * out_len);
+ int agentx_parse(netsnmp_session *, netsnmp_pdu *,
+ u_char *, size_t);
+ int agentx_check_packet(u_char *, size_t);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* AGENTX_PROTOCOL_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/subagent.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/subagent.c
new file mode 100644
index 0000000000..391fe04f84
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/subagent.c
@@ -0,0 +1,995 @@
+/*
+ * AgentX sub-agent
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/library/snmp_assert.h>
+
+#include "snmpd.h"
+#include "agentx/protocol.h"
+#include "agentx/client.h"
+#include "agentx/agentx_config.h"
+#include <net-snmp/agent/agent_callbacks.h>
+#include <net-snmp/agent/agent_trap.h>
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+#include "mibII/sysORTable.h"
+#endif
+
+#include "subagent.h"
+
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+
+static SNMPCallback subagent_register_ping_alarm;
+static SNMPAlarmCallback agentx_reopen_session;
+void agentx_register_callbacks(netsnmp_session * s);
+void agentx_unregister_callbacks(netsnmp_session * ss);
+int handle_subagent_response(int op, netsnmp_session * session,
+ int reqid, netsnmp_pdu *pdu,
+ void *magic);
+int handle_subagent_set_response(int op,
+ netsnmp_session * session,
+ int reqid, netsnmp_pdu *pdu,
+ void *magic);
+void subagent_startup_callback(unsigned int clientreg,
+ void *clientarg);
+int subagent_open_master_session(void);
+
+typedef struct _net_snmpsubagent_magic_s {
+ int original_command;
+ netsnmp_session *session;
+ netsnmp_variable_list *ovars;
+} ns_subagent_magic;
+
+struct agent_netsnmp_set_info {
+ int transID;
+ int mode;
+ int errstat;
+ time_t uptime;
+ netsnmp_session *sess;
+ netsnmp_variable_list *var_list;
+
+ struct agent_netsnmp_set_info *next;
+};
+
+static struct agent_netsnmp_set_info *Sets = NULL;
+
+netsnmp_session *agentx_callback_sess = NULL;
+extern int callback_master_num;
+extern netsnmp_session *main_session; /* from snmp_agent.c */
+
+int
+subagent_startup(int majorID, int minorID,
+ void *serverarg, void *clientarg)
+{
+ DEBUGMSGTL(("agentx/subagent", "connecting to master...\n"));
+ /*
+ * if a valid ping interval has been defined, call agentx_reopen_session
+ * to try to connect to master or setup a ping alarm if it couldn't
+ * succeed. if no ping interval was set up, just try to connect once.
+ */
+ if (netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL) > 0)
+ agentx_reopen_session(0, NULL);
+ else {
+ subagent_open_master_session();
+ }
+ return 0;
+}
+
+/**
+ * init subagent callback (local) session and connect to master agent
+ *
+ * @returns 0 for success, !0 otherwise
+ */
+int
+subagent_init(void)
+{
+ static int init = 0;
+ int rc = 0;
+
+ DEBUGMSGTL(("agentx/subagent", "initializing....\n"));
+
+ if (++init != 1)
+ return 0;
+
+ netsnmp_assert(netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_ROLE) == SUB_AGENT);
+
+#ifndef NETSNMP_TRANSPORT_CALLBACK_DOMAIN
+ snmp_log(LOG_WARNING,"AgentX subagent has been disabled because "
+ "the callback transport is not available.\n");
+ return -1;
+#endif /* NETSNMP_TRANSPORT_CALLBACK_DOMAIN */
+
+ /*
+ * open (local) callback session
+ */
+ if (agentx_callback_sess == NULL) {
+ agentx_callback_sess = netsnmp_callback_open(callback_master_num,
+ handle_subagent_response,
+ NULL, NULL);
+ DEBUGMSGTL(("agentx/subagent", "subagent_init sess %08x\n",
+ agentx_callback_sess));
+ }
+ if (NULL == agentx_callback_sess)
+ return -1;
+
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+ SNMP_CALLBACK_POST_READ_CONFIG,
+ subagent_startup, NULL);
+
+ DEBUGMSGTL(("agentx/subagent", "initializing.... DONE\n"));
+
+ return rc;
+}
+
+void
+netsnmp_enable_subagent(void) {
+ netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE,
+ SUB_AGENT);
+}
+
+struct agent_netsnmp_set_info *
+save_set_vars(netsnmp_session * ss, netsnmp_pdu *pdu)
+{
+ struct agent_netsnmp_set_info *ptr;
+ struct timeval now;
+ extern struct timeval starttime;
+
+ ptr = (struct agent_netsnmp_set_info *)
+ malloc(sizeof(struct agent_netsnmp_set_info));
+ if (ptr == NULL)
+ return NULL;
+
+ /*
+ * Save the important information
+ */
+ ptr->transID = pdu->transid;
+ ptr->sess = ss;
+ ptr->mode = SNMP_MSG_INTERNAL_SET_RESERVE1;
+ gettimeofday(&now, NULL);
+ ptr->uptime = calculate_time_diff(&now, &starttime);
+
+ ptr->var_list = snmp_clone_varbind(pdu->variables);
+ if (ptr->var_list == NULL) {
+ free(ptr);
+ return NULL;
+ }
+
+ ptr->next = Sets;
+ Sets = ptr;
+
+ return ptr;
+}
+
+struct agent_netsnmp_set_info *
+restore_set_vars(netsnmp_session * sess, netsnmp_pdu *pdu)
+{
+ struct agent_netsnmp_set_info *ptr;
+
+ for (ptr = Sets; ptr != NULL; ptr = ptr->next)
+ if (ptr->sess == sess && ptr->transID == pdu->transid)
+ break;
+
+ if (ptr == NULL || ptr->var_list == NULL)
+ return NULL;
+
+ pdu->variables = snmp_clone_varbind(ptr->var_list);
+ if (pdu->variables == NULL)
+ return NULL;
+
+ return ptr;
+}
+
+
+void
+free_set_vars(netsnmp_session * ss, netsnmp_pdu *pdu)
+{
+ struct agent_netsnmp_set_info *ptr, *prev = NULL;
+
+ for (ptr = Sets; ptr != NULL; ptr = ptr->next) {
+ if (ptr->sess == ss && ptr->transID == pdu->transid) {
+ if (prev)
+ prev->next = ptr->next;
+ else
+ Sets = ptr->next;
+ snmp_free_varbind(ptr->var_list);
+ free(ptr);
+ return;
+ }
+ prev = ptr;
+ }
+}
+
+int
+handle_agentx_packet(int operation, netsnmp_session * session, int reqid,
+ netsnmp_pdu *pdu, void *magic)
+{
+ struct agent_netsnmp_set_info *asi = NULL;
+ snmp_callback mycallback;
+ netsnmp_pdu *internal_pdu = NULL;
+ void *retmagic = NULL;
+ ns_subagent_magic *smagic = NULL;
+ int result;
+
+ if (operation == NETSNMP_CALLBACK_OP_DISCONNECT) {
+ struct synch_state *state = (struct synch_state *) magic;
+ int period =
+ netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL);
+ DEBUGMSGTL(("agentx/subagent",
+ "transport disconnect indication\n"));
+
+ /*
+ * deal with existing session. This happend if agentx sends
+ * a message to the master, but the master goes away before
+ * a response is sent. agentx will spin in snmp_synch_response_cb,
+ * waiting for a response. At the very least, the waiting
+ * flag must be set to break that loop. The rest is copied
+ * from disconnect handling in snmp_sync_input.
+ */
+ if(state) {
+ state->waiting = 0;
+ state->pdu = NULL;
+ state->status = STAT_ERROR;
+ session->s_snmp_errno = SNMPERR_ABORT;
+ SET_SNMP_ERROR(SNMPERR_ABORT);
+ }
+
+ /*
+ * Deregister the ping alarm, if any, and invalidate all other
+ * references to this session.
+ */
+ if (session->securityModel != SNMP_DEFAULT_SECMODEL) {
+ snmp_alarm_unregister(session->securityModel);
+ }
+ snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_INDEX_STOP, (void *) session);
+ agentx_unregister_callbacks(session);
+ remove_trap_session(session);
+ register_mib_detach();
+ main_session = NULL;
+ if (period != 0) {
+ /*
+ * Pings are enabled, so periodically attempt to re-establish contact
+ * with the master agent. Don't worry about the handle,
+ * agentx_reopen_session unregisters itself if it succeeds in talking
+ * to the master agent.
+ */
+ snmp_alarm_register(period, SA_REPEAT, agentx_reopen_session,
+ NULL);
+ }
+ return 0;
+ } else if (operation != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE) {
+ DEBUGMSGTL(("agentx/subagent", "unexpected callback op %d\n",
+ operation));
+ return 1;
+ }
+
+ /*
+ * ok, we have a pdu from the net. Modify as needed
+ */
+
+ DEBUGMSGTL(("agentx/subagent", "handling agentx request (req=0x%x,trans="
+ "0x%x,sess=0x%x)\n", pdu->reqid,pdu->transid, pdu->sessid));
+ pdu->version = AGENTX_VERSION_1;
+ pdu->flags |= UCD_MSG_FLAG_ALWAYS_IN_VIEW;
+
+ if (pdu->command == AGENTX_MSG_GET
+ || pdu->command == AGENTX_MSG_GETNEXT
+ || pdu->command == AGENTX_MSG_GETBULK) {
+ smagic =
+ (ns_subagent_magic *) calloc(1, sizeof(ns_subagent_magic));
+ if (smagic == NULL) {
+ DEBUGMSGTL(("agentx/subagent", "couldn't malloc() smagic\n"));
+ return 1;
+ }
+ smagic->original_command = pdu->command;
+ smagic->session = session;
+ smagic->ovars = NULL;
+ retmagic = (void *) smagic;
+ }
+
+ switch (pdu->command) {
+ case AGENTX_MSG_GET:
+ DEBUGMSGTL(("agentx/subagent", " -> get\n"));
+ pdu->command = SNMP_MSG_GET;
+ mycallback = handle_subagent_response;
+ break;
+
+ case AGENTX_MSG_GETNEXT:
+ DEBUGMSGTL(("agentx/subagent", " -> getnext\n"));
+ pdu->command = SNMP_MSG_GETNEXT;
+
+ /*
+ * We have to save a copy of the original variable list here because
+ * if the master agent has requested scoping for some of the varbinds
+ * that information is stored there.
+ */
+
+ smagic->ovars = snmp_clone_varbind(pdu->variables);
+ DEBUGMSGTL(("agentx/subagent", "saved variables\n"));
+ mycallback = handle_subagent_response;
+ break;
+
+ case AGENTX_MSG_GETBULK:
+ /*
+ * WWWXXX
+ */
+ DEBUGMSGTL(("agentx/subagent", " -> getbulk\n"));
+ pdu->command = SNMP_MSG_GETBULK;
+
+ /*
+ * We have to save a copy of the original variable list here because
+ * if the master agent has requested scoping for some of the varbinds
+ * that information is stored there.
+ */
+
+ smagic->ovars = snmp_clone_varbind(pdu->variables);
+ DEBUGMSGTL(("agentx/subagent", "saved variables at %p\n",
+ smagic->ovars));
+ mycallback = handle_subagent_response;
+ break;
+
+ case AGENTX_MSG_RESPONSE:
+ SNMP_FREE(smagic);
+ DEBUGMSGTL(("agentx/subagent", " -> response\n"));
+ return 1;
+
+ case AGENTX_MSG_TESTSET:
+ /*
+ * XXXWWW we have to map this twice to both RESERVE1 and RESERVE2
+ */
+ DEBUGMSGTL(("agentx/subagent", " -> testset\n"));
+ asi = save_set_vars(session, pdu);
+ if (asi == NULL) {
+ SNMP_FREE(smagic);
+ snmp_log(LOG_WARNING, "save_set_vars() failed\n");
+ return 1;
+ }
+ asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_RESERVE1;
+ mycallback = handle_subagent_set_response;
+ retmagic = asi;
+ break;
+
+ case AGENTX_MSG_COMMITSET:
+ DEBUGMSGTL(("agentx/subagent", " -> commitset\n"));
+ asi = restore_set_vars(session, pdu);
+ if (asi == NULL) {
+ SNMP_FREE(smagic);
+ snmp_log(LOG_WARNING, "restore_set_vars() failed\n");
+ return 1;
+ }
+ if (asi->mode != SNMP_MSG_INTERNAL_SET_RESERVE2) {
+ SNMP_FREE(smagic);
+ snmp_log(LOG_WARNING,
+ "dropping bad AgentX request (wrong mode %d)\n",
+ asi->mode);
+ return 1;
+ }
+ asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_ACTION;
+ mycallback = handle_subagent_set_response;
+ retmagic = asi;
+ break;
+
+ case AGENTX_MSG_CLEANUPSET:
+ DEBUGMSGTL(("agentx/subagent", " -> cleanupset\n"));
+ asi = restore_set_vars(session, pdu);
+ if (asi == NULL) {
+ SNMP_FREE(smagic);
+ snmp_log(LOG_WARNING, "restore_set_vars() failed\n");
+ return 1;
+ }
+ if (asi->mode == SNMP_MSG_INTERNAL_SET_RESERVE1 ||
+ asi->mode == SNMP_MSG_INTERNAL_SET_RESERVE2) {
+ asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_FREE;
+ } else if (asi->mode == SNMP_MSG_INTERNAL_SET_ACTION) {
+ asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_COMMIT;
+ } else {
+ snmp_log(LOG_WARNING,
+ "dropping bad AgentX request (wrong mode %d)\n",
+ asi->mode);
+ SNMP_FREE(retmagic);
+ return 1;
+ }
+ mycallback = handle_subagent_set_response;
+ retmagic = asi;
+ break;
+
+ case AGENTX_MSG_UNDOSET:
+ DEBUGMSGTL(("agentx/subagent", " -> undoset\n"));
+ asi = restore_set_vars(session, pdu);
+ if (asi == NULL) {
+ SNMP_FREE(smagic);
+ snmp_log(LOG_WARNING, "restore_set_vars() failed\n");
+ return 1;
+ }
+ asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_UNDO;
+ mycallback = handle_subagent_set_response;
+ retmagic = asi;
+ break;
+
+ default:
+ SNMP_FREE(smagic);
+ DEBUGMSGTL(("agentx/subagent", " -> unknown command %d (%02x)\n",
+ pdu->command, pdu->command));
+ return 0;
+ }
+
+ /*
+ * submit the pdu to the internal handler
+ */
+
+ /*
+ * We have to clone the PDU here, because when we return from this
+ * callback, sess_process_packet will free(pdu), but this call also
+ * free()s its argument PDU.
+ */
+
+ internal_pdu = snmp_clone_pdu(pdu);
+ internal_pdu->contextName = internal_pdu->community;
+ internal_pdu->contextNameLen = internal_pdu->community_len;
+ internal_pdu->community = NULL;
+ internal_pdu->community_len = 0;
+ result = snmp_async_send(agentx_callback_sess, internal_pdu, mycallback,
+ retmagic);
+ if (result == 0) {
+ snmp_free_pdu(internal_pdu);
+ }
+ return 1;
+}
+
+int
+handle_subagent_response(int op, netsnmp_session * session, int reqid,
+ netsnmp_pdu *pdu, void *magic)
+{
+ ns_subagent_magic *smagic = (ns_subagent_magic *) magic;
+ netsnmp_variable_list *u = NULL, *v = NULL;
+ int rc = 0;
+
+ if (op != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE || magic == NULL) {
+ return 1;
+ }
+
+ pdu = snmp_clone_pdu(pdu);
+ DEBUGMSGTL(("agentx/subagent",
+ "handling AgentX response (cmd 0x%02x orig_cmd 0x%02x)\n",
+ pdu->command, smagic->original_command));
+
+ if (pdu->command == SNMP_MSG_INTERNAL_SET_FREE ||
+ pdu->command == SNMP_MSG_INTERNAL_SET_UNDO ||
+ pdu->command == SNMP_MSG_INTERNAL_SET_COMMIT) {
+ free_set_vars(smagic->session, pdu);
+ }
+
+ if (smagic->original_command == AGENTX_MSG_GETNEXT) {
+ DEBUGMSGTL(("agentx/subagent",
+ "do getNext scope processing %p %p\n", smagic->ovars,
+ pdu->variables));
+ for (u = smagic->ovars, v = pdu->variables; u != NULL && v != NULL;
+ u = u->next_variable, v = v->next_variable) {
+ if (snmp_oid_compare
+ (u->val.objid, u->val_len / sizeof(oid), nullOid,
+ nullOidLen) != 0) {
+ /*
+ * The master agent requested scoping for this variable.
+ */
+ rc = snmp_oid_compare(v->name, v->name_length,
+ u->val.objid,
+ u->val_len / sizeof(oid));
+ DEBUGMSGTL(("agentx/subagent", "result "));
+ DEBUGMSGOID(("agentx/subagent", v->name, v->name_length));
+ DEBUGMSG(("agentx/subagent", " scope to "));
+ DEBUGMSGOID(("agentx/subagent",
+ u->val.objid, u->val_len / sizeof(oid)));
+ DEBUGMSG(("agentx/subagent", " result %d\n", rc));
+
+ if (rc >= 0) {
+ /*
+ * The varbind is out of scope. From RFC2741, p. 66: "If
+ * the subagent cannot locate an appropriate variable,
+ * v.name is set to the starting OID, and the VarBind is
+ * set to `endOfMibView'".
+ */
+ snmp_set_var_objid(v, u->name, u->name_length);
+ snmp_set_var_typed_value(v, SNMP_ENDOFMIBVIEW, 0, 0);
+ DEBUGMSGTL(("agentx/subagent",
+ "scope violation -- return endOfMibView\n"));
+ }
+ } else {
+ DEBUGMSGTL(("agentx/subagent", "unscoped var\n"));
+ }
+ }
+ }
+
+ /*
+ * XXXJBPN: similar for GETBULK but the varbinds can get re-ordered I
+ * think which makes it er more difficult.
+ */
+
+ if (smagic->ovars != NULL) {
+ snmp_free_varbind(smagic->ovars);
+ }
+
+ pdu->command = AGENTX_MSG_RESPONSE;
+ pdu->version = smagic->session->version;
+
+ if (!snmp_send(smagic->session, pdu)) {
+ snmp_free_pdu(pdu);
+ }
+ DEBUGMSGTL(("agentx/subagent", " FINISHED\n"));
+ free(smagic);
+ return 1;
+}
+
+int
+handle_subagent_set_response(int op, netsnmp_session * session, int reqid,
+ netsnmp_pdu *pdu, void *magic)
+{
+ netsnmp_session *retsess;
+ struct agent_netsnmp_set_info *asi;
+ int result;
+
+ if (op != NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE || magic == NULL) {
+ return 1;
+ }
+
+ DEBUGMSGTL(("agentx/subagent",
+ "handling agentx subagent set response (mode=%d,req=0x%x,"
+ "trans=0x%x,sess=0x%x)\n",
+ pdu->command, pdu->reqid,pdu->transid, pdu->sessid));
+ pdu = snmp_clone_pdu(pdu);
+
+ asi = (struct agent_netsnmp_set_info *) magic;
+ retsess = asi->sess;
+ asi->errstat = pdu->errstat;
+
+ if (asi->mode == SNMP_MSG_INTERNAL_SET_RESERVE1) {
+ /*
+ * reloop for RESERVE2 mode, an internal only agent mode
+ */
+ /*
+ * XXX: check exception statuses of reserve1 first
+ */
+ if (!pdu->errstat) {
+ asi->mode = pdu->command = SNMP_MSG_INTERNAL_SET_RESERVE2;
+ result = snmp_async_send(agentx_callback_sess, pdu,
+ handle_subagent_set_response, asi);
+ if (result == 0) {
+ snmp_free_pdu(pdu);
+ }
+ DEBUGMSGTL(("agentx/subagent",
+ " going from RESERVE1 -> RESERVE2\n"));
+ return 1;
+ }
+ } else {
+ if (asi->mode == SNMP_MSG_INTERNAL_SET_FREE ||
+ asi->mode == SNMP_MSG_INTERNAL_SET_UNDO ||
+ asi->mode == SNMP_MSG_INTERNAL_SET_COMMIT) {
+ free_set_vars(retsess, pdu);
+ }
+ snmp_free_varbind(pdu->variables);
+ pdu->variables = NULL; /* the variables were added by us */
+ }
+
+ netsnmp_assert(retsess != NULL);
+ pdu->command = AGENTX_MSG_RESPONSE;
+ pdu->version = retsess->version;
+
+ if (!snmp_send(retsess, pdu)) {
+ snmp_free_pdu(pdu);
+ }
+ DEBUGMSGTL(("agentx/subagent", " FINISHED\n"));
+ return 1;
+}
+
+
+
+int
+agentx_registration_callback(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ struct register_parameters *reg_parms =
+ (struct register_parameters *) serverarg;
+ netsnmp_session *agentx_ss = (netsnmp_session *) clientarg;
+
+ if (minorID == SNMPD_CALLBACK_REGISTER_OID)
+ return agentx_register(agentx_ss,
+ reg_parms->name, reg_parms->namelen,
+ reg_parms->priority,
+ reg_parms->range_subid,
+ reg_parms->range_ubound, reg_parms->timeout,
+ reg_parms->flags,
+ reg_parms->contextName);
+ else
+ return agentx_unregister(agentx_ss,
+ reg_parms->name, reg_parms->namelen,
+ reg_parms->priority,
+ reg_parms->range_subid,
+ reg_parms->range_ubound,
+ reg_parms->contextName);
+}
+
+
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+int
+agentx_sysOR_callback(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ struct register_sysOR_parameters *reg_parms =
+ (struct register_sysOR_parameters *) serverarg;
+ netsnmp_session *agentx_ss = (netsnmp_session *) clientarg;
+
+ if (minorID == SNMPD_CALLBACK_REG_SYSOR)
+ return agentx_add_agentcaps(agentx_ss,
+ reg_parms->name, reg_parms->namelen,
+ reg_parms->descr);
+ else
+ return agentx_remove_agentcaps(agentx_ss,
+ reg_parms->name,
+ reg_parms->namelen);
+}
+#endif
+
+
+static int
+subagent_shutdown(int majorID, int minorID, void *serverarg, void *clientarg)
+{
+ netsnmp_session *thesession = (netsnmp_session *)clientarg;
+ DEBUGMSGTL(("agentx/subagent", "shutting down session....\n"));
+ if (thesession == NULL) {
+ DEBUGMSGTL(("agentx/subagent", "Empty session to shutdown\n"));
+ main_session = NULL;
+ return 0;
+ }
+ agentx_close_session(thesession, AGENTX_CLOSE_SHUTDOWN);
+ snmp_close(thesession);
+ main_session = NULL;
+ DEBUGMSGTL(("agentx/subagent", "shut down finished.\n"));
+ return 1;
+}
+
+
+
+/*
+ * Register all the "standard" AgentX callbacks for the given session.
+ */
+
+void
+agentx_register_callbacks(netsnmp_session * s)
+{
+ DEBUGMSGTL(("agentx/subagent",
+ "registering callbacks for session %p\n", s));
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN,
+ subagent_shutdown, s);
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_REGISTER_OID,
+ agentx_registration_callback, s);
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_UNREGISTER_OID,
+ agentx_registration_callback, s);
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_REG_SYSOR,
+ agentx_sysOR_callback, s);
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_UNREG_SYSOR,
+ agentx_sysOR_callback, s);
+#endif
+}
+
+/*
+ * Unregister all the callbacks associated with this session.
+ */
+
+void
+agentx_unregister_callbacks(netsnmp_session * ss)
+{
+ DEBUGMSGTL(("agentx/subagent",
+ "unregistering callbacks for session %p\n", ss));
+ snmp_unregister_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_SHUTDOWN,
+ subagent_shutdown, ss, 1);
+ snmp_unregister_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_REGISTER_OID,
+ agentx_registration_callback, ss, 1);
+ snmp_unregister_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_UNREGISTER_OID,
+ agentx_registration_callback, ss, 1);
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+ snmp_unregister_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_REG_SYSOR,
+ agentx_sysOR_callback, ss, 1);
+ snmp_unregister_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_UNREG_SYSOR,
+ agentx_sysOR_callback, ss, 1);
+#endif
+
+}
+
+/*
+ * Open a session to the master agent.
+ */
+int
+subagent_open_master_session(void)
+{
+ netsnmp_transport *t;
+ netsnmp_session sess;
+
+ DEBUGMSGTL(("agentx/subagent", "opening session...\n"));
+
+ if (main_session) {
+ snmp_log(LOG_WARNING,
+ "AgentX session to master agent attempted to be re-opened.\n");
+ return -1;
+ }
+
+ snmp_sess_init(&sess);
+ sess.version = AGENTX_VERSION_1;
+ sess.retries = SNMP_DEFAULT_RETRIES;
+ sess.timeout = SNMP_DEFAULT_TIMEOUT;
+ sess.flags |= SNMP_FLAGS_STREAM_SOCKET;
+ sess.callback = handle_agentx_packet;
+ sess.authenticator = NULL;
+
+ t = netsnmp_transport_open_client(
+ "agentx", netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_X_SOCKET));
+ if (t == NULL) {
+ /*
+ * Diagnose snmp_open errors with the input
+ * netsnmp_session pointer.
+ */
+ if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_NO_CONNECTION_WARNINGS)) {
+ char buf[1024];
+ const char *socket =
+ netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_X_SOCKET);
+ snprintf(buf, sizeof(buf), "Warning: "
+ "Failed to connect to the agentx master agent (%s)",
+ socket ? socket : "[NIL]");
+ if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_NO_ROOT_ACCESS)) {
+ netsnmp_sess_log_error(LOG_WARNING, buf, &sess);
+ } else {
+ snmp_sess_perror(buf, &sess);
+ }
+ }
+ return -1;
+ }
+
+ main_session =
+ snmp_add_full(&sess, t, NULL, agentx_parse, NULL, NULL,
+ agentx_realloc_build, agentx_check_packet, NULL);
+
+ if (main_session == NULL) {
+ if (!netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_NO_CONNECTION_WARNINGS)) {
+ char buf[1024];
+ snprintf(buf, sizeof(buf), "Error: "
+ "Failed to create the agentx master agent session (%s)",
+ netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_X_SOCKET));
+ snmp_sess_perror(buf, &sess);
+ }
+ netsnmp_transport_free(t);
+ return -1;
+ }
+
+ /*
+ * I don't know why 1 is success instead of the usual 0 = noerr,
+ * but that's what the function returns.
+ */
+ if (1 != agentx_open_session(main_session)) {
+ snmp_close(main_session);
+ main_session = NULL;
+ return -1;
+ }
+
+ /*
+ * subagent_register_ping_alarm assumes that securityModel will
+ * be set to SNMP_DEFAULT_SECMODEL on new AgentX sessions.
+ * This field is then (ab)used to hold the alarm stash.
+ *
+ * Why is the securityModel field used for this purpose, I hear you ask.
+ * Damn good question! (See SVN revision 4886)
+ */
+ main_session->securityModel = SNMP_DEFAULT_SECMODEL;
+
+ if (add_trap_session(main_session, AGENTX_MSG_NOTIFY, 1,
+ AGENTX_VERSION_1)) {
+ DEBUGMSGTL(("agentx/subagent", " trap session registered OK\n"));
+ } else {
+ DEBUGMSGTL(("agentx/subagent",
+ "trap session registration failed\n"));
+ snmp_close(main_session);
+ main_session = NULL;
+ return -1;
+ }
+
+ agentx_register_callbacks(main_session);
+
+ snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_INDEX_START, (void *) main_session);
+
+ snmp_log(LOG_INFO, "NET-SNMP version %s AgentX subagent connected\n",
+ netsnmp_get_version());
+ DEBUGMSGTL(("agentx/subagent", "opening session... DONE (%p)\n",
+ main_session));
+
+ return 0;
+}
+
+
+/*
+ * Alarm callback function to open a session to the master agent. If a
+ * transport disconnection callback occurs, indicating that the master agent
+ * has died (or there has been some strange communication problem), this
+ * alarm is called repeatedly to try to re-open the connection.
+ */
+
+void
+agentx_reopen_session(unsigned int clientreg, void *clientarg)
+{
+ DEBUGMSGTL(("agentx/subagent", "agentx_reopen_session(%d) called\n",
+ clientreg));
+
+ if (subagent_open_master_session() == 0) {
+ /*
+ * Successful. Delete the alarm handle if one exists.
+ */
+ if (clientreg != 0) {
+ snmp_alarm_unregister(clientreg);
+ }
+
+ /*
+ * Reregister all our nodes.
+ */
+ register_mib_reattach();
+
+ /*
+ * Register a ping alarm (if need be).
+ */
+ subagent_register_ping_alarm(0, 0, 0, main_session);
+ } else {
+ if (clientreg == 0) {
+ /*
+ * Register a reattach alarm for later
+ */
+ subagent_register_ping_alarm(0, 0, 0, main_session);
+ }
+ }
+}
+
+/*
+ * If a valid session is passed in (through clientarg), register a
+ * ping handler to ping it frequently, else register an attempt to try
+ * and open it again later.
+ */
+
+static int
+subagent_register_ping_alarm(int majorID, int minorID,
+ void *serverarg, void *clientarg)
+{
+
+ netsnmp_session *ss = (netsnmp_session *) clientarg;
+ int ping_interval =
+ netsnmp_ds_get_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL);
+
+ if (!ping_interval) /* don't do anything if not setup properly */
+ return 0;
+
+ /*
+ * register a ping alarm, if desired
+ */
+ if (ss) {
+ if (ss->securityModel != SNMP_DEFAULT_SECMODEL) {
+ DEBUGMSGTL(("agentx/subagent",
+ "unregister existing alarm %d\n",
+ ss->securityModel));
+ snmp_alarm_unregister(ss->securityModel);
+ }
+
+ DEBUGMSGTL(("agentx/subagent",
+ "register ping alarm every %d seconds\n",
+ ping_interval));
+ /*
+ * we re-use the securityModel parameter for an alarm stash,
+ * since agentx doesn't need it
+ */
+ ss->securityModel = snmp_alarm_register(ping_interval, SA_REPEAT,
+ agentx_check_session, ss);
+ } else {
+ /*
+ * attempt to open it later instead
+ */
+ DEBUGMSGTL(("agentx/subagent",
+ "subagent not properly attached, postponing registration till later....\n"));
+ snmp_alarm_register(ping_interval, SA_REPEAT,
+ agentx_reopen_session, NULL);
+ }
+ return 0;
+}
+
+/*
+ * check a session validity for connectivity to the master agent. If
+ * not functioning, close and start attempts to reopen the session
+ */
+void
+agentx_check_session(unsigned int clientreg, void *clientarg)
+{
+ netsnmp_session *ss = (netsnmp_session *) clientarg;
+ if (!ss) {
+ if (clientreg)
+ snmp_alarm_unregister(clientreg);
+ return;
+ }
+ DEBUGMSGTL(("agentx/subagent", "checking status of session %p\n", ss));
+
+ if (!agentx_send_ping(ss)) {
+ snmp_log(LOG_WARNING,
+ "AgentX master agent failed to respond to ping. Attempting to re-register.\n");
+ /*
+ * master agent disappeared? Try and re-register.
+ * close first, just to be sure .
+ */
+ agentx_unregister_callbacks(ss);
+ agentx_close_session(ss, AGENTX_CLOSE_TIMEOUT);
+ snmp_alarm_unregister(clientreg); /* delete ping alarm timer */
+ snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_INDEX_STOP, (void *) ss);
+ register_mib_detach();
+ if (main_session != NULL) {
+ remove_trap_session(ss);
+ snmp_close(main_session);
+ main_session = NULL;
+ agentx_reopen_session(0, NULL);
+ }
+ else {
+ snmp_close(main_session);
+ main_session = NULL;
+ }
+ } else {
+ DEBUGMSGTL(("agentx/subagent", "session %p responded to ping\n",
+ ss));
+ }
+}
+
+
+#endif /* USING_AGENTX_SUBAGENT_MODULE */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/subagent.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/subagent.h
new file mode 100644
index 0000000000..b55bec1d1d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/agentx/subagent.h
@@ -0,0 +1,21 @@
+#ifndef _AGENTX_SUBAGENT_H
+#define _AGENTX_SUBAGENT_H
+
+config_belongs_in(agent_module)
+
+config_require(agentx/protocol)
+config_require(agentx/client)
+config_require(agentx/agentx_config)
+
+#ifndef NETSNMP_TRANSPORT_CALLBACK_DOMAIN
+config_error(agentx/subagent depends on the Callback transport)
+#endif
+
+ int subagent_init(void);
+ int handle_agentx_packet(int, netsnmp_session *, int,
+ netsnmp_pdu *, void *);
+ SNMPCallback agentx_register_callback;
+ SNMPCallback agentx_unregister_callback;
+ SNMPAlarmCallback agentx_check_session;
+
+#endif /* _AGENTX_SUBAGENT_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/default_modules.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/default_modules.h
new file mode 100644
index 0000000000..6a77f708a1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/default_modules.h
@@ -0,0 +1,56 @@
+/* this is a Net-SNMP distributed file that sets all default mib
+ modules to be built into the Net-SNMP agent */
+
+
+/* these go into both the mini agent and the full agent */
+config_require(snmpv3mibs)
+
+#ifdef NETSNMP_MINI_AGENT
+
+/* limit the mibII modules to the bare minimum */
+config_require(mibII/snmp_mib)
+config_require(mibII/system_mib)
+config_require(mibII/sysORTable)
+config_require(mibII/vacm_vars)
+config_require(mibII/vacm_conf)
+config_require(utilities/execute)
+
+/* very few default mibs */
+config_add_mib(SNMPv2-MIB)
+config_add_mib(RFC1213-MIB)
+
+#else /* !NETSNMP_MINI_AGENT == the full shabang */
+
+config_require(mibII)
+config_require(ucd_snmp)
+config_require(notification)
+config_require(notification-log-mib)
+config_require(target)
+config_require(agent_mibs)
+config_require(agentx)
+config_require(disman/event)
+config_require(disman/schedule)
+config_require(utilities)
+
+/* default MIBs to auto-include for parsing */
+/* NOTE: we consider these MIBs users will likely want to load by
+ default, even if they're not supporting it in the agent (ie, the
+ command line tools need to load them anyway) */
+config_add_mib(IP-MIB)
+config_add_mib(IF-MIB)
+config_add_mib(TCP-MIB)
+config_add_mib(UDP-MIB)
+config_add_mib(HOST-RESOURCES-MIB)
+config_add_mib(SNMPv2-MIB)
+config_add_mib(RFC1213-MIB)
+config_add_mib(NOTIFICATION-LOG-MIB)
+config_add_mib(DISMAN-EVENT-MIB)
+config_add_mib(DISMAN-SCHEDULE-MIB)
+
+/* architecture specific extra modules */
+/* these symbols are set in the host specific net-snmp/system/<os>.h files */
+#ifdef NETSNMP_INCLUDE_HOST_RESOURCES
+ config_require(host)
+#endif
+
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman.h
new file mode 100644
index 0000000000..80f3e1fed5
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman.h
@@ -0,0 +1,9 @@
+/*
+ * Wrapper for the full DisMan implementation
+ */
+config_require(disman/event-mib)
+config_require(disman/expression-mib)
+config_require(disman/schedule)
+/* config_require(disman/nslookup-mib) */
+/* config_require(disman/ping-mib) */
+/* config_require(disman/traceroute-mib) */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event-mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event-mib.h
new file mode 100644
index 0000000000..58c83915c2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event-mib.h
@@ -0,0 +1,2 @@
+config_require(disman/event)
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event.h
new file mode 100644
index 0000000000..e646975858
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event.h
@@ -0,0 +1,34 @@
+config_add_mib(DISMAN-EVENT-MIB)
+
+/*
+ * wrapper for the new disman event mib implementation code files
+ */
+config_require(disman/event/mteScalars)
+config_require(disman/event/mteTrigger)
+config_require(disman/event/mteTriggerTable)
+config_require(disman/event/mteTriggerDeltaTable)
+config_require(disman/event/mteTriggerExistenceTable)
+config_require(disman/event/mteTriggerBooleanTable)
+config_require(disman/event/mteTriggerThresholdTable)
+config_require(disman/event/mteTriggerConf)
+config_require(disman/event/mteEvent)
+config_require(disman/event/mteEventTable)
+config_require(disman/event/mteEventSetTable)
+config_require(disman/event/mteEventNotificationTable)
+config_require(disman/event/mteEventConf)
+config_require(disman/event/mteObjects)
+config_require(disman/event/mteObjectsTable)
+config_require(disman/event/mteObjectsConf)
+
+/*
+ * conflicts with the previous implementation
+ */
+config_exclude(disman/mteTriggerTable)
+config_exclude(disman/mteTriggerDeltaTable)
+config_exclude(disman/mteTriggerExistenceTable)
+config_exclude(disman/mteTriggerBooleanTable)
+config_exclude(disman/mteTriggerThresholdTable)
+config_exclude(disman/mteObjectsTable)
+config_exclude(disman/mteEventTable)
+config_exclude(disman/mteEventNotificationTable)
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEvent.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEvent.c
new file mode 100644
index 0000000000..327f8baba0
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEvent.c
@@ -0,0 +1,480 @@
+/*
+ * DisMan Event MIB:
+ * Core implementation of the event handling behaviour
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "disman/event/mteEvent.h"
+#include "disman/event/mteTrigger.h"
+#include "disman/event/mteObjects.h"
+
+netsnmp_tdata *event_table_data;
+
+ /*
+ * Initialize the container for the (combined) mteEvent*Table,
+ * regardless of which table initialisation routine is called first.
+ */
+
+void
+init_event_table_data(void)
+{
+ DEBUGMSGTL(("disman:event:init", "init event container\n"));
+ if (!event_table_data) {
+ event_table_data = netsnmp_tdata_create_table("mteEventTable", 0);
+ DEBUGMSGTL(("disman:event:init", "create event container (%x)\n",
+ event_table_data));
+ }
+}
+
+void _init_default_mteEvent( const char *event, const char *oname, int specific );
+void _init_link_mteEvent( const char *event, const char *oname, int specific );
+void _init_builtin_mteEvent( const char *event, const char *oname,
+ oid *trapOID, size_t trapOID_len );
+
+
+/** Initializes the mteEvent module */
+void
+init_mteEvent(void)
+{
+ static int _defaults_init = 0;
+ init_event_table_data();
+
+ /*
+ * Insert fixed events for the default trigger notifications
+ *
+ * NB: internal events (with an owner of "_snmpd") will not in
+ * fact refer to the mteObjectsTable for the payload varbinds.
+ * The routine mteObjects_internal_vblist() hardcodes the
+ * appropriate varbinds for these internal events.
+ * This routine will need to be updated whenever a new
+ * internal event is added.
+ */
+ if ( _defaults_init)
+ return;
+
+ _init_default_mteEvent( "mteTriggerFired", "_triggerFire", 1 );
+ _init_default_mteEvent( "mteTriggerRising", "_triggerFire", 2 );
+ _init_default_mteEvent( "mteTriggerFalling", "_triggerFire", 3 );
+ _init_default_mteEvent( "mteTriggerFailure", "_triggerFail", 4 );
+
+ _init_link_mteEvent( "linkDown", "_linkUpDown", 3 );
+ _init_link_mteEvent( "linkUp", "_linkUpDown", 4 );
+ _defaults_init = 1;
+}
+
+void
+_init_builtin_mteEvent( const char *event, const char *oname, oid *trapOID, size_t trapOID_len )
+{
+ char ename[ MTE_STR1_LEN+1 ];
+ netsnmp_tdata_row *row;
+ struct mteEvent *entry;
+
+ memset(ename, 0, sizeof(ename));
+ ename[0] = '_';
+ memcpy(ename+1, event, strlen(event));
+
+ row = mteEvent_createEntry( "_snmpd", ename, 1 );
+ if (!row || !row->data)
+ return;
+ entry = (struct mteEvent *)row->data;
+
+ entry->mteEventActions = MTE_EVENT_NOTIFICATION;
+ entry->mteNotification_len = trapOID_len;
+ memcpy( entry->mteNotification, trapOID, trapOID_len*sizeof(oid));
+ memcpy( entry->mteNotifyOwner, "_snmpd", 6 );
+ memcpy( entry->mteNotifyObjects, oname, strlen(oname));
+ entry->flags |= MTE_EVENT_FLAG_ENABLED|
+ MTE_EVENT_FLAG_ACTIVE|
+ MTE_EVENT_FLAG_VALID;
+}
+
+void
+_init_default_mteEvent( const char *event, const char *oname, int specific )
+{
+ oid mteTrapOID[] = {1, 3, 6, 1, 2, 1, 88, 2, 0, 99 /* placeholder */};
+ size_t mteTrapOID_len = OID_LENGTH(mteTrapOID);
+
+ mteTrapOID[ mteTrapOID_len-1 ] = specific;
+ _init_builtin_mteEvent( event, oname, mteTrapOID, mteTrapOID_len );
+}
+
+
+void
+_init_link_mteEvent( const char *event, const char *oname, int specific )
+{
+ oid mteTrapOID[] = {1, 3, 6, 1, 6, 3, 1, 1, 5, 99 /* placeholder */};
+ size_t mteTrapOID_len = OID_LENGTH(mteTrapOID);
+
+ mteTrapOID[ mteTrapOID_len-1 ] = specific;
+ _init_builtin_mteEvent( event, oname, mteTrapOID, mteTrapOID_len );
+}
+
+
+ /* ===================================================
+ *
+ * APIs for maintaining the contents of the (combined)
+ * mteEvent*Table container.
+ *
+ * =================================================== */
+
+void
+_mteEvent_dump(void)
+{
+ struct mteEvent *entry;
+ netsnmp_tdata_row *row;
+ int i = 0;
+
+ for (row = netsnmp_tdata_row_first(event_table_data);
+ row;
+ row = netsnmp_tdata_row_next(event_table_data, row)) {
+ entry = (struct mteEvent *)row->data;
+ DEBUGMSGTL(("disman:event:dump", "EventTable entry %d: ", i));
+ DEBUGMSGOID(("disman:event:dump", row->oid_index.oids, row->oid_index.len));
+ DEBUGMSG(("disman:event:dump", "(%s, %s)",
+ row->indexes->val.string,
+ row->indexes->next_variable->val.string));
+ DEBUGMSG(("disman:event:dump", ": %x, %x\n", row, entry));
+ i++;
+ }
+ DEBUGMSGTL(("disman:event:dump", "EventTable %d entries\n", i));
+}
+
+
+/*
+ * Create a new row in the event table
+ */
+netsnmp_tdata_row *
+mteEvent_createEntry(const char *mteOwner, const char *mteEName, int fixed)
+{
+ struct mteEvent *entry;
+ netsnmp_tdata_row *row;
+ size_t mteOwner_len = (mteOwner) ? strlen(mteOwner) : 0;
+ size_t mteEName_len = (mteEName) ? strlen(mteEName) : 0;
+
+ DEBUGMSGTL(("disman:event:table", "Create event entry (%s, %s)\n",
+ mteOwner, mteEName));
+ /*
+ * Create the mteEvent entry, and the
+ * (table-independent) row wrapper structure...
+ */
+ entry = SNMP_MALLOC_TYPEDEF(struct mteEvent);
+ if (!entry)
+ return NULL;
+
+ row = netsnmp_tdata_create_row();
+ if (!row) {
+ SNMP_FREE(entry);
+ return NULL;
+ }
+ row->data = entry;
+
+ /*
+ * ... initialize this row with the indexes supplied
+ * and the default values for the row...
+ */
+ if (mteOwner)
+ memcpy(entry->mteOwner, mteOwner, mteOwner_len);
+ netsnmp_table_row_add_index(row, ASN_OCTET_STR,
+ entry->mteOwner, mteOwner_len);
+ if (mteEName)
+ memcpy(entry->mteEName, mteEName, mteEName_len);
+ netsnmp_table_row_add_index(row, ASN_PRIV_IMPLIED_OCTET_STR,
+ entry->mteEName, mteEName_len);
+
+ entry->mteNotification_len = 2; /* .0.0 */
+ if (fixed)
+ entry->flags |= MTE_EVENT_FLAG_FIXED;
+
+ /*
+ * ... and insert the row into the (common) table container
+ */
+ netsnmp_tdata_add_row(event_table_data, row);
+ DEBUGMSGTL(("disman:event:table", "Event entry created\n"));
+ return row;
+}
+
+
+/*
+ * Remove a row from the event table
+ */
+void
+mteEvent_removeEntry(netsnmp_tdata_row *row)
+{
+ struct mteEvent *entry;
+
+ if (!row)
+ return; /* Nothing to remove */
+ entry = (struct mteEvent *)
+ netsnmp_tdata_remove_and_delete_row(event_table_data, row);
+ if (entry)
+ SNMP_FREE(entry);
+}
+
+ /* ===================================================
+ *
+ * APIs for processing the firing of an event
+ *
+ * =================================================== */
+
+int
+_mteEvent_fire_notify( struct mteEvent *event,
+ struct mteTrigger *trigger,
+ oid *suffix, size_t sfx_len );
+int
+_mteEvent_fire_set( struct mteEvent *event,
+ struct mteTrigger *trigger,
+ oid *suffix, size_t sfx_len );
+
+int
+mteEvent_fire( char *owner, char *event, /* Event to invoke */
+ struct mteTrigger *trigger, /* Trigger that fired */
+ oid *suffix, size_t s_len ) /* Matching instance */
+{
+ struct mteEvent *entry;
+ int fired = 0;
+ netsnmp_variable_list owner_var, event_var;
+
+ DEBUGMSGTL(("disman:event:fire", "Event fired (%s, %s)\n",
+ owner, event));
+
+ /*
+ * Retrieve the entry for the specified event
+ */
+ memset( &owner_var, 0, sizeof(owner_var));
+ memset( &event_var, 0, sizeof(event_var));
+ snmp_set_var_typed_value(&owner_var, ASN_OCTET_STR, owner, strlen(owner));
+ snmp_set_var_typed_value(&event_var, ASN_PRIV_IMPLIED_OCTET_STR,
+ event, strlen(event));
+ owner_var.next_variable = &event_var;
+ entry = (struct mteEvent *)
+ netsnmp_tdata_row_entry(
+ netsnmp_tdata_row_get_byidx( event_table_data, &owner_var ));
+ if (!entry) {
+ DEBUGMSGTL(("disman:event:fire", "No matching event\n"));
+ return -1;
+ }
+
+ if (entry->mteEventActions & MTE_EVENT_NOTIFICATION) {
+ DEBUGMSGTL(("disman:event:fire", "Firing notification event\n"));
+ _mteEvent_fire_notify( entry, trigger, suffix, s_len );
+ fired = 1;
+ }
+ if (entry->mteEventActions & MTE_EVENT_SET) {
+ DEBUGMSGTL(("disman:event:fire", "Firing set event\n"));
+ _mteEvent_fire_set( entry, trigger, suffix, s_len );
+ fired = 1;
+ }
+
+ if (!fired)
+ DEBUGMSGTL(("disman:event:fire", "Matched event is empty\n"));
+
+ return fired;
+}
+
+
+#ifdef __NOT_NEEDED
+void
+_insert_internal_objects( netsnmp_variable_list *vblist, char *oname,
+ struct mteTrigger *trigger)
+{
+ netsnmp_variable_list *var = NULL, *vp;
+ oid mteHotTrigger[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 1, 0};
+ oid mteHotTarget[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 2, 0};
+ oid mteHotContext[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 3, 0};
+ oid mteHotOID[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 4, 0};
+ oid mteHotValue[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 5, 0};
+
+ /*
+ * Construct the varbinds for this (internal) event...
+ */
+ if ((!strcmp(oname, "_mteTriggerFired" )) ||
+ (!strcmp(oname, "_mteTriggerRising" )) ||
+ (!strcmp(oname, "_mteTriggerFalling")) ||
+ (!strcmp(oname, "_triggerFire"))) {
+
+ snmp_varlist_add_variable( &var,
+ mteHotTrigger, OID_LENGTH(mteHotTrigger),
+ ASN_OCTET_STR, trigger->mteTName,
+ strlen(trigger->mteTName));
+ snmp_varlist_add_variable( &var,
+ mteHotTarget, OID_LENGTH(mteHotTarget),
+ ASN_OCTET_STR, trigger->mteTriggerTarget,
+ strlen(trigger->mteTriggerTarget));
+ snmp_varlist_add_variable( &var,
+ mteHotContext, OID_LENGTH(mteHotContext),
+ ASN_OCTET_STR, trigger->mteTriggerContext,
+ strlen(trigger->mteTriggerContext));
+ snmp_varlist_add_variable( &var,
+ mteHotOID, OID_LENGTH(mteHotOID),
+ ASN_OBJECT_ID, (char *)trigger->mteTriggerFired->name,
+ trigger->mteTriggerFired->name_length*sizeof(oid));
+ snmp_varlist_add_variable( &var,
+ mteHotValue, OID_LENGTH(mteHotValue),
+ trigger->mteTriggerFired->type,
+ trigger->mteTriggerFired->val.string,
+ trigger->mteTriggerFired->val_len);
+ } else {
+ DEBUGMSGTL(("disman:event:fire",
+ "Unknown internal objects tag (%s)\n", oname));
+ return;
+ }
+
+ /*
+ * ... and insert them into the main varbind list
+ * (at the point specified)
+ */
+ for (vp = var; vp && vp->next_variable; vp=vp->next_variable)
+ ;
+ vp->next_variable = vblist->next_variable;
+ vblist->next_variable = var;
+}
+#endif
+
+int
+_mteEvent_fire_notify( struct mteEvent *entry, /* The event to fire */
+ struct mteTrigger *trigger, /* Trigger that fired */
+ oid *suffix, size_t sfx_len ) /* Matching instance */
+{
+ netsnmp_variable_list *var, *v2;
+ oid snmptrap_oid[] = { 1,3,6,1,6,3,1,1,4,1,0 };
+ size_t snmptrap_oid_len = OID_LENGTH(snmptrap_oid);
+ netsnmp_session *s;
+
+ /*
+ * The Event-MIB specification says that objects from the
+ * mteEventTable should come after those from the trigger,
+ * but things actually work better if these come first.
+ * Allow the agent to be configured either way.
+ */
+ int strictOrdering = netsnmp_ds_get_boolean(
+ NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_STRICT_DISMAN);
+
+ var = (netsnmp_variable_list *)SNMP_MALLOC_TYPEDEF( netsnmp_variable_list );
+ if (!var)
+ return -1;
+
+ /*
+ * Set the basic notification OID...
+ */
+ memset(var, 0, sizeof(netsnmp_variable_list));
+ snmp_set_var_objid( var, snmptrap_oid, snmptrap_oid_len );
+ snmp_set_var_typed_value( var, ASN_OBJECT_ID,
+ (u_char *)entry->mteNotification,
+ entry->mteNotification_len*sizeof(oid));
+
+ /*
+ * ... then add the specified objects from the Objects Table.
+ *
+ * Strictly speaking, the objects from the EventTable are meant
+ * to be listed last (after the various trigger objects).
+ * But logically things actually work better if the event objects
+ * are placed first. So this code handles things either way :-)
+ */
+
+ if (!strictOrdering) {
+ DEBUGMSGTL(("disman:event:fire", "Adding event objects (first)\n"));
+ if (strcmp(entry->mteNotifyOwner, "_snmpd") != 0)
+ mteObjects_vblist( var, entry->mteNotifyOwner,
+ entry->mteNotifyObjects,
+ suffix, sfx_len );
+ }
+
+ DEBUGMSGTL(("disman:event:fire", "Adding trigger objects (general)\n"));
+ mteObjects_vblist( var, trigger->mteTriggerOOwner,
+ trigger->mteTriggerObjects,
+ suffix, sfx_len );
+ DEBUGMSGTL(("disman:event:fire", "Adding trigger objects (specific)\n"));
+ mteObjects_vblist( var, trigger->mteTriggerXOwner,
+ trigger->mteTriggerXObjects,
+ suffix, sfx_len );
+
+ if (strictOrdering) {
+ DEBUGMSGTL(("disman:event:fire", "Adding event objects (last)\n"));
+ if (strcmp(entry->mteNotifyOwner, "_snmpd") != 0)
+ mteObjects_vblist( var, entry->mteNotifyOwner,
+ entry->mteNotifyObjects,
+ suffix, sfx_len );
+ }
+
+ /*
+ * Query the agent to retrieve the necessary values...
+ * (skipping the initial snmpTrapOID varbind)
+ */
+ v2 = var->next_variable;
+ if (entry->session)
+ s = entry->session;
+ else
+ s = trigger->session;
+ netsnmp_query_get( v2, s );
+
+ /*
+ * ... add any "internal" objects...
+ * (skipped by the processing above, and best handled directly)
+ */
+ if (strcmp(entry->mteNotifyOwner, "_snmpd") == 0) {
+ DEBUGMSGTL(("disman:event:fire", "Adding event objects (internal)\n"));
+ if ( !strictOrdering ) {
+ mteObjects_internal_vblist(var, entry->mteNotifyObjects, trigger, s);
+ } else {
+ for (v2 = var; v2 && v2->next_variable; v2=v2->next_variable)
+ ;
+ mteObjects_internal_vblist(v2, entry->mteNotifyObjects, trigger, s);
+ }
+ }
+
+ /*
+ * ... and send the resulting varbind list as a notification
+ */
+ send_v2trap( var );
+ snmp_free_varbind( var );
+ return 0;
+}
+
+
+int
+_mteEvent_fire_set( struct mteEvent *entry, /* The event to fire */
+ struct mteTrigger *trigger, /* Trigger that fired */
+ oid *suffix, size_t sfx_len ) /* Matching instance */
+{
+ netsnmp_variable_list var;
+ oid set_oid[ MAX_OID_LEN ];
+ size_t set_len;
+
+ /*
+ * Set the basic assignment OID...
+ */
+ memset(set_oid, 0, sizeof(set_oid));
+ memcpy(set_oid, entry->mteSetOID, entry->mteSetOID_len*sizeof(oid));
+ set_len = entry->mteSetOID_len;
+
+ /*
+ * ... if the trigger value is wildcarded (sfx_len > 0),
+ * *and* the SET event entry is wildcarded,
+ * then add the supplied instance suffix...
+ */
+ if (sfx_len &&
+ entry->flags & MTE_SET_FLAG_OBJWILD) {
+ memcpy( &set_oid[set_len], suffix, sfx_len*sizeof(oid));
+ set_len += sfx_len;
+ }
+
+ /*
+ * ... finally build the assignment varbind,
+ * and pass it to be acted on.
+ *
+ * XXX: Need to handle (remote) targets and non-default contexts
+ */
+ memset( &var, 0, sizeof(var));
+ snmp_set_var_objid( &var, set_oid, set_len );
+ snmp_set_var_typed_integer( &var, ASN_INTEGER, entry->mteSetValue );
+ if (entry->session)
+ return netsnmp_query_set( &var, entry->session );
+ else
+ return netsnmp_query_set( &var, trigger->session );
+
+ /* XXX - Need to check result */
+}
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEvent.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEvent.h
new file mode 100644
index 0000000000..b3585193be
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEvent.h
@@ -0,0 +1,87 @@
+#ifndef MTEEVENT_H
+#define MTEEVENT_H
+
+#include "disman/event/mteTrigger.h"
+
+ /*
+ * Values for mteEventActions field
+ */
+#define MTE_EVENT_NOTIFICATION 0x80 /* mteEventActions values */
+#define MTE_EVENT_SET 0x40
+
+ /*
+ * Flags relating to the mteEventTable....
+ */
+#define MTE_EVENT_FLAG_ENABLED 0x01 /* for mteEventEnabled */
+#define MTE_EVENT_FLAG_ACTIVE 0x02 /* for mteEventEntryStatus */
+#define MTE_EVENT_FLAG_FIXED 0x04 /* for snmpd.conf persistence */
+#define MTE_EVENT_FLAG_VALID 0x08 /* for row creation/undo */
+
+ /*
+ * ...and to the mteEventSetTable
+ */
+#define MTE_SET_FLAG_OBJWILD 0x10 /* for mteEventSetObjectWildcard */
+#define MTE_SET_FLAG_CTXWILD 0x20 /* for mteEventSetContextNameWildcard */
+
+
+ /*
+ * All Event-MIB OCTET STRING objects are either short (32-character)
+ * tags, or SnmpAdminString/similar values (i.e. 255 characters)
+ */
+#define MTE_STR1_LEN 32
+#define MTE_STR2_LEN 255
+
+/*
+ * Data structure for a (combined) event row
+ * Covers both Notification and Set events
+ */
+struct mteEvent {
+ /*
+ * Index values
+ */
+ char mteOwner[MTE_STR1_LEN+1];
+ char mteEName[MTE_STR1_LEN+1];
+
+ /*
+ * Column values for the main mteEventTable
+ */
+ char mteEventComment[MTE_STR2_LEN+1];
+ char mteEventActions;
+
+ /*
+ * Column values for Notification events (mteEventNotificationTable)
+ */
+ oid mteNotification[MAX_OID_LEN];
+ size_t mteNotification_len;
+ char mteNotifyOwner[ MTE_STR1_LEN+1];
+ char mteNotifyObjects[MTE_STR1_LEN+1];
+
+ /*
+ * Column values for Set events (mteEventSetTable)
+ */
+ oid mteSetOID[MAX_OID_LEN];
+ size_t mteSetOID_len;
+ long mteSetValue;
+ char mteSetTarget[ MTE_STR2_LEN+1];
+ char mteSetContext[MTE_STR2_LEN+1];
+
+ netsnmp_session *session;
+ long flags;
+};
+
+ /*
+ * Container structure for the (combined) mteEvent*Tables,
+ * and routine to create this.
+ */
+extern netsnmp_tdata *event_table_data;
+extern void init_event_table_data(void);
+
+void init_mteEvent(void);
+void mteEvent_removeEntry(netsnmp_tdata_row *row);
+netsnmp_tdata_row *mteEvent_createEntry(const char *mteOwner,
+ const char *mteEventName, int fixed);
+int mteEvent_fire( char *owner, char *event,
+ struct mteTrigger *trigger,
+ oid *suffix, size_t s_len );
+
+#endif /* MTEEVENT_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventConf.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventConf.c
new file mode 100644
index 0000000000..2561385841
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventConf.c
@@ -0,0 +1,581 @@
+/*
+ * DisMan Event MIB:
+ * Implementation of the event table configure handling
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/agent_callbacks.h>
+#include "disman/event/mteObjects.h"
+#include "disman/event/mteEvent.h"
+#include "disman/event/mteEventConf.h"
+
+
+/** Initializes the mteEventsConf module */
+void
+init_mteEventConf(void)
+{
+ init_event_table_data();
+
+ /*
+ * Register config handlers for user-level (fixed) events....
+ */
+ snmpd_register_config_handler("notificationEvent",
+ parse_notificationEvent, NULL,
+ "eventname notifyOID [-m] [-i OID|-o OID]*");
+ snmpd_register_config_handler("setEvent",
+ parse_setEvent, NULL,
+ "eventname [-I] OID = value");
+
+ netsnmp_ds_register_config(ASN_BOOLEAN,
+ netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_APPTYPE),
+ "strictDisman", NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_STRICT_DISMAN);
+
+ /*
+ * ... and for persistent storage of dynamic event table entries.
+ *
+ * (The previous implementation didn't store these entries,
+ * so we don't need to worry about backwards compatability)
+ */
+ snmpd_register_config_handler("_mteETable",
+ parse_mteETable, NULL, NULL);
+ snmpd_register_config_handler("_mteENotTable",
+ parse_mteENotTable, NULL, NULL);
+ snmpd_register_config_handler("_mteESetTable",
+ parse_mteESetTable, NULL, NULL);
+
+ /*
+ * Register to save (non-fixed) entries when the agent shuts down
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_mteETable, NULL);
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_PRE_UPDATE_CONFIG,
+ clear_mteETable, NULL);
+}
+
+
+/* ==============================
+ *
+ * utility routines
+ *
+ * ============================== */
+
+ /*
+ * Find or create the specified event entry
+ */
+static struct mteEvent *
+_find_mteEvent_entry( const char *owner, const char *ename )
+{
+ netsnmp_variable_list owner_var, ename_var;
+ netsnmp_tdata_row *row;
+ /*
+ * If there's already an existing entry,
+ * then use that...
+ */
+ memset(&owner_var, 0, sizeof(netsnmp_variable_list));
+ memset(&ename_var, 0, sizeof(netsnmp_variable_list));
+ snmp_set_var_typed_value(&owner_var, ASN_OCTET_STR, owner, strlen(owner));
+ snmp_set_var_typed_value(&ename_var, ASN_PRIV_IMPLIED_OCTET_STR,
+ ename, strlen(ename));
+ owner_var.next_variable = &ename_var;
+ row = netsnmp_tdata_row_get_byidx( event_table_data, &owner_var );
+ /*
+ * ... otherwise, create a new one
+ */
+ if (!row)
+ row = mteEvent_createEntry( owner, ename, 0 );
+ if (!row)
+ return NULL;
+
+ /* return (struct mteEvent *)netsnmp_tdata_row_entry( row ); */
+ return (struct mteEvent *)row->data;
+}
+
+static struct mteEvent *
+_find_typed_mteEvent_entry( const char *owner, const char *ename, int type )
+{
+ struct mteEvent *entry = _find_mteEvent_entry( owner, ename );
+ if (!entry)
+ return NULL;
+
+ /*
+ * If this is an existing (i.e. valid) entry of the
+ * same type, then throw an error and discard it.
+ * But allow combined Set/Notification events.
+ */
+ if ( entry &&
+ (entry->flags & MTE_EVENT_FLAG_VALID) &&
+ (entry->mteEventActions & type )) {
+ config_perror("error: duplicate event name");
+ return NULL;
+ }
+ return entry;
+}
+
+
+/* ==============================
+ *
+ * User-configured (static) events
+ *
+ * ============================== */
+
+void
+parse_notificationEvent( const char *token, char *line )
+{
+ char ename[MTE_STR1_LEN+1];
+ char buf[SPRINT_MAX_LEN];
+ oid name_buf[MAX_OID_LEN];
+ size_t name_buf_len;
+ struct mteEvent *entry;
+ struct mteObject *object;
+ int wild = 1;
+ int idx = 0;
+ char *cp;
+#ifndef NETSNMP_DISABLE_MIB_LOADING
+ struct tree *tp;
+#endif
+ struct varbind_list *var;
+
+ DEBUGMSGTL(("disman:event:conf", "Parsing notificationEvent config\n"));
+
+ /*
+ * The event name could be used directly to index the mteObjectsTable.
+ * But it's quite possible that the same name could also be used to
+ * set up a mteTriggerTable entry (with trigger-specific objects).
+ *
+ * To avoid such a clash, we'll add a prefix ("_E").
+ */
+ memset(ename, 0, sizeof(ename));
+ ename[0] = '_';
+ ename[1] = 'E';
+ cp = copy_nword(line, ename+2, MTE_STR1_LEN-2);
+ if (!cp || ename[2] == '\0') {
+ config_perror("syntax error: no event name");
+ return;
+ }
+
+ /*
+ * Parse the notification OID field ...
+ */
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN);
+ if ( buf[0] == '\0' ) {
+ config_perror("syntax error: no notification OID");
+ return;
+ }
+ name_buf_len = MAX_OID_LEN;
+ if (!snmp_parse_oid(buf, name_buf, &name_buf_len)) {
+ snmp_log(LOG_ERR, "notificationEvent OID: %s\n", buf);
+ config_perror("unknown notification OID");
+ return;
+ }
+
+ /*
+ * ... and the relevant object/instances.
+ */
+ if ( cp && *cp=='-' && *(cp+1)=='m' ) {
+#ifdef NETSNMP_DISABLE_MIB_LOADING
+ config_perror("Can't use -m if MIB loading is disabled");
+ return;
+#else
+ /*
+ * Use the MIB definition to add the standard
+ * notification payload to the mteObjectsTable.
+ */
+ cp = skip_token( cp );
+ tp = get_tree( name_buf, name_buf_len, get_tree_head());
+ if (!tp) {
+ config_perror("Can't locate notification payload info");
+ return;
+ }
+ for (var = tp->varbinds; var; var=var->next) {
+ idx++;
+ object = mteObjects_addOID( "snmpd.conf", ename, idx,
+ var->vblabel, wild );
+ idx = object->mteOIndex;
+ }
+#endif
+ }
+ while (cp) {
+ if ( *cp == '-' ) {
+ switch (*(cp+1)) {
+ case 'm':
+ config_perror("-m option must come first");
+ return;
+ case 'i': /* exact instance */
+ case 'w': /* "not-wild" (backward compatability) */
+ wild = 0;
+ break;
+ case 'o': /* wildcarded object */
+ wild = 1;
+ break;
+ default:
+ config_perror("unrecognised option");
+ return;
+ }
+ cp = skip_token( cp );
+ if (!cp) {
+ config_perror("missing parameter");
+ return;
+ }
+ }
+ idx++;
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN);
+ object = mteObjects_addOID( "snmpd.conf", ename, idx, buf, wild );
+ idx = object->mteOIndex;
+ wild = 1; /* default to wildcarded objects */
+ }
+
+ /*
+ * If the entry has parsed successfully, then create,
+ * populate and activate the new event entry.
+ */
+ entry = _find_typed_mteEvent_entry("snmpd.conf", ename+2,
+ MTE_EVENT_NOTIFICATION);
+ if (!entry) {
+ mteObjects_removeEntries( "snmpd.conf", ename );
+ return;
+ }
+ entry->mteNotification_len = name_buf_len;
+ memcpy( entry->mteNotification, name_buf, name_buf_len*sizeof(oid));
+ memcpy( entry->mteNotifyOwner, "snmpd.conf", 10 );
+ memcpy( entry->mteNotifyObjects, ename, MTE_STR1_LEN );
+ entry->mteEventActions |= MTE_EVENT_NOTIFICATION;
+ entry->flags |= MTE_EVENT_FLAG_ENABLED |
+ MTE_EVENT_FLAG_ACTIVE |
+ MTE_EVENT_FLAG_FIXED |
+ MTE_EVENT_FLAG_VALID;
+ return;
+}
+
+void
+parse_setEvent( const char *token, char *line )
+{
+ char ename[MTE_STR1_LEN+1];
+ char buf[SPRINT_MAX_LEN];
+ oid name_buf[MAX_OID_LEN];
+ size_t name_buf_len;
+ long value;
+ int wild = 1;
+ struct mteEvent *entry;
+ char *cp;
+
+ DEBUGMSGTL(("disman:event:conf", "Parsing setEvent config... "));
+
+ memset( ename, 0, sizeof(ename));
+ cp = copy_nword(line, ename, MTE_STR1_LEN);
+ if (!cp || ename[0] == '\0') {
+ config_perror("syntax error: no event name");
+ return;
+ }
+
+ if (cp && *cp=='-' && *(cp+1)=='I') {
+ wild = 0; /* an instance assignment */
+ cp = skip_token( cp );
+ }
+
+ /*
+ * Parse the SET assignment in the form "OID = value"
+ */
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN);
+ if ( buf[0] == '\0' ) {
+ config_perror("syntax error: no set OID");
+ return;
+ }
+ name_buf_len = MAX_OID_LEN;
+ if (!snmp_parse_oid(buf, name_buf, &name_buf_len)) {
+ snmp_log(LOG_ERR, "setEvent OID: %s\n", buf);
+ config_perror("unknown set OID");
+ return;
+ }
+ if (cp && *cp == '=') {
+ cp = skip_token( cp ); /* skip the '=' assignment character */
+ }
+ value = strtol( cp, NULL, 0);
+
+ /*
+ * If the entry has parsed successfully, then create,
+ * populate and activate the new event entry.
+ */
+ entry = _find_typed_mteEvent_entry("snmpd.conf", ename, MTE_EVENT_SET);
+ if (!entry) {
+ return;
+ }
+ memcpy( entry->mteSetOID, name_buf, name_buf_len*sizeof(oid));
+ entry->mteSetOID_len = name_buf_len;
+ entry->mteSetValue = value;
+ if (wild)
+ entry->flags |= MTE_SET_FLAG_OBJWILD;
+ entry->mteEventActions |= MTE_EVENT_SET;
+ entry->flags |= MTE_EVENT_FLAG_ENABLED |
+ MTE_EVENT_FLAG_ACTIVE |
+ MTE_EVENT_FLAG_FIXED |
+ MTE_EVENT_FLAG_VALID;
+ return;
+}
+
+
+/* ==============================
+ *
+ * Persistent (dynamic) configuration
+ *
+ * ============================== */
+
+void
+parse_mteETable(const char *token, char *line )
+{
+ char owner[MTE_STR1_LEN+1];
+ char ename[MTE_STR1_LEN+1];
+ void *vp;
+ size_t tmp;
+ size_t len;
+ struct mteEvent *entry;
+
+ DEBUGMSGTL(("disman:event:conf", "Parsing mteEventTable config... "));
+
+ /*
+ * Read in the index information for this entry
+ * and create a (non-fixed) data structure for it.
+ */
+ memset( owner, 0, sizeof(owner));
+ memset( ename, 0, sizeof(ename));
+ len = MTE_STR1_LEN; vp = owner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = ename;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ entry = _find_mteEvent_entry( owner, ename );
+
+ DEBUGMSG(("disman:event:conf", "(%s, %s) ", owner, ename));
+
+ /*
+ * Read in the accessible (event-independent) column values.
+ */
+ len = MTE_STR2_LEN; vp = entry->mteEventComment;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ /*
+ * Skip the mteEventAction field, and note that the
+ * boolean values are combined into a single field.
+ */
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ entry->flags |= (tmp &
+ (MTE_EVENT_FLAG_ENABLED|MTE_EVENT_FLAG_ACTIVE));
+ /*
+ * XXX - Will need to read in the 'iquery' access information
+ */
+ entry->flags |= MTE_EVENT_FLAG_VALID;
+
+ DEBUGMSG(("disman:event:conf", "\n"));
+}
+
+
+void
+parse_mteENotTable(const char *token, char *line)
+{
+ char owner[MTE_STR1_LEN+1];
+ char ename[MTE_STR1_LEN+1];
+ void *vp;
+ size_t len;
+ struct mteEvent *entry;
+
+ DEBUGMSGTL(("disman:event:conf", "Parsing mteENotifyTable config... "));
+
+ /*
+ * Read in the index information for this entry
+ * and create a (non-fixed) data structure for it.
+ */
+ memset( owner, 0, sizeof(owner));
+ memset( ename, 0, sizeof(ename));
+ len = MTE_STR1_LEN; vp = owner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = ename;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ entry = _find_mteEvent_entry( owner, ename );
+
+ DEBUGMSG(("disman:event:conf", "(%s, %s) ", owner, ename));
+
+ /*
+ * Read in the accessible column values.
+ */
+ vp = entry->mteNotification;
+ line = read_config_read_data(ASN_OBJECT_ID, line, &vp,
+ &entry->mteNotification_len);
+ len = MTE_STR1_LEN; vp = entry->mteNotifyOwner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = entry->mteNotifyObjects;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+
+ entry->mteEventActions |= MTE_EVENT_NOTIFICATION;
+ entry->flags |= MTE_EVENT_FLAG_VALID;
+
+ DEBUGMSG(("disman:event:conf", "\n"));
+}
+
+
+void
+parse_mteESetTable(const char *token, char *line)
+{
+ char owner[MTE_STR1_LEN+1];
+ char ename[MTE_STR1_LEN+1];
+ void *vp;
+ size_t len;
+ struct mteEvent *entry;
+
+ DEBUGMSGTL(("disman:event:conf", "Parsing mteESetTable config... "));
+
+ /*
+ * Read in the index information for this entry
+ * and create a (non-fixed) data structure for it.
+ */
+ memset( owner, 0, sizeof(owner));
+ memset( ename, 0, sizeof(ename));
+ len = MTE_STR1_LEN; vp = owner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = ename;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ entry = _find_mteEvent_entry( owner, ename );
+
+ DEBUGMSG(("disman:event:conf", "(%s, %s) ", owner, ename));
+
+ /*
+ * Read in the accessible column values.
+ */
+ vp = entry->mteSetOID;
+ line = read_config_read_data(ASN_OBJECT_ID, line, &vp,
+ &entry->mteSetOID_len);
+ line = read_config_read_data(ASN_UNSIGNED, line,
+ &entry->mteSetValue, &len);
+ len = MTE_STR2_LEN; vp = entry->mteSetTarget;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR2_LEN; vp = entry->mteSetContext;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+
+ entry->mteEventActions |= MTE_EVENT_SET;
+ entry->flags |= MTE_EVENT_FLAG_VALID;
+
+ DEBUGMSG(("disman:event:conf", "\n"));
+}
+
+
+
+int
+store_mteETable(int majorID, int minorID, void *serverarg, void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr;
+ void *vp;
+ size_t tint;
+ netsnmp_tdata_row *row;
+ struct mteEvent *entry;
+
+
+ DEBUGMSGTL(("disman:event:conf", "Storing mteEventTable config:\n"));
+
+ for (row = netsnmp_tdata_row_first( event_table_data );
+ row;
+ row = netsnmp_tdata_row_next( event_table_data, row )) {
+
+ /*
+ * Skip entries that were set up via static config directives
+ */
+ entry = (struct mteEvent *)netsnmp_tdata_row_entry( row );
+ if ( entry->flags & MTE_EVENT_FLAG_FIXED )
+ continue;
+
+ DEBUGMSGTL(("disman:event:conf", " Storing (%s %s)\n",
+ entry->mteOwner, entry->mteEName));
+
+ /*
+ * Save the basic mteEventTable entry...
+ */
+ memset(line, 0, sizeof(line));
+ strcat(line, "_mteETable ");
+ cptr = line + strlen(line);
+
+ vp = entry->mteOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteEName; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteEventComment; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ /* ... (but skip the mteEventAction field)... */
+ tint = entry->flags & (MTE_EVENT_FLAG_ENABLED|MTE_EVENT_FLAG_ACTIVE);
+ cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL );
+ /* XXX - Need to store the 'iquery' access information */
+ snmpd_store_config(line);
+
+ /*
+ * ... then save Notify and/or Set entries separately
+ * (The mteEventAction bits will be set when these are read in).
+ */
+ if ( entry->mteEventActions & MTE_EVENT_NOTIFICATION ) {
+ memset(line, 0, sizeof(line));
+ strcat(line, "_mteENotTable ");
+ cptr = line + strlen(line);
+
+ vp = entry->mteOwner; tint = strlen( vp );
+ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteEName; tint = strlen( vp );
+ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteNotification;
+ cptr = read_config_store_data(ASN_OBJECT_ID, cptr, &vp,
+ &entry->mteNotification_len);
+ vp = entry->mteNotifyOwner; tint = strlen( vp );
+ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteNotifyObjects; tint = strlen( vp );
+ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &vp, &tint );
+ snmpd_store_config(line);
+ }
+
+ if ( entry->mteEventActions & MTE_EVENT_SET ) {
+ memset(line, 0, sizeof(line));
+ strcat(line, "_mteESetTable ");
+ cptr = line + strlen(line);
+
+ vp = entry->mteOwner; tint = strlen( vp );
+ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteEName; tint = strlen( vp );
+ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteSetOID;
+ cptr = read_config_store_data(ASN_OBJECT_ID, cptr, &vp,
+ &entry->mteSetOID_len);
+ tint = entry->mteSetValue;
+ cptr = read_config_store_data(ASN_INTEGER, cptr, &tint, NULL);
+ vp = entry->mteSetTarget; tint = strlen( vp );
+ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteSetContext; tint = strlen( vp );
+ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &vp, &tint );
+ tint = entry->flags & (MTE_SET_FLAG_OBJWILD|MTE_SET_FLAG_CTXWILD);
+ cptr = read_config_store_data(ASN_UNSIGNED, cptr, &tint, NULL);
+ snmpd_store_config(line);
+ }
+ }
+
+ DEBUGMSGTL(("disman:event:conf", " done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+int
+clear_mteETable(int majorID, int minorID, void *serverarg, void *clientarg)
+{
+ netsnmp_tdata_row *row;
+ netsnmp_variable_list owner_var;
+
+ /*
+ * We're only interested in entries set up via the config files
+ */
+ memset( &owner_var, 0, sizeof(netsnmp_variable_list));
+ snmp_set_var_typed_value( &owner_var, ASN_OCTET_STR,
+ "snmpd.conf", strlen("snmpd.conf"));
+ while (( row = netsnmp_tdata_row_next_byidx( event_table_data,
+ &owner_var ))) {
+ /*
+ * XXX - check for owner of "snmpd.conf"
+ * and break at the end of these
+ */
+ netsnmp_tdata_remove_and_delete_row( event_table_data, row );
+ }
+ return SNMPERR_SUCCESS;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventConf.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventConf.h
new file mode 100644
index 0000000000..47001f00c4
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventConf.h
@@ -0,0 +1,20 @@
+#ifndef MTEEVENTCONF_H
+#define MTEEVENTCONF_H
+
+config_require(utilities/iquery)
+
+/*
+ * function declarations
+ */
+void init_mteEventConf(void);
+
+void parse_notificationEvent(const char *, char *);
+void parse_setEvent( const char *, char *);
+
+void parse_mteETable( const char *, char *);
+void parse_mteENotTable(const char *, char *);
+void parse_mteESetTable(const char *, char *);
+SNMPCallback store_mteETable;
+SNMPCallback clear_mteETable;
+
+#endif /* MTEEVENTCONF_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventNotificationTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventNotificationTable.c
new file mode 100644
index 0000000000..c9b3770ce2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventNotificationTable.c
@@ -0,0 +1,228 @@
+/*
+ * DisMan Event MIB:
+ * Implementation of the mteEventNotificationTable MIB interface
+ * See 'mteEvent.c' for active behaviour of this table.
+ *
+ * (based on mib2c.table_data.conf output)
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "disman/event/mteEvent.h"
+#include "disman/event/mteEventNotificationTable.h"
+
+
+/* Initializes the mteEventNotificationTable module */
+void
+init_mteEventNotificationTable(void)
+{
+ static oid mteEventNotificationTable_oid[] = { 1, 3, 6, 1, 2, 1, 88, 1, 4, 3 };
+ size_t mteEventNotificationTable_oid_len = OID_LENGTH(mteEventNotificationTable_oid);
+ netsnmp_handler_registration *reg;
+ netsnmp_table_registration_info *table_info;
+
+ /*
+ * Ensure the (combined) table container is available...
+ */
+ init_event_table_data();
+
+ /*
+ * ... then set up the MIB interface to the mteEventNotificationTable slice
+ */
+ reg = netsnmp_create_handler_registration("mteEventNotificationTable",
+ mteEventNotificationTable_handler,
+ mteEventNotificationTable_oid,
+ mteEventNotificationTable_oid_len,
+ HANDLER_CAN_RWRITE);
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_OCTET_STR, /* index: mteOwner */
+ /* index: mteEventName */
+ ASN_PRIV_IMPLIED_OCTET_STR,
+ 0);
+
+ table_info->min_column = COLUMN_MTEEVENTNOTIFICATION;
+ table_info->max_column = COLUMN_MTEEVENTNOTIFICATIONOBJECTS;
+
+ /* Register this using the (common) event_table_data container */
+ netsnmp_tdata_register(reg, event_table_data, table_info);
+ DEBUGMSGTL(("disman:event:init", "Event Notify Table container (%x)\n",
+ event_table_data));
+}
+
+
+
+/** handles requests for the mteEventNotificationTable table */
+int
+mteEventNotificationTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *tinfo;
+ struct mteEvent *entry;
+ int ret;
+
+ DEBUGMSGTL(("disman:event:mib", "Notification Table handler (%d)\n", reqinfo->mode));
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ /*
+ * The mteEventNotificationTable should only contains entries
+ * for rows where the mteEventActions 'notification(0)' bit
+ * is set. So skip entries where this isn't the case.
+ */
+ if (!entry || !(entry->mteEventActions & MTE_EVENT_NOTIFICATION))
+ continue;
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTEEVENTNOTIFICATION:
+ snmp_set_var_typed_value(request->requestvb, ASN_OBJECT_ID,
+ (u_char *) entry->mteNotification,
+ entry->mteNotification_len*sizeof(oid));
+ break;
+ case COLUMN_MTEEVENTNOTIFICATIONOBJECTSOWNER:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteNotifyOwner,
+ strlen(entry->mteNotifyOwner));
+ break;
+ case COLUMN_MTEEVENTNOTIFICATIONOBJECTS:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteNotifyObjects,
+ strlen(entry->mteNotifyObjects));
+ break;
+ }
+ }
+ break;
+
+ /*
+ * Write-support
+ */
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+
+ /*
+ * Since the mteEventNotificationTable only contains entries
+ * for rows where the mteEventActions 'notification(0)'
+ * bit is set, strictly speaking we should reject
+ * assignments where this isn't the case.
+ * But SET requests that include an assignment of the
+ * 'notification(0)' bit at the same time are valid,
+ * so would need to be accepted. Unfortunately, this
+ * assignment is only applied in the COMMIT pass, so
+ * it's difficult to detect whether this holds or not.
+ *
+ * Let's fudge things for now, by processing assignments
+ * even if the 'notification(0)' bit isn't set.
+ */
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTEEVENTNOTIFICATION:
+ ret = netsnmp_check_vb_oid( request->requestvb );
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTEEVENTNOTIFICATIONOBJECTSOWNER:
+ case COLUMN_MTEEVENTNOTIFICATIONOBJECTS:
+ ret = netsnmp_check_vb_type_and_max_size(
+ request->requestvb, ASN_OCTET_STR, MTE_STR1_LEN);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * The Event MIB is somewhat ambiguous as to whether
+ * mteEventNotificationTable (and mteEventSetTable)
+ * entries can be modified once the main mteEventTable
+ * entry has been marked 'active'.
+ * But it's clear from discussion on the DisMan mailing
+ * list is that the intention is not.
+ *
+ * So check for whether this row is already active,
+ * and reject *all* SET requests if it is.
+ */
+ entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+ if (entry &&
+ entry->flags & MTE_EVENT_FLAG_ACTIVE ) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ case MODE_SET_FREE:
+ case MODE_SET_UNDO:
+ break;
+
+ case MODE_SET_ACTION:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+ if (!entry) {
+ /*
+ * New rows must be created via the RowStatus column
+ * (in the main mteEventTable)
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOCREATION);
+ /* or inconsistentName? */
+ return SNMP_ERR_NOERROR;
+
+ }
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ /*
+ * All these assignments are "unfailable", so it's
+ * (reasonably) safe to apply them in the Commit phase
+ */
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTEEVENTNOTIFICATION:
+ memset(entry->mteNotification, 0, sizeof(entry->mteNotification));
+ memcpy(entry->mteNotification, request->requestvb->val.objid,
+ request->requestvb->val_len);
+ entry->mteNotification_len = request->requestvb->val_len/sizeof(oid);
+ break;
+ case COLUMN_MTEEVENTNOTIFICATIONOBJECTSOWNER:
+ memset(entry->mteNotifyOwner, 0, sizeof(entry->mteNotifyOwner));
+ memcpy(entry->mteNotifyOwner, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTEEVENTNOTIFICATIONOBJECTS:
+ memset(entry->mteNotifyObjects, 0, sizeof(entry->mteNotifyObjects));
+ memcpy(entry->mteNotifyObjects, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ }
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventNotificationTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventNotificationTable.h
new file mode 100644
index 0000000000..be2bcc64ce
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventNotificationTable.h
@@ -0,0 +1,20 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.table_data.conf,v 1.8 2005/07/19 14:52:03 dts12 Exp $
+ */
+#ifndef MTEEVENTNOTIFICATIONTABLE_H
+#define MTEEVENTNOTIFICATIONTABLE_H
+
+/*
+ * function declarations
+ */
+void init_mteEventNotificationTable(void);
+Netsnmp_Node_Handler mteEventNotificationTable_handler;
+
+/*
+ * column number definitions for table mteEventNotificationTable
+ */
+#define COLUMN_MTEEVENTNOTIFICATION 1
+#define COLUMN_MTEEVENTNOTIFICATIONOBJECTSOWNER 2
+#define COLUMN_MTEEVENTNOTIFICATIONOBJECTS 3
+#endif /* MTEEVENTNOTIFICATIONTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventSetTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventSetTable.c
new file mode 100644
index 0000000000..4d0b6ee055
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventSetTable.c
@@ -0,0 +1,271 @@
+/*
+ * DisMan Event MIB:
+ * Implementation of the mteEventSetTable MIB interface
+ * See 'mteEvent.c' for active behaviour of this table.
+ *
+ * (based on mib2c.table_data.conf output)
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "disman/event/mteEvent.h"
+#include "disman/event/mteEventSetTable.h"
+
+
+/* Initializes the mteEventSetTable module */
+void
+init_mteEventSetTable(void)
+{
+ static oid mteEventSetTable_oid[] = { 1, 3, 6, 1, 2, 1, 88, 1, 4, 4 };
+ size_t mteEventSetTable_oid_len = OID_LENGTH(mteEventSetTable_oid);
+ netsnmp_handler_registration *reg;
+ netsnmp_table_registration_info *table_info;
+
+ /*
+ * Ensure the (combined) table container is available...
+ */
+ init_event_table_data();
+
+ /*
+ * ... then set up the MIB interface to the mteEventSetTable slice
+ */
+ reg = netsnmp_create_handler_registration("mteEventSetTable",
+ mteEventSetTable_handler,
+ mteEventSetTable_oid,
+ mteEventSetTable_oid_len,
+ HANDLER_CAN_RWRITE);
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_OCTET_STR, /* index: mteOwner */
+ /* index: mteEventName */
+ ASN_PRIV_IMPLIED_OCTET_STR,
+ 0);
+
+ table_info->min_column = COLUMN_MTEEVENTSETOBJECT;
+ table_info->max_column = COLUMN_MTEEVENTSETCONTEXTNAMEWILDCARD;
+
+ /* Register this using the (common) event_table_data container */
+ netsnmp_tdata_register(reg, event_table_data, table_info);
+ DEBUGMSGTL(("disman:event:init", "Event Set Table container (%x)\n",
+ event_table_data));
+}
+
+
+/** handles requests for the mteEventSetTable table */
+int
+mteEventSetTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *tinfo;
+ struct mteEvent *entry;
+ int ret;
+
+ DEBUGMSGTL(("disman:event:mib", "Set Table handler (%d)\n",
+ reqinfo->mode));
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ /*
+ * The mteEventSetTable should only contains entries for
+ * rows where the mteEventActions 'set(1)' bit is set.
+ * So skip entries where this isn't the case.
+ */
+ if (!entry || !(entry->mteEventActions & MTE_EVENT_SET))
+ continue;
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTEEVENTSETOBJECT:
+ snmp_set_var_typed_value(request->requestvb, ASN_OBJECT_ID,
+ (u_char *) entry->mteSetOID,
+ entry->mteSetOID_len*sizeof(oid));
+ break;
+ case COLUMN_MTEEVENTSETOBJECTWILDCARD:
+ ret = (entry->flags & MTE_SET_FLAG_OBJWILD ) ?
+ TV_TRUE : TV_FALSE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ case COLUMN_MTEEVENTSETVALUE:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->mteSetValue);
+ break;
+ case COLUMN_MTEEVENTSETTARGETTAG:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteSetTarget,
+ strlen(entry->mteSetTarget));
+ break;
+ case COLUMN_MTEEVENTSETCONTEXTNAME:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteSetContext,
+ strlen(entry->mteSetContext));
+ break;
+ case COLUMN_MTEEVENTSETCONTEXTNAMEWILDCARD:
+ ret = (entry->flags & MTE_SET_FLAG_CTXWILD ) ?
+ TV_TRUE : TV_FALSE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ }
+ }
+ break;
+
+ /*
+ * Write-support
+ */
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+
+ /*
+ * Since the mteEventSetTable only contains entries for
+ * rows where the mteEventActions 'set(1)' bit is set,
+ * strictly speaking we should reject assignments where
+ * this isn't the case.
+ * But SET requests that include an assignment of the
+ * 'set(1)' bit at the same time are valid, so would
+ * need to be accepted. Unfortunately, this assignment
+ * is only applied in the COMMIT pass, so it's difficult
+ * to detect whether this holds or not.
+ *
+ * Let's fudge things for now, by processing assignments
+ * even if the 'set(1)' bit isn't set.
+ */
+ switch (tinfo->colnum) {
+ case COLUMN_MTEEVENTSETOBJECT:
+ ret = netsnmp_check_vb_oid( request->requestvb );
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTEEVENTSETOBJECTWILDCARD:
+ case COLUMN_MTEEVENTSETCONTEXTNAMEWILDCARD:
+ ret = netsnmp_check_vb_truthvalue( request->requestvb );
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTEEVENTSETVALUE:
+ ret = netsnmp_check_vb_int( request->requestvb );
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTEEVENTSETTARGETTAG:
+ case COLUMN_MTEEVENTSETCONTEXTNAME:
+ ret = netsnmp_check_vb_type_and_max_size(
+ request->requestvb, ASN_OCTET_STR, MTE_STR2_LEN);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * The Event MIB is somewhat ambiguous as to whether
+ * mteEventSetTable (and mteEventNotificationTable)
+ * entries can be modified once the main mteEventTable
+ * entry has been marked 'active'.
+ * But it's clear from discussion on the DisMan mailing
+ * list is that the intention is not.
+ *
+ * So check for whether this row is already active,
+ * and reject *all* SET requests if it is.
+ */
+ entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+ if (entry &&
+ entry->flags & MTE_EVENT_FLAG_ACTIVE ) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ case MODE_SET_FREE:
+ case MODE_SET_UNDO:
+ break;
+
+ case MODE_SET_ACTION:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+ if (!entry) {
+ /*
+ * New rows must be created via the RowStatus column
+ * (in the main mteEventTable)
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOCREATION);
+ /* or inconsistentName? */
+ return SNMP_ERR_NOERROR;
+
+ }
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ /*
+ * All these assignments are "unfailable", so it's
+ * (reasonably) safe to apply them in the Commit phase
+ */
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTEEVENTSETOBJECT:
+ memset(entry->mteSetOID, 0, sizeof(entry->mteSetOID));
+ memcpy(entry->mteSetOID, request->requestvb->val.objid,
+ request->requestvb->val_len);
+ entry->mteSetOID_len = request->requestvb->val_len/sizeof(oid);
+ break;
+ case COLUMN_MTEEVENTSETOBJECTWILDCARD:
+ if (*request->requestvb->val.integer == TV_TRUE)
+ entry->flags |= MTE_SET_FLAG_OBJWILD;
+ else
+ entry->flags &= ~MTE_SET_FLAG_OBJWILD;
+ break;
+ case COLUMN_MTEEVENTSETVALUE:
+ entry->mteSetValue = *request->requestvb->val.integer;
+ break;
+ case COLUMN_MTEEVENTSETTARGETTAG:
+ memset(entry->mteSetTarget, 0, sizeof(entry->mteSetTarget));
+ memcpy(entry->mteSetTarget, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTEEVENTSETCONTEXTNAME:
+ memset(entry->mteSetContext, 0, sizeof(entry->mteSetContext));
+ memcpy(entry->mteSetContext, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTEEVENTSETCONTEXTNAMEWILDCARD:
+ if (*request->requestvb->val.integer == TV_TRUE)
+ entry->flags |= MTE_SET_FLAG_CTXWILD;
+ else
+ entry->flags &= ~MTE_SET_FLAG_CTXWILD;
+ break;
+ }
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventSetTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventSetTable.h
new file mode 100644
index 0000000000..b8cb124f87
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventSetTable.h
@@ -0,0 +1,23 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.table_data.conf,v 1.8 2005/07/19 14:52:03 dts12 Exp $
+ */
+#ifndef MTEEVENTSETTABLE_H
+#define MTEEVENTSETTABLE_H
+
+/*
+ * function declarations
+ */
+void init_mteEventSetTable(void);
+Netsnmp_Node_Handler mteEventSetTable_handler;
+
+/*
+ * column number definitions for table mteEventSetTable
+ */
+#define COLUMN_MTEEVENTSETOBJECT 1
+#define COLUMN_MTEEVENTSETOBJECTWILDCARD 2
+#define COLUMN_MTEEVENTSETVALUE 3
+#define COLUMN_MTEEVENTSETTARGETTAG 4
+#define COLUMN_MTEEVENTSETCONTEXTNAME 5
+#define COLUMN_MTEEVENTSETCONTEXTNAMEWILDCARD 6
+#endif /* MTEEVENTSETTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventTable.c
new file mode 100644
index 0000000000..93c902ef8d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventTable.c
@@ -0,0 +1,326 @@
+/*
+ * DisMan Event MIB:
+ * Implementation of the mteEventTable MIB interface
+ * See 'mteEvent.c' for active behaviour of this table.
+ *
+ * (based on mib2c.table_data.conf output)
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "utilities/iquery.h"
+#include "disman/event/mteEvent.h"
+#include "disman/event/mteEventTable.h"
+
+
+/* Initializes the mteEventTable module */
+void
+init_mteEventTable(void)
+{
+ static oid mteEventTable_oid[] = { 1, 3, 6, 1, 2, 1, 88, 1, 4, 2 };
+ size_t mteEventTable_oid_len = OID_LENGTH(mteEventTable_oid);
+ netsnmp_handler_registration *reg;
+ netsnmp_table_registration_info *table_info;
+
+ /*
+ * Ensure the (combined) table container is available...
+ */
+ init_event_table_data();
+
+ /*
+ * ... then set up the MIB interface to the mteEventTable slice
+ */
+ reg = netsnmp_create_handler_registration("mteEventTable",
+ mteEventTable_handler,
+ mteEventTable_oid,
+ mteEventTable_oid_len,
+ HANDLER_CAN_RWRITE);
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_OCTET_STR, /* index: mteOwner */
+ /* index: mteEventName */
+ ASN_PRIV_IMPLIED_OCTET_STR,
+ 0);
+
+ table_info->min_column = COLUMN_MTEEVENTCOMMENT;
+ table_info->max_column = COLUMN_MTEEVENTENTRYSTATUS;
+
+ /* Register this using the (common) event_table_data container */
+ netsnmp_tdata_register(reg, event_table_data, table_info);
+ DEBUGMSGTL(("disman:event:init", "Event Table container (%x)\n",
+ event_table_data));
+}
+
+
+/** handles requests for the mteEventTable table */
+int
+mteEventTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *tinfo;
+ netsnmp_tdata_row *row;
+ struct mteEvent *entry;
+ char mteOwner[MTE_STR1_LEN+1];
+ char mteEName[MTE_STR1_LEN+1];
+ long ret;
+
+ DEBUGMSGTL(("disman:event:mib", "Event Table handler (%d)\n",
+ reqinfo->mode));
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+ if (!entry || !(entry->flags & MTE_EVENT_FLAG_VALID))
+ continue;
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTEEVENTCOMMENT:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ entry->mteEventComment,
+ strlen(entry->mteEventComment));
+ break;
+ case COLUMN_MTEEVENTACTIONS:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ &entry->mteEventActions, 1);
+ break;
+ case COLUMN_MTEEVENTENABLED:
+ ret = (entry->flags & MTE_EVENT_FLAG_ENABLED ) ?
+ TV_TRUE : TV_FALSE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ case COLUMN_MTEEVENTENTRYSTATUS:
+ ret = (entry->flags & MTE_EVENT_FLAG_ACTIVE ) ?
+ RS_ACTIVE : RS_NOTINSERVICE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ }
+ }
+ break;
+
+ /*
+ * Write-support
+ */
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTEEVENTCOMMENT:
+ ret = netsnmp_check_vb_type_and_max_size(
+ request->requestvb, ASN_OCTET_STR, MTE_STR1_LEN);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ /*
+ * Can't modify the comment of an active row
+ * (No good reason for this, but that's what the MIB says!)
+ */
+ if (entry &&
+ entry->flags & MTE_EVENT_FLAG_ACTIVE ) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTEEVENTACTIONS:
+ ret = netsnmp_check_vb_type_and_size(
+ request->requestvb, ASN_OCTET_STR, 1);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ /*
+ * Can't modify the event types of an active row
+ * (A little more understandable perhaps,
+ * but still an unnecessary restriction IMO)
+ */
+ if (entry &&
+ entry->flags & MTE_EVENT_FLAG_ACTIVE ) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTEEVENTENABLED:
+ ret = netsnmp_check_vb_truthvalue(request->requestvb);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ /*
+ * The published version of the Event MIB forbids
+ * enabling (or disabling) an active row, which
+ * would make this object completely pointless!
+ * Fortunately this ludicrous decision has since been corrected.
+ */
+ break;
+
+ case COLUMN_MTEEVENTENTRYSTATUS:
+ ret = netsnmp_check_vb_rowstatus(request->requestvb,
+ (entry ? RS_ACTIVE : RS_NONEXISTENT));
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ /* An active row can only be deleted */
+ if (entry &&
+ entry->flags & MTE_EVENT_FLAG_ACTIVE &&
+ *request->requestvb->val.integer == RS_NOTINSERVICE ) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTEEVENTENTRYSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ /*
+ * Create an (empty) new row structure
+ */
+ memset(mteOwner, 0, sizeof(mteOwner));
+ memcpy(mteOwner, tinfo->indexes->val.string,
+ tinfo->indexes->val_len);
+ memset(mteEName, 0, sizeof(mteEName));
+ memcpy(mteEName,
+ tinfo->indexes->next_variable->val.string,
+ tinfo->indexes->next_variable->val_len);
+
+ row = mteEvent_createEntry(mteOwner, mteEName, 0);
+ if (!row) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ return SNMP_ERR_NOERROR;
+ }
+ netsnmp_insert_tdata_row( request, row );
+ }
+ }
+ }
+ break;
+
+ case MODE_SET_FREE:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTEEVENTENTRYSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ /*
+ * Tidy up after a failed row creation request
+ */
+ entry = (struct mteEvent *)
+ netsnmp_tdata_extract_entry(request);
+ if (entry &&
+ !(entry->flags & MTE_EVENT_FLAG_VALID)) {
+ row = (netsnmp_tdata_row *)
+ netsnmp_tdata_extract_row(request);
+ mteEvent_removeEntry( row );
+ }
+ }
+ }
+ }
+ break;
+
+ case MODE_SET_ACTION:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+ entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+ if (!entry) {
+ /*
+ * New rows must be created via the RowStatus column
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOCREATION);
+ /* or inconsistentName? */
+ return SNMP_ERR_NOERROR;
+
+ }
+ }
+ break;
+
+ case MODE_SET_UNDO:
+ break;
+
+ case MODE_SET_COMMIT:
+ /*
+ * All these assignments are "unfailable", so it's
+ * (reasonably) safe to apply them in the Commit phase
+ */
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteEvent *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTEEVENTCOMMENT:
+ memset(entry->mteEventComment, 0,
+ sizeof(entry->mteEventComment));
+ memcpy(entry->mteEventComment,
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+
+ case COLUMN_MTEEVENTACTIONS:
+ entry->mteEventActions = request->requestvb->val.string[0];
+ break;
+
+ case COLUMN_MTEEVENTENABLED:
+ if (*request->requestvb->val.integer == TV_TRUE)
+ entry->flags |= MTE_EVENT_FLAG_ENABLED;
+ else
+ entry->flags &= ~MTE_EVENT_FLAG_ENABLED;
+ break;
+
+ case COLUMN_MTEEVENTENTRYSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_ACTIVE:
+ entry->flags |= MTE_EVENT_FLAG_ACTIVE;
+ break;
+ case RS_CREATEANDGO:
+ entry->flags |= MTE_EVENT_FLAG_ACTIVE;
+ /* fall-through */
+ case RS_CREATEANDWAIT:
+ entry->flags |= MTE_EVENT_FLAG_VALID;
+ entry->session =
+ netsnmp_iquery_pdu_session(reqinfo->asp->pdu);
+ break;
+
+ case RS_DESTROY:
+ row = (netsnmp_tdata_row *)
+ netsnmp_tdata_extract_row(request);
+ mteEvent_removeEntry(row);
+ }
+ }
+ }
+ break;
+ }
+ DEBUGMSGTL(("disman:event:mib", "Table handler, done\n"));
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventTable.h
new file mode 100644
index 0000000000..a7d75606dd
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteEventTable.h
@@ -0,0 +1,22 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.table_data.conf,v 1.8 2005/07/19 14:52:03 dts12 Exp $
+ */
+#ifndef MTEEVENTTABLE_H
+#define MTEEVENTTABLE_H
+
+/*
+ * function declarations
+ */
+void init_mteEventTable(void);
+Netsnmp_Node_Handler mteEventTable_handler;
+
+/*
+ * column number definitions for mteEventTable
+ */
+#define COLUMN_MTEEVENTNAME 1
+#define COLUMN_MTEEVENTCOMMENT 2
+#define COLUMN_MTEEVENTACTIONS 3
+#define COLUMN_MTEEVENTENABLED 4
+#define COLUMN_MTEEVENTENTRYSTATUS 5
+#endif /* MTEEVENTTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjects.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjects.c
new file mode 100644
index 0000000000..710f8abd33
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjects.c
@@ -0,0 +1,434 @@
+/*
+ * DisMan Event MIB:
+ * Core implementation of the object handling behaviour
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "disman/event/mteObjects.h"
+
+netsnmp_tdata *objects_table_data;
+
+ /*
+ * Initialize the container for the object table
+ * regardless of which initialisation routine is called first.
+ */
+
+void
+init_objects_table_data(void)
+{
+ if (!objects_table_data)
+ objects_table_data = netsnmp_tdata_create_table("mteObjectsTable", 0);
+}
+
+
+
+SNMPCallback _init_default_mteObject_lists;
+
+/** Initializes the mteObjects module */
+void
+init_mteObjects(void)
+{
+ init_objects_table_data();
+
+ /*
+ * Insert fixed object lists for the default trigger
+ * notifications, once the MIB files have been read in.
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+ SNMP_CALLBACK_POST_READ_CONFIG,
+ _init_default_mteObject_lists, NULL);
+}
+
+
+void
+_init_default_mteObject( const char *oname, const char *object, int index, int wcard)
+{
+ struct mteObject *entry;
+
+ entry = mteObjects_addOID( "_snmpd", oname, index, object, 0 );
+ if (entry) {
+ entry->flags |= MTE_OBJECT_FLAG_ACTIVE|
+ MTE_OBJECT_FLAG_FIXED |
+ MTE_OBJECT_FLAG_VALID;
+ if (wcard)
+ entry->flags |= MTE_OBJECT_FLAG_WILD;
+ }
+}
+
+int
+_init_default_mteObject_lists( int majorID, int minorID,
+ void *serverargs, void *clientarg)
+{
+ static int _defaults_init = 0;
+
+ if (_defaults_init)
+ return 0;
+ /* mteHotTrigger */
+ _init_default_mteObject( "_triggerFire", ".1.3.6.1.2.1.88.2.1.1", 1, 0);
+ /* mteHotTargetName */
+ _init_default_mteObject( "_triggerFire", ".1.3.6.1.2.1.88.2.1.2", 2, 0);
+ /* mteHotContextName */
+ _init_default_mteObject( "_triggerFire", ".1.3.6.1.2.1.88.2.1.3", 3, 0);
+ /* mteHotOID */
+ _init_default_mteObject( "_triggerFire", ".1.3.6.1.2.1.88.2.1.4", 4, 0);
+ /* mteHotValue */
+ _init_default_mteObject( "_triggerFire", ".1.3.6.1.2.1.88.2.1.5", 5, 0);
+
+
+ /* mteHotTrigger */
+ _init_default_mteObject( "_triggerFail", ".1.3.6.1.2.1.88.2.1.1", 1, 0);
+ /* mteHotTargetName */
+ _init_default_mteObject( "_triggerFail", ".1.3.6.1.2.1.88.2.1.2", 2, 0);
+ /* mteHotContextName */
+ _init_default_mteObject( "_triggerFail", ".1.3.6.1.2.1.88.2.1.3", 3, 0);
+ /* mteHotOID */
+ _init_default_mteObject( "_triggerFail", ".1.3.6.1.2.1.88.2.1.4", 4, 0);
+ /* mteFailedReason */
+ _init_default_mteObject( "_triggerFail", ".1.3.6.1.2.1.88.2.1.6", 5, 0);
+
+ /* ifIndex */
+ _init_default_mteObject( "_linkUpDown", ".1.3.6.1.2.1.2.2.1.1", 1, 1);
+ /* ifAdminStatus */
+ _init_default_mteObject( "_linkUpDown", ".1.3.6.1.2.1.2.2.1.7", 2, 1);
+ /* ifOperStatus */
+ _init_default_mteObject( "_linkUpDown", ".1.3.6.1.2.1.2.2.1.8", 3, 1);
+
+ _defaults_init = 1;
+ return 0;
+}
+
+ /* ===================================================
+ *
+ * APIs for maintaining the contents of the mteObjectsTable container.
+ *
+ * =================================================== */
+
+/*
+ * Create a new row in the object table
+ */
+netsnmp_tdata_row *
+mteObjects_createEntry(char *owner, char *oname, int index, int flags)
+{
+ struct mteObject *entry;
+ netsnmp_tdata_row *row, *row2;
+ size_t owner_len = (owner) ? strlen(owner) : 0;
+ size_t oname_len = (oname) ? strlen(oname) : 0;
+
+ /*
+ * Create the mteObjects entry, and the
+ * (table-independent) row wrapper structure...
+ */
+ entry = SNMP_MALLOC_TYPEDEF(struct mteObject);
+ if (!entry)
+ return NULL;
+
+
+ row = netsnmp_tdata_create_row();
+ if (!row) {
+ SNMP_FREE(entry);
+ return NULL;
+ }
+ row->data = entry;
+
+ /*
+ * ... initialize this row with the indexes supplied
+ * and the default values for the row...
+ */
+ if (owner)
+ memcpy(entry->mteOwner, owner, owner_len);
+ netsnmp_tdata_row_add_index(row, ASN_OCTET_STR,
+ entry->mteOwner, owner_len);
+ if (oname)
+ memcpy(entry->mteOName, oname, oname_len);
+ netsnmp_tdata_row_add_index(row, ASN_OCTET_STR,
+ entry->mteOName, oname_len);
+ entry->mteOIndex = index;
+ netsnmp_tdata_row_add_index(row, ASN_INTEGER,
+ &entry->mteOIndex, sizeof(long));
+
+ entry->mteObjectID_len = 2; /* .0.0 */
+ if (flags & MTE_OBJECT_FLAG_FIXED)
+ entry->flags |= MTE_OBJECT_FLAG_FIXED;
+
+ /*
+ * Check whether there's already a row with the same indexes
+ * (XXX - relies on private internal data ???)
+ */
+ row2 = netsnmp_tdata_row_get_byoid(objects_table_data,
+ row->oid_index.oids,
+ row->oid_index.len);
+ if (row2) {
+ if (flags & MTE_OBJECT_FLAG_NEXT) {
+ /*
+ * If appropriate, keep incrementing the final
+ * index value until we find a free slot...
+ */
+ while (row2) {
+ row->oid_index.oids[row->oid_index.len]++;
+ row2 = netsnmp_tdata_row_get_byoid(objects_table_data,
+ row->oid_index.oids,
+ row->oid_index.len);
+ }
+ } else {
+ /*
+ * ... otherwise, this is an error.
+ * Tidy up, and return failure.
+ */
+ netsnmp_tdata_delete_row(row);
+ SNMP_FREE(entry);
+ return NULL;
+ }
+ }
+
+ /*
+ * ... finally, insert the row into the (common) table container
+ */
+ netsnmp_tdata_add_row(objects_table_data, row);
+ return row;
+}
+
+
+/*
+ * Add a row to the object table
+ */
+struct mteObject *
+mteObjects_addOID(char *owner, char *oname, int index,
+ char *oid_name_buf, int wild )
+{
+ netsnmp_tdata_row *row;
+ struct mteObject *entry;
+ oid name_buf[ MAX_OID_LEN ];
+ size_t name_buf_len;
+
+ name_buf_len = MAX_OID_LEN;
+ if (!snmp_parse_oid(oid_name_buf, name_buf, &name_buf_len)) {
+ snmp_log(LOG_ERR, "payload OID: %s\n", oid_name_buf);
+ config_perror("unknown payload OID");
+ return NULL;
+ }
+
+ row = mteObjects_createEntry(owner, oname, index,
+ MTE_OBJECT_FLAG_FIXED|MTE_OBJECT_FLAG_NEXT);
+ entry = (struct mteObject *)row->data;
+
+ entry->mteObjectID_len = name_buf_len;
+ memcpy(entry->mteObjectID, name_buf, name_buf_len*sizeof(oid));
+ if (wild)
+ entry->flags |= MTE_OBJECT_FLAG_WILD;
+ entry->flags |= MTE_OBJECT_FLAG_VALID|
+ MTE_OBJECT_FLAG_ACTIVE;
+
+ return entry;
+}
+
+
+/*
+ * Remove a row from the event table
+ */
+void
+mteObjects_removeEntry(netsnmp_tdata_row *row)
+{
+ struct mteObject *entry;
+
+ if (!row)
+ return; /* Nothing to remove */
+ entry = (struct mteObject *)
+ netsnmp_tdata_remove_and_delete_row(objects_table_data, row);
+ if (entry)
+ SNMP_FREE(entry);
+}
+
+
+/*
+ * Remove all matching rows from the event table
+ */
+void
+mteObjects_removeEntries( char *owner, char *oname )
+{
+ netsnmp_tdata_row *row;
+ netsnmp_variable_list owner_var, oname_var;
+
+ memset(&owner_var, 0, sizeof(owner_var));
+ memset(&oname_var, 0, sizeof(oname_var));
+ snmp_set_var_typed_value( &owner_var, ASN_OCTET_STR,
+ owner, strlen(owner));
+ snmp_set_var_typed_value( &oname_var, ASN_OCTET_STR,
+ oname, strlen(oname));
+ owner_var.next_variable = &oname_var;
+
+ row = netsnmp_tdata_row_next_byidx( objects_table_data, &owner_var );
+
+ while (row && !netsnmp_tdata_compare_subtree_idx( row, &owner_var )) {
+ mteObjects_removeEntry(row);
+ row = netsnmp_tdata_row_next_byidx( objects_table_data, &owner_var );
+ }
+ return;
+}
+
+
+ /* ===================================================
+ *
+ * API for retrieving a list of matching objects
+ *
+ * =================================================== */
+
+int
+mteObjects_vblist( netsnmp_variable_list *vblist,
+ char *owner, char *oname,
+ oid *suffix, size_t sfx_len )
+{
+ netsnmp_tdata_row *row;
+ struct mteObject *entry;
+ netsnmp_variable_list owner_var, oname_var;
+ netsnmp_variable_list *var = vblist;
+ oid name[MAX_OID_LEN];
+ size_t name_len;
+
+ if (!oname || !*oname) {
+ DEBUGMSGTL(("disman:event:objects", "No objects to add (%s)\n",
+ owner));
+ return 1; /* Empty object name means nothing to add */
+ }
+
+ DEBUGMSGTL(("disman:event:objects", "Objects add (%s, %s)\n",
+ owner, oname ));
+
+ /*
+ * Retrieve any matching entries from the mteObjectTable
+ * and add them to the specified varbind list.
+ */
+ memset(&owner_var, 0, sizeof(owner_var));
+ memset(&oname_var, 0, sizeof(oname_var));
+ snmp_set_var_typed_value( &owner_var, ASN_OCTET_STR,
+ owner, strlen(owner));
+ snmp_set_var_typed_value( &oname_var, ASN_OCTET_STR,
+ oname, strlen(oname));
+ owner_var.next_variable = &oname_var;
+
+ row = netsnmp_tdata_row_next_byidx( objects_table_data, &owner_var );
+
+ while (row && !netsnmp_tdata_compare_subtree_idx( row, &owner_var )) {
+ entry = (struct mteObject *)netsnmp_tdata_row_entry(row);
+
+ memset(name, 0, MAX_OID_LEN);
+ memcpy(name, entry->mteObjectID,
+ entry->mteObjectID_len*sizeof(oid));
+ name_len = entry->mteObjectID_len;
+
+ /*
+ * If the trigger value is wildcarded (sfx_len > 0),
+ * *and* this object entry is wildcarded,
+ * then add the supplied instance suffix.
+ * Otherwise use the Object OID as it stands.
+ */
+ if (sfx_len &&
+ entry->flags & MTE_OBJECT_FLAG_WILD) {
+ memcpy(&name[name_len], suffix, sfx_len*sizeof(oid));
+ name_len += sfx_len;
+ }
+ snmp_varlist_add_variable( &var, name, name_len, ASN_NULL, NULL, 0);
+
+ row = netsnmp_tdata_row_next( objects_table_data, row );
+ }
+ return 0;
+}
+
+
+int
+mteObjects_internal_vblist( netsnmp_variable_list *vblist,
+ char *oname,
+ struct mteTrigger *trigger,
+ netsnmp_session *sess)
+{
+ netsnmp_variable_list *var = NULL, *vp;
+ oid mteHotTrigger[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 1, 0};
+ oid mteHotTarget[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 2, 0};
+ oid mteHotContext[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 3, 0};
+ oid mteHotOID[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 4, 0};
+ oid mteHotValue[] = {1, 3, 6, 1, 2, 1, 88, 2, 1, 5, 0};
+
+ oid ifIndexOid[] = {1, 3, 6, 1, 2, 1, 2, 2, 1, 1, 0};
+ oid ifAdminStatus[] = {1, 3, 6, 1, 2, 1, 2, 2, 1, 7, 0};
+ oid ifOperStatus[] = {1, 3, 6, 1, 2, 1, 2, 2, 1, 8, 0};
+
+ oid if_index;
+
+ /*
+ * Construct the varbinds for this (internal) event...
+ */
+ if (!strcmp(oname, "_triggerFire")) {
+
+ snmp_varlist_add_variable( &var,
+ mteHotTrigger, OID_LENGTH(mteHotTrigger),
+ ASN_OCTET_STR, trigger->mteTName,
+ strlen(trigger->mteTName));
+ snmp_varlist_add_variable( &var,
+ mteHotTarget, OID_LENGTH(mteHotTarget),
+ ASN_OCTET_STR, trigger->mteTriggerTarget,
+ strlen(trigger->mteTriggerTarget));
+ snmp_varlist_add_variable( &var,
+ mteHotContext, OID_LENGTH(mteHotContext),
+ ASN_OCTET_STR, trigger->mteTriggerContext,
+ strlen(trigger->mteTriggerContext));
+ snmp_varlist_add_variable( &var,
+ mteHotOID, OID_LENGTH(mteHotOID),
+ ASN_OBJECT_ID, (char *)trigger->mteTriggerFired->name,
+ trigger->mteTriggerFired->name_length*sizeof(oid));
+ snmp_varlist_add_variable( &var,
+ mteHotValue, OID_LENGTH(mteHotValue),
+ trigger->mteTriggerFired->type,
+ trigger->mteTriggerFired->val.string,
+ trigger->mteTriggerFired->val_len);
+ } else if ((!strcmp(oname, "_linkUpDown" ))) {
+ /*
+ * The ifOperStatus varbind that triggered this entry
+ * is held in the trigger->mteTriggerFired field
+ *
+ * We can retrieve the ifIndex and ifOperStatus values
+ * from this varbind. But first we need to tweak the
+ * static ifXXX OID arrays to include the correct index.
+ * (or this could be passed in from the calling routine?)
+ *
+ * Unfortunately we don't have the current AdminStatus value,
+ * so we'll need to make another query to retrieve that.
+ */
+ if_index = trigger->mteTriggerFired->name[10];
+ ifIndexOid[ 10 ] = if_index;
+ ifAdminStatus[ 10 ] = if_index;
+ ifOperStatus[ 10 ] = if_index;
+ snmp_varlist_add_variable( &var,
+ ifIndexOid, OID_LENGTH(ifIndexOid),
+ ASN_INTEGER, &if_index, sizeof(if_index));
+
+ /* Set up a dummy varbind for ifAdminStatus... */
+ snmp_varlist_add_variable( &var,
+ ifAdminStatus, OID_LENGTH(ifAdminStatus),
+ ASN_INTEGER,
+ trigger->mteTriggerFired->val.integer,
+ trigger->mteTriggerFired->val_len);
+ /* ... then retrieve the actual value */
+ netsnmp_query_get( var->next_variable, sess );
+
+ snmp_varlist_add_variable( &var,
+ ifOperStatus, OID_LENGTH(ifOperStatus),
+ ASN_INTEGER,
+ trigger->mteTriggerFired->val.integer,
+ trigger->mteTriggerFired->val_len);
+ } else {
+ DEBUGMSGTL(("disman:event:objects",
+ "Unknown internal objects tag (%s)\n", oname));
+ return 1;
+ }
+
+ /*
+ * ... and insert them into the main varbind list
+ * (at the point specified)
+ */
+ for (vp = var; vp && vp->next_variable; vp=vp->next_variable)
+ ;
+ vp->next_variable = vblist->next_variable;
+ vblist->next_variable = var;
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjects.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjects.h
new file mode 100644
index 0000000000..e0c6ff6dfa
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjects.h
@@ -0,0 +1,59 @@
+#ifndef MTEOBJECTS_H
+#define MTEOBJECTS_H
+
+#include "disman/event/mteTrigger.h"
+
+ /*
+ * Flags relating to the mteObjectsTable
+ */
+#define MTE_OBJECT_FLAG_WILD 0x01 /* for mteObjectsIDWildcard */
+#define MTE_OBJECT_FLAG_ACTIVE 0x02 /* for mteObjectsEntryStatus */
+#define MTE_OBJECT_FLAG_FIXED 0x04 /* for snmpd.conf persistence */
+#define MTE_OBJECT_FLAG_VALID 0x08 /* for row creation/undo */
+#define MTE_OBJECT_FLAG_NEXT 0x10 /* for appending a new row */
+
+#define MTE_STR1_LEN 32
+
+/*
+ * Data structure for an object row
+ */
+struct mteObject {
+ /*
+ * Index values
+ */
+ char mteOwner[MTE_STR1_LEN+1];
+ char mteOName[MTE_STR1_LEN+1];
+ long mteOIndex;
+
+ /*
+ * Column values
+ */
+ oid mteObjectID[MAX_OID_LEN];
+ size_t mteObjectID_len;
+
+ long flags;
+};
+
+ /*
+ * Container structure for the mteObjectsTable,
+ * and routine to create this.
+ */
+extern netsnmp_tdata *objects_table_data;
+extern void init_objects_table_data(void);
+
+void init_mteObjects(void);
+void mteObjects_removeEntry(netsnmp_tdata_row *row);
+void mteObjects_removeEntries(char *owner, char *oname);
+netsnmp_tdata_row *mteObjects_createEntry( char *owner, char *oname,
+ int oindex, int flags);
+struct mteObject * mteObjects_addOID(char *owner, char *oname, int index,
+ char *oid_name_buf, int wild );
+
+int mteObjects_vblist( netsnmp_variable_list *vblist,
+ char *owner, char *oname,
+ oid *suffix, size_t sfx_len );
+int mteObjects_internal_vblist( netsnmp_variable_list *vblist,
+ char *oname, struct mteTrigger *trigger,
+ netsnmp_session *s);
+
+#endif /* MTEOBJECTS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjectsConf.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjectsConf.c
new file mode 100644
index 0000000000..3f9293c2aa
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjectsConf.c
@@ -0,0 +1,179 @@
+/*
+ * DisMan Event MIB:
+ * Implementation of the object table configure handling
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/agent_callbacks.h>
+#include "disman/event/mteObjects.h"
+#include "disman/event/mteObjectsConf.h"
+
+
+/** Initializes the mteObjectsConf module */
+void
+init_mteObjectsConf(void)
+{
+ init_objects_table_data();
+
+ /*
+ * Register config handlers for current and previous style
+ * persistent configuration directives
+ */
+ snmpd_register_config_handler("_mteOTable",
+ parse_mteOTable, NULL, NULL);
+ snmpd_register_config_handler("mteObjectsTable",
+ parse_mteOTable, NULL, NULL);
+ /*
+ * Register to save (non-fixed) entries when the agent shuts down
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_mteOTable, NULL);
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_PRE_UPDATE_CONFIG,
+ clear_mteOTable, NULL);
+}
+
+
+void
+parse_mteOTable(const char *token, char *line)
+{
+ char owner[MTE_STR1_LEN+1];
+ char oname[MTE_STR1_LEN+1];
+ void *vp;
+ u_long index;
+ size_t tmpint;
+ size_t len;
+ netsnmp_tdata_row *row;
+ struct mteObject *entry;
+
+ DEBUGMSGTL(("disman:event:conf", "Parsing mteObjectTable config... "));
+
+ /*
+ * Read in the index information for this entry
+ * and create a (non-fixed) data structure for it.
+ */
+ memset( owner, 0, sizeof(owner));
+ memset( oname, 0, sizeof(oname));
+ len = MTE_STR1_LEN; vp = owner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = oname;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ line = read_config_read_data(ASN_UNSIGNED, line, &index, &len);
+
+ DEBUGMSG(("disman:event:conf", "(%s, %s, %d) ", owner, oname, index));
+
+ row = mteObjects_createEntry( owner, oname, index, 0 );
+ /* entry = (struct mteObject *)netsnmp_tdata_row_entry( row ); */
+ entry = (struct mteObject *)row->data;
+
+
+ /*
+ * Read in the accessible column values
+ */
+ entry->mteObjectID_len = MAX_OID_LEN;
+ vp = entry->mteObjectID;
+ line = read_config_read_data(ASN_OBJECT_ID, line, &vp,
+ &entry->mteObjectID_len);
+
+ if (!strcasecmp(token, "mteObjectsTable")) {
+ /*
+ * The previous Event-MIB implementation saved
+ * these fields as separate (integer) values
+ * Accept this (for backwards compatability)
+ */
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmpint, &len);
+ if (tmpint == TV_TRUE)
+ entry->flags |= MTE_OBJECT_FLAG_WILD;
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmpint, &len);
+ if (tmpint == RS_ACTIVE)
+ entry->flags |= MTE_OBJECT_FLAG_ACTIVE;
+ } else {
+ /*
+ * This implementation saves the (relevant) flag bits directly
+ */
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmpint, &len);
+ if (tmpint & MTE_OBJECT_FLAG_WILD)
+ entry->flags |= MTE_OBJECT_FLAG_WILD;
+ if (tmpint & MTE_OBJECT_FLAG_ACTIVE)
+ entry->flags |= MTE_OBJECT_FLAG_ACTIVE;
+ }
+
+ entry->flags |= MTE_OBJECT_FLAG_VALID;
+
+ DEBUGMSG(("disman:event:conf", "\n"));
+}
+
+
+
+int
+store_mteOTable(int majorID, int minorID, void *serverarg, void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr;
+ void *vp;
+ size_t tint;
+ netsnmp_tdata_row *row;
+ struct mteObject *entry;
+
+
+ DEBUGMSGTL(("disman:event:conf", "Storing mteObjectTable config:\n"));
+
+ for (row = netsnmp_tdata_row_first( objects_table_data );
+ row;
+ row = netsnmp_tdata_row_next( objects_table_data, row )) {
+
+ /*
+ * Skip entries that were set up via static config directives
+ */
+ entry = (struct mteObject *)netsnmp_tdata_row_entry( row );
+ if ( entry->flags & MTE_OBJECT_FLAG_FIXED )
+ continue;
+
+ DEBUGMSGTL(("disman:event:conf", " Storing (%s %s %d)\n",
+ entry->mteOwner, entry->mteOName, entry->mteOIndex));
+ memset(line, 0, sizeof(line));
+ strcat(line, "_mteOTable ");
+ cptr = line + strlen(line);
+
+ vp = entry->mteOwner; tint = strlen( vp );
+ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteOName; tint = strlen( vp );
+ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &vp, &tint );
+ cptr = read_config_store_data(ASN_UNSIGNED, cptr,
+ &entry->mteOIndex, NULL);
+ vp = entry->mteObjectID;
+ cptr = read_config_store_data(ASN_OBJECT_ID, cptr, &vp,
+ &entry->mteObjectID_len);
+ tint = entry->flags & (MTE_OBJECT_FLAG_WILD|MTE_OBJECT_FLAG_ACTIVE);
+ cptr = read_config_store_data(ASN_UNSIGNED, cptr, &tint, NULL);
+ snmpd_store_config(line);
+ }
+
+ DEBUGMSGTL(("disman:event:conf", " done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+int
+clear_mteOTable(int majorID, int minorID, void *serverarg, void *clientarg)
+{
+ netsnmp_tdata_row *row;
+ netsnmp_variable_list owner_var;
+
+ /*
+ * We're only interested in entries set up via the config files
+ */
+ memset( &owner_var, 0, sizeof(netsnmp_variable_list));
+ snmp_set_var_typed_value( &owner_var, ASN_OCTET_STR,
+ "snmpd.conf", strlen("snmpd.conf"));
+ while (( row = netsnmp_tdata_row_next_byidx( objects_table_data,
+ &owner_var ))) {
+ /*
+ * XXX - check for owner of "snmpd.conf"
+ * and break at the end of these
+ */
+ netsnmp_tdata_remove_and_delete_row( objects_table_data, row );
+ }
+ return SNMPERR_SUCCESS;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjectsConf.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjectsConf.h
new file mode 100644
index 0000000000..d6649ff3bf
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjectsConf.h
@@ -0,0 +1,12 @@
+#ifndef MTEOBJECTSCONF_H
+#define MTEOBJECTSCONF_H
+
+/*
+ * function declarations
+ */
+void init_mteObjectsConf(void);
+void parse_mteOTable(const char *, char *);
+SNMPCallback store_mteOTable;
+SNMPCallback clear_mteOTable;
+
+#endif /* MTEOBJECTSCONF_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjectsTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjectsTable.c
new file mode 100644
index 0000000000..4c879b2dc7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjectsTable.c
@@ -0,0 +1,299 @@
+/*
+ * DisMan Event MIB:
+ * Implementation of the mteObjectsTable MIB interface
+ * See 'mteObjects.c' for active behaviour of this table.
+ *
+ * (based on mib2c.table_data.conf output)
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "disman/event/mteObjects.h"
+#include "disman/event/mteObjectsTable.h"
+
+/** Initializes the mteObjectsTable module */
+void
+init_mteObjectsTable(void)
+
+{
+ static oid mteObjectsTable_oid[] = { 1, 3, 6, 1, 2, 1, 88, 1, 3, 1 };
+ size_t mteObjectsTable_oid_len = OID_LENGTH(mteObjectsTable_oid);
+ netsnmp_handler_registration *reg;
+ netsnmp_table_registration_info *table_info;
+
+ /*
+ * Ensure the object table container is available...
+ */
+ init_objects_table_data();
+
+ /*
+ * ... then set up the MIB interface to this table
+ */
+ reg = netsnmp_create_handler_registration("mteObjectsTable",
+ mteObjectsTable_handler,
+ mteObjectsTable_oid,
+ mteObjectsTable_oid_len,
+ HANDLER_CAN_RWRITE);
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_OCTET_STR, /* index: mteOwner */
+ ASN_OCTET_STR, /* index: mteObjectsName */
+ ASN_UNSIGNED, /* index: mteObjectsIndex */
+ 0);
+
+ table_info->min_column = COLUMN_MTEOBJECTSID;
+ table_info->max_column = COLUMN_MTEOBJECTSENTRYSTATUS;
+
+
+ netsnmp_tdata_register(reg, objects_table_data, table_info);
+}
+
+
+/** handles requests for the mteObjectsTable table */
+int
+mteObjectsTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *tinfo;
+ netsnmp_tdata_row *row;
+ struct mteObject *entry;
+ char mteOwner[MTE_STR1_LEN+1];
+ char mteOName[MTE_STR1_LEN+1];
+ long ret;
+
+ DEBUGMSGTL(("disman:event:mib", "ObjTable handler (%d)\n", reqinfo->mode));
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteObject *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ if (!entry) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ switch (tinfo->colnum) {
+ case COLUMN_MTEOBJECTSID:
+ snmp_set_var_typed_value(request->requestvb, ASN_OBJECT_ID,
+ (u_char *) entry->mteObjectID,
+ entry->mteObjectID_len*sizeof(oid));
+ break;
+ case COLUMN_MTEOBJECTSIDWILDCARD:
+ ret = (entry->flags & MTE_OBJECT_FLAG_WILD ) ?
+ TV_TRUE : TV_FALSE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ case COLUMN_MTEOBJECTSENTRYSTATUS:
+ ret = (entry->flags & MTE_OBJECT_FLAG_ACTIVE ) ?
+ RS_ACTIVE : RS_NOTINSERVICE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ }
+ }
+ break;
+
+ /*
+ * Write-support
+ */
+ case MODE_SET_RESERVE1:
+
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteObject *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTEOBJECTSID:
+ ret = netsnmp_check_vb_oid( request->requestvb );
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ /*
+ * Can't modify the OID of an active row
+ * (an unnecessary restriction, IMO)
+ */
+ if (entry &&
+ entry->flags & MTE_OBJECT_FLAG_ACTIVE ) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTEOBJECTSIDWILDCARD:
+ ret = netsnmp_check_vb_truthvalue( request->requestvb );
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ /*
+ * Can't modify the wildcarding of an active row
+ * (an unnecessary restriction, IMO)
+ */
+ if (entry &&
+ entry->flags & MTE_OBJECT_FLAG_ACTIVE ) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTEOBJECTSENTRYSTATUS:
+ ret = netsnmp_check_vb_rowstatus(request->requestvb,
+ (entry ? RS_ACTIVE : RS_NONEXISTENT));
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ /* An active row can only be deleted */
+ if (entry &&
+ entry->flags & MTE_OBJECT_FLAG_ACTIVE &&
+ *request->requestvb->val.integer == RS_NOTINSERVICE ) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTEOBJECTSENTRYSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ /*
+ * Create an (empty) new row structure
+ */
+ memset(mteOwner, 0, sizeof(mteOwner));
+ memcpy(mteOwner, tinfo->indexes->val.string,
+ tinfo->indexes->val_len);
+ memset(mteOName, 0, sizeof(mteOName));
+ memcpy(mteOName,
+ tinfo->indexes->next_variable->val.string,
+ tinfo->indexes->next_variable->val_len);
+ ret = *tinfo->indexes->next_variable->next_variable->val.integer;
+
+ row = mteObjects_createEntry(mteOwner, mteOName, ret, 0);
+ if (!row) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ return SNMP_ERR_NOERROR;
+ }
+ netsnmp_insert_tdata_row( request, row );
+ }
+ }
+ }
+ break;
+
+ case MODE_SET_FREE:
+
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTEOBJECTSENTRYSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ /*
+ * Tidy up after a failed row creation request
+ */
+ entry = (struct mteObject *)
+ netsnmp_tdata_extract_entry(request);
+ if (entry &&
+ !(entry->flags & MTE_OBJECT_FLAG_VALID)) {
+ row = (netsnmp_tdata_row *)
+ netsnmp_tdata_extract_row(request);
+ mteObjects_removeEntry( row );
+ }
+ }
+ }
+ }
+ break;
+
+ case MODE_SET_ACTION:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteObject *) netsnmp_tdata_extract_entry(request);
+ if (!entry) {
+ /*
+ * New rows must be created via the RowStatus column
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOCREATION);
+ /* or inconsistentName? */
+ return SNMP_ERR_NOERROR;
+
+ }
+ }
+ break;
+
+ case MODE_SET_UNDO:
+ break;
+
+ case MODE_SET_COMMIT:
+ /*
+ * All these assignments are "unfailable", so it's
+ * (reasonably) safe to apply them in the Commit phase
+ */
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteObject *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTEOBJECTSID:
+ memset(entry->mteObjectID, 0, sizeof(entry->mteObjectID));
+ memcpy(entry->mteObjectID, request->requestvb->val.objid,
+ request->requestvb->val_len);
+ entry->mteObjectID_len = request->requestvb->val_len/sizeof(oid);
+ break;
+
+ case COLUMN_MTEOBJECTSIDWILDCARD:
+ if (*request->requestvb->val.integer == TV_TRUE)
+ entry->flags |= MTE_OBJECT_FLAG_WILD;
+ else
+ entry->flags &= ~MTE_OBJECT_FLAG_WILD;
+ break;
+
+ case COLUMN_MTEOBJECTSENTRYSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_ACTIVE:
+ entry->flags |= MTE_OBJECT_FLAG_ACTIVE;
+ break;
+ case RS_CREATEANDGO:
+ entry->flags |= MTE_OBJECT_FLAG_VALID;
+ entry->flags |= MTE_OBJECT_FLAG_ACTIVE;
+ break;
+ case RS_CREATEANDWAIT:
+ entry->flags |= MTE_OBJECT_FLAG_VALID;
+ break;
+
+ case RS_DESTROY:
+ row = (netsnmp_tdata_row *)
+ netsnmp_tdata_extract_row(request);
+ mteObjects_removeEntry(row);
+ }
+ }
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjectsTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjectsTable.h
new file mode 100644
index 0000000000..14bfb26cd3
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteObjectsTable.h
@@ -0,0 +1,22 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.table_data.conf,v 1.8 2005/07/19 14:52:03 dts12 Exp $
+ */
+#ifndef MTEOBJECTSTABLE_H
+#define MTEOBJECTSTABLE_H
+
+/*
+ * function declarations
+ */
+void init_mteObjectsTable(void);
+Netsnmp_Node_Handler mteObjectsTable_handler;
+
+/*
+ * column number definitions for table mteObjectsTable
+ */
+#define COLUMN_MTEOBJECTSNAME 1
+#define COLUMN_MTEOBJECTSINDEX 2
+#define COLUMN_MTEOBJECTSID 3
+#define COLUMN_MTEOBJECTSIDWILDCARD 4
+#define COLUMN_MTEOBJECTSENTRYSTATUS 5
+#endif /* MTEOBJECTSTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteScalars.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteScalars.c
new file mode 100644
index 0000000000..769adc1395
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteScalars.c
@@ -0,0 +1,135 @@
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "mteScalars.h"
+#include "mteTrigger.h"
+
+/** Initializes the mteScalars module */
+void
+init_mteScalars(void)
+{
+ static oid mteResource_oid[] = { 1, 3, 6, 1, 2, 1, 88, 1, 1 };
+ static oid mteTriggerFail_oid[] = { 1, 3, 6, 1, 2, 1, 88, 1, 2, 1 };
+
+ DEBUGMSGTL(("mteScalars", "Initializing\n"));
+
+ netsnmp_register_scalar_group(
+ netsnmp_create_handler_registration("mteResource", handle_mteResourceGroup,
+ mteResource_oid, OID_LENGTH(mteResource_oid),
+ HANDLER_CAN_RONLY),
+ MTE_RESOURCE_SAMPLE_MINFREQ, MTE_RESOURCE_SAMPLE_LACKS);
+
+ netsnmp_register_scalar(
+ netsnmp_create_handler_registration("mteTriggerFailures",
+ handle_mteTriggerFailures,
+ mteTriggerFail_oid, OID_LENGTH(mteTriggerFail_oid),
+ HANDLER_CAN_RONLY));
+}
+
+int
+handle_mteResourceGroup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ oid obj;
+ long value = 0;
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ obj = requests->requestvb->name[ requests->requestvb->name_length-2 ];
+ switch (obj) {
+ case MTE_RESOURCE_SAMPLE_MINFREQ:
+ value = 1; /* Fixed minimum sample frequency */
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
+ (u_char *)&value, sizeof(value));
+ break;
+
+ case MTE_RESOURCE_SAMPLE_MAX_INST:
+ value = 0; /* No fixed maximum */
+ snmp_set_var_typed_value(requests->requestvb, ASN_UNSIGNED,
+ (u_char *)&value, sizeof(value));
+ break;
+
+ case MTE_RESOURCE_SAMPLE_INSTANCES:
+#ifdef USING_DISMAN_EVENT_MTETRIGGER_MODULE
+ value = mteTrigger_getNumEntries(0);
+#else
+ value = 0;
+#endif
+ snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE,
+ (u_char *)&value, sizeof(value));
+ break;
+
+ case MTE_RESOURCE_SAMPLE_HIGH:
+#ifdef USING_DISMAN_EVENT_MTETRIGGER_MODULE
+ value = mteTrigger_getNumEntries(1);
+#else
+ value = 0;
+#endif
+ snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE,
+ (u_char *)&value, sizeof(value));
+ break;
+
+ case MTE_RESOURCE_SAMPLE_LACKS:
+ value = 0; /* mteResSampleInstMax not used */
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *)&value, sizeof(value));
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown object (%d) in handle_mteResourceGroup\n", (int)obj);
+ return SNMP_ERR_GENERR;
+ }
+ break;
+
+ default:
+ /*
+ * Although mteResourceSampleMinimum and mteResourceSampleInstanceMaximum
+ * are defined with MAX-ACCESS read-write, this version hardcodes
+ * these values, so doesn't need to implement write access.
+ */
+ snmp_log(LOG_ERR,
+ "unknown mode (%d) in handle_mteResourceGroup\n",
+ reqinfo->mode);
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+handle_mteTriggerFailures(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+#ifdef USING_DISMAN_EVENT_MTETRIGGER_MODULE
+ extern long mteTriggerFailures;
+#else
+ long mteTriggerFailures = 0;
+#endif
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *)&mteTriggerFailures,
+ sizeof(mteTriggerFailures));
+ break;
+
+
+ default:
+ /*
+ * we should never get here, so this is a really bad error
+ */
+ snmp_log(LOG_ERR,
+ "unknown mode (%d) in handle_mteTriggerFailures\n",
+ reqinfo->mode);
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteScalars.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteScalars.h
new file mode 100644
index 0000000000..a6ade2e371
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteScalars.h
@@ -0,0 +1,14 @@
+#ifndef MTESCALARS_H
+#define MTESCALARS_H
+
+void init_mteScalars(void);
+Netsnmp_Node_Handler handle_mteResourceGroup;
+Netsnmp_Node_Handler handle_mteTriggerFailures;
+
+#define MTE_RESOURCE_SAMPLE_MINFREQ 1
+#define MTE_RESOURCE_SAMPLE_MAX_INST 2
+#define MTE_RESOURCE_SAMPLE_INSTANCES 3
+#define MTE_RESOURCE_SAMPLE_HIGH 4
+#define MTE_RESOURCE_SAMPLE_LACKS 5
+
+#endif /* MTESCALARS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTrigger.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTrigger.c
new file mode 100644
index 0000000000..074c2615af
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTrigger.c
@@ -0,0 +1,1187 @@
+/*
+ * DisMan Event MIB:
+ * Core implementation of the trigger handling behaviour
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "disman/event/mteTrigger.h"
+#include "disman/event/mteEvent.h"
+
+netsnmp_tdata *trigger_table_data;
+
+oid _sysUpTime_instance[] = { 1, 3, 6, 1, 2, 1, 1, 3, 0 };
+size_t _sysUpTime_inst_len = OID_LENGTH(_sysUpTime_instance);
+
+long mteTriggerFailures;
+
+ /*
+ * Initialize the container for the (combined) mteTrigger*Table,
+ * regardless of which table initialisation routine is called first.
+ */
+
+void
+init_trigger_table_data(void)
+{
+ DEBUGMSGTL(("disman:event:init", "init trigger container\n"));
+ if (!trigger_table_data) {
+ trigger_table_data = netsnmp_tdata_create_table("mteTriggerTable", 0);
+ if (!trigger_table_data) {
+ snmp_log(LOG_ERR, "failed to create mteTriggerTable");
+ return;
+ }
+ DEBUGMSGTL(("disman:event:init", "create trigger container (%x)\n",
+ trigger_table_data));
+ }
+ mteTriggerFailures = 0;
+}
+
+
+/** Initializes the mteTrigger module */
+void
+init_mteTrigger(void)
+{
+ init_trigger_table_data();
+
+}
+
+ /* ===================================================
+ *
+ * APIs for maintaining the contents of the (combined)
+ * mteTrigger*Table container.
+ *
+ * =================================================== */
+
+void
+_mteTrigger_dump(void)
+{
+ struct mteTrigger *entry;
+ netsnmp_tdata_row *row;
+ int i = 0;
+
+ for (row = netsnmp_tdata_row_first(trigger_table_data);
+ row;
+ row = netsnmp_tdata_row_next(trigger_table_data, row)) {
+ entry = (struct mteTrigger *)row->data;
+ DEBUGMSGTL(("disman:event:dump", "TriggerTable entry %d: ", i));
+ DEBUGMSGOID(("disman:event:dump", row->oid_index.oids, row->oid_index.len));
+ DEBUGMSG(("disman:event:dump", "(%s, %s)",
+ row->indexes->val.string,
+ row->indexes->next_variable->val.string));
+ DEBUGMSG(("disman:event:dump", ": %x, %x\n", row, entry));
+ i++;
+ }
+ DEBUGMSGTL(("disman:event:dump", "TriggerTable %d entries\n", i));
+}
+
+
+/*
+ * Create a new row in the trigger table
+ */
+netsnmp_tdata_row *
+mteTrigger_createEntry(char *mteOwner, char *mteTName, int fixed)
+{
+ struct mteTrigger *entry;
+ netsnmp_tdata_row *row;
+ size_t mteOwner_len = (mteOwner) ? strlen(mteOwner) : 0;
+ size_t mteTName_len = (mteTName) ? strlen(mteTName) : 0;
+
+ DEBUGMSGTL(("disman:event:table", "Create trigger entry (%s, %s)\n",
+ mteOwner, mteTName));
+ /*
+ * Create the mteTrigger entry, and the
+ * (table-independent) row wrapper structure...
+ */
+ entry = SNMP_MALLOC_TYPEDEF(struct mteTrigger);
+ if (!entry)
+ return NULL;
+
+ row = netsnmp_tdata_create_row();
+ if (!row) {
+ SNMP_FREE(entry);
+ return NULL;
+ }
+ row->data = entry;
+
+ /*
+ * ... initialize this row with the indexes supplied
+ * and the default values for the row...
+ */
+ if (mteOwner)
+ memcpy(entry->mteOwner, mteOwner, mteOwner_len);
+ netsnmp_table_row_add_index(row, ASN_OCTET_STR,
+ entry->mteOwner, mteOwner_len);
+ if (mteTName)
+ memcpy(entry->mteTName, mteTName, mteTName_len);
+ netsnmp_table_row_add_index(row, ASN_PRIV_IMPLIED_OCTET_STR,
+ entry->mteTName, mteTName_len);
+
+ /* entry->mteTriggerTest = MTE_TRIGGER_BOOLEAN; */
+ entry->mteTriggerValueID_len = 2; /* .0.0 */
+ entry->mteTriggerFrequency = 600;
+ memcpy(entry->mteDeltaDiscontID, _sysUpTime_instance,
+ sizeof(_sysUpTime_instance));
+ entry->mteDeltaDiscontID_len = _sysUpTime_inst_len;
+ entry->mteDeltaDiscontIDType = MTE_DELTAD_TTICKS;
+ entry->flags |= MTE_TRIGGER_FLAG_SYSUPT;
+ entry->mteTExTest = (MTE_EXIST_PRESENT | MTE_EXIST_ABSENT);
+ entry->mteTExStartup = (MTE_EXIST_PRESENT | MTE_EXIST_ABSENT);
+ entry->mteTBoolComparison = MTE_BOOL_UNEQUAL;
+ entry->flags |= MTE_TRIGGER_FLAG_BSTART;
+ entry->mteTThStartup = MTE_THRESH_START_RISEFALL;
+
+ if (fixed)
+ entry->flags |= MTE_TRIGGER_FLAG_FIXED;
+
+ /*
+ * ... and insert the row into the (common) table container
+ */
+ netsnmp_tdata_add_row(trigger_table_data, row);
+ DEBUGMSGTL(("disman:event:table", "Trigger entry created\n"));
+ return row;
+}
+
+/*
+ * Remove a row from the trigger table
+ */
+void
+mteTrigger_removeEntry(netsnmp_tdata_row *row)
+{
+ struct mteTrigger *entry;
+
+ if (!row)
+ return; /* Nothing to remove */
+ entry = (struct mteTrigger *)
+ netsnmp_tdata_remove_and_delete_row(trigger_table_data, row);
+ if (entry) {
+ mteTrigger_disable( entry );
+ SNMP_FREE(entry);
+ }
+}
+
+ /* ===================================================
+ *
+ * APIs for evaluating a trigger,
+ * and firing the appropriate event
+ *
+ * =================================================== */
+const char *_ops[] = { "",
+ "!=", /* MTE_BOOL_UNEQUAL */
+ "==", /* MTE_BOOL_EQUAL */
+ "<", /* MTE_BOOL_LESS */
+ "<=", /* MTE_BOOL_LESSEQUAL */
+ ">", /* MTE_BOOL_GREATER */
+ ">=" /* MTE_BOOL_GREATEREQUAL */ };
+
+void
+_mteTrigger_failure( /* int error, */ const char *msg )
+{
+ /*
+ * XXX - Send an mteTriggerFailure trap
+ * (if configured to do so)
+ */
+ mteTriggerFailures++;
+ snmp_log(LOG_ERR, "%s\n", msg );
+ return;
+}
+
+void
+mteTrigger_run( unsigned int reg, void *clientarg)
+{
+ struct mteTrigger *entry = (struct mteTrigger *)clientarg;
+ netsnmp_variable_list *var, *vtmp;
+ netsnmp_variable_list *vp1, *vp1_prev;
+ netsnmp_variable_list *vp2, *vp2_prev;
+ netsnmp_variable_list *dvar = NULL;
+ netsnmp_variable_list *dv1 = NULL, *dv2 = NULL;
+ netsnmp_variable_list sysUT_var;
+ int cmp = 0, n, n2;
+ long value;
+ const char *reason;
+
+ if (!entry) {
+ snmp_alarm_unregister( reg );
+ return;
+ }
+ if (!(entry->flags & MTE_TRIGGER_FLAG_ENABLED ) ||
+ !(entry->flags & MTE_TRIGGER_FLAG_ACTIVE ) ||
+ !(entry->flags & MTE_TRIGGER_FLAG_VALID )) {
+ return;
+ }
+
+ {
+ extern netsnmp_agent_session *netsnmp_processing_set;
+ if (netsnmp_processing_set) {
+ /*
+ * netsnmp_handle_request will not be responsive to our efforts to
+ * Retrieve the requested MIB value(s)...
+ * so we will skip it.
+ * https://sourceforge.net/tracker/
+ * index.php?func=detail&aid=1557406&group_id=12694&atid=112694
+ */
+ DEBUGMSGTL(("disman:event:trigger:monitor",
+ "Skipping trigger (%s) while netsnmp_processing_set\n",
+ entry->mteTName));
+ return;
+ }
+ }
+
+ /*
+ * Retrieve the requested MIB value(s)...
+ */
+ DEBUGMSGTL(( "disman:event:trigger:monitor", "Running trigger (%s)\n", entry->mteTName));
+ var = (netsnmp_variable_list *)SNMP_MALLOC_TYPEDEF( netsnmp_variable_list );
+ if (!var) {
+ _mteTrigger_failure("failed to create mteTrigger query varbind");
+ return;
+ }
+ snmp_set_var_objid( var, entry->mteTriggerValueID,
+ entry->mteTriggerValueID_len );
+ if ( entry->flags & MTE_TRIGGER_FLAG_VWILD ) {
+ n = netsnmp_query_walk( var, entry->session );
+ } else {
+ n = netsnmp_query_get( var, entry->session );
+ }
+ if ( n != SNMP_ERR_NOERROR ) {
+ DEBUGMSGTL(( "disman:event:trigger:monitor", "Trigger query (%s) failed: %d\n",
+ (( entry->flags & MTE_TRIGGER_FLAG_VWILD ) ? "walk" : "get"), n));
+ _mteTrigger_failure( "failed to run mteTrigger query" );
+ return;
+ }
+
+ /*
+ * ... canonicalise the results (to simplify later comparisons)...
+ */
+
+ vp1 = var; vp1_prev = NULL;
+ vp2 = entry->old_results; vp2_prev = NULL;
+ entry->count=0;
+ while (vp1) {
+ /*
+ * Flatten various missing values/exceptions into a single form
+ */
+ switch (vp1->type) {
+ case SNMP_NOSUCHINSTANCE:
+ case SNMP_NOSUCHOBJECT:
+ case ASN_PRIV_RETRY: /* Internal only ? */
+ vp1->type = ASN_NULL;
+ }
+ /*
+ * Keep track of how many entries have been retrieved.
+ */
+ entry->count++;
+
+ /*
+ * Ensure previous and current result match
+ * (with corresponding entries in both lists)
+ * and set the flags indicating which triggers are armed
+ */
+ if (vp2) {
+ cmp = snmp_oid_compare(vp1->name, vp1->name_length,
+ vp2->name, vp2->name_length);
+ if ( cmp < 0 ) {
+ /*
+ * If a new value has appeared, insert a matching
+ * dummy entry into the previous result list.
+ *
+ * XXX - check how this is best done.
+ */
+ vtmp = SNMP_MALLOC_TYPEDEF( netsnmp_variable_list );
+ if (!vtmp) {
+ _mteTrigger_failure(
+ "failed to create mteTrigger temp varbind");
+ return;
+ }
+ vtmp->type = ASN_NULL;
+ snmp_set_var_objid( vtmp, vp1->name, vp1->name_length );
+ vtmp->next_variable = vp2;
+ if (vp2_prev) {
+ vp2_prev->next_variable = vtmp;
+ } else {
+ entry->old_results = vtmp;
+ }
+ vp2_prev = vtmp;
+ vp1->index = MTE_ARMED_ALL; /* XXX - plus a new flag */
+ vp1_prev = vp1;
+ vp1 = vp1->next_variable;
+ }
+ else if ( cmp == 0 ) {
+ /*
+ * If it's a continuing entry, just copy across the armed flags
+ */
+ vp1->index = vp2->index;
+ vp1_prev = vp1;
+ vp1 = vp1->next_variable;
+ vp2_prev = vp2;
+ vp2 = vp2->next_variable;
+ } else {
+ /*
+ * If a value has just disappeared, insert a
+ * matching dummy entry into the current result list.
+ *
+ * XXX - check how this is best done.
+ *
+ */
+ if ( vp2->type != ASN_NULL ) {
+ vtmp = SNMP_MALLOC_TYPEDEF( netsnmp_variable_list );
+ if (!vtmp) {
+ _mteTrigger_failure(
+ "failed to create mteTrigger temp varbind");
+ return;
+ }
+ vtmp->type = ASN_NULL;
+ snmp_set_var_objid( vtmp, vp2->name, vp2->name_length );
+ vtmp->next_variable = vp1;
+ if (vp1_prev) {
+ vp1_prev->next_variable = vtmp;
+ } else {
+ var = vtmp;
+ }
+ vp1_prev = vtmp;
+ vp2_prev = vp2;
+ vp2 = vp2->next_variable;
+ } else {
+ /*
+ * But only if this entry has *just* disappeared. If the
+ * entry from the last run was a dummy too, then remove it.
+ * (leaving vp2_prev unchanged)
+ */
+ vtmp = vp2;
+ if (vp2_prev) {
+ vp2_prev->next_variable = vp2->next_variable;
+ } else {
+ entry->old_results = vp2->next_variable;
+ }
+ vp2 = vp2->next_variable;
+ vtmp->next_variable = NULL;
+ snmp_free_varbind( vtmp );
+ }
+ }
+ } else {
+ /*
+ * No more old results to compare.
+ * Either all remaining values have only just been created ...
+ * (and we need to create dummy 'old' entries for them)
+ */
+ if ( vp2_prev ) {
+ vtmp = SNMP_MALLOC_TYPEDEF( netsnmp_variable_list );
+ if (!vtmp) {
+ _mteTrigger_failure(
+ "failed to create mteTrigger temp varbind");
+ return;
+ }
+ vtmp->type = ASN_NULL;
+ snmp_set_var_objid( vtmp, vp1->name, vp1->name_length );
+ vtmp->next_variable = vp2_prev->next_variable;
+ vp2_prev->next_variable = vtmp;
+ vp2_prev = vtmp;
+ }
+ /*
+ * ... or this is the first run through
+ * (and there were no old results at all)
+ *
+ * In either case, mark the current entry as armed and new.
+ * Note that we no longer need to maintain 'vp1_prev'
+ */
+ vp1->index = MTE_ARMED_ALL; /* XXX - plus a new flag */
+ vp1 = vp1->next_variable;
+ }
+ }
+
+ /*
+ * ... and then work through these result(s), deciding
+ * whether or not to trigger the corresponding event.
+ *
+ * Note that there's no point in evaluating Existence or
+ * Boolean tests if there's no corresponding event.
+ * (Even if the trigger matched, nothing would be done anyway).
+ */
+ if ((entry->mteTriggerTest & MTE_TRIGGER_EXISTENCE) &&
+ (entry->mteTExEvent[0] != '\0' )) {
+ /*
+ * If we don't have a record of previous results,
+ * this must be the first time through, so consider
+ * the mteTriggerExistenceStartup tests.
+ */
+ if ( !entry->old_results ) {
+ /*
+ * With the 'present(0)' test, the trigger should fire
+ * for each value in the varbind list returned
+ * (whether the monitored value is wildcarded or not).
+ */
+ if (entry->mteTExTest & entry->mteTExStartup & MTE_EXIST_PRESENT) {
+ for (vp1 = var; vp1; vp1=vp1->next_variable) {
+ DEBUGMSGTL(( "disman:event:trigger:fire",
+ "Firing initial existence test: "));
+ DEBUGMSGOID(("disman:event:trigger:fire",
+ vp1->name, vp1->name_length));
+ DEBUGMSG(( "disman:event:trigger:fire",
+ " (present)\n"));;
+ entry->mteTriggerXOwner = entry->mteTExObjOwner;
+ entry->mteTriggerXObjects = entry->mteTExObjects;
+ entry->mteTriggerFired = vp1;
+ n = entry->mteTriggerValueID_len;
+ mteEvent_fire(entry->mteTExEvOwner, entry->mteTExEvent,
+ entry, vp1->name+n, vp1->name_length-n);
+ }
+ }
+ /*
+ * An initial 'absent(1)' test only makes sense when
+ * monitoring a non-wildcarded OID (how would we know
+ * which rows of the table "ought" to exist, but don't?)
+ */
+ if (entry->mteTExTest & entry->mteTExStartup & MTE_EXIST_ABSENT) {
+ if (!(entry->flags & MTE_TRIGGER_FLAG_VWILD) &&
+ var->type == ASN_NULL ) {
+ DEBUGMSGTL(( "disman:event:trigger:fire",
+ "Firing initial existence test: "));
+ DEBUGMSGOID(("disman:event:trigger:fire",
+ var->name, var->name_length));
+ DEBUGMSG(( "disman:event:trigger:fire",
+ " (absent)\n"));;
+ entry->mteTriggerXOwner = entry->mteTExObjOwner;
+ entry->mteTriggerXObjects = entry->mteTExObjects;
+ /*
+ * It's unclear what value the 'mteHotValue' payload
+ * should take when a monitored instance does not
+ * exist on startup. The only sensible option is
+ * to report a NULL value, but this clashes with
+ * the syntax of the mteHotValue MIB object.
+ */
+ entry->mteTriggerFired = var;
+ n = entry->mteTriggerValueID_len;
+ mteEvent_fire(entry->mteTExEvOwner, entry->mteTExEvent,
+ entry, var->name+n, var->name_length-n);
+ }
+ }
+ } /* !old_results */
+ /*
+ * Otherwise, compare the current set of results with
+ * the previous ones, looking for changes. We can
+ * assume that the two lists match (see above).
+ */
+ else {
+ for (vp1 = var, vp2 = entry->old_results;
+ vp1;
+ vp1=vp1->next_variable, vp2=vp2->next_variable) {
+
+ /* Use this field to indicate that the trigger should fire */
+ entry->mteTriggerFired = NULL;
+ reason = NULL;
+
+ if ((entry->mteTExTest & MTE_EXIST_PRESENT) &&
+ (vp1->type != ASN_NULL) &&
+ (vp2->type == ASN_NULL)) {
+ /* A new instance has appeared */
+ entry->mteTriggerFired = vp1;
+ reason = "(present)";
+
+ } else if ((entry->mteTExTest & MTE_EXIST_ABSENT) &&
+ (vp1->type == ASN_NULL) &&
+ (vp2->type != ASN_NULL)) {
+
+ /*
+ * A previous instance has disappeared.
+ *
+ * It's unclear what value the 'mteHotValue' payload
+ * should take when this happens - the previous
+ * value (vp2), or a NULL value (vp1) ?
+ * NULL makes more sense logically, but clashes
+ * with the syntax of the mteHotValue MIB object.
+ */
+ entry->mteTriggerFired = vp2;
+ reason = "(absent)";
+
+ } else if ((entry->mteTExTest & MTE_EXIST_CHANGED) &&
+ ((vp1->val_len != vp2->val_len) ||
+ (memcmp( vp1->val.string, vp2->val.string,
+ vp1->val_len) != 0 ))) {
+ /*
+ * This comparison detects changes in *any* type
+ * of value, numeric or string (or even OID).
+ *
+ * Unfortunately, the default 'mteTriggerFired'
+ * notification payload can't report non-numeric
+ * changes properly (see syntax of 'mteHotValue')
+ */
+ entry->mteTriggerFired = vp1;
+ reason = "(changed)";
+ }
+ if ( entry->mteTriggerFired ) {
+ /*
+ * One of the above tests has matched,
+ * so fire the trigger.
+ */
+ DEBUGMSGTL(( "disman:event:trigger:fire",
+ "Firing existence test: "));
+ DEBUGMSGOID(("disman:event:trigger:fire",
+ vp1->name, vp1->name_length));
+ DEBUGMSG(( "disman:event:trigger:fire",
+ " %s\n", reason));;
+ entry->mteTriggerXOwner = entry->mteTExObjOwner;
+ entry->mteTriggerXObjects = entry->mteTExObjects;
+ n = entry->mteTriggerValueID_len;
+ mteEvent_fire(entry->mteTExEvOwner, entry->mteTExEvent,
+ entry, vp1->name+n, vp1->name_length-n);
+ }
+ }
+ } /* !old_results - end of else block */
+ } /* MTE_TRIGGER_EXISTENCE */
+
+
+ if (( entry->mteTriggerTest & MTE_TRIGGER_BOOLEAN ) ||
+ ( entry->mteTriggerTest & MTE_TRIGGER_THRESHOLD )) {
+ /*
+ * Although Existence tests can work with any syntax values,
+ * Boolean and Threshold tests are integer-only. Ensure that
+ * the returned value(s) are appropriate.
+ *
+ * Note that we only need to check the first value, since all
+ * instances of a given object should have the same syntax.
+ */
+ switch (var->type) {
+ case ASN_INTEGER:
+ case ASN_COUNTER:
+ case ASN_GAUGE:
+ case ASN_TIMETICKS:
+ case ASN_UINTEGER:
+ case ASN_COUNTER64:
+#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
+ case ASN_OPAQUE_COUNTER64:
+ case ASN_OPAQUE_U64:
+ case ASN_OPAQUE_I64:
+#endif
+ /* OK */
+ break;
+ default:
+ /*
+ * Other syntax values can't be used for Boolean/Theshold
+ * tests. Report this as an error, and then rotate the
+ * results ready for the next run, (which will presumably
+ * also detect this as an error once again!)
+ */
+ DEBUGMSGTL(( "disman:event:trigger:fire",
+ "Returned non-integer result(s): "));
+ DEBUGMSGOID(("disman:event:trigger:fire",
+ var->name, var->name_length));
+ DEBUGMSG(( "disman:event:trigger:fire",
+ " (boolean/threshold) %d\n", var->type));;
+ snmp_free_varbind( entry->old_results );
+ entry->old_results = var;
+ return;
+ }
+
+
+ /*
+ * Retrieve the discontinuity markers for delta-valued samples.
+ * (including sysUpTime.0 if not specified explicitly).
+ */
+ if ( entry->flags & MTE_TRIGGER_FLAG_DELTA ) {
+ /*
+ * We'll need sysUpTime.0 regardless...
+ */
+ DEBUGMSGTL(("disman:event:delta", "retrieve sysUpTime.0\n"));
+ memset( &sysUT_var, 0, sizeof( netsnmp_variable_list ));
+ snmp_set_var_objid( &sysUT_var, _sysUpTime_instance,
+ _sysUpTime_inst_len );
+ netsnmp_query_get( &sysUT_var, entry->session );
+
+ if (!(entry->flags & MTE_TRIGGER_FLAG_SYSUPT)) {
+ /*
+ * ... but only retrieve the configured discontinuity
+ * marker(s) if they refer to something different.
+ */
+ DEBUGMSGTL(( "disman:event:delta",
+ "retrieve discontinuity marker(s): "));
+ DEBUGMSGOID(("disman:event:delta", entry->mteDeltaDiscontID,
+ entry->mteDeltaDiscontID_len ));
+ DEBUGMSG(( "disman:event:delta", " %s\n",
+ (entry->flags & MTE_TRIGGER_FLAG_DWILD ? " (wild)" : "")));
+
+ dvar = (netsnmp_variable_list *)
+ SNMP_MALLOC_TYPEDEF( netsnmp_variable_list );
+ if (!dvar) {
+ _mteTrigger_failure(
+ "failed to create mteTrigger delta query varbind");
+ return;
+ }
+ snmp_set_var_objid( dvar, entry->mteDeltaDiscontID,
+ entry->mteDeltaDiscontID_len );
+ if ( entry->flags & MTE_TRIGGER_FLAG_DWILD ) {
+ n = netsnmp_query_walk( dvar, entry->session );
+ } else {
+ n = netsnmp_query_get( dvar, entry->session );
+ }
+ if ( n != SNMP_ERR_NOERROR ) {
+ _mteTrigger_failure( "failed to run mteTrigger delta query" );
+ snmp_free_varbind( dvar );
+ return;
+ }
+ }
+
+ /*
+ * We can't calculate delta values the first time through,
+ * so there's no point in evaluating the remaining tests.
+ *
+ * Save the results (and discontinuity markers),
+ * ready for the next run.
+ */
+ if ( !entry->old_results ) {
+ entry->old_results = var;
+ entry->old_deltaDs = dvar;
+ entry->sysUpTime = *sysUT_var.val.integer;
+ return;
+ }
+ /*
+ * If the sysUpTime marker has been reset (or strictly,
+ * has advanced by less than the monitor frequency),
+ * there's no point in trying the remaining tests.
+ */
+
+ if (*sysUT_var.val.integer < entry->sysUpTime) {
+ DEBUGMSGTL(( "disman:event:delta",
+ "single discontinuity: (sysUT)\n"));
+ snmp_free_varbind( entry->old_results );
+ snmp_free_varbind( entry->old_deltaDs );
+ entry->old_results = var;
+ entry->old_deltaDs = dvar;
+ entry->sysUpTime = *sysUT_var.val.integer;
+ return;
+ }
+ /*
+ * Similarly if a separate (non-wildcarded) discontinuity
+ * marker has changed, then there's no
+ * point in trying to evaluate these tests either.
+ */
+ if (!(entry->flags & MTE_TRIGGER_FLAG_DWILD) &&
+ !(entry->flags & MTE_TRIGGER_FLAG_SYSUPT) &&
+ (!entry->old_deltaDs ||
+ (entry->old_deltaDs->val.integer != dvar->val.integer))) {
+ DEBUGMSGTL(( "disman:event:delta", "single discontinuity: ("));
+ DEBUGMSGOID(( "disman:event:delta", entry->mteDeltaDiscontID,
+ entry->mteDeltaDiscontID_len));
+ DEBUGMSG(( "disman:event:delta", ")\n"));
+ snmp_free_varbind( entry->old_results );
+ snmp_free_varbind( entry->old_deltaDs );
+ entry->old_results = var;
+ entry->old_deltaDs = dvar;
+ entry->sysUpTime = *sysUT_var.val.integer;
+ return;
+ }
+
+ /*
+ * Ensure that the list of (wildcarded) discontinuity
+ * markers matches the list of monitored values
+ * (inserting/removing discontinuity varbinds as needed)
+ *
+ * XXX - An alternative approach would be to use the list
+ * of monitored values (instance subidentifiers) to build
+ * the exact list of delta markers to retrieve earlier.
+ */
+ if (entry->flags & MTE_TRIGGER_FLAG_DWILD) {
+ vp1 = var;
+ vp2 = dvar;
+ vp2_prev = NULL;
+ n = entry->mteTriggerValueID_len;
+ n2 = entry->mteDeltaDiscontID_len;
+ while (vp1) {
+ /*
+ * For each monitored instance, check whether
+ * there's a matching discontinuity entry.
+ */
+ cmp = snmp_oid_compare(vp1->name+n, vp1->name_length-n,
+ vp2->name+n2, vp2->name_length-n2 );
+ if ( cmp < 0 ) {
+ /*
+ * If a discontinuity entry is missing,
+ * insert a (dummy) varbind.
+ * The corresponding delta calculation will
+ * fail, but this simplifies the later code.
+ */
+ vtmp = (netsnmp_variable_list *)
+ SNMP_MALLOC_TYPEDEF( netsnmp_variable_list );
+ if (!vtmp) {
+ _mteTrigger_failure(
+ "failed to create mteTrigger discontinuity varbind");
+ return;
+ }
+ snmp_set_var_objid(vtmp, entry->mteDeltaDiscontID,
+ entry->mteDeltaDiscontID_len);
+ /* XXX - append instance subids */
+ vtmp->next_variable = vp2;
+ vp2_prev->next_variable = vtmp;
+ vp2_prev = vtmp;
+ vp1 = vp1->next_variable;
+ } else if ( cmp == 0 ) {
+ /*
+ * Matching discontinuity entry - all OK.
+ */
+ vp2_prev = vp2;
+ vp2 = vp2->next_variable;
+ vp1 = vp1->next_variable;
+ } else {
+ /*
+ * Remove unneeded discontinuity entry
+ */
+ vtmp = vp2;
+ vp2_prev->next_variable = vp2->next_variable;
+ vp2 = vp2->next_variable;
+ vtmp->next_variable = NULL;
+ snmp_free_varbind( vtmp );
+ }
+ }
+ /*
+ * XXX - Now need to ensure that the old list of
+ * delta discontinuity markers matches as well.
+ */
+ }
+ } /* delta samples */
+ } /* Boolean/Threshold test checks */
+
+
+
+ /*
+ * Only run the Boolean tests if there's an event to be triggered
+ */
+ if ((entry->mteTriggerTest & MTE_TRIGGER_BOOLEAN) &&
+ (entry->mteTBoolEvent[0] != '\0' )) {
+
+ if (entry->flags & MTE_TRIGGER_FLAG_DELTA) {
+ vp2 = entry->old_results;
+ if (entry->flags & MTE_TRIGGER_FLAG_DWILD) {
+ dv1 = dvar;
+ dv2 = entry->old_deltaDs;
+ }
+ }
+ for ( vp1 = var; vp1; vp1=vp1->next_variable ) {
+ /*
+ * Determine the value to be monitored...
+ */
+ if ( !vp1->val.integer ) { /* No value */
+ if ( vp2 )
+ vp2 = vp2->next_variable;
+ continue;
+ }
+ if (entry->flags & MTE_TRIGGER_FLAG_DELTA) {
+ if (entry->flags & MTE_TRIGGER_FLAG_DWILD) {
+ /*
+ * We've already checked any non-wildcarded
+ * discontinuity markers (inc. sysUpTime.0).
+ * Validate this particular sample against
+ * the relevant wildcarded marker...
+ */
+ if ((dv1->type == ASN_NULL) ||
+ (dv1->type != dv2->type) ||
+ (*dv1->val.integer != *dv2->val.integer)) {
+ /*
+ * Bogus or changed discontinuity marker.
+ * Need to skip this sample.
+ */
+ DEBUGMSGTL(( "disman:event:delta", "discontinuity occurred: "));
+ DEBUGMSGOID(("disman:event:delta", vp1->name,
+ vp1->name_length ));
+ DEBUGMSG(( "disman:event:delta", " \n" ));
+ vp2 = vp2->next_variable;
+ continue;
+ }
+ }
+ /*
+ * ... and check there is a previous sample to calculate
+ * the delta value against (regardless of whether the
+ * discontinuity marker was wildcarded or not).
+ */
+ if (vp2->type == ASN_NULL) {
+ DEBUGMSGTL(( "disman:event:delta", "missing sample: "));
+ DEBUGMSGOID(("disman:event:delta", vp1->name,
+ vp1->name_length ));
+ DEBUGMSG(( "disman:event:delta", " \n" ));
+ vp2 = vp2->next_variable;
+ continue;
+ }
+ value = (*vp1->val.integer - *vp2->val.integer);
+ DEBUGMSGTL(( "disman:event:delta", "delta sample: "));
+ DEBUGMSGOID(("disman:event:delta", vp1->name,
+ vp1->name_length ));
+ DEBUGMSG(( "disman:event:delta", " (%d - %d) = %d\n",
+ *vp1->val.integer, *vp2->val.integer, value));
+ vp2 = vp2->next_variable;
+ } else {
+ value = *vp1->val.integer;
+ }
+
+ /*
+ * ... evaluate the comparison ...
+ */
+ switch (entry->mteTBoolComparison) {
+ case MTE_BOOL_UNEQUAL:
+ cmp = ( value != entry->mteTBoolValue );
+ break;
+ case MTE_BOOL_EQUAL:
+ cmp = ( value == entry->mteTBoolValue );
+ break;
+ case MTE_BOOL_LESS:
+ cmp = ( value < entry->mteTBoolValue );
+ break;
+ case MTE_BOOL_LESSEQUAL:
+ cmp = ( value <= entry->mteTBoolValue );
+ break;
+ case MTE_BOOL_GREATER:
+ cmp = ( value > entry->mteTBoolValue );
+ break;
+ case MTE_BOOL_GREATEREQUAL:
+ cmp = ( value >= entry->mteTBoolValue );
+ break;
+ }
+ DEBUGMSGTL(( "disman:event:delta", "Bool comparison: (%d %s %d) %d\n",
+ value, _ops[entry->mteTBoolComparison],
+ entry->mteTBoolValue, cmp));
+
+ /*
+ * ... and decide whether to trigger the event.
+ * (using the 'index' field of the varbind structure
+ * to remember whether the trigger has already fired)
+ */
+ if ( cmp ) {
+ if (vp1->index & MTE_ARMED_BOOLEAN ) {
+ vp1->index &= ~MTE_ARMED_BOOLEAN;
+ /*
+ * NB: Clear the trigger armed flag even if the
+ * (starting) event dosn't actually fire.
+ * Otherwise initially true (but suppressed)
+ * triggers will fire on the *second* probe.
+ */
+ if ( entry->old_results ||
+ (entry->flags & MTE_TRIGGER_FLAG_BSTART)) {
+ DEBUGMSGTL(( "disman:event:trigger:fire",
+ "Firing boolean test: "));
+ DEBUGMSGOID(("disman:event:trigger:fire",
+ vp1->name, vp1->name_length));
+ DEBUGMSG(( "disman:event:trigger:fire", "%s\n",
+ (entry->old_results ? "" : " (startup)")));
+ entry->mteTriggerXOwner = entry->mteTBoolObjOwner;
+ entry->mteTriggerXObjects = entry->mteTBoolObjects;
+ /*
+ * XXX - when firing a delta-based trigger, should
+ * 'mteHotValue' report the actual value sampled
+ * (as here), or the delta that triggered the event ?
+ */
+ entry->mteTriggerFired = vp1;
+ n = entry->mteTriggerValueID_len;
+ mteEvent_fire(entry->mteTBoolEvOwner, entry->mteTBoolEvent,
+ entry, vp1->name+n, vp1->name_length-n);
+ }
+ }
+ } else {
+ vp1->index |= MTE_ARMED_BOOLEAN;
+ }
+ }
+ }
+
+
+ /*
+ * Only run the basic threshold tests if there's an event to
+ * be triggered. (Either rising or falling will do)
+ */
+ if (( entry->mteTriggerTest & MTE_TRIGGER_THRESHOLD ) &&
+ ((entry->mteTThRiseEvent[0] != '\0' ) ||
+ (entry->mteTThFallEvent[0] != '\0' ))) {
+
+ /*
+ * The same delta-sample validation from Boolean
+ * tests also applies here too.
+ */
+ if (entry->flags & MTE_TRIGGER_FLAG_DELTA) {
+ vp2 = entry->old_results;
+ if (entry->flags & MTE_TRIGGER_FLAG_DWILD) {
+ dv1 = dvar;
+ dv2 = entry->old_deltaDs;
+ }
+ }
+ for ( vp1 = var; vp1; vp1=vp1->next_variable ) {
+ /*
+ * Determine the value to be monitored...
+ */
+ if ( !vp1->val.integer ) { /* No value */
+ if ( vp2 )
+ vp2 = vp2->next_variable;
+ continue;
+ }
+ if (entry->flags & MTE_TRIGGER_FLAG_DELTA) {
+ if (entry->flags & MTE_TRIGGER_FLAG_DWILD) {
+ /*
+ * We've already checked any non-wildcarded
+ * discontinuity markers (inc. sysUpTime.0).
+ * Validate this particular sample against
+ * the relevant wildcarded marker...
+ */
+ if ((dv1->type == ASN_NULL) ||
+ (dv1->type != dv2->type) ||
+ (*dv1->val.integer != *dv2->val.integer)) {
+ /*
+ * Bogus or changed discontinuity marker.
+ * Need to skip this sample.
+ */
+ vp2 = vp2->next_variable;
+ continue;
+ }
+ }
+ /*
+ * ... and check there is a previous sample to calculate
+ * the delta value against (regardless of whether the
+ * discontinuity marker was wildcarded or not).
+ */
+ if (vp2->type == ASN_NULL) {
+ vp2 = vp2->next_variable;
+ continue;
+ }
+ value = (*vp1->val.integer - *vp2->val.integer);
+ vp2 = vp2->next_variable;
+ } else {
+ value = *vp1->val.integer;
+ }
+
+ /*
+ * ... evaluate the single-value comparisons,
+ * and decide whether to trigger the event.
+ */
+ cmp = vp1->index; /* working copy of 'armed' flags */
+ if ( value >= entry->mteTThRiseValue ) {
+ if (cmp & MTE_ARMED_TH_RISE ) {
+ cmp &= ~MTE_ARMED_TH_RISE;
+ cmp |= MTE_ARMED_TH_FALL;
+ /*
+ * NB: Clear the trigger armed flag even if the
+ * (starting) event dosn't actually fire.
+ * Otherwise initially true (but suppressed)
+ * triggers will fire on the *second* probe.
+ * Similarly for falling thresholds (see below).
+ */
+ if ( entry->old_results ||
+ (entry->mteTThStartup & MTE_THRESH_START_RISE)) {
+ DEBUGMSGTL(( "disman:event:trigger:fire",
+ "Firing rising threshold test: "));
+ DEBUGMSGOID(("disman:event:trigger:fire",
+ vp1->name, vp1->name_length));
+ DEBUGMSG(( "disman:event:trigger:fire", "%s\n",
+ (entry->old_results ? "" : " (startup)")));
+ /*
+ * If no riseEvent is configured, we need still to
+ * set the armed flags appropriately, but there's
+ * no point in trying to fire the (missing) event.
+ */
+ if (entry->mteTThRiseEvent[0] != '\0' ) {
+ entry->mteTriggerXOwner = entry->mteTThObjOwner;
+ entry->mteTriggerXObjects = entry->mteTThObjects;
+ entry->mteTriggerFired = vp1;
+ n = entry->mteTriggerValueID_len;
+ mteEvent_fire(entry->mteTThRiseOwner,
+ entry->mteTThRiseEvent,
+ entry, vp1->name+n, vp1->name_length-n);
+ }
+ }
+ }
+ }
+
+ if ( value <= entry->mteTThFallValue ) {
+ if (cmp & MTE_ARMED_TH_FALL ) {
+ cmp &= ~MTE_ARMED_TH_FALL;
+ cmp |= MTE_ARMED_TH_RISE;
+ /* Clear the trigger armed flag (see above) */
+ if ( entry->old_results ||
+ (entry->mteTThStartup & MTE_THRESH_START_FALL)) {
+ DEBUGMSGTL(( "disman:event:trigger:fire",
+ "Firing falling threshold test: "));
+ DEBUGMSGOID(("disman:event:trigger:fire",
+ vp1->name, vp1->name_length));
+ DEBUGMSG(( "disman:event:trigger:fire", "%s\n",
+ (entry->old_results ? "" : " (startup)")));
+ /*
+ * Similarly, if no fallEvent is configured,
+ * there's no point in trying to fire it either.
+ */
+ if (entry->mteTThRiseEvent[0] != '\0' ) {
+ entry->mteTriggerXOwner = entry->mteTThObjOwner;
+ entry->mteTriggerXObjects = entry->mteTThObjects;
+ entry->mteTriggerFired = vp1;
+ n = entry->mteTriggerValueID_len;
+ mteEvent_fire(entry->mteTThFallOwner,
+ entry->mteTThFallEvent,
+ entry, vp1->name+n, vp1->name_length-n);
+ }
+ }
+ }
+ }
+ vp1->index = cmp;
+ }
+ }
+
+ /*
+ * The same processing also works for delta-threshold tests (if configured)
+ */
+ if (( entry->mteTriggerTest & MTE_TRIGGER_THRESHOLD ) &&
+ ((entry->mteTThDRiseEvent[0] != '\0' ) ||
+ (entry->mteTThDFallEvent[0] != '\0' ))) {
+
+ /*
+ * Delta-threshold tests can only be used with
+ * absolute valued samples.
+ */
+ vp2 = entry->old_results;
+ if (entry->flags & MTE_TRIGGER_FLAG_DELTA) {
+ DEBUGMSGTL(( "disman:event:trigger",
+ "Delta-threshold on delta-sample\n"));
+ } else if ( vp2 != NULL ) {
+ for ( vp1 = var; vp1; vp1=vp1->next_variable ) {
+ /*
+ * Determine the value to be monitored...
+ * (similar to previous delta-sample processing,
+ * but without the discontinuity marker checks)
+ */
+ if (!vp2) {
+ break; /* Run out of 'old' values */
+ }
+ if (( !vp1->val.integer ) ||
+ (vp2->type == ASN_NULL)) {
+ vp2 = vp2->next_variable;
+ continue;
+ }
+ value = (*vp1->val.integer - *vp2->val.integer);
+ vp2 = vp2->next_variable;
+
+ /*
+ * ... evaluate the single-value comparisons,
+ * and decide whether to trigger the event.
+ */
+ cmp = vp1->index; /* working copy of 'armed' flags */
+ if ( value >= entry->mteTThDRiseValue ) {
+ if (vp1->index & MTE_ARMED_TH_DRISE ) {
+ DEBUGMSGTL(( "disman:event:trigger:fire",
+ "Firing rising delta threshold test: "));
+ DEBUGMSGOID(("disman:event:trigger:fire",
+ vp1->name, vp1->name_length));
+ DEBUGMSG(( "disman:event:trigger:fire", "\n"));
+ cmp &= ~MTE_ARMED_TH_DRISE;
+ cmp |= MTE_ARMED_TH_DFALL;
+ /*
+ * If no riseEvent is configured, we need still to
+ * set the armed flags appropriately, but there's
+ * no point in trying to fire the (missing) event.
+ */
+ if (entry->mteTThDRiseEvent[0] != '\0' ) {
+ entry->mteTriggerXOwner = entry->mteTThObjOwner;
+ entry->mteTriggerXObjects = entry->mteTThObjects;
+ entry->mteTriggerFired = vp1;
+ n = entry->mteTriggerValueID_len;
+ mteEvent_fire(entry->mteTThDRiseOwner,
+ entry->mteTThDRiseEvent,
+ entry, vp1->name+n, vp1->name_length-n);
+ }
+ }
+ }
+
+ if ( value <= entry->mteTThDFallValue ) {
+ if (vp1->index & MTE_ARMED_TH_DFALL ) {
+ DEBUGMSGTL(( "disman:event:trigger:fire",
+ "Firing falling delta threshold test: "));
+ DEBUGMSGOID(("disman:event:trigger:fire",
+ vp1->name, vp1->name_length));
+ DEBUGMSG(( "disman:event:trigger:fire", "\n"));
+ cmp &= ~MTE_ARMED_TH_DFALL;
+ cmp |= MTE_ARMED_TH_DRISE;
+ /*
+ * Similarly, if no fallEvent is configured,
+ * there's no point in trying to fire it either.
+ */
+ if (entry->mteTThDRiseEvent[0] != '\0' ) {
+ entry->mteTriggerXOwner = entry->mteTThObjOwner;
+ entry->mteTriggerXObjects = entry->mteTThObjects;
+ entry->mteTriggerFired = vp1;
+ n = entry->mteTriggerValueID_len;
+ mteEvent_fire(entry->mteTThDFallOwner,
+ entry->mteTThDFallEvent,
+ entry, vp1->name+n, vp1->name_length-n);
+ }
+ }
+ }
+ vp1->index = cmp;
+ }
+ }
+ }
+
+ /*
+ * Finally, rotate the results - ready for the next run.
+ */
+ snmp_free_varbind( entry->old_results );
+ entry->old_results = var;
+ if ( entry->flags & MTE_TRIGGER_FLAG_DELTA ) {
+ snmp_free_varbind( entry->old_deltaDs );
+ entry->old_deltaDs = dvar;
+ entry->sysUpTime = *sysUT_var.val.integer;
+ }
+}
+
+void
+mteTrigger_enable( struct mteTrigger *entry )
+{
+ if (!entry)
+ return;
+
+ if (entry->alarm) {
+ /* XXX - or explicitly call mteTrigger_disable ?? */
+ snmp_alarm_unregister( entry->alarm );
+ entry->alarm = 0;
+ }
+
+ if (entry->mteTriggerFrequency) {
+ /*
+ * register once to run ASAP, and another to run
+ * at the trigger frequency
+ */
+ snmp_alarm_register(0, 0, mteTrigger_run, entry );
+ entry->alarm = snmp_alarm_register(
+ entry->mteTriggerFrequency, SA_REPEAT,
+ mteTrigger_run, entry );
+ }
+}
+
+void
+mteTrigger_disable( struct mteTrigger *entry )
+{
+ if (!entry)
+ return;
+
+ if (entry->alarm) {
+ snmp_alarm_unregister( entry->alarm );
+ entry->alarm = 0;
+ /* XXX - perhaps release any previous results */
+ }
+}
+
+long _mteTrigger_MaxCount = 0;
+long _mteTrigger_countEntries(void)
+{
+ struct mteTrigger *entry;
+ netsnmp_tdata_row *row;
+ long count = 0;
+
+ for (row = netsnmp_tdata_row_first(trigger_table_data);
+ row;
+ row = netsnmp_tdata_row_next(trigger_table_data, row)) {
+ entry = (struct mteTrigger *)row->data;
+ count += entry->count;
+ }
+
+ return count;
+}
+
+long mteTrigger_getNumEntries(int max)
+{
+ long count;
+ /* XXX - implement some form of caching ??? */
+ count = _mteTrigger_countEntries();
+ if ( count > _mteTrigger_MaxCount )
+ _mteTrigger_MaxCount = count;
+
+ return ( max ? _mteTrigger_MaxCount : count);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTrigger.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTrigger.h
new file mode 100644
index 0000000000..aaf949a289
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTrigger.h
@@ -0,0 +1,199 @@
+#ifndef MTETRIGGER_H
+#define MTETRIGGER_H
+
+extern oid _sysUpTime_instance[];
+extern size_t _sysUpTime_inst_len;
+ /*
+ * Flags relating to the mteTriggerTable and related tables
+ */
+#define MTE_TRIGGER_FLAG_DELTA 0x01 /* for mteTriggerSampleType */
+#define MTE_TRIGGER_FLAG_VWILD 0x02 /* for mteTriggerValueIDWildcard */
+#define MTE_TRIGGER_FLAG_CWILD 0x04 /* for mteTriggerContextWildcard */
+#define MTE_TRIGGER_FLAG_DWILD 0x08 /* for mteTriggerDeltaDIDWildcard */
+#define MTE_TRIGGER_FLAG_SYSUPT 0x10 /* using default mteTriggerDeltaID */
+
+#define MTE_TRIGGER_FLAG_BSTART 0x20 /* for mteTriggerBooleanStartup */
+
+#define MTE_TRIGGER_FLAG_ENABLED 0x0100 /* for mteTriggerEnabled */
+#define MTE_TRIGGER_FLAG_ACTIVE 0x0200 /* for mteTriggerEntryStatus */
+#define MTE_TRIGGER_FLAG_FIXED 0x0400 /* for snmpd.conf persistence */
+#define MTE_TRIGGER_FLAG_VALID 0x0800 /* for row creation/undo */
+
+
+ /*
+ * Values for the mteTriggerTest field
+ */
+#define MTE_TRIGGER_EXISTENCE 0x80 /* mteTriggerTest values */
+#define MTE_TRIGGER_BOOLEAN 0x40
+#define MTE_TRIGGER_THRESHOLD 0x20
+
+ /*
+ * Values for the mteTriggerSampleType field
+ */
+#define MTE_SAMPLE_ABSOLUTE 1 /* mteTriggerSampleType values */
+#define MTE_SAMPLE_DELTA 2
+
+ /*
+ * Values for the mteTriggerDeltaDiscontinuityIDType field
+ */
+#define MTE_DELTAD_TTICKS 1
+#define MTE_DELTAD_TSTAMP 2
+#define MTE_DELTAD_DATETIME 3
+
+ /*
+ * Values for the mteTriggerExistenceTest
+ * and mteTriggerExistenceStartup fields
+ */
+#define MTE_EXIST_PRESENT 0x80
+#define MTE_EXIST_ABSENT 0x40
+#define MTE_EXIST_CHANGED 0x20
+
+ /*
+ * Values for the mteTriggerBooleanComparison field
+ */
+#define MTE_BOOL_UNEQUAL 1
+#define MTE_BOOL_EQUAL 2
+#define MTE_BOOL_LESS 3
+#define MTE_BOOL_LESSEQUAL 4
+#define MTE_BOOL_GREATER 5
+#define MTE_BOOL_GREATEREQUAL 6
+
+ /*
+ * Values for the mteTriggerThresholdStartup field
+ */
+#define MTE_THRESH_START_RISE 1
+#define MTE_THRESH_START_FALL 2
+#define MTE_THRESH_START_RISEFALL 3
+ /* Note that RISE and FALL values can be used for bit-wise
+ tests as well, since RISEFALL = RISE | FALL */
+
+
+ /*
+ * Flags to indicate which triggers are armed, and ready to fire.
+ */
+#define MTE_ARMED_TH_RISE 0x01
+#define MTE_ARMED_TH_FALL 0x02
+#define MTE_ARMED_TH_DRISE 0x04
+#define MTE_ARMED_TH_DFALL 0x08
+#define MTE_ARMED_BOOLEAN 0x10
+#define MTE_ARMED_ALL 0x1f
+
+ /*
+ * All Event-MIB OCTET STRING objects are either short (32-character)
+ * tags, or SnmpAdminString/similar values (i.e. 255 characters)
+ */
+#define MTE_STR1_LEN 32
+#define MTE_STR2_LEN 255
+
+/*
+ * Data structure for a (combined) trigger row. Covers delta samples,
+ * and all types (Existence, Boolean and Threshold) of trigger.
+ */
+struct mteTrigger {
+ /*
+ * Index values
+ */
+ char mteOwner[MTE_STR1_LEN+1];
+ char mteTName[MTE_STR1_LEN+1];
+
+ /*
+ * Column values for the main mteTriggerTable
+ */
+ char mteTriggerComment[MTE_STR2_LEN+1];
+ char mteTriggerTest;
+ oid mteTriggerValueID[MAX_OID_LEN];
+ size_t mteTriggerValueID_len;
+ char mteTriggerTarget[ MTE_STR2_LEN+1];
+ char mteTriggerContext[MTE_STR2_LEN+1];
+ u_long mteTriggerFrequency;
+ char mteTriggerOOwner[ MTE_STR1_LEN+1];
+ char mteTriggerObjects[MTE_STR1_LEN+1];
+
+ netsnmp_session *session;
+ long flags;
+
+ /*
+ * Column values for the mteTriggerDeltaTable
+ */
+ oid mteDeltaDiscontID[MAX_OID_LEN];
+ size_t mteDeltaDiscontID_len;
+ long mteDeltaDiscontIDType;
+
+ /*
+ * Column values for Existence tests (mteTriggerExistenceTable)
+ */
+ char mteTExTest;
+ char mteTExStartup;
+ char mteTExObjOwner[MTE_STR1_LEN+1];
+ char mteTExObjects[ MTE_STR1_LEN+1];
+ char mteTExEvOwner[ MTE_STR1_LEN+1];
+ char mteTExEvent[ MTE_STR1_LEN+1];
+
+ /*
+ * Column values for Boolean tests (mteTriggerBooleanTable)
+ */
+ long mteTBoolComparison;
+ long mteTBoolValue;
+ char mteTBoolObjOwner[MTE_STR1_LEN+1];
+ char mteTBoolObjects[ MTE_STR1_LEN+1];
+ char mteTBoolEvOwner[ MTE_STR1_LEN+1];
+ char mteTBoolEvent[ MTE_STR1_LEN+1];
+
+ /*
+ * Column values for Threshold tests (mteTriggerThresholdTable)
+ */
+ long mteTThStartup;
+ long mteTThRiseValue;
+ long mteTThFallValue;
+ long mteTThDRiseValue;
+ long mteTThDFallValue;
+ char mteTThObjOwner[ MTE_STR1_LEN+1];
+ char mteTThObjects[ MTE_STR1_LEN+1];
+ char mteTThRiseOwner[ MTE_STR1_LEN+1];
+ char mteTThRiseEvent[ MTE_STR1_LEN+1];
+ char mteTThFallOwner[ MTE_STR1_LEN+1];
+ char mteTThFallEvent[ MTE_STR1_LEN+1];
+ char mteTThDRiseOwner[MTE_STR1_LEN+1];
+ char mteTThDRiseEvent[MTE_STR1_LEN+1];
+ char mteTThDFallOwner[MTE_STR1_LEN+1];
+ char mteTThDFallEvent[MTE_STR1_LEN+1];
+
+ /*
+ * Additional fields for operation of the Trigger tables:
+ * monitoring...
+ */
+ unsigned int alarm;
+ long sysUpTime;
+ netsnmp_variable_list *old_results;
+ netsnmp_variable_list *old_deltaDs;
+
+ /*
+ * ... stats...
+ */
+ long count;
+
+ /*
+ * ... and firing.
+ */
+ char *mteTriggerXOwner;
+ char *mteTriggerXObjects;
+ netsnmp_variable_list *mteTriggerFired;
+};
+
+ /*
+ * Container structure for the (combined) mteTrigger*Tables,
+ * and routine to create this.
+ */
+extern netsnmp_tdata *trigger_table_data;
+extern void init_trigger_table_data(void);
+
+void init_mteTrigger(void);
+void mteTrigger_removeEntry(netsnmp_tdata_row *row);
+netsnmp_tdata_row *mteTrigger_createEntry(char *mteOwner,
+ char *mteTriggerName, int fixed);
+void mteTrigger_enable( struct mteTrigger *entry );
+void mteTrigger_disable( struct mteTrigger *entry );
+
+long mteTrigger_getNumEntries(int max);
+
+#endif /* MTETRIGGER_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerBooleanTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerBooleanTable.c
new file mode 100644
index 0000000000..52efcac8bd
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerBooleanTable.c
@@ -0,0 +1,276 @@
+/*
+ * DisMan Event MIB:
+ * Implementation of the mteTriggerBooleanTable MIB interface
+ * See 'mteTrigger.c' for active behaviour of this table.
+ *
+ * (based on mib2c.table_data.conf output)
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "disman/event/mteTrigger.h"
+#include "disman/event/mteTriggerBooleanTable.h"
+
+
+/** Initializes the mteTriggerBooleanTable module */
+void
+init_mteTriggerBooleanTable(void)
+{
+ static oid mteTBoolTable_oid[] = { 1, 3, 6, 1, 2, 1, 88, 1, 2, 5 };
+ size_t mteTBoolTable_oid_len = OID_LENGTH(mteTBoolTable_oid);
+ netsnmp_handler_registration *reg;
+ netsnmp_table_registration_info *table_info;
+
+ /*
+ * Ensure the (combined) table container is available...
+ */
+ init_trigger_table_data();
+
+ /*
+ * ... then set up the MIB interface to the mteTriggerBooleanTable slice
+ */
+ reg = netsnmp_create_handler_registration("mteTriggerBooleanTable",
+ mteTriggerBooleanTable_handler,
+ mteTBoolTable_oid,
+ mteTBoolTable_oid_len,
+ HANDLER_CAN_RWRITE);
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_OCTET_STR, /* index: mteOwner */
+ /* index: mteTriggerName */
+ ASN_PRIV_IMPLIED_OCTET_STR,
+ 0);
+
+ table_info->min_column = COLUMN_MTETRIGGERBOOLEANCOMPARISON;
+ table_info->max_column = COLUMN_MTETRIGGERBOOLEANEVENT;
+
+ /* Register this using the (common) trigger_table_data container */
+ netsnmp_tdata_register(reg, trigger_table_data, table_info);
+ DEBUGMSGTL(("disman:event:init", "Trigger Bool Table\n"));
+}
+
+
+/** handles requests for the mteTriggerBooleanTable table */
+int
+mteTriggerBooleanTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *tinfo;
+ struct mteTrigger *entry;
+ int ret;
+
+ DEBUGMSGTL(("disman:event:mib", "Boolean Table handler (%d)\n",
+ reqinfo->mode));
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ /*
+ * The mteTriggerBooleanTable should only contains entries for
+ * rows where the mteTriggerTest 'boolean(1)' bit is set.
+ * So skip entries where this isn't the case.
+ */
+ if (!entry || !(entry->mteTriggerTest & MTE_TRIGGER_BOOLEAN ))
+ continue;
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGERBOOLEANCOMPARISON:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->mteTBoolComparison);
+ break;
+ case COLUMN_MTETRIGGERBOOLEANVALUE:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->mteTBoolValue);
+ break;
+ case COLUMN_MTETRIGGERBOOLEANSTARTUP:
+ ret = (entry->flags & MTE_TRIGGER_FLAG_BSTART ) ?
+ TV_TRUE : TV_FALSE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ case COLUMN_MTETRIGGERBOOLEANOBJECTSOWNER:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTBoolObjOwner,
+ strlen(entry->mteTBoolObjOwner));
+ break;
+ case COLUMN_MTETRIGGERBOOLEANOBJECTS:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTBoolObjects,
+ strlen(entry->mteTBoolObjects));
+ break;
+ case COLUMN_MTETRIGGERBOOLEANEVENTOWNER:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTBoolEvOwner,
+ strlen(entry->mteTBoolEvOwner));
+ break;
+ case COLUMN_MTETRIGGERBOOLEANEVENT:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTBoolEvent,
+ strlen(entry->mteTBoolEvent));
+ break;
+ }
+ }
+ break;
+
+ /*
+ * Write-support
+ */
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ /*
+ * Since the mteTriggerBooleanTable only contains entries for
+ * rows where the mteTriggerTest 'boolean(1)' bit is set,
+ * strictly speaking we should reject assignments where
+ * this isn't the case.
+ * But SET requests that include an assignment of the
+ * 'boolean(1)' bit at the same time are valid, so would
+ * need to be accepted. Unfortunately, this assignment
+ * is only applied in the COMMIT pass, so it's difficult
+ * to detect whether this holds or not.
+ *
+ * Let's fudge things for now, by processing assignments
+ * even if the 'boolean(1)' bit isn't set.
+ */
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGERBOOLEANCOMPARISON:
+ ret = netsnmp_check_vb_int_range(request->requestvb,
+ MTE_BOOL_UNEQUAL, MTE_BOOL_GREATEREQUAL);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTETRIGGERBOOLEANVALUE:
+ ret = netsnmp_check_vb_int(request->requestvb);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTETRIGGERBOOLEANSTARTUP:
+ ret = netsnmp_check_vb_truthvalue(request->requestvb);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTETRIGGERBOOLEANOBJECTSOWNER:
+ case COLUMN_MTETRIGGERBOOLEANOBJECTS:
+ case COLUMN_MTETRIGGERBOOLEANEVENTOWNER:
+ case COLUMN_MTETRIGGERBOOLEANEVENT:
+ ret = netsnmp_check_vb_type_and_max_size(
+ request->requestvb, ASN_OCTET_STR, MTE_STR1_LEN);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * The Event MIB is somewhat ambiguous as to whether the
+ * various trigger table entries can be modified once the
+ * main mteTriggerTable entry has been marked 'active'.
+ * But it's clear from discussion on the DisMan mailing
+ * list is that the intention is not.
+ *
+ * So check for whether this row is already active,
+ * and reject *all* SET requests if it is.
+ */
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ if (entry &&
+ entry->flags & MTE_TRIGGER_FLAG_ACTIVE ) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ case MODE_SET_FREE:
+ case MODE_SET_UNDO:
+ break;
+
+ case MODE_SET_ACTION:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ if (!entry) {
+ /*
+ * New rows must be created via the RowStatus column
+ * (in the main mteTriggerTable)
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOCREATION);
+ /* or inconsistentName? */
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ /*
+ * All these assignments are "unfailable", so it's
+ * (reasonably) safe to apply them in the Commit phase
+ */
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGERBOOLEANCOMPARISON:
+ entry->mteTBoolComparison = *request->requestvb->val.integer;
+ break;
+ case COLUMN_MTETRIGGERBOOLEANVALUE:
+ entry->mteTBoolValue = *request->requestvb->val.integer;
+ break;
+ case COLUMN_MTETRIGGERBOOLEANSTARTUP:
+ if (*request->requestvb->val.integer == TV_TRUE)
+ entry->flags |= MTE_TRIGGER_FLAG_BSTART;
+ else
+ entry->flags &= ~MTE_TRIGGER_FLAG_BSTART;
+ break;
+ case COLUMN_MTETRIGGERBOOLEANOBJECTSOWNER:
+ memset(entry->mteTBoolObjOwner, 0, sizeof(entry->mteTBoolObjOwner));
+ memcpy(entry->mteTBoolObjOwner, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGERBOOLEANOBJECTS:
+ memset(entry->mteTBoolObjects, 0, sizeof(entry->mteTBoolObjects));
+ memcpy(entry->mteTBoolObjects, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGERBOOLEANEVENTOWNER:
+ memset(entry->mteTBoolEvOwner, 0, sizeof(entry->mteTBoolEvOwner));
+ memcpy(entry->mteTBoolEvOwner, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGERBOOLEANEVENT:
+ memset(entry->mteTBoolEvent, 0, sizeof(entry->mteTBoolEvent));
+ memcpy(entry->mteTBoolEvent, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ }
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerBooleanTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerBooleanTable.h
new file mode 100644
index 0000000000..d2d2dcb238
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerBooleanTable.h
@@ -0,0 +1,24 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.table_data.conf,v 1.8 2005/07/19 14:52:03 dts12 Exp $
+ */
+#ifndef MTETRIGGERBOOLEANTABLE_H
+#define MTETRIGGERBOOLEANTABLE_H
+
+/*
+ * function declarations
+ */
+void init_mteTriggerBooleanTable(void);
+Netsnmp_Node_Handler mteTriggerBooleanTable_handler;
+
+/*
+ * column number definitions for table mteTriggerBooleanTable
+ */
+#define COLUMN_MTETRIGGERBOOLEANCOMPARISON 1
+#define COLUMN_MTETRIGGERBOOLEANVALUE 2
+#define COLUMN_MTETRIGGERBOOLEANSTARTUP 3
+#define COLUMN_MTETRIGGERBOOLEANOBJECTSOWNER 4
+#define COLUMN_MTETRIGGERBOOLEANOBJECTS 5
+#define COLUMN_MTETRIGGERBOOLEANEVENTOWNER 6
+#define COLUMN_MTETRIGGERBOOLEANEVENT 7
+#endif /* MTETRIGGERBOOLEANTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerConf.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerConf.c
new file mode 100644
index 0000000000..c11fbc2d00
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerConf.c
@@ -0,0 +1,1480 @@
+/*
+ * DisMan Event MIB:
+ * Implementation of the trigger table configure handling
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/agent_callbacks.h>
+#include "utilities/iquery.h"
+#include "disman/event/mteObjects.h"
+#include "disman/event/mteTrigger.h"
+#include "disman/event/mteTriggerConf.h"
+
+#include <ctype.h>
+
+
+/** Initializes the mteTriggerConf module */
+void
+init_mteTriggerConf(void)
+{
+ init_trigger_table_data();
+
+ /*
+ * Register config handler for user-level (fixed) triggers ...
+ */
+ snmpd_register_config_handler("monitor",
+ parse_mteMonitor, NULL,
+ "triggername [-I] [-i OID | -o OID]* [-e event] expression ");
+ snmpd_register_config_handler("defaultMonitors",
+ parse_default_mteMonitors, NULL, "yes|no");
+ snmpd_register_config_handler("linkUpDownNotifications",
+ parse_linkUpDown_traps, NULL, "yes|no");
+
+ /*
+ * ... for persistent storage of various event table entries ...
+ */
+ snmpd_register_config_handler("_mteTTable",
+ parse_mteTTable, NULL, NULL);
+ snmpd_register_config_handler("_mteTDTable",
+ parse_mteTDTable, NULL, NULL);
+ snmpd_register_config_handler("_mteTExTable",
+ parse_mteTExTable, NULL, NULL);
+ snmpd_register_config_handler("_mteTBlTable",
+ parse_mteTBlTable, NULL, NULL);
+ snmpd_register_config_handler("_mteTThTable",
+ parse_mteTThTable, NULL, NULL);
+
+ /*
+ * ... and backwards compatability with the previous implementation.
+ */
+ snmpd_register_config_handler("mteTriggerTable",
+ parse_mteTriggerTable, NULL, NULL);
+
+ /*
+ * Register to save (non-fixed) entries when the agent shuts down
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_mteTTable, NULL);
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_PRE_UPDATE_CONFIG,
+ clear_mteTTable, NULL);
+}
+
+/* ==============================
+ *
+ * utility routines
+ *
+ * ============================== */
+
+ /*
+ * Find or create the specified trigger entry
+ */
+struct mteTrigger *
+_find_mteTrigger_entry( char *owner, char *tname )
+{
+ netsnmp_variable_list owner_var, tname_var;
+ netsnmp_tdata_row *row;
+
+ /*
+ * If there's already an existing entry,
+ * then use that...
+ */
+ memset(&owner_var, 0, sizeof(netsnmp_variable_list));
+ memset(&tname_var, 0, sizeof(netsnmp_variable_list));
+ snmp_set_var_typed_value(&owner_var, ASN_OCTET_STR, owner, strlen(owner));
+ snmp_set_var_typed_value(&tname_var, ASN_PRIV_IMPLIED_OCTET_STR,
+ tname, strlen(tname));
+ owner_var.next_variable = &tname_var;
+ row = netsnmp_tdata_row_get_byidx( trigger_table_data, &owner_var );
+ /*
+ * ... otherwise, create a new one
+ */
+ if (!row)
+ row = mteTrigger_createEntry( owner, tname, 0 );
+ if (!row)
+ return NULL;
+
+ /* return (struct mteTrigger *)netsnmp_tdata_row_entry( row ); */
+ return (struct mteTrigger *)row->data;
+}
+
+struct mteTrigger *
+_find_typed_mteTrigger_entry( char *owner, char *tname, int type )
+{
+ struct mteTrigger *entry = _find_mteTrigger_entry( owner, tname );
+ if (!entry)
+ return NULL;
+
+ /*
+ * If this is an existing (i.e. valid) entry of the
+ * same type, then throw an error and discard it.
+ * But allow combined Existence/Boolean/Threshold trigger.
+ */
+ if ( entry &&
+ (entry->flags & MTE_TRIGGER_FLAG_VALID) &&
+ (entry->mteTriggerTest & type )) {
+ config_perror("duplicate trigger name");
+ return NULL;
+ }
+ return entry;
+}
+
+
+/* ================================================
+ *
+ * Handlers for user-configured (static) triggers
+ *
+ * ================================================ */
+
+int
+_mteTrigger_callback_enable( int majorID, int minorID,
+ void *serverargs, void *clientarg)
+{
+ struct mteTrigger *entry = (struct mteTrigger *)clientarg;
+ mteTrigger_enable( entry );
+
+ return 0;
+}
+
+
+void
+parse_mteMonitor(const char *token, char *line)
+{
+ char buf[ SPRINT_MAX_LEN];
+ char tname[MTE_STR1_LEN+1];
+ char *cp;
+ long test = 0;
+
+ char ename[MTE_STR1_LEN+1];
+ long flags = MTE_TRIGGER_FLAG_ENABLED |
+ MTE_TRIGGER_FLAG_ACTIVE |
+ MTE_TRIGGER_FLAG_FIXED |
+ MTE_TRIGGER_FLAG_VWILD |
+ MTE_TRIGGER_FLAG_SYSUPT |
+ MTE_TRIGGER_FLAG_VALID;
+ long idx = 0;
+ long startup = 1; /* ??? or 0 */
+ long repeat = 600;
+ netsnmp_session *sess = NULL;
+
+ int seen_name = 0;
+ char oid_name_buf[SPRINT_MAX_LEN];
+ oid name_buf[MAX_OID_LEN];
+ size_t name_buf_len;
+ long op = 0;
+ long value = 0;
+
+ struct mteObject *object;
+ struct mteTrigger *entry;
+
+ DEBUGMSGTL(("disman:event:conf", "Parsing disman monitor config (%s)\n", line));
+
+ /*
+ * Before parsing the configuration fully, first
+ * skim through the config line in order to:
+ * a) locate the name for the trigger, and
+ * b) identify the type of trigger test
+ *
+ * This information will be used both for creating the trigger
+ * entry, and registering any additional payload objects.
+ */
+ memset( buf, 0, sizeof(buf));
+ memset( tname, 0, sizeof(tname));
+ memset( ename, 0, sizeof(ename));
+ for (cp = copy_nword(line, buf, SPRINT_MAX_LEN);
+ ;
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN)) {
+
+ if ( buf[0] == '-' ) {
+ switch (buf[1]) {
+ case 't':
+ /* No longer necessary */
+ break;
+ case 'd':
+ case 'e':
+ case 'o':
+ case 'r':
+ case 'u':
+ /* skip option parameter */
+ cp = skip_token( cp );
+ break;
+ case 'D':
+ case 'I':
+ case 's':
+ case 'S':
+ /* flag options */
+ break;
+ case 'i':
+ /*
+ * '-i' can act as a flag or take a parameter.
+ * Handle either case.
+ */
+ if (cp && *cp != '-')
+ cp = skip_token( cp );
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ /* accept negative values */
+ case '\0':
+ /* and '-' placeholder value */
+ break;
+ default:
+ config_perror("unrecognised option");
+ return;
+ }
+ } else {
+ /*
+ * Save the first non-option parameter as the trigger name.
+ *
+ * This name will also be used to register entries in the
+ * mteObjectsTable, so insert a distinguishing prefix.
+ * This will ensure combined trigger entries don't clash with
+ * each other, or with a similarly-named notification event.
+ */
+ if ( !tname[0] ) {
+ tname[0] = '_';
+ tname[1] = '_'; /* Placeholder */
+ memcpy( tname+2, buf, MTE_STR1_LEN-2 );
+ } else {
+ /*
+ * This marks the beginning of the monitor expression,
+ * so we don't need to scan any further
+ */
+ break;
+ }
+ }
+ if (!cp)
+ break;
+ }
+
+ /*
+ * Now let's examine the expression to determine the type of
+ * monitor being configured. There are four possible forms:
+ * != OID (or ! OID) (existence test)
+ * OID (existence test)
+ * OID op VALUE (boolean test)
+ * OID MIN MAX (threshold test)
+ */
+ if ( *buf == '!' ) {
+ /*
+ * If the expression starts with '!=' or '!', then
+ * it must be the first style of existence test.
+ */
+ test = MTE_TRIGGER_EXISTENCE;
+ } else {
+ /*
+ * Otherwise the first token is the OID to be monitored.
+ * Skip it and look at the next token (if any).
+ */
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN);
+ if (cp) {
+ /*
+ * If this is a numeric value, then it'll be the MIN
+ * field of a threshold test (the fourth form)
+ * Otherwise it'll be the operation field of a
+ * boolean test (the third form)
+ */
+ if ( isdigit(buf[0]) || buf[0] == '-' )
+ test = MTE_TRIGGER_THRESHOLD;
+ else
+ test = MTE_TRIGGER_BOOLEAN;
+ } else {
+ /*
+ * If there isn't a "next token", then this
+ * must be the second style of existence test.
+ */
+ test = MTE_TRIGGER_EXISTENCE;
+ }
+ }
+
+ /*
+ * Use the type of trigger test to update the trigger name buffer
+ */
+ switch (test) {
+ case MTE_TRIGGER_BOOLEAN:
+ tname[1] = 'B'; break;
+ case MTE_TRIGGER_THRESHOLD:
+ tname[1] = 'T'; break;
+ case MTE_TRIGGER_EXISTENCE:
+ tname[1] = 'X'; break;
+ }
+
+
+
+ /*
+ * Now start parsing again at the beginning of the directive,
+ * extracting the various options...
+ */
+ for (cp = copy_nword(line, buf, SPRINT_MAX_LEN);
+ ;
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN)) {
+
+ if (buf[0] == '-' ) {
+ switch (buf[1]) {
+ case 'D': /* delta sample value */
+ flags |= MTE_TRIGGER_FLAG_DELTA;
+ break;
+
+ case 'd': /* discontinuity OID (implies delta sample) */
+ flags |= MTE_TRIGGER_FLAG_DELTA;
+ if (buf[2] != 'i')
+ flags |= MTE_TRIGGER_FLAG_DWILD;
+ memset( oid_name_buf, 0, sizeof(oid_name_buf));
+ memset( name_buf, 0, sizeof( name_buf));
+ name_buf_len = MAX_OID_LEN;
+ cp = copy_nword(cp, oid_name_buf, MTE_STR1_LEN);
+ if (!snmp_parse_oid(oid_name_buf, name_buf, &name_buf_len)) {
+ snmp_log(LOG_ERR, "discontinuity OID: %s\n", oid_name_buf);
+ config_perror("unknown discontinuity OID");
+ mteObjects_removeEntries( "snmpd.conf", tname );
+ return;
+ }
+ if ( snmp_oid_compare( name_buf, name_buf_len,
+ _sysUpTime_instance,
+ _sysUpTime_inst_len) != 0 )
+ flags &= ~MTE_TRIGGER_FLAG_SYSUPT;
+ break;
+
+ case 'e': /* event */
+ cp = copy_nword(cp, ename, MTE_STR1_LEN);
+ break;
+
+ case 'I': /* value instance */
+ flags &= ~MTE_TRIGGER_FLAG_VWILD;
+ break;
+
+ /*
+ * "instance" flag:
+ * either non-wildcarded mteTriggerValueID
+ * (backwards compatability - see '-I')
+ * or exact payload OID
+ * (c.f. notificationEvent config)
+ */
+ case 'i':
+ if ( *cp == '-' ) {
+ /* Backwards compatibility - now '-I' */
+ flags &= ~MTE_TRIGGER_FLAG_VWILD;
+ continue;
+ }
+ idx++;
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN);
+ object = mteObjects_addOID( "snmpd.conf", tname, idx, buf, 0 );
+ if (!object) {
+ snmp_log(LOG_ERR, "Unknown payload OID: %s\n", buf);
+ config_perror("Unknown payload OID");
+ mteObjects_removeEntries( "snmpd.conf", tname );
+ } else
+ idx = object->mteOIndex;
+ break;
+
+ case 'o': /* object */
+ idx++;
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN);
+ object = mteObjects_addOID( "snmpd.conf", tname, idx, buf, 1 );
+ if (!object) {
+ snmp_log(LOG_ERR, "Unknown payload OID: %s\n", buf);
+ config_perror("Unknown payload OID");
+ mteObjects_removeEntries( "snmpd.conf", tname );
+ } else
+ idx = object->mteOIndex;
+ break;
+
+ case 'r': /* repeat frequency */
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN);
+ repeat = strtoul(buf, NULL, 0);
+ break;
+
+ case 'S': /* disable startup tests */
+ startup = 0;
+ break;
+
+ case 's': /* enable startup tests (default?) */
+ startup = 1;
+ break;
+
+ case 't': /* threshold test - already handled */
+ break;
+
+ case 'u': /* user */
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN);
+ sess = netsnmp_iquery_user_session(buf);
+ if (NULL == sess) {
+ snmp_log(LOG_ERR, "user name %s not found\n", buf);
+ config_perror("Unknown user name\n");
+ mteObjects_removeEntries( "snmpd.conf", tname );
+ return;
+ }
+ break;
+ }
+ } else {
+ /*
+ * Skip the first non-option token - the trigger
+ * name (which has already been processed earlier).
+ */
+ if ( !seen_name ) {
+ seen_name = 1;
+ } else {
+ /*
+ * But the next non-option token encountered will
+ * mark the start of the expression to be monitored.
+ *
+ * There are three possible expression formats:
+ * [op] OID (existence tests)
+ * OID op value (boolean tests)
+ * OID val val [val val] (threshold tests)
+ *
+ * Extract the OID, operation and (first) value.
+ */
+ switch ( test ) {
+ case MTE_TRIGGER_EXISTENCE:
+ /*
+ * Identify the existence operator (if any)...
+ */
+ op = MTE_EXIST_PRESENT;
+ if (buf[0] == '!') {
+ if (buf[1] == '=') {
+ op = MTE_EXIST_CHANGED;
+ } else {
+ op = MTE_EXIST_ABSENT;
+ }
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN);
+ }
+ /*
+ * ... then extract the monitored OID.
+ * (ignoring anything that remains)
+ */
+ memcpy(oid_name_buf, buf, SPRINT_MAX_LEN);
+ cp = NULL; /* To terminate the processing loop */
+ DEBUGMSGTL(("disman:event:conf", "%s: Exist (%s, %d)\n",
+ tname, oid_name_buf, op));
+ break;
+
+ case MTE_TRIGGER_BOOLEAN:
+ /*
+ * Extract the monitored OID, and
+ * identify the boolean operator ...
+ */
+ memcpy(oid_name_buf, buf, SPRINT_MAX_LEN);
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN);
+ if (buf[0] == '!') {
+ op = MTE_BOOL_UNEQUAL;
+ } else if (buf[0] == '=') {
+ op = MTE_BOOL_EQUAL;
+ } else if (buf[0] == '<') {
+ if (buf[1] == '=') {
+ op = MTE_BOOL_LESSEQUAL;
+ } else {
+ op = MTE_BOOL_LESS;
+ }
+ } else if (buf[0] == '>') {
+ if (buf[1] == '=') {
+ op = MTE_BOOL_GREATEREQUAL;
+ } else {
+ op = MTE_BOOL_GREATER;
+ }
+ }
+ /*
+ * ... then extract the comparison value.
+ * (ignoring anything that remains)
+ */
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN);
+ value = strtol(buf, NULL, 0);
+ cp = NULL; /* To terminate the processing loop */
+ DEBUGMSGTL(("disman:event:conf", "%s: Bool (%s, %d, %d)\n",
+ tname, oid_name_buf, op, value));
+ break;
+
+ case MTE_TRIGGER_THRESHOLD:
+ /*
+ * Extract the monitored OID, and
+ * the first comparison value...
+ */
+ memcpy(oid_name_buf, buf, SPRINT_MAX_LEN);
+ memset( buf, 0, SPRINT_MAX_LEN);
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN);
+ if ( buf[0] != '-' )
+ value = strtol(buf, NULL, 0);
+
+ /*
+ * ... then save the rest of the line for later.
+ */
+ memset( buf, 0, strlen(buf));
+ memcpy( buf, cp, strlen(cp));
+ cp = NULL; /* To terminate the processing loop */
+ DEBUGMSGTL(("disman:event:conf", "%s: Thresh (%s, %d, %s)\n",
+ tname, oid_name_buf, op, buf));
+ break;
+ }
+ }
+ }
+ if (!cp)
+ break;
+ }
+
+ if (NULL == sess) {
+ sess = netsnmp_query_get_default_session();
+ if (NULL == sess) {
+ config_perror
+ ("You must specify a default user name using the agentSecName token\n");
+ mteObjects_removeEntries( "snmpd.conf", tname );
+ return;
+ }
+ }
+
+ /*
+ * ... and then create the new trigger entry...
+ */
+ entry = _find_typed_mteTrigger_entry( "snmpd.conf", tname+2, test );
+ if (!entry) {
+ /* mteObjects_removeEntries( "snmpd.conf", tname ); */
+ return;
+ }
+
+ /*
+ * ... populate the type-independent fields...
+ * (setting the delta discontinuity OID first)
+ */
+ if ( (flags & MTE_TRIGGER_FLAG_DELTA) &&
+ !(flags & MTE_TRIGGER_FLAG_SYSUPT)) {
+ memset( entry->mteDeltaDiscontID, 0, sizeof(entry->mteDeltaDiscontID));
+ memcpy( entry->mteDeltaDiscontID, name_buf, name_buf_len*sizeof(oid));
+ entry->mteDeltaDiscontID_len = name_buf_len;
+ }
+ name_buf_len = MAX_OID_LEN;
+ if (!snmp_parse_oid(oid_name_buf, name_buf, &name_buf_len)) {
+ snmp_log(LOG_ERR, "trigger OID: %s\n", oid_name_buf);
+ config_perror("unknown monitor OID");
+ mteObjects_removeEntries( "snmpd.conf", tname );
+ return;
+ }
+ entry->session = sess;
+ entry->flags |= flags;
+ entry->mteTriggerTest |= test;
+ entry->mteTriggerFrequency = repeat;
+ entry->mteTriggerValueID_len = name_buf_len;
+ memcpy(entry->mteTriggerValueID, name_buf, name_buf_len*sizeof(oid));
+
+ /*
+ * ... and the relevant test-specific fields.
+ */
+ switch (test) {
+ case MTE_TRIGGER_EXISTENCE:
+ entry->mteTExTest = op;
+ if (op != MTE_EXIST_CHANGED && startup)
+ entry->mteTExStartup = op;
+ if ( idx > 0 ) {
+ /*
+ * Refer to the objects for this trigger (if any)...
+ */
+ memset(entry->mteTExObjOwner, 0, MTE_STR1_LEN+1);
+ memcpy(entry->mteTExObjOwner, "snmpd.conf", 10);
+ memcpy(entry->mteTExObjects, tname, MTE_STR1_LEN+1);
+ }
+ if ( ename[0] ) {
+ /*
+ * ... and the specified event...
+ */
+ memset(entry->mteTExEvOwner, 0, MTE_STR1_LEN+1);
+ if ( ename[0] == '_' )
+ memcpy(entry->mteTExEvOwner, "_snmpd", 6);
+ else
+ memcpy(entry->mteTExEvOwner, "snmpd.conf", 10);
+ memcpy(entry->mteTExEvent, ename, MTE_STR1_LEN+1);
+ } else {
+ /*
+ * ... or the hardcoded default event.
+ */
+ memset(entry->mteTExEvOwner, 0, MTE_STR1_LEN+1);
+ memset(entry->mteTExEvent, 0, MTE_STR1_LEN+1);
+ memcpy(entry->mteTExEvOwner, "_snmpd", 6);
+ memcpy(entry->mteTExEvent, "_mteTriggerFired", 16);
+ }
+ break;
+ case MTE_TRIGGER_BOOLEAN:
+ entry->mteTBoolComparison = op;
+ entry->mteTBoolValue = value;
+ if (!startup)
+ entry->flags &= ~MTE_TRIGGER_FLAG_BSTART;
+ if ( idx > 0 ) {
+ /*
+ * Refer to the objects for this trigger (if any)...
+ */
+ memset(entry->mteTBoolObjOwner, 0, MTE_STR1_LEN+1);
+ memcpy(entry->mteTBoolObjOwner, "snmpd.conf", 10);
+ memcpy(entry->mteTBoolObjects, tname, MTE_STR1_LEN+1);
+ }
+ if ( ename[0] ) {
+ /*
+ * ... and the specified event...
+ */
+ memset(entry->mteTBoolEvOwner, 0, MTE_STR1_LEN+1);
+ if ( ename[0] == '_' )
+ memcpy(entry->mteTBoolEvOwner, "_snmpd", 6);
+ else
+ memcpy(entry->mteTBoolEvOwner, "snmpd.conf", 10);
+ memcpy(entry->mteTBoolEvent, ename, MTE_STR1_LEN+1);
+ } else {
+ /*
+ * ... or the hardcoded default event.
+ */
+ memset(entry->mteTBoolEvOwner, 0, MTE_STR1_LEN+1);
+ memset(entry->mteTBoolEvent, 0, MTE_STR1_LEN+1);
+ memcpy(entry->mteTBoolEvOwner, "_snmpd", 6);
+ memcpy(entry->mteTBoolEvent, "_mteTriggerFired", 16);
+ }
+ break;
+ case MTE_TRIGGER_THRESHOLD:
+ if ( buf[0] != '-' ) {
+ entry->mteTThFallValue = value;
+ value = strtol(buf, NULL, 0);
+ entry->mteTThRiseValue = value;
+ if (!startup)
+ entry->mteTThStartup = 0;
+ if ( idx > 0 ) {
+ /*
+ * Refer to the objects for this trigger (if any)...
+ */
+ memset(entry->mteTThObjOwner, 0, MTE_STR1_LEN+1);
+ memcpy(entry->mteTThObjOwner, "snmpd.conf", 10);
+ memcpy(entry->mteTThObjects, tname, MTE_STR1_LEN+1);
+ }
+ if ( ename[0] ) {
+ /*
+ * ... and the specified event...
+ * (using the same event for all triggers)
+ */
+ memset(entry->mteTThRiseOwner, 0, MTE_STR1_LEN+1);
+ if ( ename[0] == '_' )
+ memcpy(entry->mteTThRiseOwner, "_snmpd", 6);
+ else
+ memcpy(entry->mteTThRiseOwner, "snmpd.conf", 10);
+ memcpy(entry->mteTThRiseEvent, ename, MTE_STR1_LEN+1);
+ memset(entry->mteTThFallOwner, 0, MTE_STR1_LEN+1);
+ if ( ename[0] == '_' )
+ memcpy(entry->mteTThFallOwner, "_snmpd", 6);
+ else
+ memcpy(entry->mteTThFallOwner, "snmpd.conf", 10);
+ memcpy(entry->mteTThFallEvent, ename, MTE_STR1_LEN+1);
+ } else {
+ /*
+ * ... or the hardcoded default events.
+ */
+ memset(entry->mteTThRiseOwner, 0, MTE_STR1_LEN+1);
+ memset(entry->mteTThFallOwner, 0, MTE_STR1_LEN+1);
+ memset(entry->mteTThRiseEvent, 0, MTE_STR1_LEN+1);
+ memset(entry->mteTThFallEvent, 0, MTE_STR1_LEN+1);
+ memcpy(entry->mteTThRiseOwner, "_snmpd", 6);
+ memcpy(entry->mteTThFallOwner, "_snmpd", 6);
+ memcpy(entry->mteTThRiseEvent, "_mteTriggerRising", 17);
+ memcpy(entry->mteTThFallEvent, "_mteTriggerFalling", 18);
+ }
+ cp = skip_token(buf); /* skip riseThreshold value */
+ } else {
+ /* Skip absolute threshold placeholders */
+ cp = skip_token(buf);
+ }
+ /*
+ * Parse and set (optional) Delta thresholds & events
+ */
+ if ( cp && *cp != '\0' ) {
+ if (entry->flags & MTE_TRIGGER_FLAG_DELTA) {
+ config_perror("Delta-threshold on delta-samples not supported");
+ mteObjects_removeEntries( "snmpd.conf", tname );
+ return;
+ }
+ value = strtol(cp, NULL, 0);
+ entry->mteTThDFallValue = value;
+ cp = skip_token(cp);
+ value = strtol(cp, NULL, 0);
+ entry->mteTThDRiseValue = value;
+ /*
+ * Set the events in the same way as before
+ */
+ if ( ename[0] ) {
+ memset(entry->mteTThDRiseOwner, 0, MTE_STR1_LEN+1);
+ if ( ename[0] == '_' )
+ memcpy(entry->mteTThDRiseOwner, "_snmpd", 6);
+ else
+ memcpy(entry->mteTThDRiseOwner, "snmpd.conf", 10);
+ memcpy(entry->mteTThDRiseEvent, ename, MTE_STR1_LEN+1);
+ memset(entry->mteTThDFallOwner, 0, MTE_STR1_LEN+1);
+ if ( ename[0] == '_' )
+ memcpy(entry->mteTThDFallOwner, "_snmpd", 6);
+ else
+ memcpy(entry->mteTThDFallOwner, "snmpd.conf", 10);
+ memcpy(entry->mteTThDFallEvent, ename, MTE_STR1_LEN+1);
+ } else {
+ memset(entry->mteTThDRiseOwner, 0, MTE_STR1_LEN+1);
+ memset(entry->mteTThDFallOwner, 0, MTE_STR1_LEN+1);
+ memset(entry->mteTThDRiseEvent, 0, MTE_STR1_LEN+1);
+ memset(entry->mteTThDFallEvent, 0, MTE_STR1_LEN+1);
+ memcpy(entry->mteTThDRiseOwner, "_snmpd", 6);
+ memcpy(entry->mteTThDFallOwner, "_snmpd", 6);
+ memcpy(entry->mteTThDRiseEvent, "_mteTriggerRising", 17);
+ memcpy(entry->mteTThDFallEvent, "_mteTriggerFalling", 18);
+ }
+ }
+
+ break;
+ }
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+ SNMP_CALLBACK_POST_READ_CONFIG,
+ _mteTrigger_callback_enable, entry );
+ return;
+}
+
+void
+parse_linkUpDown_traps(const char *token, char *line)
+{
+ /*
+ * XXX - This isn't strictly correct according to the
+ * definitions in IF-MIB, but will do for now.
+ */
+ if (strncmp( line, "yes", 3) == 0) {
+ DEBUGMSGTL(("disman:event:conf", "Registering linkUpDown traps\n"));
+
+ /* ifOperStatus */
+ parse_mteMonitor("monitor",
+ "-r 60 -S -e _linkUp \"linkUp\" .1.3.6.1.2.1.2.2.1.8 != 2");
+ parse_mteMonitor("monitor",
+ "-r 60 -S -e _linkDown \"linkDown\" .1.3.6.1.2.1.2.2.1.8 == 2");
+ }
+}
+
+
+void
+parse_default_mteMonitors(const char *token, char *line)
+{
+ if (strncmp( line, "yes", 3) == 0) {
+ DEBUGMSGTL(("disman:event:conf", "Registering default monitors\n"));
+
+ parse_mteMonitor("monitor",
+ "-o prNames -o prErrMessage \"process table\" prErrorFlag != 0");
+ parse_mteMonitor("monitor",
+ "-o memErrorName -o memSwapErrorMsg \"memory\" memSwapError != 0");
+ parse_mteMonitor("monitor",
+ "-o extNames -o extOutput \"extTable\" extResult != 0");
+ parse_mteMonitor("monitor",
+ "-o dskPath -o dskErrorMsg \"dskTable\" dskErrorFlag != 0");
+ parse_mteMonitor("monitor",
+ "-o laNames -o laErrMessage \"laTable\" laErrorFlag != 0");
+ parse_mteMonitor("monitor",
+ "-o fileName -o fileErrorMsg \"fileTable\" fileErrorFlag != 0");
+ parse_mteMonitor("monitor",
+ "-o snmperrErrMessage \"snmperrs\" snmperrErrorFlag != 0");
+ }
+ return;
+}
+
+/* ================================================
+ *
+ * Handlers for loading persistent trigger entries
+ *
+ * ================================================ */
+
+
+
+/*
+ * Entries for the main mteTriggerTable
+ */
+
+char *
+_parse_mteTCols( char *line, struct mteTrigger *entry, int bcomp )
+{
+ void *vp;
+ size_t tmp;
+ size_t len;
+
+ len = MTE_STR2_LEN; vp = entry->mteTriggerComment;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ if ( bcomp ) {
+ /*
+ * The newer style of config directive skips the
+ * mteTriggerTest and mteTriggerSampleType values,
+ * as these are set implicitly from the relevant
+ * config directives.
+ * Backwards compatability with the previous (combined)
+ * style reads these in explicitly.
+ */
+ len = 1;
+ vp = &entry->mteTriggerTest;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ if (tmp == 2)
+ entry->flags |= MTE_TRIGGER_FLAG_DELTA;
+ }
+ vp = entry->mteTriggerValueID;
+ entry->mteTriggerValueID_len = MAX_OID_LEN;
+ line = read_config_read_data(ASN_OBJECT_ID, line, &vp,
+ &entry->mteTriggerValueID_len);
+ if (bcomp) {
+ /*
+ * The newer style combines the various boolean values
+ * into a single field (which comes later).
+ * Backwards compatability means reading these individually.
+ */
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ if (tmp == TV_TRUE)
+ entry->flags |= MTE_TRIGGER_FLAG_VWILD;
+ }
+ len = MTE_STR2_LEN; vp = entry->mteTriggerTarget;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR2_LEN; vp = entry->mteTriggerContext;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ if (bcomp) {
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ if (tmp == TV_TRUE)
+ entry->flags |= MTE_TRIGGER_FLAG_CWILD;
+ }
+
+ line = read_config_read_data(ASN_UNSIGNED, line,
+ &entry->mteTriggerFrequency, NULL);
+
+ len = MTE_STR1_LEN; vp = entry->mteTriggerOOwner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = entry->mteTriggerObjects;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+
+ /*
+ * Assorted boolean flag values, combined into a single field
+ */
+ if (bcomp) {
+ /*
+ * Backwards compatability stores the mteTriggerEnabled
+ * and mteTriggerEntryStatus values separately...
+ */
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ if (tmp == TV_TRUE)
+ entry->flags |= MTE_TRIGGER_FLAG_ENABLED;
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ if (tmp == RS_ACTIVE)
+ entry->flags |= MTE_TRIGGER_FLAG_ACTIVE;
+ } else {
+ /*
+ * ... while the newer style combines all the assorted
+ * boolean values into this single field.
+ */
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ entry->flags |= ( tmp &
+ (MTE_TRIGGER_FLAG_VWILD |MTE_TRIGGER_FLAG_CWILD|
+ MTE_TRIGGER_FLAG_ENABLED|MTE_TRIGGER_FLAG_ACTIVE));
+ }
+
+ return line;
+}
+
+void
+parse_mteTTable(const char *token, char *line)
+{
+ char owner[MTE_STR1_LEN+1];
+ char tname[MTE_STR1_LEN+1];
+ void *vp;
+ size_t len;
+ struct mteTrigger *entry;
+
+ DEBUGMSGTL(("disman:event:conf", "Parsing mteTriggerTable config...\n"));
+
+ /*
+ * Read in the index information for this entry
+ * and create a (non-fixed) data structure for it.
+ */
+ memset( owner, 0, sizeof(owner));
+ memset( tname, 0, sizeof(tname));
+ len = MTE_STR1_LEN; vp = owner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = tname;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ entry = _find_mteTrigger_entry( owner, tname );
+
+ DEBUGMSG(("disman:event:conf", "(%s, %s) ", owner, tname));
+
+ /*
+ * Read in the accessible (trigger-independent) column values.
+ */
+ line = _parse_mteTCols( line, entry, 0 );
+ /*
+ * XXX - Will need to read in the 'iquery' access information
+ */
+ entry->flags |= MTE_TRIGGER_FLAG_VALID;
+
+ DEBUGMSG(("disman:event:conf", "\n"));
+}
+
+
+/*
+ * Entries from the mteTriggerDeltaTable
+ */
+
+char *
+_parse_mteTDCols( char *line, struct mteTrigger *entry, int bcomp )
+{
+ void *vp;
+ size_t tmp;
+
+ entry->mteDeltaDiscontID_len = MAX_OID_LEN;
+ vp = entry->mteDeltaDiscontID;
+ line = read_config_read_data(ASN_OBJECT_ID, line, &vp,
+ &entry->mteDeltaDiscontID_len);
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ if (bcomp) {
+ if ( tmp == TV_TRUE )
+ entry->flags |= MTE_TRIGGER_FLAG_DWILD;
+ } else {
+ if ( tmp & MTE_TRIGGER_FLAG_DWILD )
+ entry->flags |= MTE_TRIGGER_FLAG_DWILD;
+ }
+ line = read_config_read_data(ASN_UNSIGNED, line,
+ &entry->mteDeltaDiscontIDType, NULL);
+
+ return line;
+}
+
+void
+parse_mteTDTable(const char *token, char *line)
+{
+ char owner[MTE_STR1_LEN+1];
+ char tname[MTE_STR1_LEN+1];
+ void *vp;
+ size_t len;
+ struct mteTrigger *entry;
+
+ DEBUGMSGTL(("disman:event:conf", "Parsing mteTriggerDeltaTable config... "));
+
+ /*
+ * Read in the index information for this entry
+ * and create a (non-fixed) data structure for it.
+ */
+ memset( owner, 0, sizeof(owner));
+ memset( tname, 0, sizeof(tname));
+ len = MTE_STR1_LEN; vp = owner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = tname;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ entry = _find_mteTrigger_entry( owner, tname );
+
+ DEBUGMSG(("disman:event:conf", "(%s, %s) ", owner, tname));
+
+ /*
+ * Read in the accessible column values.
+ */
+ line = _parse_mteTDCols( line, entry, 0 );
+
+ entry->flags |= (MTE_TRIGGER_FLAG_DELTA|
+ MTE_TRIGGER_FLAG_VALID);
+
+ DEBUGMSG(("disman:event:conf", "\n"));
+}
+
+
+/*
+ * Entries from the mteTriggerExistenceTable
+ */
+
+char *
+_parse_mteTExCols( char *line, struct mteTrigger *entry, int bcomp )
+{
+ void *vp;
+ size_t tmp;
+ size_t len;
+
+ if (bcomp) {
+ len = 1;
+ vp = &entry->mteTExTest;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = 1;
+ vp = &entry->mteTExStartup;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ } else {
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ entry->mteTExStartup = ( tmp & 0xff ); tmp >>= 8;
+ entry->mteTExTest = ( tmp & 0xff );
+ }
+
+ len = MTE_STR1_LEN; vp = entry->mteTExObjOwner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = entry->mteTExObjects;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+
+ len = MTE_STR1_LEN; vp = entry->mteTExEvOwner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = entry->mteTExEvent;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+
+ return line;
+}
+
+void
+parse_mteTExTable(const char *token, char *line)
+{
+ char owner[MTE_STR1_LEN+1];
+ char tname[MTE_STR1_LEN+1];
+ void *vp;
+ size_t len;
+ struct mteTrigger *entry;
+
+ DEBUGMSGTL(("disman:event:conf", "Parsing mteTriggerExistenceTable config... "));
+
+ /*
+ * Read in the index information for this entry
+ * and create a (non-fixed) data structure for it.
+ */
+ memset( owner, 0, sizeof(owner));
+ memset( tname, 0, sizeof(tname));
+ len = MTE_STR1_LEN; vp = owner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = tname;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ entry = _find_mteTrigger_entry( owner, tname );
+
+ DEBUGMSG(("disman:event:conf", "(%s, %s) ", owner, tname));
+
+ /*
+ * Read in the accessible column values.
+ * (Note that the first two are combined into a single field)
+ */
+ line = _parse_mteTExCols( line, entry, 0 );
+
+ entry->mteTriggerTest |= MTE_TRIGGER_EXISTENCE;
+ entry->flags |= MTE_TRIGGER_FLAG_VALID;
+
+ DEBUGMSG(("disman:event:conf", "\n"));
+}
+
+
+/*
+ * Entries from the mteTriggerBooleanTable
+ */
+
+char *
+_parse_mteTBlCols( char *line, struct mteTrigger *entry, int bcomp )
+{
+ void *vp;
+ size_t tmp;
+ size_t len;
+
+ if (bcomp) {
+ line = read_config_read_data(ASN_UNSIGNED, line,
+ &entry->mteTBoolComparison, NULL);
+ line = read_config_read_data(ASN_INTEGER, line,
+ &entry->mteTBoolValue, NULL);
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ if (tmp == TV_TRUE)
+ entry->flags |= MTE_TRIGGER_FLAG_BSTART;
+ } else {
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ entry->mteTBoolComparison = ( tmp & 0x0f );
+ entry->flags |= ( tmp & MTE_TRIGGER_FLAG_BSTART );
+ line = read_config_read_data(ASN_INTEGER, line,
+ &entry->mteTBoolValue, NULL);
+ }
+
+
+ len = MTE_STR1_LEN; vp = entry->mteTBoolObjOwner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = entry->mteTBoolObjects;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+
+ len = MTE_STR1_LEN; vp = entry->mteTBoolEvOwner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = entry->mteTBoolEvent;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+
+ return line;
+}
+
+void
+parse_mteTBlTable(const char *token, char *line)
+{
+ char owner[MTE_STR1_LEN+1];
+ char tname[MTE_STR1_LEN+1];
+ void *vp;
+ size_t len;
+ struct mteTrigger *entry;
+
+ DEBUGMSGTL(("disman:event:conf", "Parsing mteTriggerBooleanTable config... "));
+
+ /*
+ * Read in the index information for this entry
+ * and create a (non-fixed) data structure for it.
+ */
+ memset( owner, 0, sizeof(owner));
+ memset( tname, 0, sizeof(tname));
+ len = MTE_STR1_LEN; vp = owner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = tname;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ entry = _find_mteTrigger_entry( owner, tname );
+
+ DEBUGMSG(("disman:event:conf", "(%s, %s) ", owner, tname));
+
+ /*
+ * Read in the accessible column values.
+ * (Note that the first & third are combined into a single field)
+ */
+ line = _parse_mteTBlCols( line, entry, 0 );
+
+ entry->mteTriggerTest |= MTE_TRIGGER_BOOLEAN;
+ entry->flags |= MTE_TRIGGER_FLAG_VALID;
+
+ DEBUGMSG(("disman:event:conf", "\n"));
+}
+
+
+/*
+ * Entries from the mteTriggerThresholdTable
+ */
+
+char *
+_parse_mteTThCols( char *line, struct mteTrigger *entry, int bcomp )
+{
+ void *vp;
+ size_t len;
+
+ line = read_config_read_data(ASN_UNSIGNED, line,
+ &entry->mteTThStartup, NULL);
+ line = read_config_read_data(ASN_INTEGER, line,
+ &entry->mteTThRiseValue, NULL);
+ line = read_config_read_data(ASN_INTEGER, line,
+ &entry->mteTThFallValue, NULL);
+ line = read_config_read_data(ASN_INTEGER, line,
+ &entry->mteTThDRiseValue, NULL);
+ line = read_config_read_data(ASN_INTEGER, line,
+ &entry->mteTThDFallValue, NULL);
+
+ len = MTE_STR1_LEN; vp = entry->mteTThObjOwner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = entry->mteTThObjects;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+
+ len = MTE_STR1_LEN; vp = entry->mteTThRiseOwner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = entry->mteTThRiseEvent;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = entry->mteTThFallOwner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = entry->mteTThFallEvent;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+
+ len = MTE_STR1_LEN; vp = entry->mteTThDRiseOwner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = entry->mteTThDRiseEvent;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = entry->mteTThDFallOwner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = entry->mteTThDFallEvent;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+
+ return line;
+}
+
+void
+parse_mteTThTable(const char *token, char *line)
+{
+ char owner[MTE_STR1_LEN+1];
+ char tname[MTE_STR1_LEN+1];
+ void *vp;
+ size_t len;
+ struct mteTrigger *entry;
+
+ DEBUGMSGTL(("disman:event:conf", "Parsing mteTriggerThresholdTable config... "));
+
+ /*
+ * Read in the index information for this entry
+ * and create a (non-fixed) data structure for it.
+ */
+ memset( owner, 0, sizeof(owner));
+ memset( tname, 0, sizeof(tname));
+ len = MTE_STR1_LEN; vp = owner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = tname;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ entry = _find_mteTrigger_entry( owner, tname );
+
+ DEBUGMSG(("disman:event:conf", "(%s, %s) ", owner, tname));
+
+ /*
+ * Read in the accessible column values.
+ */
+ line = _parse_mteTThCols( line, entry, 0 );
+
+ entry->mteTriggerTest |= MTE_TRIGGER_THRESHOLD;
+ entry->flags |= MTE_TRIGGER_FLAG_VALID;
+
+ DEBUGMSG(("disman:event:conf", "\n"));
+}
+
+
+/*
+ * Backwards Compatability with the previous implementation
+ */
+
+void
+parse_mteTriggerTable(const char *token, char *line)
+{
+ char owner[MTE_STR1_LEN+1];
+ char tname[MTE_STR1_LEN+1];
+ void *vp;
+ size_t len;
+ struct mteTrigger *entry;
+
+ DEBUGMSGTL(("disman:event:conf", "Parsing previous mteTriggerTable config... "));
+
+ /*
+ * Read in the index information for this entry
+ * and create a (non-fixed) data structure for it.
+ */
+ memset( owner, 0, sizeof(owner));
+ memset( tname, 0, sizeof(tname));
+ len = MTE_STR1_LEN; vp = owner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MTE_STR1_LEN; vp = tname;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ entry = _find_mteTrigger_entry( owner, tname );
+
+ DEBUGMSG(("disman:event:conf", "(%s, %s) ", owner, tname));
+
+ /*
+ * Read in the accessible column values for each table in turn...
+ * (similar, though not identical to the newer style).
+ */
+ line = _parse_mteTCols( line, entry, 1 );
+ line = _parse_mteTDCols( line, entry, 1 );
+ line = _parse_mteTExCols( line, entry, 1 );
+ line = _parse_mteTBlCols( line, entry, 1 );
+ line = _parse_mteTThCols( line, entry, 1 );
+
+ /*
+ * ... and then read in the "local internal variables"
+ * XXX - TODO
+ */
+ entry->flags |= MTE_TRIGGER_FLAG_VALID;
+
+ /* XXX - mte_enable_trigger(); ??? */
+ DEBUGMSG(("disman:event:conf", "\n"));
+}
+
+/* ===============================================
+ *
+ * Handler for storing persistent trigger entries
+ *
+ * =============================================== */
+
+int
+store_mteTTable(int majorID, int minorID, void *serverarg, void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr;
+ void *vp;
+ size_t tint;
+ netsnmp_tdata_row *row;
+ struct mteTrigger *entry;
+
+
+ DEBUGMSGTL(("disman:event:conf", "Storing mteTriggerTable config:\n"));
+
+ for (row = netsnmp_tdata_row_first( trigger_table_data );
+ row;
+ row = netsnmp_tdata_row_next( trigger_table_data, row )) {
+
+ /*
+ * Skip entries that were set up via static config directives
+ */
+ entry = (struct mteTrigger *)netsnmp_tdata_row_entry( row );
+ if ( entry->flags & MTE_TRIGGER_FLAG_FIXED )
+ continue;
+
+ DEBUGMSGTL(("disman:event:conf", " Storing (%s %s)\n",
+ entry->mteOwner, entry->mteTName));
+
+ /*
+ * Save the basic mteTriggerTable entry...
+ */
+ memset(line, 0, sizeof(line));
+ strcat(line, "_mteTTable ");
+ cptr = line + strlen(line);
+
+ vp = entry->mteOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTName; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTriggerComment; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ /*
+ * ... (but skip the mteTriggerTest and
+ * assorted boolean flag fields)...
+ */
+ vp = entry->mteTriggerValueID;
+ tint = entry->mteTriggerValueID_len;
+ cptr = read_config_store_data( ASN_OBJECT_ID, cptr, &vp, &tint );
+ vp = entry->mteTriggerTarget; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTriggerContext; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ tint = entry->mteTriggerFrequency;
+ cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL );
+ vp = entry->mteTriggerOOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTriggerObjects; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ tint = entry->flags &
+ (MTE_TRIGGER_FLAG_VWILD |MTE_TRIGGER_FLAG_CWILD|
+ MTE_TRIGGER_FLAG_ENABLED|MTE_TRIGGER_FLAG_ACTIVE);
+ cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL );
+ /* XXX - Need to store the 'iquery' access information */
+ snmpd_store_config(line);
+
+ /*
+ * ... then save the other (relevant) table entries separately,
+ * starting with mteDeltaDiscontinuityTable...
+ */
+ if ( entry->flags & MTE_TRIGGER_FLAG_DELTA ) {
+ memset(line, 0, sizeof(line));
+ strcat(line, "_mteTDTable ");
+ cptr = line + strlen(line);
+
+ vp = entry->mteOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTName; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+
+ vp = entry->mteDeltaDiscontID;
+ tint = entry->mteDeltaDiscontID_len;
+ cptr = read_config_store_data( ASN_OBJECT_ID, cptr, &vp, &tint );
+
+ tint = entry->flags & MTE_TRIGGER_FLAG_DWILD;
+ cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL );
+ tint = entry->mteDeltaDiscontIDType;
+ cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL );
+
+ snmpd_store_config(line);
+ }
+
+ /*
+ * ... and the three type-specific trigger tables.
+ */
+ if ( entry->mteTriggerTest & MTE_TRIGGER_EXISTENCE ) {
+ memset(line, 0, sizeof(line));
+ strcat(line, "_mteTExTable ");
+ cptr = line + strlen(line);
+
+ vp = entry->mteOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTName; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+
+ tint = (entry->mteTExTest & 0xff) << 8;
+ tint|= (entry->mteTExStartup & 0xff);
+ cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL );
+
+ vp = entry->mteTExObjOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTExObjects; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+
+ vp = entry->mteTExEvOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTExEvent; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+
+ snmpd_store_config(line);
+ }
+ if ( entry->mteTriggerTest & MTE_TRIGGER_BOOLEAN ) {
+ memset(line, 0, sizeof(line));
+ strcat(line, "_mteTBlTable ");
+ cptr = line + strlen(line);
+
+ vp = entry->mteOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTName; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+
+ tint = entry->mteTBoolComparison;
+ tint |= (entry->flags & MTE_TRIGGER_FLAG_BSTART);
+ cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL );
+ tint = entry->mteTBoolValue;
+ cptr = read_config_store_data( ASN_INTEGER, cptr, &tint, NULL );
+
+ vp = entry->mteTBoolObjOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTBoolObjects; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+
+ vp = entry->mteTBoolEvOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTBoolEvent; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+
+ snmpd_store_config(line);
+ }
+ if ( entry->mteTriggerTest & MTE_TRIGGER_THRESHOLD ) {
+ memset(line, 0, sizeof(line));
+ strcat(line, "_mteTThTable ");
+ cptr = line + strlen(line);
+
+ vp = entry->mteOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTName; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+
+ cptr = read_config_store_data(ASN_UNSIGNED, cptr,
+ &entry->mteTThStartup, NULL );
+ cptr = read_config_store_data(ASN_INTEGER, cptr,
+ &entry->mteTThRiseValue, NULL );
+ cptr = read_config_store_data(ASN_INTEGER, cptr,
+ &entry->mteTThFallValue, NULL );
+ cptr = read_config_store_data(ASN_INTEGER, cptr,
+ &entry->mteTThDRiseValue, NULL );
+ cptr = read_config_store_data(ASN_INTEGER, cptr,
+ &entry->mteTThDFallValue, NULL );
+
+ vp = entry->mteTThObjOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTThObjects; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+
+ vp = entry->mteTThRiseOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTThRiseEvent; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTThFallOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTThFallEvent; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+
+ vp = entry->mteTThDRiseOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTThDRiseEvent; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTThDFallOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->mteTThDFallEvent; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+
+ snmpd_store_config(line);
+ }
+ }
+
+ DEBUGMSGTL(("disman:event:conf", " done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+int
+clear_mteTTable(int majorID, int minorID, void *serverarg, void *clientarg)
+{
+ netsnmp_tdata_row *row;
+
+ while (( row = netsnmp_tdata_row_first( trigger_table_data ))) {
+ netsnmp_tdata_remove_and_delete_row( trigger_table_data, row );
+ }
+ return SNMPERR_SUCCESS;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerConf.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerConf.h
new file mode 100644
index 0000000000..560c3ea4c0
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerConf.h
@@ -0,0 +1,23 @@
+#ifndef MTETRIGGERCONF_H
+#define MTETRIGGERCONF_H
+
+config_require(utilities/iquery)
+
+/*
+ * function declarations
+ */
+void init_mteTriggerConf(void);
+void parse_mteMonitor( const char *, char *);
+void parse_default_mteMonitors( const char *, char *);
+void parse_linkUpDown_traps(const char *, char *);
+
+void parse_mteTTable( const char *, char *);
+void parse_mteTDTable( const char *, char *);
+void parse_mteTExTable(const char *, char *);
+void parse_mteTBlTable(const char *, char *);
+void parse_mteTThTable(const char *, char *);
+void parse_mteTriggerTable(const char *, char *);
+SNMPCallback store_mteTTable;
+SNMPCallback clear_mteTTable;
+
+#endif /* MTETRIGGERCONF_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerDeltaTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerDeltaTable.c
new file mode 100644
index 0000000000..cd21f6db2c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerDeltaTable.c
@@ -0,0 +1,239 @@
+/*
+ * DisMan Event MIB:
+ * Implementation of the mteTriggerDeltaTable MIB interface
+ * See 'mteTrigger.c' for active behaviour of this table.
+ *
+ * (based on mib2c.table_data.conf output)
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "disman/event/mteTrigger.h"
+#include "disman/event/mteTriggerDeltaTable.h"
+
+
+/** Initializes the mteTriggerDeltaTable module */
+void
+init_mteTriggerDeltaTable(void)
+{
+ static oid mteTDeltaTable_oid[] = { 1, 3, 6, 1, 2, 1, 88, 1, 2, 3 };
+ size_t mteTDeltaTable_oid_len = OID_LENGTH(mteTDeltaTable_oid);
+ netsnmp_handler_registration *reg;
+ netsnmp_table_registration_info *table_info;
+
+ /*
+ * Ensure the (combined) table container is available...
+ */
+ init_trigger_table_data();
+
+ /*
+ * ... then set up the MIB interface to the mteTriggerDeltaTable slice
+ */
+ reg = netsnmp_create_handler_registration("mteTriggerDeltaTable",
+ mteTriggerDeltaTable_handler,
+ mteTDeltaTable_oid,
+ mteTDeltaTable_oid_len,
+ HANDLER_CAN_RWRITE);
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_OCTET_STR, /* index: mteOwner */
+ /* index: mteTriggerName */
+ ASN_PRIV_IMPLIED_OCTET_STR,
+ 0);
+
+ table_info->min_column = COLUMN_MTETRIGGERDELTADISCONTINUITYID;
+ table_info->max_column = COLUMN_MTETRIGGERDELTADISCONTINUITYIDTYPE;
+
+ /* Register this using the (common) trigger_table_data container */
+ netsnmp_tdata_register(reg, trigger_table_data, table_info);
+ DEBUGMSGTL(("disman:event:init", "Trigger Delta Table\n"));
+}
+
+
+/** handles requests for the mteTriggerDeltaTable table */
+int
+mteTriggerDeltaTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *tinfo;
+ struct mteTrigger *entry;
+ int ret;
+
+ DEBUGMSGTL(("disman:event:mib", "Delta Table handler (%d)\n",
+ reqinfo->mode));
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ /*
+ * The mteTriggerBooleanTable should only contains entries for
+ * rows where the mteTriggerSampleType is 'deltaValue(2)'
+ * So skip entries where this isn't the case.
+ */
+ if (!entry || !(entry->flags & MTE_TRIGGER_FLAG_DELTA ))
+ continue;
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGERDELTADISCONTINUITYID:
+ snmp_set_var_typed_value(request->requestvb, ASN_OBJECT_ID,
+ (u_char *) entry->mteDeltaDiscontID,
+ entry->mteDeltaDiscontID_len*sizeof(oid));
+ break;
+ case COLUMN_MTETRIGGERDELTADISCONTINUITYIDWILDCARD:
+ ret = (entry->flags & MTE_TRIGGER_FLAG_DWILD ) ?
+ TV_TRUE : TV_FALSE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ case COLUMN_MTETRIGGERDELTADISCONTINUITYIDTYPE:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->mteDeltaDiscontIDType);
+ break;
+ }
+ }
+ break;
+
+ /*
+ * Write-support
+ */
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ /*
+ * Since the mteTriggerDeltaTable only contains entries for
+ * rows where mteTriggerSampleType is 'deltaValue(2)',
+ * strictly speaking we should reject assignments where
+ * this isn't the case.
+ * But SET requests that include an assignment of
+ * 'deltaValue(2)' at the same time are valid, so would
+ * need to be accepted. Unfortunately, this assignment
+ * is only applied in the COMMIT pass, so it's difficult
+ * to detect whether this holds or not.
+ *
+ * Let's fudge things for now, by processing
+ * assignments even if this value isn't set.
+ */
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGERDELTADISCONTINUITYID:
+ ret = netsnmp_check_vb_oid(request->requestvb);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTETRIGGERDELTADISCONTINUITYIDWILDCARD:
+ ret = netsnmp_check_vb_truthvalue(request->requestvb);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTETRIGGERDELTADISCONTINUITYIDTYPE:
+ ret = netsnmp_check_vb_int_range(request->requestvb,
+ MTE_DELTAD_TTICKS,
+ MTE_DELTAD_DATETIME);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * The Event MIB is somewhat ambiguous as to whether the
+ * various trigger table entries can be modified once the
+ * main mteTriggerTable entry has been marked 'active'.
+ * But it's clear from discussion on the DisMan mailing
+ * list is that the intention is not.
+ *
+ * So check for whether this row is already active,
+ * and reject *all* SET requests if it is.
+ */
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ if (entry &&
+ entry->flags & MTE_TRIGGER_FLAG_ACTIVE ) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ case MODE_SET_FREE:
+ case MODE_SET_UNDO:
+ break;
+
+ case MODE_SET_ACTION:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ if (!entry) {
+ /*
+ * New rows must be created via the RowStatus column
+ * (in the main mteTriggerTable)
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOCREATION);
+ /* or inconsistentName? */
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ /*
+ * All these assignments are "unfailable", so it's
+ * (reasonably) safe to apply them in the Commit phase
+ */
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGERDELTADISCONTINUITYID:
+ if ( snmp_oid_compare(
+ request->requestvb->val.objid,
+ request->requestvb->val_len/sizeof(oid),
+ _sysUpTime_instance, _sysUpTime_inst_len) != 0 ) {
+ memset(entry->mteDeltaDiscontID, 0,
+ sizeof(entry->mteDeltaDiscontID));
+ memcpy(entry->mteDeltaDiscontID,
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ entry->mteDeltaDiscontID_len =
+ request->requestvb->val_len/sizeof(oid);
+ entry->flags &= ~MTE_TRIGGER_FLAG_SYSUPT;
+ }
+ break;
+ case COLUMN_MTETRIGGERDELTADISCONTINUITYIDWILDCARD:
+ if (*request->requestvb->val.integer == TV_TRUE)
+ entry->flags |= MTE_TRIGGER_FLAG_DWILD;
+ else
+ entry->flags &= ~MTE_TRIGGER_FLAG_DWILD;
+ break;
+ case COLUMN_MTETRIGGERDELTADISCONTINUITYIDTYPE:
+ entry->mteDeltaDiscontIDType = *request->requestvb->val.integer;
+ break;
+ }
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerDeltaTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerDeltaTable.h
new file mode 100644
index 0000000000..51f0bdb5f4
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerDeltaTable.h
@@ -0,0 +1,20 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.table_data.conf,v 1.8 2005/07/19 14:52:03 dts12 Exp $
+ */
+#ifndef MTETRIGGERDELTATABLE_H
+#define MTETRIGGERDELTATABLE_H
+
+/*
+ * function declarations
+ */
+void init_mteTriggerDeltaTable(void);
+Netsnmp_Node_Handler mteTriggerDeltaTable_handler;
+
+/*
+ * column number definitions for table mteTriggerDeltaTable
+ */
+#define COLUMN_MTETRIGGERDELTADISCONTINUITYID 1
+#define COLUMN_MTETRIGGERDELTADISCONTINUITYIDWILDCARD 2
+#define COLUMN_MTETRIGGERDELTADISCONTINUITYIDTYPE 3
+#endif /* MTETRIGGERDELTATABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerExistenceTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerExistenceTable.c
new file mode 100644
index 0000000000..6974f41844
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerExistenceTable.c
@@ -0,0 +1,255 @@
+/*
+ * DisMan Event MIB:
+ * Implementation of the mteTriggerExistenceTable MIB interface
+ * See 'mteTrigger.c' for active behaviour of this table.
+ *
+ * (based on mib2c.table_data.conf output)
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "disman/event/mteTrigger.h"
+#include "disman/event/mteTriggerExistenceTable.h"
+
+
+/* Initializes the mteTriggerExistenceTable module */
+void
+init_mteTriggerExistenceTable(void)
+{
+ static oid mteTExistTable_oid[] = { 1, 3, 6, 1, 2, 1, 88, 1, 2, 4 };
+ size_t mteTExistTable_oid_len = OID_LENGTH(mteTExistTable_oid);
+ netsnmp_handler_registration *reg;
+ netsnmp_table_registration_info *table_info;
+
+ /*
+ * Ensure the (combined) table container is available...
+ */
+ init_trigger_table_data();
+
+ /*
+ * ... then set up the MIB interface to the mteTriggerExistenceTable slice
+ */
+ reg = netsnmp_create_handler_registration("mteTriggerExistenceTable",
+ mteTriggerExistenceTable_handler,
+ mteTExistTable_oid,
+ mteTExistTable_oid_len,
+ HANDLER_CAN_RWRITE);
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_OCTET_STR, /* index: mteOwner */
+ /* index: mteTriggerName */
+ ASN_PRIV_IMPLIED_OCTET_STR,
+ 0);
+
+ table_info->min_column = COLUMN_MTETRIGGEREXISTENCETEST;
+ table_info->max_column = COLUMN_MTETRIGGEREXISTENCEEVENT;
+
+ /* Register this using the (common) trigger_table_data container */
+ netsnmp_tdata_register(reg, trigger_table_data, table_info);
+ DEBUGMSGTL(("disman:event:init", "Trigger Exist Table\n"));
+}
+
+
+/** handles requests for the mteTriggerExistenceTable table */
+int
+mteTriggerExistenceTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *tinfo;
+ struct mteTrigger *entry;
+ int ret;
+
+ DEBUGMSGTL(("disman:event:mib", "Exist Table handler (%d)\n",
+ reqinfo->mode));
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ /*
+ * The mteTriggerExistenceTable should only contains entries for
+ * rows where the mteTriggerTest 'existence(0)' bit is set.
+ * So skip entries where this isn't the case.
+ */
+ if (!entry || !(entry->mteTriggerTest & MTE_TRIGGER_EXISTENCE ))
+ continue;
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGEREXISTENCETEST:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *)&entry->mteTExTest, 1);
+ break;
+ case COLUMN_MTETRIGGEREXISTENCESTARTUP:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *)&entry->mteTExStartup, 1);
+ break;
+ case COLUMN_MTETRIGGEREXISTENCEOBJECTSOWNER:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTExObjOwner,
+ strlen(entry->mteTExObjOwner));
+ break;
+ case COLUMN_MTETRIGGEREXISTENCEOBJECTS:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTExObjects,
+ strlen(entry->mteTExObjects));
+ break;
+ case COLUMN_MTETRIGGEREXISTENCEEVENTOWNER:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTExEvOwner,
+ strlen(entry->mteTExEvOwner));
+ break;
+ case COLUMN_MTETRIGGEREXISTENCEEVENT:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTExEvent,
+ strlen(entry->mteTExEvent));
+ break;
+ }
+ }
+ break;
+
+ /*
+ * Write-support
+ */
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ /*
+ * Since the mteTriggerExistenceTable only contains entries for
+ * rows where the mteTriggerTest 'existence(0)' bit is set,
+ * strictly speaking we should reject assignments where
+ * this isn't the case.
+ * But SET requests that include an assignment of the
+ * 'existence(0)' bit at the same time are valid, so would
+ * need to be accepted. Unfortunately, this assignment
+ * is only applied in the COMMIT pass, so it's difficult
+ * to detect whether this holds or not.
+ *
+ * Let's fudge things for now, by processing assignments
+ * even if the 'existence(0)' bit isn't set.
+ */
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGEREXISTENCETEST:
+ case COLUMN_MTETRIGGEREXISTENCESTARTUP:
+ ret = netsnmp_check_vb_type_and_size(
+ request->requestvb, ASN_OCTET_STR, 1);
+ if (ret != SNMP_ERR_NOERROR ) {
+ netsnmp_set_request_error(reqinfo, request, ret );
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+
+ case COLUMN_MTETRIGGEREXISTENCEOBJECTSOWNER:
+ case COLUMN_MTETRIGGEREXISTENCEOBJECTS:
+ case COLUMN_MTETRIGGEREXISTENCEEVENTOWNER:
+ case COLUMN_MTETRIGGEREXISTENCEEVENT:
+ ret = netsnmp_check_vb_type_and_max_size(
+ request->requestvb, ASN_OCTET_STR, MTE_STR1_LEN);
+ if (ret != SNMP_ERR_NOERROR ) {
+ netsnmp_set_request_error(reqinfo, request, ret );
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * The Event MIB is somewhat ambiguous as to whether the
+ * various trigger table entries can be modified once the
+ * main mteTriggerTable entry has been marked 'active'.
+ * But it's clear from discussion on the DisMan mailing
+ * list is that the intention is not.
+ *
+ * So check for whether this row is already active,
+ * and reject *all* SET requests if it is.
+ */
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ if (entry &&
+ entry->flags & MTE_TRIGGER_FLAG_ACTIVE ) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ case MODE_SET_FREE:
+ case MODE_SET_UNDO:
+ break;
+
+ case MODE_SET_ACTION:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ if (!entry) {
+ /*
+ * New rows must be created via the RowStatus column
+ * (in the main mteTriggerTable)
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOCREATION);
+ /* or inconsistentName? */
+ return SNMP_ERR_NOERROR;
+
+ }
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ /*
+ * All these assignments are "unfailable", so it's
+ * (reasonably) safe to apply them in the Commit phase
+ */
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGEREXISTENCETEST:
+ entry->mteTExTest = request->requestvb->val.string[0];
+ break;
+ case COLUMN_MTETRIGGEREXISTENCESTARTUP:
+ entry->mteTExStartup = request->requestvb->val.string[0];
+ break;
+ case COLUMN_MTETRIGGEREXISTENCEOBJECTSOWNER:
+ memset(entry->mteTExObjOwner, 0, sizeof(entry->mteTExObjOwner));
+ memcpy(entry->mteTExObjOwner, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGEREXISTENCEOBJECTS:
+ memset(entry->mteTExObjects, 0, sizeof(entry->mteTExObjects));
+ memcpy(entry->mteTExObjects, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGEREXISTENCEEVENTOWNER:
+ memset(entry->mteTExEvOwner, 0, sizeof(entry->mteTExEvOwner));
+ memcpy(entry->mteTExEvOwner, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGEREXISTENCEEVENT:
+ memset(entry->mteTExEvent, 0, sizeof(entry->mteTExEvent));
+ memcpy(entry->mteTExEvent, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ }
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerExistenceTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerExistenceTable.h
new file mode 100644
index 0000000000..c84566052c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerExistenceTable.h
@@ -0,0 +1,23 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.table_data.conf,v 1.8 2005/07/19 14:52:03 dts12 Exp $
+ */
+#ifndef MTETRIGGEREXISTENCETABLE_H
+#define MTETRIGGEREXISTENCETABLE_H
+
+/*
+ * function declarations
+ */
+void init_mteTriggerExistenceTable(void);
+Netsnmp_Node_Handler mteTriggerExistenceTable_handler;
+
+/*
+ * column number definitions for table mteTriggerExistenceTable
+ */
+#define COLUMN_MTETRIGGEREXISTENCETEST 1
+#define COLUMN_MTETRIGGEREXISTENCESTARTUP 2
+#define COLUMN_MTETRIGGEREXISTENCEOBJECTSOWNER 3
+#define COLUMN_MTETRIGGEREXISTENCEOBJECTS 4
+#define COLUMN_MTETRIGGEREXISTENCEEVENTOWNER 5
+#define COLUMN_MTETRIGGEREXISTENCEEVENT 6
+#endif /* MTETRIGGEREXISTENCETABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerTable.c
new file mode 100644
index 0000000000..6d43d2730b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerTable.c
@@ -0,0 +1,451 @@
+/*
+ * DisMan Event MIB:
+ * Implementation of the mteTriggerTable MIB interface
+ * See 'mteTrigger.c' for active behaviour of this table.
+ *
+ * (based on mib2c.table_data.conf output)
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "utilities/iquery.h"
+#include "disman/event/mteTrigger.h"
+#include "disman/event/mteTriggerTable.h"
+
+
+/** Initializes the mteTriggerTable module */
+void
+init_mteTriggerTable(void)
+{
+ static oid mteTriggerTable_oid[] = { 1, 3, 6, 1, 2, 1, 88, 1, 2, 2 };
+ size_t mteTriggerTable_oid_len = OID_LENGTH(mteTriggerTable_oid);
+ netsnmp_handler_registration *reg;
+ netsnmp_table_registration_info *table_info;
+
+ /*
+ * Ensure the (combined) table container is available...
+ */
+ init_trigger_table_data();
+
+ /*
+ * ... then set up the MIB interface to the mteTriggerTable slice
+ */
+ reg = netsnmp_create_handler_registration("mteTriggerTable",
+ mteTriggerTable_handler,
+ mteTriggerTable_oid,
+ mteTriggerTable_oid_len,
+ HANDLER_CAN_RWRITE);
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_OCTET_STR, /* index: mteOwner */
+ /* index: mteTriggerName */
+ ASN_PRIV_IMPLIED_OCTET_STR,
+ 0);
+
+ table_info->min_column = COLUMN_MTETRIGGERCOMMENT;
+ table_info->max_column = COLUMN_MTETRIGGERENTRYSTATUS;
+
+ /* Register this using the (common) trigger_table_data container */
+ netsnmp_tdata_register(reg, trigger_table_data, table_info);
+ DEBUGMSGTL(("disman:event:init", "Trigger Table\n"));
+}
+
+
+/** handles requests for the mteTriggerTable table */
+int
+mteTriggerTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *tinfo;
+ netsnmp_tdata_row *row;
+ struct mteTrigger *entry;
+ char mteOwner[MTE_STR1_LEN+1];
+ char mteTName[MTE_STR1_LEN+1];
+ long ret;
+
+ DEBUGMSGTL(("disman:event:mib", "Trigger Table handler (%d)\n",
+ reqinfo->mode));
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGERCOMMENT:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ entry->mteTriggerComment,
+ strlen(entry->mteTriggerComment));
+ break;
+ case COLUMN_MTETRIGGERTEST:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ &entry->mteTriggerTest, 1);
+ break;
+ case COLUMN_MTETRIGGERSAMPLETYPE:
+ ret = (entry->flags & MTE_TRIGGER_FLAG_DELTA ) ?
+ MTE_SAMPLE_DELTA : MTE_SAMPLE_ABSOLUTE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ case COLUMN_MTETRIGGERVALUEID:
+ snmp_set_var_typed_value(request->requestvb, ASN_OBJECT_ID,
+ (u_char *) entry->mteTriggerValueID,
+ entry->mteTriggerValueID_len*sizeof(oid));
+ break;
+ case COLUMN_MTETRIGGERVALUEIDWILDCARD:
+ ret = (entry->flags & MTE_TRIGGER_FLAG_VWILD ) ?
+ TV_TRUE : TV_FALSE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ case COLUMN_MTETRIGGERTARGETTAG:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ entry->mteTriggerTarget,
+ strlen(entry->mteTriggerTarget));
+ break;
+ case COLUMN_MTETRIGGERCONTEXTNAME:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ entry->mteTriggerContext,
+ strlen(entry->mteTriggerContext));
+ break;
+ case COLUMN_MTETRIGGERCONTEXTNAMEWILDCARD:
+ ret = (entry->flags & MTE_TRIGGER_FLAG_CWILD ) ?
+ TV_TRUE : TV_FALSE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ case COLUMN_MTETRIGGERFREQUENCY:
+ snmp_set_var_typed_integer(request->requestvb, ASN_UNSIGNED,
+ entry->mteTriggerFrequency);
+ break;
+ case COLUMN_MTETRIGGEROBJECTSOWNER:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ entry->mteTriggerOOwner,
+ strlen(entry->mteTriggerOOwner));
+ break;
+ case COLUMN_MTETRIGGEROBJECTS:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ entry->mteTriggerObjects,
+ strlen(entry->mteTriggerObjects));
+ break;
+ case COLUMN_MTETRIGGERENABLED:
+ ret = (entry->flags & MTE_TRIGGER_FLAG_ENABLED ) ?
+ TV_TRUE : TV_FALSE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ case COLUMN_MTETRIGGERENTRYSTATUS:
+ ret = (entry->flags & MTE_TRIGGER_FLAG_ACTIVE ) ?
+ RS_ACTIVE : RS_NOTINSERVICE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ }
+ }
+ break;
+
+ /*
+ * Write-support
+ */
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGERCOMMENT:
+ case COLUMN_MTETRIGGERTARGETTAG:
+ case COLUMN_MTETRIGGERCONTEXTNAME:
+ ret = netsnmp_check_vb_type_and_max_size(
+ request->requestvb, ASN_OCTET_STR, MTE_STR2_LEN);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTETRIGGERTEST:
+ ret = netsnmp_check_vb_type_and_size(
+ request->requestvb, ASN_OCTET_STR, 1);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTETRIGGERSAMPLETYPE:
+ ret = netsnmp_check_vb_int_range(request->requestvb,
+ MTE_SAMPLE_ABSOLUTE, MTE_SAMPLE_DELTA);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTETRIGGERVALUEID:
+ ret = netsnmp_check_vb_oid(request->requestvb);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTETRIGGERVALUEIDWILDCARD:
+ case COLUMN_MTETRIGGERCONTEXTNAMEWILDCARD:
+ case COLUMN_MTETRIGGERENABLED:
+ ret = netsnmp_check_vb_truthvalue(request->requestvb);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+
+ case COLUMN_MTETRIGGERFREQUENCY:
+ ret = netsnmp_check_vb_uint(request->requestvb);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTETRIGGEROBJECTSOWNER:
+ case COLUMN_MTETRIGGEROBJECTS:
+ ret = netsnmp_check_vb_type_and_max_size(
+ request->requestvb, ASN_OCTET_STR, MTE_STR1_LEN);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTETRIGGERENTRYSTATUS:
+ ret = netsnmp_check_vb_rowstatus(request->requestvb,
+ (entry ? RS_ACTIVE : RS_NONEXISTENT));
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOERROR;
+ }
+
+
+ /*
+ * Once a row has been made active, it cannot be
+ * modified except to delete it. There's no good
+ * reason for this, but that's what the MIB says.
+ *
+ * The published version of the Event MIB even forbids
+ * enabling (or disabling) an active row, which
+ * would make this object completely pointless!
+ * Fortunately this ludicrous decision has since been corrected.
+ */
+ if (entry &&
+ entry->flags & MTE_TRIGGER_FLAG_ACTIVE ) {
+ /* check for the acceptable assignments */
+ if ((tinfo->colnum == COLUMN_MTETRIGGERENABLED) ||
+ (tinfo->colnum == COLUMN_MTETRIGGERENTRYSTATUS &&
+ *request->requestvb->val.integer != RS_NOTINSERVICE))
+ continue;
+
+ /* Otherwise, reject this request */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGERENTRYSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ /*
+ * Create an (empty) new row structure
+ */
+ memset(mteOwner, 0, sizeof(mteOwner));
+ memcpy(mteOwner, tinfo->indexes->val.string,
+ tinfo->indexes->val_len);
+ memset(mteTName, 0, sizeof(mteTName));
+ memcpy(mteTName,
+ tinfo->indexes->next_variable->val.string,
+ tinfo->indexes->next_variable->val_len);
+
+ row = mteTrigger_createEntry(mteOwner, mteTName, 0);
+ if (!row) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ return SNMP_ERR_NOERROR;
+ }
+ netsnmp_insert_tdata_row( request, row );
+ }
+ }
+ }
+ break;
+
+ case MODE_SET_FREE:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGERENTRYSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ /*
+ * Tidy up after a failed row creation request
+ */
+ entry = (struct mteTrigger *)
+ netsnmp_tdata_extract_entry(request);
+ if (entry &&
+ !(entry->flags & MTE_TRIGGER_FLAG_VALID)) {
+ row = (netsnmp_tdata_row *)
+ netsnmp_tdata_extract_row(request);
+ mteTrigger_removeEntry( row );
+ }
+ }
+ }
+ }
+ break;
+
+ case MODE_SET_ACTION:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ if (!entry) {
+ /*
+ * New rows must be created via the RowStatus column
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOCREATION);
+ /* or inconsistentName? */
+ return SNMP_ERR_NOERROR;
+
+ }
+ }
+ break;
+
+ case MODE_SET_UNDO:
+ break;
+
+ case MODE_SET_COMMIT:
+ /*
+ * All these assignments are "unfailable", so it's
+ * (reasonably) safe to apply them in the Commit phase
+ */
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGERCOMMENT:
+ memset(entry->mteTriggerComment, 0,
+ sizeof(entry->mteTriggerComment));
+ memcpy(entry->mteTriggerComment,
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGERTEST:
+ entry->mteTriggerTest = request->requestvb->val.string[0];
+ break;
+ case COLUMN_MTETRIGGERSAMPLETYPE:
+ if (*request->requestvb->val.integer == MTE_SAMPLE_DELTA)
+ entry->flags |= MTE_TRIGGER_FLAG_DELTA;
+ else
+ entry->flags &= ~MTE_TRIGGER_FLAG_DELTA;
+ break;
+ case COLUMN_MTETRIGGERVALUEID:
+ memset(entry->mteTriggerValueID, 0,
+ sizeof(entry->mteTriggerValueID));
+ memcpy(entry->mteTriggerValueID,
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ entry->mteTriggerValueID_len = request->requestvb->val_len/sizeof(oid);
+ break;
+ case COLUMN_MTETRIGGERVALUEIDWILDCARD:
+ if (*request->requestvb->val.integer == TV_TRUE)
+ entry->flags |= MTE_TRIGGER_FLAG_VWILD;
+ else
+ entry->flags &= ~MTE_TRIGGER_FLAG_VWILD;
+ break;
+ case COLUMN_MTETRIGGERTARGETTAG:
+ memset(entry->mteTriggerTarget, 0,
+ sizeof(entry->mteTriggerTarget));
+ memcpy(entry->mteTriggerTarget,
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGERCONTEXTNAME:
+ memset(entry->mteTriggerContext, 0,
+ sizeof(entry->mteTriggerContext));
+ memcpy(entry->mteTriggerContext,
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGERCONTEXTNAMEWILDCARD:
+ if (*request->requestvb->val.integer == TV_TRUE)
+ entry->flags |= MTE_TRIGGER_FLAG_CWILD;
+ else
+ entry->flags &= ~MTE_TRIGGER_FLAG_CWILD;
+ break;
+ case COLUMN_MTETRIGGERFREQUENCY:
+ entry->mteTriggerFrequency = *request->requestvb->val.integer;
+ break;
+ case COLUMN_MTETRIGGEROBJECTSOWNER:
+ memset(entry->mteTriggerOOwner, 0,
+ sizeof(entry->mteTriggerOOwner));
+ memcpy(entry->mteTriggerOOwner,
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGEROBJECTS:
+ memset(entry->mteTriggerObjects, 0,
+ sizeof(entry->mteTriggerObjects));
+ memcpy(entry->mteTriggerObjects,
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGERENABLED:
+ if (*request->requestvb->val.integer == TV_TRUE)
+ entry->flags |= MTE_TRIGGER_FLAG_ENABLED;
+ else
+ entry->flags &= ~MTE_TRIGGER_FLAG_ENABLED;
+ break;
+ case COLUMN_MTETRIGGERENTRYSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_ACTIVE:
+ entry->flags |= MTE_TRIGGER_FLAG_ACTIVE;
+ mteTrigger_enable( entry );
+ break;
+ case RS_CREATEANDGO:
+ entry->flags |= MTE_TRIGGER_FLAG_ACTIVE;
+ entry->flags |= MTE_TRIGGER_FLAG_VALID;
+ entry->session =
+ netsnmp_iquery_pdu_session(reqinfo->asp->pdu);
+ mteTrigger_enable( entry );
+ break;
+ case RS_CREATEANDWAIT:
+ entry->flags |= MTE_TRIGGER_FLAG_VALID;
+ entry->session =
+ netsnmp_iquery_pdu_session(reqinfo->asp->pdu);
+ break;
+
+ case RS_DESTROY:
+ row = (netsnmp_tdata_row *)
+ netsnmp_tdata_extract_row(request);
+ mteTrigger_removeEntry(row);
+ }
+ break;
+ }
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerTable.h
new file mode 100644
index 0000000000..e3826125f8
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerTable.h
@@ -0,0 +1,34 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.table_data.conf,v 1.8 2005/07/19 14:52:03 dts12 Exp $
+ */
+#ifndef MTETRIGGERTABLE_H
+#define MTETRIGGERTABLE_H
+
+config_require(utilities/iquery)
+
+/*
+ * function declarations
+ */
+void init_mteTriggerTable(void);
+Netsnmp_Node_Handler mteTriggerTable_handler;
+
+/*
+ * column number definitions for table mteTriggerTable
+ */
+#define COLUMN_MTEOWNER 1
+#define COLUMN_MTETRIGGERNAME 2
+#define COLUMN_MTETRIGGERCOMMENT 3
+#define COLUMN_MTETRIGGERTEST 4
+#define COLUMN_MTETRIGGERSAMPLETYPE 5
+#define COLUMN_MTETRIGGERVALUEID 6
+#define COLUMN_MTETRIGGERVALUEIDWILDCARD 7
+#define COLUMN_MTETRIGGERTARGETTAG 8
+#define COLUMN_MTETRIGGERCONTEXTNAME 9
+#define COLUMN_MTETRIGGERCONTEXTNAMEWILDCARD 10
+#define COLUMN_MTETRIGGERFREQUENCY 11
+#define COLUMN_MTETRIGGEROBJECTSOWNER 12
+#define COLUMN_MTETRIGGEROBJECTS 13
+#define COLUMN_MTETRIGGERENABLED 14
+#define COLUMN_MTETRIGGERENTRYSTATUS 15
+#endif /* MTETRIGGERTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerThresholdTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerThresholdTable.c
new file mode 100644
index 0000000000..16b37e590e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerThresholdTable.c
@@ -0,0 +1,349 @@
+/*
+ * DisMan Event MIB:
+ * Implementation of the mteTriggerThresholdTable MIB interface
+ * See 'mteTrigger.c' for active behaviour of this table.
+ *
+ * (based on mib2c.table_data.conf output)
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "disman/event/mteTrigger.h"
+#include "disman/event/mteTriggerThresholdTable.h"
+
+
+/** Initializes the mteTriggerThresholdTable module */
+void
+init_mteTriggerThresholdTable(void)
+{
+ static oid mteTThreshTable_oid[] = { 1, 3, 6, 1, 2, 1, 88, 1, 2, 6 };
+ size_t mteTThreshTable_oid_len = OID_LENGTH(mteTThreshTable_oid);
+ netsnmp_handler_registration *reg;
+ netsnmp_table_registration_info *table_info;
+
+ /*
+ * Ensure the (combined) table container is available...
+ */
+ init_trigger_table_data();
+
+ /*
+ * ... then set up the MIB interface to the mteTriggerThresholdTable slice
+ */
+ reg = netsnmp_create_handler_registration("mteTriggerThresholdTable",
+ mteTriggerThresholdTable_handler,
+ mteTThreshTable_oid,
+ mteTThreshTable_oid_len,
+ HANDLER_CAN_RWRITE);
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_OCTET_STR, /* index: mteOwner */
+ /* index: mteTriggerName */
+ ASN_PRIV_IMPLIED_OCTET_STR,
+ 0);
+
+ table_info->min_column = COLUMN_MTETRIGGERTHRESHOLDSTARTUP;
+ table_info->max_column = COLUMN_MTETRIGGERTHRESHOLDDELTAFALLINGEVENT;
+
+ /* Register this using the (common) trigger_table_data container */
+ netsnmp_tdata_register(reg, trigger_table_data, table_info);
+ DEBUGMSGTL(("disman:event:init", "Trigger Threshold Table\n"));
+}
+
+
+/** handles requests for the mteTriggerThresholdTable table */
+int
+mteTriggerThresholdTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *tinfo;
+ struct mteTrigger *entry;
+ int ret;
+
+ DEBUGMSGTL(("disman:event:mib", "Threshold Table handler (%d)\n",
+ reqinfo->mode));
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ /*
+ * The mteTriggerThresholdTable should only contains entries for
+ * rows where the mteTriggerTest 'threshold(2)' bit is set.
+ * So skip entries where this isn't the case.
+ */
+ if (!entry || !(entry->mteTriggerTest & MTE_TRIGGER_THRESHOLD ))
+ continue;
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGERTHRESHOLDSTARTUP:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->mteTThStartup);
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDRISING:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->mteTThRiseValue);
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDFALLING:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->mteTThFallValue);
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDDELTARISING:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->mteTThDRiseValue);
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDDELTAFALLING:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->mteTThDFallValue);
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDOBJECTSOWNER:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTThObjOwner,
+ strlen(entry->mteTThObjOwner));
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDOBJECTS:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTThObjects,
+ strlen(entry->mteTThObjects));
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDRISINGEVENTOWNER:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTThRiseOwner,
+ strlen(entry->mteTThRiseOwner));
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDRISINGEVENT:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTThRiseEvent,
+ strlen(entry->mteTThRiseEvent));
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDFALLINGEVENTOWNER:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTThFallOwner,
+ strlen(entry->mteTThFallOwner));
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDFALLINGEVENT:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTThFallEvent,
+ strlen(entry->mteTThFallEvent));
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDDELTARISINGEVENTOWNER:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTThDRiseOwner,
+ strlen(entry->mteTThDRiseOwner));
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDDELTARISINGEVENT:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTThDRiseEvent,
+ strlen(entry->mteTThDRiseEvent));
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDDELTAFALLINGEVENTOWNER:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTThDFallOwner,
+ strlen(entry->mteTThDFallOwner));
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDDELTAFALLINGEVENT:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *) entry->mteTThDFallEvent,
+ strlen(entry->mteTThDFallEvent));
+ break;
+ }
+ }
+ break;
+
+ /*
+ * Write-support
+ */
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ /*
+ * Since the mteTriggerThresholdTable only contains entries for
+ * rows where the mteTriggerTest 'threshold(2)' bit is set,
+ * strictly speaking we should reject assignments where
+ * this isn't the case.
+ * But SET requests that include an assignment of the
+ * 'threshold(2)' bit at the same time are valid, so would
+ * need to be accepted. Unfortunately, this assignment
+ * is only applied in the COMMIT pass, so it's difficult
+ * to detect whether this holds or not.
+ *
+ * Let's fudge things for now, by processing assignments
+ * even if the 'threshold(2)' bit isn't set.
+ */
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGERTHRESHOLDSTARTUP:
+ ret = netsnmp_check_vb_int_range(request->requestvb,
+ MTE_THRESH_START_RISE,
+ MTE_THRESH_START_RISEFALL );
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDRISING:
+ case COLUMN_MTETRIGGERTHRESHOLDFALLING:
+ case COLUMN_MTETRIGGERTHRESHOLDDELTARISING:
+ case COLUMN_MTETRIGGERTHRESHOLDDELTAFALLING:
+ ret = netsnmp_check_vb_int(request->requestvb);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDOBJECTSOWNER:
+ case COLUMN_MTETRIGGERTHRESHOLDOBJECTS:
+ case COLUMN_MTETRIGGERTHRESHOLDRISINGEVENTOWNER:
+ case COLUMN_MTETRIGGERTHRESHOLDRISINGEVENT:
+ case COLUMN_MTETRIGGERTHRESHOLDFALLINGEVENTOWNER:
+ case COLUMN_MTETRIGGERTHRESHOLDFALLINGEVENT:
+ case COLUMN_MTETRIGGERTHRESHOLDDELTARISINGEVENTOWNER:
+ case COLUMN_MTETRIGGERTHRESHOLDDELTARISINGEVENT:
+ case COLUMN_MTETRIGGERTHRESHOLDDELTAFALLINGEVENTOWNER:
+ case COLUMN_MTETRIGGERTHRESHOLDDELTAFALLINGEVENT:
+ ret = netsnmp_check_vb_type_and_max_size(
+ request->requestvb, ASN_OCTET_STR, MTE_STR1_LEN);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * The Event MIB is somewhat ambiguous as to whether the
+ * various trigger table entries can be modified once the
+ * main mteTriggerTable entry has been marked 'active'.
+ * But it's clear from discussion on the DisMan mailing
+ * list is that the intention is not.
+ *
+ * So check for whether this row is already active,
+ * and reject *all* SET requests if it is.
+ */
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ if (entry &&
+ entry->flags & MTE_TRIGGER_FLAG_ACTIVE ) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_INCONSISTENTVALUE);
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ case MODE_SET_FREE:
+ case MODE_SET_UNDO:
+ break;
+
+ case MODE_SET_ACTION:
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ if (!entry) {
+ /*
+ * New rows must be created via the RowStatus column
+ * (in the main mteTriggerTable)
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOCREATION);
+ /* or inconsistentName? */
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ /*
+ * All these assignments are "unfailable", so it's
+ * (reasonably) safe to apply them in the Commit phase
+ */
+ for (request = requests; request; request = request->next) {
+ entry = (struct mteTrigger *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_MTETRIGGERTHRESHOLDSTARTUP:
+ entry->mteTThStartup = *request->requestvb->val.integer;
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDRISING:
+ entry->mteTThRiseValue = *request->requestvb->val.integer;
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDFALLING:
+ entry->mteTThFallValue = *request->requestvb->val.integer;
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDDELTARISING:
+ entry->mteTThDRiseValue = *request->requestvb->val.integer;
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDDELTAFALLING:
+ entry->mteTThDFallValue = *request->requestvb->val.integer;
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDOBJECTSOWNER:
+ memset(entry->mteTThObjOwner, 0, sizeof(entry->mteTThObjOwner));
+ memcpy(entry->mteTThObjOwner, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDOBJECTS:
+ memset(entry->mteTThObjects, 0, sizeof(entry->mteTThObjects));
+ memcpy(entry->mteTThObjects, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDRISINGEVENTOWNER:
+ memset(entry->mteTThRiseOwner, 0, sizeof(entry->mteTThRiseOwner));
+ memcpy(entry->mteTThRiseOwner, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDRISINGEVENT:
+ memset(entry->mteTThRiseEvent, 0, sizeof(entry->mteTThRiseEvent));
+ memcpy(entry->mteTThRiseEvent, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDFALLINGEVENTOWNER:
+ memset(entry->mteTThFallOwner, 0, sizeof(entry->mteTThFallOwner));
+ memcpy(entry->mteTThFallOwner, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDFALLINGEVENT:
+ memset(entry->mteTThFallEvent, 0, sizeof(entry->mteTThFallEvent));
+ memcpy(entry->mteTThFallEvent, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDDELTARISINGEVENTOWNER:
+ memset(entry->mteTThDRiseOwner, 0, sizeof(entry->mteTThDRiseOwner));
+ memcpy(entry->mteTThDRiseOwner, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDDELTARISINGEVENT:
+ memset(entry->mteTThDRiseEvent, 0, sizeof(entry->mteTThDRiseEvent));
+ memcpy(entry->mteTThDRiseEvent, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDDELTAFALLINGEVENTOWNER:
+ memset(entry->mteTThDFallOwner, 0, sizeof(entry->mteTThDFallOwner));
+ memcpy(entry->mteTThDFallOwner, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_MTETRIGGERTHRESHOLDDELTAFALLINGEVENT:
+ memset(entry->mteTThDFallEvent, 0, sizeof(entry->mteTThDFallEvent));
+ memcpy(entry->mteTThDFallEvent, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ }
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerThresholdTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerThresholdTable.h
new file mode 100644
index 0000000000..282cc671e2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/event/mteTriggerThresholdTable.h
@@ -0,0 +1,33 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.table_data.conf,v 1.8 2005/07/19 14:52:03 dts12 Exp $
+ */
+#ifndef MTETRIGGERTHRESHOLDTABLE_H
+#define MTETRIGGERTHRESHOLDTABLE_H
+
+/*
+ * function declarations
+ */
+void init_mteTriggerThresholdTable(void);
+Netsnmp_Node_Handler mteTriggerThresholdTable_handler;
+
+/*
+ * column number definitions for table mteTriggerThresholdTable
+ */
+#define COLUMN_MTETRIGGERTHRESHOLDSTARTUP 1
+#define COLUMN_MTETRIGGERTHRESHOLDRISING 2
+#define COLUMN_MTETRIGGERTHRESHOLDFALLING 3
+#define COLUMN_MTETRIGGERTHRESHOLDDELTARISING 4
+#define COLUMN_MTETRIGGERTHRESHOLDDELTAFALLING 5
+#define COLUMN_MTETRIGGERTHRESHOLDOBJECTSOWNER 6
+#define COLUMN_MTETRIGGERTHRESHOLDOBJECTS 7
+#define COLUMN_MTETRIGGERTHRESHOLDRISINGEVENTOWNER 8
+#define COLUMN_MTETRIGGERTHRESHOLDRISINGEVENT 9
+#define COLUMN_MTETRIGGERTHRESHOLDFALLINGEVENTOWNER 10
+#define COLUMN_MTETRIGGERTHRESHOLDFALLINGEVENT 11
+#define COLUMN_MTETRIGGERTHRESHOLDDELTARISINGEVENTOWNER 12
+#define COLUMN_MTETRIGGERTHRESHOLDDELTARISINGEVENT 13
+#define COLUMN_MTETRIGGERTHRESHOLDDELTAFALLINGEVENTOWNER 14
+#define COLUMN_MTETRIGGERTHRESHOLDDELTAFALLINGEVENT 15
+
+#endif /* MTETRIGGERTHRESHOLDTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expErrorTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expErrorTable.c
new file mode 100644
index 0000000000..2604bc3dd1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expErrorTable.c
@@ -0,0 +1,114 @@
+/*
+ * DisMan Expression MIB:
+ * Implementation of the expExpressionErrorTable MIB interface
+ * See 'expExpression.c' for active behaviour of this table.
+ *
+ * (Based on mib2c.table_data.conf output)
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "disman/expr/expExpression.h"
+#include "disman/expr/expErrorTable.h"
+
+/* Initializes the expExpressionErrorTable module */
+void
+init_expErrorTable(void)
+{
+ static oid expErrorTable_oid[] = { 1, 3, 6, 1, 2, 1, 90, 1, 2, 2 };
+ size_t expErrorTable_oid_len = OID_LENGTH(expErrorTable_oid);
+ netsnmp_handler_registration *reg;
+ netsnmp_table_registration_info *table_info;
+
+ /*
+ * Ensure the expression table container is available...
+ */
+ init_expr_table_data();
+
+ /*
+ * ... then set up the MIB interface to the expExpressionErrorTable slice
+ */
+ reg = netsnmp_create_handler_registration("expErrorTable",
+ expErrorTable_handler,
+ expErrorTable_oid,
+ expErrorTable_oid_len,
+ HANDLER_CAN_RWRITE);
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ netsnmp_table_helper_add_indexes(table_info,
+ /* index: expExpressionOwner */
+ ASN_OCTET_STR,
+ /* index: expExpressionName */
+ ASN_OCTET_STR,
+ 0);
+
+ table_info->min_column = COLUMN_EXPERRORTIME;
+ table_info->max_column = COLUMN_EXPERRORINSTANCE;
+
+ /* Register this using the (common) expr_table_data container */
+ netsnmp_tdata_register(reg, expr_table_data, table_info);
+ DEBUGMSGTL(("disman:expr:init", "Expression Error Table container (%x)\n",
+ expr_table_data));
+}
+
+
+/** handles requests for the expExpressionErrorTable table */
+int
+expErrorTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *tinfo;
+ struct expExpression *entry;
+
+ DEBUGMSGTL(("disman:expr:mib", "Expression Error Table handler (%d)\n",
+ reqinfo->mode));
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ entry = (struct expExpression *)
+ netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+ if (!entry || !(entry->flags & EXP_FLAG_VALID))
+ continue;
+
+ /*
+ * "Entries only appear in this table ... when there
+ * has been an error for that [matching] expression"
+ */
+ if (entry->expErrorCount == 0)
+ continue;
+
+ switch (tinfo->colnum) {
+ case COLUMN_EXPERRORTIME:
+ snmp_set_var_typed_integer(request->requestvb, ASN_TIMETICKS,
+ entry->expErrorTime);
+ break;
+ case COLUMN_EXPERRORINDEX:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->expErrorIndex);
+ break;
+ case COLUMN_EXPERRORCODE:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->expErrorCode);
+ break;
+ case COLUMN_EXPERRORINSTANCE:
+ snmp_set_var_typed_value(request->requestvb, ASN_OBJECT_ID,
+ (u_char *) entry->expErrorInstance,
+ entry->expErrorInst_len*sizeof(oid));
+ break;
+ }
+ }
+ break;
+ }
+ DEBUGMSGTL(("disman:expr:mib", "Expression Error handler - done \n"));
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expErrorTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expErrorTable.h
new file mode 100644
index 0000000000..1d8339ed55
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expErrorTable.h
@@ -0,0 +1,21 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.table_data.conf,v 1.11 2005/09/16 11:48:12 dts12 Exp $
+ */
+#ifndef EXPEXPRESSIONERRORTABLE_H
+#define EXPEXPRESSIONERRORTABLE_H
+
+/*
+ * function declarations
+ */
+void init_expErrorTable(void);
+Netsnmp_Node_Handler expErrorTable_handler;
+
+/*
+ * column number definitions for table expExpressionErrorTable
+ */
+#define COLUMN_EXPERRORTIME 1
+#define COLUMN_EXPERRORINDEX 2
+#define COLUMN_EXPERRORCODE 3
+#define COLUMN_EXPERRORINSTANCE 4
+#endif /* EXPEXPRESSIONERRORTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpression.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpression.c
new file mode 100644
index 0000000000..aa618b76cb
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpression.c
@@ -0,0 +1,365 @@
+/*
+ * DisMan Expression MIB:
+ * Core implementation of the expression handling behaviour
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "disman/expr/expExpression.h"
+#include "disman/expr/expObject.h"
+
+netsnmp_tdata *expr_table_data;
+
+ /*
+ * Initializes the container for the expExpression table,
+ * regardless of which module initialisation routine is called first.
+ */
+void
+init_expr_table_data(void)
+{
+ DEBUGMSGTL(("disman:expr:init", "init expression container\n"));
+ if (!expr_table_data) {
+ expr_table_data = netsnmp_tdata_create_table("expExpressionTable", 0);
+ DEBUGMSGTL(("disman:expr:init", "create expression container (%x)\n",
+ expr_table_data));
+ }
+}
+
+/** Initialize the expExpression module */
+void
+init_expExpression(void)
+{
+ init_expr_table_data();
+}
+
+
+ /* ===================================================
+ *
+ * APIs for maintaining the contents of the
+ * expression table container.
+ *
+ * =================================================== */
+
+void
+_mteExpr_dump(void)
+{
+ struct mteExpression *entry;
+ netsnmp_tdata_row *row;
+ int i = 0;
+
+ for (row = netsnmp_tdata_row_first(expr_table_data);
+ row;
+ row = netsnmp_tdata_row_next(expr_table_data, row)) {
+ entry = (struct mteExpression *)row->data;
+ DEBUGMSGTL(("disman:expr:dump", "ExpressionTable entry %d: ", i));
+ DEBUGMSGOID(("disman:expr:dump", row->oid_index.oids, row->oid_index.len));
+ DEBUGMSG(("disman:expr:dump", "(%s, %s)",
+ row->indexes->val.string,
+ row->indexes->next_variable->val.string));
+ DEBUGMSG(("disman:expr:dump", ": %x, %x\n", row, entry));
+ i++;
+ }
+ DEBUGMSGTL(("disman:expr:dump", "ExpressionTable %d entries\n", i));
+}
+
+
+
+/*
+ * Create a new row in the expression table
+ */
+struct expExpression *
+expExpression_createEntry(char *expOwner, char *expName, int fixed)
+{
+ netsnmp_tdata_row *row;
+
+ row = expExpression_createRow(expOwner, expName, fixed);
+ return row ? (struct expExpression *)row->data : NULL;
+}
+
+
+netsnmp_tdata_row *
+expExpression_createRow(char *expOwner, char *expName, int fixed)
+{
+ struct expExpression *entry;
+ netsnmp_tdata_row *row;
+ size_t expOwner_len = (expOwner) ? strlen(expOwner) : 0;
+ size_t expName_len = (expName) ? strlen(expName) : 0;
+
+ /*
+ * Create the expExpression entry, and the
+ * (table-independent) row wrapper structure...
+ */
+ entry = SNMP_MALLOC_TYPEDEF(struct expExpression);
+ if (!entry)
+ return NULL;
+
+ row = netsnmp_tdata_create_row();
+ if (!row) {
+ SNMP_FREE(entry);
+ return NULL;
+ }
+ row->data = entry;
+
+ /*
+ * ... initialize this row with the indexes supplied
+ * and the default values for the row...
+ */
+ if (expOwner)
+ memcpy(entry->expOwner, expOwner, expOwner_len);
+ netsnmp_tdata_row_add_index(row, ASN_OCTET_STR,
+ entry->expOwner, expOwner_len);
+ if (expName)
+ memcpy(entry->expName, expName, expName_len);
+ netsnmp_tdata_row_add_index(row, ASN_OCTET_STR,
+ entry->expName, expName_len);
+
+ entry->expValueType = EXPVALTYPE_COUNTER;
+ entry->expErrorCount = 0;
+ if (fixed)
+ entry->flags |= EXP_FLAG_FIXED;
+
+ /*
+ * ... and insert the row into the table container.
+ */
+ netsnmp_tdata_add_row(expr_table_data, row);
+ DEBUGMSGTL(("disman:expr:table", "Expression entry created (%s, %s)\n",
+ expOwner, expName));
+ return row;
+}
+
+/*
+ * Remove a row from the expression table
+ */
+void
+expExpression_removeEntry(netsnmp_tdata_row *row)
+{
+ struct expExpression *entry;
+
+ if (!row)
+ return; /* Nothing to remove */
+ entry = (struct expExpression *)
+ netsnmp_tdata_remove_and_delete_row(expr_table_data, row);
+ if (entry) {
+ /* expExpression_disable( entry ) */
+ SNMP_FREE(entry);
+ }
+}
+
+
+struct expExpression *
+expExpression_getFirstEntry( void )
+{
+ return (struct expExpression *)
+ netsnmp_tdata_row_entry(netsnmp_tdata_row_first(expr_table_data));
+}
+
+struct expExpression *
+expExpression_getNextEntry( char *owner, char *name )
+{
+ netsnmp_variable_list owner_var, name_var;
+
+ memset(&owner_var, 0, sizeof(netsnmp_variable_list));
+ memset(&name_var, 0, sizeof(netsnmp_variable_list));
+ snmp_set_var_typed_value( &owner_var, ASN_OCTET_STR,
+ (u_char*)owner, strlen(owner));
+ snmp_set_var_typed_value( &name_var, ASN_OCTET_STR,
+ (u_char*)name, strlen(name));
+ owner_var.next_variable = &name_var;
+
+ return (struct expExpression *)
+ netsnmp_tdata_row_entry(
+ netsnmp_tdata_row_next_byidx(expr_table_data, &owner_var));
+}
+
+struct expExpression *
+expExpression_getEntry( char *owner, char *name )
+{
+ netsnmp_variable_list owner_var, name_var;
+
+ memset(&owner_var, 0, sizeof(netsnmp_variable_list));
+ memset(&name_var, 0, sizeof(netsnmp_variable_list));
+ snmp_set_var_typed_value( &owner_var, ASN_OCTET_STR,
+ (u_char*)owner, strlen(owner));
+ snmp_set_var_typed_value( &name_var, ASN_OCTET_STR,
+ (u_char*)name, strlen(name));
+ owner_var.next_variable = &name_var;
+
+ return (struct expExpression *)
+ netsnmp_tdata_row_entry(
+ netsnmp_tdata_row_get_byidx(expr_table_data, &owner_var));
+}
+
+
+ /* ===================================================
+ *
+ * APIs for evaluating an expression - data gathering
+ *
+ * =================================================== */
+
+
+
+/*
+ * Gather the data necessary for evaluating an expression.
+ *
+ * This will retrieve *all* the data relevant for all
+ * instances of this expression, rather than just the
+ * just the values needed for expanding a given instance.
+ */
+void
+expExpression_getData( unsigned int reg, void *clientarg )
+{
+ struct expExpression *entry = (struct expExpression *)clientarg;
+ netsnmp_tdata_row *row;
+ netsnmp_variable_list *var;
+ int ret;
+
+ if ( !entry && reg ) {
+ snmp_alarm_unregister( reg );
+ return;
+ }
+
+ if (( entry->expExpression[0] == '\0' ) ||
+ !(entry->flags & EXP_FLAG_ACTIVE) ||
+ !(entry->flags & EXP_FLAG_VALID))
+ return;
+
+ DEBUGMSGTL(("disman:expr:run", "Gathering expression data (%s, %s)\n",
+ entry->expOwner, entry->expName));
+
+ /*
+ * This routine can be called in two situations:
+ * - regularly by 'snmp_alarm' (reg != 0)
+ * (as part of ongoing delta-value sampling)
+ * - on-demand (reg == 0)
+ * (for evaluating a particular entry)
+ *
+ * If a regularly sampled expression (entry->alarm != 0)
+ * is invoked on-demand (reg == 0), then use the most
+ * recent sampled values, rather than retrieving them again.
+ */
+ if ( !reg && entry->alarm )
+ return;
+
+ /*
+ * XXX - may want to implement caching for on-demand evaluation
+ * of non-regularly sampled expressions.
+ */
+
+ /*
+ * For a wildcarded expression, expExpressionPrefix is used
+ * to determine which object instances to retrieve.
+ * (For a non-wildcarded expression, we already know
+ * explicitly which object instances will be needed).
+ *
+ * If we walk this object here, then the results can be
+ * used to build the necessary GET requests for each
+ * individual parameter object (within expObject_getData)
+ *
+ * This will probably be simpler (and definitely more efficient)
+ * than walking the object instances separately and merging
+ * merging the results).
+ *
+ * NB: Releasing any old results is handled by expObject_getData.
+ * Assigning to 'entry->pvars' without first releasing the
+ * previous contents does *not* introduce a memory leak.
+ */
+ if ( entry->expPrefix_len ) {
+ var = (netsnmp_variable_list *)
+ SNMP_MALLOC_TYPEDEF( netsnmp_variable_list );
+ snmp_set_var_objid( var, entry->expPrefix, entry->expPrefix_len);
+ ret = netsnmp_query_walk( var, entry->session );
+ DEBUGMSGTL(("disman:expr:run", "Walk returned %d\n", ret ));
+ entry->pvars = var;
+ }
+
+ /* XXX - retrieve sysUpTime.0 value, and check for discontinuity */
+ /*
+ entry->flags &= ~EXP_FLAG_SYSUT;
+ var = (netsnmp_variable_list *)
+ SNMP_MALLOC_TYPEDEF( netsnmp_variable_list );
+ snmp_set_var_objid( var, sysUT_oid, sysUT_oid_len );
+ netsnmp_query_get( var, entry->session );
+ if ( *var->val.integer != entry->sysUpTime ) {
+ entry->flags |= EXP_FLAG_SYSUT;
+ entry->sysUpTime = *var->val.integer;
+ }
+ snmp_free_varbind(var);
+ */
+
+ /*
+ * Loop through the list of relevant objects,
+ * and retrieve the corresponding values.
+ */
+ for ( row = expObject_getFirst( entry->expOwner, entry->expName );
+ row;
+ row = expObject_getNext( row )) {
+
+ /* XXX - may need to check whether owner/name still match */
+ expObject_getData( entry, (struct expObject *)row->data);
+ }
+}
+
+
+void
+expExpression_enable( struct expExpression *entry )
+{
+ DEBUGMSG(("disman:expr:run", "Enabling %s\n", entry->expName));
+ if (!entry)
+ return;
+
+ if (entry->alarm) {
+ /* or explicitly call expExpression_disable ?? */
+ snmp_alarm_unregister( entry->alarm );
+ entry->alarm = 0;
+ }
+
+ if (entry->expDeltaInterval) {
+ entry->alarm = snmp_alarm_register(
+ entry->expDeltaInterval, SA_REPEAT,
+ expExpression_getData, entry );
+ expExpression_getData( entry->alarm, (void*)entry );
+ }
+}
+
+void
+expExpression_disable( struct expExpression *entry )
+{
+ if (!entry)
+ return;
+
+ if (entry->alarm) {
+ snmp_alarm_unregister( entry->alarm );
+ entry->alarm = 0;
+ /* Perhaps release any previous results ?? */
+ }
+}
+
+
+long _expExpression_MaxCount = 0;
+long _expExpression_countEntries(void)
+{
+ struct expExpression *entry;
+ netsnmp_tdata_row *row;
+ long count = 0;
+
+ for (row = netsnmp_tdata_row_first(expr_table_data);
+ row;
+ row = netsnmp_tdata_row_next(expr_table_data, row)) {
+ entry = (struct expExpression *)row->data;
+ count += entry->count;
+ }
+
+ return count;
+}
+
+long expExpression_getNumEntries(int max)
+{
+ long count;
+ /* XXX - implement some form of caching ??? */
+ count = _expExpression_countEntries();
+ if ( count > _expExpression_MaxCount )
+ _expExpression_MaxCount = count;
+
+ return ( max ? _expExpression_MaxCount : count);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpression.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpression.h
new file mode 100644
index 0000000000..16ee80b205
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpression.h
@@ -0,0 +1,91 @@
+#ifndef EXPEXPRESSION_H
+#define EXPEXPRESSION_H
+
+#include "disman/expr/exp_enum.h"
+
+ /*
+ * Flags relating to the expression table ....
+ */
+#define EXP_FLAG_ACTIVE 0x01 /* for expExpressionEntryStatus */
+#define EXP_FLAG_FIXED 0x02 /* for snmpd.conf persistence */
+#define EXP_FLAG_VALID 0x04 /* for row creation/undo */
+#define EXP_FLAG_SYSUT 0x08 /* sysUpTime.0 discontinuity */
+
+ /*
+ * Standard lengths for various Expression-MIB OCTET STRING objects:
+ * short tags ( 32 characters)
+ * SnmpAdminString-style values (255 characters)
+ * "long" DisplayString values (1024 characters)
+ */
+#define EXP_STR1_LEN 32
+#define EXP_STR2_LEN 255
+#define EXP_STR3_LEN 1024
+
+/*
+ * Data structure for an expression row.
+ * Covers both expExpressionTable and expErrorTable
+ */
+struct expExpression {
+ /*
+ * Index values
+ */
+ char expOwner[ EXP_STR1_LEN+1 ];
+ char expName[ EXP_STR1_LEN+1 ];
+
+ /*
+ * Column values for the main expExpressionTable
+ */
+ char expExpression[ EXP_STR3_LEN+1 ];
+ char expComment[ EXP_STR2_LEN+1 ];
+ oid expPrefix[ MAX_OID_LEN ];
+ size_t expPrefix_len;
+ long expValueType;
+ long expDeltaInterval;
+ u_long expErrorCount;
+
+ /*
+ * Column values for the expExpressionErrorTable
+ */
+ u_long expErrorTime;
+ long expErrorIndex;
+ long expErrorCode;
+ oid expErrorInstance[ MAX_OID_LEN ];
+ size_t expErrorInst_len;
+
+ unsigned int alarm;
+ netsnmp_session *session;
+ netsnmp_variable_list *pvars; /* expPrefix values */
+ long sysUpTime;
+ long count;
+ long flags;
+};
+
+
+ /*
+ * Container structure for the expExpressionTable,
+ * and initialisation routine to create this.
+ */
+extern netsnmp_tdata *expr_table_data;
+extern void init_expr_table_data(void);
+
+/*
+ * function declarations
+ */
+void init_expExpression(void);
+
+struct expExpression *expExpression_createEntry( char *, char *, int);
+netsnmp_tdata_row *expExpression_createRow( char *, char *, int);
+void expExpression_removeEntry( netsnmp_tdata_row *);
+
+struct expExpression *expExpression_getEntry( char *, char *);
+struct expExpression *expExpression_getFirstEntry( void );
+struct expExpression *expExpression_getNextEntry( char *, char *);
+
+void expExpression_enable( struct expExpression *);
+void expExpression_disable( struct expExpression *);
+
+void expExpression_getData( unsigned int, void *);
+void expExpression_evaluate(struct expExpression *);
+long expExpression_getNumEntries(int);
+
+#endif /* EXPEXPRESSIONTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpressionConf.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpressionConf.c
new file mode 100644
index 0000000000..743ef9d889
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpressionConf.c
@@ -0,0 +1,286 @@
+/*
+ * DisMan Expression MIB:
+ * Implementation of the expression table configuration handling.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "utilities/iquery.h"
+#include "disman/expr/expExpression.h"
+#include "disman/expr/expObject.h"
+#include "disman/expr/expExpressionConf.h"
+
+/* Initializes the expExpressionConf module */
+void
+init_expExpressionConf(void)
+{
+ init_expr_table_data();
+
+ /*
+ * Register config handler for user-level (fixed) expressions...
+ * XXX - TODO
+ */
+ snmpd_register_config_handler("expression", parse_expression, NULL, NULL);
+
+ /*
+ * ... and persistent storage of dynamically configured entries.
+ */
+ snmpd_register_config_handler("_expETable", parse_expETable, NULL, NULL);
+
+ /*
+ * Register to save (non-fixed) entries when the agent shuts down
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_expETable, NULL);
+}
+
+
+
+/* ================================================
+ *
+ * Handlers for loading/storing persistent expression entries
+ *
+ * ================================================ */
+
+char *
+_parse_expECols( char *line, struct expExpression *entry )
+{
+ void *vp;
+ size_t tmp;
+ size_t len;
+
+ len = EXP_STR3_LEN; vp = entry->expExpression;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ entry->expValueType = tmp;
+
+ len = EXP_STR2_LEN; vp = entry->expComment;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ entry->expDeltaInterval = tmp;
+
+ vp = entry->expPrefix;
+ entry->expPrefix_len = MAX_OID_LEN;
+ line = read_config_read_data(ASN_OBJECT_ID, line, &vp,
+ &entry->expPrefix_len);
+
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ entry->flags |= (tmp & EXP_FLAG_ACTIVE);
+
+ return line;
+}
+
+
+void
+parse_expression(const char *token, char *line)
+{
+ char buf[ SPRINT_MAX_LEN];
+ char ename[EXP_STR1_LEN+1];
+ oid name_buf[MAX_OID_LEN];
+ size_t name_len;
+ char *cp, *cp2;
+ struct expExpression *entry;
+ struct expObject *object;
+ netsnmp_session *sess = NULL;
+ int type=EXPVALTYPE_COUNTER;
+ int i=1;
+
+ DEBUGMSGTL(("disman:expr:conf", "Parsing expression config... "));
+
+ memset(buf, 0, sizeof(buf));
+ memset(ename, 0, sizeof(ename));
+
+ for (cp = copy_nword(line, buf, SPRINT_MAX_LEN);
+ ;
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN)) {
+
+ if (buf[0] == '-' ) {
+ switch (buf[1]) {
+ case 't': /* type */
+ switch (buf[2]) {
+ case 'c': type = EXPVALTYPE_COUNTER; break;
+ case 'u': type = EXPVALTYPE_UNSIGNED; break;
+ case 't': type = EXPVALTYPE_TIMETICKS; break;
+ case 'i': type = EXPVALTYPE_INTEGER; break;
+ case 'a': type = EXPVALTYPE_IPADDRESS; break;
+ case 's': type = EXPVALTYPE_STRING; break;
+ case 'o': type = EXPVALTYPE_OID; break;
+ case 'C': type = EXPVALTYPE_COUNTER64; break;
+ }
+ break;
+ case 'u': /* user */
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN);
+ sess = netsnmp_iquery_user_session(buf);
+ break;
+ }
+ } else {
+ break;
+ }
+ }
+
+ memcpy(ename, buf, sizeof(ename));
+ /* cp = copy_nword(line, ename, sizeof(ename)); */
+ entry = expExpression_createEntry( "snmpd.conf", ename, 1 );
+ if (!entry)
+ return;
+
+ cp2 = entry->expExpression;
+ while (cp && *cp) {
+ /*
+ * Copy everything that can't possibly be a MIB
+ * object name into the expression field...
+ */
+ /* XXX - TODO - Handle string literals */
+ if (!isalpha(*cp)) {
+ *cp2++ = *cp++;
+ continue;
+ }
+ /*
+ * ... and copy the defined functions across as well
+ * XXX - TODO
+ */
+
+ /*
+ * Anything else is presumably a MIB object (or instance).
+ * Create an entry in the expObjectTable, and insert a
+ * corresponding parameter in the expression itself.
+ */
+ name_len = MAX_OID_LEN;
+ cp = copy_nword(cp, buf, SPRINT_MAX_LEN);
+ snmp_parse_oid( buf, name_buf, &name_len );
+ object = expObject_createEntry( "snmpd.conf", ename, i, 1 );
+ memcpy( object->expObjectID, name_buf, name_len*sizeof(oid));
+ object->expObjectID_len = name_len;
+ object->flags |= EXP_OBJ_FLAG_VALID
+ | EXP_OBJ_FLAG_ACTIVE
+ | EXP_OBJ_FLAG_OWILD;
+ /*
+ * The first such object can also be used as the
+ * expExpressionPrefix
+ */
+ if ( i == 1 ) {
+ memcpy( entry->expPrefix, name_buf, name_len*sizeof(oid));
+ entry->expPrefix_len = name_len;
+ object->flags |= EXP_OBJ_FLAG_PREFIX;
+ }
+ sprintf(cp2, "$%d", i++);
+ while (*cp2)
+ cp2++; /* Skip over this parameter */
+ }
+
+ if (sess)
+ entry->session = sess;
+ else
+ entry->session = netsnmp_query_get_default_session();
+ entry->expDeltaInterval = 10;
+ entry->expValueType = type;
+ entry->flags |= EXP_FLAG_VALID
+ | EXP_FLAG_ACTIVE;
+ expExpression_enable( entry );
+ DEBUGMSG(("disman:expr:conf", "(%s, %s)\n", ename,
+ entry->expExpression));
+}
+
+void
+parse_expETable(const char *token, char *line)
+{
+ char owner[EXP_STR1_LEN+1];
+ char ename[EXP_STR1_LEN+1];
+ void *vp;
+ size_t len;
+ struct expExpression *entry;
+
+ DEBUGMSGTL(("disman:expr:conf", "Parsing mteExpressionTable config... "));
+
+ /*
+ * Read in the index information for this entry
+ * and create a (non-fixed) data structure for it.
+ */
+ memset( owner, 0, sizeof(owner));
+ memset( ename, 0, sizeof(ename));
+ len = EXP_STR1_LEN; vp = owner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = EXP_STR1_LEN; vp = ename;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ entry = expExpression_createEntry( owner, ename, 0 );
+
+ DEBUGMSG(("disman:expr:conf", "(%s, %s) ", owner, ename));
+
+ /*
+ * Read in the accessible column values.
+ */
+ line = _parse_expECols( line, entry );
+ /*
+ * XXX - Will need to read in the 'iquery' access information
+ */
+ entry->flags |= EXP_FLAG_VALID;
+
+ DEBUGMSG(("disman:expr:conf", "\n"));
+}
+
+
+int
+store_expETable(int majorID, int minorID, void *serverarg, void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr;
+ void *vp;
+ size_t tint;
+ netsnmp_tdata_row *row;
+ struct expExpression *entry;
+
+
+ DEBUGMSGTL(("disman:expr:conf", "Storing expExpressionTable config:\n"));
+
+ for (row = netsnmp_tdata_row_first( expr_table_data );
+ row;
+ row = netsnmp_tdata_row_next( expr_table_data, row )) {
+
+ /*
+ * Skip entries that were set up via static config directives
+ */
+ entry = (struct expExpression *)netsnmp_tdata_row_entry( row );
+ if ( entry->flags & EXP_FLAG_FIXED )
+ continue;
+
+ DEBUGMSGTL(("disman:expr:conf", " Storing (%s %s)\n",
+ entry->expOwner, entry->expName));
+
+ /*
+ * Save the basic expExpression entry
+ */
+ memset(line, 0, sizeof(line));
+ strcat(line, "_expETable ");
+ cptr = line + strlen(line);
+
+ vp = entry->expOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->expName; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+
+ vp = entry->expExpression; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ tint = entry->expValueType;
+ cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL );
+ vp = entry->expComment; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ tint = entry->expDeltaInterval;
+ cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL );
+
+ vp = entry->expPrefix;
+ tint = entry->expPrefix_len;
+ cptr = read_config_store_data( ASN_OBJECT_ID, cptr, &vp, &tint );
+
+ tint = entry->flags;
+ cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL );
+
+ /* XXX - Need to store the 'iquery' access information */
+ snmpd_store_config(line);
+ }
+
+ DEBUGMSGTL(("disman:expr:conf", " done.\n"));
+ return SNMPERR_SUCCESS;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpressionConf.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpressionConf.h
new file mode 100644
index 0000000000..2729109637
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpressionConf.h
@@ -0,0 +1,10 @@
+#ifndef EXPEXPRESSIONCONF_H
+#define EXPEXPRESSIONCONF_H
+
+void init_expExpressionConf(void);
+
+void parse_expression(const char *, char *);
+void parse_expETable( const char *, char *);
+SNMPCallback store_expETable;
+
+#endif /* EXPEXPRESSIONCONF_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpressionTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpressionTable.c
new file mode 100644
index 0000000000..c00ed4907f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpressionTable.c
@@ -0,0 +1,337 @@
+/*
+ * DisMan Expression MIB:
+ * Implementation of the expExpressionTable MIB interface
+ * See 'expExpression.c' for active behaviour of this table.
+ *
+ * (Based on mib2c.table_data.conf output)
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "utilities/iquery.h"
+#include "disman/expr/expExpression.h"
+#include "disman/expr/expExpressionTable.h"
+
+/* Initializes the expExpressionTable module */
+void
+init_expExpressionTable(void)
+{
+ static oid expExpressionTable_oid[] = { 1, 3, 6, 1, 2, 1, 90, 1, 2, 1 };
+ size_t expExpressionTable_oid_len = OID_LENGTH(expExpressionTable_oid);
+ netsnmp_handler_registration *reg;
+ netsnmp_table_registration_info *table_info;
+
+ /*
+ * Ensure the expression table container is available...
+ */
+ init_expr_table_data();
+
+ /*
+ * ... then set up the MIB interface to the expExpressionTable slice
+ */
+ reg = netsnmp_create_handler_registration("expExpressionTable",
+ expExpressionTable_handler,
+ expExpressionTable_oid,
+ expExpressionTable_oid_len,
+ HANDLER_CAN_RWRITE);
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ netsnmp_table_helper_add_indexes(table_info,
+ /* index: expExpressionOwner */
+ ASN_OCTET_STR,
+ /* index: expExpressionName */
+ ASN_OCTET_STR,
+ 0);
+
+ table_info->min_column = COLUMN_EXPEXPRESSION;
+ table_info->max_column = COLUMN_EXPEXPRESSIONENTRYSTATUS;
+
+ /* Register this using the (common) expr_table_data container */
+ netsnmp_tdata_register(reg, expr_table_data, table_info);
+ DEBUGMSGTL(("disman:expr:init", "Expression Table container (%x)\n",
+ expr_table_data));
+}
+
+
+/** handles requests for the expExpressionTable table */
+int
+expExpressionTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *tinfo;
+ netsnmp_tdata_row *row;
+ struct expExpression *entry;
+ char expOwner[EXP_STR1_LEN+1];
+ char expName[ EXP_STR1_LEN+1];
+ long ret;
+
+ DEBUGMSGTL(("disman:expr:mib", "Expression Table handler (%d)\n",
+ reqinfo->mode));
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ entry = (struct expExpression *)
+ netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+ if (!entry || !(entry->flags & EXP_FLAG_VALID))
+ continue;
+
+ switch (tinfo->colnum) {
+ case COLUMN_EXPEXPRESSION:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char*)entry->expExpression,
+ strlen(entry->expExpression));
+ break;
+ case COLUMN_EXPEXPRESSIONVALUETYPE:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->expValueType);
+ break;
+ case COLUMN_EXPEXPRESSIONCOMMENT:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char*)entry->expComment,
+ strlen(entry->expComment));
+ break;
+ case COLUMN_EXPEXPRESSIONDELTAINTERVAL:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->expDeltaInterval);
+ break;
+ case COLUMN_EXPEXPRESSIONPREFIX:
+ /*
+ * XXX - Need to search expObjectTable for a suitable OID
+ */
+ /*
+ * Empty OIDs (len=0) are converted into .0.0
+ * by the SNMP library automatically :-(
+ */
+ if ( entry->expPrefix_len ) {
+ snmp_set_var_typed_value(request->requestvb, ASN_OBJECT_ID,
+ (u_char *) entry->expPrefix,
+ entry->expPrefix_len*sizeof(oid));
+ } else {
+ /* XXX - possibly not needed */
+ request->requestvb->type = ASN_OBJECT_ID;
+ request->requestvb->val_len = 0;
+ }
+ break;
+ case COLUMN_EXPEXPRESSIONERRORS:
+ snmp_set_var_typed_integer(request->requestvb, ASN_COUNTER,
+ entry->expErrorCount);
+ break;
+ case COLUMN_EXPEXPRESSIONENTRYSTATUS:
+ /* What would indicate 'notReady' ? */
+ ret = (entry->flags & EXP_FLAG_ACTIVE) ?
+ RS_ACTIVE : RS_NOTINSERVICE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ }
+ }
+ break;
+
+ /*
+ * Write-support
+ */
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request = request->next) {
+ entry = (struct expExpression *)
+ netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_EXPEXPRESSION:
+ ret = netsnmp_check_vb_type_and_max_size(
+ request->requestvb, ASN_OCTET_STR, EXP_STR3_LEN);
+ /* XXX - check new expression is syntactically valid */
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_EXPEXPRESSIONVALUETYPE:
+ ret = netsnmp_check_vb_int_range(request->requestvb, 1, 8);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_EXPEXPRESSIONCOMMENT:
+ ret = netsnmp_check_vb_type_and_max_size(
+ request->requestvb, ASN_OCTET_STR, EXP_STR2_LEN);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_EXPEXPRESSIONDELTAINTERVAL:
+ ret = netsnmp_check_vb_int_range(request->requestvb, 0, 86400);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_EXPEXPRESSIONENTRYSTATUS:
+ ret = netsnmp_check_vb_rowstatus(request->requestvb,
+ (entry ? RS_ACTIVE : RS_NONEXISTENT));
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_EXPEXPRESSIONENTRYSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ /*
+ * Create an (empty) new row structure
+ */
+ memset(expOwner, 0, sizeof(expOwner));
+ memcpy(expOwner, tinfo->indexes->val.string,
+ tinfo->indexes->val_len);
+ memset(expName, 0, sizeof(expName));
+ memcpy(expName,
+ tinfo->indexes->next_variable->val.string,
+ tinfo->indexes->next_variable->val_len);
+
+ row = expExpression_createRow(expOwner, expName, 0);
+ if (!row) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ return SNMP_ERR_NOERROR;
+ }
+ netsnmp_insert_tdata_row( request, row );
+ }
+ }
+ }
+ break;
+
+ case MODE_SET_FREE:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_EXPEXPRESSIONENTRYSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ /*
+ * Tidy up after a failed row creation request
+ */
+ entry = (struct expExpression *)
+ netsnmp_tdata_extract_entry(request);
+ if (entry &&
+ !(entry->flags & EXP_FLAG_VALID)) {
+ row = (netsnmp_tdata_row *)
+ netsnmp_tdata_extract_row(request);
+ expExpression_removeEntry( row );
+ }
+ }
+ }
+ }
+ break;
+
+ case MODE_SET_ACTION:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+ entry = (struct expExpression *)
+ netsnmp_tdata_extract_entry(request);
+ if (!entry) {
+ /*
+ * New rows must be created via the RowStatus column
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOCREATION);
+ /* or inconsistentName? */
+ return SNMP_ERR_NOERROR;
+
+ }
+ }
+ break;
+
+ case MODE_SET_UNDO:
+ break;
+
+ case MODE_SET_COMMIT:
+ /*
+ * All these assignments are "unfailable", so it's
+ * (reasonably) safe to apply them in the Commit phase
+ */
+ for (request = requests; request; request = request->next) {
+ entry = (struct expExpression *)
+ netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_EXPEXPRESSION:
+ memset(entry->expExpression, 0, EXP_STR3_LEN+1);
+ memcpy(entry->expExpression,
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_EXPEXPRESSIONVALUETYPE:
+ entry->expValueType = *request->requestvb->val.integer;
+ break;
+ case COLUMN_EXPEXPRESSIONCOMMENT:
+ memset(entry->expComment, 0, EXP_STR2_LEN+1);
+ memcpy(entry->expComment,
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_EXPEXPRESSIONDELTAINTERVAL:
+ entry->expDeltaInterval = *request->requestvb->val.integer;
+ break;
+ case COLUMN_EXPEXPRESSIONENTRYSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_ACTIVE:
+ entry->flags |= EXP_FLAG_ACTIVE;
+ expExpression_enable( entry );
+ break;
+ case RS_NOTINSERVICE:
+ entry->flags &= ~EXP_FLAG_ACTIVE;
+ expExpression_disable( entry );
+ break;
+ case RS_CREATEANDGO:
+ entry->flags |= EXP_FLAG_ACTIVE;
+ entry->flags |= EXP_FLAG_VALID;
+ entry->session =
+ netsnmp_iquery_pdu_session(reqinfo->asp->pdu);
+ expExpression_enable( entry );
+ break;
+ case RS_CREATEANDWAIT:
+ entry->flags |= EXP_FLAG_VALID;
+ entry->session =
+ netsnmp_iquery_pdu_session(reqinfo->asp->pdu);
+ break;
+
+ case RS_DESTROY:
+ row = (netsnmp_tdata_row *)
+ netsnmp_tdata_extract_row(request);
+ expExpression_removeEntry(row);
+ }
+ }
+ }
+ break;
+ }
+ DEBUGMSGTL(("disman:expr:mib", "Expression Table handler - done \n"));
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpressionTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpressionTable.h
new file mode 100644
index 0000000000..a32d8f506f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expExpressionTable.h
@@ -0,0 +1,26 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.table_data.conf,v 1.11 2005/09/16 11:48:12 dts12 Exp $
+ */
+#ifndef EXPEXPRESSIONTABLE_H
+#define EXPEXPRESSIONTABLE_H
+
+/*
+ * function declarations
+ */
+void init_expExpressionTable(void);
+Netsnmp_Node_Handler expExpressionTable_handler;
+
+/*
+ * column number definitions for table expExpressionTable
+ */
+#define COLUMN_EXPEXPRESSIONOWNER 1
+#define COLUMN_EXPEXPRESSIONNAME 2
+#define COLUMN_EXPEXPRESSION 3
+#define COLUMN_EXPEXPRESSIONVALUETYPE 4
+#define COLUMN_EXPEXPRESSIONCOMMENT 5
+#define COLUMN_EXPEXPRESSIONDELTAINTERVAL 6
+#define COLUMN_EXPEXPRESSIONPREFIX 7
+#define COLUMN_EXPEXPRESSIONERRORS 8
+#define COLUMN_EXPEXPRESSIONENTRYSTATUS 9
+#endif /* EXPEXPRESSIONTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObject.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObject.c
new file mode 100644
index 0000000000..ddb071b21b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObject.c
@@ -0,0 +1,346 @@
+/*
+ * DisMan Expression MIB:
+ * Core implementation of expression object handling
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "disman/expr/expObject.h"
+#include "disman/expr/expExpression.h"
+
+netsnmp_tdata *expObject_table_data;
+
+ /*
+ * Initializes the container for the expression object table,
+ * regardless of which module is initialised first.
+ */
+void
+init_expObject_table_data(void)
+{
+ DEBUGMSGTL(("disman:expr:init", "init expObject container\n"));
+ if (!expObject_table_data) {
+ expObject_table_data = netsnmp_tdata_create_table("expObjectTable", 0);
+ DEBUGMSGTL(("disman:expr:init", "create expObject container (%x)\n",
+ expObject_table_data));
+ }
+}
+
+/* Initialize the expObject module */
+void
+init_expObject(void)
+{
+ init_expObject_table_data();
+}
+
+
+/*
+ * Create a new row in the object table
+ */
+struct expObject *
+expObject_createEntry(char *expOwner, char *expName, long expIndex, int fixed)
+{
+ netsnmp_tdata_row *row;
+
+ row = expObject_createRow(expOwner, expName, expIndex, fixed);
+ return row ? (struct expObject *)row->data : NULL;
+}
+
+netsnmp_tdata_row *
+expObject_createRow( char *expOwner, char *expName, long expIndex, int fixed)
+{
+ struct expObject *entry;
+ netsnmp_tdata_row *row;
+ size_t expOwner_len = (expOwner) ? strlen(expOwner) : 0;
+ size_t expName_len = (expName) ? strlen(expName) : 0;
+
+ /*
+ * Create the expObject entry, and the
+ * (table-independent) row wrapper structure...
+ */
+ entry = SNMP_MALLOC_TYPEDEF(struct expObject);
+ if (!entry)
+ return NULL;
+
+ row = netsnmp_tdata_create_row();
+ if (!row) {
+ SNMP_FREE(entry);
+ return NULL;
+ }
+ row->data = entry;
+
+ /*
+ * ... initialize this row with the indexes supplied
+ * and the default values for the row...
+ */
+ if (expOwner)
+ memcpy(entry->expOwner, expOwner, expOwner_len);
+ netsnmp_tdata_row_add_index(row, ASN_OCTET_STR,
+ entry->expOwner, expOwner_len);
+ if (expName)
+ memcpy(entry->expName, expName, expName_len);
+ netsnmp_tdata_row_add_index(row, ASN_OCTET_STR,
+ entry->expName, expName_len);
+ entry->expObjectIndex = expIndex;
+ netsnmp_tdata_row_add_index(row, ASN_INTEGER,
+ &entry->expObjectIndex, sizeof(long));
+
+ entry->expObjectSampleType = 1; /* absoluteValue */
+ entry->expObjDiscontinuityType = 1; /* timeTicks */
+ if (fixed)
+ entry->flags |= EXP_OBJ_FLAG_FIXED;
+
+ /*
+ * ... and insert the row into the table container.
+ */
+ netsnmp_tdata_add_row(expObject_table_data, row);
+ return row;
+}
+
+/*
+ * Remove a row from the expression object table
+ */
+void
+expObject_removeEntry(netsnmp_tdata_row * row)
+{
+ struct expObject *entry;
+
+ if (!row)
+ return; /* Nothing to remove */
+ entry = (struct expObject *)
+ netsnmp_tdata_remove_and_delete_row(expObject_table_data, row);
+ if (entry) {
+ if (entry->vars ) snmp_free_varbind( entry->vars );
+ if (entry->old_vars ) snmp_free_varbind( entry->old_vars );
+ if (entry->dvars ) snmp_free_varbind( entry->dvars );
+ if (entry->old_dvars ) snmp_free_varbind( entry->old_dvars );
+ if (entry->cvars ) snmp_free_varbind( entry->cvars );
+ SNMP_FREE(entry);
+ }
+}
+
+
+netsnmp_tdata_row *
+expObject_getFirst( char *expOwner, char *expName )
+{
+ netsnmp_tdata_row *row;
+ struct expObject *entry;
+ netsnmp_variable_list owner_var;
+ netsnmp_variable_list name_var;
+
+ if (!expOwner || !expName)
+ return NULL;
+
+ /*
+ * Find the first object entry that could potentially
+ * refer to the specified expression...
+ */
+ memset(&owner_var, 0, sizeof(netsnmp_variable_list));
+ memset(&name_var, 0, sizeof(netsnmp_variable_list));
+ snmp_set_var_typed_value( &owner_var, ASN_OCTET_STR,
+ (u_char*)expOwner, strlen(expOwner));
+ snmp_set_var_typed_value( &name_var, ASN_OCTET_STR,
+ (u_char*)expName, strlen(expName));
+ owner_var.next_variable = &name_var;
+ row = netsnmp_tdata_row_next_byidx( expObject_table_data, &owner_var );
+
+ /*
+ * ... and check that it does!
+ */
+ if (!row || !row->data)
+ return NULL;
+ entry = (struct expObject *)row->data;
+
+ if ((strcmp( entry->expOwner, expOwner ) != 0) ||
+ (strcmp( entry->expName, expName ) != 0))
+ return NULL;
+
+ return row;
+}
+
+netsnmp_tdata_row *
+expObject_getNext( netsnmp_tdata_row *thisRow )
+{
+ struct expObject *thisEntry;
+ struct expObject *nextEntry;
+ netsnmp_tdata_row *nextRow;
+
+ if (!thisRow || !thisRow->data)
+ return NULL;
+ thisEntry = (struct expObject *)thisRow->data;
+
+ /*
+ * Retrieve the next row, and check whether this
+ * refers to the same expression too.
+ */
+ nextRow = netsnmp_tdata_row_next( expObject_table_data, thisRow );
+
+ if (!nextRow || !nextRow->data)
+ return NULL;
+ nextEntry = (struct expObject *)nextRow->data;
+
+ if ((strcmp( nextEntry->expOwner, thisEntry->expOwner ) != 0) ||
+ (strcmp( nextEntry->expName, thisEntry->expName ) != 0))
+ return NULL;
+
+ return nextRow;
+}
+
+
+netsnmp_variable_list *
+_expObject_buildList( oid *root, size_t root_len, size_t prefix_len,
+ netsnmp_variable_list *template_list )
+{
+ netsnmp_variable_list *query_list = NULL;
+ netsnmp_variable_list *vp1, *vp2 = NULL;
+ oid name[ MAX_OID_LEN ];
+ int i;
+
+ if ( prefix_len ) {
+ /*
+ * For wildcarded objects, build a list of all relevant
+ * instances, using the template_list to provide the
+ * necessary instance suffixes.
+ */
+ memset( name, 0, sizeof(name));
+ memcpy( name, root, root_len*sizeof(oid));
+ for ( vp1 = template_list; vp1; vp1=vp1->next_variable ) {
+ /*
+ * Append a new varbind to the list for this object ...
+ */
+ if ( !query_list ) {
+ query_list = (netsnmp_variable_list*)
+ SNMP_MALLOC_TYPEDEF( netsnmp_variable_list );
+ vp2 = query_list;
+ } else {
+ vp2->next_variable = (netsnmp_variable_list*)
+ SNMP_MALLOC_TYPEDEF( netsnmp_variable_list );
+ vp2 = vp2->next_variable;
+ }
+ /*
+ * ... and set the OID using the template suffix
+ */
+ for ( i=0; i <= vp1->name_length - prefix_len; i++)
+ name[ root_len+i ] = vp1->name[ prefix_len+i ];
+ snmp_set_var_objid( vp2, name, root_len+i );
+ }
+ } else {
+ /*
+ * Otherwise, just use the (single) OID provided.
+ */
+ query_list = (netsnmp_variable_list*)
+ SNMP_MALLOC_TYPEDEF( netsnmp_variable_list );
+ snmp_set_var_objid( query_list, root, root_len );
+ }
+ return query_list;
+}
+
+
+void
+expObject_getData( struct expExpression *expr, struct expObject *obj )
+{
+ netsnmp_variable_list *var;
+ int res;
+
+ /*
+ * Retrieve and store the basic object value(s)
+ * (keeping the previous values if necessary)
+ */
+ if (obj->flags & EXP_OBJ_FLAG_PREFIX ) {
+ /*
+ * If this is the expExpressionPrefix object, then
+ * we already have the necessary list of values.
+ * There's no need to retrieve it again.
+ * This also takes care of releasing the prefix list
+ * once the results are no longer needed.
+ */
+ var = expr->pvars;
+ } else {
+ if (!(obj->flags & EXP_OBJ_FLAG_OWILD ))
+ /*
+ * Set up the request 'list' for an
+ * exact (non-wildcarded) object.
+ */
+ var = _expObject_buildList( obj->expObjectID,
+ obj->expObjectID_len, 0, NULL );
+ else {
+ if ( !expr->expPrefix_len ) {
+ /*
+ * You can't really have wildcarded objects unless
+ * the expression as a whole is wildcarded too.
+ */
+ return;
+ }
+ /*
+ * Set up the request list for a wildcarded object
+ */
+ var = _expObject_buildList( obj->expObjectID,
+ obj->expObjectID_len,
+ expr->expPrefix_len,
+ expr->pvars );
+ }
+ res = netsnmp_query_get( var, expr->session );
+ }
+
+ if ( obj->expObjectSampleType != EXPSAMPLETYPE_ABSOLUTE ) {
+ /*
+ * For Delta (and Changed) samples, we need
+ * to store the previous value as well.
+ */
+ if ( obj->old_vars )
+ snmp_free_varbind( obj->old_vars );
+ obj->old_vars = obj->vars;
+ } else
+ snmp_free_varbind( obj->vars );
+
+ obj->vars = var;
+
+
+ /*
+ * For Delta samples, there may be a discontinuity marker
+ * (or set of wildcarded markers) to be sampled as well.
+ * This necessarily requires storing the previous marker(s).
+ */
+ if (( obj->expObjectSampleType != EXPSAMPLETYPE_ABSOLUTE ) &&
+ ( obj->flags & EXP_OBJ_FLAG_DDISC )) {
+
+ if ( obj->flags & EXP_OBJ_FLAG_DWILD )
+ var = _expObject_buildList( obj->expObjDeltaD,
+ obj->expObjDeltaD_len,
+ expr->expPrefix_len,
+ expr->pvars );
+ else
+ var = _expObject_buildList( obj->expObjDeltaD,
+ obj->expObjDeltaD_len, 0, NULL );
+ res = netsnmp_query_get( var, expr->session );
+ if ( obj->old_dvars )
+ snmp_free_varbind( obj->old_dvars );
+ obj->old_dvars = obj->dvars;
+ obj->dvars = var;
+ }
+
+ /*
+ * If there's an expObjectConditional value specified
+ * (or set of wildcarded values) then add these to the
+ * ever-growing collection of retrieved values.
+ */
+ if ( obj->expObjCond_len ) {
+ if ( obj->flags & EXP_OBJ_FLAG_CWILD )
+ var = _expObject_buildList( obj->expObjCond,
+ obj->expObjCond_len,
+ expr->expPrefix_len,
+ expr->pvars );
+ else
+ var = _expObject_buildList( obj->expObjCond,
+ obj->expObjCond_len, 0, NULL );
+ /*
+ * XXX - Check when to use GetNext
+ *
+ * (The MIB description seems bogus?)
+ */
+ res = netsnmp_query_get( var, expr->session );
+ if ( obj->cvars )
+ snmp_free_varbind( obj->cvars );
+ obj->cvars = var;
+ }
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObject.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObject.h
new file mode 100644
index 0000000000..5b386c2df0
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObject.h
@@ -0,0 +1,77 @@
+#ifndef EXPOBJECT_H
+#define EXPOBJECT_H
+
+#include "disman/expr/expExpression.h"
+
+ /*
+ * Flags relating to the expression object table
+ */
+#define EXP_OBJ_FLAG_OWILD 0x01 /* for expObjectIDWildcard */
+#define EXP_OBJ_FLAG_DDISC 0x02 /* non-trivial expObjDiscontinuityID */
+#define EXP_OBJ_FLAG_DWILD 0x04 /* for expObjDiscontinuityIDWildcard */
+#define EXP_OBJ_FLAG_CWILD 0x08 /* for expObjConditionalWildcard */
+#define EXP_OBJ_FLAG_PREFIX 0x10 /* expExpressionPrefix object */
+#define EXP_OBJ_FLAG_ACTIVE 0x20 /* for expObjectEntryStatus */
+#define EXP_OBJ_FLAG_FIXED 0x40 /* for snmpd.conf persistence */
+#define EXP_OBJ_FLAG_VALID 0x80 /* for row creation/undo */
+
+ /*
+ * Standard lengths for various Expression-MIB OCTET STRING objects:
+ * short tags ( 32 characters)
+ * SnmpAdminString-style values (255 characters)
+ * "long" DisplayString values (1024 characters)
+ */
+#define EXP_STR1_LEN 32
+#define EXP_STR2_LEN 255
+#define EXP_STR3_LEN 1024
+
+/*
+ * Data structure for an expObject row.
+ */
+struct expObject {
+ /*
+ * Index values
+ */
+ char expOwner[ EXP_STR1_LEN+1 ];
+ char expName[ EXP_STR1_LEN+1 ];
+ u_long expObjectIndex;
+
+ /*
+ * Column values
+ */
+ oid expObjectID[ MAX_OID_LEN ];
+ oid expObjDeltaD[ MAX_OID_LEN ];
+ oid expObjCond[ MAX_OID_LEN ];
+ size_t expObjectID_len;
+ size_t expObjDeltaD_len;
+ size_t expObjCond_len;
+ long expObjectSampleType;
+ long expObjDiscontinuityType;
+
+ netsnmp_variable_list *vars, *old_vars;
+ netsnmp_variable_list *dvars, *old_dvars;
+ netsnmp_variable_list *cvars, *old_cvars;
+
+ long flags;
+};
+
+ /*
+ * Container structure for the expObjectTable,
+ * and initialisation routine to create this.
+ */
+extern netsnmp_tdata *expObject_table_data;
+void init_expObject_table_data(void);
+
+/*
+ * function declarations
+ */
+void init_expObject(void);
+struct expObject * expObject_createEntry( char *, char *, long, int );
+netsnmp_tdata_row * expObject_createRow( char *, char *, long, int );
+void expObject_removeEntry( netsnmp_tdata_row * );
+
+netsnmp_tdata_row * expObject_getFirst( char *, char * );
+netsnmp_tdata_row * expObject_getNext( netsnmp_tdata_row * );
+void expObject_getData( struct expExpression *,
+ struct expObject * );
+#endif /* EXPOBJECT_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObjectConf.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObjectConf.c
new file mode 100644
index 0000000000..bac37825f5
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObjectConf.c
@@ -0,0 +1,182 @@
+/*
+ * DisMan Expression MIB:
+ * Implementation of the object table configuration handling.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "utilities/iquery.h"
+#include "disman/expr/expObject.h"
+#include "disman/expr/expObjectConf.h"
+
+/* Initializes the expObjectConf module */
+void
+init_expObjectConf(void)
+{
+ init_expObject_table_data();
+
+ /*
+ * Register config handler for persistent storage
+ * of dynamically configured entries.
+ */
+ snmpd_register_config_handler("_expOTable", parse_expOTable, NULL, NULL);
+
+ /*
+ * Register to save (non-fixed) entries when the agent shuts down
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_expOTable, NULL);
+}
+
+
+
+/* ================================================
+ *
+ * Handlers for loading/storing persistent expression entries
+ *
+ * ================================================ */
+
+char *
+_parse_expOCols( char *line, struct expObject *entry )
+{
+ void *vp;
+ size_t tmp;
+
+ vp = entry->expObjectID;
+ entry->expObjectID_len = MAX_OID_LEN;
+ line = read_config_read_data(ASN_OBJECT_ID, line, &vp,
+ &entry->expObjectID_len);
+
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ entry->expObjectSampleType = tmp;
+
+ vp = entry->expObjDeltaD;
+ entry->expObjDeltaD_len = MAX_OID_LEN;
+ line = read_config_read_data(ASN_OBJECT_ID, line, &vp,
+ &entry->expObjDeltaD_len);
+
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ entry->expObjDiscontinuityType = tmp;
+
+ vp = entry->expObjCond;
+ entry->expObjCond_len = MAX_OID_LEN;
+ line = read_config_read_data(ASN_OBJECT_ID, line, &vp,
+ &entry->expObjCond_len);
+
+ line = read_config_read_data(ASN_UNSIGNED, line, &tmp, NULL);
+ entry->flags |= tmp;
+
+ return line;
+}
+
+
+void
+parse_expOTable(const char *token, char *line)
+{
+ char owner[EXP_STR1_LEN+1];
+ char oname[EXP_STR1_LEN+1];
+ long idx;
+ void *vp;
+ size_t len;
+ struct expObject *entry;
+
+ DEBUGMSGTL(("disman:expr:conf", "Parsing mteObjectTable config... "));
+
+ /*
+ * Read in the index information for this entry
+ * and create a (non-fixed) data structure for it.
+ */
+ memset( owner, 0, sizeof(owner));
+ memset( oname, 0, sizeof(oname));
+ len = EXP_STR1_LEN; vp = owner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = EXP_STR1_LEN; vp = oname;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ line = read_config_read_data(ASN_UNSIGNED, line, &idx, NULL);
+ entry = expObject_createEntry( owner, oname, idx, 0 );
+
+ DEBUGMSG(("disman:expr:conf", "(%s, %s, %d) ", owner, oname, idx));
+
+ /*
+ * Read in the accessible column values.
+ */
+ line = _parse_expOCols( line, entry );
+ /*
+ * XXX - Will need to read in the 'iquery' access information
+ */
+ entry->flags |= EXP_OBJ_FLAG_VALID;
+
+ DEBUGMSG(("disman:expr:conf", "\n"));
+}
+
+
+int
+store_expOTable(int majorID, int minorID, void *serverarg, void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr;
+ void *vp;
+ size_t tint;
+ netsnmp_tdata_row *row;
+ struct expObject *entry;
+
+
+ DEBUGMSGTL(("disman:expr:conf", "Storing expObjectTable config:\n"));
+
+ for (row = netsnmp_tdata_row_first( expObject_table_data );
+ row;
+ row = netsnmp_tdata_row_next( expObject_table_data, row )) {
+
+ /*
+ * Skip entries that were set up via static config directives
+ */
+ entry = (struct expObject *)netsnmp_tdata_row_entry( row );
+ if ( entry->flags & EXP_OBJ_FLAG_FIXED )
+ continue;
+
+ DEBUGMSGTL(("disman:expr:conf", " Storing (%s %s %d)\n",
+ entry->expOwner, entry->expName, entry->expObjectIndex));
+
+ /*
+ * Save the basic expObject entry, indexes...
+ */
+ memset(line, 0, sizeof(line));
+ strcat(line, "_expOTable ");
+ cptr = line + strlen(line);
+
+ vp = entry->expOwner; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->expName; tint = strlen( vp );
+ cptr = read_config_store_data( ASN_OCTET_STR, cptr, &vp, &tint );
+ tint = entry->expObjectIndex;
+ cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL );
+
+ /*
+ * ... and column values.
+ */
+ vp = entry->expObjectID;
+ tint = entry->expObjectID_len;
+ cptr = read_config_store_data( ASN_OBJECT_ID, cptr, &vp, &tint );
+ tint = entry->expObjectSampleType;
+ cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL );
+
+ vp = entry->expObjDeltaD;
+ tint = entry->expObjDeltaD_len;
+ cptr = read_config_store_data( ASN_OBJECT_ID, cptr, &vp, &tint );
+ tint = entry->expObjDiscontinuityType;
+ cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL );
+
+ vp = entry->expObjCond;
+ tint = entry->expObjCond_len;
+ cptr = read_config_store_data( ASN_OBJECT_ID, cptr, &vp, &tint );
+
+ tint = entry->flags;
+ cptr = read_config_store_data( ASN_UNSIGNED, cptr, &tint, NULL );
+
+ snmpd_store_config(line);
+ }
+
+ DEBUGMSGTL(("disman:expr:conf", " done.\n"));
+ return SNMPERR_SUCCESS;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObjectConf.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObjectConf.h
new file mode 100644
index 0000000000..8a67cca92f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObjectConf.h
@@ -0,0 +1,9 @@
+#ifndef EXPOBJECTCONF_H
+#define EXPOBJECTCONF_H
+
+void init_expObjectConf(void);
+
+void parse_expOTable(const char *, char *);
+SNMPCallback store_expOTable;
+
+#endif /* EXPOBJECTCONF_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObjectTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObjectTable.c
new file mode 100644
index 0000000000..e5c189fe48
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObjectTable.c
@@ -0,0 +1,436 @@
+/*
+ * DisMan Expression MIB:
+ * Implementation of the expExpressionObjectTable MIB interface
+ * See 'expObject.c' for active behaviour of this table.
+ *
+ * (Based on mib2c.table_data.conf output)
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "disman/expr/expObject.h"
+#include "disman/expr/expObjectTable.h"
+
+
+/* Initializes the expObjectTable module */
+void
+init_expObjectTable(void)
+{
+ static oid expObjectTable_oid[] = { 1, 3, 6, 1, 2, 1, 90, 1, 2, 3 };
+ size_t expObjectTable_oid_len = OID_LENGTH(expObjectTable_oid);
+ netsnmp_handler_registration *reg;
+ netsnmp_table_registration_info *table_info;
+
+ /*
+ * Ensure the expObject table container is available...
+ */
+ init_expObject_table_data();
+
+ /*
+ * ... then set up the MIB interface to the expObjectTable
+ */
+ reg = netsnmp_create_handler_registration("expObjectTable",
+ expObjectTable_handler,
+ expObjectTable_oid,
+ expObjectTable_oid_len,
+ HANDLER_CAN_RWRITE);
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ netsnmp_table_helper_add_indexes(table_info,
+ /* index: expExpressionOwner */
+ ASN_OCTET_STR,
+ /* index: expExpressionName */
+ ASN_OCTET_STR,
+ /* index: expObjectIndex */
+ ASN_UNSIGNED,
+ 0);
+
+ table_info->min_column = COLUMN_EXPOBJECTID;
+ table_info->max_column = COLUMN_EXPOBJECTENTRYSTATUS;
+
+ /* Register this using the common expObject_table_data container */
+ netsnmp_tdata_register(reg, expObject_table_data, table_info);
+ DEBUGMSGTL(("disman:expr:init", "Expression Object Table container (%x)\n",
+ expObject_table_data));
+}
+
+
+/** handles requests for the expObjectTable table */
+int
+expObjectTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *tinfo;
+ netsnmp_tdata_row *row;
+ struct expObject *entry;
+ struct expExpression *exp;
+ char expOwner[EXP_STR1_LEN+1];
+ char expName[ EXP_STR1_LEN+1];
+ long objIndex;
+ long ret;
+ netsnmp_variable_list *vp;
+
+ DEBUGMSGTL(("disman:expr:mib", "Expression Object Table handler (%d)\n",
+ reqinfo->mode));
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ entry = (struct expObject *)netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+ if (!entry || !(entry->flags & EXP_OBJ_FLAG_VALID))
+ continue;
+
+ switch (tinfo->colnum) {
+ case COLUMN_EXPOBJECTID:
+ snmp_set_var_typed_value(request->requestvb, ASN_OBJECT_ID,
+ (u_char *) entry->expObjectID,
+ entry->expObjectID_len*sizeof(oid));
+ break;
+ case COLUMN_EXPOBJECTIDWILDCARD:
+ ret = (entry->flags & EXP_OBJ_FLAG_OWILD) ?
+ TV_TRUE : TV_FALSE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ case COLUMN_EXPOBJECTSAMPLETYPE:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->expObjectSampleType);
+ break;
+ case COLUMN_EXPOBJECTDELTADISCONTINUITYID:
+ /*
+ * "This object [and the next two] are instantiated only if
+ * expObjectSampleType is 'deltaValue' or 'changedValue'"
+ */
+ if ( entry->expObjectSampleType == 1 )
+ continue;
+ snmp_set_var_typed_value(request->requestvb, ASN_OBJECT_ID,
+ (u_char *) entry->expObjDeltaD,
+ entry->expObjDeltaD_len*sizeof(oid));
+ break;
+ case COLUMN_EXPOBJECTDISCONTINUITYIDWILDCARD:
+ if ( entry->expObjectSampleType == 1 )
+ continue;
+ ret = (entry->flags & EXP_OBJ_FLAG_DWILD) ?
+ TV_TRUE : TV_FALSE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ case COLUMN_EXPOBJECTDISCONTINUITYIDTYPE:
+ if ( entry->expObjectSampleType == 1 )
+ continue;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->expObjDiscontinuityType);
+ break;
+ case COLUMN_EXPOBJECTCONDITIONAL:
+ snmp_set_var_typed_value(request->requestvb, ASN_OBJECT_ID,
+ (u_char *) entry->expObjCond,
+ entry->expObjCond_len*sizeof(oid));
+ break;
+ case COLUMN_EXPOBJECTCONDITIONALWILDCARD:
+ ret = (entry->flags & EXP_OBJ_FLAG_CWILD) ?
+ TV_TRUE : TV_FALSE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ case COLUMN_EXPOBJECTENTRYSTATUS:
+ /* What would indicate 'notReady' ? */
+ ret = (entry->flags & EXP_OBJ_FLAG_ACTIVE) ?
+ RS_ACTIVE : RS_NOTINSERVICE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ }
+ }
+ break;
+
+ /*
+ * Write-support
+ */
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request = request->next) {
+ entry = (struct expObject *)
+ netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_EXPOBJECTID:
+ case COLUMN_EXPOBJECTDELTADISCONTINUITYID:
+ case COLUMN_EXPOBJECTCONDITIONAL:
+ ret = netsnmp_check_vb_oid(request->requestvb);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+
+ case COLUMN_EXPOBJECTIDWILDCARD:
+ case COLUMN_EXPOBJECTDISCONTINUITYIDWILDCARD:
+ case COLUMN_EXPOBJECTCONDITIONALWILDCARD:
+ ret = netsnmp_check_vb_truthvalue(request->requestvb);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+
+ case COLUMN_EXPOBJECTSAMPLETYPE:
+ case COLUMN_EXPOBJECTDISCONTINUITYIDTYPE:
+ ret = netsnmp_check_vb_int_range(request->requestvb, 1, 3);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+
+ case COLUMN_EXPOBJECTENTRYSTATUS:
+ ret = netsnmp_check_vb_rowstatus(request->requestvb,
+ (entry ? RS_ACTIVE : RS_NONEXISTENT));
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_EXPOBJECTENTRYSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ /*
+ * Create an (empty) new row structure
+ */
+ memset(expOwner, 0, sizeof(expOwner));
+ memcpy(expOwner, tinfo->indexes->val.string,
+ tinfo->indexes->val_len);
+ memset(expName, 0, sizeof(expName));
+ memcpy(expName,
+ tinfo->indexes->next_variable->val.string,
+ tinfo->indexes->next_variable->val_len);
+ vp = tinfo->indexes->next_variable->next_variable;
+ objIndex = *vp->val.integer;
+
+ row = expObject_createRow(expOwner, expName, objIndex, 0);
+ if (!row) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ return SNMP_ERR_NOERROR;
+ }
+ netsnmp_insert_tdata_row( request, row );
+ }
+ }
+ }
+ break;
+
+ case MODE_SET_FREE:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_EXPOBJECTENTRYSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ /*
+ * Tidy up after a failed row creation request
+ */
+ entry = (struct expObject *)
+ netsnmp_tdata_extract_entry(request);
+ if (entry &&
+ !(entry->flags & EXP_OBJ_FLAG_VALID)) {
+ row = (netsnmp_tdata_row *)
+ netsnmp_tdata_extract_row(request);
+ expObject_removeEntry( row );
+ }
+ }
+ }
+ }
+ break;
+
+ case MODE_SET_ACTION:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+ entry = (struct expObject *)
+ netsnmp_tdata_extract_entry(request);
+ if (!entry) {
+ /*
+ * New rows must be created via the RowStatus column
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOCREATION);
+ /* or inconsistentName? */
+ return SNMP_ERR_NOERROR;
+
+ }
+ }
+ break;
+
+ case MODE_SET_UNDO:
+ break;
+
+ case MODE_SET_COMMIT:
+ /*
+ * All these assignments are "unfailable", so it's
+ * (reasonably) safe to apply them in the Commit phase
+ */
+ ret = 0; /* Flag to re-check expExpressionPrefix settings */
+ for (request = requests; request; request = request->next) {
+ entry = (struct expObject *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_EXPOBJECTID:
+ memset(entry->expObjectID, 0, sizeof(entry->expObjectID));
+ memcpy(entry->expObjectID, request->requestvb->val.string,
+ request->requestvb->val_len);
+ entry->expObjectID_len = request->requestvb->val_len;
+ break;
+ case COLUMN_EXPOBJECTIDWILDCARD:
+ if (*request->requestvb->val.integer == TV_TRUE)
+ entry->flags |= EXP_OBJ_FLAG_OWILD;
+ else
+ entry->flags &= ~EXP_OBJ_FLAG_OWILD;
+ break;
+ case COLUMN_EXPOBJECTSAMPLETYPE:
+ entry->expObjectSampleType = *request->requestvb->val.integer;
+ break;
+ case COLUMN_EXPOBJECTDELTADISCONTINUITYID:
+ memset(entry->expObjDeltaD, 0, sizeof(entry->expObjDeltaD));
+ memcpy(entry->expObjDeltaD, request->requestvb->val.string,
+ request->requestvb->val_len);
+ entry->expObjDeltaD_len = request->requestvb->val_len/sizeof(oid);
+ /* XXX
+ if ( snmp_oid_compare( entry->expObjDeltaD,
+ entry->expObjDeltaD_len,
+ sysUpTime_inst,
+ sysUpTime_inst_len ) != 0 )
+ entry->flags |= EXP_OBJ_FLAG_DDISC;
+ */
+
+ /*
+ * If the OID used for the expExpressionPrefix object
+ * has changed, then update the expression structure.
+ */
+ if ( entry->flags & EXP_OBJ_FLAG_PREFIX ) {
+ exp = expExpression_getEntry( entry->expOwner,
+ entry->expName );
+ memcpy( exp->expPrefix, entry->expObjDeltaD,
+ MAX_OID_LEN*sizeof(oid));
+ exp->expPrefix_len = entry->expObjDeltaD_len;
+ }
+ break;
+ case COLUMN_EXPOBJECTDISCONTINUITYIDWILDCARD:
+ if (*request->requestvb->val.integer == TV_TRUE) {
+ /*
+ * Possible new prefix OID candidate
+ * Can't set the value here, since the OID
+ * assignment might not have been processed yet.
+ */
+ exp = expExpression_getEntry( entry->expOwner,
+ entry->expName );
+ if (exp && exp->expPrefix_len == 0 )
+ ret = 1; /* Set the prefix later */
+ entry->flags |= EXP_OBJ_FLAG_DWILD;
+ } else {
+ if ( entry->flags | EXP_OBJ_FLAG_PREFIX ) {
+ exp = expExpression_getEntry( entry->expOwner,
+ entry->expName );
+ memset( exp->expPrefix, 0, MAX_OID_LEN*sizeof(oid));
+ exp->expPrefix_len = 0;
+ ret = 1; /* Need a new prefix OID */
+ }
+ entry->flags &= ~EXP_OBJ_FLAG_DWILD;
+ }
+ break;
+ case COLUMN_EXPOBJECTDISCONTINUITYIDTYPE:
+ entry->expObjDiscontinuityType =
+ *request->requestvb->val.integer;
+ break;
+ case COLUMN_EXPOBJECTCONDITIONAL:
+ memset(entry->expObjCond, 0, sizeof(entry->expObjCond));
+ memcpy(entry->expObjCond, request->requestvb->val.string,
+ request->requestvb->val_len);
+ entry->expObjCond_len = request->requestvb->val_len/sizeof(oid);
+ break;
+ case COLUMN_EXPOBJECTCONDITIONALWILDCARD:
+ if (*request->requestvb->val.integer == TV_TRUE)
+ entry->flags |= EXP_OBJ_FLAG_CWILD;
+ else
+ entry->flags &= ~EXP_OBJ_FLAG_CWILD;
+ break;
+ case COLUMN_EXPOBJECTENTRYSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_ACTIVE:
+ entry->flags |= EXP_OBJ_FLAG_ACTIVE;
+ break;
+ case RS_NOTINSERVICE:
+ entry->flags &= ~EXP_OBJ_FLAG_ACTIVE;
+ break;
+ case RS_CREATEANDGO:
+ entry->flags |= EXP_OBJ_FLAG_ACTIVE;
+ entry->flags |= EXP_OBJ_FLAG_VALID;
+ break;
+ case RS_CREATEANDWAIT:
+ entry->flags |= EXP_OBJ_FLAG_VALID;
+ break;
+
+ case RS_DESTROY:
+ row = (netsnmp_tdata_row *)
+ netsnmp_tdata_extract_row(request);
+ expObject_removeEntry(row);
+ }
+ }
+ }
+
+ /*
+ * Need to check for changes in expExpressionPrefix handling
+ */
+ for (request = requests; request; request = request->next) {
+ entry = (struct expObject *) netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_EXPOBJECTDISCONTINUITYIDWILDCARD:
+ /*
+ * If a column has just been marked as wild,
+ * then consider using it as the prefix OID
+ */
+ if (*request->requestvb->val.integer == TV_TRUE) {
+ exp = expExpression_getEntry( entry->expOwner,
+ entry->expName );
+ if ( exp->expPrefix_len == 0 ) {
+ memcpy( exp->expPrefix, entry->expObjDeltaD,
+ MAX_OID_LEN*sizeof(oid));
+ exp->expPrefix_len = entry->expObjDeltaD_len;
+ entry->flags |= EXP_OBJ_FLAG_PREFIX;
+ }
+ }
+ /*
+ * If it's just been marked as non-wildcarded
+ * then we need to look for a new candidate.
+ */
+ else {
+
+ }
+ break;
+ }
+ }
+ break;
+ }
+ DEBUGMSGTL(("disman:expr:mib", "Expression Object handler - done \n"));
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObjectTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObjectTable.h
new file mode 100644
index 0000000000..568f67a443
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expObjectTable.h
@@ -0,0 +1,27 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.table_data.conf,v 1.11 2005/09/16 11:48:12 dts12 Exp $
+ */
+#ifndef EXPOBJECTTABLE_H
+#define EXPOBJECTTABLE_H
+
+/*
+ * function declarations
+ */
+void init_expObjectTable(void);
+Netsnmp_Node_Handler expObjectTable_handler;
+
+/*
+ * column number definitions for table expObjectTable
+ */
+#define COLUMN_EXPOBJECTINDEX 1
+#define COLUMN_EXPOBJECTID 2
+#define COLUMN_EXPOBJECTIDWILDCARD 3
+#define COLUMN_EXPOBJECTSAMPLETYPE 4
+#define COLUMN_EXPOBJECTDELTADISCONTINUITYID 5
+#define COLUMN_EXPOBJECTDISCONTINUITYIDWILDCARD 6
+#define COLUMN_EXPOBJECTDISCONTINUITYIDTYPE 7
+#define COLUMN_EXPOBJECTCONDITIONAL 8
+#define COLUMN_EXPOBJECTCONDITIONALWILDCARD 9
+#define COLUMN_EXPOBJECTENTRYSTATUS 10
+#endif /* EXPOBJECTTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expScalars.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expScalars.c
new file mode 100644
index 0000000000..4a3ebc7008
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expScalars.c
@@ -0,0 +1,97 @@
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "expScalars.h"
+#include "expExpression.h"
+
+/** Initializes the expScalars module */
+void
+init_expScalars(void)
+{
+ static oid expResource_oid[] = { 1, 3, 6, 1, 2, 1, 90, 1, 1 };
+
+ DEBUGMSGTL(("expScalars", "Initializing\n"));
+
+ netsnmp_register_scalar_group(
+ netsnmp_create_handler_registration("expResource",
+ handle_expResourceGroup,
+ expResource_oid, OID_LENGTH(expResource_oid),
+ HANDLER_CAN_RONLY),
+ EXP_RESOURCE_MIN_DELTA, EXP_RESOURCE_SAMPLE_LACKS);
+
+}
+
+int
+handle_expResourceGroup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ oid obj;
+ long value = 0;
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ obj = requests->requestvb->name[ requests->requestvb->name_length-2 ];
+ switch (obj) {
+ case EXP_RESOURCE_MIN_DELTA:
+ value = 1; /* Fixed minimum sample frequency */
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
+ (u_char *)&value, sizeof(value));
+ break;
+
+ case EXP_RESOURCE_SAMPLE_MAX:
+ value = 0; /* No fixed maximum */
+ snmp_set_var_typed_value(requests->requestvb, ASN_UNSIGNED,
+ (u_char *)&value, sizeof(value));
+ break;
+
+ case EXP_RESOURCE_SAMPLE_INSTANCES:
+#ifdef USING_DISMAN_EXPR_EXPEXPRESSION_MODULE
+ value = expExpression_getNumEntries(0);
+#else
+ value = 0;
+#endif
+ snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE,
+ (u_char *)&value, sizeof(value));
+ break;
+
+ case EXP_RESOURCE_SAMPLE_HIGH:
+#ifdef USING_DISMAN_EXPR_EXPEXPRESSION_MODULE
+ value = expExpression_getNumEntries(1);
+#else
+ value = 0;
+#endif
+ snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE,
+ (u_char *)&value, sizeof(value));
+ break;
+
+ case EXP_RESOURCE_SAMPLE_LACKS:
+ value = 0; /* expResSampleInstMax not used */
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *)&value, sizeof(value));
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown object (%d) in handle_expResourceGroup\n", (int)obj);
+ return SNMP_ERR_GENERR;
+ }
+ break;
+
+ default:
+ /*
+ * Although expResourceDeltaMinimum and expResDeltaWildcardInstMaximum
+ * are defined with MAX-ACCESS read-write, this version hardcodes
+ * these values, so doesn't need to implement write access.
+ */
+ snmp_log(LOG_ERR,
+ "unknown mode (%d) in handle_expResourceGroup\n",
+ reqinfo->mode);
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expScalars.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expScalars.h
new file mode 100644
index 0000000000..022e01be67
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expScalars.h
@@ -0,0 +1,13 @@
+#ifndef EXPSCALARS_H
+#define EXPSCALARS_H
+
+void init_expScalars(void);
+Netsnmp_Node_Handler handle_expResourceGroup;
+
+#define EXP_RESOURCE_MIN_DELTA 1
+#define EXP_RESOURCE_SAMPLE_MAX 2
+#define EXP_RESOURCE_SAMPLE_INSTANCES 3
+#define EXP_RESOURCE_SAMPLE_HIGH 4
+#define EXP_RESOURCE_SAMPLE_LACKS 5
+
+#endif /* EXPSCALARS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expValue.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expValue.c
new file mode 100644
index 0000000000..98f1c502c0
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expValue.c
@@ -0,0 +1,808 @@
+/*
+ * DisMan Expression MIB:
+ * Core implementation of expression evaluation
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "disman/expr/expExpression.h"
+#include "disman/expr/expObject.h"
+#include "disman/expr/expValue.h"
+
+#include <ctype.h>
+
+void _expValue_setError( struct expExpression *exp, int reason,
+ oid *suffix, size_t suffix_len,
+ netsnmp_variable_list *var);
+
+
+#define ASN_PRIV_OPERATOR (ASN_PRIVATE | 0x0f)
+#define ASN_PRIV_FUNCTION (ASN_PRIVATE | 0x0e)
+
+int ops[128]; /* mapping from operator characters to numeric
+ tokens (ordered by priority). */
+
+void
+init_expValue(void)
+{
+DEBUGMSGTL(("disman:expr:eval", "Init expValue"));
+ /* Single-character operators */
+ ops['+'] = EXP_OPERATOR_ADD;
+ ops['-'] = EXP_OPERATOR_SUBTRACT;
+ ops['*'] = EXP_OPERATOR_MULTIPLY;
+ ops['/'] = EXP_OPERATOR_DIVIDE;
+ ops['%'] = EXP_OPERATOR_REMAINDER;
+ ops['^'] = EXP_OPERATOR_BITXOR;
+ ops['~'] = EXP_OPERATOR_BITNEGATE;
+ ops['|'] = EXP_OPERATOR_BITOR;
+ ops['&'] = EXP_OPERATOR_BITAND;
+ ops['!'] = EXP_OPERATOR_NOT;
+ ops['<'] = EXP_OPERATOR_LESS;
+ ops['>'] = EXP_OPERATOR_GREAT;
+
+ /*
+ * Arbitrary offsets, chosen so
+ * the three blocks don't overlap.
+ */
+ /* "X=" operators */
+ ops['='+20] = EXP_OPERATOR_EQUAL;
+ ops['!'+20] = EXP_OPERATOR_NOTEQ;
+ ops['<'+20] = EXP_OPERATOR_LESSEQ;
+ ops['>'+20] = EXP_OPERATOR_GREATEQ;
+
+ /* "XX" operators */
+ ops['|'-30] = EXP_OPERATOR_OR;
+ ops['&'-30] = EXP_OPERATOR_AND;
+ ops['<'-30] = EXP_OPERATOR_LSHIFT;
+ ops['>'-30] = EXP_OPERATOR_RSHIFT;
+}
+
+ /*
+ * Insert the value of the specified object parameter,
+ * using the instance 'suffix' for wildcarded objects.
+ */
+netsnmp_variable_list *
+_expValue_evalParam( netsnmp_variable_list *expIdx, int param,
+ oid *suffix, size_t suffix_len )
+{
+ netsnmp_variable_list *var = SNMP_MALLOC_TYPEDEF( netsnmp_variable_list );
+ struct expObject *obj;
+ netsnmp_variable_list *val_var = NULL, *oval_var = NULL; /* values */
+ netsnmp_variable_list *dd_var = NULL, *odd_var = NULL; /* deltaDs */
+ netsnmp_variable_list *cond_var = NULL; /* conditionals */
+ int n;
+
+ /*
+ * Retrieve the expObject entry for the requested parameter.
+ */
+ if ( !var || !expIdx || !expIdx->next_variable ||
+ !expIdx->next_variable->next_variable )
+ return NULL;
+
+ *expIdx->next_variable->next_variable->val.integer = param;
+ obj = (struct expObject *)
+ netsnmp_tdata_row_entry(
+ netsnmp_tdata_row_get_byidx( expObject_table_data, expIdx ));
+ if (!obj) {
+ /*
+ * No such parameter configured for this expression
+ */
+ snmp_set_var_typed_integer( var, ASN_INTEGER, EXPERRCODE_INDEX );
+ var->type = ASN_NULL;
+ return var;
+ }
+ if ( obj->expObjectSampleType != EXPSAMPLETYPE_ABSOLUTE &&
+ obj->old_vars == NULL ) {
+ /*
+ * Can't calculate delta values until the second pass
+ */
+ snmp_set_var_typed_integer( var, ASN_INTEGER, EXPERRCODE_RESOURCE );
+ var->type = ASN_NULL;
+ return var;
+ }
+
+
+ /*
+ * For a wildcarded object, search for the matching suffix.
+ */
+ val_var = obj->vars;
+ if ( obj->flags & EXP_OBJ_FLAG_OWILD ) {
+ if ( !suffix ) {
+ /*
+ * If there's no suffix to match against, throw an error.
+ * An exact expression with a wildcarded object is invalid.
+ * XXX - Or just use first entry?
+ */
+ snmp_set_var_typed_integer( var, ASN_INTEGER, EXPERRCODE_INDEX );
+ var->type = ASN_NULL;
+ return var;
+ }
+ /*
+ * Otherwise, we'll walk *all* wildcarded values in parallel.
+ * This relies on the various varbind lists being set up with
+ * exactly the same entries. A little extra preparation
+ * during the data gathering simplifies things significantly!
+ */
+ if ( obj->expObjectSampleType != EXPSAMPLETYPE_ABSOLUTE )
+ oval_var = obj->old_vars;
+ if ( obj->flags & EXP_OBJ_FLAG_DWILD ) {
+ dd_var = obj->dvars;
+ odd_var = obj->old_dvars;
+ }
+ if ( obj->flags & EXP_OBJ_FLAG_CWILD )
+ cond_var = obj->cvars;
+
+ n = obj->expObjectID_len;
+ while ( val_var ) {
+ if ( snmp_oid_compare( val_var->name+n, val_var->name_length-n,
+ suffix, suffix_len ))
+ break;
+ val_var = val_var->next_variable;
+ if (oval_var)
+ oval_var = oval_var->next_variable;
+ if (dd_var) {
+ dd_var = dd_var->next_variable;
+ odd_var = odd_var->next_variable;
+ }
+ if (cond_var)
+ cond_var = cond_var->next_variable;
+ }
+
+ }
+ if (!val_var) {
+ /*
+ * No matching entry
+ */
+ snmp_set_var_typed_integer( var, ASN_INTEGER, EXPERRCODE_INDEX );
+ var->type = ASN_NULL;
+ return var;
+ }
+ /*
+ * Set up any non-wildcarded values - some
+ * of which may be null. That's fine.
+ */
+ if (!oval_var)
+ oval_var = obj->old_vars;
+ if (!dd_var) {
+ dd_var = obj->dvars;
+ odd_var = obj->old_dvars;
+ }
+ if (!cond_var)
+ cond_var = obj->cvars;
+
+
+ /*
+ * ... and return the appropriate value.
+ */
+ if (obj->expObjCond_len &&
+ (!cond_var || *cond_var->val.integer == 0)) {
+ /*
+ * expObjectConditional says no
+ */
+ snmp_set_var_typed_integer( var, ASN_INTEGER, EXPERRCODE_INDEX );
+ var->type = ASN_NULL;
+ return var;
+ }
+ if (dd_var && odd_var &&
+ *dd_var->val.integer != *odd_var->val.integer) {
+ /*
+ * expObjectDeltaD says no
+ */
+ snmp_set_var_typed_integer( var, ASN_INTEGER, EXPERRCODE_INDEX );
+ var->type = ASN_NULL;
+ return var;
+ }
+
+ /*
+ * XXX - May need to check sysUpTime discontinuities
+ * (unless this is handled earlier....)
+ */
+ switch ( obj->expObjectSampleType ) {
+ case EXPSAMPLETYPE_ABSOLUTE:
+ snmp_clone_var( val_var, var );
+ break;
+ case EXPSAMPLETYPE_DELTA:
+ snmp_set_var_typed_integer( var, ASN_INTEGER /* or UNSIGNED? */,
+ *val_var->val.integer - *oval_var->val.integer );
+ break;
+ case EXPSAMPLETYPE_CHANGED:
+ if ( val_var->val_len != oval_var->val_len )
+ n = 1;
+ else if (memcmp( val_var->val.string, oval_var->val.string,
+ val_var->val_len ) != 0 )
+ n = 1;
+ else
+ n = 0;
+ snmp_set_var_typed_integer( var, ASN_UNSIGNED, n );
+ }
+ return var;
+}
+
+
+ /*
+ * Utility routine to parse (and skip over) an integer constant
+ */
+int
+_expParse_integer( char *start, char **end ) {
+ int n;
+ char *cp;
+
+ n = atoi(start);
+ for (cp=start; *cp; cp++)
+ if (!isdigit(*cp))
+ break;
+ *end = cp;
+ return n;
+}
+
+netsnmp_variable_list *
+_expValue_evalOperator(netsnmp_variable_list *left,
+ netsnmp_variable_list *op,
+ netsnmp_variable_list *right) {
+ int n;
+
+ switch( *op->val.integer ) {
+ case EXP_OPERATOR_ADD:
+ n = *left->val.integer + *right->val.integer; break;
+ case EXP_OPERATOR_SUBTRACT:
+ n = *left->val.integer - *right->val.integer; break;
+ case EXP_OPERATOR_MULTIPLY:
+ n = *left->val.integer * *right->val.integer; break;
+ case EXP_OPERATOR_DIVIDE:
+ n = *left->val.integer / *right->val.integer; break;
+ case EXP_OPERATOR_REMAINDER:
+ n = *left->val.integer % *right->val.integer; break;
+ case EXP_OPERATOR_BITXOR:
+ n = *left->val.integer ^ *right->val.integer; break;
+ case EXP_OPERATOR_BITNEGATE:
+ n = 99; /* *left->val.integer ~ *right->val.integer; */ break;
+ case EXP_OPERATOR_BITOR:
+ n = *left->val.integer | *right->val.integer; break;
+ case EXP_OPERATOR_BITAND:
+ n = *left->val.integer & *right->val.integer; break;
+ case EXP_OPERATOR_NOT:
+ n = 99; /* *left->val.integer ! *right->val.integer; */ break;
+ case EXP_OPERATOR_LESS:
+ n = *left->val.integer < *right->val.integer; break;
+ case EXP_OPERATOR_GREAT:
+ n = *left->val.integer > *right->val.integer; break;
+ case EXP_OPERATOR_EQUAL:
+ n = *left->val.integer == *right->val.integer; break;
+ case EXP_OPERATOR_NOTEQ:
+ n = *left->val.integer != *right->val.integer; break;
+ case EXP_OPERATOR_LESSEQ:
+ n = *left->val.integer <= *right->val.integer; break;
+ case EXP_OPERATOR_GREATEQ:
+ n = *left->val.integer >= *right->val.integer; break;
+ case EXP_OPERATOR_OR:
+ n = *left->val.integer || *right->val.integer; break;
+ case EXP_OPERATOR_AND:
+ n = *left->val.integer && *right->val.integer; break;
+ case EXP_OPERATOR_LSHIFT:
+ n = *left->val.integer << *right->val.integer; break;
+ case EXP_OPERATOR_RSHIFT:
+ n = *left->val.integer >> *right->val.integer; break;
+ break;
+ default:
+ left->next_variable = NULL;
+ snmp_free_var(left);
+ right->next_variable = NULL;
+ snmp_free_var(right);
+
+ snmp_set_var_typed_integer( op, ASN_INTEGER, EXPERRCODE_OPERATOR );
+ op->type = ASN_NULL;
+ return op;
+ }
+
+ /* XXX */
+ left->next_variable = NULL;
+ snmp_free_var(left);
+ op->next_variable = NULL;
+ snmp_free_var(op);
+ snmp_set_var_typed_integer( right, ASN_INTEGER, n );
+ return right;
+}
+
+netsnmp_variable_list *
+_expValue_evalFunction(netsnmp_variable_list *func) {
+ netsnmp_variable_list *params = func->next_variable;
+ /* XXX */
+ params->next_variable = NULL;
+ snmp_free_var(params);
+ snmp_set_var_typed_integer( func, ASN_INTEGER, 99 );
+ return func;
+}
+
+netsnmp_variable_list *_expValue_evalExpr2(netsnmp_variable_list *exprAlDente);
+netsnmp_variable_list *
+_expValue_evalExpr( netsnmp_variable_list *expIdx,
+ char *exprRaw, char **exprEnd,
+ oid *suffix, size_t suffix_len )
+{
+ netsnmp_variable_list *exprAlDente = NULL;
+ netsnmp_variable_list *vtail = NULL;
+ char *cp1, *cp2;
+ netsnmp_variable_list *var = NULL;
+ int i, n;
+ int neg = 0;
+ oid oid_buf[MAX_OID_LEN];
+
+ DEBUGMSGTL(("disman:expr:eval1", "Evaluating '%s'\n", exprRaw));
+ if (!expIdx || !exprRaw)
+ return NULL;
+
+ /*
+ * The expression is evaluated in two stages.
+ * First, we simplify ("parboil") the raw expression,
+ * tokenizing it into a sequence of varbind values, inserting
+ * object parameters, and (recursively) evaluating any
+ * parenthesised sub-expressions or function arguments.
+ */
+
+ for (cp1=exprRaw; cp1 && *cp1; ) {
+ switch (*cp1) {
+ case '$':
+ /*
+ * Locate the appropriate instance of the specified
+ * parameter, and insert the corresponding value.
+ */
+ n = _expParse_integer( cp1+1, &cp1 );
+ var = _expValue_evalParam( expIdx, n, suffix, suffix_len );
+ if ( var && var->type == ASN_NULL ) {
+ DEBUGMSGTL(("disman:expr:eval", "Invalid parameter '%d'\n", n));
+ /* Note position of failure in expression */
+ var->data = (void *)(cp1 - exprRaw);
+ snmp_free_var(exprAlDente);
+ return var;
+ } else {
+ if (vtail)
+ vtail->next_variable = var;
+ else
+ exprAlDente = var;
+ vtail = var;
+ var = NULL;
+ }
+ break;
+ case '(':
+ /*
+ * Recursively evaluate the sub-expression
+ */
+ var = _expValue_evalExpr( expIdx, cp1+1, &cp2,
+ suffix, suffix_len );
+ if ( var && var->type == ASN_NULL ) {
+ /* Adjust position of failure */
+ var->data = (void *)(cp1 - exprRaw + (int)var->data);
+ return var;
+ } else if (*cp2 != ')') {
+ snmp_free_var(exprAlDente);
+ DEBUGMSGTL(("disman:expr:eval", "Unbalanced parenthesis\n"));
+ snmp_set_var_typed_integer( var, ASN_INTEGER,
+ EXPERRCODE_PARENTHESIS );
+ var->type = ASN_NULL;
+ var->data = (void *)(cp2 - exprRaw);
+ return var;
+ } else {
+ if (vtail)
+ vtail->next_variable = var;
+ else
+ exprAlDente = var;
+ vtail = var;
+ var = NULL;
+ cp1 = cp2+1; /* Skip to end of sub-expression */
+ }
+ break;
+ case ')':
+ case ',':
+ /*
+ * End of current (sub-)expression
+ * Note the end-position, and evaluate
+ * the parboiled list of tokens.
+ */
+ *exprEnd = cp1;
+ var = _expValue_evalExpr2( exprAlDente );
+ snmp_free_var(exprAlDente);
+ return var;
+
+ /* === Constants === */
+ case '.': /* OID */
+ i = 0;
+ memset( oid_buf, 0, sizeof(oid_buf));
+ while ( cp1 && *cp1 == '.' ) {
+ n = _expParse_integer( cp1+1, &cp2 );
+OID:
+ oid_buf[i++] = n;
+ cp1 = cp2;
+ }
+ var = snmp_varlist_add_variable( &exprAlDente, NULL, 0,
+ ASN_OBJECT_ID,
+ (u_char*)oid_buf, i*sizeof(oid));
+ break;
+DIGIT:
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ n = _expParse_integer( cp1, &cp2 );
+ if ( cp2 && *cp2 == '.' ) {
+ i = 0;
+ memset( oid_buf, 0, sizeof(oid_buf));
+ goto OID;
+ }
+ if ( neg )
+ n = -n;
+ var = snmp_varlist_add_variable( &exprAlDente, NULL, 0,
+ ASN_INTEGER,
+ (u_char*)&n, sizeof(n));
+ vtail = var;
+ var = NULL;
+ neg = 0;
+ cp1 = cp2;
+ break;
+
+ case '"': /* String Constant */
+ for ( cp2 = cp1+1; *cp2; cp2++ ) {
+ if ( *cp2 == '"' )
+ break;
+ if ( *cp2 == '\\' && *(cp2+1) == '"' )
+ cp2++;
+ }
+ if ( *cp2 != '"' ) {
+ /*
+ * Unterminated string
+ */
+ DEBUGMSGTL(("disman:expr:eval", "Unterminated string\n"));
+ snmp_set_var_typed_integer( var, ASN_INTEGER,
+ EXPERRCODE_SYNTAX );
+ var->type = ASN_NULL;
+ var->data = (void *)(cp2 - exprRaw);
+ return var;
+ }
+ n = cp2 - cp1;
+ var = snmp_varlist_add_variable( &exprAlDente, NULL, 0,
+ ASN_OCTET_STR,
+ (u_char*)cp1+1, n);
+ vtail = var;
+ var = NULL;
+ break;
+
+
+ /* === Operators === */
+ case '-':
+ /*
+ * Could be a unary minus....
+ */
+ if (!vtail || vtail->type == ASN_PRIV_OPERATOR) {
+ neg = 1;
+ goto DIGIT;
+ }
+ /*
+ * ... or a (single-character) binary operator.
+ */
+ /* Fallthrough */
+ case '+':
+ case '*':
+ case '/':
+ case '%':
+ case '^':
+ case '~':
+ if ( !vtail ) {
+ /*
+ * Can't start an expression with a binary operator
+ */
+ DEBUGMSGTL(("disman:expr:eval", "Initial binary operator\n"));
+ snmp_set_var_typed_integer( var, ASN_INTEGER,
+ EXPERRCODE_SYNTAX );
+ var->type = ASN_NULL;
+ var->data = (void *)(cp1 - exprRaw);
+ return var;
+ }
+ n = ops[ *cp1 ];
+ DEBUGMSGTL(("disman:expr:eval", "Binary operator %c (%d)\n", *cp1, n));
+ var = snmp_varlist_add_variable( &exprAlDente, NULL, 0,
+ ASN_INTEGER,
+ (u_char*)&n, sizeof(n));
+ var->type = ASN_PRIV_OPERATOR;
+ vtail = var;
+ cp1++;
+ break;
+
+ /*
+ * Multi-character binary operators
+ */
+ case '&':
+ case '|':
+ case '!':
+ case '>':
+ case '<':
+ case '=':
+ if ( !vtail ) {
+ /*
+ * Can't start an expression with a binary operator
+ */
+ DEBUGMSGTL(("disman:expr:eval", "Initial binary operator\n"));
+ snmp_set_var_typed_integer( var, ASN_INTEGER,
+ EXPERRCODE_SYNTAX );
+ var->type = ASN_NULL;
+ var->data = (void *)(cp1 - exprRaw);
+ return var;
+ }
+ if ( *(cp1+1) == '=' )
+ n = ops[ *cp1++ + 20];
+ else if ( *(cp1+1) == *cp1 )
+ n = ops[ *cp1++ - 30];
+ else
+ n = ops[ *cp1 ];
+ var = snmp_varlist_add_variable( &exprAlDente, NULL, 0,
+ ASN_INTEGER,
+ (u_char*)&n, sizeof(n));
+ var->type = ASN_PRIV_OPERATOR;
+ vtail = var;
+ cp1++;
+ break;
+
+ /* === Functions === */
+ case 'a': /* average/arraySection */
+ case 'c': /* counter32/counter64 */
+ case 'e': /* exists */
+ case 'm': /* maximum/minimum */
+ case 'o': /* oidBegins/Ends/Contains */
+ case 's': /* sum / string{B,E,C} */
+ var = snmp_varlist_add_variable( &exprAlDente, NULL, 0,
+ ASN_OCTET_STR,
+ (u_char*)cp1, 3 );
+ /* XXX */
+ var->type = ASN_PRIV_FUNCTION;
+ vtail = var;
+ while (*cp1 >= 'a' && *cp1 <= 'z')
+ cp1++;
+ break;
+
+ default:
+ if (isalpha( *cp1 )) {
+ /*
+ * Unrecognised function call ?
+ */
+ DEBUGMSGTL(("disman:expr:eval", "Unrecognised function '%s'\n", cp1));
+ snmp_set_var_typed_integer( var, ASN_INTEGER,
+ EXPERRCODE_FUNCTION );
+ var->type = ASN_NULL;
+ var->data = (void *)(cp1 - exprRaw);
+ return var;
+ }
+ else if (!isspace( *cp1 )) {
+ /*
+ * Unrecognised operator ?
+ */
+ DEBUGMSGTL(("disman:expr:eval", "Unrecognised operator '%c'\n", *cp1));
+ snmp_set_var_typed_integer( var, ASN_INTEGER,
+ EXPERRCODE_OPERATOR );
+ var->type = ASN_NULL;
+ var->data = (void *)(cp1 - exprRaw);
+ return var;
+ }
+ cp1++;
+ break;
+ }
+ }
+
+ /*
+ * ... then we evaluate the resulting simplified ("al dente")
+ * expression, in the usual manner.
+ */
+ *exprEnd = cp1;
+ var = _expValue_evalExpr2( exprAlDente );
+ DEBUGMSGTL(( "disman:expr:eval1", "Evaluated to "));
+ DEBUGMSGVAR(("disman:expr:eval1", var));
+ DEBUGMSG(( "disman:expr:eval1", "\n"));
+/* snmp_free_var(exprAlDente); XXX - Crashes */
+ return var;
+}
+
+netsnmp_variable_list *
+_expValue_evalExpr2( netsnmp_variable_list *exprAlD )
+{
+ netsnmp_variable_list *stack = NULL;
+ netsnmp_variable_list *lval, *rval, *op;
+ netsnmp_variable_list *vp, *vp1 = NULL;
+
+ DEBUGIF(( "disman:expr:eval2")) {
+ for (vp = exprAlD; vp; vp=vp->next_variable) {
+ if ( vp->type == ASN_PRIV_OPERATOR )
+ DEBUGMSGTL(( "disman:expr:eval2", "Operator %d\n",
+ *vp->val.integer));
+ else if ( vp->type == ASN_PRIV_FUNCTION )
+ DEBUGMSGTL(( "disman:expr:eval2", "Function %s\n",
+ vp->val.string));
+ else {
+ DEBUGMSGTL(( "disman:expr:eval2", "Operand "));
+ DEBUGMSGVAR(("disman:expr:eval2", vp));
+ DEBUGMSG(( "disman:expr:eval2", "\n"));
+ }
+ }
+ }
+
+ for (vp = exprAlD; vp; vp=vp1) {
+ vp1 = vp->next_variable;
+ if ( vp->type == ASN_PRIV_OPERATOR ) {
+ /* Must *always* follow a value */
+ if ( !stack || stack->type == ASN_PRIV_OPERATOR ) {
+ snmp_set_var_typed_integer( vp, ASN_INTEGER,
+ EXPERRCODE_SYNTAX );
+ vp->type = ASN_NULL;
+ snmp_free_var( stack );
+ return vp;
+ }
+ /*
+ * Evaluate any higher priority operators
+ * already on the stack....
+ */
+ while ( stack->next_variable &&
+ stack->next_variable->type == ASN_PRIV_OPERATOR &&
+ (*stack->next_variable->val.integer > *vp->val.integer)) {
+ rval = stack;
+ op = stack->next_variable;
+ lval = op->next_variable;
+ stack = lval->next_variable;
+
+ rval = _expValue_evalOperator( lval, op, rval );
+ rval->next_variable = stack;
+ stack = rval;
+ }
+ /*
+ * ... and then push this operator onto the stack.
+ */
+ vp->next_variable = stack;
+ stack = vp;
+ } else if ( vp->type == ASN_PRIV_FUNCTION ) {
+ /* Must be first, or follow an operator */
+ if ( stack && stack->type != ASN_PRIV_OPERATOR ) {
+ snmp_set_var_typed_integer( vp, ASN_INTEGER,
+ EXPERRCODE_SYNTAX );
+ vp->type = ASN_NULL;
+ snmp_free_var( stack );
+ return vp;
+ }
+ /*
+ * Evaluate this function (consuming the
+ * appropriate parameters from the token
+ * list), and push the result onto the stack.
+ */
+ vp = _expValue_evalFunction( vp );
+ vp1 = vp->next_variable;
+ vp->next_variable = stack;
+ stack = vp;
+ } else {
+ /* Must be first, or follow an operator */
+ if ( stack && stack->type != ASN_PRIV_OPERATOR ) {
+ snmp_set_var_typed_integer( vp, ASN_INTEGER,
+ EXPERRCODE_SYNTAX );
+ vp->type = ASN_NULL;
+ snmp_free_var( stack );
+ return vp;
+ }
+ /*
+ * Push this value onto the stack
+ */
+ vp->next_variable = stack;
+ stack = vp;
+ }
+ }
+
+ /*
+ * Now evaluate whatever's left on the stack
+ * and return the final result.
+ */
+ while ( stack && stack->next_variable ) {
+ rval = stack;
+ op = stack->next_variable;
+ lval = op->next_variable;
+ stack = lval->next_variable;
+
+ rval = _expValue_evalOperator( lval, op, rval );
+ rval->next_variable = stack;
+ stack = rval;
+ }
+ return stack;
+}
+
+/* =============
+ * Main API
+ * ============= */
+netsnmp_variable_list *
+expValue_evaluateExpression( struct expExpression *exp,
+ oid *suffix, size_t suffix_len )
+{
+ char exprRaw[ EXP_STR3_LEN+1 ];
+ netsnmp_variable_list *var;
+ netsnmp_variable_list owner_var, name_var, param_var;
+ long n;
+ char *cp;
+
+ if (!exp)
+ return NULL;
+
+ /*
+ * Set up a varbind list containing the various index values
+ * (including a placeholder for expObjectIndex).
+ *
+ * This saves having to construct the same index list repeatedly
+ */
+ memset(&owner_var, 0, sizeof(netsnmp_variable_list));
+ memset(&name_var, 0, sizeof(netsnmp_variable_list));
+ memset(&param_var, 0, sizeof(netsnmp_variable_list));
+ snmp_set_var_typed_value( &owner_var, ASN_OCTET_STR,
+ (u_char*)exp->expOwner, strlen(exp->expOwner));
+ snmp_set_var_typed_value( &name_var, ASN_OCTET_STR,
+ (u_char*)exp->expName, strlen(exp->expName));
+ n = 99; /* dummy value */
+ snmp_set_var_typed_value( &param_var, ASN_INTEGER,
+ (u_char*)&n, sizeof(long));
+ owner_var.next_variable = &name_var;
+ name_var.next_variable = &param_var;
+
+ /*
+ * Make a working copy of the expression, and evaluate it.
+ */
+ memset(exprRaw, 0, sizeof(exprRaw));
+ memcpy(exprRaw, exp->expExpression, sizeof(exprRaw));
+
+ var = _expValue_evalExpr( &owner_var, exprRaw, &cp, suffix, suffix_len );
+ /*
+ * Check for any problems, and record the appropriate error
+ */
+ if (!cp || *cp != '\0') {
+ /*
+ * When we had finished, there was a lot
+ * of bricks^Wcharacters left over....
+ */
+ _expValue_setError( exp, EXPERRCODE_SYNTAX, suffix, suffix_len, NULL );
+ return NULL;
+ }
+ if (!var) {
+ /* Shouldn't happen */
+ _expValue_setError( exp, EXPERRCODE_RESOURCE, suffix, suffix_len, NULL );
+ return NULL;
+ }
+ if (var->type == ASN_NULL) {
+ /*
+ * Error explicitly reported from the evaluation routines.
+ */
+ _expValue_setError( exp, *(var->val.integer), suffix, suffix_len, var );
+ return NULL;
+ }
+ if (0 /* COMPARE var->type WITH exp->expValueType */ ) {
+ /*
+ * XXX - Check to see whether the returned type (ASN_XXX)
+ * is compatible with the requested type (an enum)
+ */
+
+ /* If not, throw an error */
+ _expValue_setError( exp, EXPERRCODE_TYPE, suffix, suffix_len, var );
+ return NULL;
+ }
+ return var;
+}
+
+void
+_expValue_setError( struct expExpression *exp, int reason,
+ oid *suffix, size_t suffix_len,
+ netsnmp_variable_list *var)
+{
+ if (!exp)
+ return;
+ exp->expErrorCount++;
+ /* exp->expErrorTime = NOW; */
+ exp->expErrorIndex = ( var && var->data ? (int)var->data : 0 );
+ exp->expErrorCode = reason;
+ memset( exp->expErrorInstance, 0, sizeof(exp->expErrorInstance));
+ memcpy( exp->expErrorInstance, suffix, suffix_len * sizeof(oid));
+ exp->expErrorInst_len = suffix_len;
+ snmp_free_var( var );
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expValue.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expValue.h
new file mode 100644
index 0000000000..5b9bffb0af
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expValue.h
@@ -0,0 +1,12 @@
+
+#ifndef EXPVALUE_H
+#define EXPVALUE_H
+
+#include "disman/expr/expExpression.h"
+
+void init_expValue(void);
+netsnmp_variable_list *
+expValue_evaluateExpression( struct expExpression *exp,
+ oid *suffix, size_t suffix_len );
+
+#endif /* EXPVALUE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expValueTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expValueTable.c
new file mode 100644
index 0000000000..3c36f38aa6
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expValueTable.c
@@ -0,0 +1,327 @@
+/*
+ * DisMan Expression MIB:
+ * Implementation of the expValueTable MIB interface
+ * See 'expValue.c' for active evaluation of expressions.
+ *
+ * (Based roughly on mib2c.raw-table.conf output)
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "expValue.h"
+#include "expValueTable.h"
+
+/** Initializes the expValueTable module */
+void
+init_expValueTable(void)
+{
+ static oid expValueTable_oid[] = { 1, 3, 6, 1, 2, 1, 90, 1, 3, 1 };
+ size_t expValueTable_oid_len = OID_LENGTH(expValueTable_oid);
+ netsnmp_handler_registration *reg;
+ netsnmp_table_registration_info *table_info;
+
+ reg =
+ netsnmp_create_handler_registration("expValueTable",
+ expValueTable_handler,
+ expValueTable_oid,
+ expValueTable_oid_len,
+ HANDLER_CAN_RONLY);
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_OCTET_STR, /* expExpressionOwner */
+ ASN_OCTET_STR, /* expExpressionName */
+ /* expValueInstance */
+ ASN_PRIV_IMPLIED_OBJECT_ID,
+ 0);
+
+ table_info->min_column = COLUMN_EXPVALUECOUNTER32VAL;
+ table_info->max_column = COLUMN_EXPVALUECOUNTER64VAL;
+
+ netsnmp_register_table(reg, table_info);
+ DEBUGMSGTL(("disman:expr:init", "Expression Value Table\n"));
+}
+
+
+netsnmp_variable_list *
+expValueTable_getEntry(netsnmp_variable_list * indexes,
+ int mode, unsigned int colnum)
+{
+ struct expExpression *exp;
+ netsnmp_variable_list *res, *vp, *vp2;
+ oid nullInstance[] = {0, 0, 0};
+ int plen;
+ size_t len;
+ unsigned int type = colnum-1; /* column object subIDs and type
+ enumerations are off by one. */
+
+ if (!indexes || !indexes->next_variable ||
+ !indexes->next_variable->next_variable ) {
+ /* XXX - Shouldn't happen! */
+ return 0;
+ }
+
+ DEBUGMSGTL(( "disman:expr:val", "get (%d) entry (%s, %s, ", mode,
+ indexes->val.string, indexes->next_variable->val.string));
+ DEBUGMSGOID(("disman:expr:val",
+ indexes->next_variable->next_variable->val.objid,
+ indexes->next_variable->next_variable->val_len/sizeof(oid)));
+ DEBUGMSG(( "disman:expr:val", ")\n"));
+
+ /*
+ * Locate the expression that we've been asked to evaluate
+ */
+ if (!indexes->val_len || !indexes->next_variable->val_len ) {
+ /*
+ * Incomplete expression specification
+ */
+ if (mode == MODE_GETNEXT || mode == MODE_GETBULK) {
+ exp = expExpression_getFirstEntry();
+ DEBUGMSGTL(( "disman:expr:val", "first entry (%x)\n", exp ));
+ } else {
+ DEBUGMSGTL(( "disman:expr:val", "incomplete request\n" ));
+ return NULL; /* No match */
+ }
+ } else {
+ exp = expExpression_getEntry( (char*)indexes->val.string,
+ (char*)indexes->next_variable->val.string);
+ DEBUGMSGTL(( "disman:expr:val", "using entry (%x)\n", exp ));
+ }
+
+ /*
+ * We know what type of value was requested,
+ * so ignore any non-matching expressions.
+ */
+ while (exp && exp->expValueType != type) {
+ if (mode != MODE_GETNEXT && mode != MODE_GETBULK) {
+ DEBUGMSGTL(( "disman:expr:val", "wrong type (%d != %d)\n",
+ type, (exp ? exp->expValueType : 0 )));
+ return NULL; /* Wrong type */
+ }
+NEXT_EXP:
+ exp = expExpression_getNextEntry( exp->expOwner, exp->expName );
+ DEBUGMSGTL(( "disman:expr:val", "using next entry (%x)\n", exp ));
+ }
+ if (!exp) {
+ DEBUGMSGTL(( "disman:expr:val", "no more entries\n"));
+ return NULL; /* No match (of the required type) */
+ }
+
+
+ /*
+ * Now consider which instance of the chosen expression is needed
+ */
+ vp = indexes->next_variable->next_variable;
+ if ( mode == MODE_GET ) {
+ /*
+ * For a GET request, check that the specified value instance
+ * is valid, and evaluate the expression using this.
+ */
+ if ( !vp || !vp->val_len ) {
+ DEBUGMSGTL(( "disman:expr:val", "no instance index\n"));
+ return NULL; /* No instance provided */
+ }
+ if ( vp->val.objid[0] != 0 ) {
+ DEBUGMSGTL(( "disman:expr:val",
+ "non-zero instance (%d)\n", vp->val.objid[0]));
+ return NULL; /* Invalid instance */
+ }
+
+ if (exp->expPrefix_len == 0 ) {
+ /*
+ * The only valid instance for a non-wildcarded
+ * expression is .0.0.0
+ */
+ if ( vp->val_len != 3*sizeof(oid) ||
+ vp->val.objid[1] != 0 ||
+ vp->val.objid[2] != 0 ) {
+ DEBUGMSGTL(( "disman:expr:val", "invalid scalar instance\n"));
+ return NULL;
+ }
+ res = expValue_evaluateExpression( exp, NULL, 0 );
+ DEBUGMSGTL(( "disman:expr:val", "scalar get returned (%x)\n", res));
+ } else {
+ /*
+ * Otherwise, skip the leading '.0' and use
+ * the remaining instance subidentifiers.
+ */
+ res = expValue_evaluateExpression( exp, vp->val.objid+1,
+ vp->val_len/sizeof(oid)-1);
+ DEBUGMSGTL(( "disman:expr:val", "w/card get returned (%x)\n", res));
+ }
+ } else {
+ /*
+ * For a GETNEXT request, identify the appropriate next
+ * value instance, and evaluate the expression using
+ * that, updating the index list appropriately.
+ */
+ if ( vp->val_len > 0 && vp->val.objid[0] != 0 ) {
+ DEBUGMSGTL(( "disman:expr:val",
+ "non-zero next instance (%d)\n", vp->val.objid[0]));
+ return NULL; /* All valid instances start with .0 */
+ }
+ plen = exp->expPrefix_len;
+ if (plen == 0 ) {
+ /*
+ * The only valid instances for GETNEXT on a
+ * non-wildcarded expression are .0 and .0.0
+ * Anything else is too late.
+ */
+ if ((vp->val_len > 2*sizeof(oid)) ||
+ (vp->val_len == 2*sizeof(oid) &&
+ vp->val.objid[1] != 0)) {
+ DEBUGMSGTL(( "disman:expr:val", "invalid scalar next instance\n"));
+ return NULL; /* Invalid instance */
+ }
+
+ /*
+ * Make sure the index varbind list refers to the
+ * (only) valid instance of this expression,
+ * and evaluate it.
+ */
+ snmp_set_var_typed_value( indexes, ASN_OCTET_STR,
+ (u_char*)exp->expOwner, strlen(exp->expOwner));
+ snmp_set_var_typed_value( indexes->next_variable, ASN_OCTET_STR,
+ (u_char*)exp->expName, strlen(exp->expName));
+ snmp_set_var_typed_value( vp, ASN_PRIV_IMPLIED_OBJECT_ID,
+ (u_char*)nullInstance, 3*sizeof(oid));
+ res = expValue_evaluateExpression( exp, NULL, 0 );
+ DEBUGMSGTL(( "disman:expr:val", "scalar next returned (%x)\n", res));
+ } else {
+ /*
+ * Now comes the interesting case - finding the
+ * appropriate instance of a wildcarded expression.
+ */
+ if ( vp->val_len == 0 ) {
+ if ( !exp->pvars ) {
+ DEBUGMSGTL(( "disman:expr:val", "no instances\n"));
+ goto NEXT_EXP;
+ }
+ DEBUGMSGTL(( "disman:expr:val", "using first instance\n"));
+ vp2 = exp->pvars;
+ } else {
+ /*
+ * Search the list of instances for the (first) greater one
+ * XXX - This comparison relies on the OID of the prefix
+ * object being the same length as the wildcarded
+ * parameter objects. It ain't necessarily so.
+ */
+ for ( vp2 = exp->pvars; vp2; vp2 = vp2->next_variable ) {
+ if ( snmp_oid_compare( vp2->name + plen,
+ vp2->name_length - plen,
+ vp->name,
+ vp->name_length) < 0 ) {
+ DEBUGMSGTL(( "disman:expr:val", "next instance "));
+ DEBUGMSGOID(("disman:expr:val", vp2->name, vp2->name_length ));
+ DEBUGMSG(( "disman:expr:val", "\n"));
+ break;
+ }
+ }
+ if (!vp2) {
+ DEBUGMSGTL(( "disman:expr:val", "no next instance\n"));
+ goto NEXT_EXP;
+ }
+ }
+ snmp_set_var_typed_value( indexes, ASN_OCTET_STR,
+ (u_char*)exp->expOwner, strlen(exp->expOwner));
+ snmp_set_var_typed_value( indexes->next_variable, ASN_OCTET_STR,
+ (u_char*)exp->expName, strlen(exp->expName));
+ if (vp2) {
+ len = vp2->name_length - exp->expPrefix_len;
+ snmp_set_var_typed_value( vp, ASN_PRIV_IMPLIED_OBJECT_ID,
+ (u_char*)(vp2->name+exp->expPrefix_len), len);
+ }
+ res = expValue_evaluateExpression( exp, vp->val.objid+1, len-1);
+ DEBUGMSGTL(( "disman:expr:val", "w/card next returned (%x)\n", res));
+ }
+ }
+ return res;
+}
+
+/** handles requests for the expValueTable table */
+int
+expValueTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *tinfo;
+ netsnmp_variable_list *value;
+ oid expValueOID[] = { 1, 3, 6, 1, 2, 1, 90, 1, 3, 1, 1, 99 };
+ size_t expValueOID_len = OID_LENGTH(expValueOID);
+ oid name_buf[ MAX_OID_LEN ];
+ size_t name_buf_len = MAX_OID_LEN;
+
+ DEBUGMSGTL(("disman:expr:mib", "Expression Value Table handler (%d)\n",
+ reqinfo->mode));
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ case MODE_GETNEXT:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+ value = expValueTable_getEntry(tinfo->indexes,
+ reqinfo->mode,
+ tinfo->colnum);
+ if (!value || !value->val.integer) {
+ netsnmp_set_request_error(reqinfo, request,
+ (reqinfo->mode == MODE_GET) ?
+ SNMP_NOSUCHINSTANCE :
+ SNMP_ENDOFMIBVIEW);
+ continue;
+ }
+ if ( reqinfo->mode == MODE_GETNEXT ) {
+ /*
+ * Need to update the request varbind OID
+ * to match the instance just evaluated.
+ * (XXX - Is this the appropriate mechanism?)
+ */
+ build_oid_noalloc( name_buf, MAX_OID_LEN, &name_buf_len,
+ expValueOID, expValueOID_len, tinfo->indexes );
+ name_buf[ expValueOID_len -1 ] = tinfo->colnum;
+ snmp_set_var_objid(request->requestvb, name_buf, name_buf_len);
+ }
+
+ switch (tinfo->colnum) {
+ case COLUMN_EXPVALUECOUNTER32VAL:
+ snmp_set_var_typed_integer(request->requestvb, ASN_COUNTER,
+ *value->val.integer);
+ break;
+ case COLUMN_EXPVALUEUNSIGNED32VAL:
+ snmp_set_var_typed_integer(request->requestvb, ASN_UNSIGNED,
+ *value->val.integer);
+ break;
+ case COLUMN_EXPVALUETIMETICKSVAL:
+ snmp_set_var_typed_integer(request->requestvb, ASN_TIMETICKS,
+ *value->val.integer);
+ break;
+ case COLUMN_EXPVALUEINTEGER32VAL:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ *value->val.integer);
+ break;
+ case COLUMN_EXPVALUEIPADDRESSVAL:
+ snmp_set_var_typed_integer(request->requestvb, ASN_IPADDRESS,
+ *value->val.integer);
+ break;
+ case COLUMN_EXPVALUEOCTETSTRINGVAL:
+ snmp_set_var_typed_value( request->requestvb, ASN_OCTET_STR,
+ value->val.string, value->val_len);
+ break;
+ case COLUMN_EXPVALUEOIDVAL:
+ snmp_set_var_typed_value( request->requestvb, ASN_OBJECT_ID,
+ (u_char *)value->val.objid, value->val_len);
+ break;
+ case COLUMN_EXPVALUECOUNTER64VAL:
+ snmp_set_var_typed_value( request->requestvb, ASN_COUNTER64,
+ (u_char *)value->val.counter64, value->val_len);
+ break;
+ }
+ }
+ break;
+
+ }
+ DEBUGMSGTL(("disman:expr:mib", "Expression Value handler - done \n"));
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expValueTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expValueTable.h
new file mode 100644
index 0000000000..15f320265a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/expValueTable.h
@@ -0,0 +1,23 @@
+#ifndef EXPVALUETABLE_H
+#define EXPVALUETABLE_H
+
+/*
+ * function declarations
+ */
+void init_expValueTable(void);
+Netsnmp_Node_Handler expValueTable_handler;
+netsnmp_variable_list *expValue_getVal(netsnmp_variable_list *, int);
+
+/*
+ * column number definitions for table expValueTable
+ */
+#define COLUMN_EXPVALUEINSTANCE 1
+#define COLUMN_EXPVALUECOUNTER32VAL 2
+#define COLUMN_EXPVALUEUNSIGNED32VAL 3
+#define COLUMN_EXPVALUETIMETICKSVAL 4
+#define COLUMN_EXPVALUEINTEGER32VAL 5
+#define COLUMN_EXPVALUEIPADDRESSVAL 6
+#define COLUMN_EXPVALUEOCTETSTRINGVAL 7
+#define COLUMN_EXPVALUEOIDVAL 8
+#define COLUMN_EXPVALUECOUNTER64VAL 9
+#endif /* EXPVALUETABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/exp_enum.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/exp_enum.h
new file mode 100755
index 0000000000..47085b21e7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expr/exp_enum.h
@@ -0,0 +1,60 @@
+#ifndef EXP_ENUM_H
+#define EXP_ENUM_H
+
+ /* expExpressionValueType */
+#define EXPVALTYPE_COUNTER 1
+#define EXPVALTYPE_UNSIGNED 2
+#define EXPVALTYPE_TIMETICKS 3
+#define EXPVALTYPE_INTEGER 4
+#define EXPVALTYPE_IPADDRESS 5
+#define EXPVALTYPE_STRING 6
+#define EXPVALTYPE_OID 7
+#define EXPVALTYPE_COUNTER64 8
+
+ /* expErrorCode */
+#define EXPERRCODE_SYNTAX 1
+#define EXPERRCODE_INDEX 2
+#define EXPERRCODE_OPERATOR 3
+#define EXPERRCODE_FUNCTION 4
+#define EXPERRCODE_TYPE 5
+#define EXPERRCODE_PARENTHESIS 6
+#define EXPERRCODE_WILDCARD 7
+#define EXPERRCODE_RECURSION 8
+#define EXPERRCODE_DELTA 9
+#define EXPERRCODE_RESOURCE 10
+#define EXPERRCODE_DIVZERO 11
+
+ /* expObjectSampleType */
+#define EXPSAMPLETYPE_ABSOLUTE 1
+#define EXPSAMPLETYPE_DELTA 2
+#define EXPSAMPLETYPE_CHANGED 3
+
+ /* expObjectDiscontinuityIDType */
+#define EXPDISCID_TIMETICKS 1
+#define EXPDISCID_TIMESTAMP 2
+#define EXPDISCID_DATETIME 3
+
+ /* expression operators (in increasing order of priority) */
+ /* XXX - Check priority ordering */
+#define EXP_OPERATOR_ADD 1
+#define EXP_OPERATOR_SUBTRACT 2
+#define EXP_OPERATOR_MULTIPLY 3
+#define EXP_OPERATOR_DIVIDE 4
+#define EXP_OPERATOR_REMAINDER 5
+#define EXP_OPERATOR_BITXOR 6
+#define EXP_OPERATOR_BITNEGATE 7
+#define EXP_OPERATOR_BITOR 8
+#define EXP_OPERATOR_BITAND 9
+#define EXP_OPERATOR_NOT 10
+#define EXP_OPERATOR_OR 11
+#define EXP_OPERATOR_AND 12
+#define EXP_OPERATOR_EQUAL 13
+#define EXP_OPERATOR_NOTEQ 14
+#define EXP_OPERATOR_LESS 15
+#define EXP_OPERATOR_LESSEQ 16
+#define EXP_OPERATOR_GREAT 17
+#define EXP_OPERATOR_GREATEQ 18
+#define EXP_OPERATOR_LSHIFT 19
+#define EXP_OPERATOR_RSHIFT 20
+#endif /* EXP_ENUM_H */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression-mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression-mib.h
new file mode 100644
index 0000000000..18db2afddb
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression-mib.h
@@ -0,0 +1,21 @@
+/*
+*Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+*
+*All right reserved
+*
+*File Name:expression-mib.h
+*File Description: add DISMAN-EXPRESSION-MIB.
+*
+*Current Version:1.0
+*Author:JianShun Tong
+*Date:2004.8.20
+*/
+
+/*
+ * wrapper for the disman expression mib code files
+ */
+config_require(disman/expression/expExpressionTable)
+config_require(disman/expression/expErrorTable)
+config_require(disman/expression/expObjectTable)
+config_require(disman/expression/expValueTable)
+config_add_mib(DISMAN-EXPRESSION-MIB)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression.h
new file mode 100644
index 0000000000..82f7cc0955
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression.h
@@ -0,0 +1,13 @@
+/*
+ * wrapper for the disman expression mib code files
+ */
+config_require(disman/expr/expScalars)
+config_require(disman/expr/expExpression)
+config_require(disman/expr/expExpressionTable)
+config_require(disman/expr/expErrorTable)
+config_require(disman/expr/expExpressionConf)
+config_require(disman/expr/expObject)
+config_require(disman/expr/expObjectTable)
+config_require(disman/expr/expObjectConf)
+config_require(disman/expr/expValue)
+config_require(disman/expr/expValueTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expErrorTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expErrorTable.c
new file mode 100644
index 0000000000..b7b257eb57
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expErrorTable.c
@@ -0,0 +1,138 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name: expErrorTable.c
+ *File Description: expErrorTable MIB operation.
+ *
+ *Current Version:1.0
+ *Author:JianShun Tong
+ *Date:2004.8.20
+ */
+
+
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent.
+ */
+
+
+/*
+ * This should always be included first before anything else
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+
+/*
+ * minimal include directives
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "expErrorTable.h"
+#include "expExpressionTable.h"
+
+
+
+/*
+ * expErrorTable_variables_oid:
+ * this is the top level oid that we want to register under. This
+ * is essentially a prefix, with the suffix appearing in the
+ * variable below.
+ */
+
+oid expErrorTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 90, 1, 2, 2 };
+
+/*
+ * variable2 expErrorTable_variables:
+ */
+
+struct variable2 expErrorTable_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+#define EXPERRORTIME 1
+ {EXPERRORTIME, ASN_UNSIGNED, RONLY, var_expErrorTable, 2, {1, 1}},
+#define EXPERRORINDEX 2
+ {EXPERRORINDEX, ASN_INTEGER, RONLY, var_expErrorTable, 2, {1, 2}},
+#define EXPERRORCODE 3
+ {EXPERRORCODE, ASN_INTEGER, RONLY, var_expErrorTable, 2, {1, 3}},
+#define EXPERRORINSTANCE 4
+ {EXPERRORINSTANCE, ASN_OBJECT_ID, RONLY, var_expErrorTable, 2, {1, 4}}
+};
+
+extern struct header_complex_index *expExpressionTableStorage;
+
+
+void
+init_expErrorTable(void)
+{
+ DEBUGMSGTL(("expErrorTable", "initializing... "));
+
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("expErrorTable",
+ expErrorTable_variables, variable2,
+ expErrorTable_variables_oid);
+
+ DEBUGMSGTL(("expErrorTable", "done.\n"));
+}
+
+
+
+unsigned char *
+var_expErrorTable(struct variable *vp,
+ oid * name,
+ size_t *length,
+ int exact, size_t *var_len, WriteMethod ** write_method)
+{
+ struct expExpressionTable_data *StorageTmp = NULL;
+
+ DEBUGMSGTL(("expErrorTable", "var_expErrorTable: Entering... \n"));
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(expExpressionTableStorage, vp, name, length, exact,
+ var_len, write_method)) == NULL)
+ return NULL;
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+
+ case EXPERRORTIME:
+ *var_len = sizeof(StorageTmp->expErrorTime);
+ return (u_char *) & StorageTmp->expErrorTime;
+
+ case EXPERRORINDEX:
+ *var_len = sizeof(StorageTmp->expErrorIndex);
+ return (u_char *) & StorageTmp->expErrorIndex;
+
+ case EXPERRORCODE:
+ *var_len = sizeof(StorageTmp->expErrorCode);
+ return (u_char *) & StorageTmp->expErrorCode;
+
+ case EXPERRORINSTANCE:
+ *var_len = StorageTmp->expErrorInstanceLen * sizeof(oid);
+ return (u_char *) StorageTmp->expErrorInstance;
+ }
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expErrorTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expErrorTable.h
new file mode 100644
index 0000000000..539915934b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expErrorTable.h
@@ -0,0 +1,49 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:expErrorTable.h
+ *File Description: head file.
+ *
+ *Current Version:1.0
+ *Author:JianShun Tong
+ *Date:2004.8.20
+ */
+
+
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+
+#ifndef _MIBGROUP_EXPERRORTALBE_H
+#define _MIBGROUP_EXPERRORTALBE_H
+
+
+
+/*
+ * we may use header_complex from the header_complex module
+ */
+config_require(header_complex)
+
+
+ struct expErrorTable_data {
+
+ unsigned long expErrorTime;
+ long expErrorIndex;
+ long expErrorCode;
+ oid *expErrorInstance;
+ size_t expErrorInstanceLen;
+ };
+
+ /*
+ * function prototypes
+ */
+ void init_expErrorTable(void);
+ FindVarMethod var_expErrorTable;
+
+
+
+#endif /* _MIBGROUP_EXPERRORTALBE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expExpressionTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expExpressionTable.c
new file mode 100644
index 0000000000..f6f7d8dc36
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expExpressionTable.c
@@ -0,0 +1,1162 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name: expExpressionTable.c
+ *File Description: expExpressionTable MIB operation.
+ *
+ *Current Version:1.0
+ *Author:JianShun Tong
+ *Date:2004.8.20
+ */
+
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent.
+ */
+
+
+/*
+ * This should always be included first before anything else
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+
+/*
+ * minimal include directives
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "header_complex.h"
+#include "expErrorTable.h"
+#include "expExpressionTable.h"
+#include "expObjectTable.h"
+#include "expValueTable.h"
+
+
+/*
+ * expExpressionTable_variables_oid:
+ * this is the top level oid that we want to register under. This
+ * is essentially a prefix, with the suffix appearing in the
+ * variable below.
+ */
+
+oid expExpressionTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 90, 1, 2, 1 };
+
+/*
+ * variable2 expExpressionTable_variables:
+ */
+
+struct variable2 expExpressionTable_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+#define EXPEXPRESSION 3
+ {EXPEXPRESSION, ASN_OCTET_STR, RWRITE, var_expExpressionTable, 2, {1, 3}},
+#define EXPEXPRESSIONVALUETYPE 4
+ {EXPEXPRESSIONVALUETYPE, ASN_INTEGER, RWRITE, var_expExpressionTable, 2, {1, 4}},
+#define EXPEXPRESSIONCOMMENT 5
+ {EXPEXPRESSIONCOMMENT, ASN_OCTET_STR, RWRITE, var_expExpressionTable, 2, {1, 5}},
+#define EXPEXPRESSIONDELTALNTERVAL 6
+ {EXPEXPRESSIONDELTALNTERVAL, ASN_INTEGER, RWRITE, var_expExpressionTable, 2, {1, 6}},
+#define EXPEXPRESSIONPREFIX 7
+ {EXPEXPRESSIONPREFIX, ASN_OBJECT_ID, RONLY, var_expExpressionTable, 2, {1, 7}},
+#define EXPEXPRESSIONERRORS 8
+ {EXPEXPRESSIONERRORS, ASN_UNSIGNED, RONLY, var_expExpressionTable, 2, {1, 8}},
+#define EXPEXPRESSIONENTRYSTATUS 9
+ {EXPEXPRESSIONENTRYSTATUS, ASN_INTEGER, RWRITE, var_expExpressionTable, 2, {1, 9}}
+};
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+
+struct header_complex_index *expExpressionTableStorage = NULL;
+extern struct header_complex_index *expObjectTableStorage;
+extern struct header_complex_index *expValueTableStorage;
+
+oid mmTimeInstance[] = { 1, 3, 6, 1, 2, 1, 1, 3, 0 };
+
+/*
+ * init_expExpressionTable():
+ * Initialization routine. This is called when the agent starts up.
+ * At a minimum, registration of your variables should take place here.
+ */
+void
+init_expExpressionTable(void)
+{
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("expExpressionTable", expExpressionTable_variables,
+ variable2, expExpressionTable_variables_oid);
+
+ /*
+ * register our config handler(s) to deal with registrations
+ */
+ snmpd_register_config_handler("expExpressionTable",
+ parse_expExpressionTable, NULL, NULL);
+
+
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_expExpressionTable, NULL);
+
+
+ DEBUGMSGTL(("expExpressionTable", "done.\n"));
+}
+
+struct expExpressionTable_data *
+create_expExpressionTable_data(void)
+{
+ struct expExpressionTable_data *StorageNew;
+ StorageNew = SNMP_MALLOC_STRUCT(expExpressionTable_data);
+ /*
+ * fill in default row values here into StorageNew
+ */
+ /*
+ * fill in values for all tables (even if not
+ * appropriate), since its easier to do here than anywhere
+ * else
+ */
+
+ StorageNew->expExpression = strdup("");
+ StorageNew->expExpressionValueType = EXPEXPRESSION_COUNTER32;
+ StorageNew->expExpressionComment = strdup("");
+ StorageNew->expExpressionDeltaInterval = 0;
+ StorageNew->expExpressionPrefix = calloc(1, sizeof(oid) * 2); /* 0.0 */
+ StorageNew->expExpressionPrefixLen = 2;
+ StorageNew->hc_ObjectTableStorage = NULL;
+ StorageNew->hc_ValueTableStorage = NULL;
+ StorageNew->storageType = ST_NONVOLATILE;
+ return StorageNew;
+}
+
+int
+expExpressionTable_add(struct expExpressionTable_data *thedata)
+{
+ netsnmp_variable_list *vars = NULL;
+
+
+ DEBUGMSGTL(("expExpressionTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->expExpressionOwner, thedata->expExpressionOwnerLen); /* expExpressionOwner */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->expExpressionName, thedata->expExpressionNameLen); /* expExpressionName */
+
+ header_complex_add_data(&expExpressionTableStorage, vars, thedata);
+ DEBUGMSGTL(("expExpressionTable", "registered an entry\n"));
+
+
+ DEBUGMSGTL(("expExpressionTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+
+/*
+ * parse_mteTriggerTable():
+ * parses .conf file entries needed to configure the mib.
+ */
+void
+parse_expExpressionTable(const char *token, char *line)
+{
+ size_t tmpint;
+ oid *tmpoid = NULL;
+ struct expExpressionTable_data *StorageTmp =
+ SNMP_MALLOC_STRUCT(expExpressionTable_data);
+
+ DEBUGMSGTL(("expExpressionTable", "parsing config... "));
+
+ if (StorageTmp == NULL) {
+ config_perror("malloc failure");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->expExpressionOwner,
+ &StorageTmp->expExpressionOwnerLen);
+ if (StorageTmp->expExpressionOwner == NULL) {
+ config_perror("invalid specification for expExpressionOwner");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->expExpressionName,
+ &StorageTmp->expExpressionNameLen);
+ if (StorageTmp->expExpressionName == NULL) {
+ config_perror("invalid specification for expExpressionName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->expExpression,
+ &StorageTmp->expExpressionLen);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->expExpressionValueType,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->expExpressionComment,
+ &StorageTmp->expExpressionCommentLen);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->expExpressionDeltaInterval,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_OBJECT_ID, line,
+ &StorageTmp->expExpressionPrefix,
+ &StorageTmp->expExpressionPrefixLen);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->expExpressionErrors, &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->expExpressionEntryStatus,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->have_copied_auth_info, &tmpint);
+ if (StorageTmp->have_copied_auth_info) {
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pdu_version, &tmpint);
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pdu_securityModel, &tmpint);
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pdu_securityLevel, &tmpint);
+ line =
+ read_config_read_data(ASN_OBJECT_ID, line, &tmpoid, &tmpint);
+ if (!netsnmp_tdomain_support
+ (tmpoid, tmpint, &StorageTmp->pdu_tDomain,
+ &StorageTmp->pdu_tDomainLen)) {
+ config_perror
+ ("unsupported transport domain for mteTriggerEntry");
+ return;
+ }
+ if (tmpoid != NULL) {
+ free(tmpoid);
+ }
+
+ /*
+ * can be NULL? Yes.
+ */
+ line = read_config_read_data(ASN_OCTET_STR, line,
+ &(StorageTmp->pdu_transport),
+ &StorageTmp->pdu_transportLen);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pdu_community,
+ &StorageTmp->pdu_community_len);
+ if (StorageTmp->pdu_community == NULL) {
+ config_perror("invalid specification for pdu_community");
+ return;
+ }
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pdu_securityName,
+ &StorageTmp->pdu_securityNameLen);
+ if (StorageTmp->pdu_securityName == NULL) {
+ config_perror("invalid specification for pdu_securityName");
+ return;
+ }
+ }
+ StorageTmp->storageType = ST_NONVOLATILE;
+ expExpressionTable_add(StorageTmp);
+
+
+ DEBUGMSGTL(("expExpressionTable", "done.\n"));
+}
+
+
+/*
+ * store_expExpressionTable():
+ * stores .conf file entries needed to configure the mib.
+ */
+int
+store_expExpressionTable(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr;
+ size_t tmpint;
+ struct expExpressionTable_data *StorageTmp;
+ struct expObjectTable_data *ObjectStorageTmp;
+ struct expValueTable_data *ValueStorageTmp;
+ struct header_complex_index *hcindex, *hc_object, *hc_value;
+
+ DEBUGMSGTL(("expExpressionTable", "storing data... "));
+
+ for (hcindex = expExpressionTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ StorageTmp = (struct expExpressionTable_data *) hcindex->data;
+
+
+ if (StorageTmp->storageType == ST_NONVOLATILE) {
+
+ memset(line, 0, sizeof(line));
+ strcat(line, "expExpressionTable ");
+ cptr = line + strlen(line);
+ /*
+ * expExpressionTable
+ */
+
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->expExpressionOwner,
+ &StorageTmp->expExpressionOwnerLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->expExpressionName,
+ &StorageTmp->expExpressionNameLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->expExpression,
+ &StorageTmp->expExpressionLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->expExpressionValueType,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->expExpressionComment,
+ &StorageTmp->
+ expExpressionCommentLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ expExpressionDeltaInterval,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OBJECT_ID, cptr,
+ &StorageTmp->expExpressionPrefix,
+ &StorageTmp->
+ expExpressionPrefixLen);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->expExpressionErrors,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ expExpressionEntryStatus, &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->have_copied_auth_info,
+ &tmpint);
+ if (StorageTmp->have_copied_auth_info) {
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->pdu_version,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->pdu_securityModel,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->pdu_securityLevel,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OBJECT_ID, cptr,
+ (void *) (&StorageTmp->
+ pdu_tDomain),
+ &StorageTmp->pdu_tDomainLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pdu_transport,
+ &StorageTmp->pdu_transportLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pdu_community,
+ &StorageTmp->pdu_community_len);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pdu_securityName,
+ &StorageTmp->
+ pdu_securityNameLen);
+ }
+
+
+ snmpd_store_config(line);
+ }
+ }
+ DEBUGMSGTL(("expExpressionTable", "storage done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+
+
+/*
+ * var_expExpressionTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_expExpressionTable above.
+ */
+unsigned char *
+var_expExpressionTable(struct variable *vp,
+ oid * name,
+ size_t *length,
+ int exact,
+ size_t *var_len, WriteMethod ** write_method)
+{
+ struct expExpressionTable_data *StorageTmp = NULL;
+
+ DEBUGMSGTL(("expExpressionTable",
+ "var_expExpressionTable: Entering... \n"));
+
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(expExpressionTableStorage, vp, name, length, exact,
+ var_len, write_method)) == NULL) {
+ if (vp->magic == EXPEXPRESSIONENTRYSTATUS)
+ *write_method = write_expExpressionEntryStatus;
+ return NULL;
+ }
+
+
+ switch (vp->magic) {
+
+
+ case EXPEXPRESSION:
+ *write_method = write_expExpression;
+ *var_len = StorageTmp->expExpressionLen;
+ return (u_char *) StorageTmp->expExpression;
+
+ case EXPEXPRESSIONVALUETYPE:
+ *write_method = write_expExpressionValueType;
+ *var_len = sizeof(StorageTmp->expExpressionValueType);
+ return (u_char *) & StorageTmp->expExpressionValueType;
+
+ case EXPEXPRESSIONCOMMENT:
+ *write_method = write_expExpressionComment;
+ *var_len = StorageTmp->expExpressionCommentLen;
+ return (u_char *) StorageTmp->expExpressionComment;
+
+ case EXPEXPRESSIONDELTALNTERVAL:
+ *write_method = write_expExpressionDeltaInterval;
+ *var_len = sizeof(StorageTmp->expExpressionDeltaInterval);
+ return (u_char *) & StorageTmp->expExpressionDeltaInterval;
+
+ case EXPEXPRESSIONPREFIX:
+ *var_len = StorageTmp->expExpressionPrefixLen * sizeof(oid);
+ return (u_char *) StorageTmp->expExpressionPrefix;
+
+ case EXPEXPRESSIONERRORS:
+ *var_len = sizeof(StorageTmp->expExpressionErrors);
+ return (u_char *) & StorageTmp->expExpressionErrors;
+
+ case EXPEXPRESSIONENTRYSTATUS:
+ *write_method = write_expExpressionEntryStatus;
+ *var_len = sizeof(StorageTmp->expExpressionEntryStatus);
+ return (u_char *) & StorageTmp->expExpressionEntryStatus;
+
+ default:
+ ERROR_MSG("");
+
+ }
+ return NULL;
+}
+
+
+
+int
+write_expExpression(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct expExpressionTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(expExpressionTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+
+ DEBUGMSGTL(("expExpressionTable",
+ "write_expExpression entering action=%d... \n", action));
+ if ((StorageTmp =
+ header_complex(expExpressionTableStorage, NULL,
+ &name[sizeof(expExpressionTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to expExpression not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->expExpression;
+ tmplen = StorageTmp->expExpressionLen;
+ memdup((u_char **) & StorageTmp->expExpression, var_val,
+ var_val_len);
+ StorageTmp->expExpressionLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->expExpression);
+ StorageTmp->expExpression = tmpvar;
+ StorageTmp->expExpressionLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+
+}
+
+
+
+int
+write_expExpressionValueType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct expExpressionTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(expExpressionTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+
+ DEBUGMSGTL(("expExpressionTable",
+ "write_expExpressionValueType entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(expExpressionTableStorage, NULL,
+ &name[sizeof(expExpressionTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to expExpressionValueType not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->expExpressionValueType;
+ StorageTmp->expExpressionValueType = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->expExpressionValueType = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+
+}
+
+
+int
+write_expExpressionComment(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct expExpressionTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(expExpressionTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+
+ DEBUGMSGTL(("expExpressionTable",
+ "write_expExpression entering action=%d... \n", action));
+ if ((StorageTmp =
+ header_complex(expExpressionTableStorage, NULL,
+ &name[sizeof(expExpressionTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to expExpressionComment not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->expExpressionComment;
+ tmplen = StorageTmp->expExpressionCommentLen;
+ memdup((u_char **) & StorageTmp->expExpressionComment, var_val,
+ var_val_len);
+ StorageTmp->expExpressionCommentLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->expExpressionComment);
+ StorageTmp->expExpressionComment = tmpvar;
+ StorageTmp->expExpressionCommentLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+
+}
+
+
+int
+write_expExpressionDeltaInterval(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name,
+ size_t name_len)
+{
+ static int tmpvar;
+ struct expExpressionTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(expExpressionTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+
+ DEBUGMSGTL(("expExpressionTable",
+ "write_expExpressionValueType entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(expExpressionTableStorage, NULL,
+ &name[sizeof(expExpressionTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to expExpressionDeltalnterval not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->expExpressionDeltaInterval;
+ StorageTmp->expExpressionDeltaInterval = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->expExpressionDeltaInterval = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+
+}
+
+
+int
+write_expExpressionEntryStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ struct expExpressionTable_data *StorageTmp = NULL;
+ static struct expExpressionTable_data *StorageNew, *StorageDel;
+ size_t newlen =
+ name_len -
+ (sizeof(expExpressionTable_variables_oid) / sizeof(oid) + 3 - 1);
+ static int old_value;
+ int set_value;
+ static netsnmp_variable_list *vars, *vp;
+ struct header_complex_index *hciptr;
+
+ StorageTmp =
+ header_complex(expExpressionTableStorage, NULL,
+ &name[sizeof(expExpressionTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL);
+
+
+
+
+ if (var_val_type != ASN_INTEGER || var_val == NULL) {
+ snmp_log(LOG_ERR,
+ "write to expExpressionEntryStatus not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ set_value = *((long *) var_val);
+
+
+ /*
+ * check legal range, and notReady is reserved for us, not a user
+ */
+ if (set_value < 1 || set_value > 6 || set_value == RS_NOTREADY)
+ return SNMP_ERR_INCONSISTENTVALUE;
+
+
+ switch (action) {
+ case RESERVE1:
+ /*
+ * stage one: test validity
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * create the row now?
+ */
+
+
+ /*
+ * ditch illegal values now
+ */
+ if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE)
+ return SNMP_ERR_INCONSISTENTVALUE;
+
+
+ /*
+ * destroying a non-existent row is actually legal
+ */
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+
+
+ /*
+ * illegal creation values
+ */
+ if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else {
+ /*
+ * row exists. Check for a valid state change
+ */
+ if (set_value == RS_CREATEANDGO
+ || set_value == RS_CREATEANDWAIT) {
+ /*
+ * can't create a row that exists
+ */
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ if (StorageTmp->expExpressionEntryStatus == RS_ACTIVE &&
+ set_value != RS_DESTROY) {
+ /*
+ * "Once made active an entry may not be modified except to
+ * delete it." XXX: doesn't this in fact apply to ALL
+ * columns of the table and not just this one?
+ */
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ break;
+
+
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * creation
+ */
+ vars = NULL;
+
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0); /* expExpressionOwner */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0); /* expExpressionName */
+
+
+
+ if (header_complex_parse_oid
+ (&
+ (name
+ [sizeof(expExpressionTable_variables_oid) / sizeof(oid) +
+ 2]), newlen, vars) != SNMPERR_SUCCESS) {
+ /*
+ * XXX: free, zero vars
+ */
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+ vp = vars;
+
+
+ StorageNew = create_expExpressionTable_data();
+
+ StorageNew->expExpressionOwner = malloc(vp->val_len + 1);
+ memcpy(StorageNew->expExpressionOwner, vp->val.string,
+ vp->val_len);
+ StorageNew->expExpressionOwner[vp->val_len] = '\0';
+ StorageNew->expExpressionOwnerLen = vp->val_len;
+
+ vp = vp->next_variable;
+ StorageNew->expExpressionName = malloc(vp->val_len + 1);
+ memcpy(StorageNew->expExpressionName, vp->val.string,
+ vp->val_len);
+ StorageNew->expExpressionName[vp->val_len] = '\0';
+ StorageNew->expExpressionNameLen = vp->val_len;
+
+ vp = vp->next_variable;
+
+ StorageNew->expExpressionEntryStatus = set_value;
+
+ }
+
+
+ break;
+
+
+
+
+ case FREE:
+ /*
+ * XXX: free, zero vars
+ */
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in set_value for you to
+ * use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in
+ * the UNDO case
+ */
+
+
+ if (StorageTmp == NULL) {
+ /*
+ * row creation, so add it
+ */
+ if (StorageNew != NULL)
+ expExpressionTable_add(StorageNew);
+ /*
+ * XXX: ack, and if it is NULL?
+ */
+ } else if (set_value != RS_DESTROY) {
+ /*
+ * set the flag?
+ */
+ old_value = StorageTmp->expExpressionEntryStatus;
+ StorageTmp->expExpressionEntryStatus = *((long *) var_val);
+ } else {
+ /*
+ * destroy... extract it for now
+ */
+ hciptr =
+ header_complex_find_entry(expExpressionTableStorage,
+ StorageTmp);
+ StorageDel =
+ header_complex_extract_entry(&expExpressionTableStorage,
+ hciptr);
+ }
+ break;
+
+
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * row creation, so remove it again
+ */
+ hciptr =
+ header_complex_find_entry(expExpressionTableStorage,
+ StorageTmp);
+ StorageDel =
+ header_complex_extract_entry(&expExpressionTableStorage,
+ hciptr);
+ /*
+ * XXX: free it
+ */
+ } else if (StorageDel != NULL) {
+ /*
+ * row deletion, so add it again
+ */
+ expExpressionTable_add(StorageDel);
+ } else {
+ StorageTmp->expExpressionEntryStatus = old_value;
+ }
+ break;
+
+
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ if (StorageDel != NULL) {
+ StorageDel = 0;
+ /*
+ * XXX: free it, its dead
+ */
+ } else {
+ if (StorageTmp
+ && StorageTmp->expExpressionEntryStatus ==
+ RS_CREATEANDGO) {
+ StorageTmp->expExpressionEntryStatus = RS_ACTIVE;
+ } else if (StorageTmp &&
+ StorageTmp->expExpressionEntryStatus ==
+ RS_CREATEANDWAIT) {
+ StorageTmp->expExpressionEntryStatus = RS_NOTINSERVICE;
+ }
+ }
+ if (StorageTmp &&
+ StorageTmp->expExpressionEntryStatus == RS_ACTIVE &&
+ !StorageTmp->have_copied_auth_info) {
+
+ netsnmp_agent_session *asp =
+ netsnmp_get_current_agent_session();
+ netsnmp_pdu *pdu = NULL;
+
+ if (!asp) {
+ snmp_log(LOG_ERR,
+ "snmpTriggerTable: can't get master session for authentication params\n");
+ } else {
+ pdu = asp->orig_pdu;
+ if (!pdu) {
+ snmp_log(LOG_ERR,
+ "snmpTriggerTable: can't get master pdu for authentication params\n");
+ }
+ }
+
+ if (pdu) {
+ DEBUGMSGTL(("expExpressionTest",
+ "copying PDU auth info\n"));
+ StorageTmp->pdu_version = pdu->version;
+ StorageTmp->pdu_securityModel = pdu->securityModel;
+ StorageTmp->pdu_securityLevel = pdu->securityLevel;
+ StorageTmp->pdu_tDomain = pdu->tDomain;
+ StorageTmp->pdu_tDomainLen = pdu->tDomainLen;
+ if (pdu->transport_data != NULL) {
+ StorageTmp->pdu_transport =
+ malloc(pdu->transport_data_length);
+ memcpy(StorageTmp->pdu_transport, pdu->transport_data,
+ pdu->transport_data_length);
+ }
+ StorageTmp->pdu_transportLen = pdu->transport_data_length;
+ if (pdu->community) {
+ StorageTmp->pdu_community =
+ calloc(1, pdu->community_len + 1);
+ memcpy(StorageTmp->pdu_community, pdu->community,
+ pdu->community_len);
+ StorageTmp->pdu_community_len = pdu->community_len;
+ } else {
+ StorageTmp->pdu_community = NULL;
+ StorageTmp->pdu_community_len = 0;
+ }
+ if (pdu->securityName) {
+ StorageTmp->pdu_securityName =
+ calloc(1, pdu->securityNameLen + 1);
+ memcpy(StorageTmp->pdu_securityName, pdu->securityName,
+ pdu->securityNameLen);
+ StorageTmp->pdu_securityNameLen = pdu->securityNameLen;
+ } else {
+ StorageTmp->pdu_securityName = NULL;
+ StorageTmp->pdu_securityNameLen = 0;
+ }
+ StorageTmp->have_copied_auth_info = 1;
+ }
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expExpressionTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expExpressionTable.h
new file mode 100644
index 0000000000..6c139f8319
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expExpressionTable.h
@@ -0,0 +1,139 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name: expExpressionTable.h
+ *File Description: head file.
+ *
+ *Current Version:1.0
+ *Author:JianShun Tong
+ *Date:2004.8.20
+ */
+
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+
+#ifndef _MIBGROUP_EXPEXPRESSIONTABLE_H
+#define _MIBGROUP_EXPEXPRESSIONTABLE_H
+
+/*
+ * we may use header_complex from the header_complex module
+ */
+
+
+config_require(header_complex)
+
+ /*
+ * our storage structure(s)
+ */
+ struct expExpressionTable_data {
+
+ /*
+ * expExpressionTable
+ */
+ char *expExpressionOwner;
+ size_t expExpressionOwnerLen;
+ char *expExpressionName;
+ size_t expExpressionNameLen;
+ char *expExpression;
+ size_t expExpressionLen;
+ long expExpressionValueType;
+ char *expExpressionComment;
+ size_t expExpressionCommentLen;
+ long expExpressionDeltaInterval;
+ oid *expExpressionPrefix;
+ size_t expExpressionPrefixLen;
+ unsigned long expExpressionErrors;
+ long expExpressionEntryStatus;
+
+ /*
+ * expError Table
+ */
+ unsigned long expErrorTime;
+ long expErrorIndex;
+ long expErrorCode;
+ oid *expErrorInstance;
+ size_t expErrorInstanceLen;
+
+ /*
+ * internal variables
+ */
+ int storageType;
+
+ /*
+ * other tables storage
+ */
+ struct header_complex_index *hc_ObjectTableStorage;
+ struct header_complex_index *hc_ValueTableStorage;
+
+
+
+ /*
+ * pdu auth contents
+ */
+ long have_copied_auth_info;
+ long pdu_version;
+ long pdu_securityModel;
+ long pdu_securityLevel;
+ void *pdu_transport;
+ size_t pdu_transportLen;
+ const oid *pdu_tDomain;
+ size_t pdu_tDomainLen;
+ u_char *pdu_community;
+ size_t pdu_community_len;
+ char *pdu_contextName;
+ size_t pdu_contextNameLen;
+ char *pdu_securityName;
+ size_t pdu_securityNameLen;
+ };
+
+
+
+#define EXPEXPRESSION_COUNTER32 1
+#define EXPEXPRESSION_UNSIGNED32 2
+#define EXPEXPRESSION_TIMETICKS 3
+#define EXPEXPRESSION_INTEGER32 4
+#define EXPEXPRESSION_IPADDRESS 5
+#define EXPEXPRESSION_OCTETSTRING 6
+#define EXPEXPRESSION_OBJECTID 7
+#define EXPEXPRESSION_COUNTER64 8
+
+
+#define EXP_FAILURE_INVALIDSYNTAX 1
+#define EXP_FAILURE_UNDEFINEOBJECTINDEX 2
+#define EXP_FAILURE_UNRECOGNIZEOPERATOR 3
+#define EXP_FAILURE_UNRECOGNIZEDFUNCTION 4
+#define EXP_FAILURE_INVALIDOPERANDTYPE 5
+#define EXP_FAILURE_UNMATCHEDPARENTHESIS 6
+#define EXP_FAILURE_TOOMANYWILDCARDVALUES 7
+#define EXP_FAILURE_RECURSION 8
+#define EXP_FAILURE_DELTATOOSHORT 9
+#define EXP_FAILURE_RESOURCEUNAVAILABLE 10
+#define EXP_FAILURE_DIVIDEBYZERO 11
+
+
+/*
+ * function prototypes
+ */
+
+
+ void init_expExpressionTable(void);
+ FindVarMethod var_expExpressionTable;
+ SNMPCallback store_expExpressionTable;
+ void parse_expExpressionTable(const char *, char *);
+
+ WriteMethod write_expExpression;
+ WriteMethod write_expExpressionValueType;
+ WriteMethod write_expExpressionComment;
+ WriteMethod write_expExpressionDeltaInterval;
+ WriteMethod write_expExpressionEntryStatus;
+
+
+
+
+
+#endif /*_MIBGROUP_EXPEXPRESSIONTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expObjectTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expObjectTable.c
new file mode 100644
index 0000000000..6de4bf5feb
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expObjectTable.c
@@ -0,0 +1,1447 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name: expObjectTable.c
+ *File Description: expObjectTable MIB operation.
+ *
+ *Current Version:1.0
+ *Author:JianShun Tong
+ *Date:2004.8.20
+ */
+
+
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent.
+ */
+
+
+/*
+ * This should always be included first before anything else
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+
+/*
+ * minimal include directives
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "expExpressionTable.h"
+#include "expObjectTable.h"
+
+
+/*
+ * expObjectTable_variables_oid:
+ * this is the top level oid that we want to register under. This
+ * is essentially a prefix, with the suffix appearing in the
+ * variable below.
+ */
+oid TimeInstance[] = { 1, 3, 6, 1, 2, 1, 1, 3, 0 };
+
+oid expObjectTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 90, 1, 2, 3 };
+
+/*
+ * variable2 expObjectTable_variables:
+ */
+
+struct variable2 expObjectTable_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+#define EXPOBJECTID 2
+ {EXPOBJECTID, ASN_OBJECT_ID, RWRITE, var_expObjectTable, 2, {1, 2}},
+#define EXPOBJECTIDWILDCARD 3
+ {EXPOBJECTIDWILDCARD, ASN_INTEGER, RWRITE, var_expObjectTable, 2, {1, 3}},
+#define EXPOBJECTSAMPLETYPE 4
+ {EXPOBJECTSAMPLETYPE, ASN_INTEGER, RWRITE, var_expObjectTable, 2, {1, 4}},
+#define EXPOBJECTDELTADISCONTINUITYID 5
+ {EXPOBJECTDELTADISCONTINUITYID, ASN_OBJECT_ID, RWRITE, var_expObjectTable, 2, {1, 5}},
+#define EXPOBJECTDISCONTINUITYIDWILDCARD 6
+ {EXPOBJECTDISCONTINUITYIDWILDCARD, ASN_INTEGER, RWRITE, var_expObjectTable, 2, {1, 6}},
+#define EXPOBJECTDISCONTINUITYIDTYPE 7
+ {EXPOBJECTDISCONTINUITYIDTYPE, ASN_INTEGER, RWRITE, var_expObjectTable, 2, {1, 7}},
+#define EXPOBJECTCONDITIONAL 8
+ {EXPOBJECTCONDITIONAL, ASN_OBJECT_ID, RWRITE, var_expObjectTable, 2, {1, 8}},
+#define EXPOBJECTCONDITIONALWILDCARD 9
+ {EXPOBJECTCONDITIONALWILDCARD, ASN_INTEGER, RWRITE, var_expObjectTable, 2, {1, 9}},
+#define EXPOBJECTENTRYSTATUS 10
+ {EXPOBJECTENTRYSTATUS, ASN_INTEGER, RWRITE, var_expObjectTable, 2, {1, 10}}
+};
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+extern struct header_complex_index *expExpressionTableStorage;
+extern struct header_complex_index *expValueTableStorage;
+
+struct header_complex_index *expObjectTableStorage = NULL;
+
+/*
+ * init_expObjectTable():
+ * Initialization routine. This is called when the agent starts up.
+ * At a minimum, registration of your variables should take place here.
+ */
+void
+init_expObjectTable(void)
+{
+ DEBUGMSGTL(("expObjectTable", "initializing... "));
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("expObjectTable",
+ expObjectTable_variables, variable2,
+ expObjectTable_variables_oid);
+
+ /*
+ * register our config handler(s) to deal with registrations
+ */
+ snmpd_register_config_handler("expObjectTable", parse_expObjectTable,
+ NULL, NULL);
+
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_expObjectTable, NULL);
+
+ DEBUGMSGTL(("expObjectTable", "done.\n"));
+}
+
+
+struct expObjectTable_data *
+create_expObjectTable_data(void)
+{
+ struct expObjectTable_data *StorageNew;
+
+ StorageNew = SNMP_MALLOC_STRUCT(expObjectTable_data);
+
+ /*
+ * fill in default row values here into StorageNew
+ */
+ /*
+ * fill in values for all tables (even if not
+ * appropriate), since its easier to do here than anywhere
+ * else
+ */
+
+ StorageNew->expObjectIDWildcard = EXPOBJCETIDWILDCARD_FALSE;
+ StorageNew->expObjectSampleType = EXPOBJCETSAMPLETYPE_ABSOLUTEVALUE;
+ memdup((unsigned char **)
+ &(StorageNew->expObjectDeltaDiscontinuityID),
+ (unsigned char *) TimeInstance, sizeof(TimeInstance));
+ StorageNew->expObjectDeltaDiscontinuityIDLen =
+ sizeof(TimeInstance) / sizeof(oid);
+
+
+
+
+ StorageNew->expObjectDiscontinuityIDWildcard =
+ EXPOBJCETDISCONTINUITYIDWILDCARD_FALSE;
+ StorageNew->expObjectDiscontinuityIDType =
+ EXPOBJECTDISCONTINUITYIDTYPE_TIMETICKS;
+
+ StorageNew->expObjectConditional = calloc(1, sizeof(oid) * 2); /* 0.0 */
+ StorageNew->expObjectConditionalLen = 2;
+
+ StorageNew->expObjectID = calloc(1, sizeof(oid) * 2); /* 0.0 */
+ StorageNew->expObjectIDLen = 2;
+
+ StorageNew->expObjectConditionalWildcard =
+ EXPOBJECTCONDITIONALWILDCARD_FALSE;
+ StorageNew->storageType = ST_NONVOLATILE;
+
+ return StorageNew;
+}
+
+int
+expObjectTable_add(struct expObjectTable_data *thedata)
+{
+ netsnmp_variable_list *vars = NULL;
+
+
+ DEBUGMSGTL(("expObjectTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->expExpressionOwner, thedata->expExpressionOwnerLen); /* expExpressionOwner */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->expExpressionName, thedata->expExpressionNameLen); /* expExpressionName */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_UNSIGNED, (char *) &thedata->expObjectIndex, sizeof(thedata->expObjectIndex)); /* expExpressionName */
+
+
+
+
+ header_complex_add_data(&expObjectTableStorage, vars, thedata);
+ DEBUGMSGTL(("expObjectTable", "registered an entry\n"));
+
+
+ DEBUGMSGTL(("expObjectTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+
+/*
+ * parse_mteTriggerTable():
+ * parses .conf file entries needed to configure the mib.
+ */
+void
+parse_expObjectTable(const char *token, char *line)
+{
+ size_t tmpint;
+ oid *tmpoid = NULL;
+ struct expObjectTable_data *StorageTmp =
+ SNMP_MALLOC_STRUCT(expObjectTable_data);
+
+ DEBUGMSGTL(("expObjectTable", "parsing config... "));
+
+ if (StorageTmp == NULL) {
+ config_perror("malloc failure");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->expExpressionOwner,
+ &StorageTmp->expExpressionOwnerLen);
+ if (StorageTmp->expExpressionOwner == NULL) {
+ config_perror("invalid specification for expExpressionOwner");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->expExpressionName,
+ &StorageTmp->expExpressionNameLen);
+ if (StorageTmp->expExpressionName == NULL) {
+ config_perror("invalid specification for expExpressionName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->expObjectIndex, &tmpint);
+
+ line =
+ read_config_read_data(ASN_OBJECT_ID, line,
+ &StorageTmp->expObjectID,
+ &StorageTmp->expObjectIDLen);
+ if (StorageTmp->expObjectID == NULL) {
+ config_perror("invalid specification for expObjectID");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->expObjectIDWildcard, &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->expObjectSampleType, &tmpint);
+
+ line =
+ read_config_read_data(ASN_OBJECT_ID, line,
+ &StorageTmp->expObjectDeltaDiscontinuityID,
+ &StorageTmp->
+ expObjectDeltaDiscontinuityIDLen);
+ if (StorageTmp->expObjectDeltaDiscontinuityID == NULL) {
+ config_perror
+ ("invalid specification for expObjectDeltaDiscontinuityID");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->
+ expObjectDiscontinuityIDWildcard, &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->expObjectDiscontinuityIDType,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_OBJECT_ID, line,
+ &StorageTmp->expObjectConditional,
+ &StorageTmp->expObjectConditionalLen);
+ if (StorageTmp->expObjectConditional == NULL) {
+ config_perror("invalid specification for expObjectConditional");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->expObjectConditionalWildcard,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->expObjectEntryStatus, &tmpint);
+
+ StorageTmp->storageType = ST_NONVOLATILE;
+ expObjectTable_add(StorageTmp);
+
+ DEBUGMSGTL(("expObjectTable", "done.\n"));
+
+}
+
+
+
+/*
+ * store_expExpressionTable():
+ * stores .conf file entries needed to configure the mib.
+ */
+int
+store_expObjectTable(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr;
+ size_t tmpint;
+ struct expObjectTable_data *StorageTmp;
+ struct header_complex_index *hcindex;
+
+ DEBUGMSGTL(("expObjectTable", "storing data... "));
+
+ for (hcindex = expObjectTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ StorageTmp = (struct expObjectTable_data *) hcindex->data;
+
+
+
+ if (StorageTmp->storageType == ST_NONVOLATILE) {
+
+ memset(line, 0, sizeof(line));
+ strcat(line, "expObjectTable ");
+ cptr = line + strlen(line);
+ /*
+ * expObjectTable
+ */
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->expExpressionOwner,
+ &StorageTmp->expExpressionOwnerLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->expExpressionName,
+ &StorageTmp->expExpressionNameLen);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->expObjectIndex,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OBJECT_ID, cptr,
+ &StorageTmp->expObjectID,
+ &StorageTmp->expObjectIDLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->expObjectIDWildcard,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->expObjectSampleType,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OBJECT_ID, cptr,
+ &StorageTmp->
+ expObjectDeltaDiscontinuityID,
+ &StorageTmp->
+ expObjectDeltaDiscontinuityIDLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ expObjectDiscontinuityIDWildcard,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ expObjectDiscontinuityIDType,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OBJECT_ID, cptr,
+ &StorageTmp->expObjectConditional,
+ &StorageTmp->
+ expObjectConditionalLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ expObjectConditionalWildcard,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->expObjectEntryStatus,
+ &tmpint);
+ snmpd_store_config(line);
+ }
+ }
+ DEBUGMSGTL(("expObjectTable", "storage done\n"));
+}
+
+
+/*
+ * var_expObjectTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_expObjectTable above.
+ */
+unsigned char *
+var_expObjectTable(struct variable *vp,
+ oid * name,
+ size_t *length,
+ int exact, size_t *var_len, WriteMethod ** write_method)
+{
+ struct expObjectTable_data *StorageTmp = NULL;
+
+
+ DEBUGMSGTL(("expObjectTable", "var_expObjectTable: Entering... \n"));
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(expObjectTableStorage, vp, name, length, exact,
+ var_len, write_method)) == NULL) {
+ if (vp->magic == EXPOBJECTENTRYSTATUS)
+ *write_method = write_expObjectEntryStatus;
+ return NULL;
+ }
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+
+ case EXPOBJECTID:
+ *write_method = write_expObjectID;
+ *var_len = StorageTmp->expObjectIDLen * sizeof(oid);
+ return (u_char *) StorageTmp->expObjectID;
+
+ case EXPOBJECTIDWILDCARD:
+ *write_method = write_expObjectIDWildcard;
+ *var_len = sizeof(StorageTmp->expObjectIDWildcard);
+ return (u_char *) & StorageTmp->expObjectIDWildcard;
+
+ case EXPOBJECTSAMPLETYPE:
+ *write_method = write_expObjectSampleType;
+ *var_len = sizeof(StorageTmp->expObjectSampleType);
+ return (u_char *) & StorageTmp->expObjectSampleType;
+
+ case EXPOBJECTDELTADISCONTINUITYID:
+ *write_method = write_expObjectDeltaDiscontinuityID;
+ *var_len =
+ StorageTmp->expObjectDeltaDiscontinuityIDLen * sizeof(oid);
+ return (u_char *) StorageTmp->expObjectDeltaDiscontinuityID;
+
+ case EXPOBJECTDISCONTINUITYIDWILDCARD:
+ *write_method = write_expObjectDiscontinuityIDWildcard;
+ *var_len = sizeof(StorageTmp->expObjectDiscontinuityIDWildcard);
+ return (u_char *) & StorageTmp->expObjectDiscontinuityIDWildcard;
+
+ case EXPOBJECTDISCONTINUITYIDTYPE:
+ *write_method = write_expObjectDiscontinuityIDWildcard;
+ *var_len = sizeof(StorageTmp->expObjectDiscontinuityIDType);
+ return (u_char *) & StorageTmp->expObjectDiscontinuityIDType;
+
+ case EXPOBJECTCONDITIONAL:
+ *write_method = write_expObjectConditional;
+ *var_len = StorageTmp->expObjectConditionalLen * sizeof(oid);
+ return (u_char *) StorageTmp->expObjectConditional;
+
+ case EXPOBJECTCONDITIONALWILDCARD:
+ *write_method = write_expObjectConditionalWildcard;
+ *var_len = sizeof(StorageTmp->expObjectConditionalWildcard);
+ return (u_char *) & StorageTmp->expObjectConditionalWildcard;
+
+ case EXPOBJECTENTRYSTATUS:
+ *write_method = write_expObjectEntryStatus;
+ *var_len = sizeof(StorageTmp->expObjectEntryStatus);
+ return (u_char *) & StorageTmp->expObjectEntryStatus;
+
+
+ default:
+ ERROR_MSG("");
+ }
+ return NULL;
+}
+
+int
+write_expObjectID(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static oid *tmpvar;
+ struct expObjectTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(expObjectTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("expObjectTable",
+ "write_expObjectID entering action=%d... \n", action));
+ if ((StorageTmp =
+ header_complex(expObjectTableStorage, NULL,
+ &name[sizeof(expObjectTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OBJECT_ID) {
+ snmp_log(LOG_ERR, "write to expObjectID not ASN_OBJECT_ID\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->expObjectID;
+ tmplen = StorageTmp->expObjectIDLen;
+ memdup((u_char **) & StorageTmp->expObjectID, var_val,
+ var_val_len);
+ StorageTmp->expObjectIDLen = var_val_len / sizeof(oid);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->expObjectID);
+ StorageTmp->expObjectID = tmpvar;
+ StorageTmp->expObjectIDLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ /*
+ * XXX: if the valueID has actually changed, shouldn't we dump any
+ * previous values, as these are from a different object?
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_expObjectIDWildcard(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct expObjectTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(expObjectTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("expObjectTable",
+ "write_expObjectIDWildcard entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(expObjectTableStorage, NULL,
+ &name[sizeof(expObjectTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to expObjectIDWildcard not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->expObjectIDWildcard;
+ StorageTmp->expObjectIDWildcard = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->expObjectIDWildcard = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+write_expObjectSampleType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct expObjectTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(expObjectTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("expObjectTable",
+ "write_expObjectSampleType entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(expObjectTableStorage, NULL,
+ &name[sizeof(expObjectTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to expObjectSampleTypenot ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->expObjectSampleType;
+ StorageTmp->expObjectSampleType = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->expObjectSampleType = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_expObjectDeltaDiscontinuityID(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name,
+ size_t name_len)
+{
+ static oid *tmpvar;
+ struct expObjectTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(expObjectTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("expObjectTable",
+ "write_expObjectDeltaDiscontinuityID entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(expObjectTableStorage, NULL,
+ &name[sizeof(expObjectTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OBJECT_ID) {
+ snmp_log(LOG_ERR,
+ "write to expObjectDeltaDiscontinuityID not ASN_OBJECT_ID\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->expObjectDeltaDiscontinuityID;
+ tmplen = StorageTmp->expObjectDeltaDiscontinuityIDLen;
+ memdup((u_char **) & StorageTmp->expObjectDeltaDiscontinuityID,
+ var_val, var_val_len);
+ StorageTmp->expObjectDeltaDiscontinuityIDLen =
+ var_val_len / sizeof(oid);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->expObjectDeltaDiscontinuityID);
+ StorageTmp->expObjectDeltaDiscontinuityID = tmpvar;
+ StorageTmp->expObjectDeltaDiscontinuityIDLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ /*
+ * XXX: if the valueID has actually changed, shouldn't we dump any
+ * previous values, as these are from a different object?
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_expObjectDiscontinuityIDWildcard(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct expObjectTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(expObjectTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("expObjectTable",
+ "write_expObjectDiscontinuityIDWildcard entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(expObjectTableStorage, NULL,
+ &name[sizeof(expObjectTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to expObjectDiscontinuityIDWildcard not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->expObjectDiscontinuityIDWildcard;
+ StorageTmp->expObjectDiscontinuityIDWildcard = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->expObjectDiscontinuityIDWildcard = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_expObjectDiscontinuityIDType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct expObjectTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(expObjectTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("expObjectTable",
+ "write_expObjectDiscontinuityIDWildcard entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(expObjectTableStorage, NULL,
+ &name[sizeof(expObjectTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to expObjectDiscontinuityIDType not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->expObjectDiscontinuityIDType;
+ StorageTmp->expObjectDiscontinuityIDType = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->expObjectDiscontinuityIDType = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_expObjectConditional(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static oid *tmpvar;
+ struct expObjectTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(expObjectTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("expObjectTable",
+ "write_expObjectConditional entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(expObjectTableStorage, NULL,
+ &name[sizeof(expObjectTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OBJECT_ID) {
+ snmp_log(LOG_ERR,
+ "write to expObjectConditional not ASN_OBJECT_ID\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->expObjectConditional;
+ tmplen = StorageTmp->expObjectConditionalLen;
+ memdup((u_char **) & StorageTmp->expObjectConditional, var_val,
+ var_val_len);
+ StorageTmp->expObjectConditionalLen = var_val_len / sizeof(oid);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->expObjectConditional);
+ StorageTmp->expObjectConditional = tmpvar;
+ StorageTmp->expObjectConditionalLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ /*
+ * XXX: if the valueID has actually changed, shouldn't we dump any
+ * previous values, as these are from a different object?
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+int
+write_expObjectConditionalWildcard(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct expObjectTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(expObjectTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("expObjectTable",
+ "write_expObjectConditionalWildcard entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(expObjectTableStorage, NULL,
+ &name[sizeof(expObjectTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to expObjectConditionalWildcard not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->expObjectConditionalWildcard;
+ StorageTmp->expObjectConditionalWildcard = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->expObjectConditionalWildcard = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+int
+write_expObjectEntryStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ struct expObjectTable_data *StorageTmp = NULL;
+ static struct expObjectTable_data *StorageNew, *StorageDel;
+ size_t newlen =
+ name_len - (sizeof(expObjectTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+ static int old_value;
+ int set_value;
+ static netsnmp_variable_list *vars, *vp;
+ struct header_complex_index *hciptr;
+
+ StorageTmp =
+ header_complex(expObjectTableStorage, NULL,
+ &name[sizeof(expObjectTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL);
+
+
+
+
+ if (var_val_type != ASN_INTEGER || var_val == NULL) {
+ snmp_log(LOG_ERR,
+ "write to expObjectEntryStatus not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ set_value = *((long *) var_val);
+
+
+ /*
+ * check legal range, and notReady is reserved for us, not a user
+ */
+ if (set_value < 1 || set_value > 6 || set_value == RS_NOTREADY)
+ return SNMP_ERR_INCONSISTENTVALUE;
+
+
+ switch (action) {
+ case RESERVE1:
+ /*
+ * stage one: test validity
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * create the row now?
+ */
+
+
+ /*
+ * ditch illegal values now
+ */
+ if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE)
+ return SNMP_ERR_INCONSISTENTVALUE;
+
+
+ /*
+ * destroying a non-existent row is actually legal
+ */
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+
+
+ /*
+ * illegal creation values
+ */
+ if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else {
+ /*
+ * row exists. Check for a valid state change
+ */
+ if (set_value == RS_CREATEANDGO
+ || set_value == RS_CREATEANDWAIT) {
+ /*
+ * can't create a row that exists
+ */
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ if (StorageTmp->expObjectEntryStatus == RS_ACTIVE &&
+ set_value != RS_DESTROY) {
+ /*
+ * "Once made active an entry may not be modified except to
+ * delete it." XXX: doesn't this in fact apply to ALL
+ * columns of the table and not just this one?
+ */
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ break;
+
+
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * creation
+ */
+ vars = NULL;
+
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0); /* expExpressionOwner */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0); /* expExpressionName */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_UNSIGNED, NULL, 0); /* expObjectIndex */
+
+
+
+ if (header_complex_parse_oid
+ (&
+ (name
+ [sizeof(expObjectTable_variables_oid) / sizeof(oid) +
+ 2]), newlen, vars) != SNMPERR_SUCCESS) {
+ /*
+ * XXX: free, zero vars
+ */
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+ vp = vars;
+
+
+ StorageNew = create_expObjectTable_data();
+
+ StorageNew->expExpressionOwner = malloc(vp->val_len + 1);
+ memcpy(StorageNew->expExpressionOwner, vp->val.string,
+ vp->val_len);
+ StorageNew->expExpressionOwner[vp->val_len] = '\0';
+ StorageNew->expExpressionOwnerLen = vp->val_len;
+
+ vp = vp->next_variable;
+ StorageNew->expExpressionName = malloc(vp->val_len + 1);
+ memcpy(StorageNew->expExpressionName, vp->val.string,
+ vp->val_len);
+
+ StorageNew->expExpressionName[vp->val_len] = '\0';
+ StorageNew->expExpressionNameLen = vp->val_len;
+
+ vp = vp->next_variable;
+ StorageNew->expObjectIndex = *vp->val.integer;
+
+ StorageNew->expObjectEntryStatus = set_value;
+
+ }
+
+
+ break;
+
+
+
+
+ case FREE:
+ /*
+ * XXX: free, zero vars
+ */
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in set_value for you to
+ * use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in
+ * the UNDO case
+ */
+
+
+ if (StorageTmp == NULL) {
+ /*
+ * row creation, so add it
+ */
+ if (StorageNew != NULL)
+ expObjectTable_add(StorageNew);
+ /*
+ * XXX: ack, and if it is NULL?
+ */
+ } else if (set_value != RS_DESTROY) {
+ /*
+ * set the flag?
+ */
+ old_value = StorageTmp->expObjectEntryStatus;
+ StorageTmp->expObjectEntryStatus = *((long *) var_val);
+ } else {
+ /*
+ * destroy... extract it for now
+ */
+ hciptr =
+ header_complex_find_entry(expObjectTableStorage,
+ StorageTmp);
+ StorageDel =
+ header_complex_extract_entry(&expObjectTableStorage,
+ hciptr);
+ }
+ break;
+
+
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * row creation, so remove it again
+ */
+ hciptr =
+ header_complex_find_entry(expObjectTableStorage,
+ StorageTmp);
+ StorageDel =
+ header_complex_extract_entry(&expObjectTableStorage,
+ hciptr);
+ /*
+ * XXX: free it
+ */
+ } else if (StorageDel != NULL) {
+ /*
+ * row deletion, so add it again
+ */
+ expObjectTable_add(StorageDel);
+ } else {
+ StorageTmp->expObjectEntryStatus = old_value;
+ }
+ break;
+
+
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ if (StorageDel != NULL) {
+ StorageDel = 0;
+ /*
+ * XXX: free it, its dead
+ */
+ } else {
+ if (StorageTmp
+ && StorageTmp->expObjectEntryStatus == RS_CREATEANDGO) {
+ StorageTmp->expObjectEntryStatus = RS_ACTIVE;
+ } else if (StorageTmp &&
+ StorageTmp->expObjectEntryStatus ==
+ RS_CREATEANDWAIT) {
+ StorageTmp->expObjectEntryStatus = RS_NOTINSERVICE;
+ }
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expObjectTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expObjectTable.h
new file mode 100644
index 0000000000..86fea31a6f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expObjectTable.h
@@ -0,0 +1,92 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name: expObjectTable.h
+ *File Description: head file.
+ *
+ *Current Version:1.0
+ *Author:JianShun Tong
+ *Date:2004.8.20
+ */
+
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+
+#ifndef _MIBGROUP_EXPOBJECTABLE_H
+#define _MIBGROUP_EXPOBJECTABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module
+ */
+config_require(header_complex)
+
+ struct expObjectTable_data {
+ char *expExpressionOwner;
+ size_t expExpressionOwnerLen;
+ char *expExpressionName;
+ size_t expExpressionNameLen;
+ unsigned long expObjectIndex;
+ oid *expObjectID;
+ size_t expObjectIDLen;
+ long expObjectIDWildcard;
+ long expObjectSampleType;
+ oid *expObjectDeltaDiscontinuityID;
+ size_t expObjectDeltaDiscontinuityIDLen;
+ long expObjectDiscontinuityIDWildcard;
+ long expObjectDiscontinuityIDType;
+ oid *expObjectConditional;
+ size_t expObjectConditionalLen;
+ long expObjectConditionalWildcard;
+ long expObjectEntryStatus;
+
+
+ /*
+ * internal variables
+ */
+ int storageType;
+
+
+ };
+ /*
+ * enum definitions from the covered mib sections
+ */
+#define EXPOBJCETIDWILDCARD_TRUE 1
+#define EXPOBJCETIDWILDCARD_FALSE 2
+#define EXPOBJCETDISCONTINUITYIDWILDCARD_TRUE 1
+#define EXPOBJCETDISCONTINUITYIDWILDCARD_FALSE 2
+#define EXPOBJECTCONDITIONALWILDCARD_TRUE 1
+#define EXPOBJECTCONDITIONALWILDCARD_FALSE 2
+#define EXPOBJECTDISCONTINUITYIDTYPE_TIMETICKS 1
+#define EXPOBJECTDISCONTINUITYIDTYPE_TIMESTAMP 2
+#define EXPOBJECTDISCONTINUITYIDTYPE_DATEANDTIME 3
+#define EXPOBJCETSAMPLETYPE_ABSOLUTEVALUE 1
+#define EXPOBJCETSAMPLETYPE_DELTAVALUE 2
+#define EXPOBJCETSAMPLETYPE_CHANGEVALUE 3
+ /*
+ * function prototypes
+ */
+ void init_expObjectTable(void);
+ FindVarMethod var_expObjectTable;
+ SNMPCallback store_expObjectTable;
+ void parse_expObjectTable(const char *, char *);
+
+ WriteMethod write_expObjectID;
+ WriteMethod write_expObjectIDWildcard;
+ WriteMethod write_expObjectSampleType;
+ WriteMethod write_expObjectDeltaDiscontinuityID;
+ WriteMethod write_expObjectDiscontinuityIDWildcard;
+ WriteMethod write_expObjectDiscontinuityIDType;
+ WriteMethod write_expObjectConditional;
+ WriteMethod write_expObjectConditionalWildcard;
+ WriteMethod write_expObjectEntryStatus;
+
+
+
+
+#endif /* _MIBGROUP_EXPOBJECTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expValueTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expValueTable.c
new file mode 100644
index 0000000000..668988240d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expValueTable.c
@@ -0,0 +1,888 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name: expValueTable.c
+ *File Description: expValueTable MIB operation.
+ *
+ *Current Version:1.0
+ *Author:JianShun Tong
+ *Date:2004.8.20
+ */
+
+
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent.
+ */
+
+
+/*
+ * This should always be included first before anything else
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <stdio.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+
+/*
+ * minimal include directives
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "header_complex.h"
+#include "expExpressionTable.h"
+#include "expValueTable.h"
+#include "expObjectTable.h"
+
+
+/*
+ * expValueTable_variables_oid:
+ * this is the top level oid that we want to register under. This
+ * is essentially a prefix, with the suffix appearing in the
+ * variable below.
+ */
+
+oid expValueTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 90, 1, 3, 1 };
+
+struct s_node {
+ unsigned data;
+ struct s_node *next;
+};
+typedef struct s_node link;
+link *operater = NULL;
+link *operand = NULL;
+
+/*
+ * variable2 expObjectTable_variables:
+ */
+
+struct variable2 expValueTable_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+#define EXPVALUECOUNTER32VAL 2
+ {EXPVALUECOUNTER32VAL, ASN_COUNTER, RONLY, var_expValueTable, 2, {1, 2}},
+#define EXPVALUEUNSIGNED32VAL 3
+ {EXPVALUEUNSIGNED32VAL, ASN_UNSIGNED, RONLY, var_expValueTable, 2, {1, 3}},
+#define EXPVALUETIMETICKSVAL 4
+ {EXPVALUETIMETICKSVAL, ASN_UNSIGNED, RONLY, var_expValueTable, 2, {1, 4}},
+#define EXPVALUEINTEGER32VAL 5
+ {EXPVALUEINTEGER32VAL, ASN_INTEGER, RONLY, var_expValueTable, 2, {1, 5}},
+#define EXPVALUEIPADDRESSVAL 6
+ {EXPVALUEIPADDRESSVAL, ASN_IPADDRESS, RONLY, var_expValueTable, 2, {1, 6}},
+#define EXPVALUEOCTETSTRINGVAL 7
+ {EXPVALUEOCTETSTRINGVAL, ASN_OCTET_STR, RONLY, var_expValueTable, 2, {1, 7}},
+#define EXPVALUEOIDVAL 8
+ {EXPVALUEOIDVAL, ASN_OBJECT_ID, RONLY, var_expValueTable, 2, {1, 8}},
+#define EXPVALUECOUNTER64VAL 9
+ {EXPVALUECOUNTER64VAL, ASN_INTEGER, RONLY, var_expValueTable, 2, {1, 9}}
+};
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+extern struct header_complex_index *expExpressionTableStorage;
+extern struct header_complex_index *expObjectTableStorage;
+struct header_complex_index *expValueTableStorage = NULL;
+struct snmp_session session;
+
+/*
+ * init_expValueTable():
+ * Initialization routine. This is called when the agent starts up.
+ * At a minimum, registration of your variables should take place here.
+ */
+void
+init_expValueTable(void)
+{
+ DEBUGMSGTL(("expValueTable", "initializing... "));
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("expValueTable",
+ expValueTable_variables, variable2,
+ expValueTable_variables_oid);
+ init_snmp("snmpapp");
+
+ /*
+ * Initialize a "session" that defines who we're going to talk to
+ */
+ snmp_sess_init(&session); /* set up defaults */
+ session.peername = "localhost";
+
+ DEBUGMSGTL(("expValueTable", "done.\n"));
+}
+
+struct expValueTable_data *
+create_expValueTable_data(void)
+{
+ struct expValueTable_data *StorageNew;
+
+ StorageNew = SNMP_MALLOC_STRUCT(expValueTable_data);
+
+ /*
+ * fill in default row values here into StorageNew
+ */
+ /*
+ * fill in values for all tables (even if not
+ * appropriate), since its easier to do here than anywhere
+ * else
+ */
+ StorageNew->expExpressionOwner = strdup("");
+ StorageNew->expExpressionName = strdup("");
+ StorageNew->expValueInstance = calloc(1, sizeof(oid) * sizeof(2)); /* 0.0.0 */
+ StorageNew->expValueInstanceLen = 3;
+ return StorageNew;
+}
+
+/*
+ * mteTriggerTable_add(): adds a structure node to our data set
+ */
+int
+expValueTable_add(struct expExpressionTable_data *expression_data,
+ char *owner, size_t owner_len, char *name,
+ size_t name_len, oid * index, size_t index_len)
+{
+ netsnmp_variable_list *vars = NULL;
+ struct expValueTable_data *thedata, *StorageTmp;
+ struct header_complex_index *hcindex;
+ int founded = 0;
+ thedata = create_expValueTable_data();
+ thedata->expValueCounter32Val = 0;
+ thedata->expExpressionOwner = owner;
+ thedata->expExpressionOwnerLen = owner_len;
+ thedata->expExpressionName = name;
+ thedata->expExpressionNameLen = name_len;
+ thedata->expValueInstance = index;
+ thedata->expValueInstanceLen = index_len;
+ thedata->expression_data = expression_data;
+ DEBUGMSGTL(("expValueTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->expExpressionOwner, thedata->expExpressionOwnerLen); /* expExpressionOwner */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->expExpressionName, thedata->expExpressionNameLen); /* expExpressionName */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OBJECT_ID,
+ (u_char *) thedata->expValueInstance,
+ thedata->expValueInstanceLen * sizeof(oid));
+
+ for (hcindex = expValueTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ StorageTmp = (struct expValueTable_data *) hcindex->data;
+ if (!strcmp
+ (StorageTmp->expExpressionOwner, thedata->expExpressionOwner)
+ && (StorageTmp->expExpressionOwnerLen ==
+ thedata->expExpressionOwnerLen)
+ && !strcmp(StorageTmp->expExpressionName,
+ thedata->expExpressionName)
+ && (StorageTmp->expExpressionNameLen ==
+ thedata->expExpressionNameLen)
+ && !snmp_oid_compare(StorageTmp->expValueInstance,
+ StorageTmp->expValueInstanceLen,
+ thedata->expValueInstance,
+ thedata->expValueInstanceLen)) {
+ founded = 1;
+ break;
+ }
+
+ }
+ if (!founded) {
+ header_complex_add_data(&expValueTableStorage, vars, thedata);
+ DEBUGMSGTL(("expValueTable", "registered an entry\n"));
+ } else {
+ SNMP_FREE(thedata);
+ DEBUGMSGTL(("expValueTable",
+ "already have an entry, dont registe\n"));
+ }
+
+
+ DEBUGMSGTL(("expValueTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+
+
+
+unsigned long
+Evaluate_Expression(struct expValueTable_data *vtable_data)
+{
+
+ struct header_complex_index *hcindex;
+ struct expObjectTable_data *objstorage, *objfound;
+ struct expValueTable_data *valstorage;
+ valstorage = vtable_data;
+
+ char *expression;
+ char *result, *resultbak;
+ char *temp, *tempbak;
+ char intchar[10];
+ int dollar1, dollar2;
+ int i = 0, j, k, l;
+ long value;
+ unsigned long result_u_long;
+ temp = malloc(100);
+ result = malloc(100);
+ tempbak = temp;
+ memset(result, 0, 100);
+ *result = '\0';
+ resultbak = result;
+
+ expression = vtable_data->expression_data->expExpression;
+
+ while (*expression != '\0') {
+ if (*expression == '$') {
+ objfound = NULL;
+ i++;
+ for (j = 1; j < 100; j++) {
+ if ((*(expression + j) == '+') ||
+ (*(expression + j) == '-') ||
+ (*(expression + j) == '*') ||
+ (*(expression + j) == '/') ||
+ (*(expression + j) == '(') ||
+ (*(expression + j) == ')') ||
+ *(expression + j) == '\0') {
+ break;
+ }
+ }
+ strncpy(temp, expression + 1, j - 1);
+ *(temp + j - 1) = '\0';
+ l = atoi(temp);
+ expression = expression + j;
+ /*
+ * here use snmpget to get value
+ */
+ for (hcindex = expObjectTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ objstorage = (struct expObjectTable_data *) hcindex->data;
+ if (!strcmp
+ (objstorage->expExpressionOwner,
+ valstorage->expExpressionOwner)
+ && (objstorage->expExpressionOwnerLen ==
+ valstorage->expExpressionOwnerLen)
+ && !strcmp(objstorage->expExpressionName,
+ valstorage->expExpressionName)
+ && (objstorage->expExpressionNameLen ==
+ valstorage->expExpressionNameLen)
+ && (l == objstorage->expObjectIndex)) {
+ objfound = objstorage;
+ break;
+ }
+ }
+
+
+ if (!objfound) {
+ /* have err */
+ return 0;
+ }
+ struct snmp_session *ss;
+ struct snmp_pdu *pdu;
+ struct snmp_pdu *response;
+
+ oid anOID[MAX_OID_LEN];
+ size_t anOID_len;
+
+ memcpy(anOID, objfound->expObjectID,
+ objfound->expObjectIDLen * sizeof(oid));
+ anOID_len = objfound->expObjectIDLen;
+ if (objfound->expObjectIDWildcard == EXPOBJCETIDWILDCARD_TRUE) {
+ anOID_len =
+ anOID_len + valstorage->expValueInstanceLen - 2;
+ memcpy(anOID + objfound->expObjectIDLen,
+ valstorage->expValueInstance + 2,
+ (valstorage->expValueInstanceLen -
+ 2) * sizeof(oid));
+ }
+ struct variable_list *vars;
+ int status;
+ int count = 1;
+
+ /*
+ * Initialize the SNMP library
+ */
+
+ /*
+ * Initialize a "session" that defines who we're going to talk to
+ */
+ session.version = vtable_data->expression_data->pdu_version;
+
+ /*
+ * set the SNMPv1 community name used for authentication
+ */
+ session.community =
+ vtable_data->expression_data->pdu_community;
+ session.community_len =
+ vtable_data->expression_data->pdu_community_len;
+ /*
+ * Open the session
+ */
+ SOCK_STARTUP;
+ ss = snmp_open(&session); /* establish the session */
+
+ if (!ss) {
+ /* err */
+ exit(2);
+ }
+ pdu = snmp_pdu_create(SNMP_MSG_GET);
+ snmp_add_null_var(pdu, anOID, anOID_len);
+
+ /*
+ * Send the Request out.
+ */
+ status = snmp_synch_response(ss, pdu, &response);
+
+ /*
+ * Process the response.
+ */
+ if (status == STAT_SUCCESS
+ && response->errstat == SNMP_ERR_NOERROR) {
+ /*
+ * SUCCESS: Print the result variables
+ */
+
+ vars = response->variables;
+ value = *(vars->val.integer);
+ sprintf(intchar, "%u", value);
+ for (k = 1; k <= strlen(intchar); k++) {
+ *result = intchar[k - 1];
+ result++;
+ }
+
+ } else {
+ /*
+ * FAILURE: print what went wrong!
+ */
+
+ if (status == STAT_SUCCESS)
+ fprintf(stderr, "Error in packet\nReason: %s\n",
+ snmp_errstring(response->errstat));
+ else
+ snmp_sess_perror("snmpget", ss);
+
+ }
+
+ /*
+ * Clean up:
+ * 1) free the response.
+ * 2) close the session.
+ */
+ if (response)
+ snmp_free_pdu(response);
+ snmp_close(ss);
+
+ SOCK_CLEANUP;
+
+ } else {
+ *result = *expression;
+ result++;
+ expression++;
+ }
+ }
+ result_u_long = get_result(resultbak);
+ free(tempbak);
+ free(resultbak);
+ return result_u_long;
+}
+
+
+
+
+
+
+
+
+void
+expValueTable_clean(void *data)
+{
+ struct expValueTable_data *cleanme =
+ (struct expValueTable_data *) data;
+ SNMP_FREE(cleanme->expValueInstance);
+ SNMP_FREE(cleanme->expValueIpAddressVal);
+ SNMP_FREE(cleanme->expValueOctetStringVal);
+ SNMP_FREE(cleanme->expValueOidVal);
+ SNMP_FREE(cleanme);
+}
+
+
+
+void
+build_valuetable()
+{
+ struct expExpressionTable_data *expstorage, *expfound;
+ struct expObjectTable_data *objstorage, *objfound = NULL;
+ struct header_complex_index *hcindex, *object_hcindex;
+ char *owner;
+ size_t owner_len;
+ char *name;
+ size_t name_len;
+ char *expression;
+ size_t expression_len;
+ oid *index;
+
+
+ char *result, *resultbak;
+ char *temp, *tempbak;
+ int i = 0, j, k, l;
+ temp = malloc(100);
+ result = malloc(100);
+ tempbak = temp;
+ memset(result, 0, 100);
+ *result = '\0';
+ resultbak = result;
+
+
+ DEBUGMSGTL(("expValueTable", "building valuetable... \n"));
+
+ for (hcindex = expExpressionTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ expstorage = (struct expExpressionTable_data *) hcindex->data;
+ if (expstorage->expExpressionEntryStatus == RS_ACTIVE) {
+ expression = expstorage->expExpression;
+ expression_len = expstorage->expExpressionLen;
+ while (*expression != '\0') {
+ if (*expression == '$') {
+ i++;
+ for (j = 1; j < 100; j++) {
+ if ((*(expression + j) == '+') ||
+ (*(expression + j) == '-') ||
+ (*(expression + j) == '*') ||
+ (*(expression + j) == '/') ||
+ (*(expression + j) == '(') ||
+ (*(expression + j) == ')') ||
+ *(expression + j) == '\0') {
+ break;
+ }
+ }
+ strncpy(temp, expression + 1, j - 1);
+ *(temp + j - 1) = '\0';
+ l = atoi(temp);
+ for (object_hcindex = expObjectTableStorage;
+ object_hcindex != NULL;
+ object_hcindex = object_hcindex->next) {
+ objstorage =
+ (struct expObjectTable_data *) object_hcindex->
+ data;
+ if (!strcmp
+ (objstorage->expExpressionOwner,
+ expstorage->expExpressionOwner)
+ && (objstorage->expExpressionOwnerLen ==
+ expstorage->expExpressionOwnerLen)
+ && !strcmp(objstorage->expExpressionName,
+ expstorage->expExpressionName)
+ && (objstorage->expExpressionNameLen ==
+ expstorage->expExpressionNameLen)
+ && (l == objstorage->expObjectIndex)) {
+ if (objfound == NULL) {
+ expfound = expstorage;
+ objfound = objstorage;
+ }
+ if (objstorage->expObjectIDWildcard ==
+ EXPOBJCETIDWILDCARD_TRUE)
+ objfound = objstorage;
+ }
+ }
+ expression = expression + j;
+ } else {
+ expression++;
+ }
+ };
+ }
+
+ if (!objfound) {
+ continue;
+ }
+ if (objfound->expObjectIDWildcard == EXPOBJCETIDWILDCARD_FALSE) {
+ index = calloc(1, MAX_OID_LEN);
+ *index = 0;
+ *(index + 1) = 0;
+ *(index + 2) = 0;
+ expValueTable_add(expstorage, objfound->expExpressionOwner,
+ objfound->expExpressionOwnerLen,
+ objfound->expExpressionName,
+ objfound->expExpressionNameLen, index, 3);
+ } else {
+ oid *targetOID;
+ size_t taggetOID_len;
+ targetOID = objfound->expObjectID;
+ struct snmp_pdu *pdu;
+ struct snmp_pdu *response;
+ oid *next_OID;
+ size_t next_OID_len;
+ taggetOID_len = objfound->expObjectIDLen;
+ struct variable_list *vars;
+ int status;
+ int count = 1;
+ struct snmp_session *ss;
+ /*
+ * Initialize the SNMP library
+ */
+
+
+ /*
+ * set the SNMP version number
+ */
+ session.version = expstorage->pdu_version;
+
+ /*
+ * set the SNMPv1 community name used for authentication
+ */
+ session.community = expstorage->pdu_community;
+ session.community_len = expstorage->pdu_community_len;
+
+ /*
+ * Open the session
+ */
+ SOCK_STARTUP;
+ ss = snmp_open(&session); /* establish the session */
+ if (!ss) {
+ snmp_perror("ack");
+ snmp_log(LOG_ERR, "something horrible happened!!!\n");
+ exit(2);
+ }
+
+ next_OID = targetOID;
+ next_OID_len = taggetOID_len;
+ do {
+ index = calloc(1, MAX_OID_LEN);
+ pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
+
+ snmp_add_null_var(pdu, next_OID, next_OID_len);
+
+ /*
+ * Send the Request out.
+ */
+ status = snmp_synch_response(ss, pdu, &response);
+
+ /*
+ * Process the response.
+ */
+ if (status == STAT_SUCCESS
+ && response->errstat == SNMP_ERR_NOERROR) {
+ /*
+ * SUCCESS: Print the result variables
+ */
+
+ if (((response->variables->type >= SNMP_NOSUCHOBJECT &&
+ response->variables->type <= SNMP_ENDOFMIBVIEW)
+ || snmp_oid_compare(targetOID, taggetOID_len,
+ response->variables->name,
+ taggetOID_len) != 0)) {
+ break;
+ }
+ /* add to expValueTable */
+
+ *index = 0;
+ *(index + 1) = 0;
+ memcpy(index + 2,
+ response->variables->name + taggetOID_len,
+ (response->variables->name_length -
+ taggetOID_len) * sizeof(oid));
+ expValueTable_add(expstorage,
+ objfound->expExpressionOwner,
+ objfound->expExpressionOwnerLen,
+ objfound->expExpressionName,
+ objfound->expExpressionNameLen,
+ index,
+ response->variables->name_length -
+ taggetOID_len + 2);
+
+ next_OID = response->variables->name;
+
+ next_OID_len = response->variables->name_length;
+
+
+
+
+ } else {
+ /*
+ * FAILURE: print what went wrong!
+ */
+ if (status == STAT_SUCCESS)
+ fprintf(stderr, "Error in packet\nReason: %s\n",
+ snmp_errstring(response->errstat));
+ else
+ snmp_sess_perror("snmpget", ss);
+ }
+ } while (TRUE);
+
+ }
+
+ }
+
+}
+
+
+
+/*
+ * var_expValueTable():
+ */
+unsigned char *
+var_expValueTable(struct variable *vp,
+ oid * name,
+ size_t *length,
+ int exact, size_t *var_len, WriteMethod ** write_method)
+{
+
+ static netsnmp_variable_list *vars;
+ size_t newlen =
+ *length - (sizeof(expValueTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+ struct expValueTable_data *StorageTmp = NULL;
+ unsigned int counter32;
+
+
+
+
+ DEBUGMSGTL(("expValueTable", "var_expValueTable: Entering... \n"));
+
+ /*
+ * before we build valuetable we must free any other valutable if exist
+ */
+ header_complex_free_all(expValueTableStorage, expValueTable_clean);
+ expValueTableStorage = NULL;
+
+
+ build_valuetable();
+
+
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(expValueTableStorage, vp, name, length, exact,
+ var_len, write_method)) == NULL)
+ return NULL;
+
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+ /*
+ * we only support counter32val
+ */
+
+ case EXPVALUECOUNTER32VAL:
+ StorageTmp->expValueCounter32Val = Evaluate_Expression(StorageTmp);
+ *var_len = sizeof(StorageTmp->expValueCounter32Val);
+ return (u_char *) & StorageTmp->expValueCounter32Val;
+
+ case EXPVALUEUNSIGNED32VAL:
+ /* var_len = sizeof(StorageTmp->expValueUnsigned32Val); */
+ /* return (u_char *) & StorageTmp->expValueUnsigned32Val; */
+ return NULL;
+
+ case EXPVALUETIMETICKSVAL:
+ /* var_len = sizeof(StorageTmp->expValueTimeTicksVal); */
+ /* return (u_char *) & StorageTmp->expValueTimeTicksVal; */
+ return NULL;
+
+ case EXPVALUEINTEGER32VAL:
+ /* var_len = sizeof(StorageTmp->expValueInteger32Val); */
+ /* return (u_char *) & StorageTmp->expValueInteger32Val; */
+ return NULL;
+
+ case EXPVALUEIPADDRESSVAL:
+ /* var_len = sizeof(StorageTmp->expValueIpAddressVal); */
+ /* return (u_char *) & StorageTmp->expValueIpAddressVal; */
+ return NULL;
+
+ case EXPVALUEOCTETSTRINGVAL:
+ /* var_len = sizeof(StorageTmp->expValueOctetStringVal); */
+ /* return (u_char *) & StorageTmp->expValueOctetStringVal; */
+ return NULL;
+
+ case EXPVALUEOIDVAL:
+ /* var_len = StorageTmp->expValueOidValLen; */
+ /* return (u_char *) & StorageTmp->expValueOidVal; */
+ return NULL;
+
+ case EXPVALUECOUNTER64VAL:
+ /* var_len = sizeof(StorageTmp->expValueCounter64Val); */
+ /* return (u_char *) & StorageTmp->expValueCounter64Val; */
+ return NULL;
+ default:
+ ERROR_MSG("");
+ }
+}
+
+
+
+
+
+void
+push(link ** stack, unsigned long value)
+{
+ link *newnode;
+ newnode = (link *) malloc(sizeof(link));
+ if (!newnode) {
+ printf("\nMemory allocation failure!");
+ return;
+ }
+ newnode->data = value;
+ newnode->next = *stack;
+ *stack = newnode;
+}
+
+unsigned long
+pop(link ** stack)
+{
+ unsigned long value;
+ link *top;
+ top = *stack;
+ *stack = (*stack)->next;
+ value = top->data;
+ free(top);
+ return value;
+}
+
+int
+priority(char operater)
+{
+ switch (operater) {
+ case '*':
+ case '/':
+ return 4;
+ case '+':
+ case '-':
+ return 3;
+ case ')':
+ return 2;
+ case '(':
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+unsigned long
+calculate(int operater, unsigned long a, unsigned long b)
+{
+ switch (operater) {
+ case '+':
+ return (a + b);
+ case '-':
+ return (a - b);
+ case '*':
+ return (a * b);
+ case '/':
+ if (operater == '/' && b == 0) {
+ printf("\nDivision mustn\'t be 0!");
+ exit(0);
+ } else
+ return (a / b);
+ }
+}
+
+unsigned long
+get_operand(char *p, int *length)
+{
+ char c[13];
+ int i = 0, k = 1;
+ unsigned long result = 0;
+ while (*p <= 57 && *p >= 48)
+ c[i++] = *(p++);
+ *length += --i;
+ for (; i >= 0; i--) {
+ result += (c[i] - 48) * k;
+ k *= 10;
+ }
+ return result;
+}
+
+int
+operator_class(char c)
+{
+ if (c <= 57 && c >= 48)
+ return 1;
+ if (c == 42 || c == 43 || c == 45 || c == 47)
+ return 2;
+ if (c == 41)
+ return 3;
+ if (c == 40)
+ return 4;
+ return 0;
+}
+
+unsigned long
+get_result(char *expr)
+{
+ int position = 0;
+ unsigned long op = 0, a = 0, b = 0, result = 0;
+ char *expression;
+ expression = expr;
+ while (*(expression + position) != '\0'
+ && *(expression + position) != '\n') {
+ switch (operator_class(*(expression + position))) {
+ case 1:
+ push(&operand, get_operand(expression + position, &position));
+ break;
+ case 2:
+ if (operater != NULL)
+ while (operater != NULL
+ && priority(*(expression + position)) <=
+ priority(operater->data)) {
+ a = pop(&operand);
+ b = pop(&operand);
+ op = pop(&operater);
+ push(&operand, calculate(op, b, a));
+ }
+ push(&operater, *(expression + position));
+ break;
+ case 3:
+ while (operater != NULL && operater->data != '(') {
+ a = pop(&operand);
+ b = pop(&operand);
+ op = pop(&operater);
+ push(&operand, calculate(op, b, a));
+ }
+ if (operater->data == '(')
+ pop(&operater);
+ break;
+ case 4:
+ push(&operater, '(');
+ break;
+ default:
+ printf("\nInvalid character in expression:");
+ a = 0;
+ while (*(expression + (int) a) != '\n'
+ && *(expression + (int) a) != '\0') {
+ if (a != position)
+ printf("%c", *(expression + (int) a));
+ else
+ printf("<%c>", *(expression + (int) a));
+ a++;
+ }
+ exit(0);
+ } /* end switch */
+ position++;
+ }
+ while (operater != NULL) {
+ op = pop(&operater);
+ a = pop(&operand);
+ b = pop(&operand);
+ push(&operand, calculate(op, b, a));
+ }
+ result = pop(&operand);
+ return result;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expValueTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expValueTable.h
new file mode 100644
index 0000000000..8569f9d63f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/expression/expValueTable.h
@@ -0,0 +1,63 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:expValueTable.h
+ *File Description: head file.
+ *
+ *Current Version:1.0
+ *Author:JianShun Tong
+ *Date:2004.8.20
+ */
+
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+
+/*
+ * we may use header_complex from the header_complex module
+ */
+config_require(header_complex)
+
+#ifndef _MIBGROUP_EXPVALUETABLE_H
+#define _MIBGROUP_EXPVALUETABLE_H
+ struct expValueTable_data {
+ char *expExpressionOwner;
+ size_t expExpressionOwnerLen;
+ char *expExpressionName;
+ size_t expExpressionNameLen;
+ oid *expValueInstance;
+ size_t expValueInstanceLen;
+ unsigned long expValueCounter32Val;
+ unsigned long expValueUnsigned32Val;
+ unsigned long expValueTimeTicksVal;
+ long expValueInteger32Val;
+ u_long *expValueIpAddressVal;
+ char *expValueOctetStringVal;
+ size_t expValueOctetStringValLen;
+ oid *expValueOidVal;
+ size_t expValueOidValLen;
+ long expValueCounter64Val;
+
+ /* internal var */
+ struct expExpressionTable_data *expression_data;
+ char *valuestr;
+ };
+
+
+ /*
+ * function prototypes
+ */
+ void init_expValueTable(void);
+ unsigned long get_result(char *expr);
+ FindVarMethod var_expValueTable;
+ int expValueTable_add(struct expExpressionTable_data
+ *expression_data, char *owner,
+ size_t owner_len, char *name,
+ size_t name_len, oid * index,
+ size_t index_len);
+
+#endif /* _MIBGROUP_EXPVALUETABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteEventNotificationTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteEventNotificationTable.c
new file mode 100644
index 0000000000..3e0786febc
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteEventNotificationTable.c
@@ -0,0 +1,97 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.create-dataset.conf,v 5.2 2002/07/17 14:41:53 dts12 Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "mteEventNotificationTable.h"
+
+netsnmp_table_data_set *mteEventNotif_table_set;
+
+
+/** Initialize the mteEventNotificationTable table by defining its contents and how it's structured */
+void
+initialize_table_mteEventNotificationTable(void)
+{
+ static oid mteEventNotificationTable_oid[] =
+ { 1, 3, 6, 1, 2, 1, 88, 1, 4, 3 };
+ size_t mteEventNotificationTable_oid_len =
+ OID_LENGTH(mteEventNotificationTable_oid);
+
+ /*
+ * create the table structure itself
+ */
+ mteEventNotif_table_set = netsnmp_create_table_data_set("mteEventNotificationTable");
+
+ /*
+ * comment this out or delete if you don't support creation of new rows
+ */
+ mteEventNotif_table_set->allow_creation = 1;
+
+ /***************************************************
+ * Adding indexes
+ */
+ DEBUGMSGTL(("initialize_table_mteEventNotificationTable",
+ "adding indexes to table mteEventNotificationTable\n"));
+ netsnmp_table_set_add_indexes(mteEventNotif_table_set,
+ /* index: mteOwner */
+ ASN_OCTET_STR,
+ /* index: mteEventName */
+ ASN_PRIV_IMPLIED_OCTET_STR,
+ 0);
+
+ DEBUGMSGTL(("initialize_table_mteEventNotificationTable",
+ "adding column types to table mteEventNotificationTable\n"));
+ netsnmp_table_set_multi_add_default_row(mteEventNotif_table_set,
+ COLUMN_MTEEVENTNOTIFICATION,
+ ASN_OBJECT_ID, 1, NULL, 0,
+ COLUMN_MTEEVENTNOTIFICATIONOBJECTSOWNER,
+ ASN_OCTET_STR, 1, NULL, 0,
+ COLUMN_MTEEVENTNOTIFICATIONOBJECTS,
+ ASN_OCTET_STR, 1, NULL, 0, 0);
+
+ /* keep index values around for comparisons later */
+ mteEventNotif_table_set->table->store_indexes = 1;
+ /*
+ * registering the table with the master agent
+ */
+ /*
+ * note: if you don't need a subhandler to deal with any aspects
+ * of the request, change mteEventNotificationTable_handler to "NULL"
+ */
+ netsnmp_register_table_data_set(netsnmp_create_handler_registration
+ ("mteEventNotificationTable",
+ mteEventNotificationTable_handler,
+ mteEventNotificationTable_oid,
+ mteEventNotificationTable_oid_len,
+ HANDLER_CAN_RWRITE), mteEventNotif_table_set, NULL);
+}
+
+/** Initializes the mteEventNotificationTable module */
+void
+init_mteEventNotificationTable(void)
+{
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ initialize_table_mteEventNotificationTable();
+}
+
+/** handles requests for the mteEventNotificationTable table, if anything else needs to be done */
+int
+mteEventNotificationTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ /*
+ * perform anything here that you need to do. The requests have
+ * already been processed by the master table_dataset handler, but
+ * this gives you chance to act on the request in some other way
+ * if need be.
+ */
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteEventNotificationTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteEventNotificationTable.h
new file mode 100644
index 0000000000..dd9bdfa5eb
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteEventNotificationTable.h
@@ -0,0 +1,23 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.create-dataset.conf,v 5.2 2002/07/17 14:41:53 dts12 Exp $
+ */
+#ifndef MTEEVENTNOTIFICATIONTABLE_H
+#define MTEEVENTNOTIFICATIONTABLE_H
+
+/*
+ * function declarations
+ */
+void init_mteEventNotificationTable(void);
+void initialize_table_mteEventNotificationTable(void);
+Netsnmp_Node_Handler mteEventNotificationTable_handler;
+
+/*
+ * column number definitions for table mteEventNotificationTable
+ */
+#define COLUMN_MTEEVENTNOTIFICATION 1
+#define COLUMN_MTEEVENTNOTIFICATIONOBJECTSOWNER 2
+#define COLUMN_MTEEVENTNOTIFICATIONOBJECTS 3
+
+extern netsnmp_table_data_set *mteEventNotif_table_set;
+#endif /* MTEEVENTNOTIFICATIONTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteEventTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteEventTable.c
new file mode 100644
index 0000000000..a168fb0c42
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteEventTable.c
@@ -0,0 +1,340 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.create-dataset.conf,v 5.2 2002/07/17 14:41:53 dts12 Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "mteTriggerTable.h"
+#include "mteEventTable.h"
+#include "mteEventNotificationTable.h"
+#include "mteObjectsTable.h"
+
+static netsnmp_table_data_set *table_set = NULL;
+
+/** Initialize the mteEventTable table by defining its contents and how it's structured */
+void
+initialize_table_mteEventTable(void)
+{
+ static oid mteEventTable_oid[] =
+ { 1, 3, 6, 1, 2, 1, 88, 1, 4, 2 };
+ size_t mteEventTable_oid_len = OID_LENGTH(mteEventTable_oid);
+
+ /*
+ * create the table structure itself
+ */
+ table_set = netsnmp_create_table_data_set("mteEventTable");
+
+ /*
+ * comment this out or delete if you don't support creation of new rows
+ */
+ table_set->allow_creation = 1;
+ /* mark the row status column */
+ table_set->rowstatus_column = COLUMN_MTEEVENTENTRYSTATUS;
+
+ /***************************************************
+ * Adding indexes
+ */
+ DEBUGMSGTL(("initialize_table_mteEventTable",
+ "adding indexes to table mteEventTable\n"));
+ netsnmp_table_set_add_indexes(table_set,
+ ASN_OCTET_STR, /* index: mteOwner */
+ ASN_PRIV_IMPLIED_OCTET_STR, /* index: mteEventName */
+ 0);
+
+ DEBUGMSGTL(("initialize_table_mteEventTable",
+ "adding column types to table mteEventTable\n"));
+ netsnmp_table_set_multi_add_default_row(table_set,
+ COLUMN_MTEEVENTNAME,
+ ASN_OCTET_STR, 0, NULL, 0,
+ COLUMN_MTEEVENTCOMMENT,
+ ASN_OCTET_STR, 1, NULL, 0,
+ COLUMN_MTEEVENTACTIONS,
+ ASN_OCTET_STR, 1, NULL, 0,
+ COLUMN_MTEEVENTENABLED,
+ ASN_INTEGER, 1, NULL, 0,
+ COLUMN_MTEEVENTENTRYSTATUS,
+ ASN_INTEGER, 1, NULL, 0, 0);
+
+ /* keep index values around for comparisons later */
+ table_set->table->store_indexes = 1;
+ /*
+ * registering the table with the master agent
+ */
+ /*
+ * note: if you don't need a subhandler to deal with any aspects
+ * of the request, change mteEventTable_handler to "NULL"
+ */
+ netsnmp_register_table_data_set(netsnmp_create_handler_registration
+ ("mteEventTable",
+ mteEventTable_handler,
+ mteEventTable_oid,
+ mteEventTable_oid_len,
+ HANDLER_CAN_RWRITE), table_set, NULL);
+}
+
+/** Initializes the mteEventTable module */
+void
+init_mteEventTable(void)
+{
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ initialize_table_mteEventTable();
+
+ snmpd_register_config_handler("notificationEvent", parse_notificationEvent,
+ NULL,
+ "notificationEvent NAME TRAP_OID [[-w] EXTRA_OID ...]");
+
+ snmpd_register_config_handler("linkUpDownNotifications",
+ parse_linkUpDownNotifications,
+ NULL,
+ "linkUpDownNotifications (yes|no)");
+}
+
+/** handles requests for the mteEventTable table, if anything else needs to be done */
+int
+mteEventTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ /*
+ * perform anything here that you need to do. The requests have
+ * already been processed by the master table_dataset handler, but
+ * this gives you chance to act on the request in some other way
+ * if need be.
+ */
+
+ /* XXX: on rowstatus = destroy, remove the corresponding rows from the
+ other tables: snmpEventNotificationTable and the set table */
+ return SNMP_ERR_NOERROR;
+}
+
+void
+parse_linkUpDownNotifications(const char *token, char *line) {
+ if (strncmp(line, "y", 1) == 0) {
+ parse_notificationEvent("notificationEvent", "linkUpTrap linkUp ifIndex ifAdminStatus ifOperStatus");
+ parse_notificationEvent("notificationEvent", "linkDownTrap linkDown ifIndex ifAdminStatus ifOperStatus");
+
+ parse_simple_monitor("monitor", "-r 60 -e linkUpTrap \"Generate linkUp\" ifOperStatus != 2");
+ parse_simple_monitor("monitor", "-r 60 -e linkDownTrap \"Generate linkDown\" ifOperStatus == 2");
+ }
+}
+
+void
+parse_notificationEvent(const char *token, char *line) {
+ char name_buf[64];
+ char oid_name_buf[SPRINT_MAX_LEN];
+ oid oid_buf[MAX_OID_LEN];
+ size_t oid_buf_len = sizeof(oid_buf);
+ int wild = 1;
+ netsnmp_table_row *row;
+ long tlong;
+ char tc;
+
+ /* get the owner */
+ const char *owner = "snmpd.conf";
+
+ /* get the name */
+ char *cp = copy_nword(line, name_buf, SPRINT_MAX_LEN);
+
+ if (!cp || name_buf[0] == '\0') {
+ config_perror("syntax error.");
+ return;
+ }
+
+ for(row = table_set->table->first_row; row; row = row->next) {
+ if (strcmp(row->indexes->val.string, owner) == 0 &&
+ strcmp(row->indexes->next_variable->val.string,
+ name_buf) == 0) {
+ config_perror("An eventd by that name has already been defined.");
+ return;
+ }
+ }
+
+ /* now, get all the trap oid */
+ cp = copy_nword(cp, oid_name_buf, SPRINT_MAX_LEN);
+
+ if (oid_name_buf[0] == '\0') {
+ config_perror("syntax error.");
+ return;
+ }
+ if (!snmp_parse_oid(oid_name_buf, oid_buf, &oid_buf_len)) {
+ snmp_log(LOG_ERR,"namebuf: %s\n",oid_name_buf);
+ config_perror("unable to parse trap oid");
+ return;
+ }
+
+ /*
+ * add to the mteEventNotificationtable to point to the
+ * notification and the objects.
+ */
+ row = netsnmp_create_table_data_row();
+
+ /* indexes */
+ netsnmp_table_row_add_index(row, ASN_OCTET_STR, owner, strlen(owner));
+ netsnmp_table_row_add_index(row, ASN_PRIV_IMPLIED_OCTET_STR,
+ name_buf, strlen(name_buf));
+
+
+ /* columns */
+ netsnmp_set_row_column(row, COLUMN_MTEEVENTNOTIFICATION, ASN_OBJECT_ID,
+ (char *) oid_buf, oid_buf_len * sizeof(oid));
+ netsnmp_set_row_column(row, COLUMN_MTEEVENTNOTIFICATIONOBJECTSOWNER,
+ ASN_OCTET_STR, owner, strlen(owner));
+ netsnmp_set_row_column(row, COLUMN_MTEEVENTNOTIFICATIONOBJECTS,
+ ASN_OCTET_STR, name_buf, strlen(name_buf));
+
+ netsnmp_table_data_add_row(mteEventNotif_table_set->table, row);
+
+ /*
+ * add to the mteEventTable to make it a notification to trigger
+ * notification and the objects.
+ */
+ row = netsnmp_create_table_data_row();
+
+ /* indexes */
+ netsnmp_table_row_add_index(row, ASN_OCTET_STR, owner, strlen(owner));
+ netsnmp_table_row_add_index(row, ASN_PRIV_IMPLIED_OCTET_STR,
+ name_buf, strlen(name_buf));
+
+
+ /* columns */
+ tc = (u_char)0x80;
+ netsnmp_set_row_column(row, COLUMN_MTEEVENTACTIONS, ASN_OCTET_STR,
+ &tc, 1);
+ tlong = MTETRIGGERENABLED_TRUE;
+ netsnmp_set_row_column(row, COLUMN_MTEEVENTENABLED,
+ ASN_INTEGER, (char *) &tlong, sizeof(tlong));
+ tlong = RS_ACTIVE;
+ netsnmp_set_row_column(row, COLUMN_MTEEVENTENTRYSTATUS,
+ ASN_INTEGER, (char *) &tlong, sizeof(tlong));
+
+ netsnmp_table_data_add_row(table_set->table, row);
+
+ /*
+ * now all the objects to put into the trap's object row
+ */
+ while(cp) {
+ cp = copy_nword(cp, oid_name_buf, SPRINT_MAX_LEN);
+ if (strcmp(oid_name_buf, "-w") == 0) {
+ wild = 0;
+ continue;
+ }
+ if (!snmp_parse_oid(oid_name_buf, oid_buf, &oid_buf_len)) {
+ config_perror("unable to parse an object oid");
+ return;
+ }
+ mte_add_object_to_table("snmpd.conf", name_buf,
+ oid_buf, oid_buf_len, wild);
+ wild = 1;
+ }
+}
+
+/*
+ * send trap
+ */
+void
+run_mte_events(struct mteTriggerTable_data *item,
+ oid * name_oid, size_t name_oid_len,
+ const char *eventobjowner, const char *eventobjname)
+{
+ static oid objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 }; /* snmpTrapIOD.0 */
+
+ netsnmp_variable_list *var_list = NULL;
+
+ netsnmp_table_row *row, *notif_row;
+ netsnmp_table_data_set_storage *col1, *tc, *no, *noo;
+
+ for(row = table_set->table->first_row; row; row = row->next) {
+ if (strcmp(row->indexes->val.string, eventobjowner) == 0 &&
+ strcmp(row->indexes->next_variable->val.string,
+ eventobjname) == 0) {
+ /* run this event */
+ col1 = (netsnmp_table_data_set_storage *) row->data;
+
+ tc = netsnmp_table_data_set_find_column(col1,
+ COLUMN_MTEEVENTACTIONS);
+ if (!tc->data.bitstring[0] & 0x80) {
+ /* not a notification. next! (XXX: do sets) */
+ continue;
+ }
+
+ tc = netsnmp_table_data_set_find_column(col1,
+ COLUMN_MTEEVENTENABLED);
+ if (*(tc->data.integer) != 1) {
+ /* not enabled. next! */
+ continue;
+ }
+
+ if (!mteEventNotif_table_set) {
+ /* no notification info */
+ continue;
+ }
+
+ /* send the notification */
+ var_list = NULL;
+
+ /* XXX: get notif information */
+ for(notif_row = mteEventNotif_table_set->table->first_row;
+ notif_row; notif_row = notif_row->next) {
+ if (strcmp(notif_row->indexes->val.string,
+ eventobjowner) == 0 &&
+ strcmp(notif_row->indexes->next_variable->val.string,
+ eventobjname) == 0) {
+
+ /* run this event */
+ col1 = (netsnmp_table_data_set_storage *) notif_row->data;
+
+ tc = netsnmp_table_data_set_find_column(col1, COLUMN_MTEEVENTNOTIFICATION);
+ no = netsnmp_table_data_set_find_column(col1, COLUMN_MTEEVENTNOTIFICATIONOBJECTS);
+ noo = netsnmp_table_data_set_find_column(col1, COLUMN_MTEEVENTNOTIFICATIONOBJECTSOWNER);
+ if (!tc)
+ continue; /* no notification to be had. XXX: return? */
+
+ /*
+ * snmpTrap oid
+ */
+ snmp_varlist_add_variable(&var_list, objid_snmptrap,
+ sizeof(objid_snmptrap) /
+ sizeof(oid),
+ ASN_OBJECT_ID,
+ (u_char *) tc->data.objid,
+ tc->data_len);
+
+ /* XXX: add objects from the mteObjectsTable */
+ DEBUGMSGTL(("mteEventTable:send_events", "no: %x, no->data: %s", no, no->data.string));
+ DEBUGMSGTL(("mteEventTable:send_events", "noo: %x, noo->data: %s", noo, noo->data.string));
+ DEBUGMSGTL(("mteEventTable:send_events", "name_oid: %x",name_oid));
+ if (no && no->data.string &&
+ noo && noo->data.string && name_oid) {
+ char *tmpowner =
+ netsnmp_strdup_and_null(noo->data.string,
+ noo->data_len);
+ char *tmpname =
+ netsnmp_strdup_and_null(no->data.string,
+ no->data_len);
+
+ DEBUGMSGTL(("mteEventTable:send_events", "Adding objects for owner=%s name=%s", tmpowner, tmpname));
+ mte_add_objects(var_list, item,
+ tmpowner, tmpname,
+ name_oid + item->mteTriggerValueIDLen,
+ name_oid_len - item->mteTriggerValueIDLen);
+ free(tmpowner);
+ free(tmpname);
+ }
+
+ DEBUGMSGTL(("mteEventTable:send_events", "sending an event "));
+ DEBUGMSGOID(("mteEventTable:send_events", tc->data.objid, tc->data_len / sizeof(oid)));
+ DEBUGMSG(("mteEventTable:send_events", "\n"));
+
+ send_v2trap(var_list);
+ snmp_free_varbind(var_list);
+ }
+ }
+ }
+ }
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteEventTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteEventTable.h
new file mode 100644
index 0000000000..c67b880456
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteEventTable.h
@@ -0,0 +1,30 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.create-dataset.conf,v 5.2 2002/07/17 14:41:53 dts12 Exp $
+ */
+#ifndef MTEEVENTTABLE_H
+#define MTEEVENTTABLE_H
+
+/*
+ * function declarations
+ */
+void init_mteEventTable(void);
+void initialize_table_mteEventTable(void);
+void run_mte_events(struct mteTriggerTable_data *item,
+ oid * name_oid, size_t name_oid_len,
+ const char *eventobjowner, const char *eventobjname);
+
+
+void parse_notificationEvent(const char *token, char *line);
+void parse_linkUpDownNotifications(const char *token, char *line);
+Netsnmp_Node_Handler mteEventTable_handler;
+
+/*
+ * column number definitions for table mteEventTable
+ */
+#define COLUMN_MTEEVENTNAME 1
+#define COLUMN_MTEEVENTCOMMENT 2
+#define COLUMN_MTEEVENTACTIONS 3
+#define COLUMN_MTEEVENTENABLED 4
+#define COLUMN_MTEEVENTENTRYSTATUS 5
+#endif /* MTEEVENTTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteObjectsTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteObjectsTable.c
new file mode 100644
index 0000000000..1c36df78d8
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteObjectsTable.c
@@ -0,0 +1,946 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent.
+ */
+
+
+/*
+ * This should always be included first before anything else
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+
+/*
+ * minimal include directives
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "mteTriggerTable.h"
+#include "mteObjectsTable.h"
+
+
+/*
+ * mteObjectsTable_variables_oid:
+ * this is the top level oid that we want to register under. This
+ * is essentially a prefix, with the suffix appearing in the
+ * variable below.
+ */
+
+
+oid mteObjectsTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 88, 1, 3, 1 };
+
+
+/*
+ * variable2 mteObjectsTable_variables:
+ * this variable defines function callbacks and type return information
+ * for the mteObjectsTable mib section
+ */
+
+
+struct variable2 mteObjectsTable_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+#define MTEOBJECTSID 5
+ {MTEOBJECTSID, ASN_OBJECT_ID, RWRITE, var_mteObjectsTable, 2, {1, 3}},
+#define MTEOBJECTSIDWILDCARD 6
+ {MTEOBJECTSIDWILDCARD, ASN_INTEGER, RWRITE, var_mteObjectsTable, 2,
+ {1, 4}},
+#define MTEOBJECTSENTRYSTATUS 7
+ {MTEOBJECTSENTRYSTATUS, ASN_INTEGER, RWRITE, var_mteObjectsTable, 2,
+ {1, 5}},
+
+};
+/*
+ * (L = length of the oidsuffix)
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+static struct header_complex_index *mteObjectsTableStorage = NULL;
+
+
+
+
+/*
+ * init_mteObjectsTable():
+ * Initialization routine. This is called when the agent starts up.
+ * At a minimum, registration of your variables should take place here.
+ */
+void
+init_mteObjectsTable(void)
+{
+ DEBUGMSGTL(("mteObjectsTable", "initializing... "));
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("mteObjectsTable", mteObjectsTable_variables, variable2,
+ mteObjectsTable_variables_oid);
+
+
+ /*
+ * register our config handler(s) to deal with registrations
+ */
+ snmpd_register_config_handler("mteObjectsTable", parse_mteObjectsTable,
+ NULL, NULL);
+
+
+ /*
+ * we need to be called back later to store our data
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_mteObjectsTable, NULL);
+
+
+ /*
+ * place any other initialization junk you need here
+ */
+
+
+ DEBUGMSGTL(("mteObjectsTable", "done.\n"));
+}
+
+
+/*
+ * mteObjectsTable_add(): adds a structure node to our data set
+ */
+int
+mteObjectsTable_add(struct mteObjectsTable_data *thedata)
+{
+ netsnmp_variable_list *vars = NULL;
+
+
+ DEBUGMSGTL(("mteObjectsTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->mteOwner, thedata->mteOwnerLen); /* mteOwner */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->mteObjectsName, thedata->mteObjectsNameLen); /* mteObjectsName */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_UNSIGNED, (char *) &thedata->mteObjectsIndex, sizeof(thedata->mteObjectsIndex)); /* mteObjectsIndex */
+
+
+
+ header_complex_add_data(&mteObjectsTableStorage, vars, thedata);
+ DEBUGMSGTL(("mteObjectsTable", "registered an entry\n"));
+
+
+ DEBUGMSGTL(("mteObjectsTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+/*
+ * parse_mteObjectsTable():
+ * parses .conf file entries needed to configure the mib.
+ */
+void
+parse_mteObjectsTable(const char *token, char *line)
+{
+ size_t tmpint;
+ struct mteObjectsTable_data *StorageTmp =
+ SNMP_MALLOC_STRUCT(mteObjectsTable_data);
+
+ DEBUGMSGTL(("mteObjectsTable", "parsing config... "));
+
+
+ if (StorageTmp == NULL) {
+ config_perror("malloc failure");
+ return;
+ }
+
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line, &StorageTmp->mteOwner,
+ &StorageTmp->mteOwnerLen);
+ if (StorageTmp->mteOwner == NULL) {
+ config_perror("invalid specification for mteOwner");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteObjectsName,
+ &StorageTmp->mteObjectsNameLen);
+ if (StorageTmp->mteObjectsName == NULL) {
+ config_perror("invalid specification for mteObjectsName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->mteObjectsIndex, &tmpint);
+
+ line =
+ read_config_read_data(ASN_OBJECT_ID, line,
+ &StorageTmp->mteObjectsID,
+ &StorageTmp->mteObjectsIDLen);
+ if (StorageTmp->mteObjectsID == NULL) {
+ config_perror("invalid specification for mteObjectsID");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->mteObjectsIDWildcard, &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->mteObjectsEntryStatus, &tmpint);
+
+
+
+
+ mteObjectsTable_add(StorageTmp);
+
+
+ DEBUGMSGTL(("mteObjectsTable", "done.\n"));
+}
+
+
+
+
+/*
+ * store_mteObjectsTable():
+ * stores .conf file entries needed to configure the mib.
+ */
+int
+store_mteObjectsTable(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr;
+ size_t tmpint;
+ struct mteObjectsTable_data *StorageTmp;
+ struct header_complex_index *hcindex;
+
+
+ DEBUGMSGTL(("mteObjectsTable", "storing data... "));
+
+
+ for (hcindex = mteObjectsTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ StorageTmp = (struct mteObjectsTable_data *) hcindex->data;
+
+ if (StorageTmp->storagetype != ST_READONLY) {
+ memset(line, 0, sizeof(line));
+ strcat(line, "mteObjectsTable ");
+ cptr = line + strlen(line);
+
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->mteOwner,
+ &StorageTmp->mteOwnerLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->mteObjectsName,
+ &StorageTmp->mteObjectsNameLen);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->mteObjectsIndex,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OBJECT_ID, cptr,
+ &StorageTmp->mteObjectsID,
+ &StorageTmp->mteObjectsIDLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->mteObjectsIDWildcard,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->mteObjectsEntryStatus,
+ &tmpint);
+
+
+
+ snmpd_store_config(line);
+ }
+ }
+ DEBUGMSGTL(("mteObjectsTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+
+
+/*
+ * var_mteObjectsTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_mteObjectsTable above.
+ */
+unsigned char *
+var_mteObjectsTable(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+
+ struct mteObjectsTable_data *StorageTmp = NULL;
+
+
+ DEBUGMSGTL(("mteObjectsTable",
+ "var_mteObjectsTable: Entering... \n"));
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(mteObjectsTableStorage, vp, name, length, exact,
+ var_len, write_method)) == NULL) {
+ if (vp->magic == MTEOBJECTSENTRYSTATUS)
+ *write_method = write_mteObjectsEntryStatus;
+ return NULL;
+ }
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+
+
+ case MTEOBJECTSID:
+ *write_method = write_mteObjectsID;
+ *var_len = (StorageTmp->mteObjectsIDLen) * sizeof(oid);
+ return (u_char *) StorageTmp->mteObjectsID;
+
+ case MTEOBJECTSIDWILDCARD:
+ *write_method = write_mteObjectsIDWildcard;
+ *var_len = sizeof(StorageTmp->mteObjectsIDWildcard);
+ return (u_char *) & StorageTmp->mteObjectsIDWildcard;
+
+ case MTEOBJECTSENTRYSTATUS:
+ *write_method = write_mteObjectsEntryStatus;
+ *var_len = sizeof(StorageTmp->mteObjectsEntryStatus);
+ return (u_char *) & StorageTmp->mteObjectsEntryStatus;
+
+
+ default:
+ ERROR_MSG("");
+ }
+ return NULL;
+}
+
+
+
+
+int
+write_mteObjectsID(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static oid *tmpvar;
+ struct mteObjectsTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(mteObjectsTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("mteObjectsTable",
+ "write_mteObjectsID entering action=%d... \n", action));
+ if ((StorageTmp =
+ header_complex(mteObjectsTableStorage, NULL,
+ &name[sizeof(mteObjectsTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storagetype == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OBJECT_ID) {
+ snmp_log(LOG_ERR, "write to mteObjectsID not ASN_OBJECT_ID\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteObjectsID;
+ tmplen = StorageTmp->mteObjectsIDLen;
+ memdup((u_char **) & StorageTmp->mteObjectsID, var_val,
+ var_val_len);
+ StorageTmp->mteObjectsIDLen = var_val_len / sizeof(oid);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteObjectsID);
+ StorageTmp->mteObjectsID = tmpvar;
+ StorageTmp->mteObjectsIDLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteObjectsIDWildcard(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct mteObjectsTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(mteObjectsTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("mteObjectsTable",
+ "write_mteObjectsIDWildcard entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteObjectsTableStorage, NULL,
+ &name[sizeof(mteObjectsTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storagetype == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to mteObjectsIDWildcard not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteObjectsIDWildcard;
+ StorageTmp->mteObjectsIDWildcard = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->mteObjectsIDWildcard = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+
+
+int
+write_mteObjectsEntryStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ struct mteObjectsTable_data *StorageTmp = NULL;
+ static struct mteObjectsTable_data *StorageNew, *StorageDel;
+ size_t newlen =
+ name_len - (sizeof(mteObjectsTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+ static int old_value;
+ int set_value;
+ static netsnmp_variable_list *vars, *vp;
+ struct header_complex_index *hciptr;
+
+
+ StorageTmp =
+ header_complex(mteObjectsTableStorage, NULL,
+ &name[sizeof(mteObjectsTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL);
+
+ if (var_val_type != ASN_INTEGER || var_val == NULL) {
+ snmp_log(LOG_ERR,
+ "write to mteObjectsEntryStatus not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+
+ if (StorageTmp && StorageTmp->storagetype == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ set_value = *((long *) var_val);
+
+
+ /*
+ * check legal range, and notReady is reserved for us, not a user
+ */
+ if (set_value < 1 || set_value > 6 || set_value == RS_NOTREADY)
+ return SNMP_ERR_INCONSISTENTVALUE;
+
+
+ switch (action) {
+ case RESERVE1:
+ /*
+ * stage one: test validity
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * create the row now?
+ */
+
+
+ /*
+ * ditch illegal values now
+ */
+ if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE)
+ return SNMP_ERR_INCONSISTENTVALUE;
+
+
+ /*
+ * destroying a non-existent row is actually legal
+ */
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+
+
+ /*
+ * illegal creation values
+ */
+ if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else {
+ /*
+ * row exists. Check for a valid state change
+ */
+ if (set_value == RS_CREATEANDGO
+ || set_value == RS_CREATEANDWAIT) {
+ /*
+ * can't create a row that exists
+ */
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ /*
+ * XXX: interaction with row storage type needed
+ */
+ }
+ break;
+
+
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * creation
+ */
+ vars = NULL;
+
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0); /* mteOwner */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0); /* mteObjectsName */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_UNSIGNED, NULL, 0); /* mteObjectsIndex */
+
+ if (header_complex_parse_oid
+ (&
+ (name
+ [sizeof(mteObjectsTable_variables_oid) / sizeof(oid) +
+ 2]), newlen, vars) != SNMPERR_SUCCESS) {
+ /*
+ * XXX: free, zero vars
+ */
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+ vp = vars;
+
+
+ StorageNew = SNMP_MALLOC_STRUCT(mteObjectsTable_data);
+ StorageNew->mteOwner = netsnmp_strdup_and_null(vp->val.string,
+ vp->val_len);
+ StorageNew->mteOwnerLen = vp->val_len;
+ vp = vp->next_variable;
+ StorageNew->mteObjectsName =
+ netsnmp_strdup_and_null(vp->val.string,
+ vp->val_len);
+ StorageNew->mteObjectsNameLen = vp->val_len;
+ vp = vp->next_variable;
+ StorageNew->mteObjectsIndex = *(vp->val.integer);
+
+ /*
+ * XXX: fill in default row values here into StorageNew
+ */
+ StorageNew->mteObjectsID = calloc(1, sizeof(oid) * sizeof(2)); /* 0.0 */
+ StorageNew->mteObjectsIDLen = 2;
+ StorageNew->mteObjectsIDWildcard = MTEOBJECTSIDWILDCARD_FALSE;
+
+ StorageNew->mteObjectsEntryStatus = set_value;
+ /*
+ * XXX: free, zero vars, no longer needed?
+ */
+ }
+
+
+ break;
+
+
+
+
+ case FREE:
+ /*
+ * XXX: free, zero vars
+ */
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in set_value for you to
+ * use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in
+ * the UNDO case
+ */
+
+
+ if (StorageTmp == NULL) {
+ /*
+ * row creation, so add it
+ */
+ if (StorageNew != NULL)
+ mteObjectsTable_add(StorageNew);
+ /*
+ * XXX: ack, and if it is NULL?
+ */
+ } else if (set_value != RS_DESTROY) {
+ /*
+ * set the flag?
+ */
+ old_value = StorageTmp->mteObjectsEntryStatus;
+ StorageTmp->mteObjectsEntryStatus = *((long *) var_val);
+ } else {
+ /*
+ * destroy... extract it for now
+ */
+ hciptr =
+ header_complex_find_entry(mteObjectsTableStorage,
+ StorageTmp);
+ StorageDel =
+ header_complex_extract_entry(&mteObjectsTableStorage,
+ hciptr);
+ }
+ break;
+
+
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * row creation, so remove it again
+ */
+ hciptr =
+ header_complex_find_entry(mteObjectsTableStorage,
+ StorageTmp);
+ StorageDel =
+ header_complex_extract_entry(&mteObjectsTableStorage,
+ hciptr);
+ /*
+ * XXX: free it
+ */
+ } else if (StorageDel != NULL) {
+ /*
+ * row deletion, so add it again
+ */
+ mteObjectsTable_add(StorageDel);
+ } else {
+ StorageTmp->mteObjectsEntryStatus = old_value;
+ }
+ break;
+
+
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ if (StorageDel != NULL) {
+ StorageDel = 0;
+ /*
+ * XXX: free it, its dead
+ */
+ } else {
+ if (StorageTmp
+ && StorageTmp->mteObjectsEntryStatus == RS_CREATEANDGO) {
+ StorageTmp->mteObjectsEntryStatus = RS_ACTIVE;
+ } else if (StorageTmp &&
+ StorageTmp->mteObjectsEntryStatus ==
+ RS_CREATEANDWAIT) {
+ StorageTmp->mteObjectsEntryStatus = RS_NOTINSERVICE;
+ }
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+void
+mte_add_objects(netsnmp_variable_list * vars,
+ struct mteTriggerTable_data *item, const char *owner,
+ const char *name, oid * suffix, size_t suffix_len)
+{
+ struct header_complex_index *hcptr = mteObjectsTableStorage;
+
+ DEBUGMSGTL(("mteObjectsTable",
+ "Searching for objects to add for owner=%s / name=%s\n",
+ owner, name));
+
+ if (vars == NULL || item == NULL || owner == NULL || name == NULL ||
+ hcptr == NULL)
+ return;
+
+ /*
+ * get to end of variable chain
+ */
+ while (vars->next_variable != NULL)
+ vars = vars->next_variable;
+
+
+ /*
+ * get to start of objects list
+ */
+ while (hcptr &&
+ (strcmp(((struct mteObjectsTable_data *) hcptr->data)->mteOwner,
+ owner) != 0 ||
+ strcmp(((struct mteObjectsTable_data *) hcptr->data)->
+ mteObjectsName, name) != 0))
+ hcptr = hcptr->next;
+
+ /*
+ * add all objects
+ */
+ while (hcptr &&
+ strcmp(((struct mteObjectsTable_data *) hcptr->data)->mteOwner,
+ owner) == 0 &&
+ strcmp(((struct mteObjectsTable_data *) hcptr->data)->
+ mteObjectsName, name) == 0) {
+ /*
+ * loop through objects
+ */
+ netsnmp_pdu *pdu = NULL, *response = NULL;
+ struct mteObjectsTable_data *node =
+ (struct mteObjectsTable_data *) hcptr->data;
+ oid theoid[MAX_OID_LEN];
+ size_t theoid_len;
+
+ /*
+ * copy in the suffix
+ */
+ memcpy(theoid, node->mteObjectsID,
+ node->mteObjectsIDLen * sizeof(oid));
+ theoid_len = node->mteObjectsIDLen;
+ if (node->mteObjectsIDWildcard == MTEOBJECTSIDWILDCARD_TRUE &&
+ suffix && suffix_len > 0) {
+ theoid_len += suffix_len;
+ if (theoid_len > MAX_OID_LEN) {
+ break; /* XXX: properly send trap or something? */
+ }
+
+ memcpy(&theoid[node->mteObjectsIDLen], suffix,
+ suffix_len * sizeof(oid));
+ }
+
+ /*
+ * retrieve the value
+ */
+ pdu = snmp_pdu_create(SNMP_MSG_GET);
+ snmp_add_null_var(pdu, theoid, theoid_len);
+ response = mte_get_response(item, pdu);
+
+ if (response) {
+ if (vars) {
+ vars->next_variable = response->variables;
+ vars = vars->next_variable;
+ DEBUGMSGTL(("mteObjectsTable", "Adding: "));
+ DEBUGMSGOID(("mteObjectsTable", response->variables->name,
+ response->variables->name_length));
+ DEBUGMSG(("mteObjectsTable", "\n"));
+ } else {
+ vars = response->variables;
+ }
+ /*
+ * erase response notion of the values we stole from it
+ */
+ response->variables = NULL;
+ snmp_free_pdu(response);
+ }
+
+ /*
+ * move along
+ */
+ hcptr = hcptr->next;
+ }
+ DEBUGMSGTL(("mteObjectsTable", "Done adding objects\n"));
+}
+
+int
+mte_add_object_to_table(const char *owner, const char *objname,
+ oid * oidname, size_t oidname_len, int iswild)
+{
+ struct header_complex_index *hcptr = mteObjectsTableStorage, *lastnode;
+ static struct mteObjectsTable_data *StorageNew;
+
+ /*
+ * malloc initial struct
+ */
+ StorageNew = SNMP_MALLOC_STRUCT(mteObjectsTable_data);
+ StorageNew->mteOwner = netsnmp_strdup_and_null(owner, strlen(owner));
+ StorageNew->mteOwnerLen = strlen(owner);
+ StorageNew->mteObjectsName = netsnmp_strdup_and_null(objname,
+ strlen(objname));
+ StorageNew->mteObjectsNameLen = strlen(objname);
+
+ /*
+ * find the next number
+ */
+ /*
+ * get to start of objects list
+ */
+ while (hcptr &&
+ (strcmp(((struct mteObjectsTable_data *) hcptr->data)->mteOwner,
+ owner) != 0 ||
+ strcmp(((struct mteObjectsTable_data *) hcptr->data)->
+ mteObjectsName, objname) != 0))
+ hcptr = hcptr->next;
+
+ if (hcptr) {
+ /*
+ * an object existed. Find the first one past and increment
+ * the previous number
+ */
+ lastnode = hcptr;
+ while (hcptr &&
+ strcmp(((struct mteObjectsTable_data *) hcptr->data)->
+ mteOwner, owner) == 0
+ && strcmp(((struct mteObjectsTable_data *) hcptr->data)->
+ mteObjectsName, objname) == 0) {
+ lastnode = hcptr;
+ hcptr = hcptr->next;
+ }
+ StorageNew->mteObjectsIndex =
+ ((struct mteObjectsTable_data *) lastnode->data)->
+ mteObjectsIndex + 1;
+ } else {
+ StorageNew->mteObjectsIndex = 1;
+ }
+
+ /*
+ * XXX: fill in default row values here into StorageNew
+ */
+ StorageNew->mteObjectsID = snmp_duplicate_objid(oidname, oidname_len);
+ StorageNew->mteObjectsIDLen = oidname_len;
+
+ if (iswild)
+ StorageNew->mteObjectsIDWildcard = MTEOBJECTSIDWILDCARD_TRUE;
+ else
+ StorageNew->mteObjectsIDWildcard = MTEOBJECTSIDWILDCARD_FALSE;
+
+ StorageNew->mteObjectsEntryStatus = RS_ACTIVE;
+ StorageNew->storagetype = ST_READONLY;
+ return mteObjectsTable_add(StorageNew);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteObjectsTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteObjectsTable.h
new file mode 100644
index 0000000000..d3c3c500c5
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteObjectsTable.h
@@ -0,0 +1,70 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+
+#ifndef _MIBGROUP_MTEOBJECTSTABLE_H
+#define _MIBGROUP_MTEOBJECTSTABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module
+ */
+
+
+config_require(header_complex)
+
+
+ /*
+ * our storage structure(s)
+ */
+ struct mteObjectsTable_data {
+
+ char *mteOwner;
+ size_t mteOwnerLen;
+ char *mteObjectsName;
+ size_t mteObjectsNameLen;
+ unsigned long mteObjectsIndex;
+ oid *mteObjectsID;
+ size_t mteObjectsIDLen;
+ long mteObjectsIDWildcard;
+ long mteObjectsEntryStatus;
+ int storagetype;
+ };
+
+/*
+ * enum definitions from the covered mib sections
+ */
+
+
+#define MTEOBJECTSIDWILDCARD_TRUE 1
+#define MTEOBJECTSIDWILDCARD_FALSE 2
+
+/*
+ * function prototypes
+ */
+
+
+ void init_mteObjectsTable(void);
+ FindVarMethod var_mteObjectsTable;
+ void parse_mteObjectsTable(const char *, char *);
+ SNMPCallback store_mteObjectsTable;
+ void mte_add_objects(netsnmp_variable_list *,
+ struct mteTriggerTable_data *,
+ const char *, const char *, oid *,
+ size_t);
+ int mte_add_object_to_table(const char *owner,
+ const char *objname,
+ oid * oidname,
+ size_t oidname_len,
+ int iswild);
+ WriteMethod write_mteObjectsID;
+ WriteMethod write_mteObjectsIDWildcard;
+ WriteMethod write_mteObjectsEntryStatus;
+
+ WriteMethod write_mteObjectsEntryStatus;
+
+
+
+#endif /* _MIBGROUP_MTEOBJECTSTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerBooleanTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerBooleanTable.c
new file mode 100644
index 0000000000..49ceb5fb5d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerBooleanTable.c
@@ -0,0 +1,802 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent.
+ */
+
+
+/*
+ * This should always be included first before anything else
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+
+/*
+ * minimal include directives
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "mteTriggerBooleanTable.h"
+#include "mteTriggerTable.h"
+
+
+/*
+ * mteTriggerBooleanTable_variables_oid:
+ * this is the top level oid that we want to register under. This
+ * is essentially a prefix, with the suffix appearing in the
+ * variable below.
+ */
+
+
+oid mteTriggerBooleanTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 88, 1, 2, 5 };
+
+
+/*
+ * variable2 mteTriggerBooleanTable_variables:
+ * this variable defines function callbacks and type return information
+ * for the mteTriggerBooleanTable mib section
+ */
+
+
+struct variable2 mteTriggerBooleanTable_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+#define MTETRIGGERBOOLEANCOMPARISON 3
+ {MTETRIGGERBOOLEANCOMPARISON, ASN_INTEGER, RWRITE,
+ var_mteTriggerBooleanTable, 2, {1, 1}},
+#define MTETRIGGERBOOLEANVALUE 4
+ {MTETRIGGERBOOLEANVALUE, ASN_INTEGER, RWRITE,
+ var_mteTriggerBooleanTable, 2, {1, 2}},
+#define MTETRIGGERBOOLEANSTARTUP 5
+ {MTETRIGGERBOOLEANSTARTUP, ASN_INTEGER, RWRITE,
+ var_mteTriggerBooleanTable, 2, {1, 3}},
+#define MTETRIGGERBOOLEANOBJECTSOWNER 6
+ {MTETRIGGERBOOLEANOBJECTSOWNER, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerBooleanTable, 2, {1, 4}},
+#define MTETRIGGERBOOLEANOBJECTS 7
+ {MTETRIGGERBOOLEANOBJECTS, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerBooleanTable, 2, {1, 5}},
+#define MTETRIGGERBOOLEANEVENTOWNER 8
+ {MTETRIGGERBOOLEANEVENTOWNER, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerBooleanTable, 2, {1, 6}},
+#define MTETRIGGERBOOLEANEVENT 9
+ {MTETRIGGERBOOLEANEVENT, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerBooleanTable, 2, {1, 7}},
+
+};
+/*
+ * (L = length of the oidsuffix)
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+extern struct header_complex_index *mteTriggerTableStorage;
+
+
+/*
+ * init_mteTriggerBooleanTable():
+ * Initialization routine. This is called when the agent starts up.
+ * At a minimum, registration of your variables should take place here.
+ */
+void
+init_mteTriggerBooleanTable(void)
+{
+ DEBUGMSGTL(("mteTriggerBooleanTable", "initializing... "));
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("mteTriggerBooleanTable",
+ mteTriggerBooleanTable_variables, variable2,
+ mteTriggerBooleanTable_variables_oid);
+
+ DEBUGMSGTL(("mteTriggerBooleanTable", "done.\n"));
+}
+
+/*
+ * var_mteTriggerBooleanTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_mteTriggerBooleanTable above.
+ */
+unsigned char *
+var_mteTriggerBooleanTable(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+
+ struct mteTriggerTable_data *StorageTmp = NULL;
+
+
+ DEBUGMSGTL(("mteTriggerBooleanTable",
+ "var_mteTriggerBooleanTable: Entering... \n"));
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, vp, name, length, exact,
+ var_len, write_method)) == NULL)
+ return NULL;
+
+ if (!(StorageTmp->mteTriggerTest[0] & MTETRIGGERTEST_BOOLEAN))
+ return NULL;
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+
+
+ case MTETRIGGERBOOLEANCOMPARISON:
+ *write_method = write_mteTriggerBooleanComparison;
+ *var_len = sizeof(StorageTmp->mteTriggerBooleanComparison);
+ return (u_char *) & StorageTmp->mteTriggerBooleanComparison;
+
+ case MTETRIGGERBOOLEANVALUE:
+ *write_method = write_mteTriggerBooleanValue;
+ *var_len = sizeof(StorageTmp->mteTriggerBooleanValue);
+ return (u_char *) & StorageTmp->mteTriggerBooleanValue;
+
+ case MTETRIGGERBOOLEANSTARTUP:
+ *write_method = write_mteTriggerBooleanStartup;
+ *var_len = sizeof(StorageTmp->mteTriggerBooleanStartup);
+ return (u_char *) & StorageTmp->mteTriggerBooleanStartup;
+
+ case MTETRIGGERBOOLEANOBJECTSOWNER:
+ *write_method = write_mteTriggerBooleanObjectsOwner;
+ *var_len = StorageTmp->mteTriggerBooleanObjectsOwnerLen;
+ return (u_char *) StorageTmp->mteTriggerBooleanObjectsOwner;
+
+ case MTETRIGGERBOOLEANOBJECTS:
+ *write_method = write_mteTriggerBooleanObjects;
+ *var_len = StorageTmp->mteTriggerBooleanObjectsLen;
+ return (u_char *) StorageTmp->mteTriggerBooleanObjects;
+
+ case MTETRIGGERBOOLEANEVENTOWNER:
+ *write_method = write_mteTriggerBooleanEventOwner;
+ *var_len = StorageTmp->mteTriggerBooleanEventOwnerLen;
+ return (u_char *) StorageTmp->mteTriggerBooleanEventOwner;
+
+ case MTETRIGGERBOOLEANEVENT:
+ *write_method = write_mteTriggerBooleanEvent;
+ *var_len = StorageTmp->mteTriggerBooleanEventLen;
+ return (u_char *) StorageTmp->mteTriggerBooleanEvent;
+
+
+ default:
+ ERROR_MSG("");
+ }
+ return NULL;
+}
+
+
+
+
+int
+write_mteTriggerBooleanComparison(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerBooleanTable",
+ "write_mteTriggerBooleanComparison entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerBooleanTable_variables_oid)
+ / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ fprintf(stderr,
+ "write to mteTriggerBooleanComparison not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerBooleanComparison;
+ StorageTmp->mteTriggerBooleanComparison = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->mteTriggerBooleanComparison = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerBooleanValue(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerBooleanTable",
+ "write_mteTriggerBooleanValue entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerBooleanTable_variables_oid)
+ / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ fprintf(stderr,
+ "write to mteTriggerBooleanValue not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerBooleanValue;
+ StorageTmp->mteTriggerBooleanValue = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->mteTriggerBooleanValue = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerBooleanStartup(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerBooleanTable",
+ "write_mteTriggerBooleanStartup entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerBooleanTable_variables_oid)
+ / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ fprintf(stderr,
+ "write to mteTriggerBooleanStartup not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerBooleanStartup;
+ StorageTmp->mteTriggerBooleanStartup = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->mteTriggerBooleanStartup = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerBooleanObjectsOwner(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerBooleanTable",
+ "write_mteTriggerBooleanObjectsOwner entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerBooleanTable_variables_oid)
+ / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerBooleanObjectsOwner not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerBooleanObjectsOwner;
+ tmplen = StorageTmp->mteTriggerBooleanObjectsOwnerLen;
+ StorageTmp->mteTriggerBooleanObjectsOwner =
+ netsnmp_strdup_and_null(var_val, var_val_len);
+ StorageTmp->mteTriggerBooleanObjectsOwnerLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerBooleanObjectsOwner);
+ StorageTmp->mteTriggerBooleanObjectsOwner = tmpvar;
+ StorageTmp->mteTriggerBooleanObjectsOwnerLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerBooleanObjects(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerBooleanTable",
+ "write_mteTriggerBooleanObjects entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerBooleanTable_variables_oid)
+ / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerBooleanObjects not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerBooleanObjects;
+ tmplen = StorageTmp->mteTriggerBooleanObjectsLen;
+ StorageTmp->mteTriggerBooleanObjects =
+ netsnmp_strdup_and_null(var_val, var_val_len);
+ StorageTmp->mteTriggerBooleanObjectsLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerBooleanObjects);
+ StorageTmp->mteTriggerBooleanObjects = tmpvar;
+ StorageTmp->mteTriggerBooleanObjectsLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerBooleanEventOwner(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerBooleanTable",
+ "write_mteTriggerBooleanEventOwner entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerBooleanTable_variables_oid)
+ / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerBooleanEventOwner not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerBooleanEventOwner;
+ tmplen = StorageTmp->mteTriggerBooleanEventOwnerLen;
+ StorageTmp->mteTriggerBooleanEventOwner =
+ netsnmp_strdup_and_null(var_val, var_val_len);
+ StorageTmp->mteTriggerBooleanEventOwnerLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerBooleanEventOwner);
+ StorageTmp->mteTriggerBooleanEventOwner = tmpvar;
+ StorageTmp->mteTriggerBooleanEventOwnerLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerBooleanEvent(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerBooleanTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerBooleanTable",
+ "write_mteTriggerBooleanEvent entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerBooleanTable_variables_oid)
+ / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerBooleanEvent not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerBooleanEvent;
+ tmplen = StorageTmp->mteTriggerBooleanEventLen;
+ StorageTmp->mteTriggerBooleanEvent =
+ netsnmp_strdup_and_null(var_val, var_val_len);
+ StorageTmp->mteTriggerBooleanEventLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerBooleanEvent);
+ StorageTmp->mteTriggerBooleanEvent = tmpvar;
+ StorageTmp->mteTriggerBooleanEventLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerBooleanTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerBooleanTable.h
new file mode 100644
index 0000000000..f685586eec
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerBooleanTable.h
@@ -0,0 +1,45 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+
+#ifndef _MIBGROUP_MTETRIGGERBOOLEANTABLE_H
+#define _MIBGROUP_MTETRIGGERBOOLEANTABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module
+ */
+
+
+config_require(header_complex)
+ /*
+ * enum definitions from the covered mib sections
+ */
+#define MTETRIGGERBOOLEANCOMPARISON_UNEQUAL 1
+#define MTETRIGGERBOOLEANCOMPARISON_EQUAL 2
+#define MTETRIGGERBOOLEANCOMPARISON_LESS 3
+#define MTETRIGGERBOOLEANCOMPARISON_LESSOREQUAL 4
+#define MTETRIGGERBOOLEANCOMPARISON_GREATER 5
+#define MTETRIGGERBOOLEANCOMPARISON_GREATEROREQUAL 6
+#define MTETRIGGERBOOLEANSTARTUP_TRUE 1
+#define MTETRIGGERBOOLEANSTARTUP_FALSE 2
+ /*
+ * function prototypes
+ */
+ void init_mteTriggerBooleanTable(void);
+ FindVarMethod var_mteTriggerBooleanTable;
+
+ WriteMethod write_mteTriggerBooleanComparison;
+ WriteMethod write_mteTriggerBooleanValue;
+ WriteMethod write_mteTriggerBooleanStartup;
+ WriteMethod write_mteTriggerBooleanObjectsOwner;
+ WriteMethod write_mteTriggerBooleanObjects;
+ WriteMethod write_mteTriggerBooleanEventOwner;
+ WriteMethod write_mteTriggerBooleanEvent;
+
+
+
+
+#endif /* _MIBGROUP_MTETRIGGERBOOLEANTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerDeltaTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerDeltaTable.c
new file mode 100644
index 0000000000..457f83138a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerDeltaTable.c
@@ -0,0 +1,416 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent.
+ */
+
+
+/*
+ * This should always be included first before anything else
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+
+/*
+ * minimal include directives
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "mteTriggerDeltaTable.h"
+#include "mteTriggerTable.h"
+
+
+/*
+ * mteTriggerDeltaTable_variables_oid:
+ * this is the top level oid that we want to register under. This
+ * is essentially a prefix, with the suffix appearing in the
+ * variable below.
+ */
+
+
+oid mteTriggerDeltaTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 88, 1, 2, 3 };
+
+
+/*
+ * variable2 mteTriggerDeltaTable_variables:
+ * this variable defines function callbacks and type return information
+ * for the mteTriggerDeltaTable mib section
+ */
+
+
+struct variable2 mteTriggerDeltaTable_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+#define MTETRIGGERDELTADISCONTINUITYID 3
+ {MTETRIGGERDELTADISCONTINUITYID, ASN_OBJECT_ID, RWRITE,
+ var_mteTriggerDeltaTable, 2, {1, 1}},
+#define MTETRIGGERDELTADISCONTINUITYIDWILDCARD 4
+ {MTETRIGGERDELTADISCONTINUITYIDWILDCARD, ASN_INTEGER, RWRITE,
+ var_mteTriggerDeltaTable, 2, {1, 2}},
+#define MTETRIGGERDELTADISCONTINUITYIDTYPE 5
+ {MTETRIGGERDELTADISCONTINUITYIDTYPE, ASN_INTEGER, RWRITE,
+ var_mteTriggerDeltaTable, 2, {1, 3}},
+
+};
+/*
+ * (L = length of the oidsuffix)
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+extern struct header_complex_index *mteTriggerTableStorage;
+
+
+
+/*
+ * init_mteTriggerDeltaTable():
+ * Initialization routine. This is called when the agent starts up.
+ * At a minimum, registration of your variables should take place here.
+ */
+void
+init_mteTriggerDeltaTable(void)
+{
+ DEBUGMSGTL(("mteTriggerDeltaTable", "initializing... "));
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("mteTriggerDeltaTable", mteTriggerDeltaTable_variables,
+ variable2, mteTriggerDeltaTable_variables_oid);
+
+ DEBUGMSGTL(("mteTriggerDeltaTable", "done.\n"));
+}
+
+/*
+ * var_mteTriggerDeltaTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_mteTriggerDeltaTable above.
+ */
+unsigned char *
+var_mteTriggerDeltaTable(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+
+ struct mteTriggerTable_data *StorageTmp = NULL;
+
+
+ DEBUGMSGTL(("mteTriggerDeltaTable",
+ "var_mteTriggerDeltaTable: Entering... \n"));
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, vp, name, length, exact,
+ var_len, write_method)) == NULL)
+ return NULL;
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+
+
+ case MTETRIGGERDELTADISCONTINUITYID:
+ *write_method = write_mteTriggerDeltaDiscontinuityID;
+ *var_len =
+ StorageTmp->mteTriggerDeltaDiscontinuityIDLen * sizeof(oid);
+ return (u_char *) StorageTmp->mteTriggerDeltaDiscontinuityID;
+
+ case MTETRIGGERDELTADISCONTINUITYIDWILDCARD:
+ *write_method = write_mteTriggerDeltaDiscontinuityIDWildcard;
+ *var_len =
+ sizeof(StorageTmp->mteTriggerDeltaDiscontinuityIDWildcard);
+ return (u_char *) & StorageTmp->
+ mteTriggerDeltaDiscontinuityIDWildcard;
+
+ case MTETRIGGERDELTADISCONTINUITYIDTYPE:
+ *write_method = write_mteTriggerDeltaDiscontinuityIDType;
+ *var_len = sizeof(StorageTmp->mteTriggerDeltaDiscontinuityIDType);
+ return (u_char *) & StorageTmp->mteTriggerDeltaDiscontinuityIDType;
+
+
+ default:
+ ERROR_MSG("");
+ }
+ return NULL;
+}
+
+
+
+
+int
+write_mteTriggerDeltaDiscontinuityID(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static oid *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerDeltaTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+
+ DEBUGMSGTL(("mteTriggerDeltaTable",
+ "write_mteTriggerDeltaDiscontinuityID entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerDeltaTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OBJECT_ID) {
+ fprintf(stderr,
+ "write to mteTriggerDeltaDiscontinuityID not ASN_OBJECT_ID\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerDeltaDiscontinuityID;
+ tmplen = StorageTmp->mteTriggerDeltaDiscontinuityIDLen;
+ memdup((u_char **) & StorageTmp->mteTriggerDeltaDiscontinuityID,
+ var_val, var_val_len);
+ StorageTmp->mteTriggerDeltaDiscontinuityIDLen =
+ var_val_len / sizeof(oid);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerDeltaDiscontinuityID);
+ StorageTmp->mteTriggerDeltaDiscontinuityID = tmpvar;
+ StorageTmp->mteTriggerDeltaDiscontinuityIDLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerDeltaDiscontinuityIDWildcard(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerDeltaTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+
+ DEBUGMSGTL(("mteTriggerDeltaTable",
+ "write_mteTriggerDeltaDiscontinuityIDWildcard entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerDeltaTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ fprintf(stderr,
+ "write to mteTriggerDeltaDiscontinuityIDWildcard not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerDeltaDiscontinuityIDWildcard;
+ StorageTmp->mteTriggerDeltaDiscontinuityIDWildcard =
+ *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->mteTriggerDeltaDiscontinuityIDWildcard = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerDeltaDiscontinuityIDType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerDeltaTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+
+ DEBUGMSGTL(("mteTriggerDeltaTable",
+ "write_mteTriggerDeltaDiscontinuityIDType entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerDeltaTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ fprintf(stderr,
+ "write to mteTriggerDeltaDiscontinuityIDType not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerDeltaDiscontinuityIDType;
+ StorageTmp->mteTriggerDeltaDiscontinuityIDType =
+ *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->mteTriggerDeltaDiscontinuityIDType = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerDeltaTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerDeltaTable.h
new file mode 100644
index 0000000000..0e8a17e75e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerDeltaTable.h
@@ -0,0 +1,37 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+
+#ifndef _MIBGROUP_MTETRIGGERDELTATABLE_H
+#define _MIBGROUP_MTETRIGGERDELTATABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module
+ */
+
+
+config_require(header_complex)
+
+
+ /*
+ * enum definitions from the covered mib sections
+ */
+#define MTETRIGGERDELTADISCONTINUITYIDWILDCARD_TRUE 1
+#define MTETRIGGERDELTADISCONTINUITYIDWILDCARD_FALSE 2
+#define MTETRIGGERDELTADISCONTINUITYIDTYPE_TIMETICKS 1
+#define MTETRIGGERDELTADISCONTINUITYIDTYPE_TIMESTAMP 2
+#define MTETRIGGERDELTADISCONTINUITYIDTYPE_DATEANDTIME 3
+ /*
+ * function prototypes
+ */
+ void init_mteTriggerDeltaTable(void);
+ FindVarMethod var_mteTriggerDeltaTable;
+
+ WriteMethod write_mteTriggerDeltaDiscontinuityID;
+ WriteMethod write_mteTriggerDeltaDiscontinuityIDWildcard;
+ WriteMethod write_mteTriggerDeltaDiscontinuityIDType;
+
+#endif /* _MIBGROUP_MTETRIGGERDELTATABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerExistenceTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerExistenceTable.c
new file mode 100644
index 0000000000..1aec2cd246
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerExistenceTable.c
@@ -0,0 +1,737 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent.
+ */
+
+
+/*
+ * This should always be included first before anything else
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+
+/*
+ * minimal include directives
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "mteTriggerExistenceTable.h"
+#include "mteTriggerTable.h"
+
+
+/*
+ * mteTriggerExistenceTable_variables_oid:
+ * this is the top level oid that we want to register under. This
+ * is essentially a prefix, with the suffix appearing in the
+ * variable below.
+ */
+
+
+oid mteTriggerExistenceTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 88, 1, 2, 4 };
+
+
+/*
+ * variable2 mteTriggerExistenceTable_variables:
+ * this variable defines function callbacks and type return information
+ * for the mteTriggerExistenceTable mib section
+ */
+
+
+struct variable2 mteTriggerExistenceTable_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+#define MTETRIGGEREXISTENCETEST 3
+ {MTETRIGGEREXISTENCETEST, ASN_BIT_STR, RWRITE,
+ var_mteTriggerExistenceTable, 2, {1, 1}},
+#define MTETRIGGEREXISTENCESTARTUP 4
+ {MTETRIGGEREXISTENCESTARTUP, ASN_BIT_STR, RWRITE,
+ var_mteTriggerExistenceTable, 2, {1, 2}},
+#define MTETRIGGEREXISTENCEOBJECTSOWNER 5
+ {MTETRIGGEREXISTENCEOBJECTSOWNER, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerExistenceTable, 2, {1, 3}},
+#define MTETRIGGEREXISTENCEOBJECTS 6
+ {MTETRIGGEREXISTENCEOBJECTS, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerExistenceTable, 2, {1, 4}},
+#define MTETRIGGEREXISTENCEEVENTOWNER 7
+ {MTETRIGGEREXISTENCEEVENTOWNER, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerExistenceTable, 2, {1, 5}},
+#define MTETRIGGEREXISTENCEEVENT 8
+ {MTETRIGGEREXISTENCEEVENT, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerExistenceTable, 2, {1, 6}},
+
+};
+/*
+ * (L = length of the oidsuffix)
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+extern struct header_complex_index *mteTriggerTableStorage;
+
+
+
+
+/*
+ * init_mteTriggerExistenceTable():
+ * Initialization routine. This is called when the agent starts up.
+ * At a minimum, registration of your variables should take place here.
+ */
+void
+init_mteTriggerExistenceTable(void)
+{
+ DEBUGMSGTL(("mteTriggerExistenceTable", "initializing... "));
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("mteTriggerExistenceTable",
+ mteTriggerExistenceTable_variables, variable2,
+ mteTriggerExistenceTable_variables_oid);
+
+
+ /*
+ * place any other initialization junk you need here
+ */
+
+
+ DEBUGMSGTL(("mteTriggerExistenceTable", "done.\n"));
+}
+
+/*
+ * var_mteTriggerExistenceTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_mteTriggerExistenceTable above.
+ */
+unsigned char *
+var_mteTriggerExistenceTable(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+
+ struct mteTriggerTable_data *StorageTmp = NULL;
+
+
+ DEBUGMSGTL(("mteTriggerExistenceTable",
+ "var_mteTriggerExistenceTable: Entering... \n"));
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, vp, name, length, exact,
+ var_len, write_method)) == NULL)
+ return NULL;
+
+ if (!(StorageTmp->mteTriggerTest[0] & MTETRIGGERTEST_EXISTENCE))
+ return NULL;
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+
+
+ case MTETRIGGEREXISTENCETEST:
+ *write_method = write_mteTriggerExistenceTest;
+ *var_len = StorageTmp->mteTriggerExistenceTestLen;
+ return (u_char *) StorageTmp->mteTriggerExistenceTest;
+
+ case MTETRIGGEREXISTENCESTARTUP:
+ *write_method = write_mteTriggerExistenceStartup;
+ *var_len = StorageTmp->mteTriggerExistenceStartupLen;
+ return (u_char *) StorageTmp->mteTriggerExistenceStartup;
+
+ case MTETRIGGEREXISTENCEOBJECTSOWNER:
+ *write_method = write_mteTriggerExistenceObjectsOwner;
+ *var_len = StorageTmp->mteTriggerExistenceObjectsOwnerLen;
+ return (u_char *) StorageTmp->mteTriggerExistenceObjectsOwner;
+
+ case MTETRIGGEREXISTENCEOBJECTS:
+ *write_method = write_mteTriggerExistenceObjects;
+ *var_len = StorageTmp->mteTriggerExistenceObjectsLen;
+ return (u_char *) StorageTmp->mteTriggerExistenceObjects;
+
+ case MTETRIGGEREXISTENCEEVENTOWNER:
+ *write_method = write_mteTriggerExistenceEventOwner;
+ *var_len = StorageTmp->mteTriggerExistenceEventOwnerLen;
+ return (u_char *) StorageTmp->mteTriggerExistenceEventOwner;
+
+ case MTETRIGGEREXISTENCEEVENT:
+ *write_method = write_mteTriggerExistenceEvent;
+ *var_len = StorageTmp->mteTriggerExistenceEventLen;
+ return (u_char *) StorageTmp->mteTriggerExistenceEvent;
+
+
+ default:
+ ERROR_MSG("");
+ }
+ return NULL;
+}
+
+
+
+
+int
+write_mteTriggerExistenceTest(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerExistenceTable",
+ "write_mteTriggerExistenceTest entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerExistenceTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerExistenceTest not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerExistenceTest;
+ tmplen = StorageTmp->mteTriggerExistenceTestLen;
+ memdup((u_char **) & StorageTmp->mteTriggerExistenceTest, var_val,
+ var_val_len);
+ StorageTmp->mteTriggerExistenceTestLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerExistenceTest);
+ StorageTmp->mteTriggerExistenceTest = tmpvar;
+ StorageTmp->mteTriggerExistenceTestLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerExistenceStartup(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerExistenceTable",
+ "write_mteTriggerExistenceStartup entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerExistenceTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerExistenceStartup not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerExistenceStartup;
+ tmplen = StorageTmp->mteTriggerExistenceStartupLen;
+ memdup((u_char **) & StorageTmp->mteTriggerExistenceStartup,
+ var_val, var_val_len);
+ StorageTmp->mteTriggerExistenceStartupLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerExistenceStartup);
+ StorageTmp->mteTriggerExistenceStartup = tmpvar;
+ StorageTmp->mteTriggerExistenceStartupLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerExistenceObjectsOwner(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerExistenceTable",
+ "write_mteTriggerExistenceObjectsOwner entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerExistenceTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerExistenceObjectsOwner not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerExistenceObjectsOwner;
+ tmplen = StorageTmp->mteTriggerExistenceObjectsOwnerLen;
+ memdup((u_char **) & StorageTmp->mteTriggerExistenceObjectsOwner,
+ var_val, var_val_len);
+ StorageTmp->mteTriggerExistenceObjectsOwnerLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerExistenceObjectsOwner);
+ StorageTmp->mteTriggerExistenceObjectsOwner = tmpvar;
+ StorageTmp->mteTriggerExistenceObjectsOwnerLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerExistenceObjects(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerExistenceTable",
+ "write_mteTriggerExistenceObjects entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerExistenceTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerExistenceObjects not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerExistenceObjects;
+ tmplen = StorageTmp->mteTriggerExistenceObjectsLen;
+ memdup((u_char **) & StorageTmp->mteTriggerExistenceObjects,
+ var_val, var_val_len);
+ StorageTmp->mteTriggerExistenceObjectsLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerExistenceObjects);
+ StorageTmp->mteTriggerExistenceObjects = tmpvar;
+ StorageTmp->mteTriggerExistenceObjectsLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerExistenceEventOwner(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerExistenceTable",
+ "write_mteTriggerExistenceEventOwner entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerExistenceTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerExistenceEventOwner not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerExistenceEventOwner;
+ tmplen = StorageTmp->mteTriggerExistenceEventOwnerLen;
+ memdup((u_char **) & StorageTmp->mteTriggerExistenceEventOwner,
+ var_val, var_val_len);
+ StorageTmp->mteTriggerExistenceEventOwnerLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerExistenceEventOwner);
+ StorageTmp->mteTriggerExistenceEventOwner = tmpvar;
+ StorageTmp->mteTriggerExistenceEventOwnerLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerExistenceEvent(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerExistenceTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerExistenceTable",
+ "write_mteTriggerExistenceEvent entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerExistenceTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerExistenceEvent not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerExistenceEvent;
+ tmplen = StorageTmp->mteTriggerExistenceEventLen;
+ memdup((u_char **) & StorageTmp->mteTriggerExistenceEvent, var_val,
+ var_val_len);
+ StorageTmp->mteTriggerExistenceEventLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerExistenceEvent);
+ StorageTmp->mteTriggerExistenceEvent = tmpvar;
+ StorageTmp->mteTriggerExistenceEventLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerExistenceTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerExistenceTable.h
new file mode 100644
index 0000000000..40dbd4e08d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerExistenceTable.h
@@ -0,0 +1,39 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+
+#ifndef _MIBGROUP_MTETRIGGEREXISTENCETABLE_H
+#define _MIBGROUP_MTETRIGGEREXISTENCETABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module
+ */
+
+
+config_require(header_complex)
+
+ /*
+ * enum definitions from the covered mib sections
+ */
+#define MTETRIGGEREXISTENCETEST_PRESENT 0x80
+#define MTETRIGGEREXISTENCETEST_ABSENT 0x40
+#define MTETRIGGEREXISTENCETEST_CHANGED 0x20
+#define MTETRIGGEREXISTENCESTARTUP_PRESENT 0x80
+#define MTETRIGGEREXISTENCESTARTUP_ABSENT 0x40
+ /*
+ * function prototypes
+ */
+ void init_mteTriggerExistenceTable(void);
+ FindVarMethod var_mteTriggerExistenceTable;
+
+ WriteMethod write_mteTriggerExistenceTest;
+ WriteMethod write_mteTriggerExistenceStartup;
+ WriteMethod write_mteTriggerExistenceObjectsOwner;
+ WriteMethod write_mteTriggerExistenceObjects;
+ WriteMethod write_mteTriggerExistenceEventOwner;
+ WriteMethod write_mteTriggerExistenceEvent;
+
+#endif /* _MIBGROUP_MTETRIGGEREXISTENCETABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerTable.c
new file mode 100644
index 0000000000..16fee0b710
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerTable.c
@@ -0,0 +1,3716 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent.
+ */
+
+
+/*
+ * This should always be included first before anything else
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+
+/*
+ * minimal include directives
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "mteTriggerTable.h"
+#include "mteTriggerBooleanTable.h"
+#include "mteTriggerDeltaTable.h"
+#include "mteTriggerExistenceTable.h"
+#include "mteTriggerThresholdTable.h"
+#include "mteEventTable.h"
+#include "mteObjectsTable.h"
+
+/*
+ * mteTriggerTable_variables_oid:
+ * this is the top level oid that we want to register under. This
+ * is essentially a prefix, with the suffix appearing in the
+ * variable below.
+ */
+
+/*
+ * trap definitions
+ */
+oid mteTriggerFired[] = { 1, 3, 6, 1, 2, 1, 88, 2, 0, 1 };
+oid mteTriggerRising[] = { 1, 3, 6, 1, 2, 1, 88, 2, 0, 2 };
+oid mteTriggerFalling[] = { 1, 3, 6, 1, 2, 1, 88, 2, 0, 3 };
+oid mteTriggerFailure[] = { 1, 3, 6, 1, 2, 1, 88, 2, 0, 4 };
+oid mteEventSetFailure[] = { 1, 3, 6, 1, 2, 1, 88, 2, 0, 5 };
+
+/*
+ * trap objects
+ */
+oid mteHotTrigger[] = { 1, 3, 6, 1, 2, 1, 88, 2, 1, 1 };
+oid mteHotTargetName[] = { 1, 3, 6, 1, 2, 1, 88, 2, 1, 2 };
+oid mteHotContextName[] = { 1, 3, 6, 1, 2, 1, 88, 2, 1, 3 };
+oid mteHotOID[] = { 1, 3, 6, 1, 2, 1, 88, 2, 1, 4 };
+oid mteHotValue[] = { 1, 3, 6, 1, 2, 1, 88, 2, 1, 5 };
+oid mteFailedReason[] = { 1, 3, 6, 1, 2, 1, 88, 2, 1, 6 };
+
+/*
+ * For discontinuity checking.
+ */
+oid sysUpTimeInstance[] = { 1, 3, 6, 1, 2, 1, 1, 3, 0 };
+
+oid mteTriggerTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 88, 1, 2, 2 };
+
+
+/*
+ * variable2 mteTriggerTable_variables:
+ * this variable defines function callbacks and type return information
+ * for the mteTriggerTable mib section
+ */
+
+
+struct variable2 mteTriggerTable_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+#define MTETRIGGERCOMMENT 5
+ {MTETRIGGERCOMMENT, ASN_OCTET_STR, RWRITE, var_mteTriggerTable, 2,
+ {1, 3}},
+#define MTETRIGGERTEST 6
+ {MTETRIGGERTEST, ASN_OCTET_STR, RWRITE, var_mteTriggerTable, 2, {1, 4}},
+#define MTETRIGGERSAMPLETYPE 7
+ {MTETRIGGERSAMPLETYPE, ASN_INTEGER, RWRITE, var_mteTriggerTable, 2,
+ {1, 5}},
+#define MTETRIGGERVALUEID 8
+ {MTETRIGGERVALUEID, ASN_OBJECT_ID, RWRITE, var_mteTriggerTable, 2,
+ {1, 6}},
+#define MTETRIGGERVALUEIDWILDCARD 9
+ {MTETRIGGERVALUEIDWILDCARD, ASN_INTEGER, RWRITE, var_mteTriggerTable,
+ 2, {1, 7}},
+#define MTETRIGGERTARGETTAG 10
+ {MTETRIGGERTARGETTAG, ASN_OCTET_STR, RWRITE, var_mteTriggerTable, 2,
+ {1, 8}},
+#define MTETRIGGERCONTEXTNAME 11
+ {MTETRIGGERCONTEXTNAME, ASN_OCTET_STR, RWRITE, var_mteTriggerTable, 2,
+ {1, 9}},
+#define MTETRIGGERCONTEXTNAMEWILDCARD 12
+ {MTETRIGGERCONTEXTNAMEWILDCARD, ASN_INTEGER, RWRITE,
+ var_mteTriggerTable, 2, {1, 10}},
+#define MTETRIGGERFREQUENCY 13
+ {MTETRIGGERFREQUENCY, ASN_UNSIGNED, RWRITE, var_mteTriggerTable, 2,
+ {1, 11}},
+#define MTETRIGGEROBJECTSOWNER 14
+ {MTETRIGGEROBJECTSOWNER, ASN_OCTET_STR, RWRITE, var_mteTriggerTable, 2,
+ {1, 12}},
+#define MTETRIGGEROBJECTS 15
+ {MTETRIGGEROBJECTS, ASN_OCTET_STR, RWRITE, var_mteTriggerTable, 2,
+ {1, 13}},
+#define MTETRIGGERENABLED 16
+ {MTETRIGGERENABLED, ASN_INTEGER, RWRITE, var_mteTriggerTable, 2,
+ {1, 14}},
+#define MTETRIGGERENTRYSTATUS 17
+ {MTETRIGGERENTRYSTATUS, ASN_INTEGER, RWRITE, var_mteTriggerTable, 2,
+ {1, 15}},
+
+};
+/*
+ * (L = length of the oidsuffix)
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+struct header_complex_index *mteTriggerTableStorage = NULL;
+
+netsnmp_session *mte_callback_sess = NULL;
+extern int callback_master_num;
+
+/*
+ * init_mteTriggerTable():
+ * Initialization routine. This is called when the agent starts up.
+ * At a minimum, registration of your variables should take place here.
+ */
+void
+init_mteTriggerTable(void)
+{
+ DEBUGMSGTL(("mteTriggerTable", "initializing... "));
+
+#ifndef NETSNMP_TRANSPORT_CALLBACK_DOMAIN
+ snmp_log(LOG_WARNING,"mteTriggerTable has been disabled because "
+ "the callback transport is not available.\n");
+ return;
+#endif
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("mteTriggerTable", mteTriggerTable_variables, variable2,
+ mteTriggerTable_variables_oid);
+
+
+ /*
+ * register our config handler(s) to deal with registrations
+ */
+ snmpd_register_config_handler("mteTriggerTable", parse_mteTriggerTable,
+ NULL, NULL);
+
+ snmpd_register_config_handler("monitor", parse_simple_monitor, NULL,
+ "[options] monitor_expression [see \"man snmpd.conf\"]");
+ snmpd_register_config_handler("defaultMonitors",
+ parse_default_monitors, NULL, "yes|no");
+
+ /*
+ * we need to be called back later to store our data
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_mteTriggerTable, NULL);
+
+
+ /*
+ * place any other initialization junk you need here
+ */
+ se_add_pair_to_slist("mteBooleanOperators", strdup("!="),
+ MTETRIGGERBOOLEANCOMPARISON_UNEQUAL);
+ se_add_pair_to_slist("mteBooleanOperators", strdup("=="),
+ MTETRIGGERBOOLEANCOMPARISON_EQUAL);
+ se_add_pair_to_slist("mteBooleanOperators", strdup("<"),
+ MTETRIGGERBOOLEANCOMPARISON_LESS);
+ se_add_pair_to_slist("mteBooleanOperators", strdup("<="),
+ MTETRIGGERBOOLEANCOMPARISON_LESSOREQUAL);
+ se_add_pair_to_slist("mteBooleanOperators", strdup(">"),
+ MTETRIGGERBOOLEANCOMPARISON_GREATER);
+ se_add_pair_to_slist("mteBooleanOperators", strdup(">="),
+ MTETRIGGERBOOLEANCOMPARISON_GREATEROREQUAL);
+
+#ifdef NETSNMP_TRANSPORT_CALLBACK_DOMAIN
+ /*
+ * open a 'callback' session to the main agent
+ */
+ if (mte_callback_sess == NULL) {
+ mte_callback_sess = netsnmp_callback_open(callback_master_num,
+ NULL, NULL, NULL);
+ DEBUGMSGTL(("mteTriggerTable", "created callback session = %08x\n",
+ mte_callback_sess));
+ }
+#endif
+ DEBUGMSGTL(("mteTriggerTable", "done.\n"));
+}
+
+struct mteTriggerTable_data *
+create_mteTriggerTable_data(void)
+{
+ struct mteTriggerTable_data *StorageNew;
+
+ StorageNew = SNMP_MALLOC_STRUCT(mteTriggerTable_data);
+
+ /*
+ * fill in default row values here into StorageNew
+ */
+ /*
+ * fill in values for all tables (even if not
+ * appropriate), since its easier to do here than anywhere
+ * else
+ */
+ StorageNew->mteTriggerComment = strdup("");
+ StorageNew->mteTriggerTest = strdup("");
+ StorageNew->mteTriggerTest[0] |= (char) MTETRIGGERTEST_BOOLEAN;
+ StorageNew->mteTriggerTestLen = 1;
+ StorageNew->mteTriggerSampleType = MTETRIGGERSAMPLETYPE_ABSOLUTEVALUE;
+ StorageNew->mteTriggerValueID = calloc(1, sizeof(oid) * sizeof(2)); /* 0.0 */
+ StorageNew->mteTriggerValueIDLen = 2;
+ StorageNew->mteTriggerValueIDWildcard =
+ MTETRIGGERVALUEIDWILDCARD_FALSE;
+ StorageNew->mteTriggerTargetTag = strdup("");
+ StorageNew->mteTriggerContextName = strdup("");
+ StorageNew->mteTriggerContextNameWildcard =
+ MTETRIGGERCONTEXTNAMEWILDCARD_FALSE;
+ StorageNew->mteTriggerFrequency = 600;
+ StorageNew->mteTriggerObjectsOwner = strdup("");
+ StorageNew->mteTriggerObjects = strdup("");
+ StorageNew->mteTriggerEnabled = MTETRIGGERENABLED_FALSE;
+ memdup((unsigned char **)
+ &(StorageNew->mteTriggerDeltaDiscontinuityID),
+ (unsigned char *) sysUpTimeInstance, sizeof(sysUpTimeInstance));
+ StorageNew->mteTriggerDeltaDiscontinuityIDLen =
+ sizeof(sysUpTimeInstance) / sizeof(oid);
+ StorageNew->mteTriggerDeltaDiscontinuityIDWildcard = TV_FALSE;
+ StorageNew->mteTriggerDeltaDiscontinuityIDType =
+ MTETRIGGERDELTADISCONTINUITYIDTYPE_TIMETICKS;
+ StorageNew->mteTriggerExistenceTest = strdup("");
+ StorageNew->mteTriggerExistenceTest[0] =
+ (char) (MTETRIGGEREXISTENCETEST_PRESENT |
+ MTETRIGGEREXISTENCETEST_ABSENT);
+ StorageNew->mteTriggerExistenceTestLen = 1;
+ StorageNew->mteTriggerExistenceStartup = strdup("");
+ StorageNew->mteTriggerExistenceStartup[0] =
+ (char) (MTETRIGGEREXISTENCESTARTUP_PRESENT);
+ StorageNew->mteTriggerExistenceStartupLen = 1;
+ StorageNew->mteTriggerExistenceObjectsOwner = strdup("");
+ StorageNew->mteTriggerExistenceObjects = strdup("");
+ StorageNew->mteTriggerExistenceEventOwner = strdup("");
+ StorageNew->mteTriggerExistenceEvent = strdup("");
+ StorageNew->mteTriggerBooleanComparison =
+ MTETRIGGERBOOLEANCOMPARISON_UNEQUAL;
+ StorageNew->mteTriggerBooleanStartup = MTETRIGGERBOOLEANSTARTUP_TRUE;
+ StorageNew->mteTriggerBooleanObjectsOwner = strdup("");
+ StorageNew->mteTriggerBooleanObjects = strdup("");
+ StorageNew->mteTriggerBooleanEventOwner = strdup("");
+ StorageNew->mteTriggerBooleanEvent = strdup("");
+ StorageNew->mteTriggerThresholdStartup =
+ MTETRIGGERTHRESHOLDSTARTUP_RISINGORFALLING;
+ StorageNew->mteTriggerThresholdObjectsOwner = strdup("");
+ StorageNew->mteTriggerThresholdObjects = strdup("");
+ StorageNew->mteTriggerThresholdRisingEventOwner = strdup("");
+ StorageNew->mteTriggerThresholdRisingEvent = strdup("");
+ StorageNew->mteTriggerThresholdFallingEventOwner = strdup("");
+ StorageNew->mteTriggerThresholdFallingEvent = strdup("");
+ StorageNew->mteTriggerThresholdDeltaRisingEventOwner = strdup("");
+ StorageNew->mteTriggerThresholdDeltaRisingEvent = strdup("");
+ StorageNew->mteTriggerThresholdDeltaFallingEventOwner = strdup("");
+ StorageNew->mteTriggerThresholdDeltaFallingEvent = strdup("");
+ StorageNew->lastboolresult = -1;
+ StorageNew->storageType = ST_NONVOLATILE;
+ StorageNew->prevDiscoTicks = 0;
+ StorageNew->prevUptimeTicks = 0;
+ return StorageNew;
+}
+
+/*
+ * mteTriggerTable_add(): adds a structure node to our data set
+ */
+int
+mteTriggerTable_add(struct mteTriggerTable_data *thedata)
+{
+ netsnmp_variable_list *vars = NULL;
+
+
+ DEBUGMSGTL(("mteTriggerTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->mteOwner, thedata->mteOwnerLen); /* mteOwner */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR, (char *) thedata->mteTriggerName, thedata->mteTriggerNameLen); /* mteTriggerName */
+
+
+
+ header_complex_add_data(&mteTriggerTableStorage, vars, thedata);
+ DEBUGMSGTL(("mteTriggerTable", "registered an entry\n"));
+
+
+ DEBUGMSGTL(("mteTriggerTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+#define MTE_PROCESS_LINE(line) \
+ snprintf(buf, SPRINT_MAX_LEN, "-u %s %s", mte_default_user, line); \
+ parse_simple_monitor("monitor", buf);
+
+void
+parse_default_monitors(const char *token, char *line)
+{
+ char buf[SPRINT_MAX_LEN];
+ char *mte_default_user =
+ netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_INTERNAL_SECNAME);
+
+ if (strncmp(line, "yes", 3) == 0) {
+
+ DEBUGMSGTL(("mteTriggerTable", "registering default monitors\n"));
+
+ if (mte_default_user == NULL) {
+ config_perror
+ ("You must specify a user name first using the agentSecName token\n");
+ return;
+ }
+
+ /*
+ * we don't include many additional objects here as most of
+ * the error messages are complete with the needed
+ * information
+ */
+ MTE_PROCESS_LINE
+ ("-o prNames -o prErrMessage \"process table\" prErrorFlag != 0");
+ MTE_PROCESS_LINE
+ ("-o memErrorName -o memSwapErrorMsg \"memory\" memSwapError != 0");
+ MTE_PROCESS_LINE
+ ("-o extNames -o extOutput \"extTable\" extResult != 0");
+ MTE_PROCESS_LINE
+ ("-o dskPath -o dskErrorMsg \"dskTable\" dskErrorFlag != 0");
+ MTE_PROCESS_LINE
+ ("-o laNames -o laErrMessage \"laTable\" laErrorFlag != 0");
+ MTE_PROCESS_LINE
+ ("-o fileName -o fileErrorMsg \"fileTable\" fileErrorFlag != 0");
+ /*
+ * this one is not *all* that useful, because the error is
+ * only kept for 30 seconds at most. Maybe scan it every 30
+ * seconds, but I'm not doing so without seeking other peoples
+ * opinions first.
+ */
+ MTE_PROCESS_LINE
+ ("-o snmperrErrMessage \"snmperrs\" snmperrErrorFlag != 0");
+ }
+}
+
+static int monitor_call_count = 0;
+void
+parse_simple_monitor(const char *token, char *line)
+{
+ char buf[SPRINT_MAX_LEN], *cp, ebuf[SPRINT_MAX_LEN],
+ eventname[64];
+ oid obuf[MAX_OID_LEN];
+ size_t obufLen;
+ struct mteTriggerTable_data *StorageNew;
+
+ monitor_call_count++;
+ eventname[0] = '\0';
+
+ StorageNew = create_mteTriggerTable_data();
+ StorageNew->storageType = ST_READONLY;
+ StorageNew->mteTriggerEnabled = MTETRIGGERENABLED_TRUE;
+ StorageNew->mteTriggerEntryStatus = RS_ACTIVE;
+ StorageNew->mteTriggerValueIDWildcard = MTETRIGGERVALUEIDWILDCARD_TRUE;
+ StorageNew->mteTriggerBooleanStartup = MTETRIGGERBOOLEANSTARTUP_TRUE;
+ StorageNew->mteTriggerThresholdStartup =
+ MTETRIGGERTHRESHOLDSTARTUP_RISINGORFALLING;
+ StorageNew->mteTriggerExistenceTest[0] = 0;
+
+ /*
+ * owner = snmpd.conf, why not?
+ */
+ StorageNew->mteOwner = strdup("snmpd.conf");
+ StorageNew->mteOwnerLen = strlen(StorageNew->mteOwner);
+ StorageNew->pdu_version = SNMP_VERSION_3;
+ StorageNew->pdu_securityModel = SNMP_SEC_MODEL_USM;
+ StorageNew->pdu_securityLevel = SNMP_SEC_LEVEL_AUTHNOPRIV;
+
+ cp = line;
+
+ while (cp && *cp == '-') {
+ cp = copy_nword(cp, buf, sizeof(buf));
+ switch (buf[1]) {
+ case 't':
+ /*
+ * Threshold toggle
+ */
+ StorageNew->mteTriggerTest[0] = MTETRIGGERTEST_THRESHOLD;
+ break;
+ case 'i':
+ /*
+ * Single instance
+ */
+ StorageNew->mteTriggerValueIDWildcard = MTETRIGGERVALUEIDWILDCARD_FALSE;
+ break;
+ case 'r':
+ if (cp) {
+ cp = copy_nword(cp, buf, sizeof(buf));
+ StorageNew->mteTriggerFrequency = strtoul(buf, NULL, 0);
+ } else {
+ config_perror("No parameter after -r given\n");
+ /*
+ * XXX: free StorageNew
+ */
+ return;
+ }
+ break;
+ case 'u':
+ if (cp) {
+ cp = copy_nword(cp, buf, sizeof(buf));
+ StorageNew->pdu_securityName = strdup(buf);
+ StorageNew->pdu_securityNameLen = strlen(buf);
+ } else {
+ config_perror("No parameter after -u given\n");
+ /*
+ * XXX: free StorageNew
+ */
+ return;
+ }
+ break;
+ case 'e':
+ if (cp) {
+ cp = copy_nword(cp, eventname, sizeof(eventname));
+ } else {
+ config_perror("No parameter after -e given\n");
+ /*
+ * XXX: free StorageNew
+ */
+ return;
+ }
+ break;
+ case 'o':
+ /*
+ * oid
+ */
+ cp = copy_nword(cp, buf, sizeof(buf));
+ obufLen = MAX_OID_LEN;
+ if (!snmp_parse_oid(buf, obuf, &obufLen)) {
+ sprintf(ebuf, "unable to parse oid: %s", buf);
+ config_perror(ebuf);
+ /*
+ * XXX: free StorageNew
+ */
+ return;
+ }
+ sprintf(buf, "snmpd.conf%d", monitor_call_count);
+ mte_add_object_to_table("snmpd.conf", buf, obuf, obufLen, 1);
+
+ if (StorageNew->mteTriggerObjectsOwnerLen == 0) {
+ SNMP_FREE(StorageNew->mteTriggerObjectsOwner);
+ StorageNew->mteTriggerObjectsOwner = strdup("snmpd.conf");
+ StorageNew->mteTriggerObjectsOwnerLen =
+ strlen("snmpd.conf");
+ }
+
+ if (StorageNew->mteTriggerObjectsLen == 0) {
+ SNMP_FREE(StorageNew->mteTriggerObjects);
+ StorageNew->mteTriggerObjects = strdup(buf);
+ StorageNew->mteTriggerObjectsLen = strlen(buf);
+ }
+ break;
+ }
+ }
+
+ if (StorageNew->pdu_securityNameLen == 0) {
+ char *mte_default_user =
+ netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_INTERNAL_SECNAME);
+ if (mte_default_user) {
+ StorageNew->pdu_securityName = strdup(mte_default_user);
+ StorageNew->pdu_securityNameLen = strlen(mte_default_user);
+ } else {
+ config_perror("-u USER parameter required\n");
+ /*
+ * XXX: free StorageNew
+ */
+ return;
+ }
+ }
+
+ /*
+ * name
+ */
+ cp = copy_nword(cp, buf, sizeof(buf));
+ if (!cp) {
+ config_perror("illegal monitor: no name specified");
+ /*
+ * XXX: free StorageNew
+ */
+ return;
+ }
+
+ StorageNew->mteTriggerName = strdup(buf);
+ StorageNew->mteTriggerNameLen = strlen(StorageNew->mteTriggerName);
+
+ /*
+ * oid
+ */
+ cp = copy_nword(cp, buf, sizeof(buf));
+ obufLen = MAX_OID_LEN;
+ if (!snmp_parse_oid(buf, obuf, &obufLen)) {
+ sprintf(ebuf, "unable to parse oid: %s", buf);
+ config_perror(ebuf);
+ /*
+ * XXX: free StorageNew
+ */
+ return;
+ }
+ if (StorageNew->mteTriggerValueID)
+ free(StorageNew->mteTriggerValueID);
+ StorageNew->mteTriggerValueID = snmp_duplicate_objid(obuf, obufLen);
+ StorageNew->mteTriggerValueIDLen = obufLen;
+
+ if (StorageNew->mteTriggerTest[0] == MTETRIGGERTEST_THRESHOLD) {
+ /*
+ * it's a threshold
+ * grab 'low' and 'high' params
+ */
+ if (!cp) {
+ config_perror("no lower threshold value specified");
+ }
+ cp = copy_nword(cp, buf, sizeof(buf));
+ StorageNew->mteTriggerThresholdFalling = strtol(buf, NULL, 0);
+
+ if (!cp) {
+ config_perror("no upper threshold value specified");
+ }
+ cp = copy_nword(cp, buf, sizeof(buf));
+ StorageNew->mteTriggerThresholdRising = strtol(buf, NULL, 0);
+ } else {
+ /*
+ * if nothing beyond here, it's an existence test
+ */
+ if (!cp) {
+ StorageNew->mteTriggerTest[0] = (u_char)MTETRIGGERTEST_EXISTENCE;
+ if (eventname[0] != '\0') {
+ StorageNew->mteTriggerExistenceEventOwner =
+ strdup("snmpd.conf");
+ StorageNew->mteTriggerExistenceEventOwnerLen =
+ strlen(StorageNew->mteTriggerExistenceEventOwner);
+ StorageNew->mteTriggerExistenceEvent =
+ strdup(eventname);
+ StorageNew->mteTriggerExistenceEventLen =
+ strlen(eventname);
+ }
+ mteTriggerTable_add(StorageNew);
+ return;
+ }
+
+ /*
+ * assume boolean (need to deal with threshold statements)
+ */
+ cp = copy_nword(cp, buf, sizeof(buf));
+ if ((StorageNew->mteTriggerBooleanComparison =
+ se_find_value_in_slist("mteBooleanOperators", buf)) == -1) {
+ config_perror("illegal boolean operator");
+ return;
+ }
+
+ /*
+ * XXX: add threshold
+ */
+ StorageNew->mteTriggerTest[0] = MTETRIGGERTEST_BOOLEAN;
+ if (!cp) {
+ config_perror("no comparison value specified");
+ /*
+ * XXX: free StorageNew
+ */
+ return;
+ }
+
+ cp = copy_nword(cp, buf, sizeof(buf));
+ StorageNew->mteTriggerBooleanValue = strtol(buf, NULL, 0);
+
+ if (eventname[0] != '\0') {
+ StorageNew->mteTriggerBooleanEventOwner =
+ strdup("snmpd.conf");
+ StorageNew->mteTriggerBooleanEventOwnerLen =
+ strlen(StorageNew->mteTriggerBooleanEventOwner);
+ StorageNew->mteTriggerBooleanEvent =
+ strdup(eventname);
+ StorageNew->mteTriggerBooleanEventLen =
+ strlen(eventname);
+ }
+ }
+ mteTriggerTable_add(StorageNew);
+ mte_enable_trigger(StorageNew);
+
+ DEBUGMSGTL(("mteTriggerTable", "added simple monitor: %s\n",
+ StorageNew->mteTriggerName));
+}
+
+
+/*
+ * parse_mteTriggerTable():
+ * parses .conf file entries needed to configure the mib.
+ */
+void
+parse_mteTriggerTable(const char *token, char *line)
+{
+ size_t tmpint;
+ oid *tmpoid = NULL;
+ struct mteTriggerTable_data *StorageTmp =
+ SNMP_MALLOC_STRUCT(mteTriggerTable_data);
+
+ DEBUGMSGTL(("mteTriggerTable", "parsing config... "));
+
+ if (StorageTmp == NULL) {
+ config_perror("malloc failure");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line, &StorageTmp->mteOwner,
+ &StorageTmp->mteOwnerLen);
+ if (StorageTmp->mteOwner == NULL) {
+ config_perror("invalid specification for mteOwner");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerName,
+ &StorageTmp->mteTriggerNameLen);
+ if (StorageTmp->mteTriggerName == NULL) {
+ config_perror("invalid specification for mteTriggerName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerComment,
+ &StorageTmp->mteTriggerCommentLen);
+ if (StorageTmp->mteTriggerComment == NULL) {
+ config_perror("invalid specification for mteTriggerComment");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerTest,
+ &StorageTmp->mteTriggerTestLen);
+ if (StorageTmp->mteTriggerTest == NULL) {
+ config_perror("invalid specification for mteTriggerTest");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->mteTriggerSampleType, &tmpint);
+
+ line =
+ read_config_read_data(ASN_OBJECT_ID, line,
+ &StorageTmp->mteTriggerValueID,
+ &StorageTmp->mteTriggerValueIDLen);
+ if (StorageTmp->mteTriggerValueID == NULL) {
+ config_perror("invalid specification for mteTriggerValueID");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->mteTriggerValueIDWildcard,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerTargetTag,
+ &StorageTmp->mteTriggerTargetTagLen);
+ if (StorageTmp->mteTriggerTargetTag == NULL) {
+ config_perror("invalid specification for mteTriggerTargetTag");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerContextName,
+ &StorageTmp->mteTriggerContextNameLen);
+ if (StorageTmp->mteTriggerContextName == NULL) {
+ config_perror("invalid specification for mteTriggerContextName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->mteTriggerContextNameWildcard,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->mteTriggerFrequency, &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerObjectsOwner,
+ &StorageTmp->mteTriggerObjectsOwnerLen);
+ if (StorageTmp->mteTriggerObjectsOwner == NULL) {
+ config_perror("invalid specification for mteTriggerObjectsOwner");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerObjects,
+ &StorageTmp->mteTriggerObjectsLen);
+ if (StorageTmp->mteTriggerObjects == NULL) {
+ config_perror("invalid specification for mteTriggerObjects");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->mteTriggerEnabled, &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->mteTriggerEntryStatus, &tmpint);
+
+ /*
+ * delta table
+ */
+ line =
+ read_config_read_data(ASN_OBJECT_ID, line,
+ &StorageTmp->mteTriggerDeltaDiscontinuityID,
+ &StorageTmp->
+ mteTriggerDeltaDiscontinuityIDLen);
+ if (StorageTmp->mteTriggerDeltaDiscontinuityID == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerDeltaDiscontinuityID");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->
+ mteTriggerDeltaDiscontinuityIDWildcard,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->
+ mteTriggerDeltaDiscontinuityIDType, &tmpint);
+
+ /*
+ * existence table
+ */
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerExistenceTest,
+ &StorageTmp->mteTriggerExistenceTestLen);
+ if (StorageTmp->mteTriggerExistenceTest == NULL) {
+ config_perror("invalid specification for mteTriggerExistenceTest");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerExistenceStartup,
+ &StorageTmp->mteTriggerExistenceStartupLen);
+ if (StorageTmp->mteTriggerExistenceStartup == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerExistenceStartup");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerExistenceObjectsOwner,
+ &StorageTmp->
+ mteTriggerExistenceObjectsOwnerLen);
+ if (StorageTmp->mteTriggerExistenceObjectsOwner == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerExistenceObjectsOwner");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerExistenceObjects,
+ &StorageTmp->mteTriggerExistenceObjectsLen);
+ if (StorageTmp->mteTriggerExistenceObjects == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerExistenceObjects");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerExistenceEventOwner,
+ &StorageTmp->
+ mteTriggerExistenceEventOwnerLen);
+ if (StorageTmp->mteTriggerExistenceEventOwner == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerExistenceEventOwner");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerExistenceEvent,
+ &StorageTmp->mteTriggerExistenceEventLen);
+ if (StorageTmp->mteTriggerExistenceEvent == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerExistenceEvent");
+ return;
+ }
+
+ /*
+ * boolean table
+ */
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->mteTriggerBooleanComparison,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->mteTriggerBooleanValue,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->mteTriggerBooleanStartup,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerBooleanObjectsOwner,
+ &StorageTmp->
+ mteTriggerBooleanObjectsOwnerLen);
+ if (StorageTmp->mteTriggerBooleanObjectsOwner == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerBooleanObjectsOwner");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerBooleanObjects,
+ &StorageTmp->mteTriggerBooleanObjectsLen);
+ if (StorageTmp->mteTriggerBooleanObjects == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerBooleanObjects");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerBooleanEventOwner,
+ &StorageTmp->mteTriggerBooleanEventOwnerLen);
+ if (StorageTmp->mteTriggerBooleanEventOwner == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerBooleanEventOwner");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerBooleanEvent,
+ &StorageTmp->mteTriggerBooleanEventLen);
+ if (StorageTmp->mteTriggerBooleanEvent == NULL) {
+ config_perror("invalid specification for mteTriggerBooleanEvent");
+ return;
+ }
+
+ /*
+ * threshold table
+ */
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->mteTriggerThresholdStartup,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->mteTriggerThresholdRising,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->mteTriggerThresholdFalling,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->mteTriggerThresholdDeltaRising,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->mteTriggerThresholdDeltaFalling,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerThresholdObjectsOwner,
+ &StorageTmp->
+ mteTriggerThresholdObjectsOwnerLen);
+ if (StorageTmp->mteTriggerThresholdObjectsOwner == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerThresholdObjectsOwner");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerThresholdObjects,
+ &StorageTmp->mteTriggerThresholdObjectsLen);
+ if (StorageTmp->mteTriggerThresholdObjects == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerThresholdObjects");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->
+ mteTriggerThresholdRisingEventOwner,
+ &StorageTmp->
+ mteTriggerThresholdRisingEventOwnerLen);
+ if (StorageTmp->mteTriggerThresholdRisingEventOwner == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerThresholdRisingEventOwner");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerThresholdRisingEvent,
+ &StorageTmp->
+ mteTriggerThresholdRisingEventLen);
+ if (StorageTmp->mteTriggerThresholdRisingEvent == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerThresholdRisingEvent");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->
+ mteTriggerThresholdFallingEventOwner,
+ &StorageTmp->
+ mteTriggerThresholdFallingEventOwnerLen);
+ if (StorageTmp->mteTriggerThresholdFallingEventOwner == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerThresholdFallingEventOwner");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->mteTriggerThresholdFallingEvent,
+ &StorageTmp->
+ mteTriggerThresholdFallingEventLen);
+ if (StorageTmp->mteTriggerThresholdFallingEvent == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerThresholdFallingEvent");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->
+ mteTriggerThresholdDeltaRisingEventOwner,
+ &StorageTmp->
+ mteTriggerThresholdDeltaRisingEventOwnerLen);
+ if (StorageTmp->mteTriggerThresholdDeltaRisingEventOwner == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerThresholdDeltaRisingEventOwner");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->
+ mteTriggerThresholdDeltaRisingEvent,
+ &StorageTmp->
+ mteTriggerThresholdDeltaRisingEventLen);
+ if (StorageTmp->mteTriggerThresholdDeltaRisingEvent == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerThresholdDeltaRisingEvent");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->
+ mteTriggerThresholdDeltaFallingEventOwner,
+ &StorageTmp->
+ mteTriggerThresholdDeltaFallingEventOwnerLen);
+ if (StorageTmp->mteTriggerThresholdDeltaFallingEventOwner == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerThresholdDeltaFallingEventOwner");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->
+ mteTriggerThresholdDeltaFallingEvent,
+ &StorageTmp->
+ mteTriggerThresholdDeltaFallingEventLen);
+ if (StorageTmp->mteTriggerThresholdDeltaFallingEvent == NULL) {
+ config_perror
+ ("invalid specification for mteTriggerThresholdDeltaFallingEvent");
+ return;
+ }
+
+ /*
+ * local internal variables
+ */
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->have_copied_auth_info, &tmpint);
+ if (StorageTmp->have_copied_auth_info) {
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pdu_version, &tmpint);
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pdu_securityModel, &tmpint);
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pdu_securityLevel, &tmpint);
+ line =
+ read_config_read_data(ASN_OBJECT_ID, line, &tmpoid, &tmpint);
+ if (!netsnmp_tdomain_support
+ (tmpoid, tmpint, &StorageTmp->pdu_tDomain,
+ &StorageTmp->pdu_tDomainLen)) {
+ config_perror
+ ("unsupported transport domain for mteTriggerEntry");
+ return;
+ }
+ if (tmpoid != NULL) {
+ free(tmpoid);
+ }
+
+ /*
+ * can be NULL? Yes.
+ */
+ line = read_config_read_data(ASN_OCTET_STR, line,
+ &(StorageTmp->pdu_transport),
+ &StorageTmp->pdu_transportLen);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pdu_community,
+ &StorageTmp->pdu_community_len);
+ if (StorageTmp->pdu_community == NULL) {
+ config_perror("invalid specification for pdu_community");
+ return;
+ }
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pdu_securityName,
+ &StorageTmp->pdu_securityNameLen);
+ if (StorageTmp->pdu_securityName == NULL) {
+ config_perror("invalid specification for pdu_securityName");
+ return;
+ }
+ }
+ StorageTmp->storageType = ST_NONVOLATILE; /* the only type stored */
+
+ mteTriggerTable_add(StorageTmp);
+
+ /*
+ * technically this is too early
+ */
+ if (StorageTmp->mteTriggerEnabled == MTETRIGGERENABLED_TRUE &&
+ StorageTmp->mteTriggerEntryStatus == RS_ACTIVE)
+ mte_enable_trigger(StorageTmp);
+
+ DEBUGMSGTL(("mteTriggerTable", "done.\n"));
+}
+
+
+
+
+/*
+ * store_mteTriggerTable():
+ * stores .conf file entries needed to configure the mib.
+ */
+int
+store_mteTriggerTable(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr;
+ size_t tmpint;
+ struct mteTriggerTable_data *StorageTmp;
+ struct header_complex_index *hcindex;
+
+ DEBUGMSGTL(("mteTriggerTable", "storing data... "));
+
+ for (hcindex = mteTriggerTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ StorageTmp = (struct mteTriggerTable_data *) hcindex->data;
+
+
+ if (StorageTmp->storageType == ST_NONVOLATILE) {
+
+ memset(line, 0, sizeof(line));
+ strcat(line, "mteTriggerTable ");
+ cptr = line + strlen(line);
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->mteOwner,
+ &StorageTmp->mteOwnerLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->mteTriggerName,
+ &StorageTmp->mteTriggerNameLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->mteTriggerComment,
+ &StorageTmp->mteTriggerCommentLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->mteTriggerTest,
+ &StorageTmp->mteTriggerTestLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->mteTriggerSampleType,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OBJECT_ID, cptr,
+ &StorageTmp->mteTriggerValueID,
+ &StorageTmp->mteTriggerValueIDLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ mteTriggerValueIDWildcard, &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->mteTriggerTargetTag,
+ &StorageTmp->
+ mteTriggerTargetTagLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->mteTriggerContextName,
+ &StorageTmp->
+ mteTriggerContextNameLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ mteTriggerContextNameWildcard,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->mteTriggerFrequency,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->mteTriggerObjectsOwner,
+ &StorageTmp->
+ mteTriggerObjectsOwnerLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->mteTriggerObjects,
+ &StorageTmp->mteTriggerObjectsLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->mteTriggerEnabled,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->mteTriggerEntryStatus,
+ &tmpint);
+
+ /*
+ * delta table
+ */
+ cptr =
+ read_config_store_data(ASN_OBJECT_ID, cptr,
+ &StorageTmp->
+ mteTriggerDeltaDiscontinuityID,
+ &StorageTmp->
+ mteTriggerDeltaDiscontinuityIDLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ mteTriggerDeltaDiscontinuityIDWildcard,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ mteTriggerDeltaDiscontinuityIDType,
+ &tmpint);
+
+ /*
+ * existence table
+ */
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerExistenceTest,
+ &StorageTmp->
+ mteTriggerExistenceTestLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerExistenceStartup,
+ &StorageTmp->
+ mteTriggerExistenceStartupLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerExistenceObjectsOwner,
+ &StorageTmp->
+ mteTriggerExistenceObjectsOwnerLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerExistenceObjects,
+ &StorageTmp->
+ mteTriggerExistenceObjectsLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerExistenceEventOwner,
+ &StorageTmp->
+ mteTriggerExistenceEventOwnerLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerExistenceEvent,
+ &StorageTmp->
+ mteTriggerExistenceEventLen);
+
+ /*
+ * boolean table
+ */
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ mteTriggerBooleanComparison,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->mteTriggerBooleanValue,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ mteTriggerBooleanStartup, &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerBooleanObjectsOwner,
+ &StorageTmp->
+ mteTriggerBooleanObjectsOwnerLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerBooleanObjects,
+ &StorageTmp->
+ mteTriggerBooleanObjectsLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerBooleanEventOwner,
+ &StorageTmp->
+ mteTriggerBooleanEventOwnerLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->mteTriggerBooleanEvent,
+ &StorageTmp->
+ mteTriggerBooleanEventLen);
+
+ /*
+ * threshold table
+ */
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ mteTriggerThresholdStartup,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ mteTriggerThresholdRising, &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ mteTriggerThresholdFalling,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ mteTriggerThresholdDeltaRising,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ mteTriggerThresholdDeltaFalling,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerThresholdObjectsOwner,
+ &StorageTmp->
+ mteTriggerThresholdObjectsOwnerLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerThresholdObjects,
+ &StorageTmp->
+ mteTriggerThresholdObjectsLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerThresholdRisingEventOwner,
+ &StorageTmp->
+ mteTriggerThresholdRisingEventOwnerLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerThresholdRisingEvent,
+ &StorageTmp->
+ mteTriggerThresholdRisingEventLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerThresholdFallingEventOwner,
+ &StorageTmp->
+ mteTriggerThresholdFallingEventOwnerLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerThresholdFallingEvent,
+ &StorageTmp->
+ mteTriggerThresholdFallingEventLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerThresholdDeltaRisingEventOwner,
+ &StorageTmp->
+ mteTriggerThresholdDeltaRisingEventOwnerLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerThresholdDeltaRisingEvent,
+ &StorageTmp->
+ mteTriggerThresholdDeltaRisingEventLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerThresholdDeltaFallingEventOwner,
+ &StorageTmp->
+ mteTriggerThresholdDeltaFallingEventOwnerLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ mteTriggerThresholdDeltaFallingEvent,
+ &StorageTmp->
+ mteTriggerThresholdDeltaFallingEventLen);
+
+ /*
+ * local internal variables
+ */
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->have_copied_auth_info,
+ &tmpint);
+ if (StorageTmp->have_copied_auth_info) {
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->pdu_version,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->pdu_securityModel,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->pdu_securityLevel,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OBJECT_ID, cptr,
+ (void *)(&StorageTmp->pdu_tDomain),
+ &StorageTmp->pdu_tDomainLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pdu_transport,
+ &StorageTmp->pdu_transportLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pdu_community,
+ &StorageTmp->pdu_community_len);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pdu_securityName,
+ &StorageTmp->
+ pdu_securityNameLen);
+ }
+
+ snmpd_store_config(line);
+ }
+ }
+ DEBUGMSGTL(("mteTriggerTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+
+
+/*
+ * var_mteTriggerTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_mteTriggerTable above.
+ */
+unsigned char *
+var_mteTriggerTable(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+
+ struct mteTriggerTable_data *StorageTmp = NULL;
+
+
+ DEBUGMSGTL(("mteTriggerTable",
+ "var_mteTriggerTable: Entering... \n"));
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, vp, name, length, exact,
+ var_len, write_method)) == NULL) {
+ if (vp->magic == MTETRIGGERENTRYSTATUS)
+ *write_method = write_mteTriggerEntryStatus;
+ return NULL;
+ }
+
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+
+
+ case MTETRIGGERCOMMENT:
+ *write_method = write_mteTriggerComment;
+ *var_len = StorageTmp->mteTriggerCommentLen;
+ return (u_char *) StorageTmp->mteTriggerComment;
+
+ case MTETRIGGERTEST:
+ *write_method = write_mteTriggerTest;
+ *var_len = StorageTmp->mteTriggerTestLen;
+ return (u_char *) StorageTmp->mteTriggerTest;
+
+ case MTETRIGGERSAMPLETYPE:
+ *write_method = write_mteTriggerSampleType;
+ *var_len = sizeof(StorageTmp->mteTriggerSampleType);
+ return (u_char *) & StorageTmp->mteTriggerSampleType;
+
+ case MTETRIGGERVALUEID:
+ *write_method = write_mteTriggerValueID;
+ *var_len = StorageTmp->mteTriggerValueIDLen * sizeof(oid);
+ return (u_char *) StorageTmp->mteTriggerValueID;
+
+ case MTETRIGGERVALUEIDWILDCARD:
+ *write_method = write_mteTriggerValueIDWildcard;
+ *var_len = sizeof(StorageTmp->mteTriggerValueIDWildcard);
+ return (u_char *) & StorageTmp->mteTriggerValueIDWildcard;
+
+ case MTETRIGGERTARGETTAG:
+ *write_method = write_mteTriggerTargetTag;
+ *var_len = StorageTmp->mteTriggerTargetTagLen;
+ return (u_char *) StorageTmp->mteTriggerTargetTag;
+
+ case MTETRIGGERCONTEXTNAME:
+ *write_method = write_mteTriggerContextName;
+ *var_len = StorageTmp->mteTriggerContextNameLen;
+ return (u_char *) StorageTmp->mteTriggerContextName;
+
+ case MTETRIGGERCONTEXTNAMEWILDCARD:
+ *write_method = write_mteTriggerContextNameWildcard;
+ *var_len = sizeof(StorageTmp->mteTriggerContextNameWildcard);
+ return (u_char *) & StorageTmp->mteTriggerContextNameWildcard;
+
+ case MTETRIGGERFREQUENCY:
+ *write_method = write_mteTriggerFrequency;
+ *var_len = sizeof(StorageTmp->mteTriggerFrequency);
+ return (u_char *) & StorageTmp->mteTriggerFrequency;
+
+ case MTETRIGGEROBJECTSOWNER:
+ *write_method = write_mteTriggerObjectsOwner;
+ *var_len = StorageTmp->mteTriggerObjectsOwnerLen;
+ return (u_char *) StorageTmp->mteTriggerObjectsOwner;
+
+ case MTETRIGGEROBJECTS:
+ *write_method = write_mteTriggerObjects;
+ *var_len = StorageTmp->mteTriggerObjectsLen;
+ return (u_char *) StorageTmp->mteTriggerObjects;
+
+ case MTETRIGGERENABLED:
+ *write_method = write_mteTriggerEnabled;
+ *var_len = sizeof(StorageTmp->mteTriggerEnabled);
+ return (u_char *) & StorageTmp->mteTriggerEnabled;
+
+ case MTETRIGGERENTRYSTATUS:
+ *write_method = write_mteTriggerEntryStatus;
+ *var_len = sizeof(StorageTmp->mteTriggerEntryStatus);
+ return (u_char *) & StorageTmp->mteTriggerEntryStatus;
+
+
+ default:
+ ERROR_MSG("");
+ }
+ return NULL;
+}
+
+
+
+
+int
+write_mteTriggerComment(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("mteTriggerTable",
+ "write_mteTriggerComment entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to mteTriggerComment not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerComment;
+ tmplen = StorageTmp->mteTriggerCommentLen;
+ memdup((u_char **) & StorageTmp->mteTriggerComment, var_val,
+ var_val_len);
+ StorageTmp->mteTriggerCommentLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerComment);
+ StorageTmp->mteTriggerComment = tmpvar;
+ StorageTmp->mteTriggerCommentLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerTest(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("mteTriggerTable",
+ "write_mteTriggerTest entering action=%d... \n", action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR, "write to mteTriggerTest not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerTest;
+ tmplen = StorageTmp->mteTriggerTestLen;
+ memdup((u_char **) & StorageTmp->mteTriggerTest, var_val,
+ var_val_len);
+ StorageTmp->mteTriggerTestLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerTest);
+ StorageTmp->mteTriggerTest = tmpvar;
+ StorageTmp->mteTriggerTestLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerSampleType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("mteTriggerTable",
+ "write_mteTriggerSampleType entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to mteTriggerSampleType not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerSampleType;
+ StorageTmp->mteTriggerSampleType = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->mteTriggerSampleType = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerValueID(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static oid *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("mteTriggerTable",
+ "write_mteTriggerValueID entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OBJECT_ID) {
+ snmp_log(LOG_ERR,
+ "write to mteTriggerValueID not ASN_OBJECT_ID\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerValueID;
+ tmplen = StorageTmp->mteTriggerValueIDLen;
+ memdup((u_char **) & StorageTmp->mteTriggerValueID, var_val,
+ var_val_len);
+ StorageTmp->mteTriggerValueIDLen = var_val_len / sizeof(oid);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerValueID);
+ StorageTmp->mteTriggerValueID = tmpvar;
+ StorageTmp->mteTriggerValueIDLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ /*
+ * XXX: if the valueID has actually changed, shouldn't we dump any
+ * previous values, as these are from a different object?
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerValueIDWildcard(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("mteTriggerTable",
+ "write_mteTriggerValueIDWildcard entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to mteTriggerValueIDWildcard not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerValueIDWildcard;
+ StorageTmp->mteTriggerValueIDWildcard = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->mteTriggerValueIDWildcard = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerTargetTag(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("mteTriggerTable",
+ "write_mteTriggerTargetTag entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to mteTriggerTargetTag not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerTargetTag;
+ tmplen = StorageTmp->mteTriggerTargetTagLen;
+ memdup((u_char **) & StorageTmp->mteTriggerTargetTag, var_val,
+ var_val_len);
+ StorageTmp->mteTriggerTargetTagLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerTargetTag);
+ StorageTmp->mteTriggerTargetTag = tmpvar;
+ StorageTmp->mteTriggerTargetTagLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerContextName(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("mteTriggerTable",
+ "write_mteTriggerContextName entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to mteTriggerContextName not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerContextName;
+ tmplen = StorageTmp->mteTriggerContextNameLen;
+ memdup((u_char **) & StorageTmp->mteTriggerContextName, var_val,
+ var_val_len);
+ StorageTmp->mteTriggerContextNameLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerContextName);
+ StorageTmp->mteTriggerContextName = tmpvar;
+ StorageTmp->mteTriggerContextNameLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerContextNameWildcard(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("mteTriggerTable",
+ "write_mteTriggerContextNameWildcard entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to mteTriggerContextNameWildcard not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerContextNameWildcard;
+ StorageTmp->mteTriggerContextNameWildcard = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->mteTriggerContextNameWildcard = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerFrequency(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("mteTriggerTable",
+ "write_mteTriggerFrequency entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to mteTriggerFrequency not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in ulong_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerFrequency;
+ StorageTmp->mteTriggerFrequency = *((unsigned long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->mteTriggerFrequency = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ if (StorageTmp->mteTriggerEnabled == MTETRIGGERENABLED_TRUE &&
+ StorageTmp->mteTriggerEntryStatus == RS_ACTIVE)
+ mte_enable_trigger(StorageTmp);
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerObjectsOwner(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("mteTriggerTable",
+ "write_mteTriggerObjectsOwner entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to mteTriggerObjectsOwner not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerObjectsOwner;
+ tmplen = StorageTmp->mteTriggerObjectsOwnerLen;
+ memdup((u_char **) & StorageTmp->mteTriggerObjectsOwner, var_val,
+ var_val_len);
+ StorageTmp->mteTriggerObjectsOwnerLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerObjectsOwner);
+ StorageTmp->mteTriggerObjectsOwner = tmpvar;
+ StorageTmp->mteTriggerObjectsOwnerLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerObjects(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("mteTriggerTable",
+ "write_mteTriggerObjects entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to mteTriggerObjects not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerObjects;
+ tmplen = StorageTmp->mteTriggerObjectsLen;
+ memdup((u_char **) & StorageTmp->mteTriggerObjects, var_val,
+ var_val_len);
+ StorageTmp->mteTriggerObjectsLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerObjects);
+ StorageTmp->mteTriggerObjects = tmpvar;
+ StorageTmp->mteTriggerObjectsLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerEnabled(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("mteTriggerTable",
+ "write_mteTriggerEnabled entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to mteTriggerEnabled not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerEnabled;
+ StorageTmp->mteTriggerEnabled = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->mteTriggerEnabled = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ if (StorageTmp->mteTriggerEnabled == MTETRIGGERENABLED_TRUE &&
+ StorageTmp->mteTriggerEntryStatus == RS_ACTIVE)
+ mte_enable_trigger(StorageTmp);
+ else if (StorageTmp->mteTriggerEnabled == MTETRIGGERENABLED_FALSE)
+ mte_disable_trigger(StorageTmp);
+
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+
+
+int
+write_mteTriggerEntryStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static struct mteTriggerTable_data *StorageNew, *StorageDel;
+ size_t newlen =
+ name_len - (sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+ static int old_value;
+ int set_value;
+ static netsnmp_variable_list *vars, *vp;
+ struct header_complex_index *hciptr;
+
+ StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof(mteTriggerTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL);
+
+
+
+
+ if (var_val_type != ASN_INTEGER || var_val == NULL) {
+ snmp_log(LOG_ERR,
+ "write to mteTriggerEntryStatus not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ set_value = *((long *) var_val);
+
+
+ /*
+ * check legal range, and notReady is reserved for us, not a user
+ */
+ if (set_value < 1 || set_value > 6 || set_value == RS_NOTREADY)
+ return SNMP_ERR_INCONSISTENTVALUE;
+
+
+ switch (action) {
+ case RESERVE1:
+ /*
+ * stage one: test validity
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * create the row now?
+ */
+
+
+ /*
+ * ditch illegal values now
+ */
+ if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE)
+ return SNMP_ERR_INCONSISTENTVALUE;
+
+
+ /*
+ * destroying a non-existent row is actually legal
+ */
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+
+
+ /*
+ * illegal creation values
+ */
+ if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else {
+ /*
+ * row exists. Check for a valid state change
+ */
+ if (set_value == RS_CREATEANDGO
+ || set_value == RS_CREATEANDWAIT) {
+ /*
+ * can't create a row that exists
+ */
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ if (StorageTmp->mteTriggerEntryStatus == RS_ACTIVE &&
+ set_value != RS_DESTROY) {
+ /*
+ * "Once made active an entry may not be modified except to
+ * delete it." XXX: doesn't this in fact apply to ALL
+ * columns of the table and not just this one?
+ */
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ break;
+
+
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * creation
+ */
+ vars = NULL;
+
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0); /* mteOwner */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR, NULL, 0); /* mteTriggerName */
+
+
+
+ if (header_complex_parse_oid
+ (&
+ (name
+ [sizeof(mteTriggerTable_variables_oid) / sizeof(oid) +
+ 2]), newlen, vars) != SNMPERR_SUCCESS) {
+ /*
+ * XXX: free, zero vars
+ */
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+ vp = vars;
+
+
+ StorageNew = create_mteTriggerTable_data();
+
+ StorageNew->mteOwner = malloc(vp->val_len + 1);
+ memcpy(StorageNew->mteOwner, vp->val.string, vp->val_len);
+ StorageNew->mteOwner[vp->val_len] = '\0';
+ StorageNew->mteOwnerLen = vp->val_len;
+
+ vp = vp->next_variable;
+ StorageNew->mteTriggerName = malloc(vp->val_len + 1);
+ memcpy(StorageNew->mteTriggerName, vp->val.string,
+ vp->val_len);
+ StorageNew->mteTriggerName[vp->val_len] = '\0';
+ StorageNew->mteTriggerNameLen = vp->val_len;
+
+ vp = vp->next_variable;
+
+ StorageNew->mteTriggerEntryStatus = set_value;
+
+ }
+
+
+ break;
+
+
+
+
+ case FREE:
+ /*
+ * XXX: free, zero vars
+ */
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in set_value for you to
+ * use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in
+ * the UNDO case
+ */
+
+
+ if (StorageTmp == NULL) {
+ /*
+ * row creation, so add it
+ */
+ if (StorageNew != NULL)
+ mteTriggerTable_add(StorageNew);
+ /*
+ * XXX: ack, and if it is NULL?
+ */
+ } else if (set_value != RS_DESTROY) {
+ /*
+ * set the flag?
+ */
+ old_value = StorageTmp->mteTriggerEntryStatus;
+ StorageTmp->mteTriggerEntryStatus = *((long *) var_val);
+ } else {
+ /*
+ * destroy... extract it for now
+ */
+ hciptr =
+ header_complex_find_entry(mteTriggerTableStorage,
+ StorageTmp);
+ StorageDel =
+ header_complex_extract_entry(&mteTriggerTableStorage,
+ hciptr);
+ }
+ break;
+
+
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * row creation, so remove it again
+ */
+ hciptr =
+ header_complex_find_entry(mteTriggerTableStorage,
+ StorageTmp);
+ StorageDel =
+ header_complex_extract_entry(&mteTriggerTableStorage,
+ hciptr);
+ /*
+ * XXX: free it
+ */
+ } else if (StorageDel != NULL) {
+ /*
+ * row deletion, so add it again
+ */
+ mteTriggerTable_add(StorageDel);
+ } else {
+ StorageTmp->mteTriggerEntryStatus = old_value;
+ }
+ break;
+
+
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ if (StorageDel != NULL) {
+ mte_disable_trigger(StorageDel);
+ StorageDel = 0;
+ /*
+ * XXX: free it, its dead
+ */
+ } else {
+ if (StorageTmp
+ && StorageTmp->mteTriggerEntryStatus == RS_CREATEANDGO) {
+ StorageTmp->mteTriggerEntryStatus = RS_ACTIVE;
+ } else if (StorageTmp &&
+ StorageTmp->mteTriggerEntryStatus ==
+ RS_CREATEANDWAIT) {
+ StorageTmp->mteTriggerEntryStatus = RS_NOTINSERVICE;
+ }
+ }
+ if (StorageTmp &&
+ StorageTmp->mteTriggerEntryStatus == RS_ACTIVE &&
+ !StorageTmp->have_copied_auth_info) {
+
+ netsnmp_agent_session *asp =
+ netsnmp_get_current_agent_session();
+ netsnmp_pdu *pdu = NULL;
+
+ if (!asp) {
+ snmp_log(LOG_ERR,
+ "snmpTriggerTable: can't get master session for authentication params\n");
+ } else {
+ pdu = asp->orig_pdu;
+ if (!pdu) {
+ snmp_log(LOG_ERR,
+ "snmpTriggerTable: can't get master pdu for authentication params\n");
+ }
+ }
+
+ if (pdu) {
+ DEBUGMSGTL(("mteTriggerTest", "copying PDU auth info\n"));
+ StorageTmp->pdu_version = pdu->version;
+ StorageTmp->pdu_securityModel = pdu->securityModel;
+ StorageTmp->pdu_securityLevel = pdu->securityLevel;
+ StorageTmp->pdu_tDomain = pdu->tDomain;
+ StorageTmp->pdu_tDomainLen = pdu->tDomainLen;
+ if (pdu->transport_data != NULL) {
+ StorageTmp->pdu_transport =
+ malloc(pdu->transport_data_length);
+ memcpy(StorageTmp->pdu_transport, pdu->transport_data,
+ pdu->transport_data_length);
+ }
+ StorageTmp->pdu_transportLen = pdu->transport_data_length;
+ if (pdu->community) {
+ StorageTmp->pdu_community =
+ calloc(1, pdu->community_len + 1);
+ memcpy(StorageTmp->pdu_community, pdu->community,
+ pdu->community_len);
+ StorageTmp->pdu_community_len = pdu->community_len;
+ } else {
+ StorageTmp->pdu_community = NULL;
+ StorageTmp->pdu_community_len = 0;
+ }
+ if (pdu->securityName) {
+ StorageTmp->pdu_securityName =
+ calloc(1, pdu->securityNameLen + 1);
+ memcpy(StorageTmp->pdu_securityName, pdu->securityName,
+ pdu->securityNameLen);
+ StorageTmp->pdu_securityNameLen = pdu->securityNameLen;
+ } else {
+ StorageTmp->pdu_securityName = NULL;
+ StorageTmp->pdu_securityNameLen = 0;
+ }
+ StorageTmp->have_copied_auth_info = 1;
+ }
+ }
+
+ if (StorageTmp &&
+ StorageTmp->mteTriggerEnabled == MTETRIGGERENABLED_TRUE &&
+ StorageTmp->mteTriggerEntryStatus == RS_ACTIVE)
+ mte_enable_trigger(StorageTmp);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+/*
+ * send trap
+ */
+void
+send_mte_trap(struct mteTriggerTable_data *item,
+ oid * trap_oid, size_t trap_oid_len,
+ oid * name_oid, size_t name_oid_len,
+ long *value, const char *objowner, const char *objname,
+ const char *reason)
+{
+ static oid objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 }; /* snmpTrapIOD.0 */
+
+ netsnmp_variable_list *var_list = NULL;
+
+ /*
+ * snmpTrap oid
+ */
+ snmp_varlist_add_variable(&var_list, objid_snmptrap,
+ sizeof(objid_snmptrap) / sizeof(oid),
+ ASN_OBJECT_ID, (u_char *) trap_oid,
+ trap_oid_len * sizeof(oid));
+
+ /*
+ * mteHotTrigger
+ */
+ snmp_varlist_add_variable(&var_list, mteHotTrigger,
+ sizeof(mteHotTrigger) / sizeof(oid),
+ ASN_OCTET_STR,
+ (u_char *) item->mteTriggerName,
+ item->mteTriggerNameLen);
+
+ /*
+ * mteHotTargetName
+ */
+ snmp_varlist_add_variable(&var_list, mteHotTargetName, sizeof(mteHotTargetName) / sizeof(oid), ASN_OCTET_STR, (u_char *) item->mteTriggerTargetTag, /*XXX: targetName,not tag */
+ item->mteTriggerTargetTagLen); /*XXX */
+
+ /*
+ * mteHotContextName
+ */
+ snmp_varlist_add_variable(&var_list, mteHotContextName,
+ sizeof(mteHotContextName) / sizeof(oid),
+ ASN_OCTET_STR,
+ (u_char *) item->mteTriggerContextName,
+ item->mteTriggerContextNameLen);
+
+ snmp_varlist_add_variable(&var_list, mteHotOID,
+ sizeof(mteHotOID) / sizeof(oid),
+ ASN_OBJECT_ID, (u_char *) name_oid,
+ sizeof(oid) * name_oid_len);
+
+ if (trap_oid == mteTriggerFailure || trap_oid == mteEventSetFailure) {
+ /*
+ * mteFailedReason
+ */
+ snmp_varlist_add_variable(&var_list, mteFailedReason,
+ sizeof(mteFailedReason) / sizeof(oid),
+ ASN_INTEGER, (u_char *) value,
+ sizeof(value));
+ } else {
+ /*
+ * mteHotValue
+ */
+ snmp_varlist_add_variable(&var_list, mteHotValue,
+ sizeof(mteHotValue) / sizeof(oid),
+ ASN_INTEGER, (u_char *) value,
+ sizeof(value));
+ }
+
+ /*
+ * add in traps from main table
+ */
+ mte_add_objects(var_list, item, item->mteTriggerObjectsOwner,
+ item->mteTriggerObjects,
+ name_oid + item->mteTriggerValueIDLen,
+ name_oid_len - item->mteTriggerValueIDLen);
+ /*
+ * add in traps from sub table
+ */
+ mte_add_objects(var_list, item, objowner, objname,
+ name_oid + item->mteTriggerValueIDLen,
+ name_oid_len - item->mteTriggerValueIDLen);
+
+ /*
+ * XXX: stuff based on event table
+ */
+ DEBUGMSGTL(("mteTriggerTest:send_mte_trap", "sending the trap (%s): ",
+ reason));
+ DEBUGMSGOID(("mteTriggerTest:send_mte_trap", name_oid, name_oid_len));
+ DEBUGMSG(("mteTriggerTest:send_mte_trap", " = %ld\n", *value));
+
+ send_v2trap(var_list);
+ snmp_free_varbind(var_list);
+}
+
+void
+last_state_clean(void *data)
+{
+ struct last_state *cleanme = (struct last_state *) data;
+ SNMP_FREE(cleanme->value);
+ SNMP_FREE(cleanme);
+}
+
+/*
+ * retrieves requested info in pdu from the current target
+ */
+netsnmp_pdu *
+mte_get_response(struct mteTriggerTable_data *item, netsnmp_pdu *pdu)
+{
+ netsnmp_pdu *response = NULL;
+ int status = 0;
+ char buf[SPRINT_MAX_LEN];
+
+ /*
+ * local agent check
+ */
+ pdu->errstat = SNMPERR_SUCCESS;
+ pdu->errindex = 0;
+ pdu->version = item->pdu_version;
+ pdu->securityModel = item->pdu_securityModel;
+ pdu->securityLevel = item->pdu_securityLevel;
+ pdu->tDomain = item->pdu_tDomain;
+ pdu->tDomainLen = item->pdu_tDomainLen;
+ memdup((u_char **) & pdu->transport_data, item->pdu_transport,
+ item->pdu_transportLen);
+ pdu->transport_data_length = item->pdu_transportLen;
+ memdup(&pdu->community, item->pdu_community, item->pdu_community_len);
+ pdu->community_len = item->pdu_community_len;
+ memdup((u_char **) & pdu->contextName, item->mteTriggerContextName,
+ item->mteTriggerContextNameLen);
+ pdu->contextNameLen = item->mteTriggerContextNameLen;
+ memdup((u_char **) & pdu->securityName, item->pdu_securityName,
+ item->pdu_securityNameLen);
+ pdu->securityNameLen = item->pdu_securityNameLen;
+ DEBUGMSGTL(("mteTriggerTable",
+ "accessing locally with secName \"%s\" community \"%s\"\n",
+ item->pdu_securityName ? (char *) item->
+ pdu_securityName : "[NIL]",
+ item->pdu_community ? (char *) item->
+ pdu_community : "[NIL]"));
+
+ if (item->mteTriggerTargetTagLen == 0) {
+ /*
+ * send to the local agent
+ */
+
+ status = snmp_synch_response(mte_callback_sess, pdu, &response);
+
+ if (status != SNMP_ERR_NOERROR ||
+ response->errstat != SNMP_ERR_NOERROR) {
+ /*
+ * xxx
+ */
+ char *errstr;
+ snmp_error(mte_callback_sess, 0, 0, &errstr);
+ if (response) {
+ DEBUGMSGTL(("mteTriggerTable",
+ "Error received: status=%d, sess_error=%s, pduerr=%d/%s, pdu version=%d\n",
+ status, errstr,
+ response->errstat,
+ snmp_api_errstring(response->errstat),
+ response->version));
+ } else {
+ DEBUGMSGTL(("mteTriggerTable",
+ "Error received: status=%d, sess_error=%s [no response pointer]\n",
+ status, errstr));
+ }
+ if (errstr)
+ free(errstr);
+ return NULL; /* XXX: proper failure, trap sent, etc */
+ }
+ } else {
+ /*
+ * remote target list
+ */
+ /*
+ * XXX
+ */
+ }
+ if (response->variables)
+ snprint_variable(buf, sizeof(buf), response->variables->name,
+ response->variables->name_length,
+ response->variables);
+ else
+ strcpy(buf, "empty");
+ buf[sizeof(buf) - 1] = '\0';
+ DEBUGMSGTL(("mteTriggerTable", "got a variables: %s\n", buf));
+ return response;
+}
+
+
+/*
+ * Return 1 if `type' is an integer type; specifically, to quote RFC 2981,
+ * p. 13, "anything that ends up encoded for transmission (that is, in BER,
+ * not ASN.1) as an integer". Return 0 for all other types.
+ */
+
+int
+mte_is_integer_type(unsigned char type)
+{
+ switch (type) {
+ case ASN_INTEGER:
+ case ASN_COUNTER:
+ case ASN_GAUGE:
+ case ASN_TIMETICKS:
+ case ASN_UINTEGER:
+ case ASN_COUNTER64:
+#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
+ case ASN_OPAQUE_COUNTER64:
+ case ASN_OPAQUE_U64:
+ case ASN_OPAQUE_I64:
+#endif /* NETSNMP_WITH_OPAQUE_SPECIAL_TYPES */
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+
+
+/*
+ * Return 0 if the discontinuity object was checked and no discontinuity has
+ * occurred, 1 if the discontinuity object was checked and a discontinuity
+ * has occurred or -1 if the discontinuity object is not accessible.
+ */
+
+int
+mte_discontinuity_occurred(struct mteTriggerTable_data *item)
+{
+ netsnmp_pdu *pdu = NULL, *response = NULL;
+ unsigned long discoTicks = 0; /* cool var name */
+
+ if (item->mteTriggerDeltaDiscontinuityIDLen == 0 ||
+ (snmp_oid_compare(item->mteTriggerDeltaDiscontinuityID,
+ item->mteTriggerDeltaDiscontinuityIDLen,
+ sysUpTimeInstance,
+ sizeof(sysUpTimeInstance) / sizeof(oid)) == 0)) {
+ DEBUGMSGTL(("mte_disco",
+ "discoID either zero-length or sysUpTimeInstance\n"));
+ } else {
+ if (item->mteTriggerValueIDWildcard == TV_TRUE) {
+ pdu = snmp_pdu_create(SNMP_MSG_GETNEXT);
+ } else {
+ pdu = snmp_pdu_create(SNMP_MSG_GET);
+ }
+ snmp_add_null_var(pdu, item->mteTriggerDeltaDiscontinuityID,
+ item->mteTriggerDeltaDiscontinuityIDLen);
+ response = mte_get_response(item, pdu);
+ if (response == NULL) {
+ /*
+ * XXX: send a mteTriggerFailure notification with the appropriate
+ * error code here.
+ */
+ /*
+ * "If the object identified is not accessible the sample attempt is in
+ * error, with the error code as from an SNMP request."
+ */
+ DEBUGMSGTL(("mte_disco", "failure (auth?) getting discoID\n"));
+ return -1;
+ } else {
+ if (item->mteTriggerDeltaDiscontinuityIDType ==
+ MTETRIGGERDELTADISCONTINUITYIDTYPE_TIMETICKS ||
+ item->mteTriggerDeltaDiscontinuityIDType ==
+ MTETRIGGERDELTADISCONTINUITYIDTYPE_TIMESTAMP) {
+ if (response->errstat == SNMPERR_SUCCESS) {
+ if (response->variables != NULL &&
+ response->variables->type == ASN_TIMETICKS) {
+ DEBUGMSGTL(("mte_disco",
+ "got ASN_TIMETICKS-valued variable\n"));
+ discoTicks =
+ *((unsigned long *) response->variables->val.
+ integer);
+ if (item->prevDiscoTicks != 0) {
+ if (discoTicks != item->prevDiscoTicks) {
+ /*
+ * Danger Will Robinson: there has been a discontinuity!
+ */
+ DEBUGMSGTL(("mte_disco",
+ "a discontinuity has occurred\n"));
+ item->prevDiscoTicks = discoTicks;
+ snmp_free_pdu(response);
+ return 1;
+ }
+ }
+ item->prevDiscoTicks = discoTicks;
+ } else {
+ /*
+ * XXX: send a mteTriggerFailure notification with the
+ * appropriate error code here.
+ */
+ if (response->variables != NULL &&
+ (response->variables->type == SNMP_NOSUCHOBJECT
+ || response->variables->type ==
+ SNMP_NOSUCHINSTANCE
+ || response->variables->type ==
+ SNMP_ENDOFMIBVIEW)) {
+ /*
+ * noSuchName I guess.
+ */
+ } else {
+ /*
+ * badType.
+ */
+ }
+ DEBUGMSGTL(("mte_disco",
+ "failure getting discoID\n"));
+ snmp_free_pdu(response);
+ return -1;
+ }
+ } else {
+ /*
+ * XXX: send a mteTriggerFailure notification with the appropriate
+ * error code (just use response->errstat) here.
+ */
+ DEBUGMSGTL(("mte_disco", "failure getting discoID\n"));
+ snmp_free_pdu(response);
+ return -1;
+ }
+ } else {
+ /*
+ * Don't handle dateAndTime type queries yet.
+ */
+ DEBUGMSGTL(("mte_disco",
+ "dateAndTime query UNIMPLEMENTED\n"));
+ }
+ snmp_free_pdu(response);
+ }
+ }
+
+ /*
+ * "...if this object does not point to sysUpTime discontinuity checking
+ * MUST still check sysUpTime for an overall discontinuity."
+ */
+ if (snmp_oid_compare(item->mteTriggerDeltaDiscontinuityID,
+ item->mteTriggerDeltaDiscontinuityIDLen,
+ sysUpTimeInstance,
+ sizeof(sysUpTimeInstance) / sizeof(oid)) != 0) {
+ DEBUGMSGTL(("mte_disco", "discoID != sysUpTimeInstance\n"));
+ /*
+ * At the moment we only support checking the local system so there's no
+ * point doing anything extra here.
+ */
+ }
+
+ /*
+ * Well if we got all the way to here, then there has been neither a
+ * discontinuity nor an error.
+ */
+ DEBUGMSGTL(("mte_disco", "no discontinuity\n"));
+ return 0;
+}
+
+
+void
+mte_run_trigger(unsigned int clientreg, void *clientarg)
+{
+
+ struct mteTriggerTable_data *item =
+ (struct mteTriggerTable_data *) clientarg;
+ netsnmp_pdu *pdu = NULL, *response = NULL;
+ char buf[SPRINT_MAX_LEN];
+ int msg_type = SNMP_MSG_GET, disco;
+
+ oid *next_oid;
+ size_t next_oid_len;
+ long *value, *old_value, x;
+ struct last_state *laststate;
+ char lastbool = 0, boolresult = 0, lastthresh = 0;
+
+ if (!item) {
+ /*
+ * ack
+ */
+ snmp_alarm_unregister(clientreg);
+ return;
+ }
+ DEBUGMSGTL(("mteTriggertable", "Running trigger for %s/%s\n",
+ item->mteOwner, item->mteTriggerName));
+
+ next_oid = item->mteTriggerValueID;
+ next_oid_len = item->mteTriggerValueIDLen;
+ if (item->mteTriggerValueIDWildcard == TV_TRUE)
+ msg_type = SNMP_MSG_GETNEXT;
+
+ item->hc_storage_old = item->hc_storage;
+ item->hc_storage = NULL;
+ do {
+ pdu = snmp_pdu_create(msg_type);
+ snmp_add_null_var(pdu, next_oid, next_oid_len);
+
+ if(response)
+ snmp_free_pdu(response);
+
+ response = mte_get_response(item, pdu);
+ if (!response)
+ break; /* XXX: proper failure */
+
+ if (item->mteTriggerValueIDWildcard == TV_TRUE &&
+ ((response->variables->type >= SNMP_NOSUCHOBJECT &&
+ response->variables->type <= SNMP_ENDOFMIBVIEW) ||
+ snmp_oid_compare(item->mteTriggerValueID,
+ item->mteTriggerValueIDLen,
+ response->variables->name,
+ item->mteTriggerValueIDLen) != 0)) {
+ DEBUGMSGTL(("mteTriggerTable",
+ "DONE, last varbind processed\n"));
+ break;
+ }
+
+ /*
+ * shorter pointers
+ */
+ next_oid = response->variables->name;
+ next_oid_len = response->variables->name_length;
+
+ /*
+ * Send a "bad type" notification if the type of the target object is
+ * non-INTEGER and the test type is either `boolean' or `threshold'
+ * (which want to do arithmetic).
+ */
+ if (((item->mteTriggerTest[0] & MTETRIGGERTEST_BOOLEAN) ||
+ (item->mteTriggerTest[0] & MTETRIGGERTEST_THRESHOLD)) &&
+ response->errstat == SNMPERR_SUCCESS &&
+ !mte_is_integer_type(response->variables->type)) {
+ long failure = MTE_FAILURE_BADTYPE;
+ send_mte_trap(item, mteTriggerFailure,
+ sizeof(mteTriggerFailure) / sizeof(oid),
+ next_oid, next_oid_len, &failure,
+ NULL, NULL, "failure: bad type");
+ /*
+ * RFC2981, p.15: "If the value syntax of those objects
+ * [returned by a getNext-style match] is not usable, that
+ * results in a `badType' error THAT TERMINATES THE SCAN."
+ * (my emphasis).
+ */
+ break;
+ }
+
+ /*
+ * Clone the value. XXX: What happens if it's an unsigned type? Or a
+ * 64-bit type, or an OCTET STRING for the sake of argument. Do
+ * everything in 64-bit arithmetic perhaps? Generate "bad type"
+ * notifications for non-INTEGER cases (except for existence).
+ */
+ if (response->errstat == SNMPERR_SUCCESS &&
+ response->variables->val.integer)
+ memdup((unsigned char **) &value,
+ (unsigned char *) response->variables->val.integer,
+ sizeof(*response->variables->val.integer));
+ else
+ value = NULL;
+
+ snprint_variable(buf, sizeof(buf),
+ next_oid, next_oid_len, response->variables);
+ buf[sizeof(buf) - 1] = '\0';
+ DEBUGMSGTL(("mteTriggerTable", "received %s (type %d)\n", buf,
+ response->variables->type));
+
+ /*
+ * see if we have old values for this
+ */
+ laststate = header_complex_get_from_oid(item->hc_storage_old,
+ next_oid, next_oid_len);
+ if (laststate) {
+ old_value = laststate->value;
+ lastbool = laststate->lastbool;
+ lastthresh = laststate->lastthreshold;
+ } else {
+ old_value = NULL;
+ lastthresh = MTE_THRESHOLD_BEGIN;
+ }
+
+ /*
+ * deal with existence tests
+ */
+ if (item->mteTriggerTest[0] & MTETRIGGERTEST_EXISTENCE) {
+ if ((item->mteTriggerExistenceTest[0] &
+ MTETRIGGEREXISTENCETEST_PRESENT)
+ && value && !old_value &&
+ (item->started ||
+ (item->mteTriggerExistenceStartup[0] &
+ MTETRIGGEREXISTENCESTARTUP_PRESENT))) {
+ /*
+ * XXX: if mteTriggerExistenceTest is not "present", for
+ * example, and then turned on when has been previously
+ * off, do we respect the value of the last known
+ * existence status?
+ */
+ send_mte_trap(item, mteTriggerFired,
+ sizeof(mteTriggerFired) / sizeof(oid),
+ next_oid, next_oid_len,
+ value, item->mteTriggerExistenceObjectsOwner,
+ item->mteTriggerExistenceObjects,
+ "existence: present");
+ run_mte_events(item, next_oid, next_oid_len,
+ item->mteTriggerExistenceEventOwner,
+ item->mteTriggerExistenceEvent);
+ }
+
+ if ((item->mteTriggerExistenceTest[0] &
+ MTETRIGGEREXISTENCETEST_CHANGED)
+ && value && old_value && *old_value != *value) {
+ /*
+ * XXX: if mteTriggerExistenceTest is not "present", for
+ * example, and then turned on when has been previously
+ * off, do we respect the value of the last known
+ * existence status?
+ */
+ send_mte_trap(item, mteTriggerFired,
+ sizeof(mteTriggerFired) / sizeof(oid),
+ next_oid, next_oid_len,
+ value, item->mteTriggerExistenceObjectsOwner,
+ item->mteTriggerExistenceObjects,
+ "existence: changed");
+ run_mte_events(item, next_oid, next_oid_len,
+ item->mteTriggerExistenceEventOwner,
+ item->mteTriggerExistenceEvent);
+ }
+ }
+
+ /*
+ * Deal with boolean tests.
+ */
+ if ((item->mteTriggerTest[0] & MTETRIGGERTEST_BOOLEAN) &&
+ ((item->mteTriggerSampleType ==
+ MTETRIGGERSAMPLETYPE_ABSOLUTEVALUE && value)
+ || (item->mteTriggerSampleType ==
+ MTETRIGGERSAMPLETYPE_DELTAVALUE && value && old_value))) {
+ if (item->mteTriggerSampleType ==
+ MTETRIGGERSAMPLETYPE_DELTAVALUE) {
+ /*
+ * XXX: Must check the discontinuity OID here.
+ */
+ disco = mte_discontinuity_occurred(item);
+ if (disco == -1) {
+ /*
+ * An error notification has already been sent; just bail
+ * out now.
+ */
+ /*
+ * XXX: should save values here?
+ */
+ return;
+ } else if (disco == 1) {
+ /*
+ * A discontinuity has occurred; the right thing to do here
+ * depends on the exact type. FOR NOW, assume long.
+ */
+ x = *((long *) value) + (INT_MAX -
+ *((long *) old_value));
+ } else {
+ x = *((long *) value) - *((long *) old_value);
+ }
+ } else {
+ x = *((long *) value);
+ }
+
+ switch (item->mteTriggerBooleanComparison) {
+ case MTETRIGGERBOOLEANCOMPARISON_UNEQUAL:
+ boolresult = (x != item->mteTriggerBooleanValue);
+ break;
+
+ case MTETRIGGERBOOLEANCOMPARISON_EQUAL:
+ boolresult = (x == item->mteTriggerBooleanValue);
+ break;
+
+ case MTETRIGGERBOOLEANCOMPARISON_LESS:
+ boolresult = (x < item->mteTriggerBooleanValue);
+ break;
+
+ case MTETRIGGERBOOLEANCOMPARISON_LESSOREQUAL:
+ boolresult = (x <= item->mteTriggerBooleanValue);
+ break;
+
+ case MTETRIGGERBOOLEANCOMPARISON_GREATER:
+ boolresult = (x > item->mteTriggerBooleanValue);
+ break;
+
+ case MTETRIGGERBOOLEANCOMPARISON_GREATEROREQUAL:
+ boolresult = (x >= item->mteTriggerBooleanValue);
+ break;
+
+ default:
+ snmp_log(LOG_WARNING,
+ "illegal value in mteTriggerBooleanComparison object: %ld",
+ item->mteTriggerBooleanComparison);
+ boolresult = item->lastboolresult; /* to fail next test */
+ }
+
+ if (boolresult &&
+ ((item->mteTriggerBooleanStartup ==
+ MTETRIGGERBOOLEANSTARTUP_TRUE
+ && lastbool == (char)-1) || lastbool != boolresult)) {
+ send_mte_trap(item, mteTriggerFired,
+ sizeof(mteTriggerFired) / sizeof(oid),
+ next_oid, next_oid_len,
+ &x, item->mteTriggerBooleanObjectsOwner,
+ item->mteTriggerBooleanObjects,
+ "boolean: true");
+ run_mte_events(item, next_oid, next_oid_len,
+ item->mteTriggerBooleanEventOwner,
+ item->mteTriggerBooleanEvent);
+ }
+
+ DEBUGMSGTL(("mteTriggerTable",
+ "value: %d %ld %lu x: %d %ld %lu\n", *value,
+ *value, *value, x, x, x));
+
+ DEBUGMSGTL(("mteTriggerTable",
+ "boolean result: x=%d %s configured=%d = %d\n",
+ x,
+ se_find_label_in_slist("mteBooleanOperators",
+ item->
+ mteTriggerBooleanComparison),
+ item->mteTriggerBooleanValue, boolresult));
+ }
+
+ /*
+ * Deal with threshold tests. XXX: doesn't handle "delta-type"
+ * sampling.
+ */
+ if ((item->mteTriggerTest[0] & MTETRIGGERTEST_THRESHOLD) &&
+ ((item->mteTriggerSampleType ==
+ MTETRIGGERSAMPLETYPE_ABSOLUTEVALUE && value)
+ || (item->mteTriggerSampleType ==
+ MTETRIGGERSAMPLETYPE_DELTAVALUE && value && old_value))) {
+ /*
+ * XXX: correct intepretation of mteTriggerThresholdStartup?
+ */
+ /*
+ * only fires when passed and just set to active? What
+ * about a newly discovered node that is past a
+ * threshold once we've been active for a turn at least?
+ */
+ /*
+ * XXX: Check notions of > vs >=
+ */
+ if (((item->started == MTE_STARTED && laststate &&
+ lastthresh == MTE_THRESHOLD_LOW) ||
+ (item->started != MTE_STARTED &&
+ (item->mteTriggerThresholdStartup ==
+ MTETRIGGERTHRESHOLDSTARTUP_RISING
+ || item->mteTriggerThresholdStartup ==
+ MTETRIGGERTHRESHOLDSTARTUP_RISINGORFALLING)))
+ && (*value >= item->mteTriggerThresholdRising)) {
+ send_mte_trap(item, mteTriggerRising,
+ sizeof(mteTriggerRising) / sizeof(oid),
+ next_oid, next_oid_len, value,
+ item->mteTriggerThresholdObjectsOwner,
+ item->mteTriggerThresholdObjects,
+ "threshold: rising");
+ run_mte_events(item, next_oid, next_oid_len,
+ item->mteTriggerThresholdRisingEventOwner,
+ item->mteTriggerThresholdRisingEvent);
+ }
+ if (((item->started == MTE_STARTED && laststate &&
+ lastthresh == MTE_THRESHOLD_HIGH) ||
+ (item->started != MTE_STARTED &&
+ (item->mteTriggerThresholdStartup ==
+ MTETRIGGERTHRESHOLDSTARTUP_FALLING
+ || item->mteTriggerThresholdStartup ==
+ MTETRIGGERTHRESHOLDSTARTUP_RISINGORFALLING)))
+ && (*value <= item->mteTriggerThresholdFalling)) {
+ send_mte_trap(item, mteTriggerFalling,
+ sizeof(mteTriggerFalling) / sizeof(oid),
+ next_oid, next_oid_len, value,
+ item->mteTriggerThresholdObjectsOwner,
+ item->mteTriggerThresholdObjects,
+ "threshold: falling");
+ run_mte_events(item, next_oid, next_oid_len,
+ item->mteTriggerThresholdFallingEventOwner,
+ item->mteTriggerThresholdFallingEvent);
+ }
+
+ }
+
+ if (value) {
+ struct last_state *new_last_state =
+ SNMP_MALLOC_STRUCT(last_state);
+ new_last_state->value = value;
+ new_last_state->lastbool = boolresult;
+ header_complex_add_data_by_oid(&item->hc_storage, next_oid,
+ next_oid_len, new_last_state);
+
+ /*
+ * set our notion of the current known threshold state
+ */
+ if (lastthresh == MTE_THRESHOLD_LOW &&
+ *value >= item->mteTriggerThresholdRising &&
+ *value > item->mteTriggerThresholdFalling)
+ new_last_state->lastthreshold = MTE_THRESHOLD_HIGH;
+ else if (lastthresh == MTE_THRESHOLD_HIGH &&
+ *value < item->mteTriggerThresholdRising &&
+ *value <= item->mteTriggerThresholdFalling)
+ new_last_state->lastthreshold = MTE_THRESHOLD_LOW;
+ else if (lastthresh == MTE_THRESHOLD_BEGIN) {
+ if (*value >= item->mteTriggerThresholdRising)
+ new_last_state->lastthreshold = MTE_THRESHOLD_HIGH;
+ else if (*value <= item->mteTriggerThresholdFalling)
+ new_last_state->lastthreshold = MTE_THRESHOLD_LOW;
+ /*
+ * XXX: else??? in between? undefined?
+ */
+ } else {
+ new_last_state->lastthreshold = lastthresh;
+ }
+ }
+
+ /*
+ * extract from old hc storage
+ */
+ if (laststate) {
+ header_complex_extract_entry(&item->hc_storage_old,
+ header_complex_find_entry(item->
+ hc_storage_old,
+ (void *)
+ laststate));
+ last_state_clean(laststate);
+ }
+
+ } while (item->mteTriggerValueIDWildcard == TV_TRUE);
+
+ if(response)
+ snmp_free_pdu(response);
+
+ /*
+ * loop through old values for DNE cases
+ */
+ if (item->mteTriggerExistenceTest[0] & MTETRIGGEREXISTENCETEST_ABSENT) {
+
+ struct header_complex_index *iter;
+
+ /*
+ * XXX: broken
+ */
+ if ((item->mteTriggerExistenceStartup[0] &
+ MTETRIGGEREXISTENCESTARTUP_ABSENT)) {
+ /*
+ * XXX: send trap that nothing was found?
+ */
+ /*
+ * only if !wild? (see mib)
+ */
+ }
+ for (iter = item->hc_storage_old; iter; iter = iter->next) {
+ laststate = (struct last_state *) iter->data;
+ send_mte_trap(item, mteTriggerFired,
+ sizeof(mteTriggerFired) / sizeof(oid),
+ iter->name, iter->namelen, laststate->value,
+ item->mteTriggerExistenceObjectsOwner,
+ item->mteTriggerExistenceObjects,
+ "existence: absent");
+ }
+ header_complex_free_all(item->hc_storage_old, last_state_clean);
+ item->hc_storage_old = NULL;
+ }
+
+ item->started = MTE_STARTED;
+}
+
+
+/*
+ * handling routines
+ */
+void
+mte_enable_trigger(struct mteTriggerTable_data *item)
+{
+ if (!item)
+ return;
+
+ if (item->alarmreg)
+ snmp_alarm_unregister(item->alarmreg);
+
+ if (item->mteTriggerFrequency > 0) {
+ DEBUGMSGTL(("mteTriggertable", "Enabling trigger for %s/%s @ %u\n",
+ item->mteOwner, item->mteTriggerName,
+ item->mteTriggerFrequency));
+ item->alarmreg =
+ snmp_alarm_register(item->mteTriggerFrequency, SA_REPEAT,
+ mte_run_trigger, item);
+ }
+}
+
+void
+mte_disable_trigger(struct mteTriggerTable_data *item)
+{
+ if (!item)
+ return;
+
+ if (item->alarmreg) {
+ DEBUGMSGTL(("mteTriggertable", "Disabling trigger for %s/%s\n",
+ item->mteOwner, item->mteTriggerName));
+ snmp_alarm_unregister(item->alarmreg);
+ item->alarmreg = 0;
+ }
+ item->started = MTE_NOTSTARTED;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerTable.h
new file mode 100644
index 0000000000..18914dd99f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerTable.h
@@ -0,0 +1,254 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+
+#ifndef _MIBGROUP_MTETRIGGERTABLE_H
+#define _MIBGROUP_MTETRIGGERTABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module
+ */
+
+
+config_require(header_complex)
+config_require(utilities/iquery)
+
+#ifndef NETSNMP_TRANSPORT_CALLBACK_DOMAIN
+config_error(disman/mteTriggerTable depends on the Callback transport)
+#endif
+
+ /*
+ * our storage structure(s)
+ */
+ struct mteTriggerTable_data {
+
+
+ char *mteOwner;
+ size_t mteOwnerLen;
+ char *mteTriggerName;
+ size_t mteTriggerNameLen;
+ char *mteTriggerComment;
+ size_t mteTriggerCommentLen;
+ char *mteTriggerTest;
+ size_t mteTriggerTestLen;
+ long mteTriggerSampleType;
+ oid *mteTriggerValueID;
+ size_t mteTriggerValueIDLen;
+ long mteTriggerValueIDWildcard;
+ char *mteTriggerTargetTag;
+ size_t mteTriggerTargetTagLen;
+ char *mteTriggerContextName;
+ size_t mteTriggerContextNameLen;
+ long mteTriggerContextNameWildcard;
+ unsigned long mteTriggerFrequency;
+ char *mteTriggerObjectsOwner;
+ size_t mteTriggerObjectsOwnerLen;
+ char *mteTriggerObjects;
+ size_t mteTriggerObjectsLen;
+ long mteTriggerEnabled;
+ long mteTriggerEntryStatus;
+
+ /*
+ * delta table
+ */
+ oid *mteTriggerDeltaDiscontinuityID;
+ size_t mteTriggerDeltaDiscontinuityIDLen;
+ long mteTriggerDeltaDiscontinuityIDWildcard;
+ long mteTriggerDeltaDiscontinuityIDType;
+ unsigned long prevDiscoTicks;
+ unsigned long prevUptimeTicks;
+
+ /*
+ * existence table
+ */
+ char *mteTriggerExistenceTest;
+ size_t mteTriggerExistenceTestLen;
+ char *mteTriggerExistenceStartup;
+ size_t mteTriggerExistenceStartupLen;
+ char *mteTriggerExistenceObjectsOwner;
+ size_t mteTriggerExistenceObjectsOwnerLen;
+ char *mteTriggerExistenceObjects;
+ size_t mteTriggerExistenceObjectsLen;
+ char *mteTriggerExistenceEventOwner;
+ size_t mteTriggerExistenceEventOwnerLen;
+ char *mteTriggerExistenceEvent;
+ size_t mteTriggerExistenceEventLen;
+
+ /*
+ * boolean table
+ */
+ long mteTriggerBooleanComparison;
+ long mteTriggerBooleanValue;
+ long mteTriggerBooleanStartup;
+ char *mteTriggerBooleanObjectsOwner;
+ size_t mteTriggerBooleanObjectsOwnerLen;
+ char *mteTriggerBooleanObjects;
+ size_t mteTriggerBooleanObjectsLen;
+ char *mteTriggerBooleanEventOwner;
+ size_t mteTriggerBooleanEventOwnerLen;
+ char *mteTriggerBooleanEvent;
+ size_t mteTriggerBooleanEventLen;
+
+ /*
+ * threshold table
+ */
+ long mteTriggerThresholdStartup;
+ long mteTriggerThresholdRising;
+ long mteTriggerThresholdFalling;
+ long mteTriggerThresholdDeltaRising;
+ long mteTriggerThresholdDeltaFalling;
+ char *mteTriggerThresholdObjectsOwner;
+ size_t mteTriggerThresholdObjectsOwnerLen;
+ char *mteTriggerThresholdObjects;
+ size_t mteTriggerThresholdObjectsLen;
+ char *mteTriggerThresholdRisingEventOwner;
+ size_t mteTriggerThresholdRisingEventOwnerLen;
+ char *mteTriggerThresholdRisingEvent;
+ size_t mteTriggerThresholdRisingEventLen;
+ char *mteTriggerThresholdFallingEventOwner;
+ size_t mteTriggerThresholdFallingEventOwnerLen;
+ char *mteTriggerThresholdFallingEvent;
+ size_t mteTriggerThresholdFallingEventLen;
+ char *mteTriggerThresholdDeltaRisingEventOwner;
+ size_t mteTriggerThresholdDeltaRisingEventOwnerLen;
+ char *mteTriggerThresholdDeltaRisingEvent;
+ size_t mteTriggerThresholdDeltaRisingEventLen;
+ char *mteTriggerThresholdDeltaFallingEventOwner;
+ size_t mteTriggerThresholdDeltaFallingEventOwnerLen;
+ char *mteTriggerThresholdDeltaFallingEvent;
+ size_t mteTriggerThresholdDeltaFallingEventLen;
+
+ /*
+ * internal variables
+ */
+ int storageType;
+ unsigned int alarmreg;
+ int lastboolresult;
+ int started;
+ long lastvalue;
+ struct header_complex_index *hc_storage, *hc_storage_old;
+ unsigned long threshold_state;
+
+ /*
+ * pdu auth contents
+ */
+ long have_copied_auth_info;
+ long pdu_version;
+ long pdu_securityModel;
+ long pdu_securityLevel;
+ void *pdu_transport;
+ size_t pdu_transportLen;
+ const oid *pdu_tDomain;
+ size_t pdu_tDomainLen;
+ u_char *pdu_community;
+ size_t pdu_community_len;
+ char *pdu_contextName;
+ size_t pdu_contextNameLen;
+ char *pdu_securityName;
+ size_t pdu_securityNameLen;
+ };
+
+ struct last_state {
+ long *value;
+ char lastbool;
+ char lastthreshold;
+ };
+
+
+/*
+ * enum definitions from the covered mib sections
+ */
+
+
+
+
+
+
+
+#define MTETRIGGERTEST_EXISTENCE 0x80
+#define MTETRIGGERTEST_BOOLEAN 0x40
+#define MTETRIGGERTEST_THRESHOLD 0x20
+
+#define MTETRIGGERSAMPLETYPE_ABSOLUTEVALUE 1
+#define MTETRIGGERSAMPLETYPE_DELTAVALUE 2
+
+
+/*
+ * What's wrong with using the regular TruthValue definitions TV_TRUE
+ * and TV_FALSE (snmp-tc.h) which are up to 77% shorter?
+ */
+
+#define MTETRIGGERVALUEIDWILDCARD_TRUE 1
+#define MTETRIGGERVALUEIDWILDCARD_FALSE 2
+
+
+
+#define MTETRIGGERCONTEXTNAMEWILDCARD_TRUE 1
+#define MTETRIGGERCONTEXTNAMEWILDCARD_FALSE 2
+
+
+
+
+#define MTETRIGGERENABLED_TRUE 1
+#define MTETRIGGERENABLED_FALSE 2
+
+#define MTE_NOTSTARTED 0
+#define MTE_STARTED 1
+
+#define MTE_THRESHOLD_BEGIN 0
+#define MTE_THRESHOLD_HIGH 1
+#define MTE_THRESHOLD_LOW 2
+
+/*
+ * Just the first (MTE-specific) groups of errors defined here;
+ * others are numerically equal to the regular SNMP errors.
+ */
+
+#define MTE_FAILURE_LOCALRESOURCELACK -1
+#define MTE_FAILURE_BADDESTINATION -2
+#define MTE_FAILURE_DESTINATIONUNREACHABLE -3
+#define MTE_FAILURE_NORESPONSE -4
+#define MTE_FAILURE_BADTYPE -5
+#define MTE_FAILURE_SAMPLEOVERRUN -6
+
+
+/*
+ * function prototypes
+ */
+
+
+ void init_mteTriggerTable(void);
+ FindVarMethod var_mteTriggerTable;
+ void parse_mteTriggerTable(const char *, char *);
+ void parse_simple_monitor(const char *, char *);
+ void parse_default_monitors(const char *, char *);
+ SNMPCallback store_mteTriggerTable;
+ netsnmp_pdu *mte_get_response(struct mteTriggerTable_data *,
+ netsnmp_pdu *);
+
+
+ WriteMethod write_mteTriggerComment;
+ WriteMethod write_mteTriggerTest;
+ WriteMethod write_mteTriggerSampleType;
+ WriteMethod write_mteTriggerValueID;
+ WriteMethod write_mteTriggerValueIDWildcard;
+ WriteMethod write_mteTriggerTargetTag;
+ WriteMethod write_mteTriggerContextName;
+ WriteMethod write_mteTriggerContextNameWildcard;
+ WriteMethod write_mteTriggerFrequency;
+ WriteMethod write_mteTriggerObjectsOwner;
+ WriteMethod write_mteTriggerObjects;
+ WriteMethod write_mteTriggerEnabled;
+ WriteMethod write_mteTriggerEntryStatus;
+
+ WriteMethod write_mteTriggerEntryStatus;
+
+ void mte_enable_trigger(struct mteTriggerTable_data *item);
+ void mte_disable_trigger(struct mteTriggerTable_data
+ *item);
+ SNMPAlarmCallback mte_run_trigger;
+
+#endif /* _MIBGROUP_MTETRIGGERTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerThresholdTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerThresholdTable.c
new file mode 100644
index 0000000000..11fa0688ef
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerThresholdTable.c
@@ -0,0 +1,1611 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent.
+ */
+
+
+/*
+ * This should always be included first before anything else
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+
+/*
+ * minimal include directives
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "mteTriggerThresholdTable.h"
+#include "mteTriggerTable.h"
+
+
+/*
+ * mteTriggerThresholdTable_variables_oid:
+ * this is the top level oid that we want to register under. This
+ * is essentially a prefix, with the suffix appearing in the
+ * variable below.
+ */
+
+
+oid mteTriggerThresholdTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 88, 1, 2, 6 };
+
+
+/*
+ * variable2 mteTriggerThresholdTable_variables:
+ * this variable defines function callbacks and type return information
+ * for the mteTriggerThresholdTable mib section
+ */
+
+
+struct variable2 mteTriggerThresholdTable_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+#define MTETRIGGERTHRESHOLDSTARTUP 3
+ {MTETRIGGERTHRESHOLDSTARTUP, ASN_INTEGER, RWRITE,
+ var_mteTriggerThresholdTable, 2, {1, 1}},
+#define MTETRIGGERTHRESHOLDRISING 4
+ {MTETRIGGERTHRESHOLDRISING, ASN_INTEGER, RWRITE,
+ var_mteTriggerThresholdTable, 2, {1, 2}},
+#define MTETRIGGERTHRESHOLDFALLING 5
+ {MTETRIGGERTHRESHOLDFALLING, ASN_INTEGER, RWRITE,
+ var_mteTriggerThresholdTable, 2, {1, 3}},
+#define MTETRIGGERTHRESHOLDDELTARISING 6
+ {MTETRIGGERTHRESHOLDDELTARISING, ASN_INTEGER, RWRITE,
+ var_mteTriggerThresholdTable, 2, {1, 4}},
+#define MTETRIGGERTHRESHOLDDELTAFALLING 7
+ {MTETRIGGERTHRESHOLDDELTAFALLING, ASN_INTEGER, RWRITE,
+ var_mteTriggerThresholdTable, 2, {1, 5}},
+#define MTETRIGGERTHRESHOLDOBJECTSOWNER 8
+ {MTETRIGGERTHRESHOLDOBJECTSOWNER, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerThresholdTable, 2, {1, 6}},
+#define MTETRIGGERTHRESHOLDOBJECTS 9
+ {MTETRIGGERTHRESHOLDOBJECTS, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerThresholdTable, 2, {1, 7}},
+#define MTETRIGGERTHRESHOLDRISINGEVENTOWNER 10
+ {MTETRIGGERTHRESHOLDRISINGEVENTOWNER, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerThresholdTable, 2, {1, 8}},
+#define MTETRIGGERTHRESHOLDRISINGEVENT 11
+ {MTETRIGGERTHRESHOLDRISINGEVENT, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerThresholdTable, 2, {1, 9}},
+#define MTETRIGGERTHRESHOLDFALLINGEVENTOWNER 12
+ {MTETRIGGERTHRESHOLDFALLINGEVENTOWNER, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerThresholdTable, 2, {1, 10}},
+#define MTETRIGGERTHRESHOLDFALLINGEVENT 13
+ {MTETRIGGERTHRESHOLDFALLINGEVENT, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerThresholdTable, 2, {1, 11}},
+#define MTETRIGGERTHRESHOLDDELTARISINGEVENTOWNER 14
+ {MTETRIGGERTHRESHOLDDELTARISINGEVENTOWNER, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerThresholdTable, 2, {1, 12}},
+#define MTETRIGGERTHRESHOLDDELTARISINGEVENT 15
+ {MTETRIGGERTHRESHOLDDELTARISINGEVENT, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerThresholdTable, 2, {1, 13}},
+#define MTETRIGGERTHRESHOLDDELTAFALLINGEVENTOWNER 16
+ {MTETRIGGERTHRESHOLDDELTAFALLINGEVENTOWNER, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerThresholdTable, 2, {1, 14}},
+#define MTETRIGGERTHRESHOLDDELTAFALLINGEVENT 17
+ {MTETRIGGERTHRESHOLDDELTAFALLINGEVENT, ASN_OCTET_STR, RWRITE,
+ var_mteTriggerThresholdTable, 2, {1, 15}},
+
+};
+/*
+ * (L = length of the oidsuffix)
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+extern struct header_complex_index *mteTriggerTableStorage;
+
+
+/*
+ * init_mteTriggerThresholdTable():
+ * Initialization routine. This is called when the agent starts up.
+ * At a minimum, registration of your variables should take place here.
+ */
+void
+init_mteTriggerThresholdTable(void)
+{
+ DEBUGMSGTL(("mteTriggerThresholdTable", "initializing... "));
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("mteTriggerThresholdTable",
+ mteTriggerThresholdTable_variables, variable2,
+ mteTriggerThresholdTable_variables_oid);
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable", "done.\n"));
+}
+
+/*
+ * var_mteTriggerThresholdTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_mteTriggerThresholdTable above.
+ */
+unsigned char *
+var_mteTriggerThresholdTable(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+
+ struct mteTriggerTable_data *StorageTmp = NULL;
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable",
+ "var_mteTriggerThresholdTable: Entering... \n"));
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, vp, name, length, exact,
+ var_len, write_method)) == NULL)
+ return NULL;
+
+
+ if (!(StorageTmp->mteTriggerTest[0] & MTETRIGGERTEST_THRESHOLD))
+ return NULL;
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+
+
+ case MTETRIGGERTHRESHOLDSTARTUP:
+ *write_method = write_mteTriggerThresholdStartup;
+ *var_len = sizeof(StorageTmp->mteTriggerThresholdStartup);
+ return (u_char *) & StorageTmp->mteTriggerThresholdStartup;
+
+ case MTETRIGGERTHRESHOLDRISING:
+ *write_method = write_mteTriggerThresholdRising;
+ *var_len = sizeof(StorageTmp->mteTriggerThresholdRising);
+ return (u_char *) & StorageTmp->mteTriggerThresholdRising;
+
+ case MTETRIGGERTHRESHOLDFALLING:
+ *write_method = write_mteTriggerThresholdFalling;
+ *var_len = sizeof(StorageTmp->mteTriggerThresholdFalling);
+ return (u_char *) & StorageTmp->mteTriggerThresholdFalling;
+
+ case MTETRIGGERTHRESHOLDDELTARISING:
+ *write_method = write_mteTriggerThresholdDeltaRising;
+ *var_len = sizeof(StorageTmp->mteTriggerThresholdDeltaRising);
+ return (u_char *) & StorageTmp->mteTriggerThresholdDeltaRising;
+
+ case MTETRIGGERTHRESHOLDDELTAFALLING:
+ *write_method = write_mteTriggerThresholdDeltaFalling;
+ *var_len = sizeof(StorageTmp->mteTriggerThresholdDeltaFalling);
+ return (u_char *) & StorageTmp->mteTriggerThresholdDeltaFalling;
+
+ case MTETRIGGERTHRESHOLDOBJECTSOWNER:
+ *write_method = write_mteTriggerThresholdObjectsOwner;
+ *var_len = StorageTmp->mteTriggerThresholdObjectsOwnerLen;
+ return (u_char *) StorageTmp->mteTriggerThresholdObjectsOwner;
+
+ case MTETRIGGERTHRESHOLDOBJECTS:
+ *write_method = write_mteTriggerThresholdObjects;
+ *var_len = StorageTmp->mteTriggerThresholdObjectsLen;
+ return (u_char *) StorageTmp->mteTriggerThresholdObjects;
+
+ case MTETRIGGERTHRESHOLDRISINGEVENTOWNER:
+ *write_method = write_mteTriggerThresholdRisingEventOwner;
+ *var_len = StorageTmp->mteTriggerThresholdRisingEventOwnerLen;
+ return (u_char *) StorageTmp->mteTriggerThresholdRisingEventOwner;
+
+ case MTETRIGGERTHRESHOLDRISINGEVENT:
+ *write_method = write_mteTriggerThresholdRisingEvent;
+ *var_len = StorageTmp->mteTriggerThresholdRisingEventLen;
+ return (u_char *) StorageTmp->mteTriggerThresholdRisingEvent;
+
+ case MTETRIGGERTHRESHOLDFALLINGEVENTOWNER:
+ *write_method = write_mteTriggerThresholdFallingEventOwner;
+ *var_len = StorageTmp->mteTriggerThresholdFallingEventOwnerLen;
+ return (u_char *) StorageTmp->mteTriggerThresholdFallingEventOwner;
+
+ case MTETRIGGERTHRESHOLDFALLINGEVENT:
+ *write_method = write_mteTriggerThresholdFallingEvent;
+ *var_len = StorageTmp->mteTriggerThresholdFallingEventLen;
+ return (u_char *) StorageTmp->mteTriggerThresholdFallingEvent;
+
+ case MTETRIGGERTHRESHOLDDELTARISINGEVENTOWNER:
+ *write_method = write_mteTriggerThresholdDeltaRisingEventOwner;
+ *var_len = StorageTmp->mteTriggerThresholdDeltaRisingEventOwnerLen;
+ return (u_char *) StorageTmp->
+ mteTriggerThresholdDeltaRisingEventOwner;
+
+ case MTETRIGGERTHRESHOLDDELTARISINGEVENT:
+ *write_method = write_mteTriggerThresholdDeltaRisingEvent;
+ *var_len = StorageTmp->mteTriggerThresholdDeltaRisingEventLen;
+ return (u_char *) StorageTmp->mteTriggerThresholdDeltaRisingEvent;
+
+ case MTETRIGGERTHRESHOLDDELTAFALLINGEVENTOWNER:
+ *write_method = write_mteTriggerThresholdDeltaFallingEventOwner;
+ *var_len =
+ StorageTmp->mteTriggerThresholdDeltaFallingEventOwnerLen;
+ return (u_char *) StorageTmp->
+ mteTriggerThresholdDeltaFallingEventOwner;
+
+ case MTETRIGGERTHRESHOLDDELTAFALLINGEVENT:
+ *write_method = write_mteTriggerThresholdDeltaFallingEvent;
+ *var_len = StorageTmp->mteTriggerThresholdDeltaFallingEventLen;
+ return (u_char *) StorageTmp->mteTriggerThresholdDeltaFallingEvent;
+
+
+ default:
+ ERROR_MSG("");
+ }
+ return NULL;
+}
+
+
+
+
+int
+write_mteTriggerThresholdStartup(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable",
+ "write_mteTriggerThresholdStartup entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerThresholdTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ fprintf(stderr,
+ "write to mteTriggerThresholdStartup not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerThresholdStartup;
+ StorageTmp->mteTriggerThresholdStartup = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->mteTriggerThresholdStartup = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdRising(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable",
+ "write_mteTriggerThresholdRising entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerThresholdTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ fprintf(stderr,
+ "write to mteTriggerThresholdRising not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerThresholdRising;
+ StorageTmp->mteTriggerThresholdRising = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->mteTriggerThresholdRising = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdFalling(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable",
+ "write_mteTriggerThresholdFalling entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerThresholdTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ fprintf(stderr,
+ "write to mteTriggerThresholdFalling not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerThresholdFalling;
+ StorageTmp->mteTriggerThresholdFalling = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->mteTriggerThresholdFalling = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdDeltaRising(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable",
+ "write_mteTriggerThresholdDeltaRising entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerThresholdTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ fprintf(stderr,
+ "write to mteTriggerThresholdDeltaRising not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerThresholdDeltaRising;
+ StorageTmp->mteTriggerThresholdDeltaRising = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->mteTriggerThresholdDeltaRising = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdDeltaFalling(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable",
+ "write_mteTriggerThresholdDeltaFalling entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerThresholdTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ fprintf(stderr,
+ "write to mteTriggerThresholdDeltaFalling not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerThresholdDeltaFalling;
+ StorageTmp->mteTriggerThresholdDeltaFalling = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->mteTriggerThresholdDeltaFalling = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdObjectsOwner(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable",
+ "write_mteTriggerThresholdObjectsOwner entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerThresholdTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerThresholdObjectsOwner not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerThresholdObjectsOwner;
+ tmplen = StorageTmp->mteTriggerThresholdObjectsOwnerLen;
+ memdup((u_char **) & StorageTmp->mteTriggerThresholdObjectsOwner,
+ var_val, var_val_len);
+ StorageTmp->mteTriggerThresholdObjectsOwnerLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerThresholdObjectsOwner);
+ StorageTmp->mteTriggerThresholdObjectsOwner = tmpvar;
+ StorageTmp->mteTriggerThresholdObjectsOwnerLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdObjects(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable",
+ "write_mteTriggerThresholdObjects entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerThresholdTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerThresholdObjects not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerThresholdObjects;
+ tmplen = StorageTmp->mteTriggerThresholdObjectsLen;
+ memdup((u_char **) & StorageTmp->mteTriggerThresholdObjects,
+ var_val, var_val_len);
+ StorageTmp->mteTriggerThresholdObjectsLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerThresholdObjects);
+ StorageTmp->mteTriggerThresholdObjects = tmpvar;
+ StorageTmp->mteTriggerThresholdObjectsLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdRisingEventOwner(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable",
+ "write_mteTriggerThresholdRisingEventOwner entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerThresholdTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerThresholdRisingEventOwner not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerThresholdRisingEventOwner;
+ tmplen = StorageTmp->mteTriggerThresholdRisingEventOwnerLen;
+ memdup((u_char **) & StorageTmp->
+ mteTriggerThresholdRisingEventOwner, var_val, var_val_len);
+ StorageTmp->mteTriggerThresholdRisingEventOwnerLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerThresholdRisingEventOwner);
+ StorageTmp->mteTriggerThresholdRisingEventOwner = tmpvar;
+ StorageTmp->mteTriggerThresholdRisingEventOwnerLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdRisingEvent(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable",
+ "write_mteTriggerThresholdRisingEvent entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerThresholdTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerThresholdRisingEvent not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerThresholdRisingEvent;
+ tmplen = StorageTmp->mteTriggerThresholdRisingEventLen;
+ memdup((u_char **) & StorageTmp->mteTriggerThresholdRisingEvent,
+ var_val, var_val_len);
+ StorageTmp->mteTriggerThresholdRisingEventLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerThresholdRisingEvent);
+ StorageTmp->mteTriggerThresholdRisingEvent = tmpvar;
+ StorageTmp->mteTriggerThresholdRisingEventLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdFallingEventOwner(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable",
+ "write_mteTriggerThresholdFallingEventOwner entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerThresholdTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerThresholdFallingEventOwner not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerThresholdFallingEventOwner;
+ tmplen = StorageTmp->mteTriggerThresholdFallingEventOwnerLen;
+ memdup((u_char **) & StorageTmp->
+ mteTriggerThresholdFallingEventOwner, var_val, var_val_len);
+ StorageTmp->mteTriggerThresholdFallingEventOwnerLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerThresholdFallingEventOwner);
+ StorageTmp->mteTriggerThresholdFallingEventOwner = tmpvar;
+ StorageTmp->mteTriggerThresholdFallingEventOwnerLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdFallingEvent(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable",
+ "write_mteTriggerThresholdFallingEvent entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerThresholdTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerThresholdFallingEvent not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerThresholdFallingEvent;
+ tmplen = StorageTmp->mteTriggerThresholdFallingEventLen;
+ memdup((u_char **) & StorageTmp->mteTriggerThresholdFallingEvent,
+ var_val, var_val_len);
+ StorageTmp->mteTriggerThresholdFallingEventLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerThresholdFallingEvent);
+ StorageTmp->mteTriggerThresholdFallingEvent = tmpvar;
+ StorageTmp->mteTriggerThresholdFallingEventLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdDeltaRisingEventOwner(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable",
+ "write_mteTriggerThresholdDeltaRisingEventOwner entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerThresholdTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerThresholdDeltaRisingEventOwner not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerThresholdDeltaRisingEventOwner;
+ tmplen = StorageTmp->mteTriggerThresholdDeltaRisingEventOwnerLen;
+ memdup((u_char **) & StorageTmp->
+ mteTriggerThresholdDeltaRisingEventOwner, var_val,
+ var_val_len);
+ StorageTmp->mteTriggerThresholdDeltaRisingEventOwnerLen =
+ var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerThresholdDeltaRisingEventOwner);
+ StorageTmp->mteTriggerThresholdDeltaRisingEventOwner = tmpvar;
+ StorageTmp->mteTriggerThresholdDeltaRisingEventOwnerLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdDeltaRisingEvent(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable",
+ "write_mteTriggerThresholdDeltaRisingEvent entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerThresholdTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerThresholdDeltaRisingEvent not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerThresholdDeltaRisingEvent;
+ tmplen = StorageTmp->mteTriggerThresholdDeltaRisingEventLen;
+ memdup((u_char **) & StorageTmp->
+ mteTriggerThresholdDeltaRisingEvent, var_val, var_val_len);
+ StorageTmp->mteTriggerThresholdDeltaRisingEventLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerThresholdDeltaRisingEvent);
+ StorageTmp->mteTriggerThresholdDeltaRisingEvent = tmpvar;
+ StorageTmp->mteTriggerThresholdDeltaRisingEventLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdDeltaFallingEventOwner(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name,
+ size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable",
+ "write_mteTriggerThresholdDeltaFallingEventOwner entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerThresholdTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerThresholdDeltaFallingEventOwner not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerThresholdDeltaFallingEventOwner;
+ tmplen = StorageTmp->mteTriggerThresholdDeltaFallingEventOwnerLen;
+ memdup((u_char **) & StorageTmp->
+ mteTriggerThresholdDeltaFallingEventOwner, var_val,
+ var_val_len);
+ StorageTmp->mteTriggerThresholdDeltaFallingEventOwnerLen =
+ var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerThresholdDeltaFallingEventOwner);
+ StorageTmp->mteTriggerThresholdDeltaFallingEventOwner = tmpvar;
+ StorageTmp->mteTriggerThresholdDeltaFallingEventOwnerLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_mteTriggerThresholdDeltaFallingEvent(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct mteTriggerTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(mteTriggerThresholdTable_variables_oid) / sizeof(oid) + 3 -
+ 1);
+
+
+ DEBUGMSGTL(("mteTriggerThresholdTable",
+ "write_mteTriggerThresholdDeltaFallingEvent entering action=%d... \n",
+ action));
+ if ((StorageTmp =
+ header_complex(mteTriggerTableStorage, NULL,
+ &name[sizeof
+ (mteTriggerThresholdTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ fprintf(stderr,
+ "write to mteTriggerThresholdDeltaFallingEvent not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->mteTriggerThresholdDeltaFallingEvent;
+ tmplen = StorageTmp->mteTriggerThresholdDeltaFallingEventLen;
+ memdup((u_char **) & StorageTmp->
+ mteTriggerThresholdDeltaFallingEvent, var_val, var_val_len);
+ StorageTmp->mteTriggerThresholdDeltaFallingEventLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->mteTriggerThresholdDeltaFallingEvent);
+ StorageTmp->mteTriggerThresholdDeltaFallingEvent = tmpvar;
+ StorageTmp->mteTriggerThresholdDeltaFallingEventLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerThresholdTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerThresholdTable.h
new file mode 100644
index 0000000000..7aa6cecf4a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/mteTriggerThresholdTable.h
@@ -0,0 +1,46 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+
+#ifndef _MIBGROUP_MTETRIGGERTHRESHOLDTABLE_H
+#define _MIBGROUP_MTETRIGGERTHRESHOLDTABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module
+ */
+
+
+config_require(header_complex)
+
+ /*
+ * enum definitions from the covered mib sections
+ */
+#define MTETRIGGERTHRESHOLDSTARTUP_RISING 1
+#define MTETRIGGERTHRESHOLDSTARTUP_FALLING 2
+#define MTETRIGGERTHRESHOLDSTARTUP_RISINGORFALLING 3
+ /*
+ * function prototypes
+ */
+ void init_mteTriggerThresholdTable(void);
+ FindVarMethod var_mteTriggerThresholdTable;
+
+ WriteMethod write_mteTriggerThresholdStartup;
+ WriteMethod write_mteTriggerThresholdRising;
+ WriteMethod write_mteTriggerThresholdFalling;
+ WriteMethod write_mteTriggerThresholdDeltaRising;
+ WriteMethod write_mteTriggerThresholdDeltaFalling;
+ WriteMethod write_mteTriggerThresholdObjectsOwner;
+ WriteMethod write_mteTriggerThresholdObjects;
+ WriteMethod write_mteTriggerThresholdRisingEventOwner;
+ WriteMethod write_mteTriggerThresholdRisingEvent;
+ WriteMethod write_mteTriggerThresholdFallingEventOwner;
+ WriteMethod write_mteTriggerThresholdFallingEvent;
+ WriteMethod write_mteTriggerThresholdDeltaRisingEventOwner;
+ WriteMethod write_mteTriggerThresholdDeltaRisingEvent;
+ WriteMethod write_mteTriggerThresholdDeltaFallingEventOwner;
+ WriteMethod write_mteTriggerThresholdDeltaFallingEvent;
+
+#endif /* _MIBGROUP_MTETRIGGERTHRESHOLDTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup-mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup-mib.h
new file mode 100644
index 0000000000..1c3fb1c582
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup-mib.h
@@ -0,0 +1,20 @@
+/*
+*Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+*
+*All right reserved
+*
+*File Name:nslookup-mib.h
+*File Description:Add DISMAN-NSLOOKUP-MIB.
+*
+*Current Version:1.0
+*Author:ChenJing
+*Date:2004.8.20
+*/
+
+/*
+ * wrapper for the disman name lookup mib code files
+ */
+config_require(disman/nslookup/lookupCtlTable)
+config_require(disman/nslookup/lookupResultsTable)
+config_add_mib(DISMAN-NSLOOKUP-MIB)
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup/lookupCtlTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup/lookupCtlTable.c
new file mode 100644
index 0000000000..7d21b0496e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup/lookupCtlTable.c
@@ -0,0 +1,1554 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:lookupCtlTable.c
+ *File Description:Rows of the lookupCtlTable MIB add , delete and read.Rows of lookupResultsTable
+ * MIB add and delete.
+
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+/*
+ * This should always be included first before anything else
+ */
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#include <netdb.h>
+#include <netinet/in.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "lookupCtlTable.h"
+#include "lookupResultsTable.h"
+#include "header_complex.h"
+
+/*
+ *For discontinuity checking.
+ */
+
+oid lookupCtlTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 82, 1, 3 };
+
+
+struct variable2 lookupCtlTable_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+ {COLUMN_LOOKUPCTLTARGETADDRESSTYPE, ASN_INTEGER, RWRITE, var_lookupCtlTable, 2, {1, 3}},
+ {COLUMN_LOOKUPCTLTARGETADDRESS, ASN_OCTET_STR, RWRITE, var_lookupCtlTable, 2, {1, 4}},
+ {COLUMN_LOOKUPCTLOPERSTATUS, ASN_INTEGER, RONLY, var_lookupCtlTable, 2, {1, 5}},
+ {COLUMN_LOOKUPCTLTIME, ASN_UNSIGNED, RONLY, var_lookupCtlTable, 2, {1, 6}},
+ {COLUMN_LOOKUPCTLRC, ASN_INTEGER, RONLY, var_lookupCtlTable, 2, {1, 7}},
+ {COLUMN_LOOKUPCTLROWSTATUS, ASN_INTEGER, RWRITE, var_lookupCtlTable, 2, {1, 8}}
+};
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+
+
+struct header_complex_index *lookupCtlTableStorage = NULL;
+struct header_complex_index *lookupResultsTableStorage = NULL;
+
+void
+init_lookupCtlTable(void)
+{
+ DEBUGMSGTL(("lookupCtlTable", "initializing... "));
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("lookupCtlTable", lookupCtlTable_variables, variable2,
+ lookupCtlTable_variables_oid);
+
+
+ /*
+ * register our config handler(s) to deal with registrations
+ */
+ snmpd_register_config_handler("lookupCtlTable", parse_lookupCtlTable,
+ NULL, NULL);
+
+ /*
+ * we need to be called back later to store our data
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_lookupCtlTable, NULL);
+
+ DEBUGMSGTL(("lookupCtlTable", "done.\n"));
+}
+
+struct lookupTable_data *
+create_lookupTable_data(void)
+{
+ struct lookupTable_data *StorageNew = NULL;
+ StorageNew = SNMP_MALLOC_STRUCT(lookupTable_data);
+ if (StorageNew == NULL) {
+ exit(1);
+ }
+ StorageNew->lookupCtlTargetAddress = strdup("");
+ StorageNew->lookupCtlTargetAddressLen = 0;
+ StorageNew->lookupCtlOperStatus = 2l;
+ StorageNew->lookupCtlTime = 0;
+ StorageNew->storagetype = ST_NONVOLATILE;
+ return StorageNew;
+}
+
+/*
+ * lookupCtlTable_add(): adds a structure node to our data set
+ */
+int
+lookupCtlTable_add(struct lookupTable_data *thedata)
+{
+ netsnmp_variable_list *vars = NULL;
+
+
+ DEBUGMSGTL(("lookupCtlTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->lookupCtlOwnerIndex, thedata->lookupCtlOwnerIndexLen); /* lookupCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->lookupCtlOperationName, thedata->lookupCtlOperationNameLen); /* lookupCtlOperationName */
+
+
+ if (header_complex_add_data(&lookupCtlTableStorage, vars, thedata) ==
+ NULL) {
+ return SNMPERR_GENERR;
+ }
+ DEBUGMSGTL(("lookupCtlTable", "registered an entry\n"));
+ vars = NULL;
+
+ DEBUGMSGTL(("lookupCtlTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+int
+lookupResultsTable_add(struct lookupTable_data *thedata)
+{
+ netsnmp_variable_list *vars_list = NULL;
+ struct lookupResultsTable_data *p = NULL;
+ p = thedata->ResultsTable;
+ if (thedata->ResultsTable != NULL)
+ do {
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->lookupCtlOwnerIndex, p->lookupCtlOwnerIndexLen); /* lookupCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->lookupCtlOperationName, p->lookupCtlOperationNameLen); /* lookupCtlOperationName */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &p->lookupResultsIndex, sizeof(p->lookupResultsIndex)); /* lookupResultsIndex */
+
+
+ DEBUGMSGTL(("lookupResultsTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+ if (header_complex_add_data
+ (&lookupResultsTableStorage, vars_list, p) == NULL) {
+ return SNMPERR_GENERR;
+ }
+
+ DEBUGMSGTL(("lookupResultsTable", "out finished\n"));
+ vars_list = NULL;
+ p = p->next;
+ } while (p != NULL);
+
+
+ DEBUGMSGTL(("lookupResultsTable", "done.\n"));
+}
+
+void
+lookupCtlTable_cleaner(struct header_complex_index *thestuff)
+{
+ struct header_complex_index *hciptr = NULL;
+ struct lookupTable_data *StorageDel = NULL;
+ DEBUGMSGTL(("lookupCtlTable", "cleanerout "));
+ for (hciptr = thestuff; hciptr != NULL; hciptr = hciptr->next) {
+ StorageDel =
+ header_complex_extract_entry(&lookupCtlTableStorage, hciptr);
+ if (StorageDel != NULL) {
+ free(StorageDel->lookupCtlOwnerIndex);
+ StorageDel->lookupCtlOwnerIndex = NULL;
+ free(StorageDel->lookupCtlOperationName);
+ StorageDel->lookupCtlOperationName = NULL;
+ free(StorageDel->lookupCtlTargetAddress);
+ StorageDel->lookupCtlTargetAddress = NULL;
+ free(StorageDel);
+ StorageDel = NULL;
+
+ }
+ DEBUGMSGTL(("lookupCtlTable", "cleaner "));
+ }
+}
+
+/*
+ * parse_lookupCtlTable():
+ * parses .conf file entries needed to configure the mib.
+ */
+void
+parse_lookupCtlTable(const char *token, char *line)
+{
+ size_t tmpint;
+ struct lookupTable_data *StorageTmp =
+ SNMP_MALLOC_STRUCT(lookupTable_data);
+
+ DEBUGMSGTL(("lookupCtlTable", "parsing config... "));
+
+
+ if (StorageTmp == NULL) {
+ config_perror("malloc failure");
+ return;
+ }
+
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->lookupCtlOwnerIndex,
+ &StorageTmp->lookupCtlOwnerIndexLen);
+ if (StorageTmp->lookupCtlOwnerIndex == NULL) {
+ config_perror("invalid specification for lookupCtlOwnerIndex");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->lookupCtlOperationName,
+ &StorageTmp->lookupCtlOperationNameLen);
+ if (StorageTmp->lookupCtlOperationName == NULL) {
+ config_perror("invalid specification for lookupCtlOperationName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->lookupCtlTargetAddressType,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->lookupCtlTargetAddress,
+ &StorageTmp->lookupCtlTargetAddressLen);
+ if (StorageTmp->lookupCtlTargetAddress == NULL) {
+ config_perror("invalid specification for lookupCtlTargetAddress");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->lookupCtlOperStatus, &tmpint);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->lookupCtlTime, &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->lookupCtlRc, &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->lookupCtlRowStatus, &tmpint);
+
+
+ StorageTmp->storagetype = ST_NONVOLATILE;
+ lookupCtlTable_add(StorageTmp);
+ /* lookupCtlTable_cleaner(lookupCtlTableStorage); */
+
+ DEBUGMSGTL(("lookupCtlTable", "done.\n"));
+}
+
+
+
+/*
+ * store_lookupCtlTable():
+ * stores .conf file entries needed to configure the mib.
+ */
+int
+store_lookupCtlTable(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr;
+ size_t tmpint;
+ struct lookupTable_data *StorageTmp;
+ struct header_complex_index *hcindex;
+
+
+ DEBUGMSGTL(("lookupCtlTable", "storing data... "));
+
+
+ for (hcindex = lookupCtlTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ StorageTmp = (struct lookupTable_data *) hcindex->data;
+
+ if (StorageTmp->storagetype != ST_READONLY) {
+ memset(line, 0, sizeof(line));
+ strcat(line, "lookupCtlTable ");
+ cptr = line + strlen(line);
+
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->lookupCtlOwnerIndex,
+ &StorageTmp->
+ lookupCtlOwnerIndexLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->lookupCtlOperationName,
+ &StorageTmp->
+ lookupCtlOperationNameLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ lookupCtlTargetAddressType,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->lookupCtlTargetAddress,
+ &StorageTmp->
+ lookupCtlTargetAddressLen);
+
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->lookupCtlOperStatus,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->lookupCtlTime,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->lookupCtlRc, &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->lookupCtlRowStatus,
+ &tmpint);
+
+
+
+ snmpd_store_config(line);
+ }
+ }
+ DEBUGMSGTL(("lookupCtlTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+
+
+/*
+ * var_lookupCtlTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_mteObjectsTable above.
+ */
+unsigned char *
+var_lookupCtlTable(struct variable *vp,
+ oid * name,
+ size_t *length,
+ int exact, size_t *var_len, WriteMethod ** write_method)
+{
+
+
+ struct lookupTable_data *StorageTmp = NULL;
+
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(lookupCtlTableStorage, vp, name, length, exact,
+ var_len, write_method)) == NULL) {
+ if (vp->magic == COLUMN_LOOKUPCTLROWSTATUS)
+ *write_method = write_lookupCtlRowStatus;
+ return NULL;
+ }
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+
+
+ case COLUMN_LOOKUPCTLTARGETADDRESSTYPE:
+ *write_method = write_lookupCtlTargetAddressType;
+ *var_len = sizeof(StorageTmp->lookupCtlTargetAddressType);
+ return (u_char *) & StorageTmp->lookupCtlTargetAddressType;
+
+ case COLUMN_LOOKUPCTLTARGETADDRESS:
+ *write_method = write_lookupCtlTargetAddress;
+ *var_len = (StorageTmp->lookupCtlTargetAddressLen);
+
+ return (u_char *) StorageTmp->lookupCtlTargetAddress;
+
+ case COLUMN_LOOKUPCTLOPERSTATUS:
+ *var_len = sizeof(StorageTmp->lookupCtlOperStatus);
+
+ return (u_char *) & StorageTmp->lookupCtlOperStatus;
+
+ case COLUMN_LOOKUPCTLTIME:
+ *var_len = sizeof(StorageTmp->lookupCtlTime);
+
+ return (u_char *) & StorageTmp->lookupCtlTime;
+
+ case COLUMN_LOOKUPCTLRC:
+ *var_len = sizeof(StorageTmp->lookupCtlRc);
+
+ return (u_char *) & StorageTmp->lookupCtlRc;
+
+ case COLUMN_LOOKUPCTLROWSTATUS:
+ *write_method = write_lookupCtlRowStatus;
+ *var_len = sizeof(StorageTmp->lookupCtlRowStatus);
+
+ return (u_char *) & StorageTmp->lookupCtlRowStatus;
+
+ default:
+ ERROR_MSG("");
+ }
+ return NULL;
+}
+
+
+void
+run_lookup(struct lookupTable_data *item)
+{
+
+ long addressType;
+ char *address = NULL;
+ size_t addresslen;
+ struct lookupResultsTable_data *head = NULL;
+ struct lookupResultsTable_data *current = NULL;
+ struct lookupResultsTable_data *temp = NULL;
+ int i = 0, n = 1, t = 0;
+
+ /* for ipv4,ipv6 */
+ unsigned int addr_in, addr_in6;
+ struct hostent *lookup = NULL;
+ struct sockaddr_in *addr = NULL;
+
+ struct timeval tpstart, tpend;
+ unsigned long timeuse, timeuse4, timeuse6;
+
+ /* for dns */
+
+ struct in_addr a;
+ struct in6_addr a6;
+ char *strptr = NULL;
+ struct addrinfo hints, *res = NULL, *tempinfo = NULL;
+ struct sockaddr_in6 myaddress6;
+ char buf[BUFSIZ];
+
+
+ if (item == NULL)
+ return;
+
+ addressType = (long) item->lookupCtlTargetAddressType;
+ addresslen = (size_t) item->lookupCtlTargetAddressLen;
+ address = (char *) malloc(addresslen + 1);
+ memcpy(address, item->lookupCtlTargetAddress, addresslen + 1);
+ address[addresslen] = '\0';
+
+ if (addressType == 1) {
+ addr_in = inet_addr(address);
+ if (addr_in == 0xffffffff
+ && strcmp(address, "255.255.255.255") != 0) {
+ DEBUGMSGTL(("lookupResultsTable", "Invalid argument: %s\n",
+ address));
+ return;
+ }
+
+ gettimeofday(&tpstart, NULL);
+ lookup = gethostbyaddr((char *) &addr_in, 4, AF_INET);
+ gettimeofday(&tpend, NULL);
+ timeuse = 1000000 * (tpend.tv_sec - tpstart.tv_sec) +
+ tpend.tv_usec - tpstart.tv_usec;
+ timeuse /= 1000;
+ modify_lookupCtlTime(item, timeuse);
+ modify_lookupCtlOperStatus(item, 3l);
+
+ if (lookup == NULL) {
+ DEBUGMSGTL(("lookupCtlTable",
+ "Can't get a network host entry for ipv4 address: %s\n",
+ address));
+ modify_lookupCtlRc(item, 1l);
+ return;
+ } else {
+ modify_lookupCtlRc(item, 0l);
+ if (lookup->h_name != NULL) {
+ current = temp =
+ SNMP_MALLOC_STRUCT(lookupResultsTable_data);
+ if (temp == NULL) {
+ exit(1);
+ }
+ temp->lookupResultsIndex = n;
+
+ temp->lookupCtlOwnerIndex =
+ (char *) malloc(item->lookupCtlOwnerIndexLen + 1);
+ if (temp->lookupCtlOwnerIndex == NULL) {
+ exit(1);
+ }
+ memcpy(temp->lookupCtlOwnerIndex,
+ item->lookupCtlOwnerIndex,
+ item->lookupCtlOwnerIndexLen + 1);
+ temp->lookupCtlOwnerIndex[item->lookupCtlOwnerIndexLen] =
+ '\0';
+ temp->lookupCtlOwnerIndexLen =
+ item->lookupCtlOwnerIndexLen;
+
+ temp->lookupCtlOperationName =
+ (char *) malloc(item->lookupCtlOperationNameLen + 1);
+ if (temp->lookupCtlOperationName == NULL) {
+ exit(1);
+ }
+ memcpy(temp->lookupCtlOperationName,
+ item->lookupCtlOperationName,
+ item->lookupCtlOperationNameLen + 1);
+ temp->lookupCtlOperationName[item->
+ lookupCtlOperationNameLen] =
+ '\0';
+ temp->lookupCtlOperationNameLen =
+ item->lookupCtlOperationNameLen;
+
+ temp->lookupResultsAddressType = 16;
+ temp->lookupResultsAddress =
+ (char *) malloc(strlen(lookup->h_name) + 1);
+ memcpy(temp->lookupResultsAddress, lookup->h_name,
+ strlen(lookup->h_name) + 1);
+ temp->lookupResultsAddress[strlen(lookup->h_name)] = '\0';
+ temp->lookupResultsAddressLen = strlen(lookup->h_name);
+ item->ResultsTable = temp;
+ n = n + 1;
+
+ }
+
+ i = 0;
+ while (lookup->h_aliases[i]) {
+ temp = SNMP_MALLOC_STRUCT(lookupResultsTable_data);
+ if (temp == NULL) {
+ exit(1);
+ }
+ temp->lookupCtlOwnerIndex =
+ (char *) malloc(item->lookupCtlOwnerIndexLen + 1);
+ if (temp->lookupCtlOwnerIndex == NULL) {
+ exit(1);
+ }
+ memcpy(temp->lookupCtlOwnerIndex,
+ item->lookupCtlOwnerIndex,
+ item->lookupCtlOwnerIndexLen + 1);
+ temp->lookupCtlOwnerIndex[item->lookupCtlOwnerIndexLen] =
+ '\0';
+ temp->lookupCtlOwnerIndexLen =
+ item->lookupCtlOwnerIndexLen;
+
+ temp->lookupCtlOperationName =
+ (char *) malloc(item->lookupCtlOperationNameLen + 1);
+ if (temp->lookupCtlOperationName == NULL) {
+ exit(1);
+ }
+ memcpy(temp->lookupCtlOperationName,
+ item->lookupCtlOperationName,
+ item->lookupCtlOperationNameLen + 1);
+ temp->lookupCtlOperationName[item->
+ lookupCtlOperationNameLen] =
+ '\0';
+ temp->lookupCtlOperationNameLen =
+ item->lookupCtlOperationNameLen;
+
+ temp->lookupResultsIndex = n;
+ temp->lookupResultsAddressType = 16;
+ temp->lookupResultsAddress =
+ (char *) malloc(strlen(lookup->h_aliases[i]) + 1);
+ memcpy(temp->lookupResultsAddress, lookup->h_aliases[i],
+ strlen(lookup->h_aliases[i]) + 1);
+ temp->lookupResultsAddress[strlen(lookup->h_aliases[i])] =
+ '\0';
+ temp->lookupResultsAddressLen =
+ strlen(lookup->h_aliases[i]);
+ current->next = temp;
+ current = temp;
+ i = i + 1;
+ n = n + 1;
+ }
+ current->next = NULL;
+
+ }
+
+
+ if (item->ResultsTable != NULL)
+ if (lookupResultsTable_add(item) != SNMPERR_SUCCESS)
+ DEBUGMSGTL(("lookupResultsTable",
+ "registered an entry error\n"));
+
+ SNMP_FREE(address);
+ address = NULL;
+ return;
+ }
+
+ else if (addressType == 16) {
+
+ gettimeofday(&tpstart, NULL);
+ lookup = gethostbyname(address);
+ gettimeofday(&tpend, NULL);
+ timeuse4 = 1000000 * (tpend.tv_sec - tpstart.tv_sec) +
+ tpend.tv_usec - tpstart.tv_usec;
+ timeuse4 /= 1000;
+ if (lookup == NULL) {
+ DEBUGMSGTL(("lookupCtlTable",
+ "Can't get a network host entry for %s\n",
+ address));
+ } else {
+ while (*lookup->h_addr_list) {
+ bcopy(*lookup->h_addr_list++, (char *) &a, sizeof(a));
+
+ temp = SNMP_MALLOC_STRUCT(lookupResultsTable_data);
+ if (temp == NULL) {
+ exit(1);
+ }
+ temp->lookupResultsIndex = n;
+
+ temp->lookupCtlOwnerIndex =
+ (char *) malloc(item->lookupCtlOwnerIndexLen + 1);
+ if (temp->lookupCtlOwnerIndex == NULL) {
+ exit(1);
+ }
+ memcpy(temp->lookupCtlOwnerIndex,
+ item->lookupCtlOwnerIndex,
+ item->lookupCtlOwnerIndexLen + 1);
+ temp->lookupCtlOwnerIndex[item->lookupCtlOwnerIndexLen] =
+ '\0';
+ temp->lookupCtlOwnerIndexLen =
+ item->lookupCtlOwnerIndexLen;
+
+ temp->lookupCtlOperationName =
+ (char *) malloc(item->lookupCtlOperationNameLen + 1);
+ if (temp->lookupCtlOperationName == NULL) {
+ exit(1);
+ }
+
+ memcpy(temp->lookupCtlOperationName,
+ item->lookupCtlOperationName,
+ item->lookupCtlOperationNameLen + 1);
+ temp->lookupCtlOperationName[item->
+ lookupCtlOperationNameLen] =
+ '\0';
+ temp->lookupCtlOperationNameLen =
+ item->lookupCtlOperationNameLen;
+
+ temp->lookupResultsAddressType = 1;
+ temp->lookupResultsAddress =
+ (char *) malloc(strlen(inet_ntoa(a)) + 1);
+ if (temp->lookupResultsAddress == NULL) {
+ exit(1);
+ }
+ memcpy(temp->lookupResultsAddress, inet_ntoa(a),
+ strlen(inet_ntoa(a)) + 1);
+ temp->lookupResultsAddress[strlen(inet_ntoa(a))] = '\0';
+ temp->lookupResultsAddressLen = strlen(inet_ntoa(a));
+ if (n == 1)
+ item->ResultsTable = temp;
+ else
+ current->next = temp;
+ current = temp;
+ n = n + 1;
+
+ }
+ current->next = NULL;
+ t = n;
+
+ }
+
+ struct hostent *hp;
+ char pa[64];
+ char *hostname = NULL;
+
+ gettimeofday(&tpstart, NULL);
+ hp = gethostbyname2(address, AF_INET6);
+ gettimeofday(&tpend, NULL);
+ timeuse6 = 1000000 * (tpend.tv_sec - tpstart.tv_sec) +
+ tpend.tv_usec - tpstart.tv_usec;
+ timeuse6 /= 1000;
+
+ if (hp == NULL) {
+ DEBUGMSGTL(("lookupCtlTable",
+ "Can't get a ipv6 network host entry for %s\n",
+ address));
+ } else {
+ while (*hp->h_addr_list) {
+ memmove((caddr_t) & a6, *hp->h_addr_list++, 16);
+ hostname = (char *) hp->h_name;
+
+ temp = SNMP_MALLOC_STRUCT(lookupResultsTable_data);
+ if (temp == NULL) {
+ exit(1);
+ }
+ temp->lookupResultsIndex = n;
+
+ temp->lookupCtlOwnerIndex =
+ (char *) malloc(item->lookupCtlOwnerIndexLen + 1);
+ if (temp->lookupCtlOwnerIndex == NULL) {
+ exit(1);
+ }
+ memcpy(temp->lookupCtlOwnerIndex,
+ item->lookupCtlOwnerIndex,
+ item->lookupCtlOwnerIndexLen + 1);
+ temp->lookupCtlOwnerIndex[item->lookupCtlOwnerIndexLen] =
+ '\0';
+ temp->lookupCtlOwnerIndexLen =
+ item->lookupCtlOwnerIndexLen;
+
+ temp->lookupCtlOperationName =
+ (char *) malloc(item->lookupCtlOperationNameLen + 1);
+ if (temp->lookupCtlOperationName == NULL) {
+ exit(1);
+ }
+ memcpy(temp->lookupCtlOperationName,
+ item->lookupCtlOperationName,
+ item->lookupCtlOperationNameLen + 1);
+ temp->lookupCtlOperationName[item->
+ lookupCtlOperationNameLen] =
+ '\0';
+ temp->lookupCtlOperationNameLen =
+ item->lookupCtlOperationNameLen;
+
+ temp->lookupResultsAddressType = 2;
+ temp->lookupResultsAddress =
+ (char *)
+ malloc(strlen(inet_ntop(AF_INET6, &a6, pa, 64)) + 1);
+ memcpy(temp->lookupResultsAddress,
+ inet_ntop(AF_INET6, &a6, pa, 64),
+ strlen(inet_ntop(AF_INET6, &a6, pa, 64)) + 1);
+ temp->
+ lookupResultsAddress[strlen
+ (inet_ntop
+ (AF_INET6, &a6, pa, 64))] = '\0';
+ temp->lookupResultsAddressLen =
+ strlen(inet_ntop(AF_INET6, &a6, pa, 64));
+ if (n == 1)
+ item->ResultsTable = temp;
+ else
+ current->next = temp;
+ current = temp;
+ n = n + 1;
+
+ }
+ current->next = NULL;
+ }
+ timeuse = timeuse4 + timeuse6;
+ modify_lookupCtlTime(item, timeuse);
+ modify_lookupCtlOperStatus(item, 3l);
+
+ if (item->ResultsTable != NULL) {
+
+ modify_lookupCtlRc(item, 0l);
+ if (lookupResultsTable_add(item) != SNMPERR_SUCCESS)
+ DEBUGMSGTL(("lookupResultsTable",
+ "registered an entry error\n"));
+ } else {
+ modify_lookupCtlRc(item, 1l);
+ }
+ SNMP_FREE(address);
+ address = NULL;
+
+ return;
+
+ }
+
+
+ else if (addressType == 2) {
+ if (inet_pton(AF_INET6, address, &addr_in6) == 1)
+ DEBUGMSGTL(("lookupCtlTable", "success! \n"));
+ else
+ DEBUGMSGTL(("lookupCtlTable", "error! \n"));
+
+
+ gettimeofday(&tpstart, NULL);
+ lookup = gethostbyaddr((char *) &addr_in6, 16, AF_INET6);
+ gettimeofday(&tpend, NULL);
+ timeuse = 1000000 * (tpend.tv_sec - tpstart.tv_sec) +
+ tpend.tv_usec - tpstart.tv_usec;
+ timeuse /= 1000;
+ modify_lookupCtlTime(item, timeuse);
+ modify_lookupCtlOperStatus(item, 3l);
+
+ if (lookup == NULL) {
+ DEBUGMSGTL(("lookupCtlTable",
+ "Can't get a network host entry for %s\n",
+ address));
+ modify_lookupCtlRc(item, 1l);
+ return;
+ } else {
+ modify_lookupCtlRc(item, 0l);
+ if (lookup->h_name != NULL) {
+ current = temp =
+ SNMP_MALLOC_STRUCT(lookupResultsTable_data);
+ if (temp == NULL) {
+ exit(1);
+ }
+ temp->lookupResultsIndex = n;
+
+ temp->lookupCtlOwnerIndex =
+ (char *) malloc(item->lookupCtlOwnerIndexLen + 1);
+ if (temp->lookupCtlOwnerIndex == NULL) {
+ exit(1);
+ }
+ memcpy(temp->lookupCtlOwnerIndex,
+ item->lookupCtlOwnerIndex,
+ item->lookupCtlOwnerIndexLen + 1);
+ temp->lookupCtlOwnerIndex[item->lookupCtlOwnerIndexLen] =
+ '\0';
+ temp->lookupCtlOwnerIndexLen =
+ item->lookupCtlOwnerIndexLen;
+
+ temp->lookupCtlOperationName =
+ (char *) malloc(item->lookupCtlOperationNameLen + 1);
+ if (temp->lookupCtlOperationName == NULL) {
+ exit(1);
+ }
+ memcpy(temp->lookupCtlOperationName,
+ item->lookupCtlOperationName,
+ item->lookupCtlOperationNameLen + 1);
+ temp->lookupCtlOperationName[item->
+ lookupCtlOperationNameLen] =
+ '\0';
+ temp->lookupCtlOperationNameLen =
+ item->lookupCtlOperationNameLen;
+
+ temp->lookupResultsAddressType = 16;
+ temp->lookupResultsAddress =
+ (char *) malloc(strlen(lookup->h_name) + 1);
+ memcpy(temp->lookupResultsAddress, lookup->h_name,
+ strlen(lookup->h_name) + 1);
+ temp->lookupResultsAddress[strlen(lookup->h_name)] = '\0';
+ temp->lookupResultsAddressLen = strlen(lookup->h_name);
+ item->ResultsTable = temp;
+ n = n + 1;
+
+ }
+
+ i = 0;
+ while (lookup->h_aliases[i]) {
+ temp = SNMP_MALLOC_STRUCT(lookupResultsTable_data);
+ if (temp == NULL) {
+ exit(1);
+ }
+ temp->lookupCtlOwnerIndex =
+ (char *) malloc(item->lookupCtlOwnerIndexLen + 1);
+ if (temp->lookupCtlOwnerIndex == NULL) {
+ exit(1);
+ }
+ memcpy(temp->lookupCtlOwnerIndex,
+ item->lookupCtlOwnerIndex,
+ item->lookupCtlOwnerIndexLen + 1);
+ temp->lookupCtlOwnerIndex[item->lookupCtlOwnerIndexLen] =
+ '\0';
+ temp->lookupCtlOwnerIndexLen =
+ item->lookupCtlOwnerIndexLen;
+
+ temp->lookupCtlOperationName =
+ (char *) malloc(item->lookupCtlOperationNameLen + 1);
+ if (temp->lookupCtlOperationName == NULL) {
+ exit(1);
+ }
+ memcpy(temp->lookupCtlOperationName,
+ item->lookupCtlOperationName,
+ item->lookupCtlOperationNameLen + 1);
+ temp->lookupCtlOperationName[item->
+ lookupCtlOperationNameLen] =
+ '\0';
+ temp->lookupCtlOperationNameLen =
+ item->lookupCtlOperationNameLen;
+
+ temp->lookupResultsIndex = n;
+ temp->lookupResultsAddressType = 16;
+ temp->lookupResultsAddress =
+ (char *) malloc(strlen(lookup->h_aliases[i]) + 1);
+ if (temp->lookupResultsAddress == NULL) {
+ exit(1);
+ }
+ memcpy(temp->lookupResultsAddress, lookup->h_aliases[i],
+ strlen(lookup->h_aliases[i]) + 1);
+ temp->lookupResultsAddress[strlen(lookup->h_aliases[i])] =
+ '\0';
+ temp->lookupResultsAddressLen =
+ strlen(lookup->h_aliases[i]);
+ current->next = temp;
+ current = temp;
+ i = i + 1;
+ n = n + 1;
+
+ }
+
+ if (item->ResultsTable != NULL)
+ current->next = NULL;
+ else
+ current = NULL;
+
+ }
+
+
+ if (item->ResultsTable != NULL)
+ if (lookupResultsTable_add(item) != SNMPERR_SUCCESS)
+ DEBUGMSGTL(("lookupResultsTable",
+ "registered an entry error\n"));
+ SNMP_FREE(address);
+ address = NULL;
+ return;
+ } else {
+ SNMP_FREE(address);
+ address = NULL;
+ return;
+ }
+}
+
+
+int
+modify_lookupCtlOperStatus(struct lookupTable_data *thedata, long val)
+{
+ netsnmp_variable_list *vars = NULL;
+ struct lookupTable_data *StorageTmp = NULL;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->lookupCtlOwnerIndex, thedata->lookupCtlOwnerIndexLen); /* lookupCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->lookupCtlOperationName, thedata->lookupCtlOperationNameLen); /* lookupCtlOperationName */
+
+
+ if ((StorageTmp =
+ header_complex_get(lookupCtlTableStorage, vars)) == NULL) {
+ snmp_free_varbind(vars);
+ vars = NULL;
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ StorageTmp->lookupCtlOperStatus = val;
+
+ snmp_free_varbind(vars);
+ vars = NULL;
+
+ DEBUGMSGTL(("lookupOperStatus", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+int
+modify_lookupCtlTime(struct lookupTable_data *thedata, unsigned long val)
+{
+ netsnmp_variable_list *vars = NULL;
+ struct lookupTable_data *StorageTmp = NULL;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->lookupCtlOwnerIndex, thedata->lookupCtlOwnerIndexLen); /* lookupCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->lookupCtlOperationName, thedata->lookupCtlOperationNameLen); /* lookupCtlOperationName */
+
+
+ if ((StorageTmp =
+ header_complex_get(lookupCtlTableStorage, vars)) == NULL) {
+ snmp_free_varbind(vars);
+ vars = NULL;
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ StorageTmp->lookupCtlTime = val;
+
+ snmp_free_varbind(vars);
+ vars = NULL;
+
+ DEBUGMSGTL(("lookupCtlTime", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+int
+modify_lookupCtlRc(struct lookupTable_data *thedata, long val)
+{
+ netsnmp_variable_list *vars = NULL;
+ struct lookupTable_data *StorageTmp = NULL;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->lookupCtlOwnerIndex, thedata->lookupCtlOwnerIndexLen); /* lookupCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->lookupCtlOperationName, thedata->lookupCtlOperationNameLen); /* lookupCtlOperationName */
+
+
+ if ((StorageTmp =
+ header_complex_get(lookupCtlTableStorage, vars)) == NULL) {
+ snmp_free_varbind(vars);
+ vars = NULL;
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ StorageTmp->lookupCtlRc = val;
+
+ snmp_free_varbind(vars);
+ vars = NULL;
+ DEBUGMSGTL(("lookupOperStatus", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+int
+lookupResultsTable_del(struct lookupTable_data *thedata)
+{
+ struct header_complex_index *hciptr2 = NULL;
+ struct lookupResultsTable_data *StorageDel = NULL;
+ netsnmp_variable_list *vars = NULL;
+ oid newoid[MAX_OID_LEN];
+ size_t newoid_len;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->lookupCtlOwnerIndex, thedata->lookupCtlOwnerIndexLen); /* lookupCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->lookupCtlOperationName, thedata->lookupCtlOperationNameLen); /* lookupCtlOperationName */
+ bzero(newoid, MAX_OID_LEN * sizeof(oid));
+ header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
+
+
+ snmp_free_varbind(vars);
+ vars = NULL;
+ for (hciptr2 = lookupResultsTableStorage; hciptr2 != NULL;
+ hciptr2 = hciptr2->next) {
+ if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
+ == 0) {
+ StorageDel =
+ header_complex_extract_entry(&lookupResultsTableStorage,
+ hciptr2);
+ if (StorageDel != NULL) {
+ SNMP_FREE(StorageDel->lookupCtlOwnerIndex);
+ SNMP_FREE(StorageDel->lookupCtlOperationName);
+ SNMP_FREE(StorageDel->lookupResultsAddress);
+ SNMP_FREE(StorageDel);
+ }
+ DEBUGMSGTL(("lookupResultsTable", "delete success!\n"));
+
+ }
+ }
+ return SNMPERR_SUCCESS;
+}
+
+
+int
+write_lookupCtlTargetAddressType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name,
+ size_t name_len)
+{
+ static size_t tmpvar;
+ struct lookupTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(lookupCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(lookupCtlTableStorage, NULL,
+ &name[sizeof(lookupCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storagetype == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->lookupCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to lookupCtlTargetAddressType not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->lookupCtlTargetAddressType;
+ StorageTmp->lookupCtlTargetAddressType = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->lookupCtlTargetAddressType = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_lookupCtlTargetAddress(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar = NULL;
+ static size_t tmplen;
+ struct lookupTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(lookupCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+ if ((StorageTmp =
+ header_complex(lookupCtlTableStorage, NULL,
+ &name[sizeof(lookupCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storagetype == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->lookupCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to lookupCtlTargetAddress not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->lookupCtlTargetAddress;
+ tmplen = StorageTmp->lookupCtlTargetAddressLen;
+
+ if ((StorageTmp->lookupCtlTargetAddress =
+ (char *) malloc(var_val_len + 1)) == NULL) {
+ exit(1);
+ }
+ memcpy(StorageTmp->lookupCtlTargetAddress, var_val, var_val_len);
+ StorageTmp->lookupCtlTargetAddress[var_val_len] = '\0';
+ StorageTmp->lookupCtlTargetAddressLen = var_val_len;
+
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ free(StorageTmp->lookupCtlTargetAddress);
+ StorageTmp->lookupCtlTargetAddress = NULL;
+ StorageTmp->lookupCtlTargetAddress = tmpvar;
+ StorageTmp->lookupCtlTargetAddressLen = tmplen;
+
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ free(tmpvar);
+ tmpvar = NULL;
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+
+
+int
+write_lookupCtlRowStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ struct lookupTable_data *StorageTmp = NULL;
+ static struct lookupTable_data *StorageNew, *StorageDel = NULL;
+ size_t newlen =
+ name_len - (sizeof(lookupCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+ static int old_value;
+ int set_value;
+ static netsnmp_variable_list *vars, *vp;
+ struct header_complex_index *hciptr = NULL;
+
+ StorageTmp =
+ header_complex(lookupCtlTableStorage, NULL,
+ &name[sizeof(lookupCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL);
+
+ if (var_val_type != ASN_INTEGER || var_val == NULL) {
+ snmp_log(LOG_ERR, "write to lookupCtlRowStatus not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp && StorageTmp->storagetype == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ set_value = *((long *) var_val);
+
+
+ /*
+ * check legal range, and notReady is reserved for us, not a user
+ */
+ if (set_value < 1 || set_value > 6 || set_value == RS_NOTREADY)
+ return SNMP_ERR_INCONSISTENTVALUE;
+
+
+ switch (action) {
+ case RESERVE1:
+ /*
+ * stage one: test validity
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * create the row now?
+ */
+
+
+ /*
+ * ditch illegal values now
+ */
+ if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) {
+
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ /*
+ * destroying a non-existent row is actually legal
+ */
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+
+
+ /*
+ * illegal creation values
+ */
+ if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else {
+ /*
+ * row exists. Check for a valid state change
+ */
+ if (set_value == RS_CREATEANDGO
+ || set_value == RS_CREATEANDWAIT) {
+ /*
+ * can't create a row that exists
+ */
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ /*
+ * XXX: interaction with row storage type needed
+ */
+
+ if (StorageTmp->lookupCtlRowStatus == RS_ACTIVE &&
+ set_value != RS_DESTROY) {
+ /*
+ * "Once made active an entry may not be modified except to
+ * delete it." XXX: doesn't this in fact apply to ALL
+ * columns of the table and not just this one?
+ */
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (StorageTmp->storagetype != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ break;
+
+
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * creation
+ */
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+ vars = NULL;
+
+ /*
+ * ½«nameΪ¿ÕµÄÈý¸öË÷Òý×ֶμӵ½var±äÁ¿ÁбíµÄĩβ
+ */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0); /* lookupCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0); /* lookupCtlOperationName */
+
+ if (header_complex_parse_oid
+ (&
+ (name
+ [sizeof(lookupCtlTable_variables_oid) / sizeof(oid) +
+ 2]), newlen, vars) != SNMPERR_SUCCESS) {
+ /*
+ * XXX: free, zero vars
+ */
+ snmp_free_varbind(vars);
+ vars = NULL;
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+ vp = vars;
+ StorageNew = create_lookupTable_data();
+ StorageNew->lookupCtlOwnerIndex = malloc(vp->val_len + 1);
+ memcpy(StorageNew->lookupCtlOwnerIndex, vp->val.string,
+ vp->val_len);
+ StorageNew->lookupCtlOwnerIndex[vp->val_len] = '\0';
+ StorageNew->lookupCtlOwnerIndexLen = vp->val_len;
+ vp = vp->next_variable;
+
+ StorageNew->lookupCtlOperationName = malloc(vp->val_len + 1);
+ memcpy(StorageNew->lookupCtlOperationName, vp->val.string,
+ vp->val_len);
+ StorageNew->lookupCtlOperationName[vp->val_len] = '\0';
+ StorageNew->lookupCtlOperationNameLen = vp->val_len;
+ vp = vp->next_variable;
+
+ /*
+ * XXX: fill in default row values here into StorageNew
+ */
+
+ StorageNew->lookupCtlTargetAddressType = 1; /* ipv4 */
+
+ StorageNew->lookupCtlRowStatus = set_value;
+
+ snmp_free_varbind(vars);
+ vars = NULL;
+
+ /*
+ * XXX: free, zero vars, no longer needed?
+ */
+ }
+
+
+ break;
+
+
+
+
+ case FREE:
+ /*
+ * XXX: free, zero vars
+ */
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in set_value for you to
+ * use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in
+ * the UNDO case
+ */
+
+
+ if (StorageTmp == NULL) {
+ /*
+ * row creation, so add it
+ */
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+ if (StorageNew != NULL)
+#if 1
+ DEBUGMSGTL(("lookupCtlTable",
+ "write_lookupCtlRowStatus entering new=%d... \n",
+ action));
+#endif
+ lookupCtlTable_add(StorageNew);
+ /*
+ * XXX: ack, and if it is NULL?
+ */
+ } else if (set_value != RS_DESTROY) {
+ /*
+ * set the flag?
+ */
+ old_value = StorageTmp->lookupCtlRowStatus;
+ StorageTmp->lookupCtlRowStatus = *((long *) var_val);
+ } else {
+ /*
+ * destroy... extract it for now
+ */
+ DEBUGMSGTL(("lookupCtlTable",
+ "write_lookupCtlTable_delete 1 \n"));
+ hciptr =
+ header_complex_find_entry(lookupCtlTableStorage,
+ StorageTmp);
+
+ StorageDel =
+ header_complex_extract_entry(&lookupCtlTableStorage,
+ hciptr);
+ lookupResultsTable_del(StorageTmp);
+
+ DEBUGMSGTL(("lookupCtlTable",
+ "write_lookupCtlTable_delete \n"));
+
+ }
+ break;
+
+
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * row creation, so remove it again
+ */
+ hciptr =
+ header_complex_find_entry(lookupCtlTableStorage,
+ StorageTmp);
+ StorageDel =
+ header_complex_extract_entry(&lookupCtlTableStorage,
+ hciptr);
+
+ lookupResultsTable_del(StorageTmp);
+
+ /*
+ * XXX: free it
+ */
+ } else if (StorageDel != NULL) {
+ /*
+ * row deletion, so add it again
+ */
+ lookupCtlTable_add(StorageDel);
+ lookupResultsTable_add(StorageDel);
+ } else {
+ StorageTmp->lookupCtlRowStatus = old_value;
+ }
+ break;
+
+
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ if (StorageTmp == NULL) {
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+ }
+
+ if (StorageDel != NULL) {
+ SNMP_FREE(StorageDel->lookupCtlOwnerIndex);
+ StorageDel->lookupCtlOwnerIndex = NULL;
+ SNMP_FREE(StorageDel->lookupCtlOperationName);
+ StorageDel->lookupCtlOperationName = NULL;
+ SNMP_FREE(StorageDel->lookupCtlTargetAddress);
+ StorageDel->lookupCtlTargetAddress = NULL;
+ SNMP_FREE(StorageDel);
+ StorageDel = NULL;
+
+ StorageDel = 0;
+ /*
+ * XXX: free it, its dead
+ */
+ } else {
+ if (StorageTmp
+ && StorageTmp->lookupCtlRowStatus == RS_CREATEANDGO) {
+ StorageTmp->lookupCtlRowStatus = RS_ACTIVE;
+ } else if (StorageTmp &&
+ StorageTmp->lookupCtlRowStatus ==
+ RS_CREATEANDWAIT) {
+
+ StorageTmp->lookupCtlRowStatus = RS_NOTINSERVICE;
+ }
+ }
+ if (StorageTmp && StorageTmp->lookupCtlRowStatus == RS_ACTIVE) {
+#if 1
+ DEBUGMSGTL(("lookupCtlTable",
+ "write_lookupCtlRowStatus entering runbefore=%ld... \n",
+ StorageTmp->lookupCtlTargetAddressType));
+
+#endif
+ modify_lookupCtlOperStatus(StorageTmp, 2l);
+ run_lookup((struct lookupTable_data *) StorageTmp);
+
+ }
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup/lookupCtlTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup/lookupCtlTable.h
new file mode 100644
index 0000000000..f73b0628ce
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup/lookupCtlTable.h
@@ -0,0 +1,87 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:lookupCtlTable.h
+ *File Description:The head file of lookupCtlTable.c
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+#ifndef LOOKUPCTLTABLE_H
+#define LOOKUPCTLTABLE_H
+
+/*
+ * we may use header_complex from the header_complex module
+ */
+
+
+config_require(header_complex);
+
+ /*
+ * our storage structure(s)
+ */
+struct lookupTable_data {
+
+
+ char *lookupCtlOwnerIndex; /* string */
+ size_t lookupCtlOwnerIndexLen;
+ char *lookupCtlOperationName; /* string */
+ size_t lookupCtlOperationNameLen;
+ long lookupCtlTargetAddressType; /* integer32 */
+ char *lookupCtlTargetAddress; /* string */
+ size_t lookupCtlTargetAddressLen;
+ long lookupCtlOperStatus; /* integer */
+ unsigned long lookupCtlTime; /* unsigned integer */
+ long lookupCtlRc; /* integer32 */
+ long lookupCtlRowStatus; /* integer */
+ int storagetype;
+
+ struct lookupResultsTable_data *ResultsTable;
+
+
+};
+typedef struct lookupResultsTable_data {
+ struct lookupResultsTable_data *next;
+ char *lookupCtlOwnerIndex; /* string */
+ size_t lookupCtlOwnerIndexLen;
+ char *lookupCtlOperationName; /* string */
+ size_t lookupCtlOperationNameLen;
+ unsigned long lookupResultsIndex;
+ long lookupResultsAddressType;
+ char *lookupResultsAddress;
+ size_t lookupResultsAddressLen;
+ int storagetype;
+} resultsIns;
+
+/*
+ * function declarations
+ */
+void init_lookupCtlTable(void);
+FindVarMethod var_lookupCtlTable;
+void parse_lookupCtlTable(const char *, char *);
+SNMPCallback store_lookupCtlTable;
+
+
+WriteMethod write_lookupCtlTargetAddressType;
+WriteMethod write_lookupCtlTargetAddress;
+WriteMethod write_lookupCtlRowStatus;
+
+WriteMethod write_lookupCtlRowStatus;
+
+/*
+ * column number definitions for table lookupCtlTable
+ */
+#define COLUMN_LOOKUPCTLOWNERINDEX 1
+#define COLUMN_LOOKUPCTLOPERATIONNAME 2
+#define COLUMN_LOOKUPCTLTARGETADDRESSTYPE 3
+#define COLUMN_LOOKUPCTLTARGETADDRESS 4
+#define COLUMN_LOOKUPCTLOPERSTATUS 5
+#define COLUMN_LOOKUPCTLTIME 6
+#define COLUMN_LOOKUPCTLRC 7
+#define COLUMN_LOOKUPCTLROWSTATUS 8
+
+#endif /* LOOKUPMIB_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup/lookupResultsTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup/lookupResultsTable.c
new file mode 100644
index 0000000000..b011140779
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup/lookupResultsTable.c
@@ -0,0 +1,309 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:lookupResultsTable.c
+ *File Description:Rows of the lookupResultsTable MIB read.
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+/*
+ * This should always be included first before anything else
+ */
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+
+
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "lookupCtlTable.h"
+#include "lookupResultsTable.h"
+#include "header_complex.h"
+
+
+oid lookupResultsTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 82, 1, 4 };
+
+struct variable2 lookupResultsTable_variables[] = {
+ {COLUMN_LOOKUPRESULTSADDRESSTYPE, ASN_INTEGER, RONLY, var_lookupResultsTable, 2, {1, 2}},
+ {COLUMN_LOOKUPRESULTSADDRESS, ASN_OCTET_STR, RONLY, var_lookupResultsTable, 2, {1, 3}}
+};
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+
+extern struct header_complex_index *lookupCtlTableStorage;
+extern struct header_complex_index *lookupResultsTableStorage;
+
+void
+lookupResultsTable_cleaner(struct header_complex_index *thestuff)
+{
+ struct header_complex_index *hciptr = NULL;
+ struct lookupResultsTable_data *StorageDel = NULL;
+ DEBUGMSGTL(("lookupResultsTable", "cleanerout "));
+ for (hciptr = thestuff; hciptr != NULL; hciptr = hciptr->next) {
+ StorageDel =
+ header_complex_extract_entry(&lookupResultsTableStorage,
+ hciptr);
+ if (StorageDel != NULL) {
+ SNMP_FREE(StorageDel->lookupCtlOwnerIndex);
+ SNMP_FREE(StorageDel->lookupCtlOperationName);
+ SNMP_FREE(StorageDel->lookupResultsAddress);
+ SNMP_FREE(StorageDel);
+ }
+ DEBUGMSGTL(("lookupResultsTable", "cleaner "));
+ }
+
+}
+void
+init_lookupResultsTable(void)
+{
+
+ DEBUGMSGTL(("lookupResultsTable", "initializing... "));
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("lookupResultsTable", lookupResultsTable_variables,
+ variable2, lookupResultsTable_variables_oid);
+
+
+ /*
+ * register our config handler(s) to deal with registrations
+ */
+ snmpd_register_config_handler("lookupResultsTable",
+ parse_lookupResultsTable, NULL, NULL);
+
+ /*
+ * we need to be called back later to store our data
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_lookupResultsTable, NULL);
+
+ DEBUGMSGTL(("lookupResultsTable", "done.\n"));
+}
+
+/*
+ * parse_mteObjectsTable():
+ * parses .conf file entries needed to configure the mib.
+ */
+
+void
+parse_lookupResultsTable(const char *token, char *line)
+{
+ size_t tmpint;
+ struct lookupResultsTable_data *StorageTmp =
+ SNMP_MALLOC_STRUCT(lookupResultsTable_data);
+
+ DEBUGMSGTL(("lookupResultsTable", "parsing config... "));
+
+
+ if (StorageTmp == NULL) {
+ config_perror("malloc failure");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->lookupCtlOwnerIndex,
+ &StorageTmp->lookupCtlOwnerIndexLen);
+ if (StorageTmp->lookupCtlOwnerIndex == NULL) {
+ config_perror("invalid specification for lookupCtlOwnerIndex");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->lookupCtlOperationName,
+ &StorageTmp->lookupCtlOperationNameLen);
+ if (StorageTmp->lookupCtlOperationName == NULL) {
+ config_perror("invalid specification for lookupCtlOperationName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->lookupResultsIndex, &tmpint);
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->lookupResultsAddressType,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->lookupResultsAddress,
+ &StorageTmp->lookupResultsAddressLen);
+ if (StorageTmp->lookupResultsAddress == NULL) {
+ config_perror("invalid specification for lookupResultsAddress");
+ return;
+ }
+
+
+ lookupResultsTable_inadd(StorageTmp);
+
+ /* lookupResultsTable_cleaner(lookupResultsTableStorage); */
+
+ DEBUGMSGTL(("lookupResultsTable", "done.\n"));
+}
+
+
+
+
+
+/*
+ * store_lookupResultsTable():
+ * stores .conf file entries needed to configure the mib.
+ */
+
+int
+store_lookupResultsTable(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr = NULL;
+ size_t tmpint;
+ struct lookupResultsTable_data *StorageTmp = NULL;
+ struct header_complex_index *hcindex = NULL;
+
+
+ DEBUGMSGTL(("lookupResultsTable", "storing data... "));
+
+
+ for (hcindex = lookupResultsTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ StorageTmp = (struct lookupResultsTable_data *) hcindex->data;
+
+ if (StorageTmp->storagetype != ST_READONLY) {
+ memset(line, 0, sizeof(line));
+ strcat(line, "lookupResultsTable ");
+ cptr = line + strlen(line);
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->lookupCtlOwnerIndex,
+ &StorageTmp->
+ lookupCtlOwnerIndexLen);
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->lookupCtlOperationName,
+ &StorageTmp->
+ lookupCtlOperationNameLen);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->lookupResultsIndex,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ lookupResultsAddressType, &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->lookupResultsAddress,
+ &StorageTmp->
+ lookupResultsAddressLen);
+
+ snmpd_store_config(line);
+ }
+ }
+ DEBUGMSGTL(("lookupResultsTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+int
+lookupResultsTable_inadd(struct lookupResultsTable_data *thedata)
+{
+ netsnmp_variable_list *vars_list = NULL;
+
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->lookupCtlOwnerIndex, thedata->lookupCtlOwnerIndexLen); /* lookupCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->lookupCtlOperationName, thedata->lookupCtlOperationNameLen); /* lookupCtlOperationName */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->lookupResultsIndex, sizeof(thedata->lookupResultsIndex)); /* lookupResultsIndex */
+
+ /*
+ * XXX: fill in default row values here into StorageNew
+ *
+ */
+
+
+ DEBUGMSGTL(("lookupResultsTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+ header_complex_add_data(&lookupResultsTableStorage, vars_list,
+ thedata);
+ DEBUGMSGTL(("lookupResultsTable", "registered an entry\n"));
+
+
+ DEBUGMSGTL(("lookupResultsTable", "done.\n"));
+ vars_list = NULL;
+ return SNMPERR_SUCCESS;
+}
+
+
+/*
+ * var_lookupResultsTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_lookupResultsTable above.
+ */
+unsigned char *
+var_lookupResultsTable(struct variable *vp,
+ oid * name,
+ size_t *length,
+ int exact,
+ size_t *var_len, WriteMethod ** write_method)
+{
+
+
+ struct lookupResultsTable_data *StorageTmp = NULL;
+
+ *write_method = NULL;
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(lookupResultsTableStorage, vp, name, length, exact,
+ var_len, write_method)) == NULL) {
+ return NULL;
+ }
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+
+ switch (vp->magic) {
+
+ case COLUMN_LOOKUPRESULTSADDRESSTYPE:
+ *var_len = sizeof(StorageTmp->lookupResultsAddressType);
+ return (u_char *) & StorageTmp->lookupResultsAddressType;
+
+ case COLUMN_LOOKUPRESULTSADDRESS:
+ *var_len = (StorageTmp->lookupResultsAddressLen);
+ return (u_char *) StorageTmp->lookupResultsAddress;
+
+ default:
+ ERROR_MSG("");
+ }
+
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup/lookupResultsTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup/lookupResultsTable.h
new file mode 100644
index 0000000000..4abfb115ae
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/nslookup/lookupResultsTable.h
@@ -0,0 +1,39 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:lookupResultsTable.h
+ *File Description:The head file of lookupResultsTable.c
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+
+#ifndef LOOKUPRESULTSTABLE_H
+#define LOOKUPRESULTSTABLE_H
+
+/*
+ * we may use header_complex from the header_complex module
+ */
+
+
+config_require(header_complex);
+
+/*
+ * function declarations
+ */
+void init_lookupResultsTable(void);
+FindVarMethod var_lookupResultsTable;
+void parse_lookupResultsTable(const char *, char *);
+SNMPCallback store_lookupResultsTable;
+
+/*
+ * column number definitions for table lookupResultsTable
+ */
+#define COLUMN_LOOKUPRESULTSINDEX 1
+#define COLUMN_LOOKUPRESULTSADDRESSTYPE 2
+#define COLUMN_LOOKUPRESULTSADDRESS 3
+#endif /* LOOKUPMIB_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/old-event-mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/old-event-mib.h
new file mode 100644
index 0000000000..71ef1f528d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/old-event-mib.h
@@ -0,0 +1,33 @@
+config_add_mib(DISMAN-EVENT-MIB)
+
+/*
+ * wrapper for the original disman event mib implementation code files
+ */
+config_require(disman/mteTriggerTable)
+config_require(disman/mteTriggerDeltaTable)
+config_require(disman/mteTriggerExistenceTable)
+config_require(disman/mteTriggerBooleanTable)
+config_require(disman/mteTriggerThresholdTable)
+config_require(disman/mteObjectsTable)
+config_require(disman/mteEventTable)
+config_require(disman/mteEventNotificationTable)
+
+/*
+ * conflicts with the new implementation
+ */
+config_exclude(disman/event/mteScalars)
+config_exclude(disman/event/mteTrigger)
+config_exclude(disman/event/mteTriggerTable)
+config_exclude(disman/event/mteTriggerDeltaTable)
+config_exclude(disman/event/mteTriggerExistenceTable)
+config_exclude(disman/event/mteTriggerBooleanTable)
+config_exclude(disman/event/mteTriggerThresholdTable)
+config_exclude(disman/event/mteTriggerConf)
+config_exclude(disman/event/mteEvent)
+config_exclude(disman/event/mteEventTable)
+config_exclude(disman/event/mteEventSetTable)
+config_exclude(disman/event/mteEventNotificationTable)
+config_exclude(disman/event/mteEventConf)
+config_exclude(disman/event/mteObjects)
+config_exclude(disman/event/mteObjectsTable)
+config_exclude(disman/event/mteObjectsConf)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping-mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping-mib.h
new file mode 100644
index 0000000000..640b37f9b8
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping-mib.h
@@ -0,0 +1,20 @@
+/*
+*Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+*
+*All right reserved
+*
+*File Name:ping-mib.h
+*File Description:Add DISMAN-PING-MIB.
+*
+*Current Version:1.0
+*Author:ChenJing
+*Date:2004.8.20
+*/
+
+/*
+ * wrapper for the disman ping mib code files
+ */
+config_require(disman/ping/pingCtlTable)
+config_require(disman/ping/pingResultsTable)
+config_require(disman/ping/pingProbeHistoryTable)
+config_add_mib(DISMAN-PING-MIB)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingCtlTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingCtlTable.c
new file mode 100644
index 0000000000..b16f03d40f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingCtlTable.c
@@ -0,0 +1,5804 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:pingCtlTable.c
+ *File Description:Rows of the pingCtlTable MIB add , delete and read.Rows of lookupResultsTable
+ * MIB add and delete.Rows of pingProbeHistoryTable MIB add and delete.
+ * The main function is also here.
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+/*
+ * This should always be included first before anything else
+ */
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#include <netdb.h>
+#include <netinet/in.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "pingCtlTable.h"
+#include "pingResultsTable.h"
+#include "pingProbeHistoryTable.h"
+#include "header_complex.h"
+
+
+/*
+ *pingCtlTable_variables_oid:
+ *
+ */
+
+
+oid pingCtlTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 80, 1, 2 };
+
+/* trap */
+oid pingProbeFailed[] = { 1, 3, 6, 1, 2, 1, 80, 0, 1 };
+oid pingTestFailed[] = { 1, 3, 6, 1, 2, 1, 80, 0, 2 };
+oid pingTestCompleted[] = { 1, 3, 6, 1, 2, 1, 80, 0, 3 };
+
+
+struct variable2 pingCtlTable_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+ {COLUMN_PINGCTLTARGETADDRESSTYPE, ASN_INTEGER, RWRITE, var_pingCtlTable, 2, {1, 3}},
+ {COLUMN_PINGCTLTARGETADDRESS, ASN_OCTET_STR, RWRITE, var_pingCtlTable, 2, {1, 4}},
+ {COLUMN_PINGCTLDATASIZE, ASN_UNSIGNED, RONLY, var_pingCtlTable, 2, {1, 5}},
+ {COLUMN_PINGCTLTIMEOUT, ASN_UNSIGNED, RONLY, var_pingCtlTable, 2, {1, 6}},
+ {COLUMN_PINGCTLPROBECOUNT, ASN_UNSIGNED, RONLY, var_pingCtlTable, 2, {1, 7}},
+ {COLUMN_PINGCTLADMINSTATUS, ASN_INTEGER, RWRITE, var_pingCtlTable, 2, {1, 8}},
+ {COLUMN_PINGCTLDATAFILL, ASN_OCTET_STR, RWRITE, var_pingCtlTable, 2, {1, 9}},
+ {COLUMN_PINGCTLFREQUENCY, ASN_UNSIGNED, RWRITE, var_pingCtlTable, 2, {1, 10}},
+ {COLUMN_PINGCTLMAXROWS, ASN_UNSIGNED, RWRITE, var_pingCtlTable, 2, {1, 11}},
+ {COLUMN_PINGCTLSTORAGETYPE, ASN_INTEGER, RWRITE, var_pingCtlTable, 2, {1, 12}},
+ {COLUMN_PINGCTLTRAPGENERATION, ASN_OCTET_STR, RWRITE, var_pingCtlTable, 2, {1, 13}},
+ {COLUMN_PINGCTLTRAPPROBEFAILUREFILTER, ASN_UNSIGNED, RWRITE, var_pingCtlTable, 2, {1, 14}},
+ {COLUMN_PINGCTLTRAPTESTFAILUREFILTER, ASN_UNSIGNED, RWRITE, var_pingCtlTable, 2, {1, 15}},
+ {COLUMN_PINGCTLTYPE, ASN_OBJECT_ID, RWRITE, var_pingCtlTable, 2, {1, 16}},
+ {COLUMN_PINGCTLDESCR, ASN_OCTET_STR, RWRITE, var_pingCtlTable, 2, {1, 17}},
+ {COLUMN_PINGCTLSOURCEADDRESSTYPE, ASN_INTEGER, RWRITE, var_pingCtlTable, 2, {1, 18}},
+ {COLUMN_PINGCTLSOURCEADDRESS, ASN_OCTET_STR, RWRITE, var_pingCtlTable, 2, {1, 19}},
+ {COLUMN_PINGCTLIFINDEX, ASN_INTEGER, RWRITE, var_pingCtlTable, 2, {1, 20}},
+ {COLUMN_PINGCTLBYPASSROUTETABLE, ASN_INTEGER, RWRITE, var_pingCtlTable, 2, {1, 21}},
+ {COLUMN_PINGCTLDSFIELD, ASN_UNSIGNED, RWRITE, var_pingCtlTable, 2, {1, 22}},
+ {COLUMN_PINGCTLROWSTATUS, ASN_INTEGER, RWRITE, var_pingCtlTable, 2, {1, 23}}
+};
+
+
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+
+
+struct header_complex_index *pingCtlTableStorage = NULL;
+struct header_complex_index *pingResultsTableStorage = NULL;
+struct header_complex_index *pingProbeHistoryTableStorage = NULL;
+
+void
+init_pingCtlTable(void)
+{
+ DEBUGMSGTL(("pingCtlTable", "initializing... "));
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("pingCtlTable", pingCtlTable_variables, variable2,
+ pingCtlTable_variables_oid);
+
+
+ /*
+ * register our config handler(s) to deal with registrations
+ */
+ snmpd_register_config_handler("pingCtlTable", parse_pingCtlTable,
+ NULL, NULL);
+
+ /*
+ * we need to be called back later to store our data
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_pingCtlTable, NULL);
+
+ DEBUGMSGTL(("pingCtlTable", "done.\n"));
+}
+
+struct pingCtlTable_data *
+create_pingCtlTable_data(void)
+{
+ struct pingCtlTable_data *StorageNew = NULL;
+ StorageNew = SNMP_MALLOC_STRUCT(pingCtlTable_data);
+ if (StorageNew == NULL) {
+ exit(1);
+ }
+ StorageNew->pingCtlTargetAddressType = 1;
+ StorageNew->pingCtlTargetAddress = strdup("");
+ StorageNew->pingCtlTargetAddressLen = 0;
+ StorageNew->pingCtlDataSize = 0;
+ StorageNew->pingCtlTimeOut = 3;
+ StorageNew->pingCtlProbeCount = 1;
+ StorageNew->pingCtlAdminStatus = 2;
+ StorageNew->pingCtlDataFill = (char *) malloc(strlen("00") + 1);
+ if (StorageNew->pingCtlDataFill == NULL) {
+ exit(1);
+ }
+ memcpy(StorageNew->pingCtlDataFill, "00", strlen("00") + 1);
+ StorageNew->pingCtlDataFill[strlen("00")] = '\0';
+ StorageNew->pingCtlDataFillLen = strlen(StorageNew->pingCtlDataFill);
+ StorageNew->pingCtlFrequency = 0;
+ StorageNew->pingCtlMaxRows = 50;
+ StorageNew->pingCtlStorageType = 1;
+ StorageNew->pingCtlTrapGeneration = strdup("");
+ StorageNew->pingCtlTrapGenerationLen = 0;
+ StorageNew->pingCtlTrapGenerationLen = 0;
+ StorageNew->pingCtlTrapProbeFailureFilter = 1;
+ StorageNew->pingCtlTrapTestFailureFilter = 1;
+ StorageNew->pingCtlType = calloc(1, sizeof(oid) * sizeof(2)); /* 0.0 */
+ StorageNew->pingCtlTypeLen = 2;
+ StorageNew->pingCtlDescr = strdup("");
+ StorageNew->pingCtlDescrLen = 0;
+ StorageNew->pingCtlSourceAddressType = 1;
+ StorageNew->pingCtlSourceAddress = strdup("");
+ StorageNew->pingCtlSourceAddressLen = 0;
+ StorageNew->pingCtlIfIndex = 0;
+ StorageNew->pingCtlByPassRouteTable = 2;
+ StorageNew->pingCtlDSField = 0;
+ StorageNew->pingResults = NULL;
+ StorageNew->pingProbeHis = NULL;
+
+ StorageNew->storageType = ST_NONVOLATILE;
+ StorageNew->pingProbeHistoryMaxIndex = 0;
+ return StorageNew;
+}
+
+/*
+ * pingCtlTable_add(): adds a structure node to our data set
+ */
+int
+pingCtlTable_add(struct pingCtlTable_data *thedata)
+{
+ netsnmp_variable_list *vars = NULL;
+
+
+ DEBUGMSGTL(("pingCtlTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlOwnerIndex, thedata->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlTestName, thedata->pingCtlTestNameLen); /* pingCtlOperationName */
+
+
+ header_complex_add_data(&pingCtlTableStorage, vars, thedata);
+
+ DEBUGMSGTL(("pingCtlTable", "registered an entry\n"));
+ vars = NULL;
+ DEBUGMSGTL(("pingCtlTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+int
+pingResultsTable_add(struct pingCtlTable_data *thedata)
+{
+ netsnmp_variable_list *vars_list = NULL;
+ struct pingResultsTable_data *p = NULL;
+ p = thedata->pingResults;
+ if (thedata->pingResults != NULL) {
+
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->pingCtlOwnerIndex, p->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->pingCtlTestName, p->pingCtlTestNameLen); /* pingCtlOperationName */
+
+ /*
+ * XXX: fill in default row values here into StorageNew
+ *
+ */
+
+
+ DEBUGMSGTL(("pingResultsTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+ header_complex_add_data(&pingResultsTableStorage, vars_list, p);
+
+ DEBUGMSGTL(("pingResultsTable", "out finished\n"));
+
+ }
+
+ DEBUGMSGTL(("pingResultsTable", "done.\n"));
+ vars_list = NULL;
+ return SNMPERR_SUCCESS;
+}
+
+
+int
+pingProbeHistoryTable_add(struct pingProbeHistoryTable_data *thedata)
+{
+ netsnmp_variable_list *vars_list;
+ vars_list = NULL;
+ if (thedata != NULL) {
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlOwnerIndex, thedata->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlTestName, thedata->pingCtlTestNameLen); /* pingCtlTestName */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->pingProbeHistoryIndex, sizeof(thedata->pingProbeHistoryIndex)); /* pingProbeHistoryIndex */
+
+ /*
+ * XXX: fill in default row values here into StorageNew
+ *
+ */
+
+
+ DEBUGMSGTL(("pingProbeHistoryTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+ header_complex_add_data(&pingProbeHistoryTableStorage, vars_list,
+ thedata);
+ DEBUGMSGTL(("pingProbeHistoryTable", "out finished\n"));
+ }
+
+ vars_list = NULL;
+ DEBUGMSGTL(("pingProbeHistoryTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+int
+pingProbeHistoryTable_addall(struct pingCtlTable_data *thedata)
+{
+ netsnmp_variable_list *vars_list = NULL;
+ struct pingProbeHistoryTable_data *p = NULL;
+ p = thedata->pingProbeHis;
+ if (thedata->pingProbeHis != NULL)
+ do {
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->pingCtlOwnerIndex, p->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->pingCtlTestName, p->pingCtlTestNameLen); /* pingCtlTestName */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &p->pingProbeHistoryIndex, sizeof(p->pingProbeHistoryIndex)); /* pingProbeHistoryIndex */
+
+ /*
+ * XXX: fill in default row values here into StorageNew
+ *
+ */
+
+
+ DEBUGMSGTL(("pingProbeHistoryTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+ header_complex_add_data(&pingProbeHistoryTableStorage,
+ vars_list, p);
+
+
+ DEBUGMSGTL(("pingProbeHistoryTable", "out finished\n"));
+ vars_list = NULL;
+ p = p->next;
+ } while (p != NULL);
+
+ DEBUGMSGTL(("pingProbeHistoryTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+void
+pingCtlTable_cleaner(struct header_complex_index *thestuff)
+{
+ struct header_complex_index *hciptr = NULL;
+ struct pingCtlTable_data *StorageDel = NULL;
+ DEBUGMSGTL(("pingProbeHistoryTable", "cleanerout "));
+ for (hciptr = thestuff; hciptr != NULL; hciptr = hciptr->next) {
+ StorageDel =
+ header_complex_extract_entry(&pingCtlTableStorage, hciptr);
+ DEBUGMSGTL(("pingProbeHistoryTable", "cleaner "));
+ }
+}
+
+/*
+ * parse_mteObjectsTable():
+ * parses .conf file entries needed to configure the mib.
+ */
+void
+parse_pingCtlTable(const char *token, char *line)
+{
+ size_t tmpint;
+ struct pingCtlTable_data *StorageTmp =
+ SNMP_MALLOC_STRUCT(pingCtlTable_data);
+
+ DEBUGMSGTL(("pingCtlTable", "parsing config... "));
+
+
+ if (StorageTmp == NULL) {
+ config_perror("malloc failure");
+ return;
+ }
+
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pingCtlOwnerIndex,
+ &StorageTmp->pingCtlOwnerIndexLen);
+ if (StorageTmp->pingCtlOwnerIndex == NULL) {
+ config_perror("invalid specification for pingCtlOwnerIndex");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pingCtlTestName,
+ &StorageTmp->pingCtlTestNameLen);
+ if (StorageTmp->pingCtlTestName == NULL) {
+ config_perror("invalid specification for pingCtlTestName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pingCtlTargetAddressType,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pingCtlTargetAddress,
+ &StorageTmp->pingCtlTargetAddressLen);
+ if (StorageTmp->pingCtlTargetAddress == NULL) {
+ config_perror("invalid specification for pingCtlTargetAddress");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingCtlDataSize, &tmpint);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingCtlTimeOut, &tmpint);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingCtlProbeCount, &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pingCtlAdminStatus, &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pingCtlDataFill,
+ &StorageTmp->pingCtlDataFillLen);
+ if (StorageTmp->pingCtlDataFill == NULL) {
+ config_perror("invalid specification for pingCtlDataFill");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingCtlFrequency, &tmpint);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingCtlMaxRows, &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pingCtlStorageType, &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pingCtlTrapGeneration,
+ &StorageTmp->pingCtlTrapGenerationLen);
+ if (StorageTmp->pingCtlTrapGeneration == NULL) {
+ config_perror("invalid specification for pingCtlTrapGeneration");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingCtlTrapProbeFailureFilter,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingCtlTrapTestFailureFilter,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_OBJECT_ID, line,
+ &StorageTmp->pingCtlType,
+ &StorageTmp->pingCtlTypeLen);
+ if (StorageTmp->pingCtlType == NULL) {
+ config_perror("invalid specification for pingCtlType");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pingCtlDescr,
+ &StorageTmp->pingCtlDescrLen);
+ if (StorageTmp->pingCtlDescr == NULL) {
+ config_perror("invalid specification for pingCtlTrapDescr");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pingCtlSourceAddressType,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pingCtlSourceAddress,
+ &StorageTmp->pingCtlSourceAddressLen);
+ if (StorageTmp->pingCtlSourceAddress == NULL) {
+ config_perror("invalid specification for pingCtlSourceAddress");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pingCtlIfIndex, &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pingCtlByPassRouteTable,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingCtlDSField, &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pingCtlRowStatus, &tmpint);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingProbeHistoryMaxIndex,
+ &tmpint);
+
+ StorageTmp->storageType = ST_NONVOLATILE;
+ pingCtlTable_add(StorageTmp);
+ /* pingCtlTable_cleaner(pingCtlTableStorage); */
+
+ DEBUGMSGTL(("pingCtlTable", "done.\n"));
+}
+
+
+
+/*
+ * store_pingCtlTable():
+ * stores .conf file entries needed to configure the mib.
+ */
+int
+store_pingCtlTable(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr = NULL;
+ size_t tmpint;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ struct header_complex_index *hcindex = NULL;
+
+
+ DEBUGMSGTL(("pingCtlTable", "storing data... "));
+
+
+ for (hcindex = pingCtlTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ StorageTmp = (struct pingCtlTable_data *) hcindex->data;
+
+ if (StorageTmp->storageType != ST_READONLY) {
+ memset(line, 0, sizeof(line));
+ strcat(line, "pingCtlTable ");
+ cptr = line + strlen(line);
+
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pingCtlOwnerIndex,
+ &StorageTmp->pingCtlOwnerIndexLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pingCtlTestName,
+ &StorageTmp->pingCtlTestNameLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ pingCtlTargetAddressType, &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pingCtlTargetAddress,
+ &StorageTmp->
+ pingCtlTargetAddressLen);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->pingCtlDataSize,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->pingCtlTimeOut,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->pingCtlProbeCount,
+ &tmpint);
+
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->pingCtlAdminStatus,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pingCtlDataFill,
+ &StorageTmp->pingCtlDataFillLen);
+
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->pingCtlFrequency,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->pingCtlMaxRows,
+ &tmpint);
+
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->pingCtlStorageType,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pingCtlTrapGeneration,
+ &StorageTmp->
+ pingCtlTrapGenerationLen);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ pingCtlTrapProbeFailureFilter,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ pingCtlTrapTestFailureFilter,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OBJECT_ID, cptr,
+ &StorageTmp->pingCtlType,
+ &StorageTmp->pingCtlTypeLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pingCtlDescr,
+ &StorageTmp->pingCtlDescrLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ pingCtlSourceAddressType, &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pingCtlSourceAddress,
+ &StorageTmp->
+ pingCtlSourceAddressLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->pingCtlIfIndex,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ pingCtlByPassRouteTable, &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->pingCtlDSField,
+ &tmpint);
+
+ if (StorageTmp->pingCtlRowStatus == RS_ACTIVE)
+ StorageTmp->pingCtlRowStatus = RS_NOTINSERVICE;
+
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->pingCtlRowStatus,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ pingProbeHistoryMaxIndex, &tmpint);
+
+
+
+ snmpd_store_config(line);
+ }
+ }
+ DEBUGMSGTL(("pingCtlTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+
+
+/*
+ * var_pingCtlTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_mteObjectsTable above.
+ */
+unsigned char *
+var_pingCtlTable(struct variable *vp,
+ oid * name,
+ size_t *length,
+ int exact, size_t *var_len, WriteMethod ** write_method)
+{
+
+
+ struct pingCtlTable_data *StorageTmp = NULL;
+
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, vp, name, length, exact,
+ var_len, write_method)) == NULL) {
+ if (vp->magic == COLUMN_PINGCTLROWSTATUS)
+ *write_method = write_pingCtlRowStatus;
+ return NULL;
+ }
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+
+
+ case COLUMN_PINGCTLTARGETADDRESSTYPE:
+ *write_method = write_pingCtlTargetAddressType;
+ *var_len = sizeof(StorageTmp->pingCtlTargetAddressType);
+ return (u_char *) & StorageTmp->pingCtlTargetAddressType;
+
+ case COLUMN_PINGCTLTARGETADDRESS:
+ *write_method = write_pingCtlTargetAddress;
+ *var_len = (StorageTmp->pingCtlTargetAddressLen);
+
+ return (u_char *) StorageTmp->pingCtlTargetAddress;
+
+ case COLUMN_PINGCTLDATASIZE:
+ *write_method = write_pingCtlDataSize;
+ *var_len = sizeof(StorageTmp->pingCtlDataSize);
+
+ return (u_char *) & StorageTmp->pingCtlDataSize;
+
+ case COLUMN_PINGCTLTIMEOUT:
+ *write_method = write_pingCtlTimeOut;
+ *var_len = sizeof(StorageTmp->pingCtlTimeOut);
+
+ return (u_char *) & StorageTmp->pingCtlTimeOut;
+
+ case COLUMN_PINGCTLPROBECOUNT:
+ *write_method = write_pingCtlProbeCount;
+ *var_len = sizeof(StorageTmp->pingCtlProbeCount);
+
+ return (u_char *) & StorageTmp->pingCtlProbeCount;
+
+ case COLUMN_PINGCTLADMINSTATUS:
+ *write_method = write_pingCtlAdminStatus;
+ *var_len = sizeof(StorageTmp->pingCtlAdminStatus);
+
+ return (u_char *) & StorageTmp->pingCtlAdminStatus;
+
+ case COLUMN_PINGCTLDATAFILL:
+ *write_method = write_pingCtlDataFill;
+ *var_len = (StorageTmp->pingCtlDataFillLen);
+
+ return (u_char *) StorageTmp->pingCtlDataFill;
+
+ case COLUMN_PINGCTLFREQUENCY:
+ *write_method = write_pingCtlFrequency;
+ *var_len = sizeof(StorageTmp->pingCtlFrequency);
+
+ return (u_char *) & StorageTmp->pingCtlFrequency;
+
+ case COLUMN_PINGCTLMAXROWS:
+ *write_method = write_pingCtlMaxRows;
+ *var_len = sizeof(StorageTmp->pingCtlMaxRows);
+
+ return (u_char *) & StorageTmp->pingCtlMaxRows;
+
+ case COLUMN_PINGCTLSTORAGETYPE:
+ *write_method = write_pingCtlStorageType;
+ *var_len = sizeof(StorageTmp->pingCtlStorageType);
+
+ return (u_char *) & StorageTmp->pingCtlStorageType;
+
+ case COLUMN_PINGCTLTRAPGENERATION:
+ *write_method = write_pingCtlTrapGeneration;
+ *var_len = (StorageTmp->pingCtlTrapGenerationLen);
+
+ return (u_char *) StorageTmp->pingCtlTrapGeneration;
+
+ case COLUMN_PINGCTLTRAPPROBEFAILUREFILTER:
+ *write_method = write_pingCtlTrapProbeFailureFilter;
+ *var_len = sizeof(StorageTmp->pingCtlTrapProbeFailureFilter);
+
+ return (u_char *) & StorageTmp->pingCtlTrapProbeFailureFilter;
+
+ case COLUMN_PINGCTLTRAPTESTFAILUREFILTER:
+ *write_method = write_pingCtlTrapTestFailureFilter;
+ *var_len = sizeof(StorageTmp->pingCtlTrapTestFailureFilter);
+
+ return (u_char *) & StorageTmp->pingCtlTrapTestFailureFilter;
+
+ case COLUMN_PINGCTLTYPE:
+ *write_method = write_pingCtlType;
+ *var_len = (StorageTmp->pingCtlTypeLen) * sizeof(oid);
+
+ return (u_char *) StorageTmp->pingCtlType;
+
+ case COLUMN_PINGCTLDESCR:
+ *write_method = write_pingCtlDescr;
+ *var_len = (StorageTmp->pingCtlDescrLen);
+
+ return (u_char *) StorageTmp->pingCtlDescr;
+
+ case COLUMN_PINGCTLSOURCEADDRESSTYPE:
+ *write_method = write_pingCtlSourceAddressType;
+ *var_len = sizeof(StorageTmp->pingCtlSourceAddressType);
+
+ return (u_char *) & StorageTmp->pingCtlSourceAddressType;
+
+ case COLUMN_PINGCTLSOURCEADDRESS:
+ *write_method = write_pingCtlSourceAddress;
+ *var_len = (StorageTmp->pingCtlSourceAddressLen);
+
+ return (u_char *) StorageTmp->pingCtlSourceAddress;
+
+ case COLUMN_PINGCTLIFINDEX:
+ *write_method = write_pingCtlIfIndex;
+ *var_len = sizeof(StorageTmp->pingCtlIfIndex);
+
+ return (u_char *) & StorageTmp->pingCtlIfIndex;
+
+ case COLUMN_PINGCTLBYPASSROUTETABLE:
+ *write_method = write_pingCtlByPassRouteTable;
+ *var_len = sizeof(StorageTmp->pingCtlByPassRouteTable);
+
+ return (u_char *) & StorageTmp->pingCtlByPassRouteTable;
+
+ case COLUMN_PINGCTLDSFIELD:
+ *write_method = write_pingCtlDSField;
+ *var_len = sizeof(StorageTmp->pingCtlDSField);
+
+ return (u_char *) & StorageTmp->pingCtlDSField;
+
+
+
+ case COLUMN_PINGCTLROWSTATUS:
+ *write_method = write_pingCtlRowStatus;
+ *var_len = sizeof(StorageTmp->pingCtlRowStatus);
+
+ return (u_char *) & StorageTmp->pingCtlRowStatus;
+
+ default:
+ ERROR_MSG("");
+ }
+ return NULL;
+}
+
+
+unsigned long
+pingProbeHistoryTable_count(struct pingCtlTable_data *thedata)
+{
+ struct header_complex_index *hciptr2 = NULL;
+ netsnmp_variable_list *vars = NULL;
+ oid newoid[MAX_OID_LEN];
+ size_t newoid_len;
+ unsigned long count = 0;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlOwnerIndex, thedata->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlTestName, thedata->pingCtlTestNameLen); /* pingCtlOperationName */
+
+ header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
+
+ for (hciptr2 = pingProbeHistoryTableStorage; hciptr2 != NULL;
+ hciptr2 = hciptr2->next) {
+ if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
+ == 0) {
+ count = count + 1;
+ }
+ }
+ return count;
+}
+
+
+
+
+int
+pingProbeHistoryTable_delLast(struct pingCtlTable_data *thedata)
+{
+ struct header_complex_index *hciptr2 = NULL;
+ struct header_complex_index *hcilast = NULL;
+ struct pingProbeHistoryTable_data *StorageDel = NULL;
+ struct pingProbeHistoryTable_data *StorageTmp = NULL;
+ netsnmp_variable_list *vars = NULL;
+ oid newoid[MAX_OID_LEN];
+ size_t newoid_len;
+ time_t last_time = 2147483647;
+ struct tm *tp;
+
+ tp = (struct tm *) malloc(sizeof(struct tm));
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlOwnerIndex, thedata->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlTestName, thedata->pingCtlTestNameLen); /* pingCtlOperationName */
+
+ header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
+
+ for (hcilast = hciptr2 = pingProbeHistoryTableStorage; hciptr2 != NULL;
+ hciptr2 = hciptr2->next) {
+ if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
+ == 0) {
+
+ StorageTmp =
+ header_complex_get_from_oid(pingProbeHistoryTableStorage,
+ hciptr2->name,
+ hciptr2->namelen);
+ strptime(StorageTmp->pingProbeHistoryTime, "%c", tp);
+
+ if (last_time > timegm(tp)) {
+ last_time = timegm(tp);
+ hcilast = hciptr2;
+ }
+
+ }
+ }
+ StorageDel =
+ header_complex_extract_entry(&pingProbeHistoryTableStorage,
+ hcilast);
+ DEBUGMSGTL(("pingProbeHistoryTable",
+ "delete the last one success!\n"));
+ SNMP_FREE(tp);
+}
+
+
+char *
+sock_ntop_host(const struct sockaddr *sa, socklen_t salen)
+{
+ static char str[128]; /* Unix domain is largest */
+
+ switch (sa->sa_family) {
+ case AF_INET:{
+ struct sockaddr_in *sin = (struct sockaddr_in *) sa;
+
+ if (inet_ntop(AF_INET, &sin->sin_addr, str, sizeof(str)) ==
+ NULL)
+ return (NULL);
+ return (str);
+ }
+
+#ifdef IPV6
+ case AF_INET6:{
+ struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa;
+
+ if (inet_ntop(AF_INET6, &sin6->sin6_addr, str, sizeof(str)) ==
+ NULL)
+ return (NULL);
+ return (str);
+ }
+#endif
+
+#ifdef AF_UNIX
+ case AF_UNIX:{
+ struct sockaddr_un *unp = (struct sockaddr_un *) sa;
+
+ /*
+ * OK to have no pathname bound to the socket: happens on
+ * every connect() unless client calls bind() first.
+ */
+ if (unp->sun_path[0] == 0)
+ strcpy(str, "(no pathname bound)");
+ else
+ snprintf(str, sizeof(str), "%s", unp->sun_path);
+ return (str);
+ }
+#endif
+
+#ifdef HAVE_SOCKADDR_DL_STRUCT
+ case AF_LINK:{
+ struct sockaddr_dl *sdl = (struct sockaddr_dl *) sa;
+
+ if (sdl->sdl_nlen > 0)
+ snprintf(str, sizeof(str), "%*s",
+ sdl->sdl_nlen, &sdl->sdl_data[0]);
+ else
+ snprintf(str, sizeof(str), "AF_LINK, index=%d",
+ sdl->sdl_index);
+ return (str);
+ }
+#endif
+ default:
+ snprintf(str, sizeof(str),
+ "sock_ntop_host: unknown AF_xxx: %d, len %d",
+ sa->sa_family, salen);
+ return (str);
+ }
+ return (NULL);
+}
+
+
+char *
+Sock_ntop_host(const struct sockaddr *sa, socklen_t salen)
+{
+ char *ptr;
+
+ if ((ptr = sock_ntop_host(sa, salen)) == NULL)
+ printf("sock_ntop_host error"); /* inet_ntop() sets errno */
+ return (ptr);
+}
+
+
+
+unsigned short
+in_cksum(unsigned short *addr, int len)
+{
+ int nleft = len;
+ int sum = 0;
+ unsigned short *w = addr;
+ unsigned short answer = 0;
+
+ /*
+ * Our algorithm is simple, using a 32 bit accumulator (sum), we add
+ * sequential 16 bit words to it, and at the end, fold back all the
+ * carry bits from the top 16 bits into the lower 16 bits.
+ */
+ while (nleft > 1) {
+ sum += *w++;
+ nleft -= 2;
+ }
+
+ /*
+ * 4mop up an odd byte, if necessary
+ */
+ if (nleft == 1) {
+ *(unsigned char *) (&answer) = *(unsigned char *) w;
+ sum += answer;
+ }
+
+ /*
+ * 4add back carry outs from top 16 bits to low 16 bits
+ */
+ sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */
+ sum += (sum >> 16); /* add carry */
+ answer = ~sum; /* truncate to 16 bits */
+ return (answer);
+}
+
+
+
+struct addrinfo *
+host_serv(const char *host, const char *serv, int family, int socktype)
+{
+ int n;
+ struct addrinfo hints, *res;
+
+ bzero(&hints, sizeof(struct addrinfo));
+ hints.ai_flags = AI_CANONNAME; /* always return canonical name */
+ hints.ai_family = family; /* AF_UNSPEC, AF_INET, AF_INET6, etc. */
+ hints.ai_socktype = socktype; /* 0, SOCK_STREAM, SOCK_DGRAM, etc. */
+
+ if ((n = getaddrinfo(host, serv, &hints, &res)) != 0)
+ return (NULL);
+
+ return (res); /* return pointer to first on linked list */
+}
+
+/*
+ * end host_serv
+ */
+
+/*
+ * There is no easy way to pass back the integer return code from
+ * getaddrinfo() in the function above, short of adding another argument
+ * that is a pointer, so the easiest way to provide the wrapper function
+ * is just to duplicate the simple function as we do here.
+ */
+
+struct addrinfo *
+Host_serv(const char *host, const char *serv, int family, int socktype)
+{
+ int n;
+ struct addrinfo hints, *res;
+
+ bzero(&hints, sizeof(struct addrinfo));
+ hints.ai_flags = AI_CANONNAME; /* always return canonical name */
+ hints.ai_family = family; /* 0, AF_INET, AF_INET6, etc. */
+ hints.ai_socktype = socktype; /* 0, SOCK_STREAM, SOCK_DGRAM, etc. */
+
+ if ((n = getaddrinfo(host, serv, &hints, &res)) != 0)
+#if HAVE_GAI_STRERROR
+ printf("host_serv error for %s, %s: %s",
+ (host == NULL) ? "(no hostname)" : host,
+ (serv == NULL) ? "(no service name)" : serv,
+ gai_strerror(n));
+#else
+ printf("host_serv error for %s, %s",
+ (host == NULL) ? "(no hostname)" : host,
+ (serv == NULL) ? "(no service name)" : serv);
+#endif
+
+ return (res); /* return pointer to first on linked list */
+}
+
+int
+readable_timeo(int fd, int sec)
+{
+ fd_set rset;
+ struct timeval tv;
+ FD_ZERO(&rset);
+ FD_SET(fd, &rset);
+ tv.tv_sec = sec;
+ tv.tv_usec = 0;
+ return (select(fd + 1, &rset, NULL, NULL, &tv));
+
+}
+
+/*
+ * send trap
+ */
+int
+send_ping_trap(struct pingCtlTable_data *item,
+ oid * trap_oid, size_t trap_oid_len)
+{
+ static oid objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 }; /* snmpTrapIOD.0 */
+ struct pingResultsTable_data *StorageTmp = NULL;
+ netsnmp_variable_list *var_list = NULL, *vars = NULL;
+ oid newoid[MAX_OID_LEN];
+ size_t newoid_len;
+
+ oid pingCtlTargetAddress[] =
+ { 1, 3, 6, 1, 2, 1, 80, 1, 2, 1, 4 };
+ oid pingResultsMinRtt[] =
+ { 1, 3, 6, 1, 2, 1, 80, 1, 3, 1, 4 };
+ oid pingResultsMaxRtt[] =
+ { 1, 3, 6, 1, 2, 1, 80, 1, 3, 1, 5 };
+ oid pingResultsAverageRtt[] =
+ { 1, 3, 6, 1, 2, 1, 80, 1, 3, 1, 6 };
+ oid pingResultsProbeResponses[] =
+ { 1, 3, 6, 1, 2, 1, 80, 1, 3, 1, 7 };
+ oid pingResultsSendProbes[] =
+ { 1, 3, 6, 1, 2, 1, 80, 1, 3, 1, 8 };
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->pingCtlOwnerIndex, item->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->pingCtlTestName, item->pingCtlTestNameLen); /* pingCtlOperationName */
+ StorageTmp = SNMP_MALLOC_STRUCT(pingResultsTable_data);
+ if ((StorageTmp =
+ (struct pingResultsTable_data *)
+ header_complex_get(pingResultsTableStorage, vars)) == NULL)
+ return SNMP_ERR_NOSUCHNAME;
+
+ /*
+ * snmpTrap oid
+ */
+ snmp_varlist_add_variable(&var_list, objid_snmptrap,
+ sizeof(objid_snmptrap) / sizeof(oid),
+ ASN_OBJECT_ID, (u_char *) trap_oid,
+ trap_oid_len * sizeof(oid));
+ /*
+ * pingCtlTargetAddress
+ */
+ bzero(newoid, MAX_OID_LEN * sizeof(oid));
+ header_complex_generate_oid(newoid, &newoid_len, pingCtlTargetAddress,
+ sizeof(pingCtlTargetAddress) / sizeof(oid),
+ vars);
+
+ snmp_varlist_add_variable(&var_list, newoid,
+ newoid_len,
+ ASN_OCTET_STR,
+ (u_char *) item->pingCtlTargetAddress,
+ item->pingCtlTargetAddressLen);
+
+ /*
+ * pingResultsMinRtt
+ */
+ bzero(newoid, newoid_len);
+ header_complex_generate_oid(newoid, &newoid_len, pingResultsMinRtt,
+ sizeof(pingResultsMinRtt) / sizeof(oid),
+ vars);
+
+ snmp_varlist_add_variable(&var_list, newoid,
+ newoid_len,
+ ASN_UNSIGNED,
+ (u_char *) & (StorageTmp->pingResultsMinRtt),
+ sizeof(StorageTmp->pingResultsMinRtt));
+ /*
+ * pingResultsMaxRtt
+ */
+ bzero(newoid, newoid_len);
+ header_complex_generate_oid(newoid, &newoid_len, pingResultsMaxRtt,
+ sizeof(pingResultsMaxRtt) / sizeof(oid),
+ vars);
+
+ snmp_varlist_add_variable(&var_list, newoid,
+ newoid_len,
+ ASN_UNSIGNED,
+ (u_char *) & (StorageTmp->pingResultsMaxRtt),
+ sizeof(StorageTmp->pingResultsMaxRtt));
+
+ /*
+ * pingResultsAverageRtt
+ */
+ bzero(newoid, newoid_len);
+ header_complex_generate_oid(newoid, &newoid_len, pingResultsAverageRtt,
+ sizeof(pingResultsAverageRtt) /
+ sizeof(oid), vars);
+
+ snmp_varlist_add_variable(&var_list, newoid,
+ newoid_len,
+ ASN_UNSIGNED,
+ (u_char *) & (StorageTmp->
+ pingResultsAverageRtt),
+ sizeof(StorageTmp->pingResultsAverageRtt));
+
+ /*
+ * pingResultsProbeResponses
+ */
+ bzero(newoid, newoid_len);
+ header_complex_generate_oid(newoid, &newoid_len,
+ pingResultsProbeResponses,
+ sizeof(pingResultsProbeResponses) /
+ sizeof(oid), vars);
+
+ snmp_varlist_add_variable(&var_list, newoid,
+ newoid_len,
+ ASN_UNSIGNED,
+ (u_char *) & (StorageTmp->
+ pingResultsProbeResponses),
+ sizeof(StorageTmp->
+ pingResultsProbeResponses));
+ /*
+ * pingResultsSendProbes
+ */
+ bzero(newoid, newoid_len);
+ header_complex_generate_oid(newoid, &newoid_len, pingResultsSendProbes,
+ sizeof(pingResultsSendProbes) /
+ sizeof(oid), vars);
+
+ snmp_varlist_add_variable(&var_list, newoid,
+ newoid_len,
+ ASN_UNSIGNED,
+ (u_char *) & (StorageTmp->
+ pingResultsSendProbes),
+ sizeof(StorageTmp->pingResultsSendProbes));
+
+ /*
+ * XXX: stuff based on event table
+ */
+
+ DEBUGMSG(("pingTest:send_ping_trap", "success!\n"));
+
+ send_v2trap(var_list);
+ snmp_free_varbind(vars);
+ vars = NULL;
+ snmp_free_varbind(var_list);
+ vars = NULL;
+}
+
+
+
+void
+readloop(struct pingCtlTable_data *item, struct addrinfo *ai, int datalen,
+ unsigned long *minrtt, unsigned long *maxrtt,
+ unsigned long *averagertt, pid_t pid)
+{
+ int size;
+ char recvbuf[BUFSIZE];
+ char sendbuf[BUFSIZE];
+ int nsent = 1;
+ socklen_t len;
+ ssize_t n;
+ struct timeval tval;
+ /* static int loop_num; */
+ /* struct pingProbeHistoryTable_data * current=NULL; */
+ struct pingProbeHistoryTable_data current_var;
+ int sockfd;
+ int current_probe_temp;
+ int success_probe = 0;
+ int fail_probe = 0;
+ int flag;
+ unsigned long *sumrtt;
+ struct timeval tv;
+
+ sumrtt = (unsigned long *) malloc(sizeof(unsigned long));
+ sockfd = socket(pr->sasend->sa_family, SOCK_RAW, pr->icmpproto);
+ setuid(getuid()); /* don't need special permissions any more */
+
+ size = 60 * 1024; /* OK if setsockopt fails */
+
+ tv.tv_sec = 5;
+ tv.tv_usec = 0;
+ setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
+
+ for (current_probe_temp = 1;
+ current_probe_temp <= item->pingCtlProbeCount;
+ current_probe_temp++) {
+ (*pr->fsend) (datalen, pid, nsent, sockfd, sendbuf);
+ nsent++;
+ len = pr->salen;
+ if (readable_timeo(sockfd, item->pingCtlTimeOut) == 0) {
+ /* printf("socket timeout!\n"); */
+ fail_probe = fail_probe + 1;
+ flag = 1;
+ } else {
+ n = recvfrom(sockfd, recvbuf, sizeof(recvbuf), 0, pr->sarecv,
+ &len);
+ success_probe = success_probe + 1;
+ flag = 0;
+ }
+
+ gettimeofday(&tval, NULL);
+
+ time_t timep;
+ time(&timep);
+
+ (*pr->fproc) (recvbuf, n, &tval, timep, item, ai, datalen, minrtt,
+ maxrtt, sumrtt, averagertt, current_probe_temp,
+ success_probe, fail_probe, flag, &current_var, pid);
+ printf("receiver success!\n");
+ if (current_probe_temp >= item->pingCtlProbeCount) {
+ SNMP_FREE(sumrtt);
+ sumrtt = NULL;
+ return;
+ }
+ }
+}
+
+unsigned long
+round_double(double number)
+{
+ unsigned long ret_num = 0;
+ if (number - (unsigned long) number < 0.5)
+ ret_num = (unsigned long) number;
+ else
+ ret_num = (unsigned long) number + 1;
+ return ret_num;
+}
+
+int
+proc_v4(char *ptr, ssize_t len, struct timeval *tvrecv, time_t timep,
+ struct pingCtlTable_data *item, struct addrinfo *ai, int datalen,
+ unsigned long *minrtt, unsigned long *maxrtt,
+ unsigned long *sumrtt, unsigned long *averagertt,
+ unsigned long current_probe, int success_probe, int fail_probe,
+ int flag, struct pingProbeHistoryTable_data *current_temp,
+ pid_t pid)
+{
+ int hlen1 = 0, icmplen = 0;
+ unsigned long rtt = 0;
+
+ struct ip *ip = NULL;
+ struct icmp *icmp = NULL;
+ struct timeval *tvsend = NULL;
+ struct pingProbeHistoryTable_data *temp = NULL;
+ static int probeFailed = 0;
+ static int testFailed = 0;
+ static int series = 0;
+
+ netsnmp_variable_list *vars = NULL;
+ struct pingResultsTable_data *StorageNew = NULL;
+ if (flag == 0) {
+ series = 0;
+ ip = (struct ip *) ptr; /* start of IP header */
+ hlen1 = ip->ip_hl << 2; /* length of IP header */
+
+ icmp = (struct icmp *) (ptr + hlen1); /* start of ICMP header */
+ if ((icmplen = len - hlen1) < 8)
+ printf("icmplen (%d) < 8", icmplen);
+
+ if (icmp->icmp_type == ICMP_ECHOREPLY) {
+ if (icmp->icmp_id != pid)
+ return; /* not a response to our ECHO_REQUEST */
+ if (icmplen < 16)
+ printf("icmplen (%d) < 16", icmplen);
+
+
+ tvsend = (struct timeval *) icmp->icmp_data;
+
+ rtt =
+ round_double((1000000 * (tvrecv->tv_sec - tvsend->tv_sec) +
+ tvrecv->tv_usec - tvsend->tv_usec) / 1000);
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->pingCtlOwnerIndex, item->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->pingCtlTestName, item->pingCtlTestNameLen); /* pingCtlTestName */
+
+
+ if ((StorageNew =
+ header_complex_get(pingResultsTableStorage,
+ vars)) == NULL)
+ return SNMP_ERR_NOSUCHNAME;
+
+ if (current_probe == 1) {
+ *averagertt = rtt;
+ *minrtt = rtt;
+ *maxrtt = rtt;
+ *sumrtt = rtt;
+ } else {
+ printf("else\n");
+ if (rtt < *minrtt)
+ *minrtt = rtt;
+ if (rtt > *maxrtt)
+ *maxrtt = rtt;
+ *sumrtt = (*sumrtt) + rtt;
+ *averagertt =
+ round_double((*sumrtt) /
+ (StorageNew->pingResultsProbeResponses +
+ 1));
+ }
+
+
+ StorageNew->pingResultsMinRtt = *minrtt;
+ StorageNew->pingResultsMaxRtt = *maxrtt;
+ StorageNew->pingResultsAverageRtt = *averagertt;
+ StorageNew->pingResultsProbeResponses =
+ StorageNew->pingResultsProbeResponses + 1;
+ StorageNew->pingResultsSendProbes =
+ StorageNew->pingResultsSendProbes + 1;
+ StorageNew->pingResultsRttSumOfSquares =
+ StorageNew->pingResultsRttSumOfSquares + rtt * rtt;
+
+ StorageNew->pingResultsLastGoodProbe =
+ (char *) malloc(strlen(asctime(gmtime(&timep))));
+ StorageNew->pingResultsLastGoodProbe =
+ strdup(asctime(gmtime(&timep)));
+ StorageNew->
+ pingResultsLastGoodProbe[strlen(asctime(gmtime(&timep))) -
+ 1] = '\0';
+ StorageNew->pingResultsLastGoodProbeLen =
+ strlen(asctime(gmtime(&timep))) - 1;
+
+
+
+ temp = SNMP_MALLOC_STRUCT(pingProbeHistoryTable_data);
+
+ temp->pingCtlOwnerIndex =
+ (char *) malloc(item->pingCtlOwnerIndexLen + 1);
+ memcpy(temp->pingCtlOwnerIndex, item->pingCtlOwnerIndex,
+ item->pingCtlOwnerIndexLen + 1);
+ temp->pingCtlOwnerIndex[item->pingCtlOwnerIndexLen] = '\0';
+ temp->pingCtlOwnerIndexLen = item->pingCtlOwnerIndexLen;
+
+ temp->pingCtlTestName =
+ (char *) malloc(item->pingCtlTestNameLen + 1);
+ memcpy(temp->pingCtlTestName, item->pingCtlTestName,
+ item->pingCtlTestNameLen + 1);
+ temp->pingCtlTestName[item->pingCtlTestNameLen] = '\0';
+ temp->pingCtlTestNameLen = item->pingCtlTestNameLen;
+
+ /* add lock to protect */
+ pthread_mutex_t counter_mutex = PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_lock(&counter_mutex);
+ if (item->pingProbeHistoryMaxIndex >=
+ (unsigned long) (2147483647))
+ item->pingProbeHistoryMaxIndex = 0;
+ temp->pingProbeHistoryIndex =
+ ++(item->pingProbeHistoryMaxIndex);
+ pthread_mutex_unlock(&counter_mutex);
+
+
+ temp->pingProbeHistoryResponse = rtt;
+ temp->pingProbeHistoryStatus = 1;
+ temp->pingProbeHistoryLastRC = 0;
+
+ temp->pingProbeHistoryTime =
+ (char *) malloc(strlen(asctime(gmtime(&timep))));
+ temp->pingProbeHistoryTime = strdup(asctime(gmtime(&timep)));
+ temp->pingProbeHistoryTime[strlen(asctime(gmtime(&timep))) -
+ 1] = '\0';
+ temp->pingProbeHistoryTimeLen =
+ strlen(asctime(gmtime(&timep))) - 1;
+
+ if (StorageNew->pingResultsSendProbes == 1)
+ item->pingProbeHis = temp;
+ else {
+ (current_temp)->next = temp;
+ }
+
+ current_temp = temp;
+
+ if (StorageNew->pingResultsSendProbes >=
+ item->pingCtlProbeCount) {
+ current_temp->next = NULL;
+ }
+
+ if (item->pingProbeHis != NULL)
+ if (pingProbeHistoryTable_count(item) <
+ item->pingCtlMaxRows) {
+ if (pingProbeHistoryTable_add(current_temp) !=
+ SNMPERR_SUCCESS)
+ DEBUGMSGTL(("pingProbeHistoryTable",
+ "registered an entry error\n"));
+ } else {
+ pingProbeHistoryTable_delLast(item);
+ if (pingProbeHistoryTable_add(current_temp) !=
+ SNMPERR_SUCCESS)
+ DEBUGMSGTL(("pingProbeHistoryTable",
+ "registered an entry error\n"));
+
+ }
+
+ }
+ }
+
+ else if (flag == 1)
+ {
+
+
+ if (series == 0)
+ probeFailed = 1;
+ else
+ probeFailed = probeFailed + 1;
+ series = 1;
+ testFailed = testFailed + 1;
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->pingCtlOwnerIndex, item->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->pingCtlTestName, item->pingCtlTestNameLen); /* pingCtlTestName */
+
+
+ if ((StorageNew =
+ header_complex_get(pingResultsTableStorage, vars)) == NULL)
+ return SNMP_ERR_NOSUCHNAME;
+
+ if (current_probe == 1) {
+ *averagertt = rtt;
+ *minrtt = rtt;
+ *maxrtt = rtt;
+ *sumrtt = rtt;
+ }
+ StorageNew->pingResultsSendProbes =
+ StorageNew->pingResultsSendProbes + 1;
+
+
+
+ temp = SNMP_MALLOC_STRUCT(pingProbeHistoryTable_data);
+
+ temp->pingCtlOwnerIndex =
+ (char *) malloc(item->pingCtlOwnerIndexLen + 1);
+ memcpy(temp->pingCtlOwnerIndex, item->pingCtlOwnerIndex,
+ item->pingCtlOwnerIndexLen + 1);
+ temp->pingCtlOwnerIndex[item->pingCtlOwnerIndexLen] = '\0';
+ temp->pingCtlOwnerIndexLen = item->pingCtlOwnerIndexLen;
+
+ temp->pingCtlTestName =
+ (char *) malloc(item->pingCtlTestNameLen + 1);
+ memcpy(temp->pingCtlTestName, item->pingCtlTestName,
+ item->pingCtlTestNameLen + 1);
+ temp->pingCtlTestName[item->pingCtlTestNameLen] = '\0';
+ temp->pingCtlTestNameLen = item->pingCtlTestNameLen;
+
+ /* add lock to protect */
+ pthread_mutex_t counter_mutex = PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_lock(&counter_mutex);
+ temp->pingProbeHistoryIndex = ++(item->pingProbeHistoryMaxIndex);
+ pthread_mutex_unlock(&counter_mutex);
+ /* end */
+
+ temp->pingProbeHistoryResponse = item->pingCtlTimeOut * 1000;
+ temp->pingProbeHistoryStatus = 4;
+ temp->pingProbeHistoryLastRC = 1;
+
+ temp->pingProbeHistoryTime =
+ (char *) malloc(strlen(asctime(gmtime(&timep))));
+ temp->pingProbeHistoryTime = strdup(asctime(gmtime(&timep)));
+ temp->pingProbeHistoryTime[strlen(asctime(gmtime(&timep))) - 1] =
+ '\0';
+ temp->pingProbeHistoryTimeLen =
+ strlen(asctime(gmtime(&timep))) - 1;
+
+ if (StorageNew->pingResultsSendProbes == 1)
+ item->pingProbeHis = temp;
+ else {
+ (current_temp)->next = temp;
+ }
+
+ current_temp = temp;
+
+ if (StorageNew->pingResultsSendProbes >= item->pingCtlProbeCount) {
+ current_temp->next = NULL;
+ }
+
+ if (item->pingProbeHis != NULL)
+ if (pingProbeHistoryTable_count(item) < item->pingCtlMaxRows) {
+ if (pingProbeHistoryTable_add(current_temp) !=
+ SNMPERR_SUCCESS)
+ DEBUGMSGTL(("pingProbeHistoryTable",
+ "registered an entry error\n"));
+ } else {
+
+ pingProbeHistoryTable_delLast(item);
+ if (pingProbeHistoryTable_add(current_temp) !=
+ SNMPERR_SUCCESS)
+ DEBUGMSGTL(("pingProbeHistoryTable",
+ "registered an entry error\n"));
+
+ }
+
+ if ((item->
+ pingCtlTrapGeneration[0] & PINGTRAPGENERATION_PROBEFAILED) !=
+ 0) {
+ if (probeFailed >= item->pingCtlTrapProbeFailureFilter)
+ send_ping_trap(item, pingProbeFailed,
+ sizeof(pingProbeFailed) / sizeof(oid));
+ }
+
+
+ }
+
+ if (current_probe == item->pingCtlProbeCount) {
+ if ((item->
+ pingCtlTrapGeneration[0] & PINGTRAPGENERATION_TESTCOMPLETED)
+ != 0) {
+ send_ping_trap(item, pingTestCompleted,
+ sizeof(pingTestCompleted) / sizeof(oid));
+ } else
+ if ((item->
+ pingCtlTrapGeneration[0] & PINGTRAPGENERATION_TESTFAILED)
+ != 0) {
+
+ if (testFailed >= item->pingCtlTrapTestFailureFilter)
+ send_ping_trap(item, pingTestFailed,
+ sizeof(pingTestFailed) / sizeof(oid));
+ }
+
+ else if ((item->
+ pingCtlTrapGeneration[0] &
+ PINGTRAPGENERATION_PROBEFAILED) != 0) {;
+ } else {
+ ;
+ }
+
+ series = 0;
+ probeFailed = 0;
+ testFailed = 0;
+
+ }
+ return;
+}
+
+
+
+void
+send_v4(int datalen, pid_t pid, int nsent, int sockfd, char *sendbuf)
+{
+ int len;
+ struct icmp *icmp = NULL;
+ struct timeval *temp = NULL;
+
+ icmp = (struct icmp *) sendbuf;
+ icmp->icmp_type = ICMP_ECHO;
+ icmp->icmp_code = 0;
+ icmp->icmp_id = pid;
+ icmp->icmp_seq = nsent;
+ gettimeofday((struct timeval *) icmp->icmp_data, NULL);
+ temp = (struct timeval *) icmp->icmp_data;
+
+ len = 8 + datalen; /* checksum ICMP header and data */
+ icmp->icmp_cksum = 0;
+ icmp->icmp_cksum = in_cksum((u_short *) icmp, len);
+
+ sendto(sockfd, sendbuf, len, 0, pr->sasend, pr->salen);
+}
+
+
+void
+run_ping(unsigned int clientreg, void *clientarg)
+/* run_ping(struct pingCtlTable_data *item) */
+{
+ struct pingCtlTable_data *item = clientarg;
+ netsnmp_variable_list *vars = NULL;
+ struct pingResultsTable_data *StorageNew = NULL;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->pingCtlOwnerIndex, item->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->pingCtlTestName, item->pingCtlTestNameLen); /* pingCtlTestName */
+
+
+ if ((StorageNew =
+ header_complex_get(pingResultsTableStorage, vars)) == NULL)
+ return;
+
+ StorageNew->pingResultsSendProbes = 0;
+ StorageNew->pingResultsProbeResponses = 0;
+
+ if (item->pingCtlTargetAddressType == 1
+ || item->pingCtlTargetAddressType == 16) {
+ struct proto proto_v4 =
+ { proc_v4, send_v4, NULL, NULL, 0, IPPROTO_ICMP };
+ char *host = NULL;
+ pid_t pid; /* our PID */
+
+ int datalen;
+ unsigned long *minrtt = NULL;
+ unsigned long *maxrtt = NULL;
+ unsigned long *averagertt = NULL;
+
+ datalen = 56; /* data that goes with ICMP echo request */
+ unsigned int n = 1;
+ int c;
+ struct addrinfo *ai = NULL;
+ minrtt = malloc(sizeof(unsigned long));
+ maxrtt = malloc(sizeof(unsigned long));
+ averagertt = malloc(sizeof(unsigned long));
+ host = item->pingCtlTargetAddress;
+ pid = getpid();
+
+ ai = host_serv(host, NULL, 0, 0);
+
+ printf("PING %s (%s): %d data bytes\n", ai->ai_canonname,
+ sock_ntop_host(ai->ai_addr, ai->ai_addrlen), datalen);
+
+ /*
+ * 4initialize according to protocol
+ */
+ if (ai->ai_family == AF_INET) {
+ pr = &proto_v4;
+#ifdef IPV6
+ } else if (ai->ai_family == AF_INET6) {
+ pr = &proto_v6;
+
+ if (IN6_IS_ADDR_V4MAPPED(&(((struct sockaddr_in6 *)
+ ai->ai_addr)->sin6_addr)))
+ printf("cannot ping IPv4-mapped IPv6 address");
+#endif
+ } else
+ printf("unknown address family %d", ai->ai_family);
+
+ pr->sasend = ai->ai_addr;
+ pr->sarecv = calloc(1, ai->ai_addrlen);
+ pr->salen = ai->ai_addrlen;
+ readloop(item, ai, datalen, minrtt, maxrtt, averagertt, pid);
+
+ SNMP_FREE(minrtt);
+ minrtt = NULL;
+ SNMP_FREE(maxrtt);
+ maxrtt = NULL;
+ SNMP_FREE(averagertt);
+ averagertt = NULL;
+ free(ai);
+ ai = NULL;
+ }
+
+ else if (item->pingCtlTargetAddressType == 2) {
+
+ int ch = 0, hold = 0, packlen = 0;
+ u_char *packet = NULL;
+ char *target = NULL;
+ struct sockaddr_in6 firsthop;
+ int socket_errno = 0;
+ struct icmp6_filter filter;
+ int err = 0, csum_offset = 0, sz_opt = 0;
+
+ static int icmp_sock = 0;
+ int uid = 0;
+ struct sockaddr_in6 source;
+ int preload = 0;
+ struct cmsghdr *srcrt = NULL;
+ static unsigned char cmsgbuf[4096];
+ static int cmsglen = 0;
+ struct sockaddr_in6 whereto; /* who to ping */
+ int options = 0;
+ char *hostname = NULL;
+ char *device = NULL;
+ int interval = 1000; /* interval between packets (msec) */
+ int pmtudisc = -1;
+ int datalen = DEFDATALEN;
+ int timing = 0; /* flag to do timing */
+ int working_recverr = 0;
+ __u32 flowlabel = 0;
+ __u32 tclass = 0;
+
+ int ident = 0; /* process id to identify our packets */
+ u_char outpack[MAX_PACKET];
+ struct timeval start_time;
+ static int screen_width = INT_MAX;
+ int deadline = 0; /* time to die */
+ int timeout = 0;
+
+ timeout = item->pingCtlTimeOut;
+ memset(&source, 0, sizeof(source));
+ icmp_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
+ socket_errno = errno;
+
+ uid = getuid();
+ setuid(uid);
+
+ source.sin6_family = AF_INET6;
+ memset(&firsthop, 0, sizeof(firsthop));
+ firsthop.sin6_family = AF_INET6;
+ preload = 1;
+
+ target = item->pingCtlTargetAddress;
+
+ memset(&whereto, 0, sizeof(struct sockaddr_in6));
+ whereto.sin6_family = AF_INET6;
+ whereto.sin6_port = htons(IPPROTO_ICMPV6);
+
+ if (inet_pton(AF_INET6, target, &whereto.sin6_addr) <= 0) {
+ struct hostent *hp = NULL;
+
+ hp = gethostbyname2(target, AF_INET6);
+
+ if (hp == NULL) {
+ fprintf(stderr, "unknown host\n");
+ return;
+ }
+
+ memcpy(&whereto.sin6_addr, hp->h_addr_list[0], 16);
+ } else {
+ options |= F_NUMERIC;
+ }
+ if (ipv6_addr_any(&firsthop.sin6_addr))
+ memcpy(&firsthop.sin6_addr, &whereto.sin6_addr, 16);
+
+ hostname = target;
+
+ if (ipv6_addr_any(&source.sin6_addr)) {
+
+ int alen;
+ int probe_fd = socket(AF_INET6, SOCK_DGRAM, 0);
+
+ if (probe_fd < 0) {
+ printf("error!\n");
+ perror("socket");
+ return;
+ }
+ if (device) {
+ struct ifreq ifr;
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, device, IFNAMSIZ - 1);
+ if (setsockopt
+ (probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device,
+ strlen(device) + 1) == -1) {
+#ifdef HAVE_SIN6_SCOPEID
+ if ((firsthop.sin6_addr.
+ s6_addr16[0] & htons(0xffc0)) == htons(0xfe80)
+ || (firsthop.sin6_addr.
+ s6_addr16[0] & htons(0xffff)) ==
+ htons(0xff02)) {
+ if (ioctl(probe_fd, SIOCGIFINDEX, &ifr) < 0) {
+ fprintf(stderr, "ping: unknown iface %s\n",
+ device);
+ return;
+ }
+ firsthop.sin6_scope_id = ifr.ifr_ifindex;
+ }
+#endif
+ }
+ }
+ firsthop.sin6_port = htons(1025);
+ if (connect
+ (probe_fd, (struct sockaddr *) &firsthop,
+ sizeof(firsthop)) == -1) {
+ perror("connect");
+ return;
+ }
+ alen = sizeof(source);
+ if (getsockname(probe_fd, (struct sockaddr *) &source, &alen)
+ == -1) {
+ perror("getsockname");
+ return;
+ }
+ source.sin6_port = 0;
+ close(probe_fd);
+ }
+
+ if (icmp_sock < 0) {
+ errno = socket_errno;
+ perror("ping: icmp open socket");
+ return;
+ }
+
+ if ((whereto.sin6_addr.s6_addr16[0] & htons(0xff00)) ==
+ htons(0xff00)) {
+ if (uid) {
+ if (interval < 1000) {
+ fprintf(stderr,
+ "ping: multicast ping with too short interval.\n");
+ return;
+ }
+ if (pmtudisc >= 0 && pmtudisc != IPV6_PMTUDISC_DO) {
+ fprintf(stderr,
+ "ping: multicast ping does not fragment.\n");
+ return;
+ }
+ }
+ if (pmtudisc < 0)
+ pmtudisc = IPV6_PMTUDISC_DO;
+ }
+
+ if (pmtudisc >= 0) {
+ if (setsockopt
+ (icmp_sock, SOL_IPV6, IPV6_MTU_DISCOVER, &pmtudisc,
+ sizeof(pmtudisc)) == -1) {
+ perror("ping: IPV6_MTU_DISCOVER");
+ return;
+ }
+ }
+ if (bind(icmp_sock, (struct sockaddr *) &source, sizeof(source)) ==
+ -1) {
+ perror("ping: bind icmp socket");
+ return;
+ }
+ if (datalen >= sizeof(struct timeval)) /* can we time transfer */
+ timing = 1;
+ packlen = datalen + 8 + 4096 + 40 + 8; /* 4096 for rthdr */
+ if (!(packet = (u_char *) malloc((u_int) packlen))) {
+ fprintf(stderr, "ping: out of memory.\n");
+ return;
+ }
+
+ working_recverr = 1;
+ hold = 1;
+ if (setsockopt
+ (icmp_sock, SOL_IPV6, IPV6_RECVERR, (char *) &hold,
+ sizeof(hold))) {
+ fprintf(stderr,
+ "WARNING: your kernel is veeery old. No problems.\n");
+ working_recverr = 0;
+ }
+
+ /*
+ * Estimate memory eaten by single packet. It is rough estimate.
+ * * Actually, for small datalen's it depends on kernel side a lot.
+ */
+ hold = datalen + 8;
+ hold += ((hold + 511) / 512) * (40 + 16 + 64 + 160);
+ sock_setbufs(icmp_sock, hold, preload);
+
+ csum_offset = 2;
+ sz_opt = sizeof(int);
+
+ err =
+ setsockopt(icmp_sock, SOL_RAW, IPV6_CHECKSUM, &csum_offset,
+ sz_opt);
+ if (err < 0) {
+ perror("setsockopt(RAW_CHECKSUM)");
+ return;
+ }
+
+ /*
+ * select icmp echo reply as icmp type to receive
+ */
+
+ ICMPV6_FILTER_SETBLOCKALL(&filter);
+
+ if (!working_recverr) {
+ ICMPV6_FILTER_SETPASS(ICMPV6_DEST_UNREACH, &filter);
+ ICMPV6_FILTER_SETPASS(ICMPV6_PKT_TOOBIG, &filter);
+ ICMPV6_FILTER_SETPASS(ICMPV6_TIME_EXCEED, &filter);
+ ICMPV6_FILTER_SETPASS(ICMPV6_PARAMPROB, &filter);
+ }
+
+ ICMPV6_FILTER_SETPASS(ICMPV6_ECHO_REPLY, &filter);
+
+ err = setsockopt(icmp_sock, SOL_ICMPV6, ICMPV6_FILTER, &filter,
+ sizeof(struct icmp6_filter));
+
+ if (err < 0) {
+ perror("setsockopt(ICMPV6_FILTER)");
+ return;
+ }
+
+ if (1) {
+ int on = 1;
+ if (setsockopt(icmp_sock, IPPROTO_IPV6, IPV6_HOPLIMIT,
+ &on, sizeof(on)) == -1) {
+ perror("can't receive hop limit");
+ return;
+ }
+ }
+
+ printf("PING %s(%s) ", hostname,
+ pr_addr(&whereto.sin6_addr, options));
+ if (flowlabel)
+ printf(", flow 0x%05x, ", (unsigned) ntohl(flowlabel));
+ if (device || (options & F_NUMERIC)) {
+ printf("from %s %s: ",
+ pr_addr_n(&source.sin6_addr), device ? : "");
+ }
+ printf("%d data bytes\n", datalen);
+
+ setup(icmp_sock, options, uid, timeout, preload, interval, datalen,
+ (char *) outpack, &ident, &start_time, &screen_width,
+ &deadline);
+
+ main_loop(item, icmp_sock, preload, packet, packlen, cmsglen,
+ (char *) cmsgbuf, &whereto, options, uid, hostname,
+ interval, datalen, timing, working_recverr,
+ (char *) outpack, &ident, &start_time, &screen_width,
+ &deadline);
+
+ }
+ return;
+}
+
+void
+init_resultsTable(struct pingCtlTable_data *item)
+{
+ struct pingResultsTable_data *StorageTmp = NULL;
+ struct pingResultsTable_data *StorageNew = NULL;
+ struct addrinfo *ai = NULL;
+ char *host = NULL;
+ netsnmp_variable_list *vars = NULL;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->pingCtlOwnerIndex, item->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->pingCtlTestName, item->pingCtlTestNameLen); /* pingCtlTestName */
+
+
+ if ((StorageNew =
+ header_complex_get(pingResultsTableStorage, vars)) != NULL) {
+ StorageNew->pingResultsSendProbes = 0;
+ StorageNew->pingResultsProbeResponses = 0;
+ return;
+
+ }
+ ai = malloc(sizeof(struct addrinfo));
+ host = item->pingCtlTargetAddress;
+ ai = host_serv(host, NULL, 0, 0);
+ StorageTmp = SNMP_MALLOC_STRUCT(pingResultsTable_data);
+
+ StorageTmp->pingCtlOwnerIndex =
+ (char *) malloc(item->pingCtlOwnerIndexLen + 1);
+ memcpy(StorageTmp->pingCtlOwnerIndex, item->pingCtlOwnerIndex,
+ item->pingCtlOwnerIndexLen + 1);
+ StorageTmp->pingCtlOwnerIndex[item->pingCtlOwnerIndexLen] = '\0';
+ StorageTmp->pingCtlOwnerIndexLen = item->pingCtlOwnerIndexLen;
+
+ StorageTmp->pingCtlTestName =
+ (char *) malloc(item->pingCtlTestNameLen + 1);
+ memcpy(StorageTmp->pingCtlTestName, item->pingCtlTestName,
+ item->pingCtlTestNameLen + 1);
+ StorageTmp->pingCtlTestName[item->pingCtlTestNameLen] = '\0';
+ StorageTmp->pingCtlTestNameLen = item->pingCtlTestNameLen;
+
+ StorageTmp->pingResultsOperStatus = 1;
+
+ if (item->pingCtlTargetAddressType == 1
+ || item->pingCtlTargetAddressType == 16) {
+ if (ai == NULL) {
+ StorageTmp->pingResultsIpTargetAddressType = 0;
+ StorageTmp->pingResultsIpTargetAddress = strdup("");
+ StorageTmp->pingResultsIpTargetAddressLen = 0;
+ } else {
+ StorageTmp->pingResultsIpTargetAddressType = 1;
+ StorageTmp->pingResultsIpTargetAddress =
+ (char *)
+ malloc(strlen(sock_ntop_host(ai->ai_addr, ai->ai_addrlen))
+ + 1);
+ StorageTmp->pingResultsIpTargetAddress =
+ strdup(sock_ntop_host(ai->ai_addr, ai->ai_addrlen));
+ StorageTmp->
+ pingResultsIpTargetAddress[strlen
+ (sock_ntop_host
+ (ai->ai_addr,
+ ai->ai_addrlen))] = '\0';
+ StorageTmp->pingResultsIpTargetAddressLen =
+ strlen(sock_ntop_host(ai->ai_addr, ai->ai_addrlen));
+ }
+ }
+ if (item->pingCtlTargetAddressType == 2) {
+
+ struct sockaddr_in6 whereto; /* Who to try to reach */
+ register struct sockaddr_in6 *to =
+ (struct sockaddr_in6 *) &whereto;
+ struct hostent *hp = NULL;
+ char pa[64];
+
+ to->sin6_family = AF_INET6;
+ to->sin6_port = htons(33434);
+
+ if (inet_pton(AF_INET6, host, &to->sin6_addr) > 0) {
+ StorageTmp->pingResultsIpTargetAddressType = 2;
+ StorageTmp->pingResultsIpTargetAddress =
+ (char *) malloc(strlen(host) + 1);
+ StorageTmp->pingResultsIpTargetAddress = strdup(host);
+ StorageTmp->pingResultsIpTargetAddress[strlen(host)] = '\0';
+ StorageTmp->pingResultsIpTargetAddressLen = strlen(host);
+ } else {
+ hp = gethostbyname2(host, AF_INET6);
+ if (hp != NULL) {
+ const char *hostname = NULL;
+ memmove((caddr_t) & to->sin6_addr, hp->h_addr, 16);
+ hostname = inet_ntop(AF_INET6, &to->sin6_addr, pa, 64);
+ StorageTmp->pingResultsIpTargetAddressType = 2;
+ StorageTmp->pingResultsIpTargetAddress =
+ (char *) malloc(strlen(hostname) + 1);
+ StorageTmp->pingResultsIpTargetAddress = strdup(hostname);
+ StorageTmp->pingResultsIpTargetAddress[strlen(hostname)] =
+ '\0';
+ StorageTmp->pingResultsIpTargetAddressLen =
+ strlen(hostname);
+ } else {
+ (void) fprintf(stderr,
+ "traceroute: unknown host %s\n", host);
+ StorageTmp->pingResultsIpTargetAddressType = 0;
+ StorageTmp->pingResultsIpTargetAddress = strdup("");
+ StorageTmp->pingResultsIpTargetAddressLen = 0;
+ }
+ }
+ }
+
+
+ StorageTmp->pingResultsMinRtt = 0;
+ StorageTmp->pingResultsMaxRtt = 0;
+ StorageTmp->pingResultsAverageRtt = 0;
+ StorageTmp->pingResultsProbeResponses = 0;
+ StorageTmp->pingResultsSendProbes = 0;
+ StorageTmp->pingResultsRttSumOfSquares = 0;
+
+ StorageTmp->pingResultsLastGoodProbe = strdup("");
+ StorageTmp->pingResultsLastGoodProbeLen = 0;
+
+ item->pingResults = StorageTmp;
+ if (item->pingProbeHistoryMaxIndex == 0) {
+ if (item->pingResults != NULL) {
+ if (pingResultsTable_add(item) != SNMPERR_SUCCESS) {
+ DEBUGMSGTL(("pingResultsTable", "init an entry error\n"));
+ }
+ }
+ }
+ SNMP_FREE(ai);
+ ai = NULL;
+
+}
+
+
+int
+modify_ResultsOper(struct pingCtlTable_data *thedata, long val)
+{
+ netsnmp_variable_list *vars = NULL;
+ struct pingResultsTable_data *StorageTmp = NULL;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlOwnerIndex, thedata->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlTestName, thedata->pingCtlTestNameLen); /* pingCtlTestName */
+
+
+ if ((StorageTmp =
+ header_complex_get(pingResultsTableStorage, vars)) == NULL)
+ return SNMP_ERR_NOSUCHNAME;
+ StorageTmp->pingResultsOperStatus = val;
+
+ DEBUGMSGTL(("pingResultsOperStatus", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+int
+pingResultsTable_del(struct pingCtlTable_data *thedata)
+{
+ struct header_complex_index *hciptr2 = NULL;
+ struct pingResultsTable_data *StorageDel = NULL;
+ netsnmp_variable_list *vars = NULL;
+ oid newoid[MAX_OID_LEN];
+ size_t newoid_len;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlOwnerIndex, thedata->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlTestName, thedata->pingCtlTestNameLen); /* pingCtlOperationName */
+
+ header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
+
+ for (hciptr2 = pingResultsTableStorage; hciptr2 != NULL;
+ hciptr2 = hciptr2->next) {
+ if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
+ == 0) {
+ StorageDel =
+ header_complex_extract_entry(&pingResultsTableStorage,
+ hciptr2);
+ if (StorageDel != NULL) {
+ SNMP_FREE(StorageDel->pingCtlOwnerIndex);
+ SNMP_FREE(StorageDel->pingCtlTestName);
+ SNMP_FREE(StorageDel->pingResultsIpTargetAddress);
+ SNMP_FREE(StorageDel->pingResultsLastGoodProbe);
+ SNMP_FREE(StorageDel);
+ }
+ DEBUGMSGTL(("pingResultsTable", "delete success!\n"));
+
+ }
+ }
+ return SNMPERR_SUCCESS;
+}
+
+
+int
+pingProbeHistoryTable_del(struct pingCtlTable_data *thedata)
+{
+ struct header_complex_index *hciptr2 = NULL;
+ struct pingProbeHistoryTable_data *StorageDel = NULL;
+ netsnmp_variable_list *vars = NULL;
+ oid newoid[MAX_OID_LEN];
+ size_t newoid_len;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlOwnerIndex, thedata->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlTestName, thedata->pingCtlTestNameLen); /* pingCtlOperationName */
+
+ header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
+
+ for (hciptr2 = pingProbeHistoryTableStorage; hciptr2 != NULL;
+ hciptr2 = hciptr2->next) {
+ if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
+ == 0) {
+ StorageDel =
+ header_complex_extract_entry(&pingProbeHistoryTableStorage,
+ hciptr2);
+ if (StorageDel != NULL) {
+ SNMP_FREE(StorageDel->pingCtlOwnerIndex);
+ SNMP_FREE(StorageDel->pingCtlTestName);
+ SNMP_FREE(StorageDel->pingProbeHistoryTime);
+ SNMP_FREE(StorageDel);
+ }
+ DEBUGMSGTL(("pingProbeHistoryTable", "delete success!\n"));
+
+ }
+ }
+ return SNMPERR_SUCCESS;
+}
+
+
+int
+write_pingCtlTargetAddressType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("pingCtlTable",
+ "write_pingCtlTargetAddressType entering action=%d... \n",
+ action));
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlTargetAddressType not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlTargetAddressType;
+ StorageTmp->pingCtlTargetAddressType = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->pingCtlTargetAddressType = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_pingCtlTargetAddress(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ static size_t tmplen;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlTargetAddress not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlTargetAddress;
+ tmplen = StorageTmp->pingCtlTargetAddressLen;
+
+ StorageTmp->pingCtlTargetAddress =
+ (char *) malloc(var_val_len + 1);
+ if (StorageTmp->pingCtlTargetAddress == NULL) {
+ exit(1);
+ }
+ memcpy(StorageTmp->pingCtlTargetAddress, var_val, var_val_len);
+ StorageTmp->pingCtlTargetAddress[var_val_len] = '\0';
+ StorageTmp->pingCtlTargetAddressLen = var_val_len;
+
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->pingCtlTargetAddress);
+ StorageTmp->pingCtlTargetAddress = NULL;
+ StorageTmp->pingCtlTargetAddress = tmpvar;
+ StorageTmp->pingCtlTargetAddressLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_pingCtlDataSize(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("pingCtlTable",
+ "pingCtlDataSize entering action=%d... \n", action));
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlDataSize not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlDataSize;
+ if ((*((long *) var_val)) >= 0 && (*((long *) var_val)) <= 65507)
+ StorageTmp->pingCtlDataSize = *((long *) var_val);
+ else
+ StorageTmp->pingCtlDataSize = 56;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->pingCtlDataSize = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+int
+write_pingCtlTimeOut(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("pingCtlTable",
+ "pingCtlTimeOut entering action=%d... \n", action));
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlDataSize not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlTimeOut;
+ if ((*((long *) var_val)) >= 1 && (*((long *) var_val)) <= 60)
+ StorageTmp->pingCtlTimeOut = *((long *) var_val);
+ else
+ StorageTmp->pingCtlTimeOut = 3;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->pingCtlTimeOut = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+
+int
+write_pingCtlProbeCount(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("pingCtlTable",
+ "pingCtlProbeCount entering action=%d... \n", action));
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlDataSize not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlProbeCount;
+
+ if ((*((long *) var_val)) >= 1 && (*((long *) var_val)) <= 15)
+ StorageTmp->pingCtlProbeCount = *((long *) var_val);
+ else
+ StorageTmp->pingCtlProbeCount = 15;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->pingCtlProbeCount = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_pingCtlAdminStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("pingCtlTable",
+ "pingCtlAdminStatus entering action=%d... \n", action));
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlTargetAddressType not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlAdminStatus;
+ StorageTmp->pingCtlAdminStatus = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->pingCtlAdminStatus = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ if (StorageTmp->pingCtlAdminStatus == 1
+ && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ StorageTmp->pingResults->pingResultsOperStatus = 1;
+ modify_ResultsOper(StorageTmp, 1);
+ if (StorageTmp->pingCtlFrequency != 0)
+ StorageTmp->timer_id =
+ snmp_alarm_register(StorageTmp->pingCtlFrequency,
+ SA_REPEAT, run_ping, StorageTmp);
+ else
+ StorageTmp->timer_id = snmp_alarm_register(1, (int) NULL,
+ run_ping,
+ StorageTmp);
+
+ } else if (StorageTmp->pingCtlAdminStatus == 2
+ && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ snmp_alarm_unregister(StorageTmp->timer_id);
+ StorageTmp->pingResults->pingResultsOperStatus = 2;
+ modify_ResultsOper(StorageTmp, 2);
+ }
+
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+int
+write_pingCtlDataFill(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ static size_t tmplen;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlTargetAddress not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlDataFill;
+ tmplen = StorageTmp->pingCtlDataFillLen;
+ StorageTmp->pingCtlDataFill = (char *) malloc(var_val_len + 1);
+ if (StorageTmp->pingCtlDataFill == NULL) {
+ exit(1);
+ }
+ memcpy(StorageTmp->pingCtlDataFill, var_val, var_val_len);
+ StorageTmp->pingCtlDataFill[var_val_len] = '\0';
+ StorageTmp->pingCtlDataFillLen = var_val_len;
+
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->pingCtlDataFill);
+ StorageTmp->pingCtlDataFill = NULL;
+ StorageTmp->pingCtlDataFill = tmpvar;
+ StorageTmp->pingCtlDataFillLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+write_pingCtlFrequency(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("pingCtlTable",
+ "pingCtlFrequency entering action=%d... \n", action));
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlDataSize not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlFrequency;
+ StorageTmp->pingCtlFrequency = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->pingCtlFrequency = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+write_pingCtlMaxRows(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("pingCtlTable",
+ "pingCtlMaxRows entering action=%d... \n", action));
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlMaxRows not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlMaxRows;
+ StorageTmp->pingCtlMaxRows = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->pingCtlMaxRows = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+int
+write_pingCtlStorageType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("pingCtlTable",
+ "pingCtlStorageType entering action=%d... \n", action));
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlStorageType not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlStorageType;
+ StorageTmp->pingCtlStorageType = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->pingCtlStorageType = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+int
+write_pingCtlTrapGeneration(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ static size_t tmplen;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlTargetAddress not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlTrapGeneration;
+ tmplen = StorageTmp->pingCtlTrapGenerationLen;
+
+ StorageTmp->pingCtlTrapGeneration =
+ (char *) malloc(var_val_len + 1);
+ if (StorageTmp->pingCtlTrapGeneration == NULL) {
+ exit(1);
+ }
+ memcpy(StorageTmp->pingCtlTrapGeneration, var_val, var_val_len);
+ StorageTmp->pingCtlTrapGeneration[var_val_len] = '\0';
+ StorageTmp->pingCtlTrapGenerationLen = var_val_len;
+
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->pingCtlTrapGeneration);
+ StorageTmp->pingCtlTrapGeneration = NULL;
+ StorageTmp->pingCtlTrapGeneration = tmpvar;
+ StorageTmp->pingCtlTrapGenerationLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_pingCtlTrapProbeFailureFilter(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name,
+ size_t name_len)
+{
+ static size_t tmpvar;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("pingCtlTable",
+ "pingCtlTrapProbeFailureFilter entering action=%d... \n",
+ action));
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlTrapProbeFailureFilter not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlTrapProbeFailureFilter;
+
+ if ((*((long *) var_val)) >= 0 && (*((long *) var_val)) <= 15)
+ StorageTmp->pingCtlTrapProbeFailureFilter =
+ *((long *) var_val);
+ else
+ StorageTmp->pingCtlTrapProbeFailureFilter = 1;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->pingCtlTrapProbeFailureFilter = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+write_pingCtlTrapTestFailureFilter(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name,
+ size_t name_len)
+{
+ static size_t tmpvar;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("pingCtlTable",
+ "pingCtlTrapTestFailureFilter entering action=%d... \n",
+ action));
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlTrapTestFailureFilter not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlTrapTestFailureFilter;
+
+ if ((*((long *) var_val)) >= 0 && (*((long *) var_val)) <= 15)
+ StorageTmp->pingCtlTrapTestFailureFilter = *((long *) var_val);
+ else
+ StorageTmp->pingCtlTrapTestFailureFilter = 1;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->pingCtlTrapTestFailureFilter = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+
+int
+write_pingCtlType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static oid *tmpvar;
+ static size_t tmplen;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OBJECT_ID) {
+ snmp_log(LOG_ERR, "write to pingCtlType not ASN_OBJECT_ID\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlType;
+ tmplen = StorageTmp->pingCtlTypeLen;
+
+ StorageTmp->pingCtlType = (oid *) malloc(var_val_len);
+ if (StorageTmp->pingCtlType == NULL) {
+ exit(1);
+ }
+ memcpy(StorageTmp->pingCtlType, var_val, var_val_len);
+
+ StorageTmp->pingCtlTypeLen = var_val_len / sizeof(oid);
+
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->pingCtlType);
+ StorageTmp->pingCtlType = NULL;
+ StorageTmp->pingCtlType = tmpvar;
+ StorageTmp->pingCtlTypeLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+int
+write_pingCtlDescr(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ static size_t tmplen;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR, "write to pingCtlDescr not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlDescr;
+ tmplen = StorageTmp->pingCtlDescrLen;
+
+ StorageTmp->pingCtlDescr = (char *) malloc(var_val_len + 1);
+ if (StorageTmp->pingCtlDescr == NULL) {
+ exit(1);
+ }
+ memcpy(StorageTmp->pingCtlDescr, var_val, var_val_len);
+ StorageTmp->pingCtlDescr[var_val_len] = '\0';
+ StorageTmp->pingCtlDescrLen = var_val_len;
+
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->pingCtlDescr);
+ StorageTmp->pingCtlDescr = NULL;
+ StorageTmp->pingCtlDescr = tmpvar;
+ StorageTmp->pingCtlDescrLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+write_pingCtlSourceAddressType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("pingCtlTable",
+ "pingCtlSourceAddressType entering action=%d... \n",
+ action));
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlSourceAddressType not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlSourceAddressType;
+ StorageTmp->pingCtlSourceAddressType = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->pingCtlSourceAddressType = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+int
+write_pingCtlSourceAddress(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ static size_t tmplen;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlSourceAddress not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlSourceAddress;
+ tmplen = StorageTmp->pingCtlSourceAddressLen;
+
+ StorageTmp->pingCtlSourceAddress =
+ (char *) malloc(var_val_len + 1);
+ if (StorageTmp->pingCtlSourceAddress == NULL) {
+ exit(1);
+ }
+ memcpy(StorageTmp->pingCtlSourceAddress, var_val, var_val_len);
+ StorageTmp->pingCtlSourceAddress[var_val_len] = '\0';
+ StorageTmp->pingCtlSourceAddressLen = var_val_len;
+
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->pingCtlSourceAddress);
+ StorageTmp->pingCtlSourceAddress = NULL;
+ StorageTmp->pingCtlSourceAddress = tmpvar;
+ StorageTmp->pingCtlSourceAddressLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_pingCtlIfIndex(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("pingCtlTable",
+ "pingCtlIfIndex entering action=%d... \n", action));
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR, "write to pingCtlIfIndex not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlIfIndex;
+ StorageTmp->pingCtlIfIndex = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->pingCtlIfIndex = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+int
+write_pingCtlByPassRouteTable(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("pingCtlTable",
+ "pingCtlByPassRouteTable entering action=%d... \n",
+ action));
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlByPassRouteTable not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlByPassRouteTable;
+ StorageTmp->pingCtlByPassRouteTable = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->pingCtlByPassRouteTable = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+
+int
+write_pingCtlDSField(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct pingCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("pingCtlTable",
+ "pingCtlDSField entering action=%d... \n", action));
+
+ if ((StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to pingCtlDSField not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->pingCtlDSField;
+ StorageTmp->pingCtlDSField = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->pingCtlDSField = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+write_pingCtlRowStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ struct pingCtlTable_data *StorageTmp = NULL;
+ static struct pingCtlTable_data *StorageNew, *StorageDel;
+ size_t newlen =
+ name_len - (sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+ static int old_value;
+ int set_value;
+ static netsnmp_variable_list *vars, *vp;
+ struct header_complex_index *hciptr = NULL;
+
+ DEBUGMSGTL(("pingCtlTable",
+ "var_pingCtlTable: Entering... action=%ul\n", action));
+ StorageTmp =
+ header_complex(pingCtlTableStorage, NULL,
+ &name[sizeof(pingCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL);
+
+ if (var_val_type != ASN_INTEGER || var_val == NULL) {
+ snmp_log(LOG_ERR, "write to pingCtlRowStatus not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ set_value = *((long *) var_val);
+
+
+ /*
+ * check legal range, and notReady is reserved for us, not a user
+ */
+ if (set_value < 1 || set_value > 6 || set_value == RS_NOTREADY)
+ return SNMP_ERR_INCONSISTENTVALUE;
+
+
+ switch (action) {
+ case RESERVE1:
+ /*
+ * stage one: test validity
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * create the row now?
+ */
+
+
+ /*
+ * ditch illegal values now
+ */
+ if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) {
+
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ /*
+ * destroying a non-existent row is actually legal
+ */
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+
+
+ /*
+ * illegal creation values
+ */
+ if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else {
+ /*
+ * row exists. Check for a valid state change
+ */
+ if (set_value == RS_CREATEANDGO
+ || set_value == RS_CREATEANDWAIT) {
+ /*
+ * can't create a row that exists
+ */
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ /*
+ * XXX: interaction with row storage type needed
+ */
+
+ if (StorageTmp->pingCtlRowStatus == RS_ACTIVE &&
+ set_value != RS_DESTROY) {
+ /*
+ * "Once made active an entry may not be modified except to
+ * delete it." XXX: doesn't this in fact apply to ALL
+ * columns of the table and not just this one?
+ */
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE)
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ break;
+
+
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ if (StorageTmp == NULL) {
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+ /*
+ * creation
+ */
+ vars = NULL;
+
+ /*
+ * ½«nameΪ¿ÕµÄÈý¸öË÷Òý×ֶμӵ½var±äÁ¿ÁбíµÄĩβ
+ */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0); /* pingCtlTestName */
+
+ if (header_complex_parse_oid
+ (&
+ (name
+ [sizeof(pingCtlTable_variables_oid) / sizeof(oid) +
+ 2]), newlen, vars) != SNMPERR_SUCCESS) {
+ /*
+ * XXX: free, zero vars
+ */
+ /* snmp_free_varbind(vars); */
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+ vp = vars;
+
+ StorageNew = create_pingCtlTable_data();
+ if (vp->val_len <= 32) {
+ StorageNew->pingCtlOwnerIndex = malloc(vp->val_len + 1);
+ memcpy(StorageNew->pingCtlOwnerIndex, vp->val.string,
+ vp->val_len);
+ StorageNew->pingCtlOwnerIndex[vp->val_len] = '\0';
+ StorageNew->pingCtlOwnerIndexLen = vp->val_len;
+ } else {
+ StorageNew->pingCtlOwnerIndex = malloc(33);
+ memcpy(StorageNew->pingCtlOwnerIndex, vp->val.string, 32);
+ StorageNew->pingCtlOwnerIndex[32] = '\0';
+ StorageNew->pingCtlOwnerIndexLen = 32;
+ }
+
+ vp = vp->next_variable;
+
+ if (vp->val_len <= 32) {
+ StorageNew->pingCtlTestName = malloc(vp->val_len + 1);
+ memcpy(StorageNew->pingCtlTestName, vp->val.string,
+ vp->val_len);
+ StorageNew->pingCtlTestName[vp->val_len] = '\0';
+ StorageNew->pingCtlTestNameLen = vp->val_len;
+ } else {
+ StorageNew->pingCtlTestName = malloc(33);
+ memcpy(StorageNew->pingCtlTestName, vp->val.string, 32);
+ StorageNew->pingCtlTestName[32] = '\0';
+ StorageNew->pingCtlTestNameLen = 32;
+ }
+ vp = vp->next_variable;
+
+ /*
+ * XXX: fill in default row values here into StorageNew
+ */
+
+ StorageNew->pingCtlRowStatus = set_value;
+
+
+ /*
+ * XXX: free, zero vars, no longer needed?
+ */
+ /* snmp_free_varbind(vars); */
+ }
+
+
+ break;
+
+
+
+
+ case FREE:
+ /*
+ * XXX: free, zero vars
+ */
+
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in set_value for you to
+ * use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in
+ * the UNDO case
+ */
+
+ if (StorageTmp == NULL) {
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+ /*
+ * row creation, so add it
+ */
+ if (StorageNew != NULL)
+#if 1
+ DEBUGMSGTL(("pingCtlTable",
+ "write_pingCtlRowStatus entering new=%d... \n",
+ action));
+#endif
+ pingCtlTable_add(StorageNew);
+ /*
+ * XXX: ack, and if it is NULL?
+ */
+ } else if (set_value != RS_DESTROY) {
+ /*
+ * set the flag?
+ */
+ old_value = StorageTmp->pingCtlRowStatus;
+ StorageTmp->pingCtlRowStatus = *((long *) var_val);
+ } else {
+ /*
+ * destroy... extract it for now
+ */
+
+ hciptr =
+ header_complex_find_entry(pingCtlTableStorage, StorageTmp);
+ StorageDel =
+ header_complex_extract_entry(&pingCtlTableStorage, hciptr);
+ snmp_alarm_unregister(StorageDel->timer_id);
+
+ pingResultsTable_del(StorageTmp);
+ pingProbeHistoryTable_del(StorageTmp);
+ }
+ break;
+
+
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ if (StorageTmp == NULL) {
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+ /*
+ * row creation, so remove it again
+ */
+ hciptr =
+ header_complex_find_entry(pingCtlTableStorage, StorageNew);
+ StorageDel =
+ header_complex_extract_entry(&pingCtlTableStorage, hciptr);
+
+ /*
+ * XXX: free it
+ */
+ } else if (StorageDel != NULL) {
+ /*
+ * row deletion, so add it again
+ */
+ pingCtlTable_add(StorageDel);
+ pingResultsTable_add(StorageDel);
+ pingProbeHistoryTable_addall(StorageDel);
+ } else {
+ StorageTmp->pingCtlRowStatus = old_value;
+ }
+ break;
+
+
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ if (StorageTmp == NULL) {
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+ }
+
+ if (StorageDel != NULL) {
+ /*
+ * if(strlen(StorageDel->pingCtlOwnerIndex)!=0)
+ * SNMP_FREE(StorageDel->pingCtlOwnerIndex);
+ * printf("COMMIT1 \n");
+ * if(strlen(StorageDel->pingCtlTestName)!=0)
+ * SNMP_FREE(StorageDel->pingCtlTestName);
+ * printf("COMMIT2 \n");
+ * if(strlen(StorageDel->pingCtlTargetAddress)!=0)
+ * SNMP_FREE(StorageDel->pingCtlTargetAddress);
+ * printf("COMMIT3 \n");
+ * if(strlen(StorageDel->pingCtlDataFill)!=0)
+ * SNMP_FREE(StorageDel->pingCtlDataFill);
+ * printf("COMMIT4 \n");
+ * if(strlen(StorageDel->pingCtlTrapGeneration)!=0)
+ * SNMP_FREE(StorageDel->pingCtlTrapGeneration);
+ * printf("COMMIT5 \n");
+ * if(StorageDel->pingCtlTypeLen!=0)
+ * SNMP_FREE(StorageDel->pingCtlType);
+ * printf("COMMIT6 \n");
+ * if(strlen(StorageDel->pingCtlDescr)!=0)
+ * SNMP_FREE(StorageDel->pingCtlDescr);
+ * printf("COMMIT7 \n");
+ * if(strlen(StorageDel->pingCtlSourceAddress)!=0)
+ * SNMP_FREE(StorageDel->pingCtlSourceAddress);
+ * printf("COMMIT8 \n");
+ */
+ StorageDel = NULL;
+ /* StorageDel = 0; */
+ /*
+ * XXX: free it, its dead
+ */
+ } else {
+ if (StorageTmp
+ && StorageTmp->pingCtlRowStatus == RS_CREATEANDGO) {
+ StorageTmp->pingCtlRowStatus = RS_ACTIVE;
+ } else if (StorageTmp &&
+ StorageTmp->pingCtlRowStatus == RS_CREATEANDWAIT) {
+ DEBUGMSGTL(("pingCtlTable",
+ "write_pingCtlRowStatus entering pingCtlRowStatus=%ld... \n",
+ StorageTmp->pingCtlRowStatus));
+
+ StorageTmp->pingCtlRowStatus = RS_NOTINSERVICE;
+ }
+ }
+ if (StorageTmp && StorageTmp->pingCtlRowStatus == RS_ACTIVE) {
+#if 1
+ DEBUGMSGTL(("pingCtlTable",
+ "write_pingCtlRowStatus entering runbefore \n"));
+
+#endif
+
+ if (StorageTmp->pingCtlAdminStatus == 1) {
+ init_resultsTable(StorageTmp);
+ if (StorageTmp->pingCtlFrequency != 0)
+ StorageTmp->timer_id =
+ snmp_alarm_register(StorageTmp->pingCtlFrequency,
+ SA_REPEAT, run_ping,
+ StorageTmp);
+ else
+ StorageTmp->timer_id =
+ snmp_alarm_register(1, (int) NULL, run_ping,
+ StorageTmp);
+
+ }
+
+ }
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+static inline void
+tvsub(struct timeval *out, struct timeval *in)
+{
+ if ((out->tv_usec -= in->tv_usec) < 0) {
+ --out->tv_sec;
+ out->tv_usec += 1000000;
+ }
+ out->tv_sec -= in->tv_sec;
+}
+
+
+static inline int
+schedule_exit(int next, int *deadline, long *npackets, long *nreceived,
+ long *ntransmitted, long *tmax)
+{
+ if ((*npackets) && (*ntransmitted) >= (*npackets) && !(*deadline))
+ next = __schedule_exit(next, nreceived, tmax);
+ return next;
+}
+
+static inline int
+in_flight(__u16 * acked, long *nreceived, long *ntransmitted,
+ long *nerrors)
+{
+ __u16 diff = (__u16) (*ntransmitted) - (*acked);
+ return (diff <=
+ 0x7FFF) ? diff : (*ntransmitted) - (*nreceived) - (*nerrors);
+}
+
+static inline void
+acknowledge(__u16 seq, __u16 * acked, long *ntransmitted, int *pipesize)
+{
+ __u16 diff = (__u16) (*ntransmitted) - seq;
+ if (diff <= 0x7FFF) {
+ if ((int) diff + 1 > (*pipesize))
+ (*pipesize) = (int) diff + 1;
+ if ((__s16) (seq - (*acked)) > 0 ||
+ (__u16) (*ntransmitted) - (*acked) > 0x7FFF)
+ *acked = seq;
+ }
+}
+
+static inline void
+advance_ntransmitted(__u16 * acked, long *ntransmitted)
+{
+ (*ntransmitted)++;
+ /*
+ * Invalidate acked, if 16 bit seq overflows.
+ */
+ if ((__u16) (*ntransmitted) - (*acked) > 0x7FFF)
+ *acked = (__u16) (*ntransmitted) + 1;
+}
+
+
+static inline void
+update_interval(int uid, int interval, int *rtt_addend, int *rtt)
+{
+ int est = (*rtt) ? (*rtt) / 8 : interval * 1000;
+
+ interval = (est + (*rtt_addend) + 500) / 1000;
+ if (uid && interval < MINUSERINTERVAL)
+ interval = MINUSERINTERVAL;
+}
+
+
+
+int
+__schedule_exit(int next, long *nreceived, long *tmax)
+{
+ unsigned long waittime;
+ struct itimerval it;
+
+ if (*nreceived) {
+ waittime = 2 * (*tmax);
+ if (waittime < 1000000)
+ waittime = 1000000;
+ } else
+ waittime = MAXWAIT * 1000000;
+
+ if (next < 0 || next < waittime / 1000)
+ next = waittime / 1000;
+
+ it.it_interval.tv_sec = 0;
+ it.it_interval.tv_usec = 0;
+ it.it_value.tv_sec = waittime / 1000000;
+ it.it_value.tv_usec = waittime % 1000000;
+ /* setitimer(ITIMER_REAL, &it, NULL); */
+ return next;
+}
+
+
+/*
+ * pinger --
+ * Compose and transmit an ICMP ECHO REQUEST packet. The IP packet
+ * will be added on by the kernel. The ID field is our UNIX process ID,
+ * and the sequence number is an ascending integer. The first 8 bytes
+ * of the data portion are used to hold a UNIX "timeval" struct in VAX
+ * byte-order, to compute the round-trip time.
+ */
+
+int
+pinger(int icmp_sock, int preload, int cmsglen, char *cmsgbuf,
+ struct sockaddr_in6 *whereto, int *rtt_addend, int options, int uid,
+ int interval, int datalen, int timing, char *outpack, int *rtt,
+ int *ident, int *screen_width, int *deadline, __u16 * acked,
+ long *npackets, long *nreceived, long *ntransmitted, long *nerrors,
+ int *confirm_flag, int *confirm, int *pipesize,
+ struct timeval *cur_time)
+{
+ static int tokens;
+ int i;
+
+ /*
+ * Have we already sent enough? If we have, return an arbitrary positive value.
+ */
+
+ if (exiting
+ || ((*npackets) && (*ntransmitted) >= (*npackets)
+ && !(*deadline))) {
+
+ return 1000;
+ }
+ /*
+ * Check that packets < rate*time + preload
+ */
+ if ((*cur_time).tv_sec == 0) {
+
+ gettimeofday(cur_time, NULL);
+ tokens = interval * (preload - 1);
+ } else {
+ long ntokens;
+ struct timeval tv;
+
+ gettimeofday(&tv, NULL);
+ ntokens = (tv.tv_sec - (*cur_time).tv_sec) * 1000 +
+ (tv.tv_usec - (*cur_time).tv_usec) / 1000;
+ if (!interval) {
+ /*
+ * Case of unlimited flood is special;
+ * * if we see no reply, they are limited to 100pps
+ */
+ if (ntokens < MININTERVAL
+ && in_flight(acked, nreceived, ntransmitted,
+ nerrors) >= preload)
+ return MININTERVAL - ntokens;
+ }
+ ntokens += tokens;
+
+ if (ntokens > interval * preload)
+ ntokens = interval * preload;
+
+ if (ntokens < interval) {
+ return interval - ntokens;
+ }
+ *cur_time = tv;
+ tokens = ntokens - interval;
+ }
+
+ resend:
+ i = send_v6(icmp_sock, cmsglen, cmsgbuf, whereto, datalen, timing,
+ outpack, ident, ntransmitted, confirm);
+
+ if (i == 0) {
+ advance_ntransmitted(acked, ntransmitted);
+ if (!(options & F_QUIET) && (options & F_FLOOD)) {
+ /*
+ * Very silly, but without this output with
+ * * high preload or pipe size is very confusing.
+ */
+ if ((preload < (*screen_width)
+ && (*pipesize) < (*screen_width))
+ || in_flight(acked, nreceived, ntransmitted,
+ nerrors) < (*screen_width))
+ write(STDOUT_FILENO, ".", 1);
+ }
+
+ return interval - tokens;
+ }
+
+ /*
+ * And handle various errors...
+ */
+ if (i > 0) {
+ /*
+ * Apparently, it is some fatal bug.
+ */
+ abort();
+ } else if (errno == ENOBUFS || errno == ENOMEM) {
+ /*
+ * Device queue overflow or OOM. Packet is not sent.
+ */
+ tokens = 0;
+ /*
+ * Slowdown. This works only in adaptive mode (option -A)
+ */
+ (*rtt_addend) += ((*rtt) < 8 * 50000 ? (*rtt) / 8 : 50000);
+ if (options & F_ADAPTIVE)
+ update_interval(uid, interval, rtt_addend, rtt);
+
+ return SCHINT(interval);
+ } else if (errno == EAGAIN) {
+ /*
+ * Socket buffer is full.
+ */
+ tokens += interval;
+
+ return MININTERVAL;
+ } else {
+ if ((i =
+ receive_error_msg(icmp_sock, whereto, options, ident,
+ nerrors)) > 0) {
+ /*
+ * An ICMP error arrived.
+ */
+ tokens += interval;
+
+ return MININTERVAL;
+ }
+ /*
+ * Compatibility with old linuces.
+ */
+ if (i == 0 && (*confirm_flag) && errno == EINVAL) {
+ *confirm_flag = 0;
+ errno = 0;
+ }
+ if (!errno)
+ goto resend;
+
+ /*
+ * Hard local error. Pretend we sent packet.
+ */
+ advance_ntransmitted(acked, ntransmitted);
+
+ if (i == 0 && !(options & F_QUIET)) {
+ if (options & F_FLOOD)
+ write(STDOUT_FILENO, "E", 1);
+ else
+ perror("ping: sendmsg");
+ }
+ tokens = 0;
+
+ return SCHINT(interval);
+ }
+}
+
+/*
+ * Set socket buffers, "alloc" is an esimate of memory taken by single packet.
+ */
+
+void
+sock_setbufs(int icmp_sock, int alloc, int preload)
+{
+ int rcvbuf, hold;
+ int tmplen = sizeof(hold);
+ int sndbuf;
+
+ if (!sndbuf)
+ sndbuf = alloc;
+ setsockopt(icmp_sock, SOL_SOCKET, SO_SNDBUF, (char *) &sndbuf,
+ sizeof(sndbuf));
+
+ rcvbuf = hold = alloc * preload;
+ if (hold < 65536)
+ hold = 65536;
+ setsockopt(icmp_sock, SOL_SOCKET, SO_RCVBUF, (char *) &hold,
+ sizeof(hold));
+ if (getsockopt
+ (icmp_sock, SOL_SOCKET, SO_RCVBUF, (char *) &hold, &tmplen) == 0) {
+ if (hold < rcvbuf)
+ fprintf(stderr,
+ "WARNING: probably, rcvbuf is not enough to hold preload.\n");
+ }
+}
+
+/*
+ * Protocol independent setup and parameter checks.
+ */
+
+void
+setup(int icmp_sock, int options, int uid, int timeout, int preload,
+ int interval, int datalen, char *outpack, int *ident,
+ struct timeval *start_time, int *screen_width, int *deadline)
+{
+ int hold;
+ struct timeval tv;
+
+ if ((options & F_FLOOD) && !(options & F_INTERVAL))
+ interval = 0;
+
+ if (uid && interval < MINUSERINTERVAL) {
+ fprintf(stderr,
+ "ping: cannot flood; minimal interval, allowed for user, is %dms\n",
+ MINUSERINTERVAL);
+ return;
+ }
+
+ if (interval >= INT_MAX / preload) {
+ fprintf(stderr, "ping: illegal preload and/or interval\n");
+ return;
+ }
+
+ hold = 1;
+ if (options & F_SO_DEBUG)
+ setsockopt(icmp_sock, SOL_SOCKET, SO_DEBUG, (char *) &hold,
+ sizeof(hold));
+ if (options & F_SO_DONTROUTE)
+ setsockopt(icmp_sock, SOL_SOCKET, SO_DONTROUTE, (char *) &hold,
+ sizeof(hold));
+
+#ifdef SO_TIMESTAMP
+ if (!(options & F_LATENCY)) {
+ int on = 1;
+ if (setsockopt
+ (icmp_sock, SOL_SOCKET, SO_TIMESTAMP, &on, sizeof(on)))
+ fprintf(stderr,
+ "Warning: no SO_TIMESTAMP support, falling back to SIOCGSTAMP\n");
+ }
+#endif
+
+ /*
+ * Set some SNDTIMEO to prevent blocking forever
+ * * on sends, when device is too slow or stalls. Just put limit
+ * * of one second, or "interval", if it is less.
+ */
+ tv.tv_sec = 1;
+ tv.tv_usec = 0;
+ if (interval < 1000) {
+ tv.tv_sec = 0;
+ tv.tv_usec = 1000 * SCHINT(interval);
+ }
+ setsockopt(icmp_sock, SOL_SOCKET, SO_SNDTIMEO, (char *) &tv,
+ sizeof(tv));
+
+ /*
+ * Set RCVTIMEO to "interval". Note, it is just an optimization
+ * * allowing to avoid redundant poll().
+ */
+
+ tv.tv_sec = timeout;
+ tv.tv_usec = 0;
+ if (setsockopt
+ (icmp_sock, SOL_SOCKET, SO_RCVTIMEO, (char *) &tv, sizeof(tv)))
+ options |= F_FLOOD_POLL;
+
+ if (!(options & F_PINGFILLED)) {
+ int i;
+ char *p = outpack + 8;
+
+ /*
+ * Do not forget about case of small datalen,
+ * * fill timestamp area too!
+ */
+ for (i = 0; i < datalen; ++i)
+ *p++ = i;
+ }
+
+ *ident = getpid() & 0xFFFF;
+
+ gettimeofday(start_time, NULL);
+
+ if (*deadline) {
+ struct itimerval it;
+
+ it.it_interval.tv_sec = 0;
+ it.it_interval.tv_usec = 0;
+ it.it_value.tv_sec = (*deadline);
+ it.it_value.tv_usec = 0;
+ }
+
+ if (isatty(STDOUT_FILENO)) {
+ struct winsize w;
+
+ if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1) {
+ if (w.ws_col > 0)
+ *screen_width = w.ws_col;
+ }
+ }
+}
+
+void
+main_loop(struct pingCtlTable_data *item, int icmp_sock, int preload,
+ __u8 * packet, int packlen, int cmsglen, char *cmsgbuf,
+ struct sockaddr_in6 *whereto, int options, int uid,
+ char *hostname, int interval, int datalen, int timing,
+ int working_recverr, char *outpack, int *ident,
+ struct timeval *start_time, int *screen_width, int *deadline)
+{
+ char addrbuf[128];
+ char ans_data[4096];
+ struct iovec iov;
+ struct msghdr msg;
+ struct cmsghdr *c;
+ int cc = 0;
+ int next = 0;
+ int polling = 0;
+ int rtt = 0;
+ int rtt_addend = 0;
+
+ __u16 acked = 0;
+ /*
+ * counters
+ */
+ long npackets = 0; /* max packets to transmit */
+ long nreceived = 0; /* # of packets we got back */
+ long nrepeats = 0; /* number of duplicates */
+ long ntransmitted = 0; /* sequence # for outbound packets = #sent */
+ long nchecksum = 0; /* replies with bad checksum */
+ long nerrors = 0; /* icmp errors */
+
+ /*
+ * timing
+ */
+ long tmin = LONG_MAX; /* minimum round trip time */
+ long tmax = 0; /* maximum round trip time */
+ long long tsum = 0; /* sum of all times, for doing average */
+ long long tsum2 = 0;
+
+ int confirm_flag = MSG_CONFIRM;
+ int confirm = 0;
+
+ int pipesize = -1;
+ struct timeval cur_time;
+ cur_time.tv_sec = 0;
+ cur_time.tv_usec = 0;
+
+ struct pingProbeHistoryTable_data current_temp;
+ static int probeFailed = 0;
+ static int testFailed = 0;
+ static int series = 0;
+
+ iov.iov_base = (char *) packet;
+ npackets = item->pingCtlProbeCount;
+ for (;;) {
+ /*
+ * Check exit conditions.
+ */
+ if (exiting) {
+ break;
+ }
+ if (npackets && nreceived >= npackets) {
+ printf("npackets,nreceived=%d\n", nreceived);
+ break;
+ }
+ if (deadline && nerrors) {
+ printf("deadline\n");
+ break;
+ }
+
+ /*
+ * Check for and do special actions.
+ */
+ if (status_snapshot)
+ status(timing, &rtt, &nreceived, &nrepeats, &ntransmitted,
+ &tmin, &tmax, &tsum, &tsum2);
+
+ /*
+ * Send probes scheduled to this time.
+ */
+ do {
+ printf("pinger\n");
+ next =
+ pinger(icmp_sock, preload, cmsglen, cmsgbuf, whereto,
+ &rtt_addend, uid, options, interval, datalen,
+ timing, outpack, &rtt, ident, screen_width,
+ deadline, &acked, &npackets, &nreceived,
+ &ntransmitted, &nerrors, &confirm_flag, &confirm,
+ &pipesize, &cur_time);
+ printf("1:next=%d\n", next);
+ next =
+ schedule_exit(next, deadline, &npackets, &nreceived,
+ &ntransmitted, &tmax);
+ printf("2:next=%d\n", next);
+ } while (next <= 0);
+
+ /*
+ * "next" is time to send next probe, if positive.
+ * * If next<=0 send now or as soon as possible.
+ */
+
+ /*
+ * Technical part. Looks wicked. Could be dropped,
+ * * if everyone used the newest kernel. :-)
+ * * Its purpose is:
+ * * 1. Provide intervals less than resolution of scheduler.
+ * * Solution: spinning.
+ * * 2. Avoid use of poll(), when recvmsg() can provide
+ * * timed waiting (SO_RCVTIMEO).
+ */
+ polling = 0;
+ if ((options & (F_ADAPTIVE | F_FLOOD_POLL))
+ || next < SCHINT(interval)) {
+ int recv_expected =
+ in_flight(&acked, &nreceived, &ntransmitted, &nerrors);
+
+ /*
+ * If we are here, recvmsg() is unable to wait for
+ * * required timeout.
+ */
+ if (1000 * next <= 1000000 / (int) HZ) {
+ /*
+ * Very short timeout... So, if we wait for
+ * * something, we sleep for MININTERVAL.
+ * * Otherwise, spin!
+ */
+ if (recv_expected) {
+ next = MININTERVAL;
+ } else {
+ next = 0;
+ /*
+ * When spinning, no reasons to poll.
+ * * Use nonblocking recvmsg() instead.
+ */
+ polling = MSG_DONTWAIT;
+ /*
+ * But yield yet.
+ */
+ sched_yield();
+ }
+ }
+
+ if (!polling &&
+ ((options & (F_ADAPTIVE | F_FLOOD_POLL)) || interval)) {
+ struct pollfd pset;
+ pset.fd = icmp_sock;
+ pset.events = POLLIN | POLLERR;
+ pset.revents = 0;
+ if (poll(&pset, 1, next) < 1 ||
+ !(pset.revents & (POLLIN | POLLERR)))
+ continue;
+ polling = MSG_DONTWAIT;
+ }
+ }
+
+ for (;;) {
+ struct timeval *recv_timep = NULL;
+ struct timeval recv_time;
+ int not_ours = 0; /* Raw socket can receive messages
+ * destined to other running pings. */
+
+ iov.iov_len = packlen;
+ msg.msg_name = addrbuf;
+ msg.msg_namelen = sizeof(addrbuf);
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+ msg.msg_control = ans_data;
+ msg.msg_controllen = sizeof(ans_data);
+
+ cc = recvmsg(icmp_sock, &msg, polling);
+ time_t timep;
+ time(&timep);
+ polling = MSG_DONTWAIT;
+
+ if (cc < 0) {
+ if (errno == EAGAIN || errno == EINTR)
+ break;
+ if (errno == EWOULDBLOCK) {
+ struct pingResultsTable_data *StorageNew = NULL;
+ struct pingProbeHistoryTable_data *temp = NULL;
+ netsnmp_variable_list *vars = NULL;
+
+
+
+ if (series == 0)
+ probeFailed = 1;
+ else
+ probeFailed = probeFailed + 1;
+ series = 1;
+ testFailed = testFailed + 1;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->pingCtlOwnerIndex, item->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->pingCtlTestName, item->pingCtlTestNameLen); /* pingCtlTestName */
+
+
+ if ((StorageNew =
+ header_complex_get(pingResultsTableStorage,
+ vars)) == NULL)
+ return;
+
+ StorageNew->pingResultsSendProbes =
+ StorageNew->pingResultsSendProbes + 1;
+
+ temp = SNMP_MALLOC_STRUCT(pingProbeHistoryTable_data);
+
+ temp->pingCtlOwnerIndex =
+ (char *) malloc(item->pingCtlOwnerIndexLen + 1);
+ memcpy(temp->pingCtlOwnerIndex,
+ item->pingCtlOwnerIndex,
+ item->pingCtlOwnerIndexLen + 1);
+ temp->pingCtlOwnerIndex[item->pingCtlOwnerIndexLen] =
+ '\0';
+ temp->pingCtlOwnerIndexLen =
+ item->pingCtlOwnerIndexLen;
+
+ temp->pingCtlTestName =
+ (char *) malloc(item->pingCtlTestNameLen + 1);
+ memcpy(temp->pingCtlTestName, item->pingCtlTestName,
+ item->pingCtlTestNameLen + 1);
+ temp->pingCtlTestName[item->pingCtlTestNameLen] = '\0';
+ temp->pingCtlTestNameLen = item->pingCtlTestNameLen;
+
+ /* add lock to protect */
+ pthread_mutex_t counter_mutex =
+ PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_lock(&counter_mutex);
+ temp->pingProbeHistoryIndex =
+ ++(item->pingProbeHistoryMaxIndex);
+ pthread_mutex_unlock(&counter_mutex);
+ /* end */
+
+ temp->pingProbeHistoryResponse =
+ item->pingCtlTimeOut * 1000;
+ temp->pingProbeHistoryStatus = 4;
+ temp->pingProbeHistoryLastRC = 1;
+
+ temp->pingProbeHistoryTime =
+ (char *) malloc(strlen(asctime(gmtime(&timep))));
+ temp->pingProbeHistoryTime =
+ strdup(asctime(gmtime(&timep)));
+ temp->
+ pingProbeHistoryTime[strlen
+ (asctime(gmtime(&timep))) -
+ 1] = '\0';
+ temp->pingProbeHistoryTimeLen =
+ strlen(asctime(gmtime(&timep))) - 1;
+
+ if (StorageNew->pingResultsSendProbes == 1)
+ item->pingProbeHis = temp;
+ else {
+ (current_temp).next = temp;
+ }
+
+ current_temp = (*temp);
+
+ if (StorageNew->pingResultsSendProbes >=
+ item->pingCtlProbeCount) {
+ current_temp.next = NULL;
+ }
+
+ if (item->pingProbeHis != NULL)
+ if (pingProbeHistoryTable_count(item) <
+ item->pingCtlMaxRows) {
+ if (pingProbeHistoryTable_add(&current_temp) !=
+ SNMPERR_SUCCESS)
+ DEBUGMSGTL(("pingProbeHistoryTable",
+ "registered an entry error\n"));
+ } else {
+ pingProbeHistoryTable_delLast(item);
+ if (pingProbeHistoryTable_add(&current_temp) !=
+ SNMPERR_SUCCESS)
+ DEBUGMSGTL(("pingProbeHistoryTable",
+ "registered an entry error\n"));
+
+ }
+ if ((item->
+ pingCtlTrapGeneration[0] &
+ PINGTRAPGENERATION_PROBEFAILED) != 0) {
+ if (probeFailed >=
+ item->pingCtlTrapProbeFailureFilter)
+ send_ping_trap(item, pingProbeFailed,
+ sizeof(pingProbeFailed) /
+ sizeof(oid));
+ }
+ break;
+ }
+ /* timeout finish */
+ if (!receive_error_msg
+ (icmp_sock, whereto, options, ident, &nerrors)) {
+ if (errno) {
+ perror("ping: recvmsg");
+ break;
+ }
+ not_ours = 1;
+ }
+ } else {
+ printf("cc>=0,else\n");
+#ifdef SO_TIMESTAMP
+ for (c = CMSG_FIRSTHDR(&msg); c; c = CMSG_NXTHDR(&msg, c)) {
+ if (c->cmsg_level != SOL_SOCKET ||
+ c->cmsg_type != SO_TIMESTAMP)
+ continue;
+ if (c->cmsg_len < CMSG_LEN(sizeof(struct timeval)))
+ continue;
+ recv_timep = (struct timeval *) CMSG_DATA(c);
+ }
+#endif
+
+ if ((options & F_LATENCY) || recv_timep == NULL) {
+ if ((options & F_LATENCY) ||
+ ioctl(icmp_sock, SIOCGSTAMP, &recv_time))
+ gettimeofday(&recv_time, NULL);
+ recv_timep = &recv_time;
+ }
+
+ not_ours =
+ parse_reply(&series, item, &msg, cc, addrbuf,
+ recv_timep, timep, uid, whereto,
+ &rtt_addend, options, interval, datalen,
+ timing, working_recverr, outpack, &rtt,
+ ident, &acked, &nreceived, &nrepeats,
+ &ntransmitted, &nchecksum, &nerrors, &tmin,
+ &tmax, &tsum, &tsum2, &confirm_flag,
+ &confirm, &pipesize, &current_temp);
+ }
+
+ /*
+ * See? ... someone runs another ping on this host.
+ */
+ if (not_ours)
+ install_filter(icmp_sock, ident);
+
+ /*
+ * If nothing is in flight, "break" returns us to pinger.
+ */
+ if (in_flight(&acked, &nreceived, &ntransmitted, &nerrors) ==
+ 0)
+ break;
+
+ /*
+ * Otherwise, try to recvmsg() again. recvmsg()
+ * * is nonblocking after the first iteration, so that
+ * * if nothing is queued, it will receive EAGAIN
+ * * and return to pinger.
+ */
+ }
+ }
+
+ if (ntransmitted == item->pingCtlProbeCount) {
+
+ if ((item->
+ pingCtlTrapGeneration[0] & PINGTRAPGENERATION_TESTCOMPLETED)
+ != 0) {
+ send_ping_trap(item, pingTestCompleted,
+ sizeof(pingTestCompleted) / sizeof(oid));
+ } else
+ if ((item->
+ pingCtlTrapGeneration[0] & PINGTRAPGENERATION_TESTFAILED)
+ != 0) {
+
+ if (testFailed >= item->pingCtlTrapTestFailureFilter)
+ send_ping_trap(item, pingTestFailed,
+ sizeof(pingTestFailed) / sizeof(oid));
+ }
+
+ else if ((item->
+ pingCtlTrapGeneration[0] &
+ PINGTRAPGENERATION_PROBEFAILED) != 0) {;
+ } else {
+ ;
+ }
+
+ series = 0;
+ probeFailed = 0;
+ testFailed = 0;
+
+ }
+
+ finish(options, hostname, interval, timing, &rtt, start_time, deadline,
+ &npackets, &nreceived, &nrepeats, &ntransmitted, &nchecksum,
+ &nerrors, &tmin, &tmax, &tsum, &tsum2, &pipesize, &cur_time);
+}
+
+int
+gather_statistics(int *series, struct pingCtlTable_data *item, __u8 * ptr,
+ int cc, __u16 seq, int hops, int csfailed,
+ struct timeval *tv, time_t timep, int *rtt_addend,
+ int uid, int options, char *from, int interval,
+ int datalen, int timing, char *outpack, int *rtt,
+ __u16 * acked, long *nreceived, long *nrepeats,
+ long *ntransmitted, long *nchecksum, long *tmin,
+ long *tmax, long long *tsum, long long *tsum2,
+ int *confirm_flag, int *confirm, int *pipesize,
+ struct pingProbeHistoryTable_data *current_temp)
+{
+ int dupflag = 0;
+ long triptime = 0;
+ int mx_dup_ck = MAX_DUP_CHK;
+
+ netsnmp_variable_list *vars = NULL;
+ struct pingResultsTable_data *StorageNew = NULL;
+ struct pingProbeHistoryTable_data *temp = NULL;
+ ++(*nreceived);
+ *series = 0;
+ if (!csfailed)
+ acknowledge(seq, acked, ntransmitted, pipesize);
+
+ if (timing && cc >= 8 + sizeof(struct timeval)) {
+ struct timeval tmp_tv;
+ memcpy(&tmp_tv, ptr, sizeof(tmp_tv));
+
+ restamp:
+ tvsub(tv, &tmp_tv);
+ triptime = tv->tv_sec * 1000000 + tv->tv_usec;
+ if (triptime < 0) {
+ fprintf(stderr,
+ "Warning: time of day goes back (%ldus), taking countermeasures.\n",
+ triptime);
+ triptime = 0;
+ if (!(options & F_LATENCY)) {
+ gettimeofday(tv, NULL);
+ options |= F_LATENCY;
+ goto restamp;
+ }
+ }
+ if (!csfailed) {
+ (*tsum) += triptime;
+ (*tsum2) += (long long) triptime *(long long) triptime;
+ if (triptime < (*tmin))
+ (*tmin) = triptime;
+ if (triptime > (*tmax))
+ (*tmax) = triptime;
+ if (!(*rtt))
+ *rtt = triptime * 8;
+ else
+ *rtt += triptime - (*rtt) / 8;
+ if (options & F_ADAPTIVE)
+ update_interval(uid, interval, rtt_addend, rtt);
+ }
+ }
+
+ if (csfailed) {
+ ++(*nchecksum);
+ --(*nreceived);
+ } else if (TST(seq % mx_dup_ck)) {
+ ++(*nrepeats);
+ --(*nreceived);
+ dupflag = 1;
+ } else {
+ SET(seq % mx_dup_ck);
+ dupflag = 0;
+ }
+ *confirm = *confirm_flag;
+
+ if (options & F_QUIET)
+ return 1;
+
+ if (options & F_FLOOD) {
+ if (!csfailed)
+ write(STDOUT_FILENO, "\b \b", 3);
+ else
+ write(STDOUT_FILENO, "\bC", 1);
+ } else {
+ int i;
+ __u8 *cp, *dp;
+ printf("%d bytes from %s: icmp_seq=%u", cc, from, seq);
+
+ if (hops >= 0)
+ printf(" ttl=%d", hops);
+
+ if (cc < datalen + 8) {
+ printf(" (truncated)\n");
+ return 1;
+ }
+ if (timing) {
+ if (triptime >= 100000)
+ printf(" time=%ld ms", triptime / 1000);
+ else if (triptime >= 10000)
+ printf(" time=%ld.%01ld ms", triptime / 1000,
+ (triptime % 1000) / 100);
+ else if (triptime >= 1000)
+ printf(" time=%ld.%02ld ms", triptime / 1000,
+ (triptime % 1000) / 10);
+ else
+ printf(" time=%ld.%03ld ms", triptime / 1000,
+ triptime % 1000);
+ }
+ if (dupflag)
+ printf(" (DUP!)");
+ if (csfailed)
+ printf(" (BAD CHECKSUM!)");
+
+ /*
+ * check the data
+ */
+ cp = ((u_char *) ptr) + sizeof(struct timeval);
+ dp = &outpack[8 + sizeof(struct timeval)];
+ for (i = sizeof(struct timeval); i < datalen; ++i, ++cp, ++dp) {
+ if (*cp != *dp) {
+ printf("\nwrong data byte #%d should be 0x%x but was 0x%x",
+ i, *dp, *cp);
+ cp = (u_char *) ptr + sizeof(struct timeval);
+ for (i = sizeof(struct timeval); i < datalen; ++i, ++cp) {
+ if ((i % 32) == sizeof(struct timeval))
+ printf("\n#%d\t", i);
+ printf("%x ", *cp);
+ }
+ break;
+ }
+ }
+ }
+
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->pingCtlOwnerIndex, item->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->pingCtlTestName, item->pingCtlTestNameLen); /* pingCtlTestName */
+
+
+ if ((StorageNew =
+ header_complex_get(pingResultsTableStorage, vars)) == NULL)
+ return SNMP_ERR_NOSUCHNAME;
+
+
+ StorageNew->pingResultsMinRtt = *tmin;
+ StorageNew->pingResultsMaxRtt = *tmax;
+ StorageNew->pingResultsAverageRtt =
+ (*tsum) / (StorageNew->pingResultsProbeResponses + 1);
+ StorageNew->pingResultsProbeResponses =
+ StorageNew->pingResultsProbeResponses + 1;
+ StorageNew->pingResultsSendProbes =
+ StorageNew->pingResultsSendProbes + 1;
+ StorageNew->pingResultsRttSumOfSquares = *tsum2;
+
+ StorageNew->pingResultsLastGoodProbe =
+ (char *) malloc(strlen(asctime(gmtime(&timep))));
+ StorageNew->pingResultsLastGoodProbe = strdup(asctime(gmtime(&timep)));
+ StorageNew->pingResultsLastGoodProbe[strlen(asctime(gmtime(&timep))) -
+ 1] = '\0';
+ StorageNew->pingResultsLastGoodProbeLen =
+ strlen(asctime(gmtime(&timep))) - 1;
+
+ /* ProbeHistory */
+ if (item->pingCtlMaxRows != 0) {
+ temp = SNMP_MALLOC_STRUCT(pingProbeHistoryTable_data);
+
+ temp->pingCtlOwnerIndex =
+ (char *) malloc(item->pingCtlOwnerIndexLen + 1);
+ memcpy(temp->pingCtlOwnerIndex, item->pingCtlOwnerIndex,
+ item->pingCtlOwnerIndexLen + 1);
+ temp->pingCtlOwnerIndex[item->pingCtlOwnerIndexLen] = '\0';
+ temp->pingCtlOwnerIndexLen = item->pingCtlOwnerIndexLen;
+
+ temp->pingCtlTestName =
+ (char *) malloc(item->pingCtlTestNameLen + 1);
+ memcpy(temp->pingCtlTestName, item->pingCtlTestName,
+ item->pingCtlTestNameLen + 1);
+ temp->pingCtlTestName[item->pingCtlTestNameLen] = '\0';
+ temp->pingCtlTestNameLen = item->pingCtlTestNameLen;
+
+ /* add lock to protect */
+ pthread_mutex_t counter_mutex = PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_lock(&counter_mutex);
+ if (item->pingProbeHistoryMaxIndex >= (unsigned long) (2147483647))
+ item->pingProbeHistoryMaxIndex = 0;
+ temp->pingProbeHistoryIndex = ++(item->pingProbeHistoryMaxIndex);
+ pthread_mutex_unlock(&counter_mutex);
+ /* end */
+
+
+ temp->pingProbeHistoryResponse = triptime;
+ temp->pingProbeHistoryStatus = 1;
+ temp->pingProbeHistoryLastRC = 0;
+
+ temp->pingProbeHistoryTime =
+ (char *) malloc(strlen(asctime(gmtime(&timep))));
+ temp->pingProbeHistoryTime = strdup(asctime(gmtime(&timep)));
+ temp->pingProbeHistoryTime[strlen(asctime(gmtime(&timep))) - 1] = '\0';
+ temp->pingProbeHistoryTimeLen =
+ strlen(asctime(gmtime(&timep))) - 1;
+
+ if (StorageNew->pingResultsSendProbes == 1)
+ item->pingProbeHis = temp;
+ else {
+ (current_temp)->next = temp;
+ }
+
+ current_temp = temp;
+
+ if (StorageNew->pingResultsSendProbes >= item->pingCtlProbeCount) {
+ current_temp->next = NULL;
+ }
+
+ if (item->pingProbeHis != NULL) {
+
+ if (pingProbeHistoryTable_count(item) < item->pingCtlMaxRows) {
+ if (pingProbeHistoryTable_add(current_temp) !=
+ SNMPERR_SUCCESS)
+ DEBUGMSGTL(("pingProbeHistoryTable",
+ "registered an entry error\n"));
+ } else {
+ pingProbeHistoryTable_delLast(item);
+
+ if (pingProbeHistoryTable_add(current_temp) !=
+ SNMPERR_SUCCESS)
+ DEBUGMSGTL(("pingProbeHistoryTable",
+ "registered an entry error\n"));
+
+ }
+
+ }
+ }
+ return 0;
+}
+
+static long
+llsqrt(long long a)
+{
+ long long prev = ~((long long) 1 << 63);
+ long long x = a;
+
+ if (x > 0) {
+ while (x < prev) {
+ prev = x;
+ x = (x + (a / x)) / 2;
+ }
+ }
+
+ return (long) x;
+}
+
+/*
+ * finish --
+ * Print out statistics, and give up.
+ */
+void
+finish(int options, char *hostname, int interval, int timing, int *rtt,
+ struct timeval *start_time, int *deadline, long *npackets,
+ long *nreceived, long *nrepeats, long *ntransmitted,
+ long *nchecksum, long *nerrors, long *tmin, long *tmax,
+ long long *tsum, long long *tsum2, int *pipesize,
+ struct timeval *cur_time)
+{
+ struct timeval tv = *cur_time;
+
+ tvsub(&tv, start_time);
+
+ putchar('\n');
+ fflush(stdout);
+ printf("--- %s ping statistics ---\n", hostname);
+
+ if (*nrepeats)
+ printf(", +%ld duplicates", *nrepeats);
+ if (*nchecksum)
+ printf(", +%ld corrupted", *nchecksum);
+ if (*nerrors)
+ printf(", +%ld errors", *nerrors);
+ if (*ntransmitted) {
+ printf(", %d%% loss",
+ (int) ((((long long) ((*ntransmitted) -
+ (*nreceived))) * 100) /
+ (*ntransmitted)));
+ printf(", time %ldms", 1000 * tv.tv_sec + tv.tv_usec / 1000);
+ }
+ putchar('\n');
+
+ if ((*nreceived) && timing) {
+ long tmdev;
+
+ (*tsum) /= (*nreceived) + (*nrepeats);
+ (*tsum2) /= (*nreceived) + (*nrepeats);
+ tmdev = llsqrt((*tsum2) - (*tsum) * (*tsum));
+
+ printf
+ ("rtt min/avg/max/mdev = %ld.%03ld/%lu.%03ld/%ld.%03ld/%ld.%03ld ms",
+ (*tmin) / 1000, (*tmin) % 1000,
+ (unsigned long) ((*tsum) / 1000), (long) ((*tsum) % 1000),
+ (*tmax) / 1000, (*tmax) % 1000, tmdev / 1000, tmdev % 1000);
+ }
+ if ((*pipesize) > 1)
+ printf(", pipe %d", *pipesize);
+ if ((*ntransmitted) > 1
+ && (!interval || (options & (F_FLOOD | F_ADAPTIVE)))) {
+ int ipg =
+ (1000000 * (long long) tv.tv_sec +
+ tv.tv_usec) / ((*ntransmitted) - 1);
+ printf(", ipg/ewma %d.%03d/%d.%03d ms", ipg / 1000, ipg % 1000,
+ (*rtt) / 8000, ((*rtt) / 8) % 1000);
+ }
+ putchar('\n');
+ return;
+ /* return(deadline ? (*nreceived)<(*npackets) : (*nreceived)==0); */
+}
+
+
+void
+status(int timing, int *rtt, long *nreceived, long *nrepeats,
+ long *ntransmitted, long *tmin, long *tmax, long long *tsum,
+ long long *tsum2)
+{
+ int loss = 0;
+ long tavg = 0;
+
+ status_snapshot = 0;
+
+ if (*ntransmitted)
+ loss =
+ (((long long) ((*ntransmitted) -
+ (*nreceived))) * 100) / (*ntransmitted);
+
+ fprintf(stderr, "\r%ld/%ld packets, %d%% loss", *ntransmitted,
+ *nreceived, loss);
+
+ if ((*nreceived) && timing) {
+ tavg = (*tsum) / ((*nreceived) + (*nrepeats));
+
+ fprintf(stderr,
+ ", min/avg/ewma/max = %ld.%03ld/%lu.%03ld/%d.%03d/%ld.%03ld ms",
+ (*tmin) / 1000, (*tmin) % 1000, tavg / 1000, tavg % 1000,
+ (*rtt) / 8000, ((*rtt) / 8) % 1000, (*tmax) / 1000,
+ (*tmax) % 1000);
+ }
+ fprintf(stderr, "\n");
+}
+
+
+static __inline__ int
+ipv6_addr_any(struct in6_addr *addr)
+{
+ static struct in6_addr in6_anyaddr;
+ return (memcmp(addr, &in6_anyaddr, 16) == 0);
+}
+
+int
+receive_error_msg(int icmp_sock, struct sockaddr_in6 *whereto, int options,
+ int *ident, long *nerrors)
+{
+ int res;
+ char cbuf[512];
+ struct iovec iov;
+ struct msghdr msg;
+ struct cmsghdr *cmsg;
+ struct sock_extended_err *e;
+ struct icmp6hdr icmph;
+ struct sockaddr_in6 target;
+ int net_errors = 0;
+ int local_errors = 0;
+ int saved_errno = errno;
+
+ iov.iov_base = &icmph;
+ iov.iov_len = sizeof(icmph);
+ msg.msg_name = (void *) &target;
+ msg.msg_namelen = sizeof(target);
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+ msg.msg_flags = 0;
+ msg.msg_control = cbuf;
+ msg.msg_controllen = sizeof(cbuf);
+
+ res = recvmsg(icmp_sock, &msg, MSG_ERRQUEUE | MSG_DONTWAIT);
+ if (res < 0)
+ goto out;
+
+ e = NULL;
+ for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+ if (cmsg->cmsg_level == SOL_IPV6) {
+ if (cmsg->cmsg_type == IPV6_RECVERR)
+ e = (struct sock_extended_err *) CMSG_DATA(cmsg);
+ }
+ }
+ if (e == NULL)
+ abort();
+
+ if (e->ee_origin == SO_EE_ORIGIN_LOCAL) {
+ local_errors++;
+ if (options & F_QUIET)
+ goto out;
+ if (options & F_FLOOD)
+ write(STDOUT_FILENO, "E", 1);
+ else if (e->ee_errno != EMSGSIZE)
+ fprintf(stderr, "ping: local error: %s\n",
+ strerror(e->ee_errno));
+ else
+ fprintf(stderr,
+ "ping: local error: Message too long, mtu=%u\n",
+ e->ee_info);
+ (*nerrors)++;
+ } else if (e->ee_origin == SO_EE_ORIGIN_ICMP6) {
+ struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) (e + 1);
+
+ if (res < sizeof(icmph) ||
+ memcmp(&target.sin6_addr, &(whereto->sin6_addr), 16) ||
+ icmph.icmp6_type != ICMPV6_ECHO_REQUEST ||
+ icmph.icmp6_identifier != *ident) {
+ /*
+ * Not our error, not an error at all. Clear.
+ */
+ saved_errno = 0;
+ goto out;
+ }
+
+ net_errors++;
+ (*nerrors)++;
+ if (options & F_QUIET)
+ goto out;
+ if (options & F_FLOOD) {
+ write(STDOUT_FILENO, "\bE", 2);
+ } else {
+ fflush(stdout);
+ }
+ }
+
+ out:
+ errno = saved_errno;
+ return net_errors ? : -local_errors;
+}
+
+int
+send_v6(int icmp_sock, int cmsglen, char *cmsgbuf,
+ struct sockaddr_in6 *whereto, int datalen, int timing,
+ char *outpack, int *ident, long *ntransmitted, int *confirm)
+{
+ struct icmp6hdr *icmph;
+ int cc;
+ int i;
+ int mx_dup_ck = MAX_DUP_CHK;
+
+ icmph = (struct icmp6hdr *) outpack;
+ icmph->icmp6_type = ICMPV6_ECHO_REQUEST;
+ icmph->icmp6_code = 0;
+ icmph->icmp6_cksum = 0;
+ icmph->icmp6_sequence = (*ntransmitted) + 1;
+ icmph->icmp6_identifier = *ident;
+
+ CLR(icmph->icmp6_sequence % mx_dup_ck);
+
+ if (timing)
+ gettimeofday((struct timeval *) &outpack[8],
+ (struct timezone *) NULL);
+
+ cc = datalen + 8; /* skips ICMP portion */
+
+ if (cmsglen == 0) {
+ i = sendto(icmp_sock, (char *) outpack, cc, *confirm,
+ (struct sockaddr *) whereto,
+ sizeof(struct sockaddr_in6));
+ } else {
+ struct msghdr mhdr;
+ struct iovec iov;
+
+ iov.iov_len = cc;
+ iov.iov_base = outpack;
+
+ mhdr.msg_name = whereto;
+ mhdr.msg_namelen = sizeof(struct sockaddr_in6);
+ mhdr.msg_iov = &iov;
+ mhdr.msg_iovlen = 1;
+ mhdr.msg_control = cmsgbuf;
+ mhdr.msg_controllen = cmsglen;
+
+ i = sendmsg(icmp_sock, &mhdr, *confirm);
+ }
+ *confirm = 0;
+
+ return (cc == i ? 0 : i);
+}
+
+/*
+ * parse_reply --
+ * Print out the packet, if it came from us. This logic is necessary
+ * because ALL readers of the ICMP socket get a copy of ALL ICMP packets
+ * which arrive ('tis only fair). This permits multiple copies of this
+ * program to be run without having intermingled output (or statistics!).
+ */
+int
+parse_reply(int *series, struct pingCtlTable_data *item,
+ struct msghdr *msg, int cc, void *addr, struct timeval *tv,
+ time_t timep, int uid, struct sockaddr_in6 *whereto,
+ int *rtt_addend, int options, int interval, int datalen,
+ int timing, int working_recverr, char *outpack, int *rtt,
+ int *ident, __u16 * acked, long *nreceived, long *nrepeats,
+ long *ntransmitted, long *nchecksum, long *nerrors, long *tmin,
+ long *tmax, long long *tsum, long long *tsum2,
+ int *confirm_flag, int *confirm, int *pipesize,
+ struct pingProbeHistoryTable_data *current_temp)
+{
+ struct sockaddr_in6 *from = addr;
+ __u8 *buf = msg->msg_iov->iov_base;
+ struct cmsghdr *c;
+ struct icmp6hdr *icmph;
+ int hops = -1;
+
+
+ for (c = CMSG_FIRSTHDR(msg); c; c = CMSG_NXTHDR(msg, c)) {
+ if (c->cmsg_level != SOL_IPV6 || c->cmsg_type != IPV6_HOPLIMIT)
+ continue;
+ if (c->cmsg_len < CMSG_LEN(sizeof(int)))
+ continue;
+ hops = *(int *) CMSG_DATA(c);
+ }
+
+
+ /*
+ * Now the ICMP part
+ */
+
+ icmph = (struct icmp6hdr *) buf;
+ if (cc < 8) {
+ if (options & F_VERBOSE)
+ fprintf(stderr, "ping: packet too short (%d bytes)\n", cc);
+ return 1;
+ }
+ if (icmph->icmp6_type == ICMPV6_ECHO_REPLY) {
+ if (icmph->icmp6_identifier != *ident)
+ return 1;
+ if (gather_statistics(series, item, (__u8 *) (icmph + 1), cc,
+ icmph->icmp6_sequence,
+ hops, 0, tv, timep, rtt_addend, uid, options,
+ pr_addr(&from->sin6_addr, options), interval,
+ datalen, timing, outpack, rtt, acked,
+ nreceived, nrepeats, ntransmitted, nchecksum,
+ tmin, tmax, tsum, tsum2, confirm_flag,
+ confirm, pipesize, current_temp))
+ return 0;
+ } else {
+ int nexthdr;
+ struct ipv6hdr *iph1 = (struct ipv6hdr *) (icmph + 1);
+ struct icmp6hdr *icmph1 = (struct icmp6hdr *) (iph1 + 1);
+
+ /*
+ * We must not ever fall here. All the messages but
+ * * echo reply are blocked by filter and error are
+ * * received with IPV6_RECVERR. Ugly code is preserved
+ * * however, just to remember what crap we avoided
+ * * using RECVRERR. :-)
+ */
+
+ if (cc < 8 + sizeof(struct ipv6hdr) + 8)
+ return 1;
+
+ if (memcmp(&iph1->daddr, &(whereto->sin6_addr), 16))
+ return 1;
+
+ nexthdr = iph1->nexthdr;
+
+ if (nexthdr == 44) {
+ nexthdr = *(__u8 *) icmph1;
+ icmph1++;
+ }
+ if (nexthdr == IPPROTO_ICMPV6) {
+ if (icmph1->icmp6_type != ICMPV6_ECHO_REQUEST ||
+ icmph1->icmp6_identifier != *ident)
+ return 1;
+ acknowledge(icmph1->icmp6_sequence, acked, ntransmitted,
+ pipesize);
+ if (working_recverr)
+ return 0;
+ (*nerrors)++;
+ if (options & F_FLOOD) {
+ write(STDOUT_FILENO, "\bE", 2);
+ return 0;
+ }
+ printf("From %s: icmp_seq=%u ",
+ pr_addr(&from->sin6_addr, options),
+ icmph1->icmp6_sequence);
+ } else {
+ /*
+ * We've got something other than an ECHOREPLY
+ */
+ if (!(options & F_VERBOSE) || uid)
+ return 1;
+ printf("From %s: ", pr_addr(&from->sin6_addr, options));
+ }
+ /* pr_icmph(icmph->icmp6_type, icmph->icmp6_code, ntohl(icmph->icmp6_mtu)); */
+ }
+
+ if (!(options & F_FLOOD)) {
+ if (options & F_AUDIBLE)
+ putchar('\a');
+ putchar('\n');
+ fflush(stdout);
+ }
+ return 0;
+}
+
+
+
+#include <linux/filter.h>
+void
+install_filter(int icmp_sock, int *ident)
+{
+ static int once;
+ static struct sock_filter insns[] = {
+ BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 4), /* Load icmp echo ident */
+ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, 0xAAAA, 0, 1), /* Ours? */
+ BPF_STMT(BPF_RET | BPF_K, ~0U), /* Yes, it passes. */
+ BPF_STMT(BPF_LD | BPF_B | BPF_ABS, 0), /* Load icmp type */
+ BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, ICMPV6_ECHO_REPLY, 1, 0), /* Echo? */
+ BPF_STMT(BPF_RET | BPF_K, ~0U), /* No. It passes. This must not happen. */
+ BPF_STMT(BPF_RET | BPF_K, 0), /* Echo with wrong ident. Reject. */
+ };
+ static struct sock_fprog filter = {
+ sizeof insns / sizeof(insns[0]),
+ insns
+ };
+
+ if (once)
+ return;
+ once = 1;
+
+ /*
+ * Patch bpflet for current identifier.
+ */
+ insns[1] =
+ (struct sock_filter) BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K,
+ __constant_htons(*ident), 0, 1);
+
+ if (setsockopt
+ (icmp_sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)))
+ perror("WARNING: failed to install socket filter\n");
+}
+
+
+/*
+ * pr_addr --
+ * Return an ascii host address as a dotted quad and optionally with
+ * a hostname.
+ */
+static char *
+pr_addr(struct in6_addr *addr, int options)
+{
+ struct hostent *hp = NULL;
+
+ if (!(options & F_NUMERIC))
+ hp = gethostbyaddr((__u8 *) addr, sizeof(struct in6_addr),
+ AF_INET6);
+
+ return hp ? hp->h_name : pr_addr_n(addr);
+}
+
+static char *
+pr_addr_n(struct in6_addr *addr)
+{
+ static char str[64];
+ inet_ntop(AF_INET6, addr, str, sizeof(str));
+ return str;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingCtlTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingCtlTable.h
new file mode 100644
index 0000000000..2234ec9f55
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingCtlTable.h
@@ -0,0 +1,465 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:pingCtlTable.h
+ *File Description:The head file of pingCtlTable.c
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+
+#ifndef PINGCTLTABLE_H
+#define PINGCTLTABLE_H
+
+
+
+#include <sys/types.h> /* basic system data types */
+#include <sys/socket.h> /* basic socket definitions */
+#include <sys/time.h> /* timeval{} for select() */
+#include <time.h> /* timespec{} for pselect() */
+#include <netinet/in.h> /* sockaddr_in{} and other Internet defns */
+#include <arpa/inet.h> /* inet(3) functions */
+#include <errno.h>
+#include <fcntl.h> /* for nonblocking */
+#include <netdb.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h> /* for S_xxx file mode constants */
+#include <sys/uio.h> /* for iovec{} and readv/writev */
+#include <unistd.h>
+#include <sys/wait.h>
+#include <sys/un.h> /* for Unix domain sockets */
+#include <netdb.h>
+#include <pthread.h>
+
+#ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h> /* for convenience */
+#endif
+
+#ifdef HAVE_POLL_H
+# include <poll.h> /* for convenience */
+#endif
+
+#ifdef HAVE_STRINGS_H
+# include <strings.h> /* for convenience */
+#endif
+
+/*
+ * Three headers are normally needed for socket/file ioctl's:
+ * * <sys/ioctl.h>, <sys/filio.h>, and <sys/sockio.h>.
+ */
+#ifdef HAVE_SYS_IOCTL_H
+# include <sys/ioctl.h>
+#endif
+#ifdef HAVE_SYS_FILIO_H
+# include <sys/filio.h>
+#endif
+#ifdef HAVE_SYS_SOCKIO_H
+# include <sys/sockio.h>
+#endif
+
+#ifdef HAVE_PTHREAD_H
+# include <pthread.h>
+#endif
+
+#ifdef HAVE_SOCKADDR_DL_STRUCT
+# include <net/if_dl.h>
+#endif
+
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/ip_icmp.h>
+
+#define BUFSIZE 1500
+
+/*
+ * ipv6 include
+ */
+#include <sys/param.h>
+#include <linux/sockios.h>
+#include <sys/file.h>
+#include <sys/signal.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <sys/poll.h>
+#include <linux/types.h>
+#include <ctype.h>
+#include <linux/errqueue.h>
+
+/* #include <linux/in6.h> */
+/* #include <linux/ipv6.h> */
+
+#include "in6.h"
+#include "ipv6.h"
+
+
+#include <linux/icmpv6.h>
+#include <sched.h>
+
+
+
+
+#define BUFSIZE 1500
+
+
+
+/*
+ * ipv4 include
+ */
+
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+
+#include <netinet/ip_icmp.h>
+#include <netinet/in.h> /* sockaddr_in{} and other Internet defns */
+
+
+config_require(header_complex);
+
+struct pingCtlTable_data {
+ char *pingCtlOwnerIndex; /* string */
+ size_t pingCtlOwnerIndexLen;
+
+ char *pingCtlTestName; /* string */
+ size_t pingCtlTestNameLen;
+
+ long pingCtlTargetAddressType; /* integer32 */
+
+ char *pingCtlTargetAddress; /* string */
+ size_t pingCtlTargetAddressLen;
+
+ unsigned long pingCtlDataSize;
+ unsigned long pingCtlTimeOut;
+ unsigned long pingCtlProbeCount;
+ long pingCtlAdminStatus;
+ char *pingCtlDataFill;
+ size_t pingCtlDataFillLen;
+
+ unsigned long pingCtlFrequency;
+ unsigned long pingCtlMaxRows;
+ long pingCtlStorageType;
+
+ char *pingCtlTrapGeneration;
+ size_t pingCtlTrapGenerationLen;
+ unsigned long pingCtlTrapProbeFailureFilter;
+ unsigned long pingCtlTrapTestFailureFilter;
+ oid *pingCtlType;
+ size_t pingCtlTypeLen;
+
+ char *pingCtlDescr;
+ size_t pingCtlDescrLen;
+ long pingCtlSourceAddressType;
+ char *pingCtlSourceAddress;
+ size_t pingCtlSourceAddressLen;
+ long pingCtlIfIndex;
+ long pingCtlByPassRouteTable;
+ unsigned long pingCtlDSField;
+ long pingCtlRowStatus;
+
+ int storageType;
+ u_long timer_id;
+ unsigned long pingProbeHistoryMaxIndex;
+
+ struct pingResultsTable_data *pingResults;
+ struct pingProbeHistoryTable_data *pingProbeHis;
+
+};
+
+struct pingResultsTable_data {
+ char *pingCtlOwnerIndex; /* string */
+ size_t pingCtlOwnerIndexLen;
+ char *pingCtlTestName; /* string */
+ size_t pingCtlTestNameLen;
+
+ long pingResultsOperStatus;
+ long pingResultsIpTargetAddressType;
+ char *pingResultsIpTargetAddress;
+ size_t pingResultsIpTargetAddressLen;
+ unsigned long pingResultsMinRtt;
+ unsigned long pingResultsMaxRtt;
+ unsigned long pingResultsAverageRtt;
+ unsigned long pingResultsProbeResponses;
+ unsigned long pingResultsSendProbes;
+ unsigned long pingResultsRttSumOfSquares;
+ char *pingResultsLastGoodProbe;
+ size_t pingResultsLastGoodProbeLen;
+
+ int storageType;
+
+};
+
+struct pingProbeHistoryTable_data {
+ struct pingProbeHistoryTable_data *next;
+ char *pingCtlOwnerIndex; /* string */
+ size_t pingCtlOwnerIndexLen;
+ char *pingCtlTestName; /* string */
+ size_t pingCtlTestNameLen;
+
+ unsigned long pingProbeHistoryIndex;
+ unsigned long pingProbeHistoryResponse;
+ long pingProbeHistoryStatus;
+ long pingProbeHistoryLastRC;
+ char *pingProbeHistoryTime;
+ size_t pingProbeHistoryTimeLen;
+
+ int storageType;
+
+};
+
+
+/*
+ * function declarations
+ */
+void init_pingCtlTable(void);
+FindVarMethod var_pingCtlTable;
+void parse_pingCtlTable(const char *, char *);
+SNMPCallback store_pingCtlTable;
+
+
+WriteMethod write_pingCtlTargetAddressType;
+WriteMethod write_pingCtlTargetAddress;
+WriteMethod write_pingCtlDataSize;
+WriteMethod write_pingCtlTimeOut;
+WriteMethod write_pingCtlProbeCount;
+WriteMethod write_pingCtlAdminStatus;
+WriteMethod write_pingCtlDataFill;
+WriteMethod write_pingCtlFrequency;
+WriteMethod write_pingCtlMaxRows;
+WriteMethod write_pingCtlStorageType;
+WriteMethod write_pingCtlTrapGeneration;
+WriteMethod write_pingCtlTrapProbeFailureFilter;
+WriteMethod write_pingCtlTrapTestFailureFilter;
+WriteMethod write_pingCtlType;
+WriteMethod write_pingCtlDescr;
+WriteMethod write_pingCtlSourceAddressType;
+WriteMethod write_pingCtlSourceAddress;
+WriteMethod write_pingCtlIfIndex;
+WriteMethod write_pingCtlByPassRouteTable;
+WriteMethod write_pingCtlDSField;
+
+WriteMethod write_pingCtlRowStatus;
+
+
+
+#define PINGTRAPGENERATION_PROBEFAILED 0x80
+#define PINGTRAPGENERATION_TESTFAILED 0x40
+#define PINGTRAPGENERATION_TESTCOMPLETED 0x20
+#define PINGTRAPGENERATION_NULL 0x00
+
+/*
+ * column number definitions for table pingCtlTable
+ */
+#define COLUMN_PINGCTLOWNERINDEX 1
+#define COLUMN_PINGCTLTESTNAME 2
+#define COLUMN_PINGCTLTARGETADDRESSTYPE 3
+#define COLUMN_PINGCTLTARGETADDRESS 4
+#define COLUMN_PINGCTLDATASIZE 5
+#define COLUMN_PINGCTLTIMEOUT 6
+#define COLUMN_PINGCTLPROBECOUNT 7
+#define COLUMN_PINGCTLADMINSTATUS 8
+#define COLUMN_PINGCTLDATAFILL 9
+#define COLUMN_PINGCTLFREQUENCY 10
+#define COLUMN_PINGCTLMAXROWS 11
+#define COLUMN_PINGCTLSTORAGETYPE 12
+#define COLUMN_PINGCTLTRAPGENERATION 13
+#define COLUMN_PINGCTLTRAPPROBEFAILUREFILTER 14
+#define COLUMN_PINGCTLTRAPTESTFAILUREFILTER 15
+#define COLUMN_PINGCTLTYPE 16
+#define COLUMN_PINGCTLDESCR 17
+#define COLUMN_PINGCTLSOURCEADDRESSTYPE 18
+#define COLUMN_PINGCTLSOURCEADDRESS 19
+#define COLUMN_PINGCTLIFINDEX 20
+#define COLUMN_PINGCTLBYPASSROUTETABLE 21
+#define COLUMN_PINGCTLDSFIELD 22
+#define COLUMN_PINGCTLROWSTATUS 23
+
+
+/*
+ * ipv4 function
+ */
+int proc_v4(char *, ssize_t, struct timeval *, time_t,
+ struct pingCtlTable_data *, struct addrinfo *, int,
+ unsigned long *, unsigned long *, unsigned long *,
+ unsigned long *, unsigned long, int, int, int,
+ struct pingProbeHistoryTable_data *, pid_t);
+void send_v4(int, pid_t, int, int, char *);
+void readloop(struct pingCtlTable_data *, struct addrinfo *,
+ int, unsigned long *, unsigned long *,
+ unsigned long *, pid_t);
+void sig_alrm(int);
+void tv_sub(struct timeval *, struct timeval *);
+unsigned long round_double(double);
+struct proto {
+ int (*fproc) (char *, ssize_t, struct timeval *, time_t,
+ struct pingCtlTable_data *,
+ struct addrinfo *, int, unsigned long *,
+ unsigned long *, unsigned long *,
+ unsigned long *, unsigned long, int, int,
+ int, struct pingProbeHistoryTable_data *,
+ pid_t);
+ void (*fsend) (int, pid_t, int, int, char *);
+ struct sockaddr *sasend; /* sockaddr{} for send, from getaddrinfo */
+ struct sockaddr *sarecv; /* sockaddr{} for receiving */
+ socklen_t salen; /* length of sockaddr{}s */
+ int icmpproto; /* IPPROTO_xxx value for ICMP */
+} *pr;
+
+
+/*
+ * ipv6 function
+ */
+
+#define BIT_CLEAR(nr, addr) do { ((__u32 *)(addr))[(nr) >> 5] &= ~(1U << ((nr) & 31)); } while(0)
+#define BIT_SET(nr, addr) do { ((__u32 *)(addr))[(nr) >> 5] |= (1U << ((nr) & 31)); } while(0)
+#define BIT_TEST(nr, addr) do { (__u32 *)(addr))[(nr) >> 5] & (1U << ((nr) & 31)); } while(0)
+
+#define ICMPV6_FILTER_WILLPASS(type, filterp) \
+ (BIT_TEST((type), filterp) == 0)
+
+#define ICMPV6_FILTER_WILLBLOCK(type, filterp) \
+ BIT_TEST((type), filterp)
+
+#define ICMPV6_FILTER_SETPASS(type, filterp) \
+ BIT_CLEAR((type), filterp)
+
+#define ICMPV6_FILTER_SETBLOCK(type, filterp) \
+ BIT_SET((type), filterp)
+
+#define ICMPV6_FILTER_SETPASSALL(filterp) \
+ memset(filterp, 0, sizeof(struct icmp6_filter));
+
+#define ICMPV6_FILTER_SETBLOCKALL(filterp) \
+ memset(filterp, 0xFF, sizeof(struct icmp6_filter));
+
+
+#define MAX_PACKET 128000 /* max packet size */
+
+#ifdef SO_TIMESTAMP
+#define HAVE_SIN6_SCOPEID 1
+#endif
+
+
+static char *pr_addr(struct in6_addr *addr, int options);
+static char *pr_addr_n(struct in6_addr *addr);
+static int pr_icmph(__u8 type, __u8 code, __u32 info);
+
+#define MAX_DUP_CHK 0x10000
+char rcvd_tbl[MAX_DUP_CHK / 8];
+
+volatile int exiting;
+volatile int status_snapshot;
+
+#ifndef MSG_CONFIRM
+#define MSG_CONFIRM 0
+#endif
+
+#define DEFDATALEN (64 - 8) /* default data length */
+
+#define MAXWAIT 10 /* max seconds to wait for response */
+#define MININTERVAL 10 /* Minimal interpacket gap */
+#define MINUSERINTERVAL 200 /* Minimal allowed interval for non-root */
+
+#define SCHINT(a) (((a) <= MININTERVAL) ? MININTERVAL : (a))
+
+#define A(bit) rcvd_tbl[(bit)>>3] /* identify byte in array */
+#define B(bit) (1 << ((bit) & 0x07)) /* identify bit in byte */
+#define SET(bit) (A(bit) |= B(bit))
+#define CLR(bit) (A(bit) &= (~B(bit)))
+#define TST(bit) (A(bit) & B(bit))
+
+/*
+ * various options
+ */
+#define F_FLOOD 0x001
+#define F_INTERVAL 0x002
+#define F_NUMERIC 0x004
+#define F_PINGFILLED 0x008
+#define F_QUIET 0x010
+#define F_RROUTE 0x020
+#define F_SO_DEBUG 0x040
+#define F_SO_DONTROUTE 0x080
+#define F_VERBOSE 0x100
+#define F_TIMESTAMP 0x200
+#define F_FLOWINFO 0x200
+#define F_SOURCEROUTE 0x400
+#define F_TCLASS 0x400
+#define F_FLOOD_POLL 0x800
+#define F_LATENCY 0x1000
+#define F_AUDIBLE 0x2000
+#define F_ADAPTIVE 0x4000
+
+/*
+ * multicast options
+ */
+#define MULTICAST_NOLOOP 0x001
+#define MULTICAST_TTL 0x002
+#define MULTICAST_IF 0x004
+
+static inline void tvsub(struct timeval *, struct timeval *);
+static inline void set_signal(int, void (*)(int));
+static inline int schedule_exit(int, int *, long *, long *, long *,
+ long *);
+static inline int in_flight(__u16 *, long *, long *, long *);
+static inline void acknowledge(__u16, __u16 *, long *, int *);
+static inline void advance_ntransmitted(__u16 *, long *);
+static void sigexit(int);
+static void sigexit(int);
+static inline void update_interval(int, int, int *, int *);
+int __schedule_exit(int, long *, long *);
+int pinger(int, int, int, char *, struct sockaddr_in6 *, int *,
+ int, int, int, int, int, char *, int *, int *,
+ int *, int *, __u16 *, long *, long *, long *,
+ long *, int *, int *, int *, struct timeval *);
+void sock_setbufs(int, int, int);
+void setup(int, int, int, int, int, int, int, char *, int *,
+ struct timeval *, int *, int *);
+void main_loop(struct pingCtlTable_data *, int, int, __u8 *,
+ int, int, char *, struct sockaddr_in6 *, int,
+ int, char *, int, int, int, int, char *, int *,
+ struct timeval *, int *, int *);
+int gather_statistics(int *, struct pingCtlTable_data *,
+ __u8 *, int, __u16, int, int,
+ struct timeval *, time_t, int *, int,
+ int, char *, int, int, int, char *,
+ int *, __u16 *, long *, long *, long *,
+ long *, long *, long *, long long *,
+ long long *, int *, int *, int *,
+ struct pingProbeHistoryTable_data *);
+static long llsqrt(long long);
+void finish(int, char *, int, int, int *, struct timeval *,
+ int *, long *, long *, long *, long *, long *,
+ long *, long *, long *, long long *, long long *,
+ int *, struct timeval *);
+void status(int, int *, long *, long *, long *, long *, long *,
+ long long *, long long *);
+static __inline__ int ipv6_addr_any(struct in6_addr *);
+size_t inet6_srcrt_space(int, int);
+struct cmsghdr *inet6_srcrt_init(void *, int);
+int inet6_srcrt_add(struct cmsghdr *, const struct in6_addr *);
+int receive_error_msg(int, struct sockaddr_in6 *, int, int *,
+ long *);
+int send_v6(int, int, char *, struct sockaddr_in6 *, int, int,
+ char *, int *, long *, int *);
+int parse_reply(int *, struct pingCtlTable_data *,
+ struct msghdr *, int, void *, struct timeval *,
+ time_t, int, struct sockaddr_in6 *, int *, int,
+ int, int, int, int, char *, int *, int *,
+ __u16 *, long *, long *, long *, long *,
+ long *, long *, long *, long long *,
+ long long *, int *, int *, int *,
+ struct pingProbeHistoryTable_data *);
+static int pr_icmph(__u8, __u8, __u32);
+void install_filter(int, int *);
+static char *pr_addr(struct in6_addr *, int);
+static char *pr_addr_n(struct in6_addr *);
+
+#endif
+/*
+ * PINGCTLTABLE_H
+ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingProbeHistoryTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingProbeHistoryTable.c
new file mode 100644
index 0000000000..29599c565b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingProbeHistoryTable.c
@@ -0,0 +1,338 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:pingProbeHistoryTable.c
+ *File Description:Rows of pingProbeHistoryTable MIB read.
+ *
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+
+/*
+ * This should always be included first before anything else
+ */
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+
+
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "pingCtlTable.h"
+#include "pingResultsTable.h"
+#include "pingProbeHistoryTable.h"
+#include "header_complex.h"
+
+
+/*
+ *pingProbeHistoryTable_variables_oid:
+ *
+ */
+
+oid pingProbeHistoryTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 80, 1, 4 };
+
+struct variable2 pingProbeHistoryTable_variables[] = {
+ {COLUMN_PINGPROBEHISTORYRESPONSE, ASN_UNSIGNED, RONLY, var_pingProbeHistoryTable, 2, {1, 2}},
+ {COLUMN_PINGPROBEHISTORYSTATUS, ASN_INTEGER, RONLY, var_pingProbeHistoryTable, 2, {1, 3}},
+ {COLUMN_PINGPROBEHISTORYLASTRC, ASN_INTEGER, RONLY, var_pingProbeHistoryTable, 2, {1, 4}},
+ {COLUMN_PINGPROBEHISTORYTIME, ASN_OCTET_STR, RONLY, var_pingProbeHistoryTable, 2, {1, 5}}
+};
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+
+extern struct header_complex_index *pingCtlTableStorage;
+extern struct header_complex_index *pingProbeHistoryTableStorage;
+
+void
+pingProbeHistoryTable_cleaner(struct header_complex_index *thestuff)
+{
+ struct header_complex_index *hciptr = NULL;
+ struct pingProbeHistoryTable_data *StorageDel = NULL;
+ DEBUGMSGTL(("pingProbeHistoryTable", "cleanerout "));
+ for (hciptr = thestuff; hciptr != NULL; hciptr = hciptr->next) {
+ StorageDel =
+ header_complex_extract_entry(&pingProbeHistoryTableStorage,
+ hciptr);
+ DEBUGMSGTL(("pingProbeHistoryTable", "cleaner "));
+ }
+
+}
+void
+init_pingProbeHistoryTable(void)
+{
+
+ DEBUGMSGTL(("pingProbeHistoryTable", "initializing... "));
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("pingProbeHistoryTable", pingProbeHistoryTable_variables,
+ variable2, pingProbeHistoryTable_variables_oid);
+
+
+ /*
+ * register our config handler(s) to deal with registrations
+ */
+ snmpd_register_config_handler("pingProbeHistoryTable",
+ parse_pingProbeHistoryTable, NULL, NULL);
+
+ /*
+ * we need to be called back later to store our data
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_pingProbeHistoryTable, NULL);
+
+ DEBUGMSGTL(("pingProbeHistoryTable", "done.\n"));
+}
+
+/*
+ * parse_mteObjectsTable():
+ * parses .conf file entries needed to configure the mib.
+ */
+
+void
+parse_pingProbeHistoryTable(const char *token, char *line)
+{
+ size_t tmpint;
+ struct pingProbeHistoryTable_data *StorageTmp =
+ SNMP_MALLOC_STRUCT(pingProbeHistoryTable_data);
+
+ DEBUGMSGTL(("pingProbeHistoryTable", "parsing config... "));
+
+
+ if (StorageTmp == NULL) {
+ config_perror("malloc failure");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pingCtlOwnerIndex,
+ &StorageTmp->pingCtlOwnerIndexLen);
+ if (StorageTmp->pingCtlOwnerIndex == NULL) {
+ config_perror("invalid specification for pingCtlOwnerIndex");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pingCtlTestName,
+ &StorageTmp->pingCtlTestNameLen);
+ if (StorageTmp->pingCtlTestName == NULL) {
+ config_perror("invalid specification for pingCtlTestName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingProbeHistoryIndex, &tmpint);
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingProbeHistoryResponse,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pingProbeHistoryStatus,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pingProbeHistoryLastRC,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pingProbeHistoryTime,
+ &StorageTmp->pingProbeHistoryTimeLen);
+ if (StorageTmp->pingProbeHistoryTime == NULL) {
+ config_perror("invalid specification for pingProbeHistoryTime");
+ return;
+ }
+
+
+ pingProbeHistoryTable_inadd(StorageTmp);
+
+ /* pingProbeHistoryTable_cleaner(pingProbeHistoryTableStorage); */
+
+ DEBUGMSGTL(("pingProbeHistoryTable", "done.\n"));
+}
+
+
+
+
+
+/*
+ * store_pingProbeHistoryTable():
+ * stores .conf file entries needed to configure the mib.
+ */
+
+int
+store_pingProbeHistoryTable(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr;
+ size_t tmpint;
+ struct pingProbeHistoryTable_data *StorageTmp;
+ struct header_complex_index *hcindex;
+
+
+ DEBUGMSGTL(("pingProbeHistoryTable", "storing data... "));
+
+
+ for (hcindex = pingProbeHistoryTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ StorageTmp = (struct pingProbeHistoryTable_data *) hcindex->data;
+
+ if (StorageTmp->storageType != ST_READONLY) {
+ memset(line, 0, sizeof(line));
+ strcat(line, "pingProbeHistoryTable ");
+ cptr = line + strlen(line);
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pingCtlOwnerIndex,
+ &StorageTmp->pingCtlOwnerIndexLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pingCtlTestName,
+ &StorageTmp->pingCtlTestNameLen);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->pingProbeHistoryIndex,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ pingProbeHistoryResponse, &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->pingProbeHistoryStatus,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->pingProbeHistoryLastRC,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pingProbeHistoryTime,
+ &StorageTmp->
+ pingProbeHistoryTimeLen);
+
+ snmpd_store_config(line);
+ }
+ }
+ DEBUGMSGTL(("pingProbeHistoryTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+int
+pingProbeHistoryTable_inadd(struct pingProbeHistoryTable_data *thedata)
+{
+ netsnmp_variable_list *vars_list;
+ vars_list = NULL;
+
+
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlOwnerIndex, thedata->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlTestName, thedata->pingCtlTestNameLen); /* pingCtlTestName */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->pingProbeHistoryIndex, sizeof(thedata->pingProbeHistoryIndex)); /* pingProbeHistoryIndex */
+
+ /*
+ * XXX: fill in default row values here into StorageNew
+ *
+ */
+
+
+ DEBUGMSGTL(("pingProbeHistoryTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+ header_complex_add_data(&pingProbeHistoryTableStorage, vars_list,
+ thedata);
+ DEBUGMSGTL(("pingProbeHistoryTable", "registered an entry\n"));
+
+
+ DEBUGMSGTL(("pingProbeHistoryTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+/*
+ * var_pingProbeHistoryTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_pingProbeHistoryTable above.
+ */
+unsigned char *
+var_pingProbeHistoryTable(struct variable *vp,
+ oid * name,
+ size_t *length,
+ int exact,
+ size_t *var_len, WriteMethod ** write_method)
+{
+
+
+ struct pingProbeHistoryTable_data *StorageTmp = NULL;
+
+ *write_method = NULL;
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(pingProbeHistoryTableStorage, vp, name, length,
+ exact, var_len, write_method)) == NULL) {
+
+ return NULL;
+ }
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+
+ switch (vp->magic) {
+
+ case COLUMN_PINGPROBEHISTORYRESPONSE:
+ *var_len = sizeof(StorageTmp->pingProbeHistoryResponse);
+ return (u_char *) & StorageTmp->pingProbeHistoryResponse;
+
+ case COLUMN_PINGPROBEHISTORYSTATUS:
+ *var_len = sizeof(StorageTmp->pingProbeHistoryStatus);
+ return (u_char *) & StorageTmp->pingProbeHistoryStatus;
+
+ case COLUMN_PINGPROBEHISTORYLASTRC:
+ *var_len = sizeof(StorageTmp->pingProbeHistoryLastRC);
+ return (u_char *) & StorageTmp->pingProbeHistoryLastRC;
+
+ case COLUMN_PINGPROBEHISTORYTIME:
+ *var_len = (StorageTmp->pingProbeHistoryTimeLen);
+ return (u_char *) StorageTmp->pingProbeHistoryTime;
+
+ default:
+ ERROR_MSG("");
+ }
+
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingProbeHistoryTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingProbeHistoryTable.h
new file mode 100644
index 0000000000..1c3eadb00e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingProbeHistoryTable.h
@@ -0,0 +1,36 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:pingProbeHistoryTable.h
+ *File Description:The head file of pingProbeHistoryTable.c
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+#ifndef PINGPROBEHISTORYTABLE_H
+#define PINGPROBEHISTORYTABLE_H
+
+config_require(header_complex);
+
+/*
+ * function declarations
+ */
+void init_pingProbeHistoryTable(void);
+FindVarMethod var_pingProbeHistoryTable;
+void parse_pingProbeHistoryTable(const char *, char *);
+SNMPCallback store_pingProbeHistoryTable;
+
+
+/*
+ * column number definitions for table pingProbeHistoryTable
+ */
+#define COLUMN_PINGPROBEHISTORYINDEX 1
+#define COLUMN_PINGPROBEHISTORYRESPONSE 2
+#define COLUMN_PINGPROBEHISTORYSTATUS 3
+#define COLUMN_PINGPROBEHISTORYLASTRC 4
+#define COLUMN_PINGPROBEHISTORYTIME 5
+#endif /* PINGPROBEHISTORYTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingResultsTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingResultsTable.c
new file mode 100644
index 0000000000..440edb498c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingResultsTable.c
@@ -0,0 +1,414 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:pingResultsTable.c
+ *File Description:Rows of lookupResultsTable MIB add and delete.
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+
+/*
+ * This should always be included first before anything else
+ */
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+
+
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "pingCtlTable.h"
+#include "pingResultsTable.h"
+#include "pingProbeHistoryTable.h"
+#include "header_complex.h"
+
+
+/*
+ *pingResultsTable_variables_oid:
+ *
+ */
+oid pingResultsTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 80, 1, 3 };
+
+struct variable2 pingResultsTable_variables[] = {
+ {COLUMN_PINGRESULTSOPERSTATUS, ASN_INTEGER, RONLY, var_pingResultsTable, 2, {1, 1}},
+ {COLUMN_PINGRESULTSIPTARGETADDRESSTYPE, ASN_INTEGER, RONLY, var_pingResultsTable, 2, {1, 2}},
+ {COLUMN_PINGRESULTSIPTARGETADDRESS, ASN_OCTET_STR, RONLY, var_pingResultsTable, 2, {1, 3}},
+ {COLUMN_PINGRESULTSMINRTT, ASN_UNSIGNED, RONLY, var_pingResultsTable, 2, {1, 4}},
+ {COLUMN_PINGRESULTSMAXRTT, ASN_UNSIGNED, RONLY, var_pingResultsTable, 2, {1, 5}},
+ {COLUMN_PINGRESULTSAVERAGERTT, ASN_UNSIGNED, RONLY, var_pingResultsTable, 2, {1, 6}},
+ {COLUMN_PINGRESULTSPROBERESPONSES, ASN_UNSIGNED, RONLY, var_pingResultsTable, 2, {1, 7}},
+ {COLUMN_PINGRESULTSSENTPROBES, ASN_UNSIGNED, RONLY, var_pingResultsTable, 2, {1, 8}},
+ {COLUMN_PINGRESULTSRTTSUMOFSQUARES, ASN_UNSIGNED, RONLY, var_pingResultsTable, 2, {1, 9}},
+ {COLUMN_PINGRESULTSLASTGOODPROBE, ASN_OCTET_STR, RONLY, var_pingResultsTable, 2, {1, 10}}
+};
+
+
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+
+extern struct header_complex_index *pingCtlTableStorage;
+extern struct header_complex_index *pingResultsTableStorage;
+
+void
+pingResultsTable_cleaner(struct header_complex_index *thestuff)
+{
+ struct header_complex_index *hciptr = NULL;
+ struct pingResultsTable_data *StorageDel = NULL;
+ DEBUGMSGTL(("pingResultsTable", "cleanerout "));
+ for (hciptr = thestuff; hciptr != NULL; hciptr = hciptr->next) {
+ StorageDel =
+ header_complex_extract_entry(&pingResultsTableStorage, hciptr);
+ DEBUGMSGTL(("pingResultsTable", "cleaner "));
+ }
+
+}
+void
+init_pingResultsTable(void)
+{
+
+ DEBUGMSGTL(("pingResultsTable", "initializing... "));
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("pingResultsTable", pingResultsTable_variables, variable2,
+ pingResultsTable_variables_oid);
+
+
+ /*
+ * register our config handler(s) to deal with registrations
+ */
+ snmpd_register_config_handler("pingResultsTable",
+ parse_pingResultsTable, NULL, NULL);
+
+ /*
+ * we need to be called back later to store our data
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_pingResultsTable, NULL);
+
+ DEBUGMSGTL(("pingResultsTable", "done.\n"));
+}
+
+/*
+ * parse_mteObjectsTable():
+ * parses .conf file entries needed to configure the mib.
+ */
+
+void
+parse_pingResultsTable(const char *token, char *line)
+{
+ size_t tmpint;
+ struct pingResultsTable_data *StorageTmp =
+ SNMP_MALLOC_STRUCT(pingResultsTable_data);
+
+ DEBUGMSGTL(("pingResultsTable", "parsing config... "));
+
+
+ if (StorageTmp == NULL) {
+ config_perror("malloc failure");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pingCtlOwnerIndex,
+ &StorageTmp->pingCtlOwnerIndexLen);
+ if (StorageTmp->pingCtlOwnerIndex == NULL) {
+ config_perror("invalid specification for pingCtlOwnerIndex");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pingCtlTestName,
+ &StorageTmp->pingCtlTestNameLen);
+ if (StorageTmp->pingCtlTestName == NULL) {
+ config_perror("invalid specification for pingCtlTestName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pingResultsOperStatus, &tmpint);
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->pingResultsIpTargetAddressType,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pingResultsIpTargetAddress,
+ &StorageTmp->pingResultsIpTargetAddressLen);
+ if (StorageTmp->pingResultsIpTargetAddress == NULL) {
+ config_perror
+ ("invalid specification for pingResultsIpTargetAddress");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingResultsMinRtt, &tmpint);
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingResultsMaxRtt, &tmpint);
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingResultsAverageRtt, &tmpint);
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingResultsProbeResponses,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingResultsSendProbes, &tmpint);
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->pingResultsRttSumOfSquares,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->pingResultsLastGoodProbe,
+ &StorageTmp->pingResultsLastGoodProbeLen);
+ if (StorageTmp->pingResultsLastGoodProbe == NULL) {
+ config_perror
+ ("invalid specification for pingResultsLastGoodProbe!");
+ return;
+ }
+
+ pingResultsTable_inadd(StorageTmp);
+
+ /* pingResultsTable_cleaner(pingResultsTableStorage); */
+
+ DEBUGMSGTL(("pingResultsTable", "done.\n"));
+}
+
+
+
+
+
+/*
+ * store_pingResultsTable():
+ * stores .conf file entries needed to configure the mib.
+ */
+
+int
+store_pingResultsTable(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr;
+ size_t tmpint;
+ struct pingResultsTable_data *StorageTmp;
+ struct header_complex_index *hcindex;
+
+
+ DEBUGMSGTL(("pingResultsTable", "storing data... "));
+
+
+ for (hcindex = pingResultsTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ StorageTmp = (struct pingResultsTable_data *) hcindex->data;
+
+ if (StorageTmp->storageType != ST_READONLY) {
+ memset(line, 0, sizeof(line));
+ strcat(line, "pingResultsTable ");
+ cptr = line + strlen(line);
+
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pingCtlOwnerIndex,
+ &StorageTmp->pingCtlOwnerIndexLen);
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->pingCtlTestName,
+ &StorageTmp->pingCtlTestNameLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->pingResultsOperStatus,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ pingResultsIpTargetAddressType,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ pingResultsIpTargetAddress,
+ &StorageTmp->
+ pingResultsIpTargetAddressLen);
+
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->pingResultsMinRtt,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->pingResultsMaxRtt,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->pingResultsAverageRtt,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ pingResultsProbeResponses, &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->pingResultsSendProbes,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ pingResultsRttSumOfSquares,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ pingResultsLastGoodProbe,
+ &StorageTmp->
+ pingResultsLastGoodProbeLen);
+
+ snmpd_store_config(line);
+ }
+ }
+ DEBUGMSGTL(("pingResultsTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+int
+pingResultsTable_inadd(struct pingResultsTable_data *thedata)
+{
+ netsnmp_variable_list *vars_list;
+ vars_list = NULL;
+
+
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlOwnerIndex, thedata->pingCtlOwnerIndexLen); /* pingCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->pingCtlTestName, thedata->pingCtlTestNameLen); /* pingCtlTestName */
+
+ /*
+ * XXX: fill in default row values here into StorageNew
+ *
+ */
+
+
+ DEBUGMSGTL(("pingResultsTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+ header_complex_add_data(&pingResultsTableStorage, vars_list, thedata);
+ DEBUGMSGTL(("pingResultsTable", "registered an entry\n"));
+
+
+ DEBUGMSGTL(("pingResultsTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+/*
+ * var_pingResultsTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_pingResultsTable above.
+ */
+unsigned char *
+var_pingResultsTable(struct variable *vp,
+ oid * name,
+ size_t *length,
+ int exact,
+ size_t *var_len, WriteMethod ** write_method)
+{
+
+
+ struct pingResultsTable_data *StorageTmp = NULL;
+
+ *write_method = NULL;
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(pingResultsTableStorage, vp, name, length, exact,
+ var_len, write_method)) == NULL) {
+
+ return NULL;
+ }
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+
+ switch (vp->magic) {
+
+ case COLUMN_PINGRESULTSOPERSTATUS:
+ *var_len = sizeof(StorageTmp->pingResultsOperStatus);
+ return (u_char *) & StorageTmp->pingResultsOperStatus;
+
+ case COLUMN_PINGRESULTSIPTARGETADDRESSTYPE:
+ *var_len = sizeof(StorageTmp->pingResultsIpTargetAddressType);
+ return (u_char *) & StorageTmp->pingResultsIpTargetAddressType;
+
+ case COLUMN_PINGRESULTSIPTARGETADDRESS:
+ *var_len = (StorageTmp->pingResultsIpTargetAddressLen);
+ return (u_char *) StorageTmp->pingResultsIpTargetAddress;
+
+ case COLUMN_PINGRESULTSMINRTT:
+ *var_len = sizeof(StorageTmp->pingResultsMinRtt);
+ return (u_char *) & StorageTmp->pingResultsMinRtt;
+
+ case COLUMN_PINGRESULTSMAXRTT:
+ *var_len = sizeof(StorageTmp->pingResultsMaxRtt);
+ return (u_char *) & StorageTmp->pingResultsMaxRtt;
+
+ case COLUMN_PINGRESULTSAVERAGERTT:
+ *var_len = sizeof(StorageTmp->pingResultsAverageRtt);
+ return (u_char *) & StorageTmp->pingResultsAverageRtt;
+
+ case COLUMN_PINGRESULTSPROBERESPONSES:
+ *var_len = sizeof(StorageTmp->pingResultsProbeResponses);
+ return (u_char *) & StorageTmp->pingResultsProbeResponses;
+
+ case COLUMN_PINGRESULTSSENTPROBES:
+ *var_len = sizeof(StorageTmp->pingResultsSendProbes);
+ return (u_char *) & StorageTmp->pingResultsSendProbes;
+
+ case COLUMN_PINGRESULTSRTTSUMOFSQUARES:
+ *var_len = sizeof(StorageTmp->pingResultsRttSumOfSquares);
+ return (u_char *) & StorageTmp->pingResultsRttSumOfSquares;
+
+ case COLUMN_PINGRESULTSLASTGOODPROBE:
+ *var_len = (StorageTmp->pingResultsLastGoodProbeLen);
+ return (u_char *) StorageTmp->pingResultsLastGoodProbe;
+
+ default:
+ ERROR_MSG("");
+ }
+
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingResultsTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingResultsTable.h
new file mode 100644
index 0000000000..5cfa33918d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/ping/pingResultsTable.h
@@ -0,0 +1,42 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:pingResultsTable.h
+ *File Description:The head file of pingResultsTable.c
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+
+#ifndef PINGRESULTSTABLE_H
+#define PINGRESULTSTABLE_H
+
+config_require(header_complex);
+
+/*
+ * function declarations
+ */
+void init_pingResultsTable(void);
+FindVarMethod var_pingResultsTable;
+void parse_pingResultsTable(const char *, char *);
+SNMPCallback store_pingResultsTable;
+
+
+/*
+ * column number definitions for table pingResultsTable
+ */
+#define COLUMN_PINGRESULTSOPERSTATUS 1
+#define COLUMN_PINGRESULTSIPTARGETADDRESSTYPE 2
+#define COLUMN_PINGRESULTSIPTARGETADDRESS 3
+#define COLUMN_PINGRESULTSMINRTT 4
+#define COLUMN_PINGRESULTSMAXRTT 5
+#define COLUMN_PINGRESULTSAVERAGERTT 6
+#define COLUMN_PINGRESULTSPROBERESPONSES 7
+#define COLUMN_PINGRESULTSSENTPROBES 8
+#define COLUMN_PINGRESULTSRTTSUMOFSQUARES 9
+#define COLUMN_PINGRESULTSLASTGOODPROBE 10
+#endif /* PINGRESULTSTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule.h
new file mode 100644
index 0000000000..a3351b692b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule.h
@@ -0,0 +1,3 @@
+config_require(disman/schedule/schedCore)
+config_require(disman/schedule/schedConf)
+config_require(disman/schedule/schedTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedConf.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedConf.c
new file mode 100644
index 0000000000..2e67b73e77
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedConf.c
@@ -0,0 +1,427 @@
+/*
+ * DisMan Schedule MIB:
+ * Implementation of the schedule MIB config handling
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <ctype.h>
+#include "disman/schedule/schedCore.h"
+#include "disman/schedule/schedConf.h"
+
+static int schedEntries;
+
+/** Initializes the schedConf module */
+void
+init_schedConf(void)
+{
+ DEBUGMSGTL(("disman:schedule:init", "Initializing config module\n"));
+ init_schedule_container();
+
+ /*
+ * Register public configuration directives
+ */
+ snmpd_register_config_handler("repeat", parse_sched_periodic, NULL,
+ "repeat period OID = value");
+ snmpd_register_config_handler("cron", parse_sched_timed, NULL,
+ "cron * * * * * OID = value");
+ snmpd_register_config_handler("at", parse_sched_timed, NULL,
+ "at * * * * * OID = value");
+
+ /*
+ * Register internal configuration directive,
+ * and arrange for dynamically configured entries to be saved
+ */
+ snmpd_register_config_handler("_schedTable", parse_schedTable, NULL, NULL);
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_schedTable, NULL);
+ schedEntries = 0;
+}
+
+
+/* =======================================================
+ *
+ * Handlers for user-configured (static) scheduled actions
+ *
+ * ======================================================= */
+
+void
+parse_sched_periodic( const char *token, char *line )
+{
+ netsnmp_tdata_row *row;
+ struct schedTable_entry *entry;
+ char buf[24];
+ long frequency;
+ long value;
+ size_t tmpint;
+ oid variable[ MAX_OID_LEN], *var_ptr = variable;
+ size_t var_len = MAX_OID_LEN;
+
+ schedEntries++;
+ sprintf(buf, "_conf%03d", schedEntries);
+
+ DEBUGMSGTL(( "disman:schedule:conf", "periodic: %s %s\n", token, line));
+ /*
+ * Parse the configure directive line
+ */
+ line = read_config_read_data(ASN_INTEGER, line, &frequency, &tmpint);
+ line = read_config_read_data(ASN_OBJECT_ID, line, &var_ptr, &var_len);
+ if (var_len == 0) {
+ config_perror("invalid specification for schedVariable");
+ return;
+ }
+ /*
+ * Skip over optional assignment in "var = value"
+ */
+ while (line && isspace(*line))
+ line++;
+ if (line && *line == '=' ) {
+ line++;
+ while (line && isspace(*line)) {
+ line++;
+ }
+ }
+ line = read_config_read_data(ASN_INTEGER, line, &value, &tmpint);
+
+ /*
+ * Create an entry in the schedTable
+ */
+ row = schedTable_createEntry( "snmpd.conf", buf );
+ if (!row || !row->data) {
+ config_perror("create schedule entry failure");
+ return;
+ }
+ entry = (struct schedTable_entry *)row->data;
+
+ entry->schedInterval = frequency;
+ entry->schedValue = value;
+ entry->schedVariable_len = var_len;
+ memcpy(entry->schedVariable, variable, var_len*sizeof(oid));
+
+ entry->schedType = SCHED_TYPE_PERIODIC;
+ entry->schedStorageType = ST_READONLY; /* or PERMANENT */
+ entry->flags = SCHEDULE_FLAG_ENABLED |
+ SCHEDULE_FLAG_ACTIVE |
+ SCHEDULE_FLAG_VALID;
+ entry->session = netsnmp_query_get_default_session();
+ sched_nextTime( entry );
+}
+
+
+/*
+ * Timed-schedule utility:
+ * Convert from a cron-style specification to the equivalent set
+ * of bits. Note that minute, hour and weekday crontab fields are
+ * 0-based, while day and month more naturally start from 1.
+ */
+void
+_sched_convert_bits( char *cron_spec, char *bit_buf,
+ int bit_buf_len, int max_val, int startAt1 ) {
+ char *cp = cron_spec;
+ char b[] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
+ int val, major, minor;
+ int overshoot;
+
+ if (!cron_spec || !bit_buf)
+ return;
+
+ /*
+ * Wildcard field - set all bits
+ */
+ if ( *cp == '*' ) {
+ memset( bit_buf, 0xff, bit_buf_len );
+
+ /*
+ * An "all-bits" specification may not be an exact multiple of 8.
+ * Work out how far we've overshot things, and tidy up the excess.
+ */
+ overshoot = 8*bit_buf_len-max_val;
+ while ( overshoot > 0 ) {
+ bit_buf[ bit_buf_len-1 ] ^= b[8-overshoot];
+ overshoot--;
+ }
+ return;
+ }
+
+ /*
+ * Otherwise, clear the bit string buffer,
+ * and start calculating which bits to set
+ */
+ memset( bit_buf, 0, bit_buf_len );
+
+ while (1) {
+ sscanf( cp, "%d", &val);
+ /* Handle negative day specification */
+ if ( val < 0 ) {
+ val = max_val - val;
+ }
+ if ( startAt1 )
+ val--;
+ major = val/8;
+ minor = val%8;
+ bit_buf[ major ] |= b[minor];
+
+ /* XXX - ideally we should handle "X-Y" syntax as well */
+ while (*cp && *cp!=',')
+ cp++;
+ if (!*cp)
+ break;
+ cp++;
+ }
+}
+
+void
+parse_sched_timed( const char *token, char *line )
+{
+ netsnmp_tdata_row *row;
+ struct schedTable_entry *entry;
+ char buf[24], *cp;
+
+ char minConf[512]; size_t min_len = sizeof(minConf); char minVal[8];
+ char hourConf[512]; size_t hour_len = sizeof(hourConf); char hourVal[3];
+ char dateConf[512]; size_t date_len = sizeof(dateConf); char dateVal[8];
+ char monConf[512]; size_t mon_len = sizeof(monConf); char monVal[2];
+ char dayConf[512]; size_t day_len = sizeof(dayConf); char dayVal;
+
+ long value;
+ size_t tmpint;
+ oid variable[ MAX_OID_LEN], *var_ptr = variable;
+ size_t var_len = MAX_OID_LEN;
+
+ schedEntries++;
+ sprintf(buf, "_conf%03d", schedEntries);
+
+ DEBUGMSGTL(( "sched", "config: %s %s\n", token, line));
+ /*
+ * Parse the configure directive line
+ */
+ cp = minConf;
+ line = read_config_read_data(ASN_OCTET_STR, line, &cp, &min_len);
+ cp = hourConf;
+ line = read_config_read_data(ASN_OCTET_STR, line, &cp, &hour_len);
+ cp = dateConf;
+ line = read_config_read_data(ASN_OCTET_STR, line, &cp, &date_len);
+ cp = monConf;
+ line = read_config_read_data(ASN_OCTET_STR, line, &cp, &mon_len);
+ cp = dayConf;
+ line = read_config_read_data(ASN_OCTET_STR, line, &cp, &day_len);
+ if (!line) {
+ config_perror("invalid schedule time specification");
+ return;
+ }
+
+ line = read_config_read_data(ASN_OBJECT_ID, line, &var_ptr, &var_len);
+ if (var_len == 0) {
+ config_perror("invalid specification for schedVariable");
+ return;
+ }
+ /*
+ * Skip over optional assignment in "var = value"
+ */
+ while (line && isspace(*line))
+ line++;
+ if ( *line == '=' ) {
+ line++;
+ while (line && isspace(*line)) {
+ line++;
+ }
+ }
+ line = read_config_read_data(ASN_INTEGER, line, &value, &tmpint);
+
+ /*
+ * Convert from cron-style specifications into bits
+ */
+ _sched_convert_bits( minConf, minVal, 8, 60, 0 );
+ _sched_convert_bits( hourConf, hourVal, 3, 24, 0 );
+ memset(dateVal+4, 0, 4); /* Clear the reverse day bits */
+ _sched_convert_bits( dateConf, dateVal, 4, 31, 1 );
+ _sched_convert_bits( monConf, monVal, 2, 12, 1 );
+ _sched_convert_bits( dayConf, &dayVal, 1, 8, 0 );
+ if ( dayVal & 0x01 ) { /* sunday(7) = sunday(0) */
+ dayVal |= 0x80;
+ dayVal &= 0xfe;
+ }
+
+ /*
+ * Create an entry in the schedTable
+ */
+ row = schedTable_createEntry("snmpd.conf", buf);
+ if (!row || !row->data) {
+ config_perror("create schedule entry failure");
+ return;
+ }
+ entry = (struct schedTable_entry *)row->data;
+
+ entry->schedWeekDay = dayVal;
+ memcpy(entry->schedMonth, monVal, 2);
+ memcpy(entry->schedDay, dateVal, 4+4);
+ memcpy(entry->schedHour, hourVal, 3);
+ memcpy(entry->schedMinute, minVal, 8);
+
+ memcpy(entry->schedVariable, variable, var_len*sizeof(oid));
+ entry->schedVariable_len = var_len;
+ entry->schedValue = value;
+
+ if ( !strcmp( token, "at" ))
+ entry->schedType = SCHED_TYPE_ONESHOT;
+ else
+ entry->schedType = SCHED_TYPE_CALENDAR;
+ entry->schedStorageType = ST_READONLY; /* or PERMANENT */
+ entry->flags = SCHEDULE_FLAG_ENABLED |
+ SCHEDULE_FLAG_ACTIVE |
+ SCHEDULE_FLAG_VALID;
+ entry->session = netsnmp_query_get_default_session();
+ sched_nextTime( entry );
+}
+
+
+/* ========================================
+ *
+ * Handlers for persistent schedule entries
+ *
+ * ======================================== */
+
+void
+parse_schedTable( const char *token, char *line )
+{
+ char owner[SCHED_STR1_LEN+1];
+ char name[ SCHED_STR1_LEN+1];
+ char time_bits[22]; /* schedWeekDay..schedMinute */
+ void *vp;
+ size_t len;
+ netsnmp_tdata_row *row;
+ struct schedTable_entry *entry;
+
+ DEBUGMSGTL(("disman:schedule:conf", "Parsing schedTable config... "));
+
+ /*
+ * Read in the index information for this entry
+ * and create a (non-fixed) data structure for it.
+ */
+ memset( owner, 0, sizeof(owner));
+ memset( name, 0, sizeof(name));
+ len = SCHED_STR1_LEN; vp = owner;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = SCHED_STR1_LEN; vp = name;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ row = schedTable_createEntry(owner, name);
+ if (!row || !row->data) {
+ config_perror("create schedule entry failure");
+ return;
+ }
+ entry = (struct schedTable_entry *)row->data;
+ DEBUGMSG(("disman:schedule:conf", "(%s, %s) ", owner, name));
+
+ /*
+ * Read in the column values.
+ */
+ len = SCHED_STR2_LEN; vp = entry->schedDescr;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ line = read_config_read_data(ASN_UNSIGNED, line,
+ &entry->schedInterval, NULL);
+ /* Unpick the various timed bits */
+ len = 22; vp = time_bits;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ entry->schedWeekDay = time_bits[0];
+ entry->schedMonth[0] = time_bits[1];
+ entry->schedMonth[1] = time_bits[2];
+ entry->schedHour[0] = time_bits[11];
+ entry->schedHour[1] = time_bits[12];
+ entry->schedHour[2] = time_bits[13];
+ memcpy(entry->schedDay, time_bits+3, 8);
+ memcpy(entry->schedMinute, time_bits+14, 8);
+
+ len = SCHED_STR1_LEN; vp = entry->schedContextName;
+ line = read_config_read_data(ASN_OCTET_STR, line, &vp, &len);
+ len = MAX_OID_LEN; vp = entry->schedVariable;
+ line = read_config_read_data(ASN_OBJECT_ID, line, &vp, &len);
+ entry->schedVariable_len = len;
+ line = read_config_read_data(ASN_INTEGER, line,
+ &entry->schedValue, NULL);
+ line = read_config_read_data(ASN_UNSIGNED, line,
+ &entry->schedType, NULL);
+ line = read_config_read_data(ASN_UNSIGNED, line, &len, NULL);
+ entry->flags |= (len /* & WHAT ?? */);
+ /* XXX - Will need to read in the 'iquery' access information */
+ entry->flags |= SCHEDULE_FLAG_VALID;
+
+ DEBUGMSG(("disman:schedule:conf", "\n"));
+}
+
+/*
+ * Save dynamically-configured schedTable entries into persistent storage
+ */
+int
+store_schedTable(int majorID, int minorID, void *serverarg, void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char time_bits[22]; /* schedWeekDay..schedMinute */
+ char *cptr;
+ void *vp;
+ size_t tint;
+ netsnmp_tdata_row *row;
+ struct schedTable_entry *entry;
+
+
+ DEBUGMSGTL(( "disman:schedule:conf", "Storing schedTable:\n"));
+
+ for (row = netsnmp_tdata_row_first( schedule_table );
+ row;
+ row = netsnmp_tdata_row_next( schedule_table, row )) {
+
+ if (!row->data)
+ continue;
+ entry = (struct schedTable_entry *)row->data;
+
+ /*
+ * Only save (dynamically-created) 'nonVolatile' entries
+ * (XXX - what about dynamic 'permanent' entries ??)
+ */
+ if (entry->schedStorageType != ST_NONVOLATILE )
+ continue;
+ DEBUGMSGTL(( "disman:schedule:conf", " Storing (%s, %s)\n",
+ entry->schedOwner, entry->schedName));
+
+ memset(line, 0, sizeof(line));
+ strcpy(line, "_schedTable ");
+ cptr = line + strlen(line);
+
+ vp = entry->schedOwner; tint = strlen( vp );
+ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->schedName; tint = strlen( vp );
+ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->schedDescr; tint = strlen( vp );
+ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &vp, &tint );
+ tint = entry->schedInterval;
+ cptr = read_config_store_data(ASN_UNSIGNED, cptr, &tint, NULL );
+
+ /* Combine all the timed bits into a single field */
+ time_bits[0] = entry->schedWeekDay;
+ time_bits[1] = entry->schedMonth[0];
+ time_bits[2] = entry->schedMonth[1];
+ time_bits[11] = entry->schedHour[0];
+ time_bits[12] = entry->schedHour[1];
+ time_bits[13] = entry->schedHour[2];
+ memcpy(time_bits+3, entry->schedDay, 8);
+ memcpy(time_bits+14, entry->schedMinute, 8);
+ vp = time_bits; tint = 22;
+ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &vp, &tint );
+
+ vp = entry->schedContextName; tint = strlen( vp );
+ cptr = read_config_store_data(ASN_OCTET_STR, cptr, &vp, &tint );
+ vp = entry->schedVariable;
+ tint = entry->schedVariable_len;
+ cptr = read_config_store_data(ASN_OBJECT_ID, cptr, &vp, &tint );
+ tint = entry->schedValue;
+ cptr = read_config_store_data(ASN_INTEGER, cptr, &tint, NULL );
+ tint = entry->schedType;
+ cptr = read_config_store_data(ASN_UNSIGNED, cptr, &tint, NULL );
+ tint = entry->flags /* & WHAT ?? */;
+ cptr = read_config_store_data(ASN_UNSIGNED, cptr, &tint, NULL );
+ /* XXX - Need to store the 'iquery' access information */
+ snmpd_store_config(line);
+ }
+ DEBUGMSGTL(( "disman:schedule:conf", " done.\n"));
+ return SNMPERR_SUCCESS;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedConf.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedConf.h
new file mode 100644
index 0000000000..91f496579c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedConf.h
@@ -0,0 +1,17 @@
+#ifndef SCHEDCONF_H
+#define SCHEDCONF_H
+
+config_require(disman/schedule/schedCore)
+
+/*
+ * function declarations
+ */
+void init_schedConf(void);
+
+void parse_sched_periodic(const char *, char *);
+void parse_sched_timed( const char *, char *);
+void parse_schedTable( const char *, char *);
+SNMPCallback store_schedTable;
+
+
+#endif /* SCHEDCONF_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedCore.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedCore.c
new file mode 100644
index 0000000000..94c9f25574
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedCore.c
@@ -0,0 +1,503 @@
+/*
+ * DisMan Schedule MIB:
+ * Core implementation of the schedule handling behaviour
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "disman/schedule/schedCore.h"
+#include "utilities/iquery.h"
+
+netsnmp_tdata *schedule_table;
+
+ /*
+ * Initialize the container for the schedule table,
+ * regardless of which initialisation routine is called first.
+ */
+void
+init_schedule_container(void)
+{
+ DEBUGMSGTL(("disman:schedule:init", "init schedule container\n"));
+ if (!schedule_table) {
+ schedule_table = netsnmp_tdata_create_table("schedTable", 0);
+ DEBUGMSGTL(("disman:schedule:init",
+ "create schedule container(%x)\n", schedule_table));
+ }
+}
+
+/** Initializes the schedCore module */
+void
+init_schedCore(void)
+{
+ /*
+ * Create a table structure for the schedule table
+ * This will typically be registered by the schedTable module
+ */
+ DEBUGMSGTL(("disman:schedule:init", "Initializing core module\n"));
+ init_schedule_container();
+}
+
+
+/*
+ * Callback to invoke a scheduled action
+ */
+static void
+_sched_callback( unsigned int reg, void *magic )
+{
+ struct schedTable_entry *entry = (struct schedTable_entry *)magic;
+ int ret;
+ netsnmp_variable_list assign;
+
+ if ( !entry ) {
+ DEBUGMSGTL(("disman:schedule:callback", "missing entry\n"));
+ return;
+ }
+ entry->schedLastRun = time(0);
+ entry->schedTriggers++;
+
+ DEBUGMSGTL(( "disman:schedule:callback", "assignment "));
+ DEBUGMSGOID(("disman:schedule:callback", entry->schedVariable,
+ entry->schedVariable_len));
+ DEBUGMSG(( "disman:schedule:callback", " = %d\n", entry->schedValue));
+
+ memset(&assign, 0, sizeof(netsnmp_variable_list));
+ snmp_set_var_objid(&assign, entry->schedVariable, entry->schedVariable_len);
+ snmp_set_var_typed_value(&assign, ASN_INTEGER,
+ (u_char *)&entry->schedValue,
+ sizeof(entry->schedValue));
+
+ ret = netsnmp_query_set( &assign, entry->session );
+ if ( ret != SNMP_ERR_NOERROR ) {
+ DEBUGMSGTL(( "disman:schedule:callback",
+ "assignment failed (%d)\n", ret));
+ entry->schedFailures++;
+ entry->schedLastFailure = ret;
+ time ( &entry->schedLastFailed );
+ }
+
+ sched_nextTime( entry );
+}
+
+
+ /*
+ * Internal utility routines to help interpret
+ * calendar-based schedule bit strings
+ */
+static char _masks[] = { /* 0xff, */ 0x7f, 0x3f, 0x1f,
+ 0x0f, 0x07, 0x03, 0x01, 0x00 };
+static char _bits[] = { 0x80, 0x40, 0x20, 0x10,
+ 0x08, 0x04, 0x02, 0x01 };
+
+/*
+ * Are any of the bits set?
+ */
+static int
+_bit_allClear( char *pattern, int len ) {
+ int i;
+
+ for (i=0; i<len; i++) {
+ if ( pattern[i] != 0 )
+ return 0; /* At least one bit set */
+ }
+ return 1; /* All bits clear */
+}
+
+/*
+ * Is a particular bit set?
+ */
+static int
+_bit_set( char *pattern, int bit ) {
+ int major, minor;
+
+ major = bit/8;
+ minor = bit%8;
+ if ( pattern[major] & _bits[minor] ) {
+ return 1; /* Specified bit is set */
+ }
+ return 0; /* Bit not set */
+}
+
+/*
+ * What is the next bit set?
+ * (after a specified point)
+ */
+static int
+_bit_next( char *pattern, int current, size_t len ) {
+ char buf[ 8 ];
+ int major, minor, i, j;
+
+ /* Make a working copy of the bit pattern */
+ memset( buf, 0, 8 );
+ memcpy( buf, pattern, len );
+
+ /*
+ * If we're looking for the first bit after some point,
+ * then clear all earlier bits from the working copy.
+ */
+ if ( current > -1 ) {
+ major = current/8;
+ minor = current%8;
+ for ( i=0; i<major; i++ )
+ buf[i]=0;
+ buf[major] &= _masks[minor];
+ }
+
+ /*
+ * Look for the first bit that's set
+ */
+ for ( i=0; i<len; i++ ) {
+ if ( buf[i] != 0 ) {
+ major = i*8;
+ for ( j=0; j<8; j++ ) {
+ if ( buf[i] & _bits[j] ) {
+ return major+j;
+ }
+ }
+ }
+ }
+ return -1; /* No next bit */
+}
+
+
+static int _daysPerMonth[] = { 31, 28, 31, 30,
+ 31, 30, 31, 31,
+ 30, 31, 30, 31, 29 };
+
+static char _truncate[] = { 0xfe, 0xf0, 0xfe, 0xfc,
+ 0xfe, 0xfc, 0xfe, 0xfe,
+ 0xfc, 0xfe, 0xfc, 0xfe, 0xf8 };
+
+/*
+ * What is the next day with a relevant bit set?
+ *
+ * Merge the forward and reverse day bits into a single
+ * pattern relevant for this particular month,
+ * and apply the standard _bit_next() call.
+ * Then check this result against the day of the week bits.
+ */
+static int
+_bit_next_day( char *day_pattern, char weekday_pattern,
+ int day, int month, int year ) {
+ char buf[4];
+ union {
+ char buf2[4];
+ int int_val;
+ } rev;
+ int next_day, i;
+ struct tm tm_val;
+
+ /* Make a working copy of the forward day bits ... */
+ memset( buf, 0, 4 );
+ memcpy( buf, day_pattern, 4 );
+
+ /* ... and another (right-aligned) of the reverse day bits */
+ memset( rev.buf2, 0, 4 );
+ memcpy( rev.buf2, day_pattern+4, 4 );
+ rev.int_val >>= 2;
+ if ( buf[3] & 0x01 )
+ rev.buf2[0] |= 0x40;
+ if ( month == 3 || month == 5 ||
+ month == 8 || month == 10 )
+ rev.int_val >>= 1; /* April, June, September, November */
+ if ( month == 1 )
+ rev.int_val >>= 3; /* February */
+ if ( month == 12 )
+ rev.int_val >>= 2; /* February (leap year) */
+
+ /* Combine the two bit patterns, and truncate to the month end */
+ for ( i=0; i<4; i++ ) {
+ if ( rev.buf2[i] & 0x80 ) buf[3-i] |= 0x01;
+ if ( rev.buf2[i] & 0x40 ) buf[3-i] |= 0x02;
+ if ( rev.buf2[i] & 0x20 ) buf[3-i] |= 0x04;
+ if ( rev.buf2[i] & 0x10 ) buf[3-i] |= 0x08;
+ if ( rev.buf2[i] & 0x08 ) buf[3-i] |= 0x10;
+ if ( rev.buf2[i] & 0x04 ) buf[3-i] |= 0x20;
+ if ( rev.buf2[i] & 0x02 ) buf[3-i] |= 0x40;
+ if ( rev.buf2[i] & 0x01 ) buf[3-i] |= 0x80;
+ }
+
+ buf[3] &= _truncate[ month ];
+
+ next_day = day-1; /* tm_day is 1-based, not 0-based */
+ do {
+ next_day = _bit_next( buf, next_day, 4 );
+ if ( next_day < 0 )
+ return -1;
+
+ /*
+ * Calculate the day of the week, and
+ * check this against the weekday pattern
+ */
+ memset( &tm_val, 0, sizeof(struct tm));
+ tm_val.tm_mday = next_day+1;
+ tm_val.tm_mon = month;
+ tm_val.tm_year = year;
+ mktime( &tm_val );
+ } while ( !_bit_set( &weekday_pattern, tm_val.tm_wday ));
+ return next_day+1; /* Convert back to 1-based list */
+}
+
+
+#ifndef HAVE_LOCALTIME_R
+struct tm *
+localtime_r(const time_t *timep, struct tm *result) {
+ struct tm *tmp;
+
+ tmp = localtime( timep );
+ if ( tmp && result ) {
+ memcpy( result, tmp, sizeof(struct tm));
+ }
+
+ return (tmp ? result : NULL );
+}
+#endif
+
+/*
+ * determine the time for the next scheduled action of a given entry
+ */
+void
+sched_nextTime( struct schedTable_entry *entry )
+{
+ time_t now;
+ struct tm now_tm, next_tm;
+ int rev_day, mon;
+
+ time( &now );
+
+ if ( !entry ) {
+ DEBUGMSGTL(("disman:schedule:time", "missing entry\n"));
+ return;
+ }
+
+ if ( entry->schedCallbackID )
+ snmp_alarm_unregister( entry->schedCallbackID );
+
+ if (!(entry->flags & SCHEDULE_FLAG_ENABLED) ||
+ !(entry->flags & SCHEDULE_FLAG_ACTIVE)) {
+ DEBUGMSGTL(("disman:schedule:time", "inactive entry\n"));
+ return;
+ }
+
+ switch ( entry->schedType ) {
+ case SCHED_TYPE_PERIODIC:
+ if ( !entry->schedInterval ) {
+ DEBUGMSGTL(("disman:schedule:time", "periodic: no interval\n"));
+ return;
+ }
+ if ( entry->schedLastRun ) {
+ entry->schedNextRun = entry->schedLastRun +
+ entry->schedInterval;
+ } else {
+ entry->schedNextRun = now + entry->schedInterval;
+ }
+ DEBUGMSGTL(("disman:schedule:time", "periodic: (%d) %s",
+ entry->schedNextRun,
+ ctime(&entry->schedNextRun)));
+ break;
+
+ case SCHED_TYPE_ONESHOT:
+ if ( entry->schedLastRun ) {
+ DEBUGMSGTL(("disman:schedule:time", "one-shot: expired (%d) %s",
+ entry->schedNextRun,
+ ctime(&entry->schedNextRun)));
+ return;
+ }
+ /* Fallthrough */
+ DEBUGMSGTL(("disman:schedule:time", "one-shot: fallthrough\n"));
+ case SCHED_TYPE_CALENDAR:
+ /*
+ * Check for complete time specification
+ * If any of the five fields have no bits set,
+ * the entry can't possibly match any time.
+ */
+ if ( _bit_allClear( entry->schedMinute, 8 ) ||
+ _bit_allClear( entry->schedHour, 3 ) ||
+ _bit_allClear( entry->schedDay, 4+4 ) ||
+ _bit_allClear( entry->schedMonth, 2 ) ||
+ _bit_allClear(&entry->schedWeekDay, 1 )) {
+ DEBUGMSGTL(("disman:schedule:time", "calendar: incomplete spec\n"));
+ return;
+ }
+
+ /*
+ * Calculate the next run time:
+ *
+ * If the current Month, Day & Hour bits are set
+ * calculate the next specified minute
+ * If this fails (or the current Hour bit is not set)
+ * use the first specified minute,
+ * and calculate the next specified hour
+ * If this fails (or the current Day bit is not set)
+ * use the first specified minute and hour
+ * and calculate the next specified day (in this month)
+ * If this fails (or the current Month bit is not set)
+ * use the first specified minute and hour
+ * calculate the next specified month, and
+ * the first specified day (in that month)
+ */
+
+ localtime_r( &now, &now_tm );
+ localtime_r( &now, &next_tm );
+
+ next_tm.tm_mon=-1;
+ next_tm.tm_mday=-1;
+ next_tm.tm_hour=-1;
+ next_tm.tm_min=-1;
+ next_tm.tm_sec=0;
+ if ( _bit_set( entry->schedMonth, now_tm.tm_mon )) {
+ next_tm.tm_mon = now_tm.tm_mon;
+ rev_day = _daysPerMonth[ now_tm.tm_mon ] - now_tm.tm_mday;
+ if ( _bit_set( &entry->schedWeekDay, now_tm.tm_wday ) &&
+ (_bit_set( entry->schedDay, now_tm.tm_mday-1 ) ||
+ _bit_set( entry->schedDay, 31+rev_day ))) {
+ next_tm.tm_mday = now_tm.tm_mday;
+
+ if ( _bit_set( entry->schedHour, now_tm.tm_hour )) {
+ next_tm.tm_hour = now_tm.tm_hour;
+ /* XXX - Check Fall timechange */
+ next_tm.tm_min = _bit_next( entry->schedMinute,
+ now_tm.tm_min, 8 );
+ } else {
+ next_tm.tm_min = -1;
+ }
+
+ if ( next_tm.tm_min == -1 ) {
+ next_tm.tm_min = _bit_next( entry->schedMinute, -1, 8 );
+ next_tm.tm_hour = _bit_next( entry->schedHour,
+ now_tm.tm_hour, 3 );
+ }
+ } else {
+ next_tm.tm_hour = -1;
+ }
+
+ if ( next_tm.tm_hour == -1 ) {
+ next_tm.tm_min = _bit_next( entry->schedMinute, -1, 8 );
+ next_tm.tm_hour = _bit_next( entry->schedHour, -1, 3 );
+ /* Handle leap years */
+ mon = now_tm.tm_mon;
+ if ( mon == 1 && (now_tm.tm_year%4 == 0) )
+ mon = 12;
+ next_tm.tm_mday = _bit_next_day( entry->schedDay,
+ entry->schedWeekDay,
+ now_tm.tm_mday,
+ mon, now_tm.tm_year );
+ }
+ } else {
+ next_tm.tm_min = _bit_next( entry->schedMinute, -1, 2 );
+ next_tm.tm_hour = _bit_next( entry->schedHour, -1, 3 );
+ next_tm.tm_mday = -1;
+ next_tm.tm_mon = now_tm.tm_mon;
+ }
+
+ while ( next_tm.tm_mday == -1 ) {
+ next_tm.tm_mon = _bit_next( entry->schedMonth,
+ next_tm.tm_mon, 2 );
+ if ( next_tm.tm_mon == -1 ) {
+ next_tm.tm_year++;
+ next_tm.tm_mon = _bit_next( entry->schedMonth,
+ -1, 2 );
+ }
+ /* Handle leap years */
+ mon = next_tm.tm_mon;
+ if ( mon == 1 && (next_tm.tm_year%4 == 0) )
+ mon = 12;
+ next_tm.tm_mday = _bit_next_day( entry->schedDay,
+ entry->schedWeekDay,
+ -1, mon, next_tm.tm_year );
+ /* XXX - catch infinite loop */
+ }
+
+ /* XXX - Check for Spring timechange */
+
+ /*
+ * 'next_tm' now contains the time for the next scheduled run
+ */
+ entry->schedNextRun = mktime( &next_tm );
+ DEBUGMSGTL(("disman:schedule:time", "calendar: (%d) %s",
+ entry->schedNextRun,
+ ctime(&entry->schedNextRun)));
+ return;
+
+ default:
+ DEBUGMSGTL(("disman:schedule:time", "unknown type (%d)\n",
+ entry->schedType));
+ return;
+ }
+ entry->schedCallbackID = snmp_alarm_register(
+ entry->schedNextRun - now,
+ 0, _sched_callback, entry );
+ return;
+}
+
+void
+sched_nextRowTime( netsnmp_tdata_row *row )
+{
+ sched_nextTime((struct schedTable_entry *) row->data );
+}
+
+/*
+ * create a new row in the table
+ */
+netsnmp_tdata_row *
+schedTable_createEntry(const char *schedOwner, const char *schedName)
+{
+ struct schedTable_entry *entry;
+ netsnmp_tdata_row *row;
+
+ DEBUGMSGTL(("disman:schedule:entry", "creating entry (%s, %s)\n",
+ schedOwner, schedName));
+ entry = SNMP_MALLOC_TYPEDEF(struct schedTable_entry);
+ if (!entry)
+ return NULL;
+
+ row = netsnmp_tdata_create_row();
+ if (!row) {
+ SNMP_FREE(entry);
+ return NULL;
+ }
+ row->data = entry;
+ /*
+ * Set the indexing for this entry, both in the row
+ * data structure, and in the table_data helper.
+ */
+ if (schedOwner) {
+ memcpy(entry->schedOwner, schedOwner, strlen(schedOwner));
+ }
+ memcpy( entry->schedName, schedName, strlen(schedName));
+ netsnmp_tdata_row_add_index(row, ASN_OCTET_STR,
+ (entry->schedOwner || ""),
+ ((schedOwner) ? strlen(schedOwner) : 0));
+ netsnmp_tdata_row_add_index(row, ASN_OCTET_STR,
+ entry->schedName, strlen(schedName));
+ /*
+ * Set the (non-zero) default values in the row data structure.
+ */
+ entry->schedType = SCHED_TYPE_PERIODIC;
+ entry->schedVariable_len = 2; /* .0.0 */
+
+ netsnmp_tdata_add_row(schedule_table, row);
+ return row;
+}
+
+
+/*
+ * remove a row from the table
+ */
+void
+schedTable_removeEntry(netsnmp_tdata_row *row)
+{
+ struct schedTable_entry *entry;
+
+ if (!row || !row->data) {
+ DEBUGMSGTL(("disman:schedule:entry", "remove: missing entry\n"));
+ return; /* Nothing to remove */
+ }
+ entry = (struct schedTable_entry *)
+ netsnmp_tdata_remove_and_delete_row(schedule_table, row);
+ if (entry) {
+ DEBUGMSGTL(("disman:schedule:entry", "remove entry (%s, %s)\n",
+ entry->schedOwner, entry->schedName));
+ SNMP_FREE(entry);
+ }
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedCore.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedCore.h
new file mode 100644
index 0000000000..4436711037
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedCore.h
@@ -0,0 +1,85 @@
+#ifndef SCHEDCORE_H
+#define SCHEDCORE_H
+
+config_require(utilities/iquery)
+
+ /*
+ * Values for schedType field
+ */
+#define SCHED_TYPE_PERIODIC 1
+#define SCHED_TYPE_CALENDAR 2
+#define SCHED_TYPE_ONESHOT 3
+
+ /*
+ * Schedule flags
+ */
+#define SCHEDULE_FLAG_ENABLED 0x01 /* for schedAdminStatus */
+#define SCHEDULE_FLAG_ACTIVE 0x02 /* for schedRowStatus */
+#define SCHEDULE_FLAG_VALID 0x04 /* for row creation/undo */
+
+ /*
+ * All Schedule-MIB OCTET STRING objects are either short (32-char)
+ * tags, or SnmpAdminString values (i.e. 255 characters)
+ */
+#define SCHED_STR1_LEN 32
+#define SCHED_STR2_LEN 255
+
+ /*
+ * Data structure for a schedTable row entry
+ */
+struct schedTable_entry {
+ /*
+ * Index values
+ */
+ char schedOwner[SCHED_STR1_LEN+1];
+ char schedName[ SCHED_STR1_LEN+1];
+
+ /*
+ * Column values - schedule actions
+ */
+ char schedDescr[SCHED_STR2_LEN+1];
+ u_long schedInterval;
+ char schedWeekDay;
+ char schedMonth[2];
+ char schedDay[4+4];
+ char schedHour[3];
+ char schedMinute[8];
+ char schedContextName[SCHED_STR1_LEN];
+ oid schedVariable[ MAX_OID_LEN ];
+ size_t schedVariable_len;
+ long schedValue;
+
+ /*
+ * Column values - schedule control
+ */
+ long schedType;
+ u_long schedFailures;
+ long schedLastFailure;
+ time_t schedLastFailed;
+ long schedStorageType;
+ u_long schedTriggers;
+
+ /*
+ * Supporting values
+ */
+ time_t schedLastRun;
+ time_t schedNextRun;
+ unsigned int schedCallbackID;
+ netsnmp_session *session;
+ long flags;
+};
+
+/*
+ * function declarations
+ */
+extern netsnmp_tdata *schedule_table;
+void init_schedule_container(void);
+void init_schedCore(void);
+
+netsnmp_tdata_row *
+ schedTable_createEntry(const char *schedOwner, const char *schedName);
+void schedTable_removeEntry(netsnmp_tdata_row *row);
+void sched_nextTime( struct schedTable_entry *entry );
+void sched_nextRowTime( netsnmp_tdata_row *row );
+
+#endif /* SCHEDCORE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedTable.c
new file mode 100644
index 0000000000..ddb1be3d29
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedTable.c
@@ -0,0 +1,500 @@
+/*
+ * DisMan Schedule MIB:
+ * Core implementation of the schedTable MIB interface.
+ * See 'schedCore.c' for active behaviour of this table.
+ *
+ * (based on mib2c.table_data.conf output)
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "utilities/iquery.h"
+#include "disman/schedule/schedCore.h"
+#include "disman/schedule/schedTable.h"
+
+/** Initializes the schedTable module */
+void
+init_schedTable(void)
+{
+ static oid schedTable_oid[] = { 1, 3, 6, 1, 2, 1, 63, 1, 2 };
+ size_t schedTable_oid_len = OID_LENGTH(schedTable_oid);
+ netsnmp_handler_registration *reg;
+ netsnmp_table_registration_info *table_info;
+
+ DEBUGMSGTL(("disman:schedule:init", "Initializing table\n"));
+ /*
+ * Ensure the schedule table container is available...
+ */
+ init_schedule_container();
+
+ /*
+ * ... then set up the MIB interface.
+ */
+ reg = netsnmp_create_handler_registration("schedTable",
+ schedTable_handler,
+ schedTable_oid,
+ schedTable_oid_len,
+ HANDLER_CAN_RWRITE);
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ netsnmp_table_helper_add_indexes(table_info,
+ ASN_OCTET_STR, /* index: schedOwner */
+ ASN_OCTET_STR, /* index: schedName */
+ 0);
+ table_info->min_column = COLUMN_SCHEDDESCR;
+ table_info->max_column = COLUMN_SCHEDTRIGGERS;
+
+ netsnmp_tdata_register(reg, schedule_table, table_info);
+}
+
+
+/** handles requests for the schedTable table */
+int
+schedTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *tinfo;
+ netsnmp_tdata_row *row;
+ struct schedTable_entry *entry;
+ int recalculate = 0;
+ size_t len;
+ char *cp;
+ char owner[SCHED_STR1_LEN+1];
+ char name[ SCHED_STR1_LEN+1];
+ int ret;
+
+ DEBUGMSGTL(("disman:schedule:mib", "Schedule handler (%d)\n",
+ reqinfo->mode));
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ entry = (struct schedTable_entry *)
+ netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info( request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_SCHEDDESCR:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ entry->schedDescr,
+ strlen(entry->schedDescr));
+ break;
+ case COLUMN_SCHEDINTERVAL:
+ snmp_set_var_typed_integer(request->requestvb, ASN_UNSIGNED,
+ entry->schedInterval);
+ break;
+ case COLUMN_SCHEDWEEKDAY:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ &entry->schedWeekDay,
+ sizeof(entry->schedWeekDay));
+ break;
+ case COLUMN_SCHEDMONTH:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ entry->schedMonth,
+ sizeof(entry->schedMonth));
+ break;
+ case COLUMN_SCHEDDAY:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ entry->schedDay,
+ sizeof(entry->schedDay));
+ break;
+ case COLUMN_SCHEDHOUR:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ entry->schedHour,
+ sizeof(entry->schedHour));
+ break;
+ case COLUMN_SCHEDMINUTE:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ entry->schedMinute,
+ sizeof(entry->schedMinute));
+ break;
+ case COLUMN_SCHEDCONTEXTNAME:
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ entry->schedContextName,
+ strlen(entry->schedContextName));
+ break;
+ case COLUMN_SCHEDVARIABLE:
+ snmp_set_var_typed_value(request->requestvb, ASN_OBJECT_ID,
+ (u_char *)entry->schedVariable,
+ entry->schedVariable_len*sizeof(oid));
+ break;
+ case COLUMN_SCHEDVALUE:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->schedValue);
+ break;
+ case COLUMN_SCHEDTYPE:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->schedType);
+ break;
+ case COLUMN_SCHEDADMINSTATUS:
+ ret = (entry->flags & SCHEDULE_FLAG_ENABLED ) ?
+ TV_TRUE : TV_FALSE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ case COLUMN_SCHEDOPERSTATUS:
+ ret = (entry->flags & SCHEDULE_FLAG_ENABLED ) ?
+ TV_TRUE : TV_FALSE;
+ /*
+ * Check for one-shot entries that have already fired
+ */
+ if ((entry->schedType == SCHED_TYPE_ONESHOT) &&
+ (entry->schedLastRun != 0 ))
+ ret = 3; /* finished(3) */
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ case COLUMN_SCHEDFAILURES:
+ snmp_set_var_typed_integer(request->requestvb, ASN_COUNTER,
+ entry->schedFailures);
+ break;
+ case COLUMN_SCHEDLASTFAILURE:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->schedLastFailure);
+ break;
+ case COLUMN_SCHEDLASTFAILED:
+ /*
+ * Convert 'schedLastFailed' timestamp
+ * into DateAndTime string
+ */
+ cp = date_n_time( &entry->schedLastFailed, &len );
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ cp, len);
+ break;
+ case COLUMN_SCHEDSTORAGETYPE:
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ entry->schedStorageType);
+ break;
+ case COLUMN_SCHEDROWSTATUS:
+ ret = (entry->flags & SCHEDULE_FLAG_ACTIVE ) ?
+ TV_TRUE : TV_FALSE;
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER, ret);
+ break;
+ case COLUMN_SCHEDTRIGGERS:
+ snmp_set_var_typed_integer(request->requestvb, ASN_COUNTER,
+ entry->schedTriggers);
+ break;
+ }
+ }
+ break;
+
+ /*
+ * Write-support
+ */
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request = request->next) {
+ entry = (struct schedTable_entry *)
+ netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info( request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_SCHEDDESCR:
+ ret = netsnmp_check_vb_type_and_max_size(
+ request->requestvb, ASN_OCTET_STR, SCHED_STR2_LEN);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_SCHEDINTERVAL:
+ ret = netsnmp_check_vb_uint( request->requestvb );
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_SCHEDWEEKDAY:
+ ret = netsnmp_check_vb_type_and_size(
+ request->requestvb, ASN_OCTET_STR, 1);
+ /* XXX - check for bit(7) set */
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_SCHEDMONTH:
+ ret = netsnmp_check_vb_type_and_size( /* max_size ?? */
+ request->requestvb, ASN_OCTET_STR, 2);
+ /* XXX - check for bit(12)-bit(15) set */
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_SCHEDDAY:
+ ret = netsnmp_check_vb_type_and_size( /* max_size ?? */
+ request->requestvb, ASN_OCTET_STR, 4+4);
+ /* XXX - check for bit(62) or bit(63) set */
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_SCHEDHOUR:
+ ret = netsnmp_check_vb_type_and_size( /* max_size ?? */
+ request->requestvb, ASN_OCTET_STR, 3);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_SCHEDMINUTE:
+ ret = netsnmp_check_vb_type_and_size( /* max_size ?? */
+ request->requestvb, ASN_OCTET_STR, 8);
+ /* XXX - check for bit(60)-bit(63) set */
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_SCHEDCONTEXTNAME:
+ ret = netsnmp_check_vb_type_and_max_size(
+ request->requestvb, ASN_OCTET_STR, SCHED_STR1_LEN);
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_SCHEDVARIABLE:
+ ret = netsnmp_check_vb_oid( request->requestvb );
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_SCHEDVALUE:
+ ret = netsnmp_check_vb_int( request->requestvb );
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_SCHEDTYPE:
+ ret = netsnmp_check_vb_int_range( request->requestvb,
+ SCHED_TYPE_PERIODIC, SCHED_TYPE_ONESHOT );
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_SCHEDADMINSTATUS:
+ ret = netsnmp_check_vb_truthvalue( request->requestvb );
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_WRONGTYPE);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_SCHEDSTORAGETYPE:
+ ret = netsnmp_check_vb_int_range( request->requestvb,
+ ST_NONE, ST_READONLY );
+ /* XXX - check valid/consistent assignments */
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ case COLUMN_SCHEDROWSTATUS:
+ ret = netsnmp_check_vb_rowstatus( request->requestvb,
+ (entry ? RS_ACTIVE: RS_NONEXISTENT));
+ /* XXX - check consistency assignments */
+ if (ret != SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_SCHEDROWSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ /*
+ * Create an (empty) new row structure
+ */
+ memset(owner, 0, SCHED_STR1_LEN+1);
+ memset(name, 0, SCHED_STR1_LEN+1);
+ memcpy(owner, tinfo->indexes->val.string,
+ tinfo->indexes->val_len);
+ memcpy(name, tinfo->indexes->next_variable->val.string,
+ tinfo->indexes->next_variable->val_len);
+ row = schedTable_createEntry(owner, name);
+ if (!row) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ return SNMP_ERR_NOERROR;
+ }
+ netsnmp_insert_tdata_row(request, row);
+ }
+ }
+ }
+ break;
+
+ case MODE_SET_FREE:
+ for (request = requests; request; request = request->next) {
+ tinfo = netsnmp_extract_table_info(request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_SCHEDROWSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_CREATEANDGO:
+ case RS_CREATEANDWAIT:
+ /*
+ * Tidy up after a failed row creation request
+ */
+ entry = (struct schedTable_entry *)
+ netsnmp_tdata_extract_entry(request);
+ if (entry &&
+ !(entry->flags & SCHEDULE_FLAG_VALID)) {
+ row = (netsnmp_tdata_row *)
+ netsnmp_tdata_extract_row(request);
+ schedTable_removeEntry(row);
+ }
+ }
+ }
+ }
+ break;
+
+ case MODE_SET_ACTION:
+ for (request = requests; request; request = request->next) {
+ entry = (struct schedTable_entry *)
+ netsnmp_tdata_extract_entry(request);
+ if (!entry) {
+ /*
+ * New rows must be created via the RowStatus column
+ */
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOCREATION);
+ /* or inconsistentName? */
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ break;
+
+ case MODE_SET_UNDO:
+ break;
+
+ case MODE_SET_COMMIT:
+ /*
+ * All these assignments are "unfailable", so it's
+ * (reasonably) safe to apply them in the Commit phase
+ */
+ for (request = requests; request; request = request->next) {
+ entry = (struct schedTable_entry *)
+ netsnmp_tdata_extract_entry(request);
+ tinfo = netsnmp_extract_table_info( request);
+
+ switch (tinfo->colnum) {
+ case COLUMN_SCHEDDESCR:
+ memset(entry->schedDescr, 0, sizeof(entry->schedDescr));
+ memcpy(entry->schedDescr, request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_SCHEDINTERVAL:
+ entry->schedInterval = *request->requestvb->val.integer;
+ recalculate = 1;
+ break;
+ case COLUMN_SCHEDWEEKDAY:
+ entry->schedWeekDay = request->requestvb->val.string[0];
+ recalculate = 1;
+ break;
+ case COLUMN_SCHEDMONTH:
+ entry->schedMonth[0] = request->requestvb->val.string[0];
+ entry->schedMonth[1] = request->requestvb->val.string[1];
+ recalculate = 1;
+ break;
+ case COLUMN_SCHEDDAY:
+ memset(entry->schedDay, 0, sizeof(entry->schedDay));
+ memcpy(entry->schedDay, request->requestvb->val.string,
+ request->requestvb->val_len);
+ recalculate = 1;
+ break;
+ case COLUMN_SCHEDHOUR:
+ entry->schedHour[0] = request->requestvb->val.string[0];
+ entry->schedHour[1] = request->requestvb->val.string[1];
+ entry->schedHour[2] = request->requestvb->val.string[2];
+ recalculate = 1;
+ break;
+ case COLUMN_SCHEDMINUTE:
+ memset(entry->schedMinute, 0, sizeof(entry->schedMinute));
+ memcpy(entry->schedMinute, request->requestvb->val.string,
+ request->requestvb->val_len);
+ recalculate = 1;
+ break;
+ case COLUMN_SCHEDCONTEXTNAME:
+ memset(entry->schedContextName, 0, SCHED_STR1_LEN+1);
+ memcpy(entry->schedContextName,
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ break;
+ case COLUMN_SCHEDVARIABLE:
+ memset(entry->schedVariable, 0, sizeof(entry->schedVariable));
+ memcpy(entry->schedVariable,
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ entry->schedVariable_len =
+ request->requestvb->val_len/sizeof(oid);
+ break;
+ case COLUMN_SCHEDVALUE:
+ entry->schedValue = *request->requestvb->val.integer;
+ break;
+ case COLUMN_SCHEDTYPE:
+ entry->schedType = *request->requestvb->val.integer;
+ break;
+ case COLUMN_SCHEDADMINSTATUS:
+ if (*request->requestvb->val.integer == TV_TRUE)
+ entry->flags |= SCHEDULE_FLAG_ENABLED;
+ else
+ entry->flags &= ~SCHEDULE_FLAG_ENABLED;
+ break;
+ case COLUMN_SCHEDSTORAGETYPE:
+ entry->schedStorageType = *request->requestvb->val.integer;
+ break;
+ case COLUMN_SCHEDROWSTATUS:
+ switch (*request->requestvb->val.integer) {
+ case RS_ACTIVE:
+ entry->flags |= SCHEDULE_FLAG_ACTIVE;
+ break;
+ case RS_CREATEANDGO:
+ entry->flags |= SCHEDULE_FLAG_ACTIVE;
+ entry->flags |= SCHEDULE_FLAG_VALID;
+ entry->session =
+ netsnmp_iquery_pdu_session(reqinfo->asp->pdu);
+ break;
+ case RS_CREATEANDWAIT:
+ entry->flags |= SCHEDULE_FLAG_VALID;
+ entry->session =
+ netsnmp_iquery_pdu_session(reqinfo->asp->pdu);
+ break;
+
+ case RS_DESTROY:
+ row = (netsnmp_tdata_row *)
+ netsnmp_tdata_extract_row(request);
+ schedTable_removeEntry(row);
+ }
+ recalculate = 1;
+ break;
+ }
+ }
+ if (recalculate)
+ sched_nextTime(entry);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedTable.h
new file mode 100644
index 0000000000..efd1f2eb50
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/schedule/schedTable.h
@@ -0,0 +1,38 @@
+#ifndef SCHEDTABLE_H
+#define SCHEDTABLE_H
+
+config_require(disman/schedule/schedCore)
+config_add_mib(DISMAN-SCHEDULE-MIB)
+
+/*
+ * function declarations
+ */
+void init_schedTable(void);
+Netsnmp_Node_Handler schedTable_handler;
+
+/*
+ * column number definitions for table schedTable
+ */
+#define COLUMN_SCHEDOWNER 1
+#define COLUMN_SCHEDNAME 2
+#define COLUMN_SCHEDDESCR 3
+#define COLUMN_SCHEDINTERVAL 4
+#define COLUMN_SCHEDWEEKDAY 5
+#define COLUMN_SCHEDMONTH 6
+#define COLUMN_SCHEDDAY 7
+#define COLUMN_SCHEDHOUR 8
+#define COLUMN_SCHEDMINUTE 9
+#define COLUMN_SCHEDCONTEXTNAME 10
+#define COLUMN_SCHEDVARIABLE 11
+#define COLUMN_SCHEDVALUE 12
+#define COLUMN_SCHEDTYPE 13
+#define COLUMN_SCHEDADMINSTATUS 14
+#define COLUMN_SCHEDOPERSTATUS 15
+#define COLUMN_SCHEDFAILURES 16
+#define COLUMN_SCHEDLASTFAILURE 17
+#define COLUMN_SCHEDLASTFAILED 18
+#define COLUMN_SCHEDSTORAGETYPE 19
+#define COLUMN_SCHEDROWSTATUS 20
+#define COLUMN_SCHEDTRIGGERS 21
+
+#endif /* SCHEDTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute-mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute-mib.h
new file mode 100644
index 0000000000..b33d69eafc
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute-mib.h
@@ -0,0 +1,21 @@
+/*
+*Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+*
+*All right reserved
+*
+*File Name:traceroute-mib.h
+*File Description:Add DISMAN-TRACEROUTE-MIB.
+*
+*Current Version:1.0
+*Author:ChenJing
+*Date:2004.8.20
+*/
+
+/*
+ * wrapper for the disman traceroute mib code files
+ */
+config_require(disman/traceroute/traceRouteCtlTable)
+config_require(disman/traceroute/traceRouteResultsTable)
+config_require(disman/traceroute/traceRouteProbeHistoryTable)
+config_require(disman/traceroute/traceRouteHopsTable)
+config_add_mib(DISMAN-TRACEROUTE-MIB)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteCtlTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteCtlTable.c
new file mode 100644
index 0000000000..17493d38df
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteCtlTable.c
@@ -0,0 +1,6258 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:traceRouteCtlTable.c
+ *File Description:Rows of traceRouteCtlTable MIB add delete ans read.
+ * Rows of traceRouteResultsTable MIB add and delete.
+ * Rows of traceRouteProbeHistoryTable MIB add and delete.
+ * Rows of traceRouteHopsTable MIB add and delete.
+ * The main function is also here.
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <pthread.h>
+
+#include "traceRouteCtlTable.h"
+#include "traceRouteResultsTable.h"
+#include "traceRouteProbeHistoryTable.h"
+#include "traceRouteHopsTable.h"
+#include "header_complex.h"
+
+oid traceRouteCtlTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 81, 1, 2 };
+
+/* trap */
+oid traceRoutePathChange[] = { 1, 3, 6, 1, 2, 1, 81, 0, 1 };
+oid traceRouteTestFailed[] = { 1, 3, 6, 1, 2, 1, 81, 0, 2 };
+oid traceRouteTestCompleted[] = { 1, 3, 6, 1, 2, 1, 81, 0, 3 };
+
+struct variable2 traceRouteCtlTable_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+
+ {COLUMN_TRACEROUTECTLTARGETADDRESSTYPE, ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 3}},
+ {COLUMN_TRACEROUTECTLTARGETADDRESS, ASN_OCTET_STR, RWRITE, var_traceRouteCtlTable, 2, {1, 4}},
+ {COLUMN_TRACEROUTECTLBYPASSROUTETABLE, ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 5}},
+ {COLUMN_TRACEROUTECTLDATASIZE, ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 6}},
+ {COLUMN_TRACEROUTECTLTIMEOUT, ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 7}},
+ {COLUMN_TRACEROUTECTLPROBESPERHOP, ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 8}},
+ {COLUMN_TRACEROUTECTLPORT, ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 9}},
+ {COLUMN_TRACEROUTECTLMAXTTL, ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 10}},
+ {COLUMN_TRACEROUTECTLDSFIELD, ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 11}},
+ {COLUMN_TRACEROUTECTLSOURCEADDRESSTYPE, ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 12}},
+ {COLUMN_TRACEROUTECTLSOURCEADDRESS, ASN_OCTET_STR, RWRITE, var_traceRouteCtlTable, 2, {1, 13}},
+ {COLUMN_TRACEROUTECTLIFINDEX, ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 14}},
+ {COLUMN_TRACEROUTECTLMISCOPTIONS, ASN_OCTET_STR, RWRITE, var_traceRouteCtlTable, 2, {1, 15}},
+ {COLUMN_TRACEROUTECTLMAXFAILURES, ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 16}},
+ {COLUMN_TRACEROUTECTLDONTFRAGMENT, ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 17}},
+ {COLUMN_TRACEROUTECTLINITIALTTL, ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 18}},
+ {COLUMN_TRACEROUTECTLFREQUENCY, ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 19}},
+ {COLUMN_TRACEROUTECTLSTORAGETYPE, ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 20}},
+ {COLUMN_TRACEROUTECTLADMINSTATUS, ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 21}},
+ {COLUMN_TRACEROUTECTLDESCR, ASN_OCTET_STR, RWRITE, var_traceRouteCtlTable, 2, {1, 22}},
+ {COLUMN_TRACEROUTECTLMAXROWS, ASN_UNSIGNED, RWRITE, var_traceRouteCtlTable, 2, {1, 23}},
+ {COLUMN_TRACEROUTECTLTRAPGENERATION, ASN_OCTET_STR, RWRITE, var_traceRouteCtlTable, 2, {1, 24}},
+ {COLUMN_TRACEROUTECTLCREATEHOPSENTRIES, ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 25}},
+ {COLUMN_TRACEROUTECTLTYPE, ASN_OBJECT_ID, RWRITE, var_traceRouteCtlTable, 2, {1, 26}},
+ {COLUMN_TRACEROUTECTLROWSTATUS, ASN_INTEGER, RWRITE, var_traceRouteCtlTable, 2, {1, 27}}
+
+};
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+
+struct header_complex_index *traceRouteCtlTableStorage = NULL;
+struct header_complex_index *traceRouteResultsTableStorage = NULL;
+struct header_complex_index *traceRouteProbeHistoryTableStorage = NULL;
+struct header_complex_index *traceRouteHopsTableStorage = NULL;
+
+void
+init_traceRouteCtlTable(void)
+{
+ DEBUGMSGTL(("traceRouteCtlTable", "initializing... "));
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("traceRouteCtlTable", traceRouteCtlTable_variables,
+ variable2, traceRouteCtlTable_variables_oid);
+
+ /*
+ * register our config handler(s) to deal with registrations
+ */
+ snmpd_register_config_handler("traceRouteCtlTable",
+ parse_traceRouteCtlTable, NULL, NULL);
+
+ /*
+ * we need to be called back later to store our data
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_traceRouteCtlTable, NULL);
+
+ DEBUGMSGTL(("traceRouteCtlTable", "done.\n"));
+}
+
+
+void
+init_trResultsTable(struct traceRouteCtlTable_data *item)
+{
+ struct traceRouteResultsTable_data *StorageTmp = NULL;
+ netsnmp_variable_list *vars = NULL;
+ char *host = NULL;
+
+ host =
+ (char *) malloc(sizeof(char) *
+ (item->traceRouteCtlTargetAddressLen + 1));
+
+ if (host == NULL) {
+ DEBUGMSGTL(("traceRouteCtlTable", "host calloc %s\n",
+ strerror(errno)));
+ exit(1);
+ }
+
+ bzero(host, sizeof(char) * (item->traceRouteCtlTargetAddressLen + 1));
+ strcpy(host, item->traceRouteCtlTargetAddress);
+ host[item->traceRouteCtlTargetAddressLen] = '\0';
+
+ StorageTmp = SNMP_MALLOC_STRUCT(traceRouteResultsTable_data);
+ if (StorageTmp == NULL) {
+ DEBUGMSGTL(("traceRouteCtlTable", "StorageTmp malloc %s\n",
+ strerror(errno)));
+ exit(1);
+ }
+
+ StorageTmp->traceRouteCtlOwnerIndex =
+ (char *) malloc(sizeof(char) *
+ (item->traceRouteCtlOwnerIndexLen + 1));
+ if (StorageTmp->traceRouteCtlOwnerIndex == NULL) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "traceRouteCtlOwnerIndex malloc %s\n",
+ strerror(errno)));
+ exit(1);
+ }
+
+ memcpy(StorageTmp->traceRouteCtlOwnerIndex,
+ item->traceRouteCtlOwnerIndex,
+ item->traceRouteCtlOwnerIndexLen + 1);
+ StorageTmp->traceRouteCtlOwnerIndex[item->traceRouteCtlOwnerIndexLen] =
+ '\0';
+ StorageTmp->traceRouteCtlOwnerIndexLen =
+ item->traceRouteCtlOwnerIndexLen;
+
+ StorageTmp->traceRouteCtlTestName =
+ (char *) malloc(sizeof(char) *
+ (item->traceRouteCtlTestNameLen + 1));
+ if (StorageTmp->traceRouteCtlTestName == NULL) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "traceRouteCtlTestName malloc %s\n", strerror(errno)));
+ exit(1);
+ }
+
+ memcpy(StorageTmp->traceRouteCtlTestName, item->traceRouteCtlTestName,
+ item->traceRouteCtlTestNameLen + 1);
+ StorageTmp->traceRouteCtlTestName[item->traceRouteCtlTestNameLen] =
+ '\0';
+ StorageTmp->traceRouteCtlTestNameLen = item->traceRouteCtlTestNameLen;
+
+ StorageTmp->traceRouteResultsOperStatus = 1;
+
+ if (item->traceRouteCtlTargetAddressType == 1
+ || item->traceRouteCtlTargetAddressType == 16) {
+ struct sockaddr whereto; /* Who to try to reach */
+ register struct sockaddr_in *to = (struct sockaddr_in *) &whereto;
+ register struct hostinfo *hi = NULL;
+ hi = gethostinfo(host);
+ if (hi == NULL) {
+ DEBUGMSGTL(("traceRouteCtlTable", "hi calloc %s\n",
+ strerror(errno)));
+ exit(1);
+ }
+
+ setsin(to, hi->addrs[0]);
+ if (inet_ntoa(to->sin_addr) == NULL) {
+ StorageTmp->traceRouteResultsIpTgtAddrType = 0;
+ StorageTmp->traceRouteResultsIpTgtAddr = strdup("");
+ StorageTmp->traceRouteResultsIpTgtAddrLen = 0;
+ } else {
+ StorageTmp->traceRouteResultsIpTgtAddrType = 1;
+ StorageTmp->traceRouteResultsIpTgtAddr =
+ (char *) malloc(sizeof(char) *
+ (strlen(inet_ntoa(to->sin_addr)) + 1));
+ if (StorageTmp->traceRouteResultsIpTgtAddr == NULL) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "traceRouteResultsIpTgtAddr malloc %s\n",
+ strerror(errno)));
+ exit(1);
+ }
+
+ memcpy(StorageTmp->traceRouteResultsIpTgtAddr,
+ inet_ntoa(to->sin_addr),
+ strlen(inet_ntoa(to->sin_addr)) + 1);
+ StorageTmp->
+ traceRouteResultsIpTgtAddr[strlen(inet_ntoa(to->sin_addr))]
+ = '\0';
+ StorageTmp->traceRouteResultsIpTgtAddrLen =
+ strlen(inet_ntoa(to->sin_addr));
+ }
+ }
+ if (item->traceRouteCtlTargetAddressType == 2) {
+
+ struct sockaddr_in6 whereto; /* Who to try to reach */
+ register struct sockaddr_in6 *to =
+ (struct sockaddr_in6 *) &whereto;
+ struct hostent *hp = NULL;
+ /* struct hostenv hp; */
+ char pa[64];
+ bzero(pa, 64);
+
+ to->sin6_family = AF_INET6;
+ to->sin6_port = htons(33434);
+
+ if (inet_pton(AF_INET6, host, &to->sin6_addr) > 0) {
+ StorageTmp->traceRouteResultsIpTgtAddrType = 2;
+ StorageTmp->traceRouteResultsIpTgtAddr =
+ (char *) malloc(sizeof(char) * (strlen(host) + 1));
+ if (StorageTmp->traceRouteResultsIpTgtAddr == NULL) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "traceRouteResultsIpTgtAddr malloc %s\n",
+ strerror(errno)));
+ exit(1);
+ }
+ bzero(StorageTmp->traceRouteResultsIpTgtAddr,
+ sizeof(char) * (strlen(host) + 1));
+ memcpy(StorageTmp->traceRouteResultsIpTgtAddr, host,
+ strlen(host) + 1);
+ StorageTmp->traceRouteResultsIpTgtAddr[strlen(host)] = '\0';
+ StorageTmp->traceRouteResultsIpTgtAddrLen = strlen(host);
+ } else {
+ hp = gethostbyname2(host, AF_INET6);
+ if (hp != NULL) {
+ const char *hostname;
+ memmove((caddr_t) & to->sin6_addr, hp->h_addr, 16);
+ hostname = inet_ntop(AF_INET6, &to->sin6_addr, pa, 64);
+ StorageTmp->traceRouteResultsIpTgtAddrType = 2;
+ StorageTmp->traceRouteResultsIpTgtAddr =
+ (char *) malloc(sizeof(char) * (strlen(hostname) + 1));
+ if (StorageTmp->traceRouteResultsIpTgtAddr == NULL) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "traceRouteResultsIpTgtAddr malloc %s\n",
+ strerror(errno)));
+ exit(1);
+ }
+ bzero(StorageTmp->traceRouteResultsIpTgtAddr,
+ sizeof(char) * (strlen(host) + 1));
+ memcpy(StorageTmp->traceRouteResultsIpTgtAddr, hostname,
+ strlen(hostname) + 1);
+ StorageTmp->traceRouteResultsIpTgtAddr[strlen(hostname)] =
+ '\0';
+ StorageTmp->traceRouteResultsIpTgtAddrLen =
+ strlen(hostname);
+ } else {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "traceroute: unknown host %s\n", host));
+
+ StorageTmp->traceRouteResultsIpTgtAddrType = 0;
+ StorageTmp->traceRouteResultsIpTgtAddr = strdup("");
+ StorageTmp->traceRouteResultsIpTgtAddrLen = 0;
+ }
+ }
+ }
+
+ StorageTmp->traceRouteResultsCurHopCount = 0;
+ StorageTmp->traceRouteResultsCurProbeCount = 0;
+ StorageTmp->traceRouteResultsTestAttempts = 0;
+ StorageTmp->traceRouteResultsTestSuccesses = 0;
+
+ StorageTmp->traceRouteResultsLastGoodPath = strdup("");
+ StorageTmp->traceRouteResultsLastGoodPathLen = 0;
+
+ item->traceRouteResults = StorageTmp;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlOwnerIndex, item->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlTestName, item->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+ if ((header_complex_get(traceRouteResultsTableStorage, vars)) != NULL) {
+ traceRouteResultsTable_del(item);
+ }
+ snmp_free_varbind(vars);
+ vars = NULL;
+ if (item->traceRouteResults != NULL) {
+ if (traceRouteResultsTable_add(item) != SNMPERR_SUCCESS) {
+ DEBUGMSGTL(("traceRouteResultsTable",
+ "init an entry error\n"));
+ }
+ }
+
+}
+
+
+
+int
+modify_trResultsOper(struct traceRouteCtlTable_data *thedata, long val)
+{
+ netsnmp_variable_list *vars = NULL;
+ struct traceRouteResultsTable_data *StorageTmp = NULL;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+
+ if ((StorageTmp =
+ header_complex_get(traceRouteResultsTableStorage,
+ vars)) == NULL) {
+ snmp_free_varbind(vars);
+ vars = NULL;
+ return SNMP_ERR_NOSUCHNAME;
+ } else {
+ StorageTmp->traceRouteResultsOperStatus = val;
+ DEBUGMSGTL(("traceRouteResultsOperStatus", "done.\n"));
+ snmp_free_varbind(vars);
+ vars = NULL;
+ return SNMPERR_SUCCESS;
+ }
+}
+
+
+struct traceRouteCtlTable_data *
+create_traceRouteCtlTable_data(void)
+{
+ struct traceRouteCtlTable_data *StorageNew = NULL;
+ StorageNew = SNMP_MALLOC_STRUCT(traceRouteCtlTable_data);
+ if (StorageNew == NULL) {
+ exit(1);
+ }
+ StorageNew->traceRouteCtlTargetAddressType = 1;
+ StorageNew->traceRouteCtlTargetAddress = strdup("");
+ StorageNew->traceRouteCtlTargetAddressLen = 0;
+ StorageNew->traceRouteCtlByPassRouteTable = 2;
+ StorageNew->traceRouteCtlDataSize = 0;
+ StorageNew->traceRouteCtlTimeOut = 3;
+ StorageNew->traceRouteCtlProbesPerHop = 3;
+ StorageNew->traceRouteCtlPort = 33434;
+ StorageNew->traceRouteCtlMaxTtl = 30;
+ StorageNew->traceRouteCtlDSField = 0;
+ StorageNew->traceRouteCtlSourceAddressType = 0;
+ StorageNew->traceRouteCtlSourceAddress = strdup("");
+ StorageNew->traceRouteCtlSourceAddressLen = 0;
+ StorageNew->traceRouteCtlIfIndex = 0;
+ StorageNew->traceRouteCtlMiscOptions = strdup("");
+ StorageNew->traceRouteCtlMiscOptionsLen = 0;
+ StorageNew->traceRouteCtlMaxFailures = 5;
+ StorageNew->traceRouteCtlDontFragment = 2;
+ StorageNew->traceRouteCtlInitialTtl = 1;
+ StorageNew->traceRouteCtlFrequency = 0;
+ StorageNew->traceRouteCtlStorageType = ST_NONVOLATILE;
+ StorageNew->traceRouteCtlAdminStatus = 2;
+ StorageNew->traceRouteCtlDescr = (char *) malloc(strlen("00") + 1);
+ if (StorageNew->traceRouteCtlDescr == NULL) {
+ exit(1);
+ }
+ memcpy(StorageNew->traceRouteCtlDescr, "00", strlen("00") + 1);
+ StorageNew->traceRouteCtlDescr[strlen("00")] = '\0';
+ StorageNew->traceRouteCtlDescrLen =
+ strlen(StorageNew->traceRouteCtlDescr);
+
+ StorageNew->traceRouteCtlMaxRows = 50;
+ StorageNew->traceRouteCtlTrapGeneration = strdup("");
+ StorageNew->traceRouteCtlTrapGenerationLen = 0;
+ StorageNew->traceRouteCtlCreateHopsEntries = 2;
+
+ StorageNew->traceRouteCtlType = calloc(1, sizeof(oid) * sizeof(2)); /* 0.0 */
+ StorageNew->traceRouteCtlTypeLen = 2;
+
+ StorageNew->traceRouteResults = NULL;
+ StorageNew->traceRouteProbeHis = NULL;
+ StorageNew->traceRouteHops = NULL;
+
+ StorageNew->storageType = ST_NONVOLATILE;
+ /* StorageNew->traceRouteProbeHistoryMaxIndex=0; */
+ return StorageNew;
+}
+
+
+/*
+ * traceRouteCtlTable_add(): adds a structure node to our data set
+ */
+int
+traceRouteCtlTable_add(struct traceRouteCtlTable_data *thedata)
+{
+ netsnmp_variable_list *vars = NULL;
+
+
+ DEBUGMSGTL(("traceRouteCtlTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlOperationName */
+
+ if (header_complex_add_data(&traceRouteCtlTableStorage, vars, thedata)
+ == NULL) {
+ vars = NULL;
+ return SNMPERR_GENERR;
+ } else {
+
+ DEBUGMSGTL(("traceRouteCtlTable", "registered an entry\n"));
+
+
+ DEBUGMSGTL(("traceRouteCtlTable", "done.\n"));
+ vars = NULL;
+ return SNMPERR_SUCCESS;
+ }
+}
+
+int
+traceRouteResultsTable_add(struct traceRouteCtlTable_data *thedata)
+{
+ netsnmp_variable_list *vp = NULL;
+ netsnmp_variable_list *vars_list = NULL;
+ struct traceRouteResultsTable_data *p = NULL;
+ p = thedata->traceRouteResults;
+ if (thedata->traceRouteResults != NULL) {
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlOwnerIndex, p->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlTestName, p->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+ DEBUGMSGTL(("traceRouteResultsTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+ header_complex_add_data(&traceRouteResultsTableStorage, vars_list,
+ p);
+ DEBUGMSGTL(("traceRouteResultsTable", "out finished\n"));
+ vars_list = NULL;
+ DEBUGMSGTL(("traceRouteResultsTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+ } else {
+ vars_list = NULL;
+ DEBUGMSGTL(("traceRouteResultsTable", "error.\n"));
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+}
+
+
+int
+traceRouteProbeHistoryTable_add(struct traceRouteProbeHistoryTable_data
+ *thedata)
+{
+ netsnmp_variable_list *vars_list = NULL;
+ if (thedata != NULL) {
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteProbeHistoryIndex, sizeof(thedata->traceRouteProbeHistoryIndex)); /* traceRouteProbeHistoryIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteProbeHistoryHopIndex, sizeof(thedata->traceRouteProbeHistoryHopIndex)); /* traceRouteProbeHistoryHopIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteProbeHistoryProbeIndex, sizeof(thedata->traceRouteProbeHistoryProbeIndex)); /* traceRouteProbeHistoryProbeIndex */
+
+ DEBUGMSGTL(("traceRouteProbeHistoryTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+ if (header_complex_add_data
+ (&traceRouteProbeHistoryTableStorage, vars_list,
+ thedata) == NULL) {
+ vars_list = NULL;
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ DEBUGMSGTL(("traceRouteProbeHistoryTable", "out finished\n"));
+
+ vars_list = NULL;
+
+ DEBUGMSGTL(("traceRouteProbeHistoryTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+ }
+ } else {
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+}
+
+int
+traceRouteProbeHistoryTable_addall(struct traceRouteCtlTable_data *thedata)
+{
+ netsnmp_variable_list *vars_list = NULL;
+ struct traceRouteProbeHistoryTable_data *p = NULL;
+ p = thedata->traceRouteProbeHis;
+ if (thedata->traceRouteProbeHis != NULL)
+ do {
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlOwnerIndex, p->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlTestName, p->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &p->traceRouteProbeHistoryIndex, sizeof(p->traceRouteProbeHistoryIndex)); /* traceRouteProbeHistoryIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &p->traceRouteProbeHistoryHopIndex, sizeof(p->traceRouteProbeHistoryHopIndex)); /* traceRouteProbeHistoryHopIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &p->traceRouteProbeHistoryProbeIndex, sizeof(p->traceRouteProbeHistoryProbeIndex)); /* traceRouteProbeHistoryProbeIndex */
+
+ DEBUGMSGTL(("traceRouteProbeHistoryTable",
+ "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+ if (header_complex_add_data
+ (&traceRouteProbeHistoryTableStorage, vars_list,
+ p) == NULL) {
+ vars_list = NULL;
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+
+ struct header_complex_index *temp = NULL;
+ temp = traceRouteProbeHistoryTableStorage;
+ if (traceRouteProbeHistoryTableStorage != NULL)
+ do {
+ DEBUGMSGTL(("traceRouteProbeHistoryTable",
+ "adding data,vars_oid=%u\n ",
+ temp->name));
+ DEBUGMSGTL(("traceRouteProbeHistoryTable",
+ "adding data,vars_oid=%d\n ",
+ temp->namelen));
+ temp = temp->next;
+ } while (temp != NULL);
+
+ DEBUGMSGTL(("traceRouteProbeHistoryTable",
+ "out finished\n"));
+ DEBUGMSGTL(("traceRouteProbeHistoryTable", "done.\n"));
+ vars_list = NULL;
+ return SNMPERR_SUCCESS;
+ }
+
+ p = p->next;
+ } while (p != NULL);
+ else {
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+
+}
+
+
+
+int
+traceRouteHopsTable_add(struct traceRouteHopsTable_data *thedata)
+{
+ netsnmp_variable_list *vars_list = NULL;
+
+ if (thedata != NULL) {
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteHopsHopIndex, sizeof(thedata->traceRouteHopsHopIndex)); /* traceRouteHopsHopIndex */
+
+ DEBUGMSGTL(("traceRouteHopsTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+ if (header_complex_add_data
+ (&traceRouteHopsTableStorage, vars_list, thedata) == NULL) {
+ vars_list = NULL;
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ DEBUGMSGTL(("traceRouteHopsTable", "out finished\n"));
+ DEBUGMSGTL(("traceRouteHopsTable", "done.\n"));
+ vars_list = NULL;
+ return SNMPERR_SUCCESS;
+ }
+ }
+}
+
+int
+traceRouteHopsTable_addall(struct traceRouteCtlTable_data *thedata)
+{
+ netsnmp_variable_list *vars_list = NULL;
+ struct traceRouteHopsTable_data *p = NULL;
+ vars_list = NULL;
+ p = thedata->traceRouteHops;
+ if (thedata->traceRouteHops != NULL) {
+ do {
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlOwnerIndex, p->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) p->traceRouteCtlTestName, p->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &p->traceRouteHopsHopIndex, sizeof(p->traceRouteHopsHopIndex)); /* traceRouteHopsHopIndex */
+
+ DEBUGMSGTL(("traceRouteHopsTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+ if (header_complex_add_data
+ (&traceRouteHopsTableStorage, vars_list, p) == NULL) {
+ vars_list = NULL;
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+
+ struct header_complex_index *temp = NULL;
+ temp = traceRouteHopsTableStorage;
+ if (traceRouteHopsTableStorage != NULL)
+ do {
+ DEBUGMSGTL(("traceRouteProbeHistoryTable",
+ "adding data,vars_oid=%u\n ",
+ temp->name));
+ DEBUGMSGTL(("traceRouteProbeHistoryTable",
+ "adding data,vars_oid=%d\n ",
+ temp->namelen));
+ temp = temp->next;
+ } while (temp != NULL);
+ DEBUGMSGTL(("traceRouteHopsTable", "out finished\n"));
+
+ vars_list = NULL;
+ }
+ p = p->next;
+ } while (p != NULL);
+ DEBUGMSGTL(("traceRouteHopsTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+ } else {
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+
+}
+
+
+unsigned long
+traceRouteProbeHistoryTable_count(struct traceRouteCtlTable_data *thedata)
+{
+ struct header_complex_index *hciptr2 = NULL;
+ netsnmp_variable_list *vars = NULL;
+ oid newoid[MAX_OID_LEN];
+ size_t newoid_len;
+ unsigned long count = 0;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+
+ header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
+
+ vars = NULL;
+ for (hciptr2 = traceRouteProbeHistoryTableStorage; hciptr2 != NULL;
+ hciptr2 = hciptr2->next) {
+ if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
+ == 0) {
+ count = count + 1;
+ }
+ }
+ return count;
+}
+
+
+
+unsigned long
+traceRouteHopsTable_count(struct traceRouteCtlTable_data *thedata)
+{
+ struct header_complex_index *hciptr2 = NULL;
+ netsnmp_variable_list *vars = NULL;
+ oid newoid[MAX_OID_LEN];
+ size_t newoid_len;
+ unsigned long count = 0;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlOperationName */
+
+ header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
+
+ vars = NULL;
+ for (hciptr2 = traceRouteHopsTableStorage; hciptr2 != NULL;
+ hciptr2 = hciptr2->next) {
+ if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
+ == 0) {
+ count = count + 1;
+ }
+ }
+ return count;
+}
+
+
+
+int
+traceRouteProbeHistoryTable_delLast(struct traceRouteCtlTable_data
+ *thedata)
+{
+ struct traceRouteProbeHistoryTable_data *p = NULL;
+ struct header_complex_index *hciptr1 = NULL;
+ struct header_complex_index *hciptr2 = NULL;
+ struct header_complex_index *hcilast = NULL;
+ struct traceRouteProbeHistoryTable_data *StorageDel = NULL;
+ struct traceRouteProbeHistoryTable_data *StorageTmp = NULL;
+ netsnmp_variable_list *vars = NULL;
+ netsnmp_variable_list *vars_temp = NULL;
+ oid newoid[MAX_OID_LEN];
+ size_t newoid_len = 0;
+ time_t last_time = 2147483647;
+ struct tm *tp = NULL;
+
+ tp = (struct tm *) malloc(sizeof(struct tm));
+ if (tp == NULL) {
+ exit(1);
+ }
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlOperationName */
+
+ bzero(newoid, sizeof(oid) * MAX_OID_LEN);
+ header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
+
+ for (hcilast = hciptr2 = traceRouteProbeHistoryTableStorage;
+ hciptr2 != NULL; hciptr2 = hciptr2->next) {
+ if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
+ == 0) {
+
+ StorageTmp =
+ header_complex_get_from_oid
+ (traceRouteProbeHistoryTableStorage, hciptr2->name,
+ hciptr2->namelen);
+ strptime(StorageTmp->traceRouteProbeHistoryTime, "%c", tp);
+
+ if (last_time > timegm(tp)) {
+ last_time = timegm(tp);
+ hcilast = hciptr2;
+ }
+
+ }
+ }
+ StorageDel =
+ header_complex_extract_entry(&traceRouteProbeHistoryTableStorage,
+ hcilast);
+ DEBUGMSGTL(("traceRouteProbeHistoryTable",
+ "delete the last one success!\n"));
+ vars = NULL;
+ free(tp);
+ tp = NULL;
+}
+
+
+
+void
+traceRouteCtlTable_cleaner(struct header_complex_index *thestuff)
+{
+ struct header_complex_index *hciptr = NULL;
+ struct traceRouteCtlTable_data *StorageDel = NULL;
+ DEBUGMSGTL(("traceRouteCtlTable", "cleanerout "));
+ for (hciptr = thestuff; hciptr != NULL; hciptr = hciptr->next) {
+ StorageDel =
+ header_complex_extract_entry(&traceRouteCtlTableStorage,
+ hciptr);
+ if (StorageDel != NULL) {
+ free(StorageDel->traceRouteCtlOwnerIndex);
+ StorageDel->traceRouteCtlOwnerIndex = NULL;
+ free(StorageDel->traceRouteCtlTestName);
+ StorageDel->traceRouteCtlTestName = NULL;
+ free(StorageDel->traceRouteCtlTargetAddress);
+ StorageDel->traceRouteCtlTargetAddress = NULL;
+ free(StorageDel->traceRouteCtlSourceAddress);
+ StorageDel->traceRouteCtlSourceAddress = NULL;
+ free(StorageDel->traceRouteCtlMiscOptions);
+ StorageDel->traceRouteCtlMiscOptions = NULL;
+ free(StorageDel->traceRouteCtlDescr);
+ StorageDel->traceRouteCtlDescr = NULL;
+ free(StorageDel->traceRouteCtlTrapGeneration);
+ StorageDel->traceRouteCtlTrapGeneration = NULL;
+ free(StorageDel->traceRouteCtlType);
+ StorageDel->traceRouteCtlType = NULL;
+ free(StorageDel);
+ StorageDel = NULL;
+
+ }
+ DEBUGMSGTL(("traceRouteCtlTable", "cleaner "));
+ }
+}
+
+
+/*
+ * parse_mteObjectsTable():
+ * parses .conf file entries needed to configure the mib.
+ */
+void
+parse_traceRouteCtlTable(const char *token, char *line)
+{
+ size_t tmpint;
+ struct traceRouteCtlTable_data *StorageTmp =
+ SNMP_MALLOC_STRUCT(traceRouteCtlTable_data);
+
+ DEBUGMSGTL(("traceRouteCtlTable", "parsing config... "));
+
+
+ if (StorageTmp == NULL) {
+ config_perror("malloc failure");
+ return;
+ }
+
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteCtlOwnerIndex,
+ &StorageTmp->traceRouteCtlOwnerIndexLen);
+ if (StorageTmp->traceRouteCtlOwnerIndex == NULL) {
+ config_perror("invalid specification for traceRouteCtlOwnerIndex");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteCtlTestName,
+ &StorageTmp->traceRouteCtlTestNameLen);
+ if (StorageTmp->traceRouteCtlTestName == NULL) {
+ config_perror("invalid specification for traceRouteCtlTestName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->traceRouteCtlTargetAddressType,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteCtlTargetAddress,
+ &StorageTmp->traceRouteCtlTargetAddressLen);
+ if (StorageTmp->traceRouteCtlTargetAddress == NULL) {
+ config_perror
+ ("invalid specification for traceRouteCtlTargetAddress");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->traceRouteCtlByPassRouteTable,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteCtlDataSize, &tmpint);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteCtlTimeOut, &tmpint);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteCtlProbesPerHop,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteCtlPort, &tmpint);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteCtlMaxTtl, &tmpint);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteCtlDSField, &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->traceRouteCtlSourceAddressType,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteCtlSourceAddress,
+ &StorageTmp->traceRouteCtlSourceAddressLen);
+ if (StorageTmp->traceRouteCtlSourceAddress == NULL) {
+ config_perror
+ ("invalid specification for traceRouteCtlSourceAddress");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->traceRouteCtlIfIndex, &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteCtlMiscOptions,
+ &StorageTmp->traceRouteCtlMiscOptionsLen);
+ if (StorageTmp->traceRouteCtlMiscOptions == NULL) {
+ config_perror
+ ("invalid specification for traceRouteCtlMiscOptions");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteCtlMaxFailures,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->traceRouteCtlDontFragment,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteCtlInitialTtl,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteCtlFrequency,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->traceRouteCtlStorageType,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->traceRouteCtlAdminStatus,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteCtlDescr,
+ &StorageTmp->traceRouteCtlDescrLen);
+ if (StorageTmp->traceRouteCtlDescr == NULL) {
+ config_perror("invalid specification for traceRouteCtlTrapDescr");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteCtlMaxRows, &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteCtlTrapGeneration,
+ &StorageTmp->traceRouteCtlTrapGenerationLen);
+ if (StorageTmp->traceRouteCtlTrapGeneration == NULL) {
+ config_perror
+ ("invalid specification for traceRouteCtlTrapGeneration");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->traceRouteCtlCreateHopsEntries,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_OBJECT_ID, line,
+ &StorageTmp->traceRouteCtlType,
+ &StorageTmp->traceRouteCtlTypeLen);
+ if (StorageTmp->traceRouteCtlType == NULL) {
+ config_perror("invalid specification for traceRouteCtlType");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->traceRouteCtlRowStatus,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteProbeHistoryMaxIndex,
+ &tmpint);
+
+ StorageTmp->storageType = ST_NONVOLATILE;
+ traceRouteCtlTable_add(StorageTmp);
+ /* traceRouteCtlTable_cleaner(traceRouteCtlTableStorage); */
+
+ DEBUGMSGTL(("traceRouteCtlTable", "done.\n"));
+}
+
+
+
+/*
+ * store_traceRouteCtlTable():
+ * stores .conf file entries needed to configure the mib.
+ */
+int
+store_traceRouteCtlTable(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr = NULL;
+ size_t tmpint;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ struct header_complex_index *hcindex = NULL;
+
+
+ DEBUGMSGTL(("traceRouteCtlTable", "storing data... "));
+
+
+ for (hcindex = traceRouteCtlTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ StorageTmp = (struct traceRouteCtlTable_data *) hcindex->data;
+
+ if (StorageTmp->storageType != ST_READONLY) {
+ memset(line, 0, sizeof(line));
+ strcat(line, "traceRouteCtlTable ");
+ cptr = line + strlen(line);
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ traceRouteCtlOwnerIndex,
+ &StorageTmp->
+ traceRouteCtlOwnerIndexLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->traceRouteCtlTestName,
+ &StorageTmp->
+ traceRouteCtlTestNameLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ traceRouteCtlTargetAddressType,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ traceRouteCtlTargetAddress,
+ &StorageTmp->
+ traceRouteCtlTargetAddressLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ traceRouteCtlByPassRouteTable,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->traceRouteCtlDataSize,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->traceRouteCtlTimeOut,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ traceRouteCtlProbesPerHop, &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->traceRouteCtlPort,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->traceRouteCtlMaxTtl,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->traceRouteCtlDSField,
+ &tmpint);
+
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ traceRouteCtlSourceAddressType,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ traceRouteCtlSourceAddress,
+ &StorageTmp->
+ traceRouteCtlSourceAddressLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->traceRouteCtlIfIndex,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ traceRouteCtlMiscOptions,
+ &StorageTmp->
+ traceRouteCtlMiscOptionsLen);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ traceRouteCtlMaxFailures, &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ traceRouteCtlDontFragment, &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ traceRouteCtlInitialTtl, &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->traceRouteCtlFrequency,
+ &tmpint);
+
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ traceRouteCtlStorageType, &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ traceRouteCtlAdminStatus, &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->traceRouteCtlDescr,
+ &StorageTmp->traceRouteCtlDescrLen);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->traceRouteCtlMaxRows,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ traceRouteCtlTrapGeneration,
+ &StorageTmp->
+ traceRouteCtlTrapGenerationLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ traceRouteCtlCreateHopsEntries,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OBJECT_ID, cptr,
+ &StorageTmp->traceRouteCtlType,
+ &StorageTmp->traceRouteCtlTypeLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->traceRouteCtlRowStatus,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ traceRouteProbeHistoryMaxIndex,
+ &tmpint);
+
+
+
+ snmpd_store_config(line);
+ }
+ }
+ DEBUGMSGTL(("traceRouteCtlTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+
+
+/*
+ * var_traceRouteCtlTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_mteObjectsTable above.
+ */
+unsigned char *
+var_traceRouteCtlTable(struct variable *vp,
+ oid * name,
+ size_t *length,
+ int exact,
+ size_t *var_len, WriteMethod ** write_method)
+{
+
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, vp, name, length, exact,
+ var_len, write_method)) == NULL) {
+ if (vp->magic == COLUMN_TRACEROUTECTLROWSTATUS)
+ *write_method = write_traceRouteCtlRowStatus;
+
+ return NULL;
+ }
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+
+
+ case COLUMN_TRACEROUTECTLTARGETADDRESSTYPE:
+ *write_method = write_traceRouteCtlTargetAddressType;
+ *var_len = sizeof(StorageTmp->traceRouteCtlTargetAddressType);
+
+ return (u_char *) & StorageTmp->traceRouteCtlTargetAddressType;
+
+ case COLUMN_TRACEROUTECTLTARGETADDRESS:
+ *write_method = write_traceRouteCtlTargetAddress;
+ *var_len = (StorageTmp->traceRouteCtlTargetAddressLen);
+
+ return (u_char *) StorageTmp->traceRouteCtlTargetAddress;
+
+ case COLUMN_TRACEROUTECTLBYPASSROUTETABLE:
+ *write_method = write_traceRouteCtlByPassRouteTable;
+ *var_len = sizeof(StorageTmp->traceRouteCtlByPassRouteTable);
+
+ return (u_char *) & StorageTmp->traceRouteCtlByPassRouteTable;
+
+ case COLUMN_TRACEROUTECTLDATASIZE:
+ *write_method = write_traceRouteCtlDataSize;
+ *var_len = sizeof(StorageTmp->traceRouteCtlDataSize);
+
+ return (u_char *) & StorageTmp->traceRouteCtlDataSize;
+
+ case COLUMN_TRACEROUTECTLTIMEOUT:
+ *write_method = write_traceRouteCtlTimeOut;
+ *var_len = sizeof(StorageTmp->traceRouteCtlTimeOut);
+
+ return (u_char *) & StorageTmp->traceRouteCtlTimeOut;
+
+ case COLUMN_TRACEROUTECTLPROBESPERHOP:
+ *write_method = write_traceRouteCtlProbesPerHop;
+ *var_len = sizeof(StorageTmp->traceRouteCtlProbesPerHop);
+
+ return (u_char *) & StorageTmp->traceRouteCtlProbesPerHop;
+
+ case COLUMN_TRACEROUTECTLPORT:
+ *write_method = write_traceRouteCtlPort;
+ *var_len = sizeof(StorageTmp->traceRouteCtlPort);
+
+ return (u_char *) & StorageTmp->traceRouteCtlPort;
+
+ case COLUMN_TRACEROUTECTLMAXTTL:
+ *write_method = write_traceRouteCtlMaxTtl;
+ *var_len = sizeof(StorageTmp->traceRouteCtlMaxTtl);
+
+ return (u_char *) & StorageTmp->traceRouteCtlMaxTtl;
+
+ case COLUMN_TRACEROUTECTLDSFIELD:
+ *write_method = write_traceRouteCtlDSField;
+ *var_len = sizeof(StorageTmp->traceRouteCtlDSField);
+
+ return (u_char *) & StorageTmp->traceRouteCtlDSField;
+
+ case COLUMN_TRACEROUTECTLSOURCEADDRESSTYPE:
+ *write_method = write_traceRouteCtlSourceAddressType;
+ *var_len = sizeof(StorageTmp->traceRouteCtlSourceAddressType);
+
+ return (u_char *) & StorageTmp->traceRouteCtlSourceAddressType;
+
+ case COLUMN_TRACEROUTECTLSOURCEADDRESS:
+ *write_method = write_traceRouteCtlSourceAddress;
+ *var_len = (StorageTmp->traceRouteCtlSourceAddressLen);
+
+ return (u_char *) StorageTmp->traceRouteCtlSourceAddress;
+
+ case COLUMN_TRACEROUTECTLIFINDEX:
+ *write_method = write_traceRouteCtlIfIndex;
+ *var_len = sizeof(StorageTmp->traceRouteCtlIfIndex);
+
+ return (u_char *) & StorageTmp->traceRouteCtlIfIndex;
+
+ case COLUMN_TRACEROUTECTLMISCOPTIONS:
+ *write_method = write_traceRouteCtlMiscOptions;
+ *var_len = (StorageTmp->traceRouteCtlMiscOptionsLen);
+
+ return (u_char *) StorageTmp->traceRouteCtlMiscOptions;
+
+ case COLUMN_TRACEROUTECTLMAXFAILURES:
+ *write_method = write_traceRouteCtlMaxFailures;
+ *var_len = sizeof(StorageTmp->traceRouteCtlMaxFailures);
+
+ return (u_char *) & StorageTmp->traceRouteCtlMaxFailures;
+
+ case COLUMN_TRACEROUTECTLDONTFRAGMENT:
+ *write_method = write_traceRouteCtlDontFragment;
+ *var_len = sizeof(StorageTmp->traceRouteCtlDontFragment);
+
+ return (u_char *) & StorageTmp->traceRouteCtlDontFragment;
+
+ case COLUMN_TRACEROUTECTLINITIALTTL:
+ *write_method = write_traceRouteCtlInitialTtl;
+ *var_len = sizeof(StorageTmp->traceRouteCtlInitialTtl);
+
+ return (u_char *) & StorageTmp->traceRouteCtlInitialTtl;
+
+ case COLUMN_TRACEROUTECTLFREQUENCY:
+ *write_method = write_traceRouteCtlFrequency;
+ *var_len = sizeof(StorageTmp->traceRouteCtlFrequency);
+
+ return (u_char *) & StorageTmp->traceRouteCtlFrequency;
+
+ case COLUMN_TRACEROUTECTLSTORAGETYPE:
+ *write_method = write_traceRouteCtlStorageType;
+ *var_len = sizeof(StorageTmp->traceRouteCtlStorageType);
+
+ return (u_char *) & StorageTmp->traceRouteCtlStorageType;
+
+ case COLUMN_TRACEROUTECTLADMINSTATUS:
+ *write_method = write_traceRouteCtlAdminStatus;
+ *var_len = sizeof(StorageTmp->traceRouteCtlAdminStatus);
+
+ return (u_char *) & StorageTmp->traceRouteCtlAdminStatus;
+
+ case COLUMN_TRACEROUTECTLDESCR:
+ *write_method = write_traceRouteCtlDescr;
+ *var_len = (StorageTmp->traceRouteCtlDescrLen);
+
+ return (u_char *) StorageTmp->traceRouteCtlDescr;
+
+ case COLUMN_TRACEROUTECTLMAXROWS:
+ *write_method = write_traceRouteCtlMaxRows;
+ *var_len = sizeof(StorageTmp->traceRouteCtlMaxRows);
+
+ return (u_char *) & StorageTmp->traceRouteCtlMaxRows;
+
+ case COLUMN_TRACEROUTECTLTRAPGENERATION:
+ *write_method = write_traceRouteCtlTrapGeneration;
+ *var_len = (StorageTmp->traceRouteCtlTrapGenerationLen);
+
+ return (u_char *) StorageTmp->traceRouteCtlTrapGeneration;
+
+ case COLUMN_TRACEROUTECTLCREATEHOPSENTRIES:
+ *write_method = write_traceRouteCtlCreateHopsEntries;
+ *var_len = sizeof(StorageTmp->traceRouteCtlCreateHopsEntries);
+
+ return (u_char *) & StorageTmp->traceRouteCtlCreateHopsEntries;
+
+ case COLUMN_TRACEROUTECTLTYPE:
+ *write_method = write_traceRouteCtlType;
+ *var_len = (StorageTmp->traceRouteCtlTypeLen) * sizeof(oid);
+
+ return (u_char *) StorageTmp->traceRouteCtlType;
+
+ case COLUMN_TRACEROUTECTLROWSTATUS:
+ *write_method = write_traceRouteCtlRowStatus;
+ *var_len = sizeof(StorageTmp->traceRouteCtlRowStatus);
+
+ return (u_char *) & StorageTmp->traceRouteCtlRowStatus;
+
+ default:
+ ERROR_MSG("");
+ }
+ return NULL;
+}
+
+
+
+int
+traceRouteResultsTable_del(struct traceRouteCtlTable_data *thedata)
+{
+ struct header_complex_index *hciptr2 = NULL;
+ struct traceRouteResultsTable_data *StorageDel = NULL;
+ netsnmp_variable_list *vars = NULL;
+ oid newoid[MAX_OID_LEN];
+ size_t newoid_len = 0;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+
+ bzero(newoid, sizeof(oid) * MAX_OID_LEN);
+ header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
+
+ for (hciptr2 = traceRouteResultsTableStorage; hciptr2 != NULL;
+ hciptr2 = hciptr2->next) {
+ if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
+ == 0) {
+ StorageDel =
+ header_complex_extract_entry
+ (&traceRouteResultsTableStorage, hciptr2);
+ DEBUGMSGTL(("traceRouteResultsTable", "delete success!\n"));
+
+ }
+ }
+ vars = NULL;
+ return SNMPERR_SUCCESS;
+}
+
+
+
+
+int
+traceRouteProbeHistoryTable_del(struct traceRouteCtlTable_data *thedata)
+{
+ struct header_complex_index *hciptr2 = NULL;
+ struct traceRouteProbeHistoryTable_data *StorageDel = NULL;
+ netsnmp_variable_list *vars = NULL;
+ netsnmp_variable_list *vars_temp = NULL;
+ oid newoid[MAX_OID_LEN];
+ size_t newoid_len = 0;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlOperationName */
+
+ bzero(newoid, sizeof(oid) * MAX_OID_LEN);
+
+ header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
+
+ for (hciptr2 = traceRouteProbeHistoryTableStorage; hciptr2 != NULL;
+ hciptr2 = hciptr2->next) {
+ if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
+ == 0) {
+ StorageDel =
+ header_complex_extract_entry
+ (&traceRouteProbeHistoryTableStorage, hciptr2);
+ DEBUGMSGTL(("traceRouteProbeHistoryTable",
+ "delete success!\n"));
+
+ }
+ }
+ vars = NULL;
+ return SNMPERR_SUCCESS;
+}
+
+
+
+
+
+int
+traceRouteHopsTable_del(struct traceRouteCtlTable_data *thedata)
+{
+ struct header_complex_index *hciptr2 = NULL;
+ struct traceRouteHopsTable_data *StorageDel = NULL;
+ netsnmp_variable_list *vars = NULL;
+ netsnmp_variable_list *vars_temp = NULL;
+ oid newoid[MAX_OID_LEN];
+ size_t newoid_len = 0;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+
+ bzero(newoid, sizeof(oid) * MAX_OID_LEN);
+
+ header_complex_generate_oid(newoid, &newoid_len, NULL, 0, vars);
+
+ for (hciptr2 = traceRouteHopsTableStorage; hciptr2 != NULL;
+ hciptr2 = hciptr2->next) {
+ if (snmp_oid_compare(newoid, newoid_len, hciptr2->name, newoid_len)
+ == 0) {
+ StorageDel =
+ header_complex_extract_entry(&traceRouteHopsTableStorage,
+ hciptr2);
+ DEBUGMSGTL(("traceRouteHopsTable", "delete success!\n"));
+
+ }
+ }
+ vars = NULL;
+ return SNMPERR_SUCCESS;
+}
+
+/*
+ * send trap
+ */
+
+int
+send_traceRoute_trap(struct traceRouteCtlTable_data *item,
+ oid * trap_oid, size_t trap_oid_len)
+{
+ static oid objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 }; /* snmpTrapIOD.0 */
+ struct traceRouteResultsTable_data *StorageTmp = NULL;
+ struct traceRouteHopsTable_data *StorageHops = NULL;
+ netsnmp_variable_list *var_list = NULL;
+ netsnmp_variable_list *vars = NULL;
+ netsnmp_variable_list *var_hops = NULL;
+ oid newoid[MAX_OID_LEN];
+ size_t newoid_len = 0;
+
+ oid indexoid[MAX_OID_LEN];
+ size_t indexoid_len = 0;
+
+ struct header_complex_index *hciptr;
+ oid tempoid[MAX_OID_LEN];
+ size_t tempoid_len = 0;
+
+ oid traceRouteCtlTargetAddress[] =
+ { 1, 3, 6, 1, 2, 1, 81, 1, 2, 1, 4 };
+ oid traceRouteHopsIpTgAddress[] =
+ { 1, 3, 6, 1, 2, 1, 81, 1, 5, 1, 3 };
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlOwnerIndex, item->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlTestName, item->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+
+ /*
+ * snmpTrap oid
+ */
+ snmp_varlist_add_variable(&var_list, objid_snmptrap,
+ sizeof(objid_snmptrap) / sizeof(oid),
+ ASN_OBJECT_ID, (u_char *) trap_oid,
+ trap_oid_len * sizeof(oid));
+
+ /*
+ * traceRouteCtlTargetAddress
+ */
+ bzero(newoid, MAX_OID_LEN * sizeof(oid));
+ header_complex_generate_oid(newoid, &newoid_len,
+ traceRouteCtlTargetAddress,
+ sizeof(traceRouteCtlTargetAddress) /
+ sizeof(oid), vars);
+
+ snmp_varlist_add_variable(&var_list, newoid,
+ newoid_len,
+ ASN_OCTET_STR,
+ (u_char *) item->traceRouteCtlTargetAddress,
+ item->traceRouteCtlTargetAddressLen);
+
+ for (hciptr = traceRouteHopsTableStorage; hciptr != NULL;
+ hciptr = hciptr->next) {
+ bzero(indexoid, MAX_OID_LEN * sizeof(oid));
+ header_complex_generate_oid(indexoid, &indexoid_len, NULL, 0,
+ vars);
+ if (snmp_oid_compare
+ (indexoid, indexoid_len, hciptr->name, indexoid_len) == 0) {
+ StorageHops =
+ (struct traceRouteHopsTable_data *)
+ header_complex_get_from_oid(traceRouteHopsTableStorage,
+ hciptr->name, hciptr->namelen);
+ bzero(tempoid, MAX_OID_LEN * sizeof(oid));
+ header_complex_generate_oid(tempoid, &tempoid_len,
+ traceRouteHopsIpTgAddress,
+ sizeof(traceRouteHopsIpTgAddress) /
+ sizeof(oid), vars);
+ snmp_varlist_add_variable(&var_hops, NULL, 0, ASN_UNSIGNED, (char *) &StorageHops->traceRouteHopsHopIndex, sizeof(StorageHops->traceRouteHopsHopIndex)); /* traceRouteCtlTestName */
+ bzero(newoid, MAX_OID_LEN * sizeof(oid));
+ header_complex_generate_oid(newoid, &newoid_len, tempoid,
+ tempoid_len, var_hops);
+ snmp_varlist_add_variable(&var_list, newoid, newoid_len,
+ ASN_OCTET_STR,
+ (u_char *) StorageHops->
+ traceRouteHopsIpTgtAddress,
+ StorageHops->
+ traceRouteHopsIpTgtAddressLen);
+
+ var_hops = NULL;
+ }
+ }
+
+ /*
+ * XXX: stuff based on event table
+ */
+
+ DEBUGMSG(("pingTest:send_ping_trap", "success!\n"));
+
+ send_v2trap(var_list);
+ snmp_free_varbind(vars);
+ vars = NULL;
+ snmp_free_varbind(var_list);
+ var_list = NULL;
+}
+
+
+int
+write_traceRouteCtlTargetAddressType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name,
+ size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlTargetAddressType not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlTargetAddressType;
+ StorageTmp->traceRouteCtlTargetAddressType = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlTargetAddressType = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_traceRouteCtlTargetAddress(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name,
+ size_t name_len)
+{
+ static char *tmpvar;
+ static size_t tmplen;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlTargetAddress not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlTargetAddress;
+ tmplen = StorageTmp->traceRouteCtlTargetAddressLen;
+
+ StorageTmp->traceRouteCtlTargetAddress =
+ (char *) malloc(var_val_len + 1);
+ if (StorageTmp->traceRouteCtlTargetAddress == NULL) {
+ exit(1);
+ }
+ memcpy(StorageTmp->traceRouteCtlTargetAddress, var_val,
+ var_val_len);
+ StorageTmp->traceRouteCtlTargetAddress[var_val_len] = '\0';
+ StorageTmp->traceRouteCtlTargetAddressLen = var_val_len;
+
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->traceRouteCtlTargetAddress);
+ StorageTmp->traceRouteCtlTargetAddress = NULL;
+
+ StorageTmp->traceRouteCtlTargetAddress = tmpvar;
+ StorageTmp->traceRouteCtlTargetAddressLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ tmpvar = NULL;
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_traceRouteCtlByPassRouteTable(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name,
+ size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlTargetAddressType not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlByPassRouteTable;
+ StorageTmp->traceRouteCtlByPassRouteTable = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlByPassRouteTable = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+
+}
+
+int
+write_traceRouteCtlDataSize(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlDataSize not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlDataSize;
+ if ((*((long *) var_val)) >= 0 && (*((long *) var_val)) <= 65507)
+ StorageTmp->traceRouteCtlDataSize = *((long *) var_val);
+ else
+ StorageTmp->traceRouteCtlDataSize = 56;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlDataSize = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+int
+write_traceRouteCtlTimeOut(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlDataSize not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlTimeOut;
+
+ if ((*((long *) var_val)) >= 1 && (*((long *) var_val)) <= 60)
+ StorageTmp->traceRouteCtlTimeOut = *((long *) var_val);
+ else
+ StorageTmp->traceRouteCtlTimeOut = 3;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlTimeOut = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+
+int
+write_traceRouteCtlProbesPerHop(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name,
+ size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlDataSize not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlProbesPerHop;
+
+ if ((*((long *) var_val)) >= 1 && (*((long *) var_val)) <= 10)
+ StorageTmp->traceRouteCtlProbesPerHop = *((long *) var_val);
+ else
+ StorageTmp->traceRouteCtlProbesPerHop = 3;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlProbesPerHop = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_traceRouteCtlPort(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlTargetAddressType not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlPort;
+ StorageTmp->traceRouteCtlPort = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlPort = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+int
+write_traceRouteCtlMaxTtl(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlDataSize not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlMaxTtl;
+ if ((*((long *) var_val)) >= 1 && (*((long *) var_val)) <= 255)
+ StorageTmp->traceRouteCtlMaxTtl = *((long *) var_val);
+ else
+ StorageTmp->traceRouteCtlMaxTtl = 30;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlMaxTtl = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+write_traceRouteCtlDSField(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlDataSize not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlDSField;
+ StorageTmp->traceRouteCtlDSField = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlDSField = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_traceRouteCtlSourceAddressType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name,
+ size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlMaxRows not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlSourceAddressType;
+ StorageTmp->traceRouteCtlSourceAddressType = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlSourceAddressType = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_traceRouteCtlSourceAddress(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name,
+ size_t name_len)
+{
+ static char *tmpvar;
+ static size_t tmplen;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlTargetAddress not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlSourceAddress;
+ tmplen = StorageTmp->traceRouteCtlSourceAddressLen;
+ StorageTmp->traceRouteCtlSourceAddress =
+ (char *) malloc(var_val_len + 1);
+ if (StorageTmp->traceRouteCtlSourceAddress == NULL) {
+ exit(1);
+ }
+ memcpy(StorageTmp->traceRouteCtlSourceAddress, var_val,
+ var_val_len + 1);
+ StorageTmp->traceRouteCtlSourceAddress[var_val_len] = '\0';
+ StorageTmp->traceRouteCtlSourceAddressLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->traceRouteCtlSourceAddress);
+ StorageTmp->traceRouteCtlSourceAddress = NULL;
+ StorageTmp->traceRouteCtlSourceAddress = tmpvar;
+ StorageTmp->traceRouteCtlSourceAddressLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ tmpvar = NULL;
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+int
+write_traceRouteCtlIfIndex(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlMaxRows not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlIfIndex;
+ StorageTmp->traceRouteCtlIfIndex = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlIfIndex = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_traceRouteCtlMiscOptions(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ static size_t tmplen;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlTargetAddress not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlMiscOptions;
+ tmplen = StorageTmp->traceRouteCtlMiscOptionsLen;
+ StorageTmp->traceRouteCtlMiscOptions =
+ (char *) malloc(var_val_len + 1);
+ if (StorageTmp->traceRouteCtlMiscOptions == NULL) {
+ exit(1);
+ }
+ memcpy(StorageTmp->traceRouteCtlMiscOptions, var_val,
+ var_val_len + 1);
+ StorageTmp->traceRouteCtlMiscOptions[var_val_len] = '\0';
+ StorageTmp->traceRouteCtlMiscOptionsLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->traceRouteCtlMiscOptions);
+ StorageTmp->traceRouteCtlMiscOptions = NULL;
+ StorageTmp->traceRouteCtlMiscOptions = tmpvar;
+ StorageTmp->traceRouteCtlMiscOptionsLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ tmpvar = NULL;
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_traceRouteCtlMaxFailures(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlTrapTestFailureFilter not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlMaxFailures;
+ if ((*((long *) var_val)) >= 0 && (*((long *) var_val)) <= 15)
+ StorageTmp->traceRouteCtlMaxFailures = *((long *) var_val);
+ else
+ StorageTmp->traceRouteCtlMaxFailures = 1;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlMaxFailures = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+
+int
+write_traceRouteCtlDontFragment(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name,
+ size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlMaxRows not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlDontFragment;
+ StorageTmp->traceRouteCtlDontFragment = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlDontFragment = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+int
+write_traceRouteCtlInitialTtl(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlTrapTestFailureFilter not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlInitialTtl;
+ if ((*((long *) var_val)) >= 0 && (*((long *) var_val)) <= 255)
+ StorageTmp->traceRouteCtlInitialTtl = *((long *) var_val);
+ else
+ StorageTmp->traceRouteCtlInitialTtl = 1;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlInitialTtl = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+write_traceRouteCtlFrequency(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlSourceAddressType not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlFrequency;
+ StorageTmp->traceRouteCtlFrequency = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlFrequency = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+int
+write_traceRouteCtlStorageType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ int set_value;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+
+ set_value = *((long *) var_val);
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlMaxRows not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+
+ if ((StorageTmp->traceRouteCtlStorageType == 2
+ || StorageTmp->traceRouteCtlStorageType == 3)
+ && (set_value == 4 || set_value == 5)) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlStorageType;
+ StorageTmp->traceRouteCtlStorageType = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlStorageType = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_traceRouteCtlAdminStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ netsnmp_variable_list *vars = NULL;
+ struct traceRouteResultsTable_data *StorageNew = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlIfIndex not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlAdminStatus;
+ StorageTmp->traceRouteCtlAdminStatus = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlAdminStatus = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) StorageTmp->traceRouteCtlOwnerIndex, StorageTmp->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) StorageTmp->traceRouteCtlTestName, StorageTmp->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+ StorageNew =
+ header_complex_get(traceRouteResultsTableStorage, vars);
+
+ if (StorageTmp->traceRouteCtlAdminStatus == 1
+ && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ if (StorageNew == NULL)
+ init_trResultsTable(StorageTmp);
+ else {
+ StorageTmp->traceRouteResults->
+ traceRouteResultsOperStatus = 1;
+ modify_trResultsOper(StorageTmp, 1);
+ }
+ if (StorageTmp->traceRouteCtlFrequency != 0)
+ StorageTmp->timer_id =
+ snmp_alarm_register(StorageTmp->traceRouteCtlFrequency,
+ SA_REPEAT, run_traceRoute,
+ StorageTmp);
+ else
+ StorageTmp->timer_id = snmp_alarm_register(1, (int) NULL,
+ run_traceRoute,
+ StorageTmp);
+
+ } else if (StorageTmp->traceRouteCtlAdminStatus == 2
+ && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ snmp_alarm_unregister(StorageTmp->timer_id);
+ if (StorageNew == NULL)
+ init_trResultsTable(StorageTmp);
+ else {
+ StorageTmp->traceRouteResults->
+ traceRouteResultsOperStatus = 2;
+ modify_trResultsOper(StorageTmp, 2);
+ }
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+int
+write_traceRouteCtlDescr(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ static size_t tmplen;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlTargetAddress not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlDescr;
+ tmplen = StorageTmp->traceRouteCtlDescrLen;
+
+ StorageTmp->traceRouteCtlDescr = (char *) malloc(var_val_len + 1);
+ if (StorageTmp->traceRouteCtlDescr == NULL) {
+ exit(1);
+ }
+ memcpy(StorageTmp->traceRouteCtlDescr, var_val, var_val_len + 1);
+ StorageTmp->traceRouteCtlDescr[var_val_len] = '\0';
+ StorageTmp->traceRouteCtlDescrLen = var_val_len;
+
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->traceRouteCtlDescr);
+ StorageTmp->traceRouteCtlDescr = NULL;
+ StorageTmp->traceRouteCtlDescr = tmpvar;
+ StorageTmp->traceRouteCtlDescrLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ tmpvar = NULL;
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+
+int
+write_traceRouteCtlMaxRows(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_UNSIGNED) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlDSField not ASN_UNSIGNED\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlMaxRows;
+ StorageTmp->traceRouteCtlMaxRows = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlMaxRows = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_traceRouteCtlTrapGeneration(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name,
+ size_t name_len)
+{
+ static char *tmpvar;
+ static size_t tmplen;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlTargetAddress not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlTrapGeneration;
+ tmplen = StorageTmp->traceRouteCtlTrapGenerationLen;
+ StorageTmp->traceRouteCtlTrapGeneration =
+ (char *) malloc(var_val_len + 1);
+ if (StorageTmp->traceRouteCtlTrapGeneration == NULL) {
+ exit(1);
+ }
+
+ memcpy(StorageTmp->traceRouteCtlTrapGeneration, var_val,
+ var_val_len + 1);
+ StorageTmp->traceRouteCtlTrapGeneration[var_val_len] = '\0';
+ StorageTmp->traceRouteCtlTrapGenerationLen = var_val_len;
+
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->traceRouteCtlTrapGeneration);
+ StorageTmp->traceRouteCtlTrapGeneration = NULL;
+ StorageTmp->traceRouteCtlTrapGeneration = tmpvar;
+ StorageTmp->traceRouteCtlTrapGenerationLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ tmpvar = NULL;
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_traceRouteCtlCreateHopsEntries(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name,
+ size_t name_len)
+{
+ static size_t tmpvar;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlDSField not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in objid for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlCreateHopsEntries;
+ StorageTmp->traceRouteCtlCreateHopsEntries = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->traceRouteCtlCreateHopsEntries = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_traceRouteCtlType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static oid *tmpvar;
+ static size_t tmplen;
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+
+ if ((StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OBJECT_ID) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlType not ASN_OBJECT_ID\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->traceRouteCtlType;
+ tmplen = StorageTmp->traceRouteCtlTypeLen;
+
+ StorageTmp->traceRouteCtlType = (oid *) malloc(var_val_len);
+ if (StorageTmp->traceRouteCtlType == NULL) {
+ exit(1);
+ }
+ memcpy(StorageTmp->traceRouteCtlType, var_val, var_val_len);
+ StorageTmp->traceRouteCtlTypeLen = var_val_len / sizeof(oid);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->traceRouteCtlType);
+ StorageTmp->traceRouteCtlType = NULL;
+ StorageTmp->traceRouteCtlType = tmpvar;
+ StorageTmp->traceRouteCtlTypeLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ tmpvar = NULL;
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_traceRouteCtlRowStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ struct traceRouteCtlTable_data *StorageTmp = NULL;
+ static struct traceRouteCtlTable_data *StorageNew = NULL;
+ static struct traceRouteCtlTable_data *StorageDel = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) + 3 - 1);
+ static int old_value;
+ int set_value;
+ static netsnmp_variable_list *vars = NULL, *vp = NULL;
+ struct header_complex_index *hciptr = NULL;
+
+ StorageTmp =
+ header_complex(traceRouteCtlTableStorage, NULL,
+ &name[sizeof(traceRouteCtlTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL);
+
+ if (var_val_type != ASN_INTEGER || var_val == NULL) {
+ snmp_log(LOG_ERR,
+ "write to traceRouteCtlRowStatus not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (StorageTmp && StorageTmp->storageType == ST_READONLY) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ set_value = *((long *) var_val);
+
+
+ /*
+ * check legal range, and notReady is reserved for us, not a user
+ */
+ if (set_value < 1 || set_value > 6 || set_value == RS_NOTREADY)
+ return SNMP_ERR_INCONSISTENTVALUE;
+
+
+ switch (action) {
+ case RESERVE1:
+ /*
+ * stage one: test validity
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * create the row now?
+ */
+
+ /*
+ * ditch illegal values now
+ */
+ if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) {
+
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ /*
+ * destroying a non-existent row is actually legal
+ */
+ if (set_value == RS_DESTROY) {
+
+ return SNMP_ERR_NOERROR;
+ }
+
+
+ /*
+ * illegal creation values
+ */
+ if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else {
+ /*
+ * row exists. Check for a valid state change
+ */
+ if (set_value == RS_CREATEANDGO
+ || set_value == RS_CREATEANDWAIT) {
+ /*
+ * can't create a row that exists
+ */
+
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ /*
+ * XXX: interaction with row storage type needed
+ */
+
+ if (StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE &&
+ set_value != RS_DESTROY) {
+ /*
+ * "Once made active an entry may not be modified except to
+ * delete it." XXX: doesn't this in fact apply to ALL
+ * columns of the table and not just this one?
+ */
+
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (StorageTmp->storageType != ST_NONVOLATILE) {
+
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ }
+
+ break;
+
+
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ if (StorageTmp == NULL) {
+
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+ /*
+ * creation
+ */
+
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0); /* traceRouteCtlTestName */
+
+ if (header_complex_parse_oid
+ (&
+ (name
+ [sizeof(traceRouteCtlTable_variables_oid) / sizeof(oid) +
+ 2]), newlen, vars) != SNMPERR_SUCCESS) {
+ /*
+ * XXX: free, zero vars
+ */
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+
+
+ StorageNew = create_traceRouteCtlTable_data();
+ if (vars->val_len <= 32) {
+ StorageNew->traceRouteCtlOwnerIndex =
+ malloc(vars->val_len + 1);
+ memcpy(StorageNew->traceRouteCtlOwnerIndex,
+ vars->val.string, vars->val_len);
+ StorageNew->traceRouteCtlOwnerIndex[vars->val_len] = '\0';
+ StorageNew->traceRouteCtlOwnerIndexLen = vars->val_len;
+ } else {
+ StorageNew->traceRouteCtlOwnerIndex = malloc(33);
+ memcpy(StorageNew->traceRouteCtlOwnerIndex,
+ vars->val.string, 32);
+ StorageNew->traceRouteCtlOwnerIndex[32] = '\0';
+ StorageNew->traceRouteCtlOwnerIndexLen = 32;
+ }
+
+ vars = vars->next_variable;
+
+ if (vars->val_len <= 32) {
+ StorageNew->traceRouteCtlTestName =
+ malloc(vars->val_len + 1);
+ memcpy(StorageNew->traceRouteCtlTestName, vars->val.string,
+ vars->val_len);
+ StorageNew->traceRouteCtlTestName[vars->val_len] = '\0';
+ StorageNew->traceRouteCtlTestNameLen = vars->val_len;
+ } else {
+ StorageNew->traceRouteCtlTestName = malloc(33);
+ memcpy(StorageNew->traceRouteCtlTestName, vars->val.string,
+ 32);
+ StorageNew->traceRouteCtlTestName[32] = '\0';
+ StorageNew->traceRouteCtlTestNameLen = 32;
+ }
+ vars = vars->next_variable;
+
+ /*
+ * XXX: fill in default row values here into StorageNew
+ */
+
+ StorageNew->traceRouteCtlRowStatus = set_value;
+
+
+ /*
+ * XXX: free, zero vars, no longer needed?
+ */
+ }
+ snmp_free_varbind(vars);
+ vars = NULL;
+ break;
+
+ case FREE:
+ /*
+ * XXX: free, zero vars
+ */
+ snmp_free_varbind(vars);
+ vars = NULL;
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+ case ACTION:
+ /*
+ * The variable has been stored in set_value for you to
+ * use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in
+ * the UNDO case
+ */
+
+ if (StorageTmp == NULL) {
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+ /*
+ * row creation, so add it
+ */
+ if (StorageNew != NULL) {
+#if 1
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "write_traceRouteCtlRowStatus entering new=%d... \n",
+ action));
+#endif
+ traceRouteCtlTable_add(StorageNew);
+ }
+
+ /*
+ * XXX: ack, and if it is NULL?
+ */
+ } else if (set_value != RS_DESTROY) {
+ /*
+ * set the flag?
+ */
+ old_value = StorageTmp->traceRouteCtlRowStatus;
+ StorageTmp->traceRouteCtlRowStatus = *((long *) var_val);
+ } else {
+ /*
+ * destroy... extract it for now
+ */
+
+ hciptr =
+ header_complex_find_entry(traceRouteCtlTableStorage,
+ StorageTmp);
+ StorageDel =
+ header_complex_extract_entry(&traceRouteCtlTableStorage,
+ hciptr);
+ snmp_alarm_unregister(StorageDel->timer_id);
+
+ traceRouteResultsTable_del(StorageTmp);
+ traceRouteProbeHistoryTable_del(StorageTmp);
+ traceRouteHopsTable_del(StorageTmp);
+ }
+ break;
+
+
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ if (StorageTmp == NULL) {
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+ /*
+ * row creation, so remove it again
+ */
+ hciptr =
+ header_complex_find_entry(traceRouteCtlTableStorage,
+ StorageTmp);
+ StorageDel =
+ header_complex_extract_entry(&traceRouteCtlTableStorage,
+ hciptr);
+ /*
+ * XXX: free it
+ */
+ } else if (StorageDel != NULL) {
+ /*
+ * row deletion, so add it again
+ */
+ traceRouteCtlTable_add(StorageDel);
+ traceRouteResultsTable_add(StorageDel);
+ traceRouteProbeHistoryTable_addall(StorageDel);
+ traceRouteHopsTable_addall(StorageDel);
+ } else {
+ StorageTmp->traceRouteCtlRowStatus = old_value;
+ }
+ break;
+
+
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ if (StorageTmp == NULL) {
+ if (set_value == RS_DESTROY) {
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ if (StorageDel != NULL) {
+ free(StorageDel->traceRouteCtlOwnerIndex);
+ StorageDel->traceRouteCtlOwnerIndex = NULL;
+ free(StorageDel->traceRouteCtlTestName);
+ StorageDel->traceRouteCtlTestName = NULL;
+ free(StorageDel->traceRouteCtlTargetAddress);
+ StorageDel->traceRouteCtlTargetAddress = NULL;
+ free(StorageDel->traceRouteCtlSourceAddress);
+ StorageDel->traceRouteCtlSourceAddress = NULL;
+ free(StorageDel->traceRouteCtlMiscOptions);
+ StorageDel->traceRouteCtlMiscOptions = NULL;
+ free(StorageDel->traceRouteCtlDescr);
+ StorageDel->traceRouteCtlDescr = NULL;
+ free(StorageDel->traceRouteCtlTrapGeneration);
+ StorageDel->traceRouteCtlTrapGeneration = NULL;
+ free(StorageDel->traceRouteCtlType);
+ StorageDel->traceRouteCtlType = NULL;
+ free(StorageDel);
+ StorageDel = NULL;
+
+ /*
+ * XXX: free it, its dead
+ */
+ } else {
+ if (StorageTmp
+ && StorageTmp->traceRouteCtlRowStatus == RS_CREATEANDGO) {
+ StorageTmp->traceRouteCtlRowStatus = RS_ACTIVE;
+ } else if (StorageTmp &&
+ StorageTmp->traceRouteCtlRowStatus ==
+ RS_CREATEANDWAIT) {
+
+ StorageTmp->traceRouteCtlRowStatus = RS_NOTINSERVICE;
+ }
+ }
+ if (StorageTmp && StorageTmp->traceRouteCtlRowStatus == RS_ACTIVE) {
+#if 1
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "write_traceRouteCtlRowStatus entering runbefore=%ld... \n",
+ StorageTmp->traceRouteCtlTargetAddressType));
+
+#endif
+ if (StorageTmp->traceRouteCtlAdminStatus == 1) {
+ init_trResultsTable(StorageTmp);
+ if (StorageTmp->traceRouteCtlFrequency != 0)
+ StorageTmp->timer_id =
+ snmp_alarm_register(StorageTmp->
+ traceRouteCtlFrequency,
+ SA_REPEAT, run_traceRoute,
+ StorageTmp);
+ else
+ StorageTmp->timer_id =
+ snmp_alarm_register(1, (int) NULL, run_traceRoute,
+ StorageTmp);
+
+ }
+
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+unsigned long
+round(double number)
+{
+ unsigned long ret_num = 0;
+ if (number - (unsigned long) number < 0.5)
+ ret_num = (unsigned long) number;
+ else
+ ret_num = (unsigned long) number + 1;
+ return ret_num;
+}
+
+void
+run_traceRoute(unsigned int clientreg, void *clientarg)
+{
+ struct traceRouteCtlTable_data *item = clientarg;
+ u_short port = item->traceRouteCtlPort; /* start udp dest port # for probe packets Ï൱ÓÚctlport */
+ int waittime = item->traceRouteCtlTimeOut; /* time to wait for response (in seconds) ÏàµÈÓÚctltimeout */
+ prog = "traceroute";
+ int nprobes = item->traceRouteCtlProbesPerHop;
+
+ if (item->traceRouteCtlInitialTtl > item->traceRouteCtlMaxTtl) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "first ttl (%d) may not be greater than max ttl (%d)\n",
+ item->traceRouteCtlInitialTtl,
+ item->traceRouteCtlMaxTtl));
+ return;
+ }
+
+ char *old_HopsAddress[255];
+ int count = 0;
+ int flag = 0;
+
+ if (item->traceRouteCtlTargetAddressType == 1
+ || item->traceRouteCtlTargetAddressType == 16) {
+ register int op, code, n;
+ register char *cp;
+ register const char *err;
+ register u_char *outp;
+ register u_int32_t *ap;
+ struct sockaddr whereto; /* Who to try to reach */
+ struct sockaddr wherefrom; /* Who we are */
+
+ register struct sockaddr_in *from =
+ (struct sockaddr_in *) &wherefrom;
+ register struct sockaddr_in *to = (struct sockaddr_in *) &whereto;
+ register struct hostinfo *hi;
+ int on = 1;
+ register struct protoent *pe;
+ register int ttl, probe, i;
+ register int seq = 0;
+ int tos = 0, settos = 0;
+ register int lsrr = 0;
+ register u_short off = 0;
+ struct ifaddrlist *al;
+ char errbuf[132];
+ int minpacket = 0; /* min ip packet size */
+
+
+ struct ip *outip; /* last output (udp) packet */
+ struct udphdr *outudp; /* last output (udp) packet */
+ int packlen = 0; /* total length of packet */
+ int optlen = 0; /* length of ip options */
+ int options = 0; /* socket options */
+ int s; /* receive (icmp) socket file descriptor */
+ int sndsock; /* send (udp/icmp) socket file descriptor */
+
+ u_short ident;
+ /*
+ * loose source route gateway list (including room for final destination)
+ */
+ u_int32_t gwlist[NGATEWAYS + 1];
+ static const char devnull[] = "/dev/null";
+ char *device = NULL;
+ char *source = NULL;
+ char *hostname;
+ u_int pausemsecs = 0;
+ u_char packet[512]; /* last inbound (icmp) packet */
+
+ int pmtu = 0; /* Path MTU Discovery (RFC1191) */
+
+ struct outdata *outdata; /* last output (udp) packet */
+
+ minpacket = sizeof(*outip) + sizeof(*outdata) + optlen;
+ minpacket += sizeof(*outudp);
+ packlen = minpacket; /* minimum sized packet */
+
+ hostname =
+ (char *) malloc(item->traceRouteCtlTargetAddressLen + 1);
+ if (hostname == NULL)
+ return;
+ memcpy(hostname, item->traceRouteCtlTargetAddress,
+ item->traceRouteCtlTargetAddressLen + 1);
+ hostname[item->traceRouteCtlTargetAddressLen] = '\0';
+
+ hi = gethostinfo(hostname);
+ setsin(to, hi->addrs[0]);
+ if (hi->n > 1)
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "Warning: %s has multiple addresses; using %s\n",
+ hostname, inet_ntoa(to->sin_addr)));
+ hostname = hi->name;
+ hi->name = NULL;
+ freehostinfo(hi);
+
+
+#ifdef HAVE_SETLINEBUF
+ setlinebuf(stdout);
+#else
+ setvbuf(stdout, NULL, _IOLBF, 0);
+#endif
+
+ outip = (struct ip *) malloc(packlen);
+ if (outip == NULL) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "malloc: %s\n", strerror(errno)));
+ exit(1);
+ }
+ memset((char *) outip, 0, packlen);
+
+ outip->ip_v = IPVERSION;
+ if (settos)
+ outip->ip_tos = tos;
+#ifdef BYTESWAP_IP_HDR
+ outip->ip_len = htons(packlen);
+ outip->ip_off = htons(off);
+#else
+ outip->ip_len = packlen;
+ outip->ip_off = off;
+#endif
+ outp = (u_char *) (outip + 1);
+#ifdef HAVE_RAW_OPTIONS
+ if (lsrr > 0) {
+ register u_char *optlist;
+
+ optlist = outp;
+ outp += optlen;
+
+ /*
+ * final hop
+ */
+ gwlist[lsrr] = to->sin_addr.s_addr;
+
+ outip->ip_dst.s_addr = gwlist[0];
+
+ /*
+ * force 4 byte alignment
+ */
+ optlist[0] = IPOPT_NOP;
+ /*
+ * loose source route option
+ */
+ optlist[1] = IPOPT_LSRR;
+ i = lsrr * sizeof(gwlist[0]);
+ optlist[2] = i + 3;
+ /*
+ * Pointer to LSRR addresses
+ */
+ optlist[3] = IPOPT_MINOFF;
+ memcpy(optlist + 4, gwlist + 1, i);
+ } else
+#endif
+ outip->ip_dst = to->sin_addr;
+ outip->ip_hl = (outp - (u_char *) outip) >> 2;
+ ident = (getpid() & 0xffff) | 0x8000;
+
+ outip->ip_p = IPPROTO_UDP;
+
+ outudp = (struct udphdr *) outp;
+ outudp->source = htons(ident);
+ outudp->len =
+ htons((u_short) (packlen - (sizeof(*outip) + optlen)));
+ outdata = (struct outdata *) (outudp + 1);
+
+ cp = "icmp";
+ if ((pe = getprotobyname(cp)) == NULL) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "unknown protocol %s\n", cp));
+ exit(1);
+ }
+
+ /*
+ * Insure the socket fds won't be 0, 1 or 2
+ */
+ if (open(devnull, O_RDONLY) < 0 ||
+ open(devnull, O_RDONLY) < 0 || open(devnull, O_RDONLY) < 0) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "open \"%s\": %s\n", devnull, strerror(errno)));
+ exit(1);
+ }
+ if ((s = socket(AF_INET, SOCK_RAW, pe->p_proto)) < 0) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "icmp socket: %s\n", strerror(errno)));
+ exit(1);
+ }
+ if (options & SO_DEBUG)
+ (void) setsockopt(s, SOL_SOCKET, SO_DEBUG, (char *) &on,
+ sizeof(on));
+ if (options & SO_DONTROUTE)
+ (void) setsockopt(s, SOL_SOCKET, SO_DONTROUTE, (char *) &on,
+ sizeof(on));
+#ifndef __hpux
+ printf("raw\n");
+ sndsock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
+#else
+ printf("udp\n");
+ sndsock = socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
+#endif
+ if (sndsock < 0) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "raw socket: %s\n", strerror(errno)));
+ exit(1);
+ }
+#if defined(IP_OPTIONS) && !defined(HAVE_RAW_OPTIONS)
+ if (lsrr > 0) {
+ u_char optlist[MAX_IPOPTLEN];
+
+ cp = "ip";
+ if ((pe = getprotobyname(cp)) == NULL) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "unknown protocol %s\n", cp));
+ exit(1);
+ }
+ /*
+ * final hop
+ */
+ gwlist[lsrr] = to->sin_addr.s_addr;
+ ++lsrr;
+
+ /*
+ * force 4 byte alignment
+ */
+ optlist[0] = IPOPT_NOP;
+ /*
+ * loose source route option
+ */
+ optlist[1] = IPOPT_LSRR;
+ i = lsrr * sizeof(gwlist[0]);
+ optlist[2] = i + 3;
+ /*
+ * Pointer to LSRR addresses
+ */
+ optlist[3] = IPOPT_MINOFF;
+ memcpy(optlist + 4, gwlist, i);
+
+ if ((setsockopt(sndsock, pe->p_proto, IP_OPTIONS,
+ (char *) optlist,
+ i + sizeof(gwlist[0]))) < 0) {
+ DEBUGMSGTL(("traceRouteCtlTable", "IP_OPTIONS: %s\n",
+ strerror(errno)));
+ exit(1);
+ }
+ }
+#endif
+#ifdef SO_SNDBUF
+ if (setsockopt(sndsock, SOL_SOCKET, SO_SNDBUF, (char *) &packlen,
+ sizeof(packlen)) < 0) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "SO_SNDBUF: %s\n", strerror(errno)));
+ exit(1);
+ }
+#endif
+#ifdef IP_HDRINCL
+ if (setsockopt(sndsock, IPPROTO_IP, IP_HDRINCL, (char *) &on,
+ sizeof(on)) < 0) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "IP_HDRINCL: %s\n", strerror(errno)));
+ exit(1);
+ }
+#else
+#ifdef IP_TOS
+ if (settos && setsockopt(sndsock, IPPROTO_IP, IP_TOS,
+ (char *) &tos, sizeof(tos)) < 0) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ "setsockopt tos %d: %s\n", strerror(errno)));
+ exit(1);
+ }
+#endif
+#endif
+ if (options & SO_DEBUG)
+ (void) setsockopt(sndsock, SOL_SOCKET, SO_DEBUG, (char *) &on,
+ sizeof(on));
+ if (options & SO_DONTROUTE)
+ (void) setsockopt(sndsock, SOL_SOCKET, SO_DONTROUTE,
+ (char *) &on, sizeof(on));
+ /*
+ * Get the interface address list
+ */
+ n = ifaddrlist(&al, errbuf);
+ if (n < 0) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ " ifaddrlist: %s\n", errbuf));
+ exit(1);
+ }
+ if (n == 0) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ " Can't find any network interfaces\n"));
+
+ exit(1);
+ }
+
+ /*
+ * Look for a specific device
+ */
+ if (device != NULL) {
+ for (i = n; i > 0; --i, ++al)
+ if (strcmp(device, al->device) == 0)
+ break;
+ if (i <= 0) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ " Can't find interface %.32s\n", device));
+
+ exit(1);
+ }
+ }
+ /*
+ * Determine our source address
+ */
+ if (source == NULL) {
+ /*
+ * If a device was specified, use the interface address.
+ * Otherwise, try to determine our source address.
+ */
+ if (device != NULL)
+ setsin(from, al->addr);
+ else if ((err = findsaddr(to, from)) != NULL) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ " findsaddr: %s\n", err));
+ exit(1);
+ }
+
+ } else {
+ hi = gethostinfo(source);
+ source = hi->name;
+ hi->name = NULL;
+ /*
+ * If the device was specified make sure it
+ * corresponds to the source address specified.
+ * Otherwise, use the first address (and warn if
+ * there are more than one).
+ */
+ if (device != NULL) {
+ for (i = hi->n, ap = hi->addrs; i > 0; --i, ++ap)
+ if (*ap == al->addr)
+ break;
+ if (i <= 0) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ " %s is not on interface %.32s\n",
+ source, device));
+
+ exit(1);
+ }
+ setsin(from, *ap);
+ } else {
+ setsin(from, hi->addrs[0]);
+ if (hi->n > 1)
+ DEBUGMSGTL(("traceRouteCtlTable",
+ " Warning: %s has multiple addresses; using %s\n",
+ source, inet_ntoa(from->sin_addr)));
+
+ }
+ freehostinfo(hi);
+ }
+ /*
+ * Revert to non-privileged user after opening sockets
+ */
+ setgid(getgid());
+ setuid(getuid());
+
+ outip->ip_src = from->sin_addr;
+#ifndef IP_HDRINCL
+ if (bind(sndsock, (struct sockaddr *) from, sizeof(*from)) < 0) {
+ DEBUGMSGTL(("traceRouteCtlTable",
+ " bind: %s\n", strerror(errno)));
+ exit(1);
+ }
+#endif
+ DEBUGMSGTL(("traceRouteCtlTable",
+ " to %s (%s)", hostname, inet_ntoa(to->sin_addr)));
+
+ if (source)
+ DEBUGMSGTL(("traceRouteCtlTable", " from %s", source));
+
+ DEBUGMSGTL(("traceRouteCtlTable",
+ ", %d hops max, %d byte packets\n",
+ item->traceRouteCtlMaxTtl, packlen));
+ (void) fflush(stderr);
+
+ struct traceRouteResultsTable_data *StorageResults = NULL;
+ netsnmp_variable_list *vars_results = NULL;
+
+ struct traceRouteHopsTable_data *StorageHops = NULL;
+ struct traceRouteHopsTable_data *temp = NULL;
+ struct traceRouteHopsTable_data *current_temp = NULL;
+ struct traceRouteHopsTable_data *current = NULL;
+
+ unsigned long index = 0;
+
+ struct traceRouteProbeHistoryTable_data *StorageProbe = NULL;
+ struct traceRouteProbeHistoryTable_data *temp_his = NULL;
+ struct traceRouteProbeHistoryTable_data *current_temp_his = NULL;
+ netsnmp_variable_list *vars_probe = NULL;
+
+ snmp_varlist_add_variable(&vars_results, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlOwnerIndex, item->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_results, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlTestName, item->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+ if ((StorageResults =
+ header_complex_get(traceRouteResultsTableStorage,
+ vars_results)) == NULL)
+ return;
+ snmp_free_varbind(vars_results);
+ vars_results = NULL;
+
+
+ for (ttl = item->traceRouteCtlInitialTtl;
+ ttl <= item->traceRouteCtlMaxTtl; ++ttl) {
+
+ u_int32_t lastaddr = 0;
+ int gotlastaddr = 0;
+ int got_there = 0;
+ int unreachable = 0;
+ int sentfirst = 0;
+ time_t timep = 0;
+
+ StorageResults->traceRouteResultsCurHopCount = ttl;
+ if (item->traceRouteCtlCreateHopsEntries == 1) {
+ if (ttl == item->traceRouteCtlInitialTtl) {
+ int k = 0;
+ count = traceRouteHopsTable_count(item);
+
+
+ struct traceRouteHopsTable_data *StorageTmp = NULL;
+ struct header_complex_index *hciptr2 = NULL;
+ netsnmp_variable_list *vars = NULL;
+ oid newoid[MAX_OID_LEN];
+ size_t newoid_len;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlOwnerIndex, item->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlTestName, item->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+
+ header_complex_generate_oid(newoid, &newoid_len, NULL,
+ 0, vars);
+
+ for (hciptr2 = traceRouteHopsTableStorage;
+ hciptr2 != NULL; hciptr2 = hciptr2->next) {
+ if (snmp_oid_compare
+ (newoid, newoid_len, hciptr2->name,
+ newoid_len) == 0) {
+ StorageTmp =
+ header_complex_extract_entry
+ (&traceRouteHopsTableStorage, hciptr2);
+
+ old_HopsAddress[k] =
+ (char *) malloc(StorageTmp->
+ traceRouteHopsIpTgtAddressLen
+ + 1);
+ if (old_HopsAddress[k] == NULL) {
+ exit(1);
+ }
+ memdup((u_char **) & old_HopsAddress[k],
+ StorageTmp->traceRouteHopsIpTgtAddress,
+ StorageTmp->
+ traceRouteHopsIpTgtAddressLen + 1);
+ old_HopsAddress[k][StorageTmp->
+ traceRouteHopsIpTgtAddressLen]
+ = '\0';
+
+ k++;
+ StorageTmp = NULL;
+ }
+ }
+ traceRouteHopsTable_del(item);
+ index = 0;
+ }
+
+ temp = SNMP_MALLOC_STRUCT(traceRouteHopsTable_data);
+ temp->traceRouteCtlOwnerIndex =
+ (char *) malloc(item->traceRouteCtlOwnerIndexLen + 1);
+ memcpy(temp->traceRouteCtlOwnerIndex,
+ item->traceRouteCtlOwnerIndex,
+ item->traceRouteCtlOwnerIndexLen + 1);
+ temp->traceRouteCtlOwnerIndex[item->
+ traceRouteCtlOwnerIndexLen] =
+ '\0';
+ temp->traceRouteCtlOwnerIndexLen =
+ item->traceRouteCtlOwnerIndexLen;
+
+ temp->traceRouteCtlTestName =
+ (char *) malloc(item->traceRouteCtlTestNameLen + 1);
+ memcpy(temp->traceRouteCtlTestName,
+ item->traceRouteCtlTestName,
+ item->traceRouteCtlTestNameLen + 1);
+ temp->traceRouteCtlTestName[item->
+ traceRouteCtlTestNameLen] =
+ '\0';
+ temp->traceRouteCtlTestNameLen =
+ item->traceRouteCtlTestNameLen;
+
+ /* add lock to protect */
+ pthread_mutex_t counter_mutex = PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_lock(&counter_mutex);
+ temp->traceRouteHopsHopIndex = ++index;
+ pthread_mutex_unlock(&counter_mutex);
+ /* endsadsadsad */
+
+
+ temp->traceRouteHopsIpTgtAddressType = 0;
+ temp->traceRouteHopsIpTgtAddress = strdup("");
+ temp->traceRouteHopsIpTgtAddressLen = 0;
+ temp->traceRouteHopsMinRtt = 0;
+ temp->traceRouteHopsMaxRtt = 0;
+ temp->traceRouteHopsAverageRtt = 0;
+ temp->traceRouteHopsRttSumOfSquares = 0;
+ temp->traceRouteHopsSentProbes = 0;
+ temp->traceRouteHopsProbeResponses = 0;
+
+ temp->traceRouteHopsLastGoodProbe = strdup("");
+ temp->traceRouteHopsLastGoodProbeLen = 0;
+ if (index == 1)
+ item->traceRouteHops = temp;
+ else {
+ (current_temp)->next = temp;
+ }
+
+ current_temp = temp;
+
+ if (index + 1 >= item->traceRouteCtlMaxTtl) {
+ current_temp->next = NULL;
+ }
+
+ if (item->traceRouteHops != NULL)
+
+ if (traceRouteHopsTable_add(current_temp) !=
+ SNMPERR_SUCCESS)
+ DEBUGMSGTL(("traceRouteHopsTable",
+ "registered an entry error\n"));
+
+ }
+ register unsigned long maxRtt = 0;
+ register unsigned long minRtt = 0;
+ register unsigned long averageRtt = 0;
+ register unsigned long sumRtt = 0;
+ register unsigned long responseProbe = 0;
+ register unsigned long sumOfSquare = 0;
+ for (probe = 0; probe < nprobes; ++probe) {
+ register int cc;
+ struct timeval t1, t2;
+ struct timezone tz;
+ register struct ip *ip = NULL;
+ register unsigned long Rtt = 0;
+
+ if (sentfirst && pausemsecs > 0)
+ usleep(pausemsecs * 1000);
+ (void) gettimeofday(&t1, &tz);
+ send_probe(to, ++seq, ttl, &t1, outip, outudp, packlen,
+ optlen, hostname, ident, sndsock, port,
+ outdata);
+ ++sentfirst;
+ while ((cc =
+ wait_for_reply(s, from, &t1, packet,
+ waittime)) != 0) {
+ (void) gettimeofday(&t2, &tz);
+ timep = 0;
+ time(&timep);
+ i = packet_ok(packet, cc, from, seq, ident, pmtu,
+ port);
+ /*
+ * Skip short packet
+ */
+ if (i == 0)
+ continue;
+ if (!gotlastaddr || from->sin_addr.s_addr != lastaddr) {
+ register struct ip *ip;
+ register int hlen;
+ ip = (struct ip *) packet;
+ hlen = ip->ip_hl << 2;
+ cc -= hlen;
+ DEBUGMSGTL(("traceRouteCtlTable",
+ " %s", inet_ntoa(from->sin_addr)));
+
+
+ lastaddr = from->sin_addr.s_addr;
+ ++gotlastaddr;
+ }
+ Rtt = deltaT(&t1, &t2);
+ responseProbe = responseProbe + 1;
+ if (probe == 0) {
+ minRtt = Rtt;
+ maxRtt = Rtt;
+ averageRtt = Rtt;
+ sumRtt = Rtt;
+ sumOfSquare = Rtt * Rtt;
+ } else {
+ if (Rtt < minRtt)
+ minRtt = Rtt;
+ if (Rtt > maxRtt)
+ maxRtt = Rtt;
+ sumRtt = (sumRtt) + Rtt;
+ averageRtt =
+ round((double) (sumRtt) /
+ (double) responseProbe);
+ sumOfSquare = sumOfSquare + Rtt * Rtt;
+ }
+
+ StorageResults->traceRouteResultsCurProbeCount =
+ probe + 1;
+ if (i == -2) {
+#ifndef ARCHAIC
+ ip = (struct ip *) packet;
+ if (ip->ip_ttl <= 1)
+ Printf(" !");
+#endif
+ ++got_there;
+ break;
+ }
+ /*
+ * time exceeded in transit
+ */
+ if (i == -1)
+ break;
+ code = i - 1;
+ switch (code) {
+
+ case ICMP_UNREACH_PORT:
+#ifndef ARCHAIC
+ ip = (struct ip *) packet;
+ if (ip->ip_ttl <= 1)
+ Printf(" !");
+#endif
+ ++got_there;
+ break;
+
+ case ICMP_UNREACH_NET:
+ ++unreachable;
+ Printf(" !N");
+ break;
+
+ case ICMP_UNREACH_HOST:
+ ++unreachable;
+ Printf(" !H");
+ break;
+
+ case ICMP_UNREACH_PROTOCOL:
+ ++got_there;
+ Printf(" !P");
+ break;
+
+ case ICMP_UNREACH_NEEDFRAG:
+ ++unreachable;
+ Printf(" !F-%d", pmtu);
+ break;
+
+ case ICMP_UNREACH_SRCFAIL:
+ ++unreachable;
+ Printf(" !S");
+ break;
+
+ case ICMP_UNREACH_FILTER_PROHIB:
+ ++unreachable;
+ Printf(" !X");
+ break;
+
+ case ICMP_UNREACH_HOST_PRECEDENCE:
+ ++unreachable;
+ Printf(" !V");
+ break;
+
+ case ICMP_UNREACH_PRECEDENCE_CUTOFF:
+ ++unreachable;
+ Printf(" !C");
+ break;
+
+ default:
+ ++unreachable;
+ Printf(" !<%d>", code);
+ break;
+ }
+ break;
+ }
+ if (cc == 0) {
+ timep = 0;
+ time(&timep);
+ Printf(" *");
+ Rtt = (item->traceRouteCtlTimeOut) * 1000;
+ }
+ if (item->traceRouteCtlMaxRows != 0) {
+
+ temp_his =
+ SNMP_MALLOC_STRUCT
+ (traceRouteProbeHistoryTable_data);
+ temp_his->traceRouteCtlOwnerIndex =
+ (char *) malloc(item->traceRouteCtlOwnerIndexLen +
+ 1);
+ memcpy(temp_his->traceRouteCtlOwnerIndex,
+ item->traceRouteCtlOwnerIndex,
+ item->traceRouteCtlOwnerIndexLen + 1);
+ temp_his->traceRouteCtlOwnerIndex[item->
+ traceRouteCtlOwnerIndexLen]
+ = '\0';
+ temp_his->traceRouteCtlOwnerIndexLen =
+ item->traceRouteCtlOwnerIndexLen;
+
+ temp_his->traceRouteCtlTestName =
+ (char *) malloc(item->traceRouteCtlTestNameLen +
+ 1);
+ memcpy(temp_his->traceRouteCtlTestName,
+ item->traceRouteCtlTestName,
+ item->traceRouteCtlTestNameLen + 1);
+ temp_his->traceRouteCtlTestName[item->
+ traceRouteCtlTestNameLen]
+ = '\0';
+ temp_his->traceRouteCtlTestNameLen =
+ item->traceRouteCtlTestNameLen;
+
+ /* add lock to protect */
+ pthread_mutex_t counter_mutex =
+ PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_lock(&counter_mutex);
+ if (item->traceRouteProbeHistoryMaxIndex >=
+ (unsigned long) (2147483647))
+ item->traceRouteProbeHistoryMaxIndex = 0;
+ temp_his->traceRouteProbeHistoryIndex =
+ ++(item->traceRouteProbeHistoryMaxIndex);
+ pthread_mutex_unlock(&counter_mutex);
+ /* endsadsadsad */
+ temp_his->traceRouteProbeHistoryHopIndex = ttl;
+ temp_his->traceRouteProbeHistoryProbeIndex = probe + 1;
+
+ temp_his->traceRouteProbeHistoryHAddrType = 1;
+ temp_his->traceRouteProbeHistoryHAddr =
+ (char *) malloc(strlen(inet_ntoa(from->sin_addr)) +
+ 1);
+ strcpy(temp_his->traceRouteProbeHistoryHAddr,
+ (inet_ntoa(from->sin_addr)));
+ temp_his->
+ traceRouteProbeHistoryHAddr[strlen
+ (inet_ntoa
+ (from->sin_addr))] =
+ '\0';
+ temp_his->traceRouteProbeHistoryHAddrLen =
+ strlen(inet_ntoa(from->sin_addr));
+
+ temp_his->traceRouteProbeHistoryResponse = Rtt;
+ temp_his->traceRouteProbeHistoryStatus = 1;
+ temp_his->traceRouteProbeHistoryLastRC = 0;
+
+ temp_his->traceRouteProbeHistoryTime =
+ (char *) malloc(strlen(asctime(gmtime(&timep))));
+ temp_his->traceRouteProbeHistoryTime =
+ strdup(asctime(gmtime(&timep)));
+ temp_his->
+ traceRouteProbeHistoryTime[strlen
+ (asctime
+ (gmtime(&timep))) -
+ 1] = '\0';
+ temp_his->traceRouteProbeHistoryTimeLen =
+ strlen(asctime(gmtime(&timep))) - 1;
+ if (probe == 0)
+ item->traceRouteProbeHis = temp_his;
+ else {
+ (current_temp_his)->next = temp_his;
+ }
+
+ current_temp_his = temp_his;
+
+ if (probe + 1 >= nprobes) {
+ current_temp_his->next = NULL;
+
+ }
+
+ if (item->traceRouteProbeHis != NULL)
+ if (traceRouteProbeHistoryTable_count(item) <
+ item->traceRouteCtlMaxRows) {
+ if (traceRouteProbeHistoryTable_add
+ (current_temp_his) != SNMPERR_SUCCESS)
+ DEBUGMSGTL(("traceRouteProbeHistoryTable",
+ "registered an entry error\n"));
+ } else {
+ traceRouteProbeHistoryTable_delLast(item);
+ if (traceRouteProbeHistoryTable_add
+ (current_temp_his) != SNMPERR_SUCCESS)
+ DEBUGMSGTL(("traceRouteProbeHistoryTable",
+ "registered an entry error\n"));
+
+ }
+
+
+ }
+
+ if (item->traceRouteCtlCreateHopsEntries == 1) {
+ netsnmp_variable_list *vars_hops = NULL;
+ snmp_varlist_add_variable(&vars_hops, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlOwnerIndex, item->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_hops, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlTestName, item->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+ snmp_varlist_add_variable(&vars_hops, NULL, 0, ASN_UNSIGNED, (char *) &index, sizeof(index)); /* traceRouteHopsIndex */
+ if ((current =
+ header_complex_get(traceRouteHopsTableStorage,
+ vars_hops)) == NULL)
+ return;
+ snmp_free_varbind(vars_hops);
+ vars_hops = NULL;
+
+ current->traceRouteHopsIpTgtAddressType = 1;
+ current->traceRouteHopsIpTgtAddress =
+ (char *) malloc(strlen(inet_ntoa(from->sin_addr)) +
+ 1);
+ current->traceRouteHopsIpTgtAddress =
+ strdup(inet_ntoa(from->sin_addr));
+ current->
+ traceRouteHopsIpTgtAddress[strlen
+ (inet_ntoa
+ (from->sin_addr))] =
+ '\0';
+ current->traceRouteHopsIpTgtAddressLen =
+ strlen(inet_ntoa(from->sin_addr));
+ if (count != 0) {
+ if (strcmp
+ (old_HopsAddress[index - 1],
+ current->traceRouteHopsIpTgtAddress) != 0)
+ flag = 1;
+ }
+
+ current->traceRouteHopsIpTgtAddressLen =
+ strlen(inet_ntoa(from->sin_addr));
+ current->traceRouteHopsMinRtt = minRtt;
+ current->traceRouteHopsMaxRtt = maxRtt;
+ current->traceRouteHopsAverageRtt = averageRtt;
+ current->traceRouteHopsRttSumOfSquares = sumOfSquare;
+ current->traceRouteHopsSentProbes = probe + 1;
+ current->traceRouteHopsProbeResponses = responseProbe;
+ current->traceRouteHopsLastGoodProbe =
+ (char *) malloc(strlen(asctime(gmtime(&timep))));
+ current->traceRouteHopsLastGoodProbe =
+ strdup(asctime(gmtime(&timep)));
+ current->
+ traceRouteHopsLastGoodProbe[strlen
+ (asctime
+ (gmtime(&timep))) -
+ 1] = '\0';
+ current->traceRouteHopsLastGoodProbeLen =
+ strlen(asctime(gmtime(&timep))) - 1;
+
+ }
+
+ (void) fflush(stdout);
+ }
+ putchar('\n');
+
+
+ if (got_there
+ || (unreachable > 0 && unreachable >= nprobes - 1)) {
+
+ if (got_there != 0) {
+ StorageResults->traceRouteResultsTestAttempts =
+ StorageResults->traceRouteResultsTestAttempts + 1;
+
+ StorageResults->traceRouteResultsTestSuccesses =
+ StorageResults->traceRouteResultsTestSuccesses + 1;
+
+ StorageResults->traceRouteResultsLastGoodPath =
+ (char *) malloc(strlen(asctime(gmtime(&timep))) -
+ 1);
+ StorageResults->traceRouteResultsLastGoodPath =
+ strdup(asctime(gmtime(&timep)));
+ StorageResults->
+ traceRouteResultsLastGoodPath[strlen
+ (asctime
+ (gmtime(&timep))) -
+ 1] = '\0';
+ StorageResults->traceRouteResultsLastGoodPathLen =
+ strlen(asctime(gmtime(&timep))) - 1;
+ if ((item->
+ traceRouteCtlTrapGeneration[0] &
+ TRACEROUTETRAPGENERATION_TESTCOMPLETED) != 0) {
+ DEBUGMSGTL(("traceRouteProbeHistoryTable",
+ "TEST completed!\n"));
+ send_traceRoute_trap(item, traceRouteTestCompleted,
+ sizeof
+ (traceRouteTestCompleted) /
+ sizeof(oid));
+ }
+ }
+
+ else {
+ StorageResults->traceRouteResultsTestAttempts =
+ StorageResults->traceRouteResultsTestAttempts + 1;
+ if ((item->
+ traceRouteCtlTrapGeneration[0] &
+ TRACEROUTETRAPGENERATION_TESTFAILED) != 0) {
+ DEBUGMSGTL(("traceRouteProbeHistoryTable",
+ "test Failed!\n"));
+ send_ping_trap(item, traceRouteTestFailed,
+ sizeof(traceRouteTestFailed) /
+ sizeof(oid));
+ }
+ }
+ break;
+
+ } else if (ttl == item->traceRouteCtlMaxTtl
+ && (probe + 1) == nprobes) {
+ StorageResults->traceRouteResultsTestAttempts =
+ StorageResults->traceRouteResultsTestAttempts + 1;
+
+ if ((item->
+ traceRouteCtlTrapGeneration[0] &
+ TRACEROUTETRAPGENERATION_TESTFAILED) != 0) {
+ DEBUGMSGTL(("traceRouteProbeHistoryTable",
+ "test Failed!\n"));
+ send_ping_trap(item, traceRouteTestFailed,
+ sizeof(traceRouteTestFailed) /
+ sizeof(oid));
+ }
+ }
+
+ }
+
+ if (flag == 1) {
+ DEBUGMSGTL(("traceRouteProbeHistoryTable", "path changed!\n"));
+ send_traceRoute_trap(item, traceRoutePathChange,
+ sizeof(traceRoutePathChange) /
+ sizeof(oid));
+ }
+
+ int k = 0;
+ for (k = 0; k < count; k++) {
+ free(old_HopsAddress[k]);
+ old_HopsAddress[k] = NULL;
+ }
+ }
+ if (item->traceRouteCtlTargetAddressType == 2) {
+ static char SNAPSHOT[] = "020124";
+ int icmp_sock = 0; /* receive (icmp) socket file descriptor */
+ int sndsock = 0; /* send (udp) socket file descriptor */
+ struct timezone tz; /* leftover */
+
+ struct sockaddr_in6 whereto; /* Who to try to reach */
+
+ struct sockaddr_in6 saddr;
+ struct sockaddr_in6 firsthop;
+ char *source = NULL;
+ char *device = NULL;
+ char *hostname = NULL;
+
+ pid_t ident = 0;
+ u_short port = 32768 + 666; /* start udp dest port # for probe packets */
+ int options = 0; /* socket options */
+ int verbose = 0;
+ int waittime = 5; /* time to wait for response (in seconds) */
+ int nflag = 0; /* print addresses numerically */
+
+ char *sendbuff = NULL;
+ int datalen = sizeof(struct pkt_format);
+
+ u_char packet[512]; /* last inbound (icmp) packet */
+
+ char pa[64];
+ struct hostent *hp = NULL;
+ struct sockaddr_in6 from, *to = NULL;
+ int ch = 0, i = 0, on = 0, probe = 0, seq = 0, tos =
+ 0, ttl = 0;
+ int socket_errno = 0;
+
+ icmp_sock = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6);
+ socket_errno = errno;
+
+ setuid(getuid());
+
+ on = 1;
+ seq = tos = 0;
+ to = (struct sockaddr_in6 *) &whereto;
+
+ hostname =
+ (char *) malloc(item->traceRouteCtlTargetAddressLen + 1);
+ memcpy(hostname, item->traceRouteCtlTargetAddress,
+ item->traceRouteCtlTargetAddressLen + 1);
+ hostname[item->traceRouteCtlTargetAddressLen] = '\0';
+
+ setlinebuf(stdout);
+
+ (void) bzero((char *) &whereto, sizeof(struct sockaddr_in6));
+
+ to->sin6_family = AF_INET6;
+ to->sin6_port = htons(port);
+
+ if (inet_pton(AF_INET6, hostname, &to->sin6_addr) > 0) {
+ NULL;
+ } else {
+ hp = gethostbyname2(hostname, AF_INET6);
+ if (hp != NULL) {
+ memmove((caddr_t) & to->sin6_addr, hp->h_addr, 16);
+ hostname = (char *) hp->h_name;
+ } else {
+ (void) fprintf(stderr,
+ "traceroute: unknown host %s\n", hostname);
+ return;
+ }
+ }
+ firsthop = *to;
+
+ datalen = item->traceRouteCtlDataSize;
+ if (datalen < (int) sizeof(struct pkt_format)
+ || datalen >= MAXPACKET) {
+ Fprintf(stderr,
+ "traceroute: packet size must be %d <= s < %d.\n",
+ (int) sizeof(struct pkt_format), MAXPACKET);
+ datalen = 16;
+ }
+
+ ident = getpid();
+
+ sendbuff = malloc(datalen);
+ if (sendbuff == NULL) {
+ fprintf(stderr, "malloc failed\n");
+ return;
+ }
+
+ if (icmp_sock < 0) {
+ errno = socket_errno;
+ perror("traceroute6: icmp socket");
+ return;
+ }
+
+ if (options & SO_DEBUG)
+ setsockopt(icmp_sock, SOL_SOCKET, SO_DEBUG,
+ (char *) &on, sizeof(on));
+ if (options & SO_DONTROUTE)
+ setsockopt(icmp_sock, SOL_SOCKET, SO_DONTROUTE,
+ (char *) &on, sizeof(on));
+
+ if ((sndsock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
+ perror("traceroute: UDP socket");
+ return;
+ }
+#ifdef SO_SNDBUF
+ if (setsockopt(sndsock, SOL_SOCKET, SO_SNDBUF, (char *) &datalen,
+ sizeof(datalen)) < 0) {
+ perror("traceroute: SO_SNDBUF");
+ return;
+ }
+#endif /* SO_SNDBUF */
+
+ if (options & SO_DEBUG)
+ (void) setsockopt(sndsock, SOL_SOCKET, SO_DEBUG,
+ (char *) &on, sizeof(on));
+ if (options & SO_DONTROUTE)
+ (void) setsockopt(sndsock, SOL_SOCKET, SO_DONTROUTE,
+ (char *) &on, sizeof(on));
+
+ if (source == NULL) {
+ int alen;
+ int probe_fd = socket(AF_INET6, SOCK_DGRAM, 0);
+
+ if (probe_fd < 0) {
+ perror("socket");
+ return;
+ }
+ if (device) {
+ if (setsockopt
+ (probe_fd, SOL_SOCKET, SO_BINDTODEVICE, device,
+ strlen(device) + 1) == -1)
+ perror("WARNING: interface is ignored");
+ }
+ firsthop.sin6_port = htons(1025);
+ if (connect
+ (probe_fd, (struct sockaddr *) &firsthop,
+ sizeof(firsthop)) == -1) {
+ perror("connect");
+ return;
+ }
+ alen = sizeof(saddr);
+ if (getsockname(probe_fd, (struct sockaddr *) &saddr, &alen) ==
+ -1) {
+ perror("getsockname");
+ return;
+ }
+ saddr.sin6_port = 0;
+ close(probe_fd);
+ } else {
+ (void) bzero((char *) &saddr, sizeof(struct sockaddr_in6));
+ saddr.sin6_family = AF_INET6;
+ if (inet_pton(AF_INET6, source, &saddr.sin6_addr) < 0) {
+ Printf("traceroute: unknown addr %s\n", source);
+ return;
+ }
+ }
+
+ if (bind(sndsock, (struct sockaddr *) &saddr, sizeof(saddr)) < 0) {
+ perror("traceroute: bind sending socket");
+ return;
+ }
+ if (bind(icmp_sock, (struct sockaddr *) &saddr, sizeof(saddr)) < 0) {
+ perror("traceroute: bind icmp6 socket");
+ return;
+ }
+
+ Fprintf(stderr, "traceroute to %s (%s)", hostname,
+ inet_ntop(AF_INET6, &to->sin6_addr, pa, 64));
+
+ Fprintf(stderr, " from %s",
+ inet_ntop(AF_INET6, &saddr.sin6_addr, pa, 64));
+ Fprintf(stderr, ", %d hops max, %d byte packets\n",
+ item->traceRouteCtlMaxTtl, datalen);
+ (void) fflush(stderr);
+
+
+ struct traceRouteResultsTable_data *StorageResults = NULL;
+ netsnmp_variable_list *vars_results = NULL;
+
+ struct traceRouteHopsTable_data *StorageHops = NULL;
+ struct traceRouteHopsTable_data *temp = NULL;
+ struct traceRouteHopsTable_data *current_temp = NULL;
+ struct traceRouteHopsTable_data *current = NULL;
+
+ unsigned long index = 0;
+
+ struct traceRouteProbeHistoryTable_data *StorageProbe = NULL;
+ struct traceRouteProbeHistoryTable_data *temp_his = NULL;
+ struct traceRouteProbeHistoryTable_data *current_temp_his = NULL;
+ netsnmp_variable_list *vars_probe = NULL;
+
+ snmp_varlist_add_variable(&vars_results, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlOwnerIndex, item->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_results, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlTestName, item->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+ if ((StorageResults =
+ header_complex_get(traceRouteResultsTableStorage,
+ vars_results)) == NULL)
+ return;
+ snmp_free_varbind(vars_results);
+ vars_results = NULL;
+
+ for (ttl = item->traceRouteCtlInitialTtl;
+ ttl <= item->traceRouteCtlMaxTtl; ++ttl) {
+ struct in6_addr lastaddr = { {{0,}} };
+ int got_there = 0;
+ int unreachable = 0;
+ time_t timep = 0;
+ Printf("%2d ", ttl);
+
+
+ StorageResults->traceRouteResultsCurHopCount = ttl;
+ if (item->traceRouteCtlCreateHopsEntries == 1) {
+ if (ttl == item->traceRouteCtlInitialTtl) {
+
+ int k = 0;
+ count = traceRouteHopsTable_count(item);
+ struct traceRouteHopsTable_data *StorageTmp = NULL;
+ struct header_complex_index *hciptr2 = NULL;
+ netsnmp_variable_list *vars = NULL;
+ oid newoid[MAX_OID_LEN];
+ size_t newoid_len;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlOwnerIndex, item->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlTestName, item->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+
+ header_complex_generate_oid(newoid, &newoid_len, NULL,
+ 0, vars);
+
+ snmp_free_varbind(vars);
+ vars = NULL;
+
+ for (hciptr2 = traceRouteHopsTableStorage;
+ hciptr2 != NULL; hciptr2 = hciptr2->next) {
+ if (snmp_oid_compare
+ (newoid, newoid_len, hciptr2->name,
+ newoid_len) == 0) {
+ StorageTmp =
+ header_complex_extract_entry
+ (&traceRouteHopsTableStorage, hciptr2);
+
+ old_HopsAddress[k] =
+ (char *) malloc(StorageTmp->
+ traceRouteHopsIpTgtAddressLen
+ + 1);
+ if (old_HopsAddress[k] == NULL) {
+ exit(1);
+ }
+ memdup((u_char **) & old_HopsAddress[k],
+ StorageTmp->traceRouteHopsIpTgtAddress,
+ StorageTmp->
+ traceRouteHopsIpTgtAddressLen + 1);
+ old_HopsAddress[k][StorageTmp->
+ traceRouteHopsIpTgtAddressLen]
+ = '\0';
+
+ k++;
+ }
+ }
+ traceRouteHopsTable_del(item);
+ index = 0;
+ }
+
+ temp = SNMP_MALLOC_STRUCT(traceRouteHopsTable_data);
+ temp->traceRouteCtlOwnerIndex =
+ (char *) malloc(item->traceRouteCtlOwnerIndexLen + 1);
+ memcpy(temp->traceRouteCtlOwnerIndex,
+ item->traceRouteCtlOwnerIndex,
+ item->traceRouteCtlOwnerIndexLen + 1);
+ temp->traceRouteCtlOwnerIndex[item->
+ traceRouteCtlOwnerIndexLen] =
+ '\0';
+ temp->traceRouteCtlOwnerIndexLen =
+ item->traceRouteCtlOwnerIndexLen;
+
+ temp->traceRouteCtlTestName =
+ (char *) malloc(item->traceRouteCtlTestNameLen + 1);
+ memcpy(temp->traceRouteCtlTestName,
+ item->traceRouteCtlTestName,
+ item->traceRouteCtlTestNameLen + 1);
+ temp->traceRouteCtlTestName[item->
+ traceRouteCtlTestNameLen] =
+ '\0';
+ temp->traceRouteCtlTestNameLen =
+ item->traceRouteCtlTestNameLen;
+
+ /* add lock to protect */
+ pthread_mutex_t counter_mutex = PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_lock(&counter_mutex);
+ temp->traceRouteHopsHopIndex = ++index;
+ pthread_mutex_unlock(&counter_mutex);
+ /* endsadsadsad */
+
+
+ temp->traceRouteHopsIpTgtAddressType = 0;
+ temp->traceRouteHopsIpTgtAddress = strdup("");
+ temp->traceRouteHopsIpTgtAddressLen = 0;
+ temp->traceRouteHopsMinRtt = 0;
+ temp->traceRouteHopsMaxRtt = 0;
+ temp->traceRouteHopsAverageRtt = 0;
+ temp->traceRouteHopsRttSumOfSquares = 0;
+ temp->traceRouteHopsSentProbes = 0;
+ temp->traceRouteHopsProbeResponses = 0;
+
+ temp->traceRouteHopsLastGoodProbe = strdup("");
+ temp->traceRouteHopsLastGoodProbeLen = 0;
+ if (index == 1)
+ item->traceRouteHops = temp;
+ else {
+ (current_temp)->next = temp;
+ }
+
+ current_temp = temp;
+
+ if (index >= item->traceRouteCtlMaxTtl) {
+ current_temp->next = NULL;
+ }
+
+ if (item->traceRouteHops != NULL)
+
+ if (traceRouteHopsTable_add(current_temp) !=
+ SNMPERR_SUCCESS)
+ DEBUGMSGTL(("traceRouteHopsTable",
+ "registered an entry error\n"));
+
+ }
+
+ register unsigned long maxRtt = 0;
+ register unsigned long minRtt = 0;
+ register unsigned long averageRtt = 0;
+ register unsigned long sumRtt = 0;
+ register unsigned long responseProbe = 0;
+ register unsigned long sumOfSquare = 0;
+ for (probe = 0; probe < nprobes; ++probe) {
+ int cc = 0, reset_timer = 0;
+ struct timeval t1, t2;
+ struct timezone tz;
+ register unsigned long Rtt = 0;
+
+ gettimeofday(&t1, &tz);
+
+ send_probe_v6(++seq, ttl, sendbuff, ident, &tz, sndsock,
+ datalen, &whereto, hostname);
+ reset_timer = 1;
+
+ while ((cc =
+ wait_for_reply_v6(icmp_sock, &from, reset_timer,
+ waittime, icmp_sock,
+ packet)) != 0) {
+ gettimeofday(&t2, &tz);
+ timep = 0;
+ time(&timep);
+ if ((i =
+ packet_ok_v6(packet, cc, &from, seq, &t1,
+ ident))) {
+ reset_timer = 1;
+ if (memcmp
+ (&from.sin6_addr, &lastaddr,
+ sizeof(struct in6_addr))) {
+
+ memcpy(&lastaddr,
+ &from.sin6_addr,
+ sizeof(struct in6_addr));
+ }
+
+ Rtt = deltaT(&t1, &t2);
+ responseProbe = responseProbe + 1;
+ if (probe == 0) {
+ minRtt = Rtt;
+ maxRtt = Rtt;
+ averageRtt = Rtt;
+ sumRtt = Rtt;
+ sumOfSquare = Rtt * Rtt;
+ } else {
+ if (Rtt < minRtt)
+ minRtt = Rtt;
+ if (Rtt > maxRtt)
+ maxRtt = Rtt;
+ sumRtt = (sumRtt) + Rtt;
+ averageRtt =
+ round((double) (sumRtt) /
+ (double) responseProbe);
+ sumOfSquare = sumOfSquare + Rtt * Rtt;
+ }
+
+ StorageResults->traceRouteResultsCurProbeCount =
+ probe + 1;
+
+
+ switch (i - 1) {
+ case ICMPV6_PORT_UNREACH:
+ ++got_there;
+ break;
+
+ case ICMPV6_NOROUTE:
+ ++unreachable;
+ Printf(" !N");
+ break;
+ case ICMPV6_ADDR_UNREACH:
+ ++unreachable;
+ Printf(" !H");
+ break;
+
+ case ICMPV6_ADM_PROHIBITED:
+ ++unreachable;
+ Printf(" !S");
+ break;
+ }
+ break;
+ } else
+ reset_timer = 0;
+ }
+ if (cc == 0) {
+ timep = 0;
+ time(&timep);
+ Printf(" *");
+ Rtt = (item->traceRouteCtlTimeOut) * 1000;
+ }
+
+ if (item->traceRouteCtlMaxRows != 0) {
+
+ temp_his =
+ SNMP_MALLOC_STRUCT
+ (traceRouteProbeHistoryTable_data);
+ temp_his->traceRouteCtlOwnerIndex =
+ (char *) malloc(item->traceRouteCtlOwnerIndexLen +
+ 1);
+ memcpy(temp_his->traceRouteCtlOwnerIndex,
+ item->traceRouteCtlOwnerIndex,
+ item->traceRouteCtlOwnerIndexLen + 1);
+ temp_his->traceRouteCtlOwnerIndex[item->
+ traceRouteCtlOwnerIndexLen]
+ = '\0';
+ temp_his->traceRouteCtlOwnerIndexLen =
+ item->traceRouteCtlOwnerIndexLen;
+
+ temp_his->traceRouteCtlTestName =
+ (char *) malloc(item->traceRouteCtlTestNameLen +
+ 1);
+ memcpy(temp_his->traceRouteCtlTestName,
+ item->traceRouteCtlTestName,
+ item->traceRouteCtlTestNameLen + 1);
+ temp_his->traceRouteCtlTestName[item->
+ traceRouteCtlTestNameLen]
+ = '\0';
+ temp_his->traceRouteCtlTestNameLen =
+ item->traceRouteCtlTestNameLen;
+
+ /* add lock to protect */
+ pthread_mutex_t counter_mutex =
+ PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_lock(&counter_mutex);
+ if (item->traceRouteProbeHistoryMaxIndex >=
+ (unsigned long) (2147483647))
+ item->traceRouteProbeHistoryMaxIndex = 0;
+ temp_his->traceRouteProbeHistoryIndex =
+ ++(item->traceRouteProbeHistoryMaxIndex);
+ pthread_mutex_unlock(&counter_mutex);
+ /* endsadsadsad */
+ temp_his->traceRouteProbeHistoryHopIndex = ttl;
+ temp_his->traceRouteProbeHistoryProbeIndex = probe + 1;
+
+ temp_his->traceRouteProbeHistoryHAddrType = 2;
+ temp_his->traceRouteProbeHistoryHAddr =
+ (char *)
+ malloc(strlen
+ (inet_ntop
+ (AF_INET6, &from.sin6_addr, pa, 64)) + 1);
+ temp_his->traceRouteProbeHistoryHAddr =
+ strdup(inet_ntop
+ (AF_INET6, &from.sin6_addr, pa, 64));
+ temp_his->
+ traceRouteProbeHistoryHAddr[strlen
+ (inet_ntop
+ (AF_INET6,
+ &from.sin6_addr, pa,
+ 64))] = '\0';
+ temp_his->traceRouteProbeHistoryHAddrLen =
+ strlen(inet_ntop
+ (AF_INET6, &from.sin6_addr, pa, 64));
+
+ temp_his->traceRouteProbeHistoryResponse = Rtt;
+ temp_his->traceRouteProbeHistoryStatus = 1;
+ temp_his->traceRouteProbeHistoryLastRC = 0;
+
+ temp_his->traceRouteProbeHistoryTime =
+ (char *) malloc(strlen(asctime(gmtime(&timep))));
+ temp_his->traceRouteProbeHistoryTime =
+ strdup(asctime(gmtime(&timep)));
+ temp_his->
+ traceRouteProbeHistoryTime[strlen
+ (asctime
+ (gmtime(&timep))) -
+ 1] = '\0';
+ temp_his->traceRouteProbeHistoryTimeLen =
+ strlen(asctime(gmtime(&timep))) - 1;
+
+ if (probe == 0)
+ item->traceRouteProbeHis = temp_his;
+ else {
+ (current_temp_his)->next = temp_his;
+ }
+
+ current_temp_his = temp_his;
+
+ if (probe + 1 >= nprobes) {
+ current_temp_his->next = NULL;
+ }
+
+ if (item->traceRouteProbeHis != NULL)
+ if (traceRouteProbeHistoryTable_count(item) <
+ item->traceRouteCtlMaxRows) {
+ if (traceRouteProbeHistoryTable_add
+ (current_temp_his) != SNMPERR_SUCCESS)
+ DEBUGMSGTL(("traceRouteProbeHistoryTable",
+ "registered an entry error\n"));
+ } else {
+ traceRouteProbeHistoryTable_delLast(item);
+ if (traceRouteProbeHistoryTable_add
+ (current_temp_his) != SNMPERR_SUCCESS)
+ DEBUGMSGTL(("traceRouteProbeHistoryTable",
+ "registered an entry error\n"));
+
+ }
+
+
+ }
+ if (item->traceRouteCtlCreateHopsEntries == 1) {
+ netsnmp_variable_list *vars_hops = NULL;
+ snmp_varlist_add_variable(&vars_hops, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlOwnerIndex, item->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_hops, NULL, 0, ASN_OCTET_STR, (char *) item->traceRouteCtlTestName, item->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+ snmp_varlist_add_variable(&vars_hops, NULL, 0, ASN_UNSIGNED, (char *) &index, sizeof(index)); /* traceRouteHopsIndex */
+ if ((current =
+ header_complex_get(traceRouteHopsTableStorage,
+ vars_hops)) == NULL)
+ return;
+ current->traceRouteHopsIpTgtAddressType = 2;
+ current->traceRouteHopsIpTgtAddress =
+ (char *)
+ malloc(strlen
+ (inet_ntop
+ (AF_INET6, &from.sin6_addr, pa, 64)) + 1);
+ current->traceRouteHopsIpTgtAddress =
+ strdup(inet_ntop
+ (AF_INET6, &from.sin6_addr, pa, 64));
+ current->
+ traceRouteHopsIpTgtAddress[strlen
+ (inet_ntop
+ (AF_INET6,
+ &from.sin6_addr, pa,
+ 64))] = '\0';
+
+ if (count != 0) {
+ if (strcmp
+ (old_HopsAddress[index - 1],
+ current->traceRouteHopsIpTgtAddress) != 0)
+ flag = 1;
+ }
+
+ current->traceRouteHopsIpTgtAddressLen =
+ strlen(inet_ntop
+ (AF_INET6, &from.sin6_addr, pa, 64));
+ current->traceRouteHopsMinRtt = minRtt;
+ current->traceRouteHopsMaxRtt = maxRtt;
+ current->traceRouteHopsAverageRtt = averageRtt;
+ current->traceRouteHopsRttSumOfSquares = sumOfSquare;
+ current->traceRouteHopsSentProbes = probe + 1;
+ current->traceRouteHopsProbeResponses = responseProbe;
+ current->traceRouteHopsLastGoodProbe =
+ (char *) malloc(strlen(asctime(gmtime(&timep))));
+ current->traceRouteHopsLastGoodProbe =
+ strdup(asctime(gmtime(&timep)));
+ current->
+ traceRouteHopsLastGoodProbe[strlen
+ (asctime
+ (gmtime(&timep))) -
+ 1] = '\0';
+ current->traceRouteHopsLastGoodProbeLen =
+ strlen(asctime(gmtime(&timep))) - 1;
+
+ snmp_free_varbind(vars_hops);
+ vars_hops = NULL;
+ }
+
+
+ (void) fflush(stdout);
+ }
+ putchar('\n');
+
+
+ if (got_there || unreachable >= nprobes - 1) {
+
+
+ if (got_there != 0) {
+ StorageResults->traceRouteResultsTestAttempts =
+ StorageResults->traceRouteResultsTestAttempts + 1;
+
+ StorageResults->traceRouteResultsTestSuccesses =
+ StorageResults->traceRouteResultsTestSuccesses + 1;
+ StorageResults->traceRouteResultsLastGoodPath =
+ (char *) malloc(strlen(asctime(gmtime(&timep))) -
+ 1);
+ StorageResults->traceRouteResultsLastGoodPath =
+ strdup(asctime(gmtime(&timep)));
+ StorageResults->
+ traceRouteResultsLastGoodPath[strlen
+ (asctime
+ (gmtime(&timep))) -
+ 1] = '\0';
+ StorageResults->traceRouteResultsLastGoodPathLen =
+ strlen(asctime(gmtime(&timep))) - 1;
+ if ((item->
+ traceRouteCtlTrapGeneration[0] &
+ TRACEROUTETRAPGENERATION_TESTCOMPLETED) != 0) {
+ printf("TEST completed!\n");
+ send_traceRoute_trap(item, traceRouteTestCompleted,
+ sizeof
+ (traceRouteTestCompleted) /
+ sizeof(oid));
+ }
+ }
+
+ else {
+ StorageResults->traceRouteResultsTestAttempts =
+ StorageResults->traceRouteResultsTestAttempts + 1;
+ if ((item->
+ traceRouteCtlTrapGeneration[0] &
+ TRACEROUTETRAPGENERATION_TESTFAILED) != 0) {
+ printf("test Failed!\n");
+ send_traceRoute_trap(item, traceRouteTestFailed,
+ sizeof(traceRouteTestFailed) /
+ sizeof(oid));
+ }
+ }
+ break;
+
+ } else if (ttl == item->traceRouteCtlMaxTtl
+ && (probe + 1) == nprobes) {
+ StorageResults->traceRouteResultsTestAttempts =
+ StorageResults->traceRouteResultsTestAttempts + 1;
+
+ if ((item->
+ traceRouteCtlTrapGeneration[0] &
+ TRACEROUTETRAPGENERATION_TESTFAILED) != 0) {
+ printf("test Failed!\n");
+ send_ping_trap(item, traceRouteTestFailed,
+ sizeof(traceRouteTestFailed) /
+ sizeof(oid));
+ }
+ }
+
+ }
+
+ if (flag == 1) {
+ printf("path changed!\n");
+ send_traceRoute_trap(item, traceRoutePathChange,
+ sizeof(traceRoutePathChange) /
+ sizeof(oid));
+ }
+
+ int k = 0;
+ for (k = 0; k < count; k++) {
+ free(old_HopsAddress[k]);
+ old_HopsAddress[k] = NULL;
+ }
+
+ }
+ return;
+}
+
+
+int
+wait_for_reply(register int sock, register struct sockaddr_in *fromp,
+ register const struct timeval *tp, u_char * packet,
+ int waittime)
+{
+ fd_set fds;
+ struct timeval now, wait;
+ struct timezone tz;
+ register int cc = 0;
+ int fromlen = sizeof(*fromp);
+
+ FD_ZERO(&fds);
+ FD_SET(sock, &fds);
+ wait.tv_sec = tp->tv_sec + waittime;
+ wait.tv_usec = tp->tv_usec;
+ (void) gettimeofday(&now, &tz);
+ tvsub(&wait, &now);
+ if (select(sock + 1, &fds, NULL, NULL, &wait) > 0)
+ cc = recvfrom(sock, (char *) packet, 512, 0,
+ (struct sockaddr *) fromp, &fromlen);
+ return (cc);
+}
+
+
+int
+wait_for_reply_v6(int sock, struct sockaddr_in6 *from, int reset_timer,
+ int waittime, int icmp_sock, u_char * packet)
+{
+ fd_set fds;
+ static struct timeval wait;
+ int cc = 0;
+ int fromlen = sizeof(*from);
+
+ FD_ZERO(&fds);
+ FD_SET(sock, &fds);
+ if (reset_timer) {
+ /*
+ * traceroute could hang if someone else has a ping
+ * running and our ICMP reply gets dropped but we don't
+ * realize it because we keep waking up to handle those
+ * other ICMP packets that keep coming in. To fix this,
+ * "reset_timer" will only be true if the last packet that
+ * came in was for us or if this is the first time we're
+ * waiting for a reply since sending out a probe. Note
+ * that this takes advantage of the select() feature on
+ * Linux where the remaining timeout is written to the
+ * struct timeval area.
+ */
+ wait.tv_sec = waittime;
+ wait.tv_usec = 0;
+ }
+
+ if (select(sock + 1, &fds, (fd_set *) 0, (fd_set *) 0, &wait) > 0) {
+ cc = recvfrom(icmp_sock, (char *) packet, 512, 0,
+ (struct sockaddr *) from, &fromlen);
+ }
+
+ return (cc);
+}
+
+void
+send_probe(struct sockaddr_in *whereto, register int seq, int ttl,
+ register struct timeval *tp, register struct ip *outip,
+ register struct udphdr *outudp, int packlen, int optlen,
+ char *hostname, u_short ident, int sndsock, u_short port,
+ struct outdata *outdata)
+{
+ register int cc = 0;
+ register struct udpiphdr *ui = NULL, *oui = NULL;
+ struct ip tip;
+
+ outip->ip_ttl = ttl;
+#ifndef __hpux
+ outip->ip_id = htons(ident + seq);
+#endif
+
+ /*
+ * In most cases, the kernel will recalculate the ip checksum.
+ * But we must do it anyway so that the udp checksum comes out
+ * right.
+ */
+
+ outip->ip_sum =
+ in_checksum((u_short *) outip, sizeof(*outip) + optlen);
+ if (outip->ip_sum == 0)
+ outip->ip_sum = 0xffff;
+
+
+ /*
+ * Payload
+ */
+ outdata->seq = seq;
+ outdata->ttl = ttl;
+ outdata->tv = *tp;
+
+
+ outudp->dest = htons(port + seq);
+
+
+ /*
+ * Checksum (we must save and restore ip header)
+ */
+ tip = *outip;
+ ui = (struct udpiphdr *) outip;
+ oui = (struct udpiphdr *) &tip;
+ /*
+ * Easier to zero and put back things that are ok
+ */
+ memset((char *) ui, 0, sizeof(ui->ui_i));
+ ui->ui_src = oui->ui_src;
+ ui->ui_dst = oui->ui_dst;
+ ui->ui_pr = oui->ui_pr;
+ ui->ui_len = outudp->len;
+ outudp->check = 0;
+ outudp->check = in_checksum((u_short *) ui, packlen);
+ if (outudp->check == 0)
+ outudp->check = 0xffff;
+ *outip = tip;
+
+
+ /*
+ * XXX undocumented debugging hack
+ */
+
+
+#if !defined(IP_HDRINCL) && defined(IP_TTL)
+ printf("ttl\n");
+ if (setsockopt(sndsock, IPPROTO_IP, IP_TTL,
+ (char *) &ttl, sizeof(ttl)) < 0) {
+ Fprintf(stderr, "%s: setsockopt ttl %d: %s\n",
+ prog, ttl, strerror(errno));
+ exit(1);
+ }
+#endif
+
+#ifdef __hpux
+
+ Printf("whereto=%s\n",
+ inet_ntoa(((struct sockaddr_in *) whereto)->sin_addr));
+ cc = sendto(sndsock, (char *) outudp,
+ packlen - (sizeof(*outip) + optlen), 0, whereto,
+ sizeof(*whereto));
+ if (cc > 0)
+ cc += sizeof(*outip) + optlen;
+#else
+
+ cc = sendto(sndsock, (char *) outip,
+ packlen, 0, whereto, sizeof(*whereto));
+#endif
+ if (cc < 0 || cc != packlen) {
+ if (cc < 0)
+ Fprintf(stderr, "%s: sendto: %s\n", prog, strerror(errno));
+ Printf("%s: wrote %s %d chars, ret=%d\n",
+ prog, hostname, packlen, cc);
+ (void) fflush(stdout);
+ }
+}
+
+
+
+void
+send_probe_v6(int seq, int ttl, char *sendbuff, pid_t ident,
+ struct timezone *tz, int sndsock, int datalen,
+ struct sockaddr_in6 *whereto, char *hostname)
+{
+ struct pkt_format *pkt = (struct pkt_format *) sendbuff;
+ int i = 0;
+
+ pkt->ident = htonl(ident);
+ pkt->seq = htonl(seq);
+ gettimeofday(&pkt->tv, tz);
+
+ i = setsockopt(sndsock, SOL_IPV6, IPV6_UNICAST_HOPS, &ttl,
+ sizeof(int));
+ if (i < 0) {
+ perror("setsockopt");
+ exit(1);
+ }
+
+ do {
+ i = sendto(sndsock, sendbuff, datalen, 0,
+ (struct sockaddr *) whereto,
+ sizeof(struct sockaddr_in6));
+ } while (i < 0 && errno == ECONNREFUSED);
+
+ if (i < 0 || i != datalen) {
+ if (i < 0)
+ perror("sendto");
+ Printf("traceroute: wrote %s %d chars, ret=%d\n", hostname,
+ datalen, i);
+ (void) fflush(stdout);
+ }
+}
+
+
+unsigned long
+deltaT(struct timeval *t1p, struct timeval *t2p)
+{
+ register unsigned long dt;
+
+ dt = (unsigned long) ((long) (t2p->tv_sec - t1p->tv_sec) * 1000 +
+ (long) (t2p->tv_usec - t1p->tv_usec) / 1000);
+ return (dt);
+}
+
+
+int
+packet_ok(register u_char * buf, int cc, register struct sockaddr_in *from,
+ register int seq, u_short ident, int pmtu, u_short port)
+{
+ register struct icmp *icp = NULL;
+ register u_char type, code;
+ register int hlen = 0;
+#ifndef ARCHAIC
+ register struct ip *ip = NULL;
+
+ ip = (struct ip *) buf;
+ hlen = ip->ip_hl << 2;
+ if (cc < hlen + ICMP_MINLEN) {
+
+ return (0);
+ }
+ cc -= hlen;
+ icp = (struct icmp *) (buf + hlen);
+#else
+ icp = (struct icmp *) buf;
+#endif
+ type = icp->icmp_type;
+ code = icp->icmp_code;
+ /*
+ * Path MTU Discovery (RFC1191)
+ */
+ if (code != ICMP_UNREACH_NEEDFRAG)
+ pmtu = 0;
+ else {
+#ifdef HAVE_ICMP_NEXTMTU
+ pmtu = ntohs(icp->icmp_nextmtu);
+#else
+ pmtu = ntohs(((struct my_pmtu *) &icp->icmp_void)->ipm_nextmtu);
+#endif
+ }
+ if ((type == ICMP_TIMXCEED && code == ICMP_TIMXCEED_INTRANS) ||
+ type == ICMP_UNREACH || type == ICMP_ECHOREPLY) {
+ register struct ip *hip;
+ register struct udphdr *up;
+ register struct icmp *hicmp;
+
+ hip = &icp->icmp_ip;
+ hlen = hip->ip_hl << 2;
+ up = (struct udphdr *) ((u_char *) hip + hlen);
+ /*
+ * XXX 8 is a magic number
+ */
+ if (hlen + 12 <= cc &&
+ hip->ip_p == IPPROTO_UDP &&
+ up->source == htons(ident) && up->dest == htons(port + seq))
+ return (type == ICMP_TIMXCEED ? -1 : code + 1);
+ }
+
+
+ return (0);
+}
+
+
+
+
+int
+packet_ok_v6(u_char * buf, int cc, struct sockaddr_in6 *from, int seq,
+ struct timeval *tv, pid_t ident)
+{
+ struct icmp6hdr *icp = NULL;
+ u_char type, code;
+
+ icp = (struct icmp6hdr *) buf;
+
+ type = icp->icmp6_type;
+ code = icp->icmp6_code;
+
+ if ((type == ICMPV6_TIME_EXCEED && code == ICMPV6_EXC_HOPLIMIT) ||
+ type == ICMPV6_DEST_UNREACH) {
+ struct ipv6hdr *hip = NULL;
+ struct udphdr *up = NULL;
+ int nexthdr = 0;
+
+ hip = (struct ipv6hdr *) (icp + 1);
+ up = (struct udphdr *) (hip + 1);
+ nexthdr = hip->nexthdr;
+
+ if (nexthdr == 44) {
+ nexthdr = *(unsigned char *) up;
+ up++;
+ }
+ if (nexthdr == IPPROTO_UDP) {
+ struct pkt_format *pkt;
+
+ pkt = (struct pkt_format *) (up + 1);
+
+ if (ntohl(pkt->ident) == ident && ntohl(pkt->seq) == seq) {
+ *tv = pkt->tv;
+ return (type == ICMPV6_TIME_EXCEED ? -1 : code + 1);
+ }
+ }
+
+ }
+
+ return (0);
+}
+
+
+/*
+ * Checksum routine for Internet Protocol family headers (C Version)
+ */
+
+u_short
+in_checksum(register u_short * addr, register int len)
+{
+ register int nleft = len;
+ register u_short *w = addr;
+ register u_short answer;
+ register int sum = 0;
+
+ /*
+ * Our algorithm is simple, using a 32 bit accumulator (sum),
+ * we add sequential 16 bit words to it, and at the end, fold
+ * back all the carry bits from the top 16 bits into the lower
+ * 16 bits.
+ */
+ while (nleft > 1) {
+ sum += *w++;
+ nleft -= 2;
+ }
+
+ /*
+ * mop up an odd byte, if necessary
+ */
+ if (nleft == 1)
+ sum += *(u_char *) w;
+
+ /*
+ * add back carry outs from top 16 bits to low 16 bits
+ */
+ sum = (sum >> 16) + (sum & 0xffff); /* add hi 16 to low 16 */
+ sum += (sum >> 16); /* add carry */
+ answer = ~sum; /* truncate to 16 bits */
+ return (answer);
+}
+
+/*
+ * Subtract 2 timeval structs: out = out - in.
+ * Out is assumed to be >= in.
+ */
+void
+tvsub(register struct timeval *out, register struct timeval *in)
+{
+
+ if ((out->tv_usec -= in->tv_usec) < 0) {
+ --out->tv_sec;
+ out->tv_usec += 1000000;
+ }
+ out->tv_sec -= in->tv_sec;
+}
+
+
+struct hostinfo *
+gethostinfo(register char *hostname)
+{
+ register int n;
+ register struct hostent *hp = NULL;
+ register struct hostinfo *hi = NULL;
+ register char **p = NULL;
+ register u_int32_t addr, *ap = NULL;
+
+ if (strlen(hostname) > 64) {
+ Fprintf(stderr, "%s: hostname \"%.32s...\" is too long\n",
+ prog, hostname);
+ exit(1);
+ }
+ hi = calloc(1, sizeof(*hi));
+ if (hi == NULL) {
+ Fprintf(stderr, "%s: calloc %s\n", prog, strerror(errno));
+ exit(1);
+ }
+ addr = inet_addr(hostname);
+ if ((int32_t) addr != -1) {
+ hi->name = strdup(hostname);
+ hi->n = 1;
+ hi->addrs = calloc(1, sizeof(hi->addrs[0]));
+ if (hi->addrs == NULL) {
+ Fprintf(stderr, "%s: calloc %s\n", prog, strerror(errno));
+ exit(1);
+ }
+ hi->addrs[0] = addr;
+ return (hi);
+ }
+
+ hp = gethostbyname(hostname);
+ if (hp == NULL) {
+ Fprintf(stderr, "%s: unknown host %s\n", prog, hostname);
+ printf("hp=NULL\n");
+ exit(1);
+ }
+ if (hp->h_addrtype != AF_INET || hp->h_length != 4) {
+ Fprintf(stderr, "%s: bad host %s\n", prog, hostname);
+ exit(1);
+ }
+ hi->name = strdup(hp->h_name);
+ for (n = 0, p = hp->h_addr_list; *p != NULL; ++n, ++p)
+ continue;
+ hi->n = n;
+ hi->addrs = calloc(n, sizeof(hi->addrs[0]));
+ if (hi->addrs == NULL) {
+ Fprintf(stderr, "%s: calloc %s\n", prog, strerror(errno));
+ exit(1);
+ }
+ for (ap = hi->addrs, p = hp->h_addr_list; *p != NULL; ++ap, ++p)
+ memcpy(ap, *p, sizeof(*ap));
+ return (hi);
+}
+
+void
+freehostinfo(register struct hostinfo *hi)
+{
+ if (hi->name != NULL) {
+ free(hi->name);
+ hi->name = NULL;
+ }
+ free((char *) hi->addrs);
+ free((char *) hi);
+}
+
+void
+setsin(register struct sockaddr_in *sin, register u_int32_t addr)
+{
+
+ memset(sin, 0, sizeof(*sin));
+#ifdef HAVE_SOCKADDR_SA_LEN
+ sin->sin_len = sizeof(*sin);
+#endif
+ sin->sin_family = AF_INET;
+ sin->sin_addr.s_addr = addr;
+}
+
+
+/*
+ * Return the source address for the given destination address
+ */
+const char *
+findsaddr(register const struct sockaddr_in *to,
+ register struct sockaddr_in *from)
+{
+ register int i, n;
+ register FILE *f;
+ register u_int32_t mask;
+ u_int32_t dest, tmask;
+ struct ifaddrlist *al;
+ char buf[256], tdevice[256], device[256];
+ static char errbuf[132];
+ static const char route[] = "/proc/net/route";
+
+ if ((f = fopen(route, "r")) == NULL) {
+ sprintf(errbuf, "open %s: %.128s", route, strerror(errno));
+ return (errbuf);
+ }
+
+ /*
+ * Find the appropriate interface
+ */
+ n = 0;
+ mask = 0;
+ device[0] = '\0';
+ while (fgets(buf, sizeof(buf), f) != NULL) {
+ ++n;
+ if (n == 1 && strncmp(buf, "Iface", 5) == 0)
+ continue;
+ if ((i = sscanf(buf, "%s %x %*s %*s %*s %*s %*s %x",
+ tdevice, &dest, &tmask)) != 3)
+ return ("junk in buffer");
+ if ((to->sin_addr.s_addr & tmask) == dest &&
+ (tmask > mask || mask == 0)) {
+ mask = tmask;
+ strcpy(device, tdevice);
+ }
+ }
+ fclose(f);
+
+ if (device[0] == '\0')
+ return ("Can't find interface");
+
+ /*
+ * Get the interface address list
+ */
+ if ((n = ifaddrlist(&al, errbuf)) < 0)
+ return (errbuf);
+
+ if (n == 0)
+ return ("Can't find any network interfaces");
+
+ /*
+ * Find our appropriate source address
+ */
+ for (i = n; i > 0; --i, ++al)
+ if (strcmp(device, al->device) == 0)
+ break;
+ if (i <= 0) {
+ sprintf(errbuf, "Can't find interface \"%.32s\"", device);
+ return (errbuf);
+ }
+
+ setsin(from, al->addr);
+ return (NULL);
+}
+
+int
+ifaddrlist(register struct ifaddrlist **ipaddrp, register char *errbuf)
+{
+ register int fd, nipaddr;
+#ifdef HAVE_SOCKADDR_SA_LEN
+ register int n;
+#endif
+ register struct ifreq *ifrp, *ifend, *ifnext, *mp;
+ register struct sockaddr_in *sin;
+ register struct ifaddrlist *al;
+ struct ifconf ifc;
+ struct ifreq ibuf[(32 * 1024) / sizeof(struct ifreq)], ifr;
+#define MAX_IPADDR (sizeof(ibuf) / sizeof(ibuf[0]))
+ static struct ifaddrlist ifaddrlist[MAX_IPADDR];
+ char device[sizeof(ifr.ifr_name) + 1];
+
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if (fd < 0) {
+ (void) sprintf(errbuf, "socket: %s", strerror(errno));
+ return (-1);
+ }
+ ifc.ifc_len = sizeof(ibuf);
+ ifc.ifc_buf = (caddr_t) ibuf;
+
+ if (ioctl(fd, SIOCGIFCONF, (char *) &ifc) < 0 ||
+ ifc.ifc_len < sizeof(struct ifreq)) {
+ if (errno == EINVAL)
+ (void) sprintf(errbuf,
+ "SIOCGIFCONF: ifreq struct too small (%d bytes)",
+ sizeof(ibuf));
+ else
+ (void) sprintf(errbuf, "SIOCGIFCONF: %s", strerror(errno));
+ (void) close(fd);
+ return (-1);
+ }
+ ifrp = ibuf;
+ ifend = (struct ifreq *) ((char *) ibuf + ifc.ifc_len);
+
+ al = ifaddrlist;
+ mp = NULL;
+ nipaddr = 0;
+ for (; ifrp < ifend; ifrp = ifnext) {
+#ifdef HAVE_SOCKADDR_SA_LEN
+ n = ifrp->ifr_addr.sa_len + sizeof(ifrp->ifr_name);
+ if (n < sizeof(*ifrp))
+ ifnext = ifrp + 1;
+ else
+ ifnext = (struct ifreq *) ((char *) ifrp + n);
+ if (ifrp->ifr_addr.sa_family != AF_INET)
+ continue;
+#else
+ ifnext = ifrp + 1;
+#endif
+ /*
+ * Need a template to preserve address info that is
+ * used below to locate the next entry. (Otherwise,
+ * SIOCGIFFLAGS stomps over it because the requests
+ * are returned in a union.)
+ */
+ strncpy(ifr.ifr_name, ifrp->ifr_name, sizeof(ifr.ifr_name));
+ if (ioctl(fd, SIOCGIFFLAGS, (char *) &ifr) < 0) {
+ if (errno == ENXIO)
+ continue;
+ (void) sprintf(errbuf, "SIOCGIFFLAGS: %.*s: %s",
+ (int) sizeof(ifr.ifr_name), ifr.ifr_name,
+ strerror(errno));
+ (void) close(fd);
+ return (-1);
+ }
+
+ /*
+ * Must be up
+ */
+ if ((ifr.ifr_flags & IFF_UP) == 0)
+ continue;
+
+
+ (void) strncpy(device, ifr.ifr_name, sizeof(ifr.ifr_name));
+ device[sizeof(device) - 1] = '\0';
+#ifdef sun
+ /*
+ * Ignore sun virtual interfaces
+ */
+ if (strchr(device, ':') != NULL)
+ continue;
+#endif
+ if (ioctl(fd, SIOCGIFADDR, (char *) &ifr) < 0) {
+ (void) sprintf(errbuf, "SIOCGIFADDR: %s: %s",
+ device, strerror(errno));
+ (void) close(fd);
+ return (-1);
+ }
+
+ if (nipaddr >= MAX_IPADDR) {
+ (void) sprintf(errbuf, "Too many interfaces (%d)", MAX_IPADDR);
+ (void) close(fd);
+ return (-1);
+ }
+ sin = (struct sockaddr_in *) &ifr.ifr_addr;
+ al->addr = sin->sin_addr.s_addr;
+ al->device = strdup(device);
+ ++al;
+ ++nipaddr;
+ }
+ (void) close(fd);
+
+ *ipaddrp = ifaddrlist;
+ return (nipaddr);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteCtlTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteCtlTable.h
new file mode 100644
index 0000000000..da34f46208
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteCtlTable.h
@@ -0,0 +1,627 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:traceRouteCtlTable.h
+ *File Description:The head file of traceRouteCtlTable.c
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.create-dataset.conf,v 5.3 2002/12/05 00:29:45 hardaker Exp $
+ */
+#ifndef TRACEROUTECTLTABLE_H
+#define TRACEROUTECTLTABLE_H
+
+
+config_require(header_complex);
+
+struct traceRouteCtlTable_data {
+ char *traceRouteCtlOwnerIndex; /* string */
+ size_t traceRouteCtlOwnerIndexLen;
+
+ char *traceRouteCtlTestName; /* string */
+ size_t traceRouteCtlTestNameLen;
+
+
+ long traceRouteCtlTargetAddressType;
+
+ char *traceRouteCtlTargetAddress;
+ size_t traceRouteCtlTargetAddressLen;
+
+ long traceRouteCtlByPassRouteTable;
+
+ unsigned long traceRouteCtlDataSize;
+
+ unsigned long traceRouteCtlTimeOut;
+
+ unsigned long traceRouteCtlProbesPerHop;
+
+ unsigned long traceRouteCtlPort;
+
+ unsigned long traceRouteCtlMaxTtl;
+
+ unsigned long traceRouteCtlDSField;
+
+ long traceRouteCtlSourceAddressType;
+
+ char *traceRouteCtlSourceAddress;
+ size_t traceRouteCtlSourceAddressLen;
+
+ long traceRouteCtlIfIndex;
+
+ char *traceRouteCtlMiscOptions;
+ size_t traceRouteCtlMiscOptionsLen;
+
+ unsigned long traceRouteCtlMaxFailures;
+
+ long traceRouteCtlDontFragment;
+
+ unsigned long traceRouteCtlInitialTtl;
+
+ unsigned long traceRouteCtlFrequency;
+
+ long traceRouteCtlStorageType;
+
+ long traceRouteCtlAdminStatus;
+
+ char *traceRouteCtlDescr;
+ size_t traceRouteCtlDescrLen;
+
+ unsigned long traceRouteCtlMaxRows;
+
+ char *traceRouteCtlTrapGeneration;
+ size_t traceRouteCtlTrapGenerationLen;
+
+ long traceRouteCtlCreateHopsEntries;
+
+ oid *traceRouteCtlType;
+ size_t traceRouteCtlTypeLen;
+
+ long traceRouteCtlRowStatus;
+
+
+ int storageType;
+ u_long timer_id;
+ unsigned long traceRouteProbeHistoryMaxIndex;
+
+ struct traceRouteResultsTable_data *traceRouteResults;
+ struct traceRouteProbeHistoryTable_data *traceRouteProbeHis;
+ struct traceRouteHopsTable_data *traceRouteHops;
+
+};
+
+struct traceRouteResultsTable_data {
+ /* struct pingResultsTable_data *next; */
+ char *traceRouteCtlOwnerIndex; /* string */
+ size_t traceRouteCtlOwnerIndexLen;
+
+ char *traceRouteCtlTestName; /* string */
+ size_t traceRouteCtlTestNameLen;
+
+ long traceRouteResultsOperStatus;
+ unsigned long traceRouteResultsCurHopCount;
+ unsigned long traceRouteResultsCurProbeCount;
+ long traceRouteResultsIpTgtAddrType;
+ char *traceRouteResultsIpTgtAddr;
+ size_t traceRouteResultsIpTgtAddrLen;
+ unsigned long traceRouteResultsTestAttempts;
+ unsigned long traceRouteResultsTestSuccesses;
+ char *traceRouteResultsLastGoodPath;
+ size_t traceRouteResultsLastGoodPathLen;
+
+ int storageType;
+
+};
+
+struct traceRouteProbeHistoryTable_data {
+ struct traceRouteProbeHistoryTable_data *next;
+ /* index */
+ char *traceRouteCtlOwnerIndex; /* string */
+ size_t traceRouteCtlOwnerIndexLen;
+
+ char *traceRouteCtlTestName; /* string */
+ size_t traceRouteCtlTestNameLen;
+ unsigned long traceRouteProbeHistoryIndex;
+ unsigned long traceRouteProbeHistoryHopIndex;
+ unsigned long traceRouteProbeHistoryProbeIndex;
+ /* index */
+ long traceRouteProbeHistoryHAddrType;
+ char *traceRouteProbeHistoryHAddr;
+ size_t traceRouteProbeHistoryHAddrLen;
+ unsigned long traceRouteProbeHistoryResponse;
+ long traceRouteProbeHistoryStatus;
+ long traceRouteProbeHistoryLastRC;
+ char *traceRouteProbeHistoryTime;
+ size_t traceRouteProbeHistoryTimeLen;
+
+ int storageType;
+
+};
+
+struct traceRouteHopsTable_data {
+ struct traceRouteHopsTable_data *next;
+
+ char *traceRouteCtlOwnerIndex; /* string */
+ size_t traceRouteCtlOwnerIndexLen;
+
+ char *traceRouteCtlTestName; /* string */
+ size_t traceRouteCtlTestNameLen;
+
+ unsigned long traceRouteHopsHopIndex;
+ long traceRouteHopsIpTgtAddressType;
+ char *traceRouteHopsIpTgtAddress;
+ size_t traceRouteHopsIpTgtAddressLen;
+
+ unsigned long traceRouteHopsMinRtt;
+ unsigned long traceRouteHopsMaxRtt;
+ unsigned long traceRouteHopsAverageRtt;
+ unsigned long traceRouteHopsRttSumOfSquares;
+ unsigned long traceRouteHopsSentProbes;
+ unsigned long traceRouteHopsProbeResponses;
+ char *traceRouteHopsLastGoodProbe;
+ size_t traceRouteHopsLastGoodProbeLen;
+
+ int storageType;
+};
+/*
+ * function declarations
+ */
+void init_traceRouteCtlTable(void);
+FindVarMethod var_traceRouteCtlTable;
+void parse_traceRouteCtlTable(const char *, char *);
+SNMPCallback store_traceRouteCtlTable;
+void init_trResultsTable(struct traceRouteCtlTable_data *);
+
+WriteMethod write_traceRouteCtlTargetAddressType;
+WriteMethod write_traceRouteCtlTargetAddress;
+WriteMethod write_traceRouteCtlByPassRouteTable;
+WriteMethod write_traceRouteCtlDataSize;
+WriteMethod write_traceRouteCtlTimeOut;
+WriteMethod write_traceRouteCtlProbesPerHop;
+WriteMethod write_traceRouteCtlPort;
+WriteMethod write_traceRouteCtlMaxTtl;
+WriteMethod write_traceRouteCtlDSField;
+WriteMethod write_traceRouteCtlSourceAddressType;
+WriteMethod write_traceRouteCtlSourceAddress;
+WriteMethod write_traceRouteCtlIfIndex;
+WriteMethod write_traceRouteCtlMiscOptions;
+WriteMethod write_traceRouteCtlMaxFailures;
+WriteMethod write_traceRouteCtlDontFragment;
+WriteMethod write_traceRouteCtlInitialTtl;
+WriteMethod write_traceRouteCtlFrequency;
+WriteMethod write_traceRouteCtlStorageType;
+WriteMethod write_traceRouteCtlAdminStatus;
+WriteMethod write_traceRouteCtlDescr;
+WriteMethod write_traceRouteCtlMaxRows;
+WriteMethod write_traceRouteCtlTrapGeneration;
+WriteMethod write_traceRouteCtlCreateHopsEntries;
+WriteMethod write_traceRouteCtlType;
+
+WriteMethod write_traceRouteCtlRowStatus;
+
+
+
+#define TRACEROUTETRAPGENERATION_PATHCHANGE 0x80
+#define TRACEROUTETRAPGENERATION_TESTFAILED 0x40
+#define TRACEROUTETRAPGENERATION_TESTCOMPLETED 0x20
+#define TRACEROUTETRAPGENERATION_NULL 0x00
+
+
+/*
+ * column number definitions for table traceRouteCtlTable
+ */
+#define COLUMN_TRACEROUTECTLOWNERINDEX 1
+#define COLUMN_TRACEROUTECTLTESTNAME 2
+#define COLUMN_TRACEROUTECTLTARGETADDRESSTYPE 3
+#define COLUMN_TRACEROUTECTLTARGETADDRESS 4
+#define COLUMN_TRACEROUTECTLBYPASSROUTETABLE 5
+#define COLUMN_TRACEROUTECTLDATASIZE 6
+#define COLUMN_TRACEROUTECTLTIMEOUT 7
+#define COLUMN_TRACEROUTECTLPROBESPERHOP 8
+#define COLUMN_TRACEROUTECTLPORT 9
+#define COLUMN_TRACEROUTECTLMAXTTL 10
+#define COLUMN_TRACEROUTECTLDSFIELD 11
+#define COLUMN_TRACEROUTECTLSOURCEADDRESSTYPE 12
+#define COLUMN_TRACEROUTECTLSOURCEADDRESS 13
+#define COLUMN_TRACEROUTECTLIFINDEX 14
+#define COLUMN_TRACEROUTECTLMISCOPTIONS 15
+#define COLUMN_TRACEROUTECTLMAXFAILURES 16
+#define COLUMN_TRACEROUTECTLDONTFRAGMENT 17
+#define COLUMN_TRACEROUTECTLINITIALTTL 18
+#define COLUMN_TRACEROUTECTLFREQUENCY 19
+#define COLUMN_TRACEROUTECTLSTORAGETYPE 20
+#define COLUMN_TRACEROUTECTLADMINSTATUS 21
+#define COLUMN_TRACEROUTECTLDESCR 22
+#define COLUMN_TRACEROUTECTLMAXROWS 23
+#define COLUMN_TRACEROUTECTLTRAPGENERATION 24
+#define COLUMN_TRACEROUTECTLCREATEHOPSENTRIES 25
+#define COLUMN_TRACEROUTECTLTYPE 26
+#define COLUMN_TRACEROUTECTLROWSTATUS 27
+#endif /* TRACEROUTECTLTABLE_H */
+
+/*
+ * Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that: (1) source code distributions
+ * retain the above copyright notice and this paragraph in its entirety, (2)
+ * distributions including binary code include the above copyright notice and
+ * this paragraph in its entirety in the documentation or other materials
+ * provided with the distribution, and (3) all advertising materials mentioning
+ * features or use of this software display the following acknowledgement:
+ * ``This product includes software developed by the University of California,
+ * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
+ * the University nor the names of its contributors may be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#ifndef lint
+static const char copyright[] =
+ "@(#) Copyright (c) 1988, 1989, 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000\n\
+The Regents of the University of California. All rights reserved.\n";
+static const char rcsid[] =
+ "@(#)$Id: traceRouteCtlTable.h 10899 2004-08-24 15:15:03Z dts12 $ (LBL)";
+#endif
+
+/*
+ * traceroute host - trace the route ip packets follow going to "host".
+ *
+ * Attempt to trace the route an ip packet would follow to some
+ * internet host. We find out intermediate hops by launching probe
+ * packets with a small ttl (time to live) then listening for an
+ * icmp "time exceeded" reply from a gateway. We start our probes
+ * with a ttl of one and increase by one until we get an icmp "port
+ * unreachable" (which means we got to "host") or hit a max (which
+ * defaults to 30 hops & can be changed with the -m flag). Three
+ * probes (change with -q flag) are sent at each ttl setting and a
+ * line is printed showing the ttl, address of the gateway and
+ * round trip time of each probe. If the probe answers come from
+ * different gateways, the address of each responding system will
+ * be printed. If there is no response within a 5 sec. timeout
+ * interval (changed with the -w flag), a "*" is printed for that
+ * probe.
+ *
+ * Probe packets are UDP format. We don't want the destination
+ * host to process them so the destination port is set to an
+ * unlikely value (if some clod on the destination is using that
+ * value, it can be changed with the -p flag).
+ *
+ * A sample use might be:
+ *
+ * [yak 71]% traceroute nis.nsf.net.
+ * traceroute to nis.nsf.net (35.1.1.48), 30 hops max, 56 byte packet
+ * 1 helios.ee.lbl.gov (128.3.112.1) 19 ms 19 ms 0 ms
+ * 2 lilac-dmc.Berkeley.EDU (128.32.216.1) 39 ms 39 ms 19 ms
+ * 3 lilac-dmc.Berkeley.EDU (128.32.216.1) 39 ms 39 ms 19 ms
+ * 4 ccngw-ner-cc.Berkeley.EDU (128.32.136.23) 39 ms 40 ms 39 ms
+ * 5 ccn-nerif22.Berkeley.EDU (128.32.168.22) 39 ms 39 ms 39 ms
+ * 6 128.32.197.4 (128.32.197.4) 40 ms 59 ms 59 ms
+ * 7 131.119.2.5 (131.119.2.5) 59 ms 59 ms 59 ms
+ * 8 129.140.70.13 (129.140.70.13) 99 ms 99 ms 80 ms
+ * 9 129.140.71.6 (129.140.71.6) 139 ms 239 ms 319 ms
+ * 10 129.140.81.7 (129.140.81.7) 220 ms 199 ms 199 ms
+ * 11 nic.merit.edu (35.1.1.48) 239 ms 239 ms 239 ms
+ *
+ * Note that lines 2 & 3 are the same. This is due to a buggy
+ * kernel on the 2nd hop system -- lbl-csam.arpa -- that forwards
+ * packets with a zero ttl.
+ *
+ * A more interesting example is:
+ *
+ * [yak 72]% traceroute allspice.lcs.mit.edu.
+ * traceroute to allspice.lcs.mit.edu (18.26.0.115), 30 hops max
+ * 1 helios.ee.lbl.gov (128.3.112.1) 0 ms 0 ms 0 ms
+ * 2 lilac-dmc.Berkeley.EDU (128.32.216.1) 19 ms 19 ms 19 ms
+ * 3 lilac-dmc.Berkeley.EDU (128.32.216.1) 39 ms 19 ms 19 ms
+ * 4 ccngw-ner-cc.Berkeley.EDU (128.32.136.23) 19 ms 39 ms 39 ms
+ * 5 ccn-nerif22.Berkeley.EDU (128.32.168.22) 20 ms 39 ms 39 ms
+ * 6 128.32.197.4 (128.32.197.4) 59 ms 119 ms 39 ms
+ * 7 131.119.2.5 (131.119.2.5) 59 ms 59 ms 39 ms
+ * 8 129.140.70.13 (129.140.70.13) 80 ms 79 ms 99 ms
+ * 9 129.140.71.6 (129.140.71.6) 139 ms 139 ms 159 ms
+ * 10 129.140.81.7 (129.140.81.7) 199 ms 180 ms 300 ms
+ * 11 129.140.72.17 (129.140.72.17) 300 ms 239 ms 239 ms
+ * 12 * * *
+ * 13 128.121.54.72 (128.121.54.72) 259 ms 499 ms 279 ms
+ * 14 * * *
+ * 15 * * *
+ * 16 * * *
+ * 17 * * *
+ * 18 ALLSPICE.LCS.MIT.EDU (18.26.0.115) 339 ms 279 ms 279 ms
+ *
+ * (I start to see why I'm having so much trouble with mail to
+ * MIT.) Note that the gateways 12, 14, 15, 16 & 17 hops away
+ * either don't send ICMP "time exceeded" messages or send them
+ * with a ttl too small to reach us. 14 - 17 are running the
+ * MIT C Gateway code that doesn't send "time exceeded"s. God
+ * only knows what's going on with 12.
+ *
+ * The silent gateway 12 in the above may be the result of a bug in
+ * the 4.[23]BSD network code (and its derivatives): 4.x (x <= 3)
+ * sends an unreachable message using whatever ttl remains in the
+ * original datagram. Since, for gateways, the remaining ttl is
+ * zero, the icmp "time exceeded" is guaranteed to not make it back
+ * to us. The behavior of this bug is slightly more interesting
+ * when it appears on the destination system:
+ *
+ * 1 helios.ee.lbl.gov (128.3.112.1) 0 ms 0 ms 0 ms
+ * 2 lilac-dmc.Berkeley.EDU (128.32.216.1) 39 ms 19 ms 39 ms
+ * 3 lilac-dmc.Berkeley.EDU (128.32.216.1) 19 ms 39 ms 19 ms
+ * 4 ccngw-ner-cc.Berkeley.EDU (128.32.136.23) 39 ms 40 ms 19 ms
+ * 5 ccn-nerif35.Berkeley.EDU (128.32.168.35) 39 ms 39 ms 39 ms
+ * 6 csgw.Berkeley.EDU (128.32.133.254) 39 ms 59 ms 39 ms
+ * 7 * * *
+ * 8 * * *
+ * 9 * * *
+ * 10 * * *
+ * 11 * * *
+ * 12 * * *
+ * 13 rip.Berkeley.EDU (128.32.131.22) 59 ms ! 39 ms ! 39 ms !
+ *
+ * Notice that there are 12 "gateways" (13 is the final
+ * destination) and exactly the last half of them are "missing".
+ * What's really happening is that rip (a Sun-3 running Sun OS3.5)
+ * is using the ttl from our arriving datagram as the ttl in its
+ * icmp reply. So, the reply will time out on the return path
+ * (with no notice sent to anyone since icmp's aren't sent for
+ * icmp's) until we probe with a ttl that's at least twice the path
+ * length. I.e., rip is really only 7 hops away. A reply that
+ * returns with a ttl of 1 is a clue this problem exists.
+ * Traceroute prints a "!" after the time if the ttl is <= 1.
+ * Since vendors ship a lot of obsolete (DEC's Ultrix, Sun 3.x) or
+ * non-standard (HPUX) software, expect to see this problem
+ * frequently and/or take care picking the target host of your
+ * probes.
+ *
+ * Other possible annotations after the time are !H, !N, !P (got a host,
+ * network or protocol unreachable, respectively), !S or !F (source
+ * route failed or fragmentation needed -- neither of these should
+ * ever occur and the associated gateway is busted if you see one). If
+ * almost all the probes result in some kind of unreachable, traceroute
+ * will give up and exit.
+ *
+ * Notes
+ * -----
+ * This program must be run by root or be setuid. (I suggest that
+ * you *don't* make it setuid -- casual use could result in a lot
+ * of unnecessary traffic on our poor, congested nets.)
+ *
+ * This program requires a kernel mod that does not appear in any
+ * system available from Berkeley: A raw ip socket using proto
+ * IPPROTO_RAW must interpret the data sent as an ip datagram (as
+ * opposed to data to be wrapped in a ip datagram). See the README
+ * file that came with the source to this program for a description
+ * of the mods I made to /sys/netinet/raw_ip.c. Your mileage may
+ * vary. But, again, ANY 4.x (x < 4) BSD KERNEL WILL HAVE TO BE
+ * MODIFIED TO RUN THIS PROGRAM.
+ *
+ * The udp port usage may appear bizarre (well, ok, it is bizarre).
+ * The problem is that an icmp message only contains 8 bytes of
+ * data from the original datagram. 8 bytes is the size of a udp
+ * header so, if we want to associate replies with the original
+ * datagram, the necessary information must be encoded into the
+ * udp header (the ip id could be used but there's no way to
+ * interlock with the kernel's assignment of ip id's and, anyway,
+ * it would have taken a lot more kernel hacking to allow this
+ * code to set the ip id). So, to allow two or more users to
+ * use traceroute simultaneously, we use this task's pid as the
+ * source port (the high bit is set to move the port number out
+ * of the "likely" range). To keep track of which probe is being
+ * replied to (so times and/or hop counts don't get confused by a
+ * reply that was delayed in transit), we increment the destination
+ * port number before each probe.
+ *
+ * Don't use this as a coding example. I was trying to find a
+ * routing problem and this code sort-of popped out after 48 hours
+ * without sleep. I was amazed it ever compiled, much less ran.
+ *
+ * I stole the idea for this program from Steve Deering. Since
+ * the first release, I've learned that had I attended the right
+ * IETF working group meetings, I also could have stolen it from Guy
+ * Almes or Matt Mathis. I don't know (or care) who came up with
+ * the idea first. I envy the originators' perspicacity and I'm
+ * glad they didn't keep the idea a secret.
+ *
+ * Tim Seaver, Ken Adelman and C. Philip Wood provided bug fixes and/or
+ * enhancements to the original distribution.
+ *
+ * I've hacked up a round-trip-route version of this that works by
+ * sending a loose-source-routed udp datagram through the destination
+ * back to yourself. Unfortunately, SO many gateways botch source
+ * routing, the thing is almost worthless. Maybe one day...
+ *
+ * -- Van Jacobson (van@ee.lbl.gov)
+ * Tue Dec 20 03:50:13 PST 1988
+ */
+
+#include <sys/param.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#include <sys/socket.h>
+#include <sys/time.h>
+
+/* include <linux/ipv6.h> */
+/* include <linux/in6.h> */
+
+#include "in6.h"
+#include "ipv6.h"
+
+#include <linux/icmpv6.h>
+
+#include <netinet/in_systm.h>
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include "ip_var.h"
+#include <netinet/ip_icmp.h>
+#include <netinet/udp.h>
+#include "udp_var.h"
+
+/* include <linux/if.h> */
+#include <arpa/inet.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#include <memory.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "gnuc.h"
+#ifdef HAVE_OS_PROTO_H
+#include "os-proto.h"
+#endif
+
+#include <net/if.h>
+
+#if __linux__
+#include <endian.h>
+#endif
+
+
+
+/*
+ * rfc1716
+ */
+#ifndef ICMP_UNREACH_FILTER_PROHIB
+#define ICMP_UNREACH_FILTER_PROHIB 13 /* admin prohibited filter */
+#endif
+#ifndef ICMP_UNREACH_HOST_PRECEDENCE
+#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* host precedence violation */
+#endif
+#ifndef ICMP_UNREACH_PRECEDENCE_CUTOFF
+#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* precedence cutoff */
+#endif
+
+#define MAXPACKET 65535
+
+/*
+ * Maximum number of gateways (include room for one noop)
+ */
+#define NGATEWAYS ((int)((MAX_IPOPTLEN - IPOPT_MINOFF - 1) / sizeof(u_int32_t)))
+
+#ifndef MAXHOSTNAMELEN
+#define MAXHOSTNAMELEN 64
+#endif
+
+#ifndef FD_SET
+#define NFDBITS (8*sizeof(fd_set))
+#define FD_SETSIZE NFDBITS
+#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
+#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
+#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
+#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
+#endif
+
+#define Fprintf (void)fprintf
+#define Printf (void)printf
+
+/*
+ * Host name and address list
+ */
+struct hostinfo {
+ char *name;
+ int n;
+ u_int32_t *addrs;
+};
+
+/*
+ * Data section of the probe packet
+ */
+struct outdata {
+ u_char seq; /* sequence number of this packet */
+ u_char ttl; /* ttl packet left with */
+ struct timeval tv; /* time packet left */
+};
+
+#ifndef HAVE_ICMP_NEXTMTU
+/*
+ * Path MTU Discovery (RFC1191)
+ */
+struct my_pmtu {
+ u_short ipm_void;
+ u_short ipm_nextmtu;
+};
+#endif
+
+struct ifaddrlist {
+ u_int32_t addr;
+ char *device;
+};
+
+
+
+
+char *prog;
+
+struct pkt_format {
+ __u32 ident;
+ __u32 seq;
+ struct timeval tv;
+};
+
+
+extern int optind;
+extern int opterr;
+extern char *optarg;
+
+/*
+ * Forwards
+ */
+unsigned long deltaT(struct timeval *, struct timeval *);
+unsigned long round(double);
+void freehostinfo(struct hostinfo *);
+void getaddr(u_int32_t *, char *);
+struct hostinfo *gethostinfo(char *);
+u_short in_checksum(u_short *, int);
+char *inetname(struct in_addr);
+void run_traceRoute(unsigned int, void *);
+int packet_ok(u_char *, int, struct sockaddr_in *, int,
+ u_short, int, u_short);
+char *pr_type(u_char);
+ /* void print(u_char *, int, struct sockaddr_in *); */
+void send_probe(struct sockaddr_in *, int, int,
+ struct timeval *, struct ip *, struct udphdr *,
+ int, int, char *, u_short, int, u_short,
+ struct outdata *);
+int str2val(const char *, const char *, int, int);
+void tvsub(struct timeval *, struct timeval *);
+int wait_for_reply(int, struct sockaddr_in *,
+ const struct timeval *, u_char *, int);
+#ifndef HAVE_USLEEP
+int usleep(u_int);
+#endif
+void setsin(struct sockaddr_in *, u_int32_t);
+int ifaddrlist(struct ifaddrlist **, char *);
+const char *findsaddr(const struct sockaddr_in *,
+ struct sockaddr_in *);
+struct addrinfo *host_serv_tr(const char *, const char *, int, int);
+char *sock_ntop_host_tr(const struct sockaddr *, socklen_t);
+
+void send_probe_v6(int, int, char *, pid_t, struct timezone *,
+ int, int, struct sockaddr_in6 *, char *);
+int wait_for_reply_v6(int, struct sockaddr_in6 *, int, int,
+ int, u_char *);
+int packet_ok_v6(u_char *, int, struct sockaddr_in6 *, int,
+ struct timeval *, pid_t);
+void print_v6(unsigned char *, int, struct sockaddr_in6 *);
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteHopsTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteHopsTable.c
new file mode 100644
index 0000000000..7149129141
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteHopsTable.c
@@ -0,0 +1,409 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:traceRouteHopsTable.c
+ *File Description:Rows of traceRouteHopsTable MIB read.
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "traceRouteCtlTable.h"
+#include "traceRouteResultsTable.h"
+#include "traceRouteProbeHistoryTable.h"
+#include "traceRouteHopsTable.h"
+
+#include "header_complex.h"
+
+
+oid traceRouteHopsTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 81, 1, 5 };
+
+struct variable2 traceRouteHopsTable_variables[] = {
+ {COLUMN_TRACEROUTEHOPSIPTGTADDRESSTYPE, ASN_INTEGER, RONLY, var_traceRouteHopsTable, 2, {1, 2}},
+ {COLUMN_TRACEROUTEHOPSIPTGTADDRESS, ASN_OCTET_STR, RONLY, var_traceRouteHopsTable, 2, {1, 3}},
+ {COLUMN_TRACEROUTEHOPSMINRTT, ASN_UNSIGNED, RONLY, var_traceRouteHopsTable, 2, {1, 4}},
+ {COLUMN_TRACEROUTEHOPSMAXRTT, ASN_UNSIGNED, RONLY, var_traceRouteHopsTable, 2, {1, 5}},
+ {COLUMN_TRACEROUTEHOPSAVERAGERTT, ASN_UNSIGNED, RONLY, var_traceRouteHopsTable, 2, {1, 6}},
+ {COLUMN_TRACEROUTEHOPSRTTSUMOFSQUARES, ASN_UNSIGNED, RONLY, var_traceRouteHopsTable, 2, {1, 7}},
+ {COLUMN_TRACEROUTEHOPSSENTPROBES, ASN_UNSIGNED, RONLY, var_traceRouteHopsTable, 2, {1, 8}},
+ {COLUMN_TRACEROUTEHOPSPROBERESPONSES, ASN_UNSIGNED, RONLY, var_traceRouteHopsTable, 2, {1, 9}},
+ {COLUMN_TRACEROUTEHOPSLASTGOODPROBE, ASN_OCTET_STR, RONLY, var_traceRouteHopsTable, 2, {1, 10}}
+};
+
+
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+
+extern struct header_complex_index *traceRouteCtlTableStorage;
+extern struct header_complex_index *traceRouteHopsTableStorage;
+
+void
+traceRouteHopsTable_cleaner(struct header_complex_index *thestuff)
+{
+ struct header_complex_index *hciptr = NULL;
+ struct traceRouteHopsTable_data *StorageDel = NULL;
+ DEBUGMSGTL(("traceRouteHopsTable", "cleanerout "));
+ for (hciptr = thestuff; hciptr != NULL; hciptr = hciptr->next) {
+ StorageDel =
+ header_complex_extract_entry(&traceRouteHopsTableStorage,
+ hciptr);
+ if (StorageDel != NULL) {
+ free(StorageDel->traceRouteCtlOwnerIndex);
+ StorageDel->traceRouteCtlOwnerIndex = NULL;
+ free(StorageDel->traceRouteCtlTestName);
+ StorageDel->traceRouteCtlTestName = NULL;
+ free(StorageDel->traceRouteHopsLastGoodProbe);
+ StorageDel->traceRouteHopsLastGoodProbe = NULL;
+ free(StorageDel);
+ StorageDel = NULL;
+ }
+ DEBUGMSGTL(("traceRouteHopsTable", "cleaner "));
+ }
+
+}
+void
+init_traceRouteHopsTable(void)
+{
+
+ DEBUGMSGTL(("traceRouteHopsTable", "initializing... "));
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("traceRouteHopsTable", traceRouteHopsTable_variables,
+ variable2, traceRouteHopsTable_variables_oid);
+
+
+ /*
+ * register our config handler(s) to deal with registrations
+ */
+ snmpd_register_config_handler("traceRouteHopsTable",
+ parse_traceRouteHopsTable, NULL, NULL);
+
+ /*
+ * we need to be called back later to store our data
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_traceRouteHopsTable, NULL);
+
+ DEBUGMSGTL(("traceRouteHopsTable", "done.\n"));
+}
+
+/*
+ * parse_mteObjectsTable():
+ * parses .conf file entries needed to configure the mib.
+ */
+
+void
+parse_traceRouteHopsTable(const char *token, char *line)
+{
+ size_t tmpint;
+ struct traceRouteHopsTable_data *StorageTmp =
+ SNMP_MALLOC_STRUCT(traceRouteHopsTable_data);
+
+ DEBUGMSGTL(("traceRouteHopsTable", "parsing config... "));
+
+
+ if (StorageTmp == NULL) {
+ config_perror("malloc failure");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteCtlOwnerIndex,
+ &StorageTmp->traceRouteCtlOwnerIndexLen);
+ if (StorageTmp->traceRouteCtlOwnerIndex == NULL) {
+ config_perror("invalid specification for traceRouteCtlOwnerIndex");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteCtlTestName,
+ &StorageTmp->traceRouteCtlTestNameLen);
+ if (StorageTmp->traceRouteCtlTestName == NULL) {
+ config_perror("invalid specification for traceRouteCtlTestName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteHopsHopIndex,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->traceRouteHopsIpTgtAddressType,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteHopsIpTgtAddress,
+ &StorageTmp->traceRouteHopsIpTgtAddressLen);
+ if (StorageTmp->traceRouteHopsIpTgtAddress == NULL) {
+ config_perror
+ ("invalid specification for traceRouteHopsIpTgtAddress");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteHopsMinRtt, &tmpint);
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteHopsMaxRtt, &tmpint);
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteHopsAverageRtt,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteHopsRttSumOfSquares,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteHopsSentProbes,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteHopsProbeResponses,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteHopsLastGoodProbe,
+ &StorageTmp->traceRouteHopsLastGoodProbeLen);
+ if (StorageTmp->traceRouteHopsLastGoodProbe == NULL) {
+ config_perror
+ ("invalid specification for traceRouteHopsLastGoodProbe");
+ return;
+ }
+
+ traceRouteHopsTable_inadd(StorageTmp);
+
+ /* traceRouteHopsTable_cleaner(traceRouteHopsTableStorage); */
+
+ DEBUGMSGTL(("traceRouteHopsTable", "done.\n"));
+}
+
+
+
+
+
+/*
+ * store_traceRouteHopsTable():
+ * stores .conf file entries needed to configure the mib.
+ */
+
+int
+store_traceRouteHopsTable(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr = NULL;
+ size_t tmpint;
+ struct traceRouteHopsTable_data *StorageTmp = NULL;
+ struct header_complex_index *hcindex = NULL;
+
+
+ DEBUGMSGTL(("traceRouteHopsTable", "storing data... "));
+
+
+ for (hcindex = traceRouteHopsTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ StorageTmp = (struct traceRouteHopsTable_data *) hcindex->data;
+
+ if (StorageTmp->storageType != ST_READONLY) {
+ memset(line, 0, sizeof(line));
+ strcat(line, "traceRouteHopsTable ");
+ cptr = line + strlen(line);
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ traceRouteCtlOwnerIndex,
+ &StorageTmp->
+ traceRouteCtlOwnerIndexLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->traceRouteCtlTestName,
+ &StorageTmp->
+ traceRouteCtlTestNameLen);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->traceRouteHopsHopIndex,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ traceRouteHopsIpTgtAddressType,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ traceRouteHopsIpTgtAddress,
+ &StorageTmp->
+ traceRouteHopsIpTgtAddressLen);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->traceRouteHopsMinRtt,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->traceRouteHopsMaxRtt,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ traceRouteHopsAverageRtt, &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ traceRouteHopsRttSumOfSquares,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ traceRouteHopsSentProbes, &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ traceRouteHopsProbeResponses,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ traceRouteHopsLastGoodProbe,
+ &StorageTmp->
+ traceRouteHopsLastGoodProbeLen);
+
+ snmpd_store_config(line);
+ }
+ }
+ DEBUGMSGTL(("traceRouteHopsTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+int
+traceRouteHopsTable_inadd(struct traceRouteHopsTable_data *thedata)
+{
+ netsnmp_variable_list *vars_list = NULL;
+
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteHopsHopIndex, sizeof(thedata->traceRouteHopsHopIndex)); /* traceRouteHopsHopIndex */
+
+ DEBUGMSGTL(("traceRouteHopsTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+ header_complex_add_data(&traceRouteHopsTableStorage, vars_list,
+ thedata);
+ DEBUGMSGTL(("traceRouteHopsTable", "registered an entry\n"));
+
+
+ DEBUGMSGTL(("traceRouteHopsTable", "done.\n"));
+}
+
+
+/*
+ * var_traceRouteHopsTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_traceRouteHopsTable above.
+ */
+unsigned char *
+var_traceRouteHopsTable(struct variable *vp,
+ oid * name,
+ size_t *length,
+ int exact,
+ size_t *var_len, WriteMethod ** write_method)
+{
+
+
+ struct traceRouteHopsTable_data *StorageTmp = NULL;
+
+ *write_method = NULL;
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(traceRouteHopsTableStorage, vp, name, length,
+ exact, var_len, write_method)) == NULL) {
+ return NULL;
+ }
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+
+ switch (vp->magic) {
+
+ case COLUMN_TRACEROUTEHOPSIPTGTADDRESSTYPE:
+ *var_len = sizeof(StorageTmp->traceRouteHopsIpTgtAddressType);
+ return (u_char *) & StorageTmp->traceRouteHopsIpTgtAddressType;
+
+ case COLUMN_TRACEROUTEHOPSIPTGTADDRESS:
+ *var_len = (StorageTmp->traceRouteHopsIpTgtAddressLen);
+ return (u_char *) StorageTmp->traceRouteHopsIpTgtAddress;
+
+ case COLUMN_TRACEROUTEHOPSMINRTT:
+ *var_len = sizeof(StorageTmp->traceRouteHopsMinRtt);
+ return (u_char *) & StorageTmp->traceRouteHopsMinRtt;
+
+ case COLUMN_TRACEROUTEHOPSMAXRTT:
+ *var_len = sizeof(StorageTmp->traceRouteHopsMaxRtt);
+ return (u_char *) & StorageTmp->traceRouteHopsMaxRtt;
+
+ case COLUMN_TRACEROUTEHOPSAVERAGERTT:
+ *var_len = sizeof(StorageTmp->traceRouteHopsAverageRtt);
+ return (u_char *) & StorageTmp->traceRouteHopsAverageRtt;
+
+ case COLUMN_TRACEROUTEHOPSRTTSUMOFSQUARES:
+ *var_len = sizeof(StorageTmp->traceRouteHopsRttSumOfSquares);
+ return (u_char *) & StorageTmp->traceRouteHopsRttSumOfSquares;
+
+ case COLUMN_TRACEROUTEHOPSSENTPROBES:
+ *var_len = sizeof(StorageTmp->traceRouteHopsSentProbes);
+ return (u_char *) & StorageTmp->traceRouteHopsSentProbes;
+
+ case COLUMN_TRACEROUTEHOPSPROBERESPONSES:
+ *var_len = sizeof(StorageTmp->traceRouteHopsProbeResponses);
+ return (u_char *) & StorageTmp->traceRouteHopsProbeResponses;
+
+ case COLUMN_TRACEROUTEHOPSLASTGOODPROBE:
+ *var_len = (StorageTmp->traceRouteHopsLastGoodProbeLen);
+ return (u_char *) StorageTmp->traceRouteHopsLastGoodProbe;
+
+ default:
+ ERROR_MSG("");
+ }
+
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteHopsTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteHopsTable.h
new file mode 100644
index 0000000000..f7e7746bd8
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteHopsTable.h
@@ -0,0 +1,41 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:traceRouteHopsTable.h
+ *File Description:The head file of traceRouteHopsTable.c
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+
+#ifndef TRACEROUTEHOPSTABLE_H
+#define TRACEROUTEHOPSTABLE_H
+
+config_require(header_complex);
+
+/*
+ * function declarations
+ */
+void init_traceRouteHopsTable(void);
+FindVarMethod var_traceRouteHopsTable;
+void parse_traceRouteHopsTable(const char *, char *);
+SNMPCallback store_traceRouteHopsTable;
+
+/*
+ * column number definitions for table traceRouteHopsTable
+ */
+#define COLUMN_TRACEROUTEHOPSHOPINDEX 1
+#define COLUMN_TRACEROUTEHOPSIPTGTADDRESSTYPE 2
+#define COLUMN_TRACEROUTEHOPSIPTGTADDRESS 3
+#define COLUMN_TRACEROUTEHOPSMINRTT 4
+#define COLUMN_TRACEROUTEHOPSMAXRTT 5
+#define COLUMN_TRACEROUTEHOPSAVERAGERTT 6
+#define COLUMN_TRACEROUTEHOPSRTTSUMOFSQUARES 7
+#define COLUMN_TRACEROUTEHOPSSENTPROBES 8
+#define COLUMN_TRACEROUTEHOPSPROBERESPONSES 9
+#define COLUMN_TRACEROUTEHOPSLASTGOODPROBE 10
+#endif /* TRACEROUTEHOPSTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteProbeHistoryTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteProbeHistoryTable.c
new file mode 100644
index 0000000000..456efb9688
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteProbeHistoryTable.c
@@ -0,0 +1,408 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:traceRouteProbeHistoryTable.c
+ *File Description:Rows of traceRouteProbeHistoryTable MIB read.
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "traceRouteCtlTable.h"
+#include "traceRouteResultsTable.h"
+#include "traceRouteProbeHistoryTable.h"
+#include "traceRouteHopsTable.h"
+
+#include "header_complex.h"
+
+
+oid traceRouteProbeHistoryTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 81, 1, 4 };
+
+struct variable2 traceRouteProbeHistoryTable_variables[] = {
+ {COLUMN_TRACEROUTEPROBEHISTORYHADDRTYPE, ASN_INTEGER, RONLY, var_traceRouteProbeHistoryTable, 2, {1, 4}},
+ {COLUMN_TRACEROUTEPROBEHISTORYHADDR, ASN_OCTET_STR, RONLY, var_traceRouteProbeHistoryTable, 2, {1, 5}},
+ {COLUMN_TRACEROUTEPROBEHISTORYRESPONSE, ASN_UNSIGNED, RONLY, var_traceRouteProbeHistoryTable, 2, {1, 6}},
+ {COLUMN_TRACEROUTEPROBEHISTORYSTATUS, ASN_INTEGER, RONLY, var_traceRouteProbeHistoryTable, 2, {1, 7}},
+ {COLUMN_TRACEROUTEPROBEHISTORYLASTRC, ASN_INTEGER, RONLY, var_traceRouteProbeHistoryTable, 2, {1, 8}},
+ {COLUMN_TRACEROUTEPROBEHISTORYTIME, ASN_OCTET_STR, RONLY, var_traceRouteProbeHistoryTable, 2, {1, 9}}
+};
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+
+extern struct header_complex_index *traceRouteCtlTableStorage;
+extern struct header_complex_index *traceRouteProbeHistoryTableStorage;
+
+void
+traceRouteProbeHistoryTable_cleaner(struct header_complex_index *thestuff)
+{
+ struct header_complex_index *hciptr = NULL;
+ struct traceRouteProbeHistoryTable_data *StorageDel = NULL;
+ DEBUGMSGTL(("traceRouteProbeHistoryTable", "cleanerout "));
+ for (hciptr = thestuff; hciptr != NULL; hciptr = hciptr->next) {
+ StorageDel =
+ header_complex_extract_entry
+ (&traceRouteProbeHistoryTableStorage, hciptr);
+ if (StorageDel != NULL) {
+ free(StorageDel->traceRouteCtlOwnerIndex);
+ StorageDel->traceRouteCtlOwnerIndex = NULL;
+ free(StorageDel->traceRouteCtlTestName);
+ StorageDel->traceRouteCtlTestName = NULL;
+ free(StorageDel->traceRouteProbeHistoryHAddr);
+ StorageDel->traceRouteProbeHistoryHAddr = NULL;
+ free(StorageDel->traceRouteProbeHistoryTime);
+ StorageDel->traceRouteProbeHistoryTime = NULL;
+ free(StorageDel);
+ StorageDel = NULL;
+ }
+ DEBUGMSGTL(("traceRouteProbeHistoryTable", "cleaner "));
+ }
+
+}
+void
+init_traceRouteProbeHistoryTable(void)
+{
+
+ DEBUGMSGTL(("traceRouteProbeHistoryTable", "initializing... "));
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("traceRouteProbeHistoryTable",
+ traceRouteProbeHistoryTable_variables, variable2,
+ traceRouteProbeHistoryTable_variables_oid);
+
+
+ /*
+ * register our config handler(s) to deal with registrations
+ */
+ snmpd_register_config_handler("traceRouteProbeHistoryTable",
+ parse_traceRouteProbeHistoryTable, NULL,
+ NULL);
+
+ /*
+ * we need to be called back later to store our data
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_traceRouteProbeHistoryTable, NULL);
+
+ DEBUGMSGTL(("traceRouteProbeHistoryTable", "done.\n"));
+}
+
+/*
+ * parse_mteObjectsTable():
+ * parses .conf file entries needed to configure the mib.
+ */
+
+void
+parse_traceRouteProbeHistoryTable(const char *token, char *line)
+{
+ size_t tmpint;
+ struct traceRouteProbeHistoryTable_data *StorageTmp =
+ SNMP_MALLOC_STRUCT(traceRouteProbeHistoryTable_data);
+
+ DEBUGMSGTL(("traceRouteProbeHistoryTable", "parsing config... "));
+
+
+ if (StorageTmp == NULL) {
+ config_perror("malloc failure");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteCtlOwnerIndex,
+ &StorageTmp->traceRouteCtlOwnerIndexLen);
+ if (StorageTmp->traceRouteCtlOwnerIndex == NULL) {
+ config_perror("invalid specification for traceRouteCtlOwnerIndex");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteCtlTestName,
+ &StorageTmp->traceRouteCtlTestNameLen);
+ if (StorageTmp->traceRouteCtlTestName == NULL) {
+ config_perror("invalid specification for traceRouteCtlTestName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteProbeHistoryIndex,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteProbeHistoryHopIndex,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->
+ traceRouteProbeHistoryProbeIndex, &tmpint);
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->traceRouteProbeHistoryHAddrType,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteProbeHistoryHAddr,
+ &StorageTmp->traceRouteProbeHistoryHAddrLen);
+ if (StorageTmp->traceRouteProbeHistoryHAddr == NULL) {
+ config_perror
+ ("invalid specification for traceRouteProbeHistoryHAddr");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteProbeHistoryResponse,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->traceRouteProbeHistoryStatus,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->traceRouteProbeHistoryLastRC,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteProbeHistoryTime,
+ &StorageTmp->traceRouteProbeHistoryTimeLen);
+ if (StorageTmp->traceRouteProbeHistoryTime == NULL) {
+ config_perror
+ ("invalid specification for traceRouteProbeHistoryTime");
+ return;
+ }
+
+
+ traceRouteProbeHistoryTable_inadd(StorageTmp);
+
+ /* traceRouteProbeHistoryTable_cleaner(traceRouteProbeHistoryTableStorage); */
+
+ DEBUGMSGTL(("traceRouteProbeHistoryTable", "done.\n"));
+}
+
+
+
+
+
+/*
+ * store_traceRouteProbeHistoryTable():
+ * stores .conf file entries needed to configure the mib.
+ */
+
+int
+store_traceRouteProbeHistoryTable(int majorID, int minorID,
+ void *serverarg, void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr = NULL;
+ size_t tmpint;
+ struct traceRouteProbeHistoryTable_data *StorageTmp = NULL;
+ struct header_complex_index *hcindex = NULL;
+
+
+ DEBUGMSGTL(("traceRouteProbeHistoryTable", "storing data... "));
+
+
+ for (hcindex = traceRouteProbeHistoryTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ StorageTmp =
+ (struct traceRouteProbeHistoryTable_data *) hcindex->data;
+
+ if (StorageTmp->storageType != ST_READONLY) {
+ memset(line, 0, sizeof(line));
+ strcat(line, "traceRouteProbeHistoryTable ");
+ cptr = line + strlen(line);
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ traceRouteCtlOwnerIndex,
+ &StorageTmp->
+ traceRouteCtlOwnerIndexLen);
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->traceRouteCtlTestName,
+ &StorageTmp->
+ traceRouteCtlTestNameLen);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ traceRouteProbeHistoryIndex,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ traceRouteProbeHistoryHopIndex,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ traceRouteProbeHistoryProbeIndex,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ traceRouteProbeHistoryHAddrType,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ traceRouteProbeHistoryHAddr,
+ &StorageTmp->
+ traceRouteProbeHistoryHAddrLen);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ traceRouteProbeHistoryResponse,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ traceRouteProbeHistoryStatus,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ traceRouteProbeHistoryLastRC,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ traceRouteProbeHistoryTime,
+ &StorageTmp->
+ traceRouteProbeHistoryTimeLen);
+
+ snmpd_store_config(line);
+ }
+ }
+ DEBUGMSGTL(("traceRouteProbeHistoryTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+int
+traceRouteProbeHistoryTable_inadd(struct traceRouteProbeHistoryTable_data
+ *thedata)
+{
+ netsnmp_variable_list *vars_list = NULL;
+
+
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteProbeHistoryIndex, sizeof(thedata->traceRouteProbeHistoryIndex)); /* traceRouteProbeHistoryIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteProbeHistoryHopIndex, sizeof(thedata->traceRouteProbeHistoryHopIndex)); /* traceRouteProbeHistoryHopIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_UNSIGNED, (char *) &thedata->traceRouteProbeHistoryProbeIndex, sizeof(thedata->traceRouteProbeHistoryProbeIndex)); /* traceRouteProbeHistoryProbeIndex */
+
+
+ /*
+ * XXX: fill in default row values here into StorageNew
+ *
+ */
+
+
+ DEBUGMSGTL(("traceRouteProbeHistoryTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+ header_complex_add_data(&traceRouteProbeHistoryTableStorage, vars_list,
+ thedata);
+ DEBUGMSGTL(("traceRouteProbeHistoryTable", "registered an entry\n"));
+
+
+ DEBUGMSGTL(("traceRouteProbeHistoryTable", "done.\n"));
+}
+
+
+/*
+ * var_traceRouteProbeHistoryTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_traceRouteProbeHistoryTable above.
+ */
+unsigned char *
+var_traceRouteProbeHistoryTable(struct variable *vp,
+ oid * name,
+ size_t *length,
+ int exact,
+ size_t *var_len,
+ WriteMethod ** write_method)
+{
+
+
+ struct traceRouteProbeHistoryTable_data *StorageTmp = NULL;
+
+ *write_method = NULL;
+
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(traceRouteProbeHistoryTableStorage, vp, name,
+ length, exact, var_len, write_method)) == NULL) {
+ return NULL;
+ }
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+
+ switch (vp->magic) {
+
+ case COLUMN_TRACEROUTEPROBEHISTORYHADDRTYPE:
+ *var_len = sizeof(StorageTmp->traceRouteProbeHistoryHAddrType);
+ return (u_char *) & StorageTmp->traceRouteProbeHistoryHAddrType;
+
+ case COLUMN_TRACEROUTEPROBEHISTORYHADDR:
+ *var_len = (StorageTmp->traceRouteProbeHistoryHAddrLen);
+ return (u_char *) StorageTmp->traceRouteProbeHistoryHAddr;
+
+ case COLUMN_TRACEROUTEPROBEHISTORYRESPONSE:
+ *var_len = sizeof(StorageTmp->traceRouteProbeHistoryResponse);
+ return (u_char *) & StorageTmp->traceRouteProbeHistoryResponse;
+
+ case COLUMN_TRACEROUTEPROBEHISTORYSTATUS:
+ *var_len = sizeof(StorageTmp->traceRouteProbeHistoryStatus);
+ return (u_char *) & StorageTmp->traceRouteProbeHistoryStatus;
+
+ case COLUMN_TRACEROUTEPROBEHISTORYLASTRC:
+ *var_len = sizeof(StorageTmp->traceRouteProbeHistoryLastRC);
+ return (u_char *) & StorageTmp->traceRouteProbeHistoryLastRC;
+
+ case COLUMN_TRACEROUTEPROBEHISTORYTIME:
+ *var_len = (StorageTmp->traceRouteProbeHistoryTimeLen);
+ return (u_char *) StorageTmp->traceRouteProbeHistoryTime;
+
+ default:
+ ERROR_MSG("");
+ }
+
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteProbeHistoryTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteProbeHistoryTable.h
new file mode 100644
index 0000000000..e99d9484e1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteProbeHistoryTable.h
@@ -0,0 +1,39 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:traceRouteProbeHistoryTable.h
+ *File Description:The head file of traceRouteProbeHistoryTable.c
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+#ifndef TRACEROUTEPROBEHISTORYTABLE_H
+#define TRACEROUTEPROBEHISTORYTABLE_H
+
+config_require(header_complex);
+
+/*
+ * function declarations
+ */
+void init_traceRouteProbeHistoryTable(void);
+FindVarMethod var_traceRouteProbeHistoryTable;
+void parse_traceRouteProbeHistoryTable(const char *, char *);
+SNMPCallback store_traceRouteProbeHistoryTable;
+
+/*
+ * column number definitions for table traceRouteProbeHistoryTable
+ */
+#define COLUMN_TRACEROUTEPROBEHISTORYINDEX 1
+#define COLUMN_TRACEROUTEPROBEHISTORYHOPINDEX 2
+#define COLUMN_TRACEROUTEPROBEHISTORYPROBEINDEX 3
+#define COLUMN_TRACEROUTEPROBEHISTORYHADDRTYPE 4
+#define COLUMN_TRACEROUTEPROBEHISTORYHADDR 5
+#define COLUMN_TRACEROUTEPROBEHISTORYRESPONSE 6
+#define COLUMN_TRACEROUTEPROBEHISTORYSTATUS 7
+#define COLUMN_TRACEROUTEPROBEHISTORYLASTRC 8
+#define COLUMN_TRACEROUTEPROBEHISTORYTIME 9
+#endif /* TRACEROUTEPROBEHISTORYTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteResultsTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteResultsTable.c
new file mode 100644
index 0000000000..cc421e30f7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteResultsTable.c
@@ -0,0 +1,407 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:traceRouteResultsTable.c
+ *File Description:Rows of traceRouteResultsTable MIB read.
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.create-dataset.conf,v 5.3 2002/12/05 00:29:45 hardaker Exp $
+ */
+
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "traceRouteResultsTable.h"
+#include "traceRouteCtlTable.h"
+#include "traceRouteProbeHistoryTable.h"
+#include "traceRouteHopsTable.h"
+#include "header_complex.h"
+
+/*
+ *traceRouteResultsTable_variables_oid:
+ *
+ */
+oid traceRouteResultsTable_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 81, 1, 3 };
+
+struct variable2 traceRouteResultsTable_variables[] = {
+ {COLUMN_TRACEROUTERESULTSOPERSTATUS, ASN_INTEGER, RONLY, var_traceRouteResultsTable, 2, {1, 1}},
+ {COLUMN_TRACEROUTERESULTSCURHOPCOUNT, ASN_GAUGE, RONLY, var_traceRouteResultsTable, 2, {1, 2}},
+ {COLUMN_TRACEROUTERESULTSCURPROBECOUNT, ASN_GAUGE, RONLY, var_traceRouteResultsTable, 2, {1, 3}},
+ {COLUMN_TRACEROUTERESULTSIPTGTADDRTYPE, ASN_INTEGER, RONLY, var_traceRouteResultsTable, 2, {1, 4}},
+ {COLUMN_TRACEROUTERESULTSIPTGTADDR, ASN_OCTET_STR, RONLY, var_traceRouteResultsTable, 2, {1, 5}},
+ {COLUMN_TRACEROUTERESULTSTESTATTEMPTS, ASN_UNSIGNED, RONLY, var_traceRouteResultsTable, 2, {1, 6}},
+ {COLUMN_TRACEROUTERESULTSTESTSUCCESSES, ASN_UNSIGNED, RONLY, var_traceRouteResultsTable, 2, {1, 7}},
+ {COLUMN_TRACEROUTERESULTSLASTGOODPATH, ASN_OCTET_STR, RONLY, var_traceRouteResultsTable, 2, {1, 8}}
+};
+
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+
+extern struct header_complex_index *traceRouteCtlTableStorage;
+extern struct header_complex_index *traceRouteResultsTableStorage;
+
+void
+traceRouteResultsTable_cleaner(struct header_complex_index *thestuff)
+{
+ struct header_complex_index *hciptr = NULL;
+ struct traceRouteResultsTable_data *StorageDel = NULL;
+ DEBUGMSGTL(("traceRouteResultsTable", "cleanerout "));
+ for (hciptr = thestuff; hciptr != NULL; hciptr = hciptr->next) {
+ StorageDel =
+ header_complex_extract_entry(&traceRouteResultsTableStorage,
+ hciptr);
+ if (StorageDel != NULL) {
+ free(StorageDel->traceRouteCtlOwnerIndex);
+ StorageDel->traceRouteCtlOwnerIndex = NULL;
+ free(StorageDel->traceRouteCtlTestName);
+ StorageDel->traceRouteCtlTestName = NULL;
+ free(StorageDel->traceRouteResultsIpTgtAddr);
+ StorageDel->traceRouteResultsIpTgtAddr = NULL;
+ free(StorageDel->traceRouteResultsLastGoodPath);
+ StorageDel->traceRouteResultsLastGoodPath = NULL;
+ free(StorageDel);
+ StorageDel = NULL;
+
+ }
+ DEBUGMSGTL(("traceRouteResultsTable", "cleaner "));
+ }
+
+}
+
+void
+init_traceRouteResultsTable(void)
+{
+
+ DEBUGMSGTL(("traceRouteResultsTable", "initializing... "));
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("traceRouteResultsTable",
+ traceRouteResultsTable_variables, variable2,
+ traceRouteResultsTable_variables_oid);
+
+
+ /*
+ * register our config handler(s) to deal with registrations
+ */
+ snmpd_register_config_handler("traceRouteResultsTable",
+ parse_traceRouteResultsTable, NULL,
+ NULL);
+
+ /*
+ * we need to be called back later to store our data
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_traceRouteResultsTable, NULL);
+
+ DEBUGMSGTL(("traceRouteResultsTable", "done.\n"));
+}
+
+/*
+ * parse_mteObjectsTable():
+ * parses .conf file entries needed to configure the mib.
+ */
+
+void
+parse_traceRouteResultsTable(const char *token, char *line)
+{
+ size_t tmpint;
+ struct traceRouteResultsTable_data *StorageTmp =
+ SNMP_MALLOC_STRUCT(traceRouteResultsTable_data);
+
+ DEBUGMSGTL(("traceRouteResultsTable", "parsing config... "));
+
+
+ if (StorageTmp == NULL) {
+ config_perror("malloc failure");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteCtlOwnerIndex,
+ &StorageTmp->traceRouteCtlOwnerIndexLen);
+ if (StorageTmp->traceRouteCtlOwnerIndex == NULL) {
+ config_perror("invalid specification for traceRouteCtlOwnerIndex");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteCtlTestName,
+ &StorageTmp->traceRouteCtlTestNameLen);
+ if (StorageTmp->traceRouteCtlTestName == NULL) {
+ config_perror("invalid specification for traceRouteCtlTestName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->traceRouteResultsOperStatus,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_GAUGE, line,
+ &StorageTmp->traceRouteResultsCurHopCount,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_GAUGE, line,
+ &StorageTmp->traceRouteResultsCurProbeCount,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->traceRouteResultsIpTgtAddrType,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteResultsIpTgtAddr,
+ &StorageTmp->traceRouteResultsIpTgtAddrLen);
+ if (StorageTmp->traceRouteResultsIpTgtAddr == NULL) {
+ config_perror
+ ("invalid specification for traceRouteResultsIpTgtAddr");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteResultsTestAttempts,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_UNSIGNED, line,
+ &StorageTmp->traceRouteResultsTestSuccesses,
+ &tmpint);
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->traceRouteResultsLastGoodPath,
+ &StorageTmp->
+ traceRouteResultsLastGoodPathLen);
+ if (StorageTmp->traceRouteResultsLastGoodPath == NULL) {
+ config_perror
+ ("invalid specification for traceRouteResultsLastGoodPath!");
+ return;
+ }
+
+
+ traceRouteResultsTable_inadd(StorageTmp);
+
+ /* traceRouteResultsTable_cleaner(traceRouteResultsTableStorage); */
+
+ DEBUGMSGTL(("traceRouteResultsTable", "done.\n"));
+}
+
+
+
+
+
+/*
+ * store_traceRouteResultsTable():
+ * stores .conf file entries needed to configure the mib.
+ */
+
+int
+store_traceRouteResultsTable(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr = NULL;
+ size_t tmpint;
+ struct traceRouteResultsTable_data *StorageTmp = NULL;
+ struct header_complex_index *hcindex = NULL;
+
+
+ DEBUGMSGTL(("traceRouteResultsTable", "storing data... "));
+
+
+ for (hcindex = traceRouteResultsTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ StorageTmp = (struct traceRouteResultsTable_data *) hcindex->data;
+
+ if (StorageTmp->storageType != ST_READONLY) {
+ memset(line, 0, sizeof(line));
+ strcat(line, "traceRouteResultsTable ");
+ cptr = line + strlen(line);
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ traceRouteCtlOwnerIndex,
+ &StorageTmp->
+ traceRouteCtlOwnerIndexLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->traceRouteCtlTestName,
+ &StorageTmp->
+ traceRouteCtlTestNameLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ traceRouteResultsOperStatus,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_GAUGE, cptr,
+ &StorageTmp->
+ traceRouteResultsCurHopCount,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_GAUGE, cptr,
+ &StorageTmp->
+ traceRouteResultsCurProbeCount,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ traceRouteResultsIpTgtAddrType,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ traceRouteResultsIpTgtAddr,
+ &StorageTmp->
+ traceRouteResultsIpTgtAddrLen);
+
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ traceRouteResultsTestAttempts,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_UNSIGNED, cptr,
+ &StorageTmp->
+ traceRouteResultsTestSuccesses,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ traceRouteResultsLastGoodPath,
+ &StorageTmp->
+ traceRouteResultsLastGoodPathLen);
+
+ snmpd_store_config(line);
+ }
+ }
+ DEBUGMSGTL(("traceRouteResultsTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+int
+traceRouteResultsTable_inadd(struct traceRouteResultsTable_data *thedata)
+{
+ netsnmp_variable_list *vars_list = NULL;
+
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlOwnerIndex, thedata->traceRouteCtlOwnerIndexLen); /* traceRouteCtlOwnerIndex */
+ snmp_varlist_add_variable(&vars_list, NULL, 0, ASN_OCTET_STR, (char *) thedata->traceRouteCtlTestName, thedata->traceRouteCtlTestNameLen); /* traceRouteCtlTestName */
+
+ DEBUGMSGTL(("traceRouteResultsTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+ header_complex_add_data(&traceRouteResultsTableStorage, vars_list,
+ thedata);
+ DEBUGMSGTL(("traceRouteResultsTable", "registered an entry\n"));
+
+
+ DEBUGMSGTL(("traceRouteResultsTable", "done.\n"));
+}
+
+
+/*
+ * var_traceRouteResultsTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_traceRouteResultsTable above.
+ */
+unsigned char *
+var_traceRouteResultsTable(struct variable *vp,
+ oid * name,
+ size_t *length,
+ int exact,
+ size_t *var_len, WriteMethod ** write_method)
+{
+
+
+ struct traceRouteResultsTable_data *StorageTmp = NULL;
+
+ *write_method = NULL;
+
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp =
+ header_complex(traceRouteResultsTableStorage, vp, name, length,
+ exact, var_len, write_method)) == NULL) {
+ return NULL;
+ }
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+
+ switch (vp->magic) {
+
+ case COLUMN_TRACEROUTERESULTSOPERSTATUS:
+ *var_len = sizeof(StorageTmp->traceRouteResultsOperStatus);
+ return (u_char *) & StorageTmp->traceRouteResultsOperStatus;
+
+ case COLUMN_TRACEROUTERESULTSCURHOPCOUNT:
+ *var_len = sizeof(StorageTmp->traceRouteResultsCurHopCount);
+ return (u_char *) & StorageTmp->traceRouteResultsCurHopCount;
+
+ case COLUMN_TRACEROUTERESULTSCURPROBECOUNT:
+ *var_len = sizeof(StorageTmp->traceRouteResultsCurProbeCount);
+ return (u_char *) & StorageTmp->traceRouteResultsCurProbeCount;
+
+ case COLUMN_TRACEROUTERESULTSIPTGTADDRTYPE:
+ *var_len = sizeof(StorageTmp->traceRouteResultsIpTgtAddrType);
+ return (u_char *) & StorageTmp->traceRouteResultsIpTgtAddrType;
+
+ case COLUMN_TRACEROUTERESULTSIPTGTADDR:
+ *var_len = (StorageTmp->traceRouteResultsIpTgtAddrLen);
+ return (u_char *) StorageTmp->traceRouteResultsIpTgtAddr;
+
+ case COLUMN_TRACEROUTERESULTSTESTATTEMPTS:
+ *var_len = sizeof(StorageTmp->traceRouteResultsTestAttempts);
+ return (u_char *) & StorageTmp->traceRouteResultsTestAttempts;
+
+ case COLUMN_TRACEROUTERESULTSTESTSUCCESSES:
+ *var_len = sizeof(StorageTmp->traceRouteResultsTestSuccesses);
+ return (u_char *) & StorageTmp->traceRouteResultsTestSuccesses;
+
+ case COLUMN_TRACEROUTERESULTSLASTGOODPATH:
+ *var_len = (StorageTmp->traceRouteResultsLastGoodPathLen);
+ return (u_char *) StorageTmp->traceRouteResultsLastGoodPath;
+
+ default:
+ ERROR_MSG("");
+ }
+
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteResultsTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteResultsTable.h
new file mode 100644
index 0000000000..f31ffbf235
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/disman/traceroute/traceRouteResultsTable.h
@@ -0,0 +1,40 @@
+/*
+ *Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches.
+ *
+ *All right reserved
+ *
+ *File Name:traceRouteResultsTable.h
+ *File Description:The head file of traceRouteResultsTable.c
+ *
+ *Current Version:1.0
+ *Author:ChenJing
+ *Date:2004.8.20
+ */
+
+#ifndef TRACEROUTERESULTSTABLE_H
+#define TRACEROUTERESULTSTABLE_H
+
+
+config_require(header_complex);
+
+/*
+ * function declarations
+ */
+void init_traceRouteResultsTable(void);
+FindVarMethod var_traceRouteResultsTable;
+void parse_traceRouteResultsTable(const char *, char *);
+SNMPCallback store_traceRouteResultsTable;
+
+
+/*
+ * column number definitions for table traceRouteResultsTable
+ */
+#define COLUMN_TRACEROUTERESULTSOPERSTATUS 1
+#define COLUMN_TRACEROUTERESULTSCURHOPCOUNT 2
+#define COLUMN_TRACEROUTERESULTSCURPROBECOUNT 3
+#define COLUMN_TRACEROUTERESULTSIPTGTADDRTYPE 4
+#define COLUMN_TRACEROUTERESULTSIPTGTADDR 5
+#define COLUMN_TRACEROUTERESULTSTESTATTEMPTS 6
+#define COLUMN_TRACEROUTERESULTSTESTSUCCESSES 7
+#define COLUMN_TRACEROUTERESULTSLASTGOODPATH 8
+#endif /* TRACEROUTERESULTSTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples.h
new file mode 100644
index 0000000000..83d3ccb050
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples.h
@@ -0,0 +1,4 @@
+config_require(examples/scalar_int)
+config_require(examples/watched)
+config_require(examples/data_set)
+config_require(examples/delayed_instance)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/Makefile.dlmod b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/Makefile.dlmod
new file mode 100644
index 0000000000..13bf3e45ad
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/Makefile.dlmod
@@ -0,0 +1,34 @@
+#
+# Makefile for dynamically loadable module `example'
+#
+#DLMODDIR = $(libdir)/snmp/dlmod
+#UCDTOPDIR = $(top_srcdir)
+DLMODDIR = /usr/local/lib/snmp/dlmod
+UCDTOPDIR = /usr/home/strauss/src/ucd-snmp-ibr
+TARG = example.so
+OBJS = example.o
+CC = gcc
+CFLAGS = -I$(UCDTOPDIR) -I$(UCDTOPDIR)/snmplib -I$(UCDTOPDIR)/agent -I$(UCDTOPDIR)/agent/mibgroup -shared -fPIC
+#LD = ld
+#LDFLAGS = -G -o
+LD = gcc -shared -o
+LDFLAGS =
+INSTALL = install
+LIBS =
+
+all: $(TARG)
+
+.c.o:
+ $(CC) $(CFLAGS) -o $@ -c $<
+
+$(TARG): $(OBJS)
+ $(LD) $(LDFLAGS) $@ $(OBJS) $(LIBS)
+
+clean:
+ rm -f $(OBJS) $(TARG)
+
+install: all installdirs
+ $(INSTALL) $(TARG) $(DLMODDIR)
+
+installdirs:
+ @$(SHELL) $(UCDTOPDIR)/mkinstalldirs $(DLMODDIR)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/data_set.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/data_set.c
new file mode 100644
index 0000000000..daed8f3921
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/data_set.c
@@ -0,0 +1,206 @@
+/** @example data_set.c
+ * This example creates a table full of information and stores all
+ * that information within the agent's memory. The "table_dataset"
+ * helper routines take care of handling all aspects of SNMP requests
+ * as they come in (yay!).
+ *
+ * The exmaple we are instrumenting is an otherwise-useless table
+ * containing the names of IETF working group chairs. Obviously,
+ * this data isn't all that useful from a network management point of
+ * view but this example only demonstrates how to use and store data.
+ * For more useful examples (but more complex), check out the
+ * apps/notification_log.c file which implements parts of the
+ * NOTIFICATION-LOG-MIB for logging incoming SNMP notifications.
+ *
+ * Much of this code could be automatically generated by running
+ * mib2c as follows:
+ *
+ * - mib2c -c mib2c.create-dataset.conf netSnmpIETFWGTable
+ *
+ * The table is defined roughly as follows:
+ *
+ * <pre>
+ * % snmptranslate -m NET-SNMP-EXAMPLES-MIB -Tp -IR netSnmpIETFWGTable
+ * |+--netSnmpIETFWGTable(1)
+ * | |
+ * | +--netSnmpIETFWGEntry(1)
+ * | | Index: nsIETFWGName
+ * | |
+ * | +-- ---- String nsIETFWGName(1)
+ * | | Size: 1..32
+ * | +-- CR-- String nsIETFWGChair1(2)
+ * | +-- CR-- String nsIETFWGChair2(3)
+ * </pre>
+ *
+ * If this module is compiled into an agent, you should be able to
+ * issue snmp commands that look something like (valid authentication
+ * information not shown in these commands):
+ *
+ * <pre>
+ * % snmpwalk localhost netSnmpIETFWGTable
+ * nsIETFWGChair1."snmpv3" = "Russ Mundy"
+ * nsIETFWGChair2."snmpv3" = "David Harrington"
+ *
+ * % snmpset localhost nsIETFWGChair1.\"sming\" = "David Durham"
+ * nsIETFWGChair1."sming" = "David Durham"
+ *
+ * % snmpwalk localhost netSnmpIETFWGTable
+ * nsIETFWGChair1."sming" = "David Durham"
+ * nsIETFWGChair1."snmpv3" = "Russ Mundy"
+ * nsIETFWGChair2."snmpv3" = "David Harrington"
+ *
+ * In your snmpd.conf file, put the following line:
+ * add_row netSnmpIETFWGTable eos "Glenn Waters" "Dale Francisco"
+ *
+ * % snmpwalk localhost netSnmpIETFWGTable
+ * nsIETFWGChair1.\"eos\" = "Glenn Waters"
+ * nsIETFWGChair1.\"snmpv3\" = "Russ Mundy"
+ * nsIETFWGChair2.\"eos\" = "Dale Francisco"
+ * nsIETFWGChair2.\"snmpv3\" = "David Harrington"
+ * </pre>
+ */
+
+/*
+ * start be including the appropriate header files
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * our initialization routine, automatically called by the agent
+ */
+/*
+ * (to get called, the function name must match init_FILENAME()
+ */
+void
+init_data_set(void)
+{
+ netsnmp_table_data_set *table_set;
+ netsnmp_table_row *row;
+
+ /*
+ * the OID we want to register our integer at. This should be the
+ * * OID node for the entire table. In our case this is the
+ * * netSnmpIETFWGTable oid definition
+ */
+ oid my_registration_oid[] =
+ { 1, 3, 6, 1, 4, 1, 8072, 2, 2, 1 };
+
+ /*
+ * a debugging statement. Run the agent with -Dexample_data_set to see
+ * * the output of this debugging statement.
+ */
+ DEBUGMSGTL(("example_data_set",
+ "Initalizing example dataset table\n"));
+
+ /*
+ * It's going to be the "working group chairs" table, since I'm
+ * * sitting at an IETF convention while I'm writing this.
+ * *
+ * * column 1 = index = string = WG name
+ * * column 2 = string = chair #1
+ * * column 3 = string = chair #2 (most WGs have 2 chairs now)
+ */
+
+ table_set = netsnmp_create_table_data_set("netSnmpIETFWGTable");
+
+ /*
+ * allow the creation of new rows via SNMP SETs
+ */
+ table_set->allow_creation = 1;
+
+ /*
+ * set up what a row "should" look like, starting with the index
+ */
+ netsnmp_table_dataset_add_index(table_set, ASN_OCTET_STR);
+
+ /*
+ * define what the columns should look like. both are octet strings here
+ */
+ netsnmp_table_set_multi_add_default_row(table_set,
+ /*
+ * column 2 = OCTET STRING,
+ * writable = 1,
+ * default value = NULL,
+ * default value len = 0
+ */
+ 2, ASN_OCTET_STR, 1, NULL, 0,
+ /*
+ * similar
+ */
+ 3, ASN_OCTET_STR, 1, NULL, 0,
+ 0 /* done */ );
+
+ /*
+ * register the table
+ */
+ /*
+ * if we wanted to handle specific data in a specific way, or note
+ * * when requests came in we could change the NULL below to a valid
+ * * handler method in which we could over ride the default
+ * * behaviour of the table_dataset helper
+ */
+ netsnmp_register_table_data_set(netsnmp_create_handler_registration
+ ("netSnmpIETFWGTable", NULL,
+ my_registration_oid,
+ OID_LENGTH(my_registration_oid),
+ HANDLER_CAN_RWRITE), table_set, NULL);
+
+
+ /*
+ * create the a row for the table, and add the data
+ */
+ row = netsnmp_create_table_data_row();
+ /*
+ * set the index to the IETF WG name "snmpv3"
+ */
+ netsnmp_table_row_add_index(row, ASN_OCTET_STR, "snmpv3",
+ strlen("snmpv3"));
+
+
+ /*
+ * set column 2 to be the WG chair name "Russ Mundy"
+ */
+ netsnmp_set_row_column(row, 2, ASN_OCTET_STR,
+ "Russ Mundy", strlen("Russ Mundy"));
+ netsnmp_mark_row_column_writable(row, 2, 1); /* make writable via SETs */
+
+ /*
+ * set column 3 to be the WG chair name "David Harrington"
+ */
+ netsnmp_set_row_column(row, 3, ASN_OCTET_STR, "David Harrington",
+ strlen("David Harrington"));
+ netsnmp_mark_row_column_writable(row, 3, 1); /* make writable via SETs */
+
+ /*
+ * add the row to the table
+ */
+ netsnmp_table_dataset_add_row(table_set, row);
+
+#ifdef ADD_MORE_DATA
+ /*
+ * add the data, for the second row
+ */
+ row = netsnmp_create_table_data_row();
+ netsnmp_table_row_add_index(row, ASN_OCTET_STR, "snmpconf",
+ strlen("snmpconf"));
+ netsnmp_set_row_column(row, 2, ASN_OCTET_STR, "David Partain",
+ strlen("David Partain"));
+ netsnmp_mark_row_column_writable(row, 2, 1); /* make writable */
+ netsnmp_set_row_column(row, 3, ASN_OCTET_STR, "Jon Saperia",
+ strlen("Jon Saperia"));
+ netsnmp_mark_row_column_writable(row, 3, 1); /* make writable */
+ netsnmp_table_dataset_add_row(table_set, row);
+#endif
+
+ /*
+ * Finally, this actually allows the "add_row" token it the
+ * * snmpd.conf file to add rows to this table.
+ * * Example snmpd.conf line:
+ * * add_row netSnmpIETFWGTable eos "Glenn Waters" "Dale Francisco"
+ */
+ netsnmp_register_auto_data_table(table_set, NULL);
+
+ DEBUGMSGTL(("example_data_set", "Done initializing.\n"));
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/data_set.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/data_set.h
new file mode 100644
index 0000000000..e56f6007df
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/data_set.h
@@ -0,0 +1,15 @@
+#ifndef DATA_SET_H
+#define DATA_SET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void init_data_set(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DATA_SET_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/delayed_instance.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/delayed_instance.c
new file mode 100644
index 0000000000..850db8c61b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/delayed_instance.c
@@ -0,0 +1,256 @@
+/** @example delayed_instance.c
+ * This example implements the netSnmpExampleSleeper object.
+ *
+ * It demonstrates 2 things:
+ *
+ * - The instance helper, which is a way of registering an exact OID
+ * such that GENEXT requests are handled entirely by the helper.
+ *
+ * - how to implement objects which normally would block the agent as
+ * it waits for external events in such a way that the agent can
+ * continue responding to other requests while this implementation
+ * waits.
+ *
+ * - Added bonus: normally the nsTransactionTable is empty, since
+ * there aren't any outstanding requests generally. When accessed,
+ * this module will create some however. Try setting
+ * netSnmpExampleSleeper.0 to 10 and then accessing it (use
+ * "snmpget -t 15 ..." to access it), and then walk the
+ * nsTransactionTable from another shell to see that not only is
+ * the walk not blocked, but that the nsTransactionTable is not
+ * empty.
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "delayed_instance.h"
+
+static u_long delay_time = 1;
+
+void
+init_delayed_instance(void)
+{
+ static oid my_delayed_oid[] =
+ { 1, 3, 6, 1, 4, 1, 8072, 2, 1, 2, 0 };
+ /*
+ * delayed handler test
+ */
+ netsnmp_handler_registration *my_test;
+
+ my_test =
+ netsnmp_create_handler_registration("delayed_instance_example",
+ delayed_instance_handler,
+ my_delayed_oid,
+ OID_LENGTH(my_delayed_oid),
+ HANDLER_CAN_RWRITE);
+
+ netsnmp_register_instance(my_test);
+}
+
+#define DELAYED_INSTANCE_SET_NAME "test_delayed"
+
+int
+delayed_instance_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ DEBUGMSGTL(("delayed_instance", "Got request, mode = %d:\n",
+ reqinfo->mode));
+
+ switch (reqinfo->mode) {
+ /*
+ * here we merely mention that we'll answer this request
+ * later. we don't actually care about the mode type in this
+ * example, but for certain cases you may, so I'll leave in the
+ * otherwise useless switch and case statements
+ */
+
+ default:
+ /*
+ * mark this variable as something that can't be handled now.
+ * We'll answer it later.
+ */
+ requests->delegated = 1;
+
+ /*
+ * register an alarm to update the results at a later
+ * time. Normally, we might have to query something else
+ * (like an external request sent to a different network
+ * or system socket, etc), but for this example we'll do
+ * something really simply and just insert an alarm for a
+ * certain period of time
+ */
+ snmp_alarm_register(delay_time, /* seconds */
+ 0, /* dont repeat. */
+ return_delayed_response, /* the function
+ * to call */
+ /*
+ * here we create a "cache" of useful
+ * information that we'll want later
+ * on. This argument is passed back
+ * to us in the callback function for
+ * an alarm
+ */
+ (void *)
+ netsnmp_create_delegated_cache(handler,
+ reginfo,
+ reqinfo,
+ requests,
+ NULL));
+ break;
+
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+void
+return_delayed_response(unsigned int clientreg, void *clientarg)
+{
+ /*
+ * extract the cache from the passed argument
+ */
+ netsnmp_delegated_cache *cache = (netsnmp_delegated_cache *) clientarg;
+
+ netsnmp_request_info *requests;
+ netsnmp_agent_request_info *reqinfo;
+ u_long *delay_time_cache = NULL;
+
+ /*
+ * here we double check that the cache we created earlier is still
+ * * valid. If not, the request timed out for some reason and we
+ * * don't need to keep processing things. Should never happen, but
+ * * this double checks.
+ */
+ cache = netsnmp_handler_check_cache(cache);
+
+ if (!cache) {
+ snmp_log(LOG_ERR, "illegal call to return delayed response\n");
+ return;
+ }
+
+ /*
+ * re-establish the previous pointers we are used to having
+ */
+ reqinfo = cache->reqinfo;
+ requests = cache->requests;
+
+ DEBUGMSGTL(("delayed_instance",
+ "continuing delayed request, mode = %d\n",
+ cache->reqinfo->mode));
+
+ /*
+ * mention that it's no longer delegated, and we've now answered
+ * the query (which we'll do down below).
+ */
+ requests->delegated = 0;
+
+ switch (cache->reqinfo->mode) {
+ /*
+ * registering as an instance means we don't need to deal with
+ * getnext processing, so we don't handle it here at all.
+ *
+ * However, since the instance handler already reset the mode
+ * back to GETNEXT from the faked GET mode, we need to do the
+ * same thing in both cases. This should be fixed in future
+ * versions of net-snmp hopefully.
+ */
+
+ case MODE_GET:
+ case MODE_GETNEXT:
+ /*
+ * return the currend delay time
+ */
+ snmp_set_var_typed_value(cache->requests->requestvb,
+ ASN_INTEGER,
+ (u_char *) & delay_time,
+ sizeof(delay_time));
+ break;
+
+ case MODE_SET_RESERVE1:
+ /*
+ * check type
+ */
+ if (requests->requestvb->type != ASN_INTEGER) {
+ /*
+ * not an integer. Bad dog, no bone.
+ */
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_WRONGTYPE);
+ /*
+ * we don't need the cache any longer
+ */
+ netsnmp_free_delegated_cache(cache);
+ return;
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ /*
+ * store old value for UNDO support in the future.
+ */
+ memdup((u_char **) & delay_time_cache,
+ (u_char *) & delay_time, sizeof(delay_time));
+
+ /*
+ * malloc failed
+ */
+ if (delay_time_cache == NULL) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ netsnmp_free_delegated_cache(cache);
+ return;
+ }
+
+ /*
+ * Add our temporary information to the request itself.
+ * This is then retrivable later. The free function
+ * passed auto-frees it when the request is later
+ * deleted.
+ */
+ netsnmp_request_add_list_data(requests,
+ netsnmp_create_data_list
+ (DELAYED_INSTANCE_SET_NAME,
+ delay_time_cache, free));
+ break;
+
+ case MODE_SET_ACTION:
+ /*
+ * update current value
+ */
+ delay_time = *(requests->requestvb->val.integer);
+ DEBUGMSGTL(("testhandler", "updated delay_time -> %d\n",
+ delay_time));
+ break;
+
+ case MODE_SET_UNDO:
+ /*
+ * ack, something somewhere failed. We reset back to the
+ * previously old value by extracting the previosuly
+ * stored information back out of the request
+ */
+ delay_time =
+ *((u_long *) netsnmp_request_get_list_data(requests,
+ DELAYED_INSTANCE_SET_NAME));
+ break;
+
+ case MODE_SET_COMMIT:
+ case MODE_SET_FREE:
+ /*
+ * the only thing to do here is free the old memdup'ed
+ * value, but it's auto-freed by the datalist recovery, so
+ * we don't have anything to actually do here
+ */
+ break;
+ }
+
+ /*
+ * free the information cache
+ */
+ netsnmp_free_delegated_cache(cache);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/delayed_instance.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/delayed_instance.h
new file mode 100644
index 0000000000..9d0e5225ae
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/delayed_instance.h
@@ -0,0 +1,16 @@
+#ifndef DELAYED_INSTANCE_H
+#define DELAYED_INSTANCE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+Netsnmp_Node_Handler delayed_instance_handler;
+void init_delayed_instance(void);
+SNMPAlarmCallback return_delayed_response;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* DELAYED_INSTANCE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/example.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/example.c
new file mode 100644
index 0000000000..7af86636ea
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/example.c
@@ -0,0 +1,743 @@
+/*
+ * Template MIB group implementation - example.c
+ *
+ */
+
+/*
+ * include important headers
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+/*
+ * needed by util_funcs.h
+ */
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * header_generic() comes from here
+ */
+#include "util_funcs.h"
+
+/*
+ * include our .h file
+ */
+#include "example.h"
+
+
+ /*
+ * Certain objects can be set via configuration file directives.
+ * These variables hold the values for such objects, as they need to
+ * be accessible to both the config handlers, and the callback routine.
+ */
+#define EXAMPLE_STR_LEN 300
+#define EXAMPLE_STR_DEFAULT "life the universe and everything"
+int example_int = 42;
+char example_str[EXAMPLE_STR_LEN];
+
+ /*
+ * Forward declarations for the config handlers
+ */
+void example_parse_config_exampleint(const char *token,
+ char *cptr);
+void example_parse_config_examplestr(const char *token,
+ char *cptr);
+void example_free_config_exampleint(void);
+void example_free_config_examplestr(void);
+
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+
+ /*
+ * This array structure defines a representation of the
+ * MIB being implemented.
+ *
+ * The type of the array is 'struct variableN', where N is
+ * large enough to contain the longest OID sub-component
+ * being loaded. This will normally be the maximum value
+ * of the fifth field in each line. In this case, the second
+ * and third entries are both of size 2, so we're using
+ * 'struct variable2'
+ *
+ * The supported values for N are listed in <agent/var_struct.h>
+ * If the value you need is not listed there, simply use the
+ * next largest that is.
+ *
+ * The format of each line is as follows
+ * (using the first entry as an example):
+ * 1: EXAMPLESTRING:
+ * The magic number defined in the example header file.
+ * This is passed to the callback routine and is used
+ * to determine which object is being queried.
+ * 2: ASN_OCTET_STR:
+ * The type of the object.
+ * Valid types are listed in <snmp_impl.h>
+ * 3: RONLY (or RWRITE):
+ * Whether this object can be SET or not.
+ * 4: var_example:
+ * The callback routine, used when the object is queried.
+ * This will usually be the same for all objects in a module
+ * and is typically defined later in this file.
+ * 5: 1:
+ * The length of the OID sub-component (the next field)
+ * 6: {1}:
+ * The OID sub-components of this entry.
+ * In other words, the bits of the full OID that differ
+ * between the various entries of this array.
+ * This value is appended to the common prefix (defined later)
+ * to obtain the full OID of each entry.
+ */
+struct variable2 example_variables[] = {
+ {EXAMPLESTRING, ASN_OCTET_STR, RONLY, var_example, 1, {1}},
+ {EXAMPLEINTEGER, ASN_INTEGER, RWRITE, var_example, 2, {2, 1}},
+ {EXAMPLEOBJECTID, ASN_OBJECT_ID, RONLY, var_example, 2, {2, 2}},
+ {EXAMPLETIMETICKS, ASN_TIMETICKS, RONLY, var_example, 1, {3}},
+ {EXAMPLEIPADDRESS, ASN_IPADDRESS, RONLY, var_example, 1, {4}},
+ {EXAMPLECOUNTER, ASN_COUNTER, RONLY, var_example, 1, {5}},
+ {EXAMPLEGAUGE, ASN_GAUGE, RONLY, var_example, 1, {6}},
+ {EXAMPLETRIGGERTRAP, ASN_INTEGER, RWRITE, var_example, 1, {7}},
+ {EXAMPLETRIGGERTRAP2, ASN_INTEGER, RWRITE, var_example, 1, {8}}
+};
+
+ /*
+ * This array defines the OID of the top of the mib tree that we're
+ * registering underneath.
+ * Note that this needs to be the correct size for the OID being
+ * registered, so that the length of the OID can be calculated.
+ * The format given here is the simplest way to achieve this.
+ */
+oid example_variables_oid[] = { 1, 3, 6, 1, 4, 1, 2021, 254 };
+
+
+
+ /*
+ * This function is called at the time the agent starts up
+ * to do any initializations that might be required.
+ *
+ * In theory it is optional and can be omitted if no
+ * initialization is needed. In practise, every module
+ * will need to register itself (or the objects being
+ * implemented will not appear in the MIB tree), and this
+ * registration is typically done here.
+ *
+ * If this function is added or removed, you must re-run
+ * the configure script, to detect this change.
+ */
+void
+init_example(void)
+{
+ /*
+ * Register ourselves with the agent to handle our mib tree.
+ * The arguments are:
+ * descr: A short description of the mib group being loaded.
+ * var: The variable structure to load.
+ * (the name of the variable structure defined above)
+ * vartype: The type of this variable structure
+ * theoid: The OID pointer this MIB is being registered underneath.
+ */
+ REGISTER_MIB("example", example_variables, variable2,
+ example_variables_oid);
+
+
+ /*
+ * Register config handlers for the two objects that can be set
+ * via configuration file directive.
+ * Also set a default value for the string object. Note that the
+ * example integer variable was initialised above.
+ */
+ strncpy(example_str, EXAMPLE_STR_DEFAULT, EXAMPLE_STR_LEN);
+
+ snmpd_register_config_handler("exampleint",
+ example_parse_config_exampleint,
+ example_free_config_exampleint,
+ "exampleint value");
+ snmpd_register_config_handler("examplestr",
+ example_parse_config_examplestr,
+ example_free_config_examplestr,
+ "examplestr value");
+ snmpd_register_config_handler("examplestring",
+ example_parse_config_examplestr,
+ example_free_config_examplestr,
+ "examplestring value");
+
+ /*
+ * One common requirement is to read values from the kernel.
+ * This is usually initialised here, to speed up access when the
+ * information is read in, as a response to an incoming request.
+ *
+ * This module doesn't actually use this mechanism,
+ * so this call is commented out here.
+ */
+ /*
+ * auto_nlist( "example_symbol", 0, 0 );
+ */
+}
+
+ /*********************
+ *
+ * Configuration file handling functions
+ *
+ *********************/
+
+void
+example_parse_config_exampleint(const char *token, char *cptr)
+{
+ example_int = atoi(cptr);
+}
+
+void
+example_parse_config_examplestr(const char *token, char *cptr)
+{
+ /*
+ * Make sure the string fits in the space allocated for it.
+ */
+ if (strlen(cptr) < EXAMPLE_STR_LEN)
+ strcpy(example_str, cptr);
+ else {
+ /*
+ * Truncate the string if necessary.
+ * An alternative approach would be to log an error,
+ * and discard this value altogether.
+ */
+ strncpy(example_str, cptr, EXAMPLE_STR_LEN - 4);
+ example_str[EXAMPLE_STR_LEN - 4] = 0;
+ strcat(example_str, "...");
+ example_str[EXAMPLE_STR_LEN - 1] = 0;
+ }
+}
+
+ /*
+ * We don't need to do anything special when closing down
+ */
+void
+example_free_config_exampleint(void)
+{
+}
+
+void
+example_free_config_examplestr(void)
+{
+}
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+ /*
+ * Define the callback function used in the example_variables structure.
+ * This is called whenever an incoming request refers to an object
+ * within this sub-tree.
+ *
+ * Four of the parameters are used to pass information in.
+ * These are:
+ * vp The entry from the 'example_variables' array for the
+ * object being queried.
+ * name The OID from the request.
+ * length The length of this OID.
+ * exact A flag to indicate whether this is an 'exact' request
+ * (GET/SET) or an 'inexact' one (GETNEXT/GETBULK).
+ *
+ * Four of the parameters are used to pass information back out.
+ * These are:
+ * name The OID being returned.
+ * length The length of this OID.
+ * var_len The length of the answer being returned.
+ * write_method A pointer to the SET function for this object.
+ *
+ * Note that name & length serve a dual purpose in both roles.
+ */
+
+u_char *
+var_example(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * The result returned from this function needs to be a pointer to
+ * static data (so that it can be accessed from outside).
+ * Define suitable variables for any type of data we may return.
+ */
+ static char string[EXAMPLE_STR_LEN]; /* for EXAMPLESTRING */
+ static oid oid_ret[8]; /* for EXAMPLEOBJECTID */
+ static long long_ret; /* for everything else */
+
+ /*
+ * Before returning an answer, we need to check that the request
+ * refers to a valid instance of this object. The utility routine
+ * 'header_generic' can be used to do this for scalar objects.
+ *
+ * This routine 'header_simple_table' does the same thing for "simple"
+ * tables. (See the AGENT.txt file for the definition of a simple table).
+ *
+ * Both these utility routines also set up default values for the
+ * return arguments (assuming the check succeeded).
+ * The name and length are set suitably for the current object,
+ * var_len assumes that the result is an integer of some form,
+ * and write_method assumes that the object cannot be set.
+ *
+ * If these assumptions are correct, this callback routine simply
+ * needs to return a pointer to the appropriate value (using 'long_ret').
+ * Otherwise, 'var_len' and/or 'write_method' should be set suitably.
+ */
+ DEBUGMSGTL(("example", "var_example entered\n"));
+ if (header_generic(vp, name, length, exact, var_len, write_method) ==
+ MATCH_FAILED)
+ return NULL;
+
+
+ /*
+ * Many object will need to obtain data from the operating system in
+ * order to return the appropriate value. Typically, this is done
+ * here - immediately following the 'header' call, and before the
+ * switch statement. This is particularly appropriate if a single
+ * interface call can return data for all the objects supported.
+ *
+ * This example module does not rely on external data, so no such
+ * calls are needed in this case.
+ */
+
+ /*
+ * Now use the magic number from the variable pointer 'vp' to
+ * select the particular object being queried.
+ * In each case, one of the static objects is set up with the
+ * appropriate information, and returned mapped to a 'u_char *'
+ */
+ switch (vp->magic) {
+ case EXAMPLESTRING:
+ sprintf(string, example_str);
+ /*
+ * Note that the assumption that the answer will be an
+ * integer does not hold true in this case, so the length
+ * of the answer needs to be set explicitly.
+ */
+ *var_len = strlen(string);
+ return (u_char *) string;
+
+ case EXAMPLEINTEGER:
+ /*
+ * Here the length assumption is correct, but the
+ * object is writeable, so we need to set the
+ * write_method pointer as well as the current value.
+ */
+ long_ret = example_int;
+ *write_method = write_exampleint;
+ return (u_char *) & long_ret;
+
+ case EXAMPLEOBJECTID:
+ oid_ret[0] = 1;
+ oid_ret[1] = 3;
+ oid_ret[2] = 6;
+ oid_ret[3] = 1;
+ oid_ret[4] = 4;
+ oid_ret[5] = oid_ret[6] = oid_ret[7] = 42;
+ /*
+ * Again, the assumption regarding the answer length is wrong.
+ */
+ *var_len = 8 * sizeof(oid);
+ return (u_char *) oid_ret;
+
+ case EXAMPLETIMETICKS:
+ /*
+ * Here both assumptions are correct,
+ * so we just need to set up the answer.
+ */
+ long_ret = 363136200; /* 42 days, 42 minutes and 42.0 seconds */
+ return (u_char *) & long_ret;
+
+ case EXAMPLEIPADDRESS:
+ /*
+ * ipaddresses get returned as a long. ick
+ */
+ /*
+ * we're returning 127.0.0.1
+ */
+ long_ret = ntohl(INADDR_LOOPBACK);
+ return (u_char *) & long_ret;
+
+ case EXAMPLECOUNTER:
+ long_ret = 42;
+ return (u_char *) & long_ret;
+
+ case EXAMPLEGAUGE:
+ long_ret = 42; /* Do we detect a theme running through these answers? */
+ return (u_char *) & long_ret;
+
+ case EXAMPLETRIGGERTRAP:
+ /*
+ * This object is essentially "write-only".
+ * It only exists to trigger the sending of a trap.
+ * Reading it will always return 0.
+ */
+ long_ret = 0;
+ *write_method = write_exampletrap;
+ return (u_char *) & long_ret;
+
+ case EXAMPLETRIGGERTRAP2:
+ /*
+ * This object is essentially "write-only".
+ * It only exists to trigger the sending of a v2 trap.
+ * Reading it will always return 0.
+ */
+ long_ret = 0;
+ *write_method = write_exampletrap2;
+ return (u_char *) & long_ret;
+
+ default:
+ /*
+ * This will only be triggered if there's a problem with
+ * the coding of the module. SNMP requests that reference
+ * a non-existant OID will be directed elsewhere.
+ * If this branch is reached, log an error, so that
+ * the problem can be investigated.
+ */
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in examples/var_example\n",
+ vp->magic));
+ }
+ /*
+ * If we fall through to here, fail by returning NULL.
+ * This is essentially a continuation of the 'default' case above.
+ */
+ return NULL;
+}
+
+ /*********************
+ *
+ * Writeable object SET handling routines
+ *
+ *********************/
+int
+write_exampleint(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ /*
+ * Define an arbitrary maximum permissible value
+ */
+#define MAX_EXAMPLE_INT 100
+ static long intval;
+ static long old_intval;
+
+ switch (action) {
+ case RESERVE1:
+ /*
+ * Check that the value being set is acceptable
+ */
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("example", "%x not integer type", var_val_type));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(long)) {
+ DEBUGMSGTL(("example", "wrong length %x", var_val_len));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+
+ intval = *((long *) var_val);
+ if (intval > MAX_EXAMPLE_INT) {
+ DEBUGMSGTL(("example", "wrong value %x", intval));
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+
+ case RESERVE2:
+ /*
+ * This is conventially where any necesary
+ * resources are allocated (e.g. calls to malloc)
+ * Here, we are using static variables
+ * so don't need to worry about this.
+ */
+ break;
+
+ case FREE:
+ /*
+ * This is where any of the above resources
+ * are freed again (because one of the other
+ * values being SET failed for some reason).
+ * Again, since we are using static variables
+ * we don't need to worry about this either.
+ */
+ break;
+
+ case ACTION:
+ /*
+ * Set the variable as requested.
+ * Note that this may need to be reversed,
+ * so save any information needed to do this.
+ */
+ old_intval = example_int;
+ example_int = intval;
+ break;
+
+ case UNDO:
+ /*
+ * Something failed, so re-set the
+ * variable to its previous value
+ * (and free any allocated resources).
+ */
+ example_int = old_intval;
+ break;
+
+ case COMMIT:
+ /*
+ * Everything worked, so we can discard any
+ * saved information, and make the change
+ * permanent (e.g. write to the config file).
+ * We also free any allocated resources.
+ *
+ * In this case, there's nothing to do.
+ */
+ break;
+
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_exampletrap(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ long intval;
+
+ DEBUGMSGTL(("example", "write_exampletrap entered: action=%d\n",
+ action));
+ switch (action) {
+ case RESERVE1:
+ /*
+ * The only acceptable value is the integer 1
+ */
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("example", "%x not integer type", var_val_type));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(long)) {
+ DEBUGMSGTL(("example", "wrong length %x", var_val_len));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+
+ intval = *((long *) var_val);
+ if (intval != 1) {
+ DEBUGMSGTL(("example", "wrong value %x", intval));
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+
+ case RESERVE2:
+ /*
+ * No resources are required....
+ */
+ break;
+
+ case FREE:
+ /*
+ * ... so no resources need be freed
+ */
+ break;
+
+ case ACTION:
+ /*
+ * Having triggered the sending of a trap,
+ * it would be impossible to revoke this,
+ * so we can't actually invoke the action here.
+ */
+ break;
+
+ case UNDO:
+ /*
+ * We haven't done anything yet,
+ * so there's nothing to undo
+ */
+ break;
+
+ case COMMIT:
+ /*
+ * Everything else worked, so it's now safe
+ * to trigger the trap.
+ * Note that this is *only* acceptable since
+ * the trap sending routines are "failsafe".
+ * (In fact, they can fail, but they return no
+ * indication of this, which is the next best thing!)
+ */
+ DEBUGMSGTL(("example", "write_exampletrap sending the trap\n"));
+ send_easy_trap(SNMP_TRAP_ENTERPRISESPECIFIC, 99);
+ DEBUGMSGTL(("example", "write_exampletrap trap sent\n"));
+ break;
+
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+/*
+ * this documents how to send a SNMPv2 (and higher) trap via the
+ * send_v2trap() API.
+ *
+ * Coding SNMP-v2 Trap:
+ *
+ * The SNMPv2-Trap PDU contains at least a pair of object names and
+ * values: - sysUpTime.0 whose value is the time in hundredths of a
+ * second since the netwok management portion of system was last
+ * reinitialized. - snmpTrapOID.0 which is part of the trap group SNMPv2
+ * MIB whose value is the object-id of the specific trap you have defined
+ * in your own MIB. Other variables can be added to caracterize the
+ * trap.
+ *
+ * The function send_v2trap adds automaticallys the two objects but the
+ * value of snmpTrapOID.0 is 0.0 by default. If you want to add your trap
+ * name, you have to reconstruct this object and to add your own
+ * variable.
+ *
+ */
+
+
+
+int
+write_exampletrap2(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ long intval;
+
+ /*
+ * these variales will be used when we send the trap
+ */
+ oid objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 }; /* snmpTrapOID.0 */
+ oid demo_trap[] = { 1, 3, 6, 1, 4, 1, 2021, 13, 990 }; /*demo-trap */
+ oid example_string_oid[] =
+ { 1, 3, 6, 1, 4, 1, 2021, 254, 1, 0 };
+ static netsnmp_variable_list var_trap;
+ static netsnmp_variable_list var_obj;
+
+ DEBUGMSGTL(("example", "write_exampletrap2 entered: action=%d\n",
+ action));
+ switch (action) {
+ case RESERVE1:
+ /*
+ * The only acceptable value is the integer 1
+ */
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("example", "%x not integer type", var_val_type));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(long)) {
+ DEBUGMSGTL(("example", "wrong length %x", var_val_len));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+
+ intval = *((long *) var_val);
+ if (intval != 1) {
+ DEBUGMSGTL(("example", "wrong value %x", intval));
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+
+ case RESERVE2:
+ /*
+ * No resources are required....
+ */
+ break;
+
+ case FREE:
+ /*
+ * ... so no resources need be freed
+ */
+ break;
+
+ case ACTION:
+ /*
+ * Having triggered the sending of a trap,
+ * it would be impossible to revoke this,
+ * so we can't actually invoke the action here.
+ */
+ break;
+
+ case UNDO:
+ /*
+ * We haven't done anything yet,
+ * so there's nothing to undo
+ */
+ break;
+
+ case COMMIT:
+ /*
+ * Everything else worked, so it's now safe
+ * to trigger the trap.
+ * Note that this is *only* acceptable since
+ * the trap sending routines are "failsafe".
+ * (In fact, they can fail, but they return no
+ * indication of this, which is the next best thing!)
+ */
+
+ /*
+ * trap definition objects
+ */
+
+ var_trap.next_variable = &var_obj; /* next variable */
+ var_trap.name = objid_snmptrap; /* snmpTrapOID.0 */
+ var_trap.name_length = sizeof(objid_snmptrap) / sizeof(oid); /* number of sub-ids */
+ var_trap.type = ASN_OBJECT_ID;
+ var_trap.val.objid = demo_trap; /* demo-trap objid */
+ var_trap.val_len = sizeof(demo_trap); /* length in bytes (not number of subids!) */
+
+
+ /*
+ * additional objects
+ */
+
+
+ var_obj.next_variable = NULL; /* No more variables after this one */
+ var_obj.name = example_string_oid;
+ var_obj.name_length = sizeof(example_string_oid) / sizeof(oid); /* number of sub-ids */
+ var_obj.type = ASN_OCTET_STR; /* type of variable */
+ var_obj.val.string = example_str; /* value */
+ var_obj.val_len = strlen(example_str);
+ DEBUGMSGTL(("example", "write_exampletrap2 sending the v2 trap\n"));
+ send_v2trap(&var_trap);
+ DEBUGMSGTL(("example", "write_exampletrap2 v2 trap sent\n"));
+
+ break;
+
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/example.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/example.h
new file mode 100644
index 0000000000..9de5748447
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/example.h
@@ -0,0 +1,67 @@
+/*
+ * Template MIB group interface - example.h
+ *
+ */
+
+/*
+ * Don't include ourselves twice
+ */
+#ifndef _MIBGROUP_EXAMPLE_H
+#define _MIBGROUP_EXAMPLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * We use 'header_generic' from the util_funcs module,
+ * so make sure this module is included in the agent.
+ */
+config_require(util_funcs)
+
+
+ /*
+ * Declare our publically-visible functions.
+ * Typically, these will include the initialization and shutdown functions,
+ * the main request callback routine and any writeable object methods.
+ *
+ * Function prototypes are provided for the callback routine ('FindVarMethod')
+ * and writeable object methods ('WriteMethod').
+ */
+ void init_example(void);
+ FindVarMethod var_example;
+ WriteMethod write_exampleint;
+ WriteMethod write_exampletrap;
+ WriteMethod write_exampletrap2;
+
+
+ /*
+ * Magic number definitions.
+ * These must be unique for each object implemented within a
+ * single mib module callback routine.
+ *
+ * Typically, these will be the last OID sub-component for
+ * each entry, or integers incrementing from 1.
+ * (which may well result in the same values anyway).
+ *
+ * Here, the second and third objects are form a 'sub-table' and
+ * the magic numbers are chosen to match these OID sub-components.
+ * This is purely for programmer convenience.
+ * All that really matters is that the numbers are unique.
+ */
+
+#define EXAMPLESTRING 1
+#define EXAMPLEINTEGER 21
+#define EXAMPLEOBJECTID 22
+#define EXAMPLETIMETICKS 3
+#define EXAMPLEIPADDRESS 4
+#define EXAMPLECOUNTER 5
+#define EXAMPLEGAUGE 6
+#define EXAMPLETRIGGERTRAP 7
+#define EXAMPLETRIGGERTRAP2 8
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MIBGROUP_EXAMPLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable.c
new file mode 100644
index 0000000000..714eca8241
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable.c
@@ -0,0 +1,566 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate_access.conf,v 1.4 2003/07/01 00:15:11 hardaker Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "netSnmpHostsTable.h"
+#include "netSnmpHostsTable_checkfns.h"
+#include "netSnmpHostsTable_access.h"
+
+static netsnmp_oid_stash_node *undoStorage = NULL;
+static netsnmp_oid_stash_node *commitStorage = NULL;
+
+struct undoInfo {
+ void *ptr;
+ size_t len;
+};
+
+struct commitInfo {
+ void *data_context;
+ int have_committed;
+ int new_row;
+};
+
+void
+netSnmpHostsTable_free_undoInfo(void *vptr)
+{
+ struct undoInfo *ui = vptr;
+ if (!ui)
+ return;
+ SNMP_FREE(ui->ptr);
+ SNMP_FREE(ui);
+}
+
+/** Initialize the netSnmpHostsTable table by defining its contents and how it's structured */
+void
+initialize_table_netSnmpHostsTable(void)
+{
+ static oid netSnmpHostsTable_oid[] =
+ { 1, 3, 6, 1, 4, 1, 8072, 2, 2, 2 };
+ netsnmp_table_registration_info *table_info;
+ netsnmp_handler_registration *my_handler;
+ netsnmp_iterator_info *iinfo;
+
+ /** create the table registration information structures */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+ /** if your table is read only, it's easiest to change the
+ HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */
+ my_handler = netsnmp_create_handler_registration("netSnmpHostsTable",
+ netSnmpHostsTable_handler,
+ netSnmpHostsTable_oid,
+ OID_LENGTH
+ (netSnmpHostsTable_oid),
+ HANDLER_CAN_RWRITE);
+
+ if (!my_handler || !table_info || !iinfo) {
+ snmp_log(LOG_ERR,
+ "malloc failed in initialize_table_netSnmpHostsTable");
+ return; /** Serious error. */
+ }
+
+ /***************************************************
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(table_info, ASN_OCTET_STR,
+ /** index: netSnmpHostName */
+ 0);
+
+ /** Define the minimum and maximum accessible columns. This
+ optimizes retrival. */
+ table_info->min_column = 2;
+ table_info->max_column = 5;
+
+ /** iterator access routines */
+ iinfo->get_first_data_point = netSnmpHostsTable_get_first_data_point;
+ iinfo->get_next_data_point = netSnmpHostsTable_get_next_data_point;
+
+ /** you may wish to set these as well */
+ iinfo->make_data_context = netSnmpHostsTable_context_convert_function;
+ iinfo->free_data_context = netSnmpHostsTable_data_free;
+ iinfo->free_loop_context_at_end = netSnmpHostsTable_loop_free;
+
+ /** tie the two structures together */
+ iinfo->table_reginfo = table_info;
+
+ /***************************************************
+ * registering the table with the master agent
+ */
+ DEBUGMSGTL(("initialize_table_netSnmpHostsTable",
+ "Registering table netSnmpHostsTable as a table iterator\n"));
+ netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/** Initializes the netSnmpHostsTable module */
+void
+init_netSnmpHostsTable(void)
+{
+
+ /** here we initialize all the tables we're planning on supporting */
+ initialize_table_netSnmpHostsTable();
+}
+
+/** handles requests for the netSnmpHostsTable table, if anything else needs to be done */
+int
+netSnmpHostsTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ netsnmp_variable_list *var;
+ struct commitInfo *ci = NULL;
+
+ void *data_context = NULL;
+
+ oid *suffix;
+ size_t suffix_len;
+
+ for (request = requests; request; request = request->next) {
+ /* column and row index encoded portion */
+ var = request->requestvb;
+ suffix = var->name + reginfo->rootoid_len + 1;
+ suffix_len = var->name_length - (reginfo->rootoid_len + 1);
+
+ if (request->processed != 0)
+ continue;
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ case MODE_SET_RESERVE1:
+ data_context = netsnmp_extract_iterator_context(request);
+ if (data_context == NULL) {
+ if (reqinfo->mode == MODE_GET) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ }
+ break;
+
+ default: /* == the other SET modes */
+ ci = netsnmp_oid_stash_get_data(commitStorage,
+ suffix + 1, suffix_len - 1);
+ break;
+
+ }
+
+ /** extracts the information about the table from the request */
+ table_info = netsnmp_extract_table_info(request);
+ /** table_info->colnum contains the column number requested */
+ /** table_info->indexes contains a linked list of snmp variable
+ bindings for the indexes of the table. Values in the list
+ have been set corresponding to the indexes of the
+ request */
+ if (table_info == NULL) {
+ continue;
+ }
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ switch (table_info->colnum) {
+ case COLUMN_NETSNMPHOSTADDRESSTYPE:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ retval =
+ get_netSnmpHostAddressType(data_context,
+ &retval_len);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_NETSNMPHOSTADDRESS:
+ {
+ char *retval;
+ size_t retval_len = 0;
+ retval =
+ get_netSnmpHostAddress(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_OCTET_STR,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_NETSNMPHOSTSTORAGE:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ retval =
+ get_netSnmpHostStorage(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_NETSNMPHOSTROWSTATUS:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ retval =
+ get_netSnmpHostRowStatus(data_context,
+ &retval_len);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ default:
+ /** We shouldn't get here */
+ snmp_log(LOG_ERR,
+ "problem encountered in netSnmpHostsTable_handler: unknown column\n");
+ }
+ break;
+
+ case MODE_SET_RESERVE1:
+ ci = netsnmp_oid_stash_get_data(commitStorage,
+ suffix + 1, suffix_len - 1);
+
+ if (!ci) {
+ /** create the commit storage info */
+ ci = SNMP_MALLOC_STRUCT(commitInfo);
+ if (!data_context) {
+ ci->data_context =
+ netSnmpHostsTable_create_data_context(table_info->
+ indexes);
+ ci->new_row = 1;
+ } else {
+ ci->data_context = data_context;
+ }
+ netsnmp_oid_stash_add_data(&commitStorage,
+ suffix + 1, suffix_len - 1, ci);
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ switch (table_info->colnum) {
+ case COLUMN_NETSNMPHOSTADDRESSTYPE:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ struct undoInfo *ui = NULL;
+ int ret;
+
+ /** first, get the old value */
+ retval =
+ get_netSnmpHostAddressType(ci->data_context,
+ &retval_len);
+ if (retval) {
+ ui = SNMP_MALLOC_STRUCT(undoInfo);
+ ui->len = retval_len;
+ memdup((u_char **) & ui->ptr,
+ (u_char *) retval, ui->len);
+ }
+
+ /** check the new value, possibly against the
+ older value for a valid state transition */
+ ret =
+ check_netSnmpHostAddressType(request->requestvb->
+ type,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len, retval,
+ retval_len);
+ if (ret != 0) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ netSnmpHostsTable_free_undoInfo(ui);
+ } else if (ui) {
+ /** remember information for undo purposes later */
+ netsnmp_oid_stash_add_data(&undoStorage,
+ suffix, suffix_len, ui);
+ }
+
+ }
+ break;
+ case COLUMN_NETSNMPHOSTADDRESS:
+ {
+ char *retval;
+ size_t retval_len = 0;
+ struct undoInfo *ui = NULL;
+ int ret;
+
+ /** first, get the old value */
+ retval =
+ get_netSnmpHostAddress(ci->data_context,
+ &retval_len);
+ if (retval) {
+ ui = SNMP_MALLOC_STRUCT(undoInfo);
+ ui->len = retval_len;
+ memdup((u_char **) & ui->ptr,
+ (u_char *) retval, ui->len);
+ }
+
+ /** check the new value, possibly against the
+ older value for a valid state transition */
+ ret =
+ check_netSnmpHostAddress(request->requestvb->type,
+ (char *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len, retval,
+ retval_len);
+ if (ret != 0) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ netSnmpHostsTable_free_undoInfo(ui);
+ } else if (ui) {
+ /** remember information for undo purposes later */
+ netsnmp_oid_stash_add_data(&undoStorage,
+ suffix, suffix_len, ui);
+ }
+
+ }
+ break;
+ case COLUMN_NETSNMPHOSTSTORAGE:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ struct undoInfo *ui = NULL;
+ int ret;
+
+ /** first, get the old value */
+ retval =
+ get_netSnmpHostStorage(ci->data_context,
+ &retval_len);
+ if (retval) {
+ ui = SNMP_MALLOC_STRUCT(undoInfo);
+ ui->len = retval_len;
+ memdup((u_char **) & ui->ptr,
+ (u_char *) retval, ui->len);
+ }
+
+ /** check the new value, possibly against the
+ older value for a valid state transition */
+ ret =
+ check_netSnmpHostStorage(request->requestvb->type,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len, retval,
+ retval_len);
+ if (ret != 0) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ netSnmpHostsTable_free_undoInfo(ui);
+ } else if (ui) {
+ /** remember information for undo purposes later */
+ netsnmp_oid_stash_add_data(&undoStorage,
+ suffix, suffix_len, ui);
+ }
+
+ }
+ break;
+ case COLUMN_NETSNMPHOSTROWSTATUS:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ struct undoInfo *ui = NULL;
+ int ret;
+
+ /** first, get the old value */
+ retval =
+ get_netSnmpHostRowStatus(ci->data_context,
+ &retval_len);
+ if (retval) {
+ ui = SNMP_MALLOC_STRUCT(undoInfo);
+ ui->len = retval_len;
+ memdup((u_char **) & ui->ptr,
+ (u_char *) retval, ui->len);
+ }
+
+ /** check the new value, possibly against the
+ older value for a valid state transition */
+ ret =
+ check_netSnmpHostRowStatus(request->requestvb->
+ type,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len, retval,
+ retval_len);
+ if (ret != 0) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ netSnmpHostsTable_free_undoInfo(ui);
+ } else if (ui) {
+ /** remember information for undo purposes later */
+ netsnmp_oid_stash_add_data(&undoStorage,
+ suffix, suffix_len, ui);
+ }
+
+ }
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ break;
+ }
+ break;
+
+ case MODE_SET_ACTION:
+ /** save a variable copy */
+ switch (table_info->colnum) {
+ case COLUMN_NETSNMPHOSTADDRESSTYPE:
+ {
+ int ret;
+ ret = set_netSnmpHostAddressType(ci->data_context,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ }
+ }
+ break;
+ case COLUMN_NETSNMPHOSTADDRESS:
+ {
+ int ret;
+ ret = set_netSnmpHostAddress(ci->data_context,
+ (char *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ }
+ }
+ break;
+ case COLUMN_NETSNMPHOSTSTORAGE:
+ {
+ int ret;
+ ret = set_netSnmpHostStorage(ci->data_context,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ }
+ }
+ break;
+ case COLUMN_NETSNMPHOSTROWSTATUS:
+ {
+ int ret;
+ ret = set_netSnmpHostRowStatus(ci->data_context,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret) {
+ netsnmp_set_request_error(reqinfo, request, ret);
+ }
+ if (*request->requestvb->val.integer == RS_DESTROY) {
+ ci->new_row = -1;
+ }
+ }
+ break;
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ if (!ci->have_committed) {
+ /** do this once per row only */
+ netSnmpHostsTable_commit_row(&ci->data_context,
+ ci->new_row);
+ ci->have_committed = 1;
+ }
+ break;
+
+ case MODE_SET_UNDO:
+ /** save a variable copy */
+ switch (table_info->colnum) {
+ case COLUMN_NETSNMPHOSTADDRESSTYPE:
+ {
+ int retval;
+ struct undoInfo *ui;
+ ui = netsnmp_oid_stash_get_data(undoStorage,
+ suffix, suffix_len);
+ retval =
+ set_netSnmpHostAddressType(ci->data_context,
+ ui->ptr, ui->len);
+ if (retval) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_UNDOFAILED);
+ }
+ }
+ break;
+ case COLUMN_NETSNMPHOSTADDRESS:
+ {
+ int retval;
+ struct undoInfo *ui;
+ ui = netsnmp_oid_stash_get_data(undoStorage,
+ suffix, suffix_len);
+ retval =
+ set_netSnmpHostAddress(ci->data_context, ui->ptr,
+ ui->len);
+ if (retval) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_UNDOFAILED);
+ }
+ }
+ break;
+ case COLUMN_NETSNMPHOSTSTORAGE:
+ {
+ int retval;
+ struct undoInfo *ui;
+ ui = netsnmp_oid_stash_get_data(undoStorage,
+ suffix, suffix_len);
+ retval =
+ set_netSnmpHostStorage(ci->data_context, ui->ptr,
+ ui->len);
+ if (retval) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_UNDOFAILED);
+ }
+ }
+ break;
+ case COLUMN_NETSNMPHOSTROWSTATUS:
+ {
+ int retval;
+ struct undoInfo *ui;
+ ui = netsnmp_oid_stash_get_data(undoStorage,
+ suffix, suffix_len);
+ retval =
+ set_netSnmpHostRowStatus(ci->data_context, ui->ptr,
+ ui->len);
+ if (retval) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_UNDOFAILED);
+ }
+ }
+ break;
+ }
+ break;
+
+ case MODE_SET_FREE:
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "problem encountered in netSnmpHostsTable_handler: unsupported mode\n");
+ }
+ }
+
+ /** clean up after all requset processing has ended */
+ switch (reqinfo->mode) {
+ case MODE_SET_UNDO:
+ case MODE_SET_FREE:
+ case MODE_SET_COMMIT:
+ /** clear out the undo cache */
+ netsnmp_oid_stash_free(&undoStorage,
+ netSnmpHostsTable_free_undoInfo);
+ netsnmp_oid_stash_free(&commitStorage, netsnmp_oid_stash_no_free);
+ }
+
+
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable.h
new file mode 100644
index 0000000000..b6164a96a7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable.h
@@ -0,0 +1,40 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate_access.conf,v 1.4 2003/07/01 00:15:11 hardaker Exp $
+ */
+#ifndef NETSNMPHOSTSTABLE_H
+#define NETSNMPHOSTSTABLE_H
+
+/** other required module components */
+config_require(examples/netSnmpHostsTable_access)
+config_require(examples/netSnmpHostsTable_checkfns)
+config_add_mib(NET-SNMP-EXAMPLES-MIB)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * function declarations
+ */
+ void init_netSnmpHostsTable(void);
+ void initialize_table_netSnmpHostsTable(void);
+ Netsnmp_Node_Handler netSnmpHostsTable_handler;
+
+
+/*
+ * column number definitions for table netSnmpHostsTable
+ */
+#include "netSnmpHostsTable_columns.h"
+
+/*
+ * enum definions
+ */
+#include "netSnmpHostsTable_enums.h"
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /** NETSNMPHOSTSTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_access.c
new file mode 100644
index 0000000000..04f6bbdba3
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_access.c
@@ -0,0 +1,364 @@
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.access_functions.conf,v 1.3 2003/05/31 00:11:57 hardaker Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "netSnmpHostsTable_access.h"
+#include "netSnmpHostsTable_enums.h"
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <stdio.h>
+#include <unistd.h>
+
+#define MAX_HOSTS_LINE 4096
+
+/* XXX: make .conf token */
+#define HOSTS_FILE "/etc/hosts"
+
+typedef struct my_loop_info_s {
+ FILE *filep;
+ in_addr_t theaddr;
+ char line[MAX_HOSTS_LINE];
+ char hostname[64];
+ int lineno;
+ char *current_ptr;
+} my_loop_info;
+
+typedef struct my_data_info_s {
+ in_addr_t theaddr;
+ in_addr_t theoldaddr;
+ char hostname[64];
+ int lineno;
+} my_data_info;
+
+/** NOTE:
+ * - these get_ routines MUST return data that will not be freed (ie,
+ * use static variables or persistent data). It will be copied, if
+ * needed, immediately after the get_ routine has been called.
+ * - these SET routines must copy the incoming data and can not take
+ * ownership of the memory passed in by the val pointer.
+ */
+
+
+/** returns the first data point within the netSnmpHostsTable table data.
+
+ Set the my_loop_context variable to the first data point structure
+ of your choice (from which you can find the next one). This could
+ be anything from the first node in a linked list, to an integer
+ pointer containing the beginning of an array variable.
+
+ Set the my_data_context variable to something to be returned to
+ you later that will provide you with the data to return in a given
+ row. This could be the same pointer as what my_loop_context is
+ set to, or something different.
+
+ The put_index_data variable contains a list of snmp variable
+ bindings, one for each index in your table. Set the values of
+ each appropriately according to the data matching the first row
+ and return the put_index_data variable at the end of the function.
+*/
+netsnmp_variable_list *
+netSnmpHostsTable_get_first_data_point(void **my_loop_context,
+ void **my_data_context,
+ netsnmp_variable_list *
+ put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+ my_loop_info *loopctx;
+
+ loopctx = SNMP_MALLOC_TYPEDEF(my_loop_info);
+
+ if (!loopctx)
+ return NULL; /*XXX log err */
+
+ loopctx->filep = fopen("/etc/hosts","r");
+
+ if (!loopctx->filep) {
+ free(loopctx);
+ return NULL;
+ }
+
+ /* at this point, we need to get the first name and address from
+ the file. But since our get_next_data_point function does
+ this, we'll use it instead of duplicating code */
+ *my_loop_context = loopctx;
+
+ return netSnmpHostsTable_get_next_data_point(my_loop_context,
+ my_data_context,
+ put_index_data,
+ mydata);
+}
+
+/** functionally the same as netSnmpHostsTable_get_first_data_point, but
+ my_loop_context has already been set to a previous value and should
+ be updated to the next in the list. For example, if it was a
+ linked list, you might want to cast it to your local data type and
+ then return my_loop_context->next. The my_data_context pointer
+ should be set to something you need later and the indexes in
+ put_index_data updated again. */
+netsnmp_variable_list *
+netSnmpHostsTable_get_next_data_point(void **my_loop_context,
+ void **my_data_context,
+ netsnmp_variable_list *
+ put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+ my_loop_info *loopctx = *my_loop_context;
+ char tmpstring[64];
+
+ if (!loopctx)
+ return NULL;
+
+ while(loopctx->filep) {
+ if (!loopctx->current_ptr) {
+ if (!fgets(loopctx->line, sizeof(loopctx->line), loopctx->filep)) {
+ /* we're done */
+ fclose(loopctx->filep);
+ loopctx->filep = NULL;
+ return NULL;
+ }
+ loopctx->lineno++;
+ loopctx->current_ptr = loopctx->line;
+ loopctx->current_ptr = skip_white(loopctx->current_ptr);
+
+ if (loopctx->current_ptr == NULL || *loopctx->current_ptr == '#') {
+ loopctx->current_ptr = NULL;
+ continue;
+ }
+
+ loopctx->current_ptr =
+ copy_nword(loopctx->current_ptr, tmpstring, sizeof(tmpstring));
+ loopctx->theaddr = inet_addr(tmpstring);
+
+ if (!loopctx->current_ptr)
+ continue;
+ }
+
+ loopctx->current_ptr =
+ copy_nword(loopctx->current_ptr, loopctx->hostname, sizeof(loopctx->hostname));
+
+ snmp_set_var_value(put_index_data, (u_char *) loopctx->hostname,
+ strlen(loopctx->hostname));
+ return put_index_data;
+ }
+
+ /* we're out of data */
+ *my_loop_context = NULL;
+ return NULL;
+}
+
+void *
+netSnmpHostsTable_context_convert_function(void *loop_context,
+ netsnmp_iterator_info *iinfo)
+{
+ my_loop_info *loopctx = loop_context;
+ my_data_info *datactx = SNMP_MALLOC_TYPEDEF(my_data_info);
+ if (!datactx)
+ return NULL;
+ datactx->theoldaddr = datactx->theaddr = loopctx->theaddr;
+ datactx->lineno = loopctx->lineno;
+ strcpy(datactx->hostname, loopctx->hostname);
+ return datactx;
+}
+
+/** Create a data_context for non-existent rows that SETs are performed on.
+ * return a void * pointer which will be passed to subsequent get_XXX
+ * and set_XXX functions for data retrival and modification during
+ * this SET request.
+ *
+ * The indexs are encoded (in order) into the index_data pointer if it
+ * would be helpful to use that information.
+ */
+void *
+netSnmpHostsTable_create_data_context(netsnmp_variable_list * index_data)
+{
+ my_data_info *datactx = SNMP_MALLOC_TYPEDEF(my_data_info);
+ if (!datactx)
+ return NULL;
+ strncpy(datactx->hostname, index_data->val.string,
+ strlen(index_data->val.string));
+ return datactx;
+}
+
+void
+netSnmpHostsTable_data_free(void *data, netsnmp_iterator_info *iinfo)
+{
+ free(data);
+}
+
+void
+netSnmpHostsTable_loop_free(void *loopctx, netsnmp_iterator_info *iinfo)
+{
+ free(loopctx);
+}
+
+/** If the implemented set_* functions don't operate directly on the
+ real-live data (which is actually recommended), then this function
+ can be used to take a given my_data_context pointer and "commit" it
+ to whereever the modified data needs to be put back to. For
+ example, if this was a routing table you could publish the modified
+ routes back into the kernel at this point.
+
+ rowStatus will be set to 1 if new, 0 if not or -1 if it should
+ be deleted.
+
+ If you free the data yourself, make sure to *my_data_context = NULL */
+int
+netSnmpHostsTable_commit_row(void **my_data_context, int new_or_del)
+{
+ /** Add any necessary commit code here */
+ FILE *in, *out;
+ char line[MAX_HOSTS_LINE], line2[MAX_HOSTS_LINE];
+ char myaddr[64], *cp;
+ my_data_info *datactx = *my_data_context;
+ size_t line2_sz;
+ int foundit = 0;
+
+ if (datactx->theaddr == datactx->theoldaddr && new_or_del != -1)
+ return SNMP_ERR_NOERROR; /* no change in the value */
+
+ if ((out = fopen(HOSTS_FILE ".snmp", "w")) == NULL)
+ return SNMP_ERR_COMMITFAILED;
+
+ if ((in = fopen(HOSTS_FILE, "r")) == NULL)
+ return SNMP_ERR_COMMITFAILED;
+
+ while(fgets(line, sizeof(line), in)) {
+ copy_nword(line,myaddr,sizeof(myaddr));
+ if (inet_addr(myaddr) == datactx->theaddr && new_or_del != -1) {
+ foundit = 1;
+ /* right line to append to */
+ line[strlen(line)-1] = '\0'; /* nuke the new line */
+ fprintf(out, "%s %s\n", line, datactx->hostname);
+ } else if (inet_addr(myaddr) == datactx->theoldaddr) {
+ /* find and remove the name from the current line */
+ int count = 0;
+ cp = copy_nword(line, line2, sizeof(line2)); /* pass the addr */
+ if (strlen(line2) > sizeof(line2)-2) {
+ errorit:
+ fclose(in);
+ fclose(out);
+ unlink(HOSTS_FILE ".snmp");
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ line2_sz = strlen(line2);
+ line2[line2_sz++] = '\t';
+ while(cp) {
+ cp = copy_nword(cp, &line2[line2_sz], sizeof(line2)-line2_sz);
+ if (strcmp(&line2[line2_sz], datactx->hostname) == 0) {
+ /* a match, so don't add it to line2 (which means
+ don't update the write line2_sz index */
+ } else {
+ if (strlen(line2) > sizeof(line2)-2) {
+ goto errorit;
+ }
+ line2_sz = strlen(line2);
+ line2[line2_sz++] = ' ';
+ count++;
+ }
+ }
+ if (count) {
+ /* at least one name was still present on the line, so
+ save it to the new file */
+ line2[line2_sz] = '\0';
+ fprintf(out, "%s\n", line2);
+ }
+ } else {
+ fputs(line, out);
+ }
+ }
+
+ if (!foundit && new_or_del != -1) {
+ /* couldn't add it to an existing line, so append a new one */
+ fprintf(out, "%d.%d.%d.%d\t%s\n",
+ (0x000000ff & datactx->theaddr),
+ (0x0000ff00 & datactx->theaddr) >> 8,
+ (0x00ff0000 & datactx->theaddr) >> 16,
+ (0xff000000 & datactx->theaddr) >> 24,
+ datactx->hostname);
+ }
+ fclose(out); /* close out first to minimize race condition */
+ fclose(in);
+ /*
+ * race condition here - someone else could open the file after
+ * we close it but before we can rename it.
+ */
+ if (!rename(HOSTS_FILE ".snmp", HOSTS_FILE))
+ return SNMP_ERR_COMMITFAILED;
+
+ /*
+ * return no errors. And there shouldn't be any!!! Ever!!! You
+ * should have checked the values long before this.
+ */
+ return SNMP_ERR_NOERROR;
+}
+
+
+/*
+ * User-defined data access functions (per column) for data in table
+ * netSnmpHostsTable
+ */
+
+
+long *
+get_netSnmpHostAddressType(void *data_context, size_t * ret_len)
+{
+ static long ret = NETSNMPHOSTADDRESSTYPE_IPV4;
+ *ret_len = sizeof(ret);
+ return &ret;
+}
+
+int
+set_netSnmpHostAddressType(void *data_context, long *val, size_t val_len)
+{
+ return SNMP_ERR_NOERROR; /* always ipv4 */
+}
+
+char *
+get_netSnmpHostAddress(void *data_context, size_t * ret_len)
+{
+ my_data_info *datainfo = data_context;
+ *ret_len = sizeof(in_addr_t); /* XXX: make sure it's 4 */
+ return (char *) &datainfo->theaddr;
+}
+
+int
+set_netSnmpHostAddress(void *data_context, char *val, size_t val_len)
+{
+ my_data_info *datainfo = data_context;
+ memcpy(&datainfo->theaddr, val, val_len);
+ return SNMP_ERR_NOERROR;
+}
+
+long *
+get_netSnmpHostStorage(void *data_context, size_t * ret_len)
+{
+ static long ret = ST_NONVOLATILE;
+ *ret_len = sizeof(ret);
+ return &ret;
+}
+
+int
+set_netSnmpHostStorage(void *data_context, long *val, size_t val_len)
+{
+ return SNMP_ERR_NOERROR;
+}
+
+long *
+get_netSnmpHostRowStatus(void *data_context, size_t * ret_len)
+{
+ static long ret = RS_ACTIVE;
+ *ret_len = sizeof(ret);
+ return &ret;
+}
+
+int
+set_netSnmpHostRowStatus(void *data_context, long *val, size_t val_len)
+{
+ /* XXX */
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_access.h
new file mode 100644
index 0000000000..3be2a5cc9b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_access.h
@@ -0,0 +1,48 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.access_functions.conf,v 1.3 2003/05/31 00:11:57 hardaker Exp $
+ */
+#ifndef NETSNMPHOSTSTABLE_ACCESS_H
+#define NETSNMPHOSTSTABLE_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** User-defined data access functions for data in table netSnmpHostsTable */
+/** row level accessors */
+Netsnmp_First_Data_Point netSnmpHostsTable_get_first_data_point;
+Netsnmp_Next_Data_Point netSnmpHostsTable_get_next_data_point;
+Netsnmp_Make_Data_Context netSnmpHostsTable_context_convert_function;
+Netsnmp_Free_Loop_Context netSnmpHostsTable_loop_free;
+Netsnmp_Free_Data_Context netSnmpHostsTable_data_free;
+
+int netSnmpHostsTable_commit_row(void **my_data_context,
+ int new_or_del);
+void *netSnmpHostsTable_create_data_context(netsnmp_variable_list
+ * index_data);
+
+/** column accessors */
+long *get_netSnmpHostAddressType(void *data_context,
+ size_t * ret_len);
+int set_netSnmpHostAddressType(void *data_context, long *val,
+ size_t val_len);
+char *get_netSnmpHostAddress(void *data_context,
+ size_t * ret_len);
+int set_netSnmpHostAddress(void *data_context, char *val,
+ size_t val_len);
+long *get_netSnmpHostStorage(void *data_context,
+ size_t * ret_len);
+int set_netSnmpHostStorage(void *data_context, long *val,
+ size_t val_len);
+long *get_netSnmpHostRowStatus(void *data_context,
+ size_t * ret_len);
+int set_netSnmpHostRowStatus(void *data_context, long *val,
+ size_t val_len);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NETSNMPHOSTSTABLE_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_checkfns.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_checkfns.c
new file mode 100644
index 0000000000..f29ba9837d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_checkfns.c
@@ -0,0 +1,197 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.check_values.conf,v 1.5 2003/05/31 00:11:57 hardaker Exp $
+ */
+
+/********************************************************************
+ * NOTE NOTE NOTE
+ * This file is auto-generated and SHOULD NOT BE EDITED by hand.
+ * Modify the netSnmpHostsTable_checkfns_local.[ch] files insead so that you
+ * can regenerate this one as mib2c improvements are made.
+ ********************************************************************/
+
+/*
+ * standard headers
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include "netSnmpHostsTable_checkfns.h"
+#include "netSnmpHostsTable_checkfns_local.h"
+#include "netSnmpHostsTable_enums.h"
+
+/** Decides if an incoming value for the netSnmpHostAddressType mib node is legal.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @param old_val
+ * @param old_val_len
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_netSnmpHostAddressType(int type, long *val, size_t val_len,
+ long *old_val, size_t old_val_len)
+{
+
+ int ret;
+
+ /** Check to see that we were called legally */
+ if (!val)
+ return SNMP_ERR_GENERR;
+
+ /** Check the incoming type for correctness */
+ if (type != ASN_INTEGER)
+ return SNMP_ERR_WRONGTYPE;
+
+ /** Check the enums. Legal values will continue, others return error. */
+ switch (*val) {
+ case NETSNMPHOSTADDRESSTYPE_UNKNOWN:
+ case NETSNMPHOSTADDRESSTYPE_IPV4:
+ case NETSNMPHOSTADDRESSTYPE_IPV6:
+ case NETSNMPHOSTADDRESSTYPE_IPV4Z:
+ case NETSNMPHOSTADDRESSTYPE_IPV6Z:
+ case NETSNMPHOSTADDRESSTYPE_DNS:
+ break;
+
+ /** not a legal enum value. return an error */
+ default:
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ ret = SNMP_ERR_NOERROR;
+
+
+ /** looks ok, call the local version of the same function. */
+ return check_netSnmpHostAddressType_local(type, val, val_len, old_val,
+ old_val_len);
+}
+
+/** Decides if an incoming value for the netSnmpHostAddress mib node is legal.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @param old_val
+ * @param old_val_len
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_netSnmpHostAddress(int type, char *val, size_t val_len,
+ char *old_val, size_t old_val_len)
+{
+
+ int ret;
+
+ /** Check to see that we were called legally */
+ if (!val)
+ return SNMP_ERR_GENERR;
+
+ /** Check the incoming type for correctness */
+ if (type != ASN_OCTET_STR)
+ return SNMP_ERR_WRONGTYPE;
+
+ /** Check the ranges of the passed value for legality */
+ if (!(val_len >= 0 && val_len <= 255)
+ ) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+
+
+ /** looks ok, call the local version of the same function. */
+ return check_netSnmpHostAddress_local(type, val, val_len, old_val,
+ old_val_len);
+}
+
+/** Decides if an incoming value for the netSnmpHostStorage mib node is legal.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @param old_val
+ * @param old_val_len
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_netSnmpHostStorage(int type, long *val, size_t val_len,
+ long *old_val, size_t old_val_len)
+{
+
+ int ret;
+
+ /** Check to see that we were called legally */
+ if (!val)
+ return SNMP_ERR_GENERR;
+
+ /** Check the incoming type for correctness */
+ if (type != ASN_INTEGER)
+ return SNMP_ERR_WRONGTYPE;
+
+ /** Check the enums. Legal values will continue, others return error. */
+ switch (*val) {
+ case NETSNMPHOSTSTORAGE_OTHER:
+ case NETSNMPHOSTSTORAGE_VOLATILE:
+ case NETSNMPHOSTSTORAGE_NONVOLATILE:
+ case NETSNMPHOSTSTORAGE_PERMANENT:
+ case NETSNMPHOSTSTORAGE_READONLY:
+ break;
+
+ /** not a legal enum value. return an error */
+ default:
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ ret = SNMP_ERR_NOERROR;
+
+ if (ret =
+ check_storage_transition((old_val) ? *old_val : SNMP_STORAGE_NONE,
+ *val))
+ return ret;
+
+ /** looks ok, call the local version of the same function. */
+ return check_netSnmpHostStorage_local(type, val, val_len, old_val,
+ old_val_len);
+}
+
+/** Decides if an incoming value for the netSnmpHostRowStatus mib node is legal.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @param old_val
+ * @param old_val_len
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_netSnmpHostRowStatus(int type, long *val, size_t val_len,
+ long *old_val, size_t old_val_len)
+{
+
+ int ret;
+
+ /** Check to see that we were called legally */
+ if (!val)
+ return SNMP_ERR_GENERR;
+
+ /** Check the incoming type for correctness */
+ if (type != ASN_INTEGER)
+ return SNMP_ERR_WRONGTYPE;
+
+ /** Check the enums. Legal values will continue, others return error. */
+ switch (*val) {
+ case NETSNMPHOSTROWSTATUS_ACTIVE:
+ case NETSNMPHOSTROWSTATUS_NOTINSERVICE:
+ case NETSNMPHOSTROWSTATUS_NOTREADY:
+ case NETSNMPHOSTROWSTATUS_CREATEANDGO:
+ case NETSNMPHOSTROWSTATUS_CREATEANDWAIT:
+ case NETSNMPHOSTROWSTATUS_DESTROY:
+ break;
+
+ /** not a legal enum value. return an error */
+ default:
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ ret = SNMP_ERR_NOERROR;
+
+ if (ret =
+ check_rowstatus_transition((old_val) ? *old_val : RS_NONEXISTENT,
+ *val))
+ return ret;
+
+ /** looks ok, call the local version of the same function. */
+ return check_netSnmpHostRowStatus_local(type, val, val_len, old_val,
+ old_val_len);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_checkfns.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_checkfns.h
new file mode 100644
index 0000000000..cb996bb1aa
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_checkfns.h
@@ -0,0 +1,47 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate.conf,v 5.6 2003/02/20 00:52:07 hardaker Exp $
+ */
+
+/***********************************************************************
+ * This file is auto-generated and SHOULD NOT BE EDITED by hand.
+ * Modify the netSnmpHostsTable_checkfns_local.[ch] files insead.
+ * (so that you can regenerate this one as mib2c improvements are made)
+ ***********************************************************************/
+#ifndef NETSNMPHOSTSTABLE_CHECKFNS_H
+#define NETSNMPHOSTSTABLE_CHECKFNS_H
+
+/** make sure we load the functions that you can modify */
+config_require(examples/netSnmpHostsTable_checkfns_local)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * these functions are designed to check incoming values for
+ * columns in the netSnmpHostsTable table for legality with respect to
+ * datatype and value.
+ */
+ int check_netSnmpHostAddressType(int type, long *val,
+ size_t val_len,
+ long *old_val,
+ size_t old_val_len);
+ int check_netSnmpHostAddress(int type, char *val,
+ size_t val_len,
+ char *old_val,
+ size_t old_val_len);
+ int check_netSnmpHostStorage(int type, long *val,
+ size_t val_len,
+ long *old_val,
+ size_t old_val_len);
+ int check_netSnmpHostRowStatus(int type, long *val,
+ size_t val_len,
+ long *old_val,
+ size_t old_val_len);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NETSNMPHOSTSTABLE_CHECKFNS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_checkfns_local.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_checkfns_local.c
new file mode 100644
index 0000000000..a29360d7e1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_checkfns_local.c
@@ -0,0 +1,117 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.check_values_local.conf,v 5.1 2003/05/30 23:53:15 hardaker Exp $
+ */
+
+/*
+ * standard headers
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include "netSnmpHostsTable_checkfns.h"
+#include "netSnmpHostsTable_enums.h"
+
+/** Decides if an incoming value for the netSnmpHostAddressType mib node is legal, from a local implementation specific viewpoint.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @param old_val
+ * @param old_val_len
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_netSnmpHostAddressType_local(int type, long *val, size_t val_len,
+ long *old_val, size_t old_val_len)
+{
+
+ /** XXX: you may want to check aspects of the new value that
+ were not covered by the automatic checks by the parent function. */
+
+ /** XXX: you make want to check that the requested change from
+ the old value to the new value is legal (ie, the transistion
+ from one value to another is legal */
+
+ if (*val != NETSNMPHOSTADDRESSTYPE_IPV4)
+ return SNMP_ERR_WRONGVALUE;
+
+ /** if everything looks ok, return SNMP_ERR_NOERROR */
+ return SNMP_ERR_NOERROR;
+}
+
+/** Decides if an incoming value for the netSnmpHostAddress mib node is legal, from a local implementation specific viewpoint.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @param old_val
+ * @param old_val_len
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_netSnmpHostAddress_local(int type, char *val, size_t val_len,
+ char *old_val, size_t old_val_len)
+{
+
+ /** XXX: you may want to check aspects of the new value that
+ were not covered by the automatic checks by the parent function. */
+
+ /** XXX: you make want to check that the requested change from
+ the old value to the new value is legal (ie, the transistion
+ from one value to another is legal */
+
+ if (val_len != 4)
+ return SNMP_ERR_WRONGVALUE;
+
+ /** if everything looks ok, return SNMP_ERR_NOERROR */
+ return SNMP_ERR_NOERROR;
+}
+
+/** Decides if an incoming value for the netSnmpHostStorage mib node is legal, from a local implementation specific viewpoint.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @param old_val
+ * @param old_val_len
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_netSnmpHostStorage_local(int type, long *val, size_t val_len,
+ long *old_val, size_t old_val_len)
+{
+
+ /** XXX: you may want to check aspects of the new value that
+ were not covered by the automatic checks by the parent function. */
+
+ /** XXX: you make want to check that the requested change from
+ the old value to the new value is legal (ie, the transistion
+ from one value to another is legal */
+
+ if (*val != ST_NONVOLATILE)
+ return SNMP_ERR_WRONGVALUE;
+
+ /** if everything looks ok, return SNMP_ERR_NOERROR */
+ return SNMP_ERR_NOERROR;
+}
+
+/** Decides if an incoming value for the netSnmpHostRowStatus mib node is legal, from a local implementation specific viewpoint.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @param old_val
+ * @param old_val_len
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_netSnmpHostRowStatus_local(int type, long *val, size_t val_len,
+ long *old_val, size_t old_val_len)
+{
+
+ /** XXX: you may want to check aspects of the new value that
+ were not covered by the automatic checks by the parent function. */
+
+ /** XXX: you make want to check that the requested change from
+ the old value to the new value is legal (ie, the transistion
+ from one value to another is legal */
+
+ /** if everything looks ok, return SNMP_ERR_NOERROR */
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_checkfns_local.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_checkfns_local.h
new file mode 100644
index 0000000000..335a0ae72e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_checkfns_local.h
@@ -0,0 +1,36 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : : mib2c.check_values_local.conf,v 5.1 2003/05/30 23:53:15 hardaker Exp $
+ *
+ */
+#ifndef NETSNMPHOSTSTABLE_CHECKFNS_H
+#define NETSNMPHOSTSTABLE_CHECKFNS_H
+
+/*
+ * these functions are designed to check incoming values for
+ * columns in the netSnmpHostsTable table for legality with respect to
+ * datatype and value according to local conventions. You should modify
+ * them as appropriate. They will be called from parent check_value
+ * functions that are auto-generated using mib2c and the parent functions
+ * should NOT be modified.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int check_(int type, long *val, size_t val_len, long *old_val,
+ size_t old_val_len);
+int check_(int type, char *val, size_t val_len, char *old_val,
+ size_t old_val_len);
+int check_(int type, long *val, size_t val_len, long *old_val,
+ size_t old_val_len);
+int check_(int type, long *val, size_t val_len, long *old_val,
+ size_t old_val_len);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NETSNMPHOSTSTABLE_CHECKFNS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_columns.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_columns.h
new file mode 100644
index 0000000000..2b3af76aba
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_columns.h
@@ -0,0 +1,16 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.column_defines.conf,v 5.1 2002/05/08 05:42:47 hardaker Exp $
+ */
+#ifndef NETSNMPHOSTSTABLE_COLUMNS_H
+#define NETSNMPHOSTSTABLE_COLUMNS_H
+
+/*
+ * column number definitions for table netSnmpHostsTable
+ */
+#define COLUMN_NETSNMPHOSTNAME 1
+#define COLUMN_NETSNMPHOSTADDRESSTYPE 2
+#define COLUMN_NETSNMPHOSTADDRESS 3
+#define COLUMN_NETSNMPHOSTSTORAGE 4
+#define COLUMN_NETSNMPHOSTROWSTATUS 5
+#endif /* NETSNMPHOSTSTABLE_COLUMNS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_enums.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_enums.h
new file mode 100644
index 0000000000..fcff3920ca
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/netSnmpHostsTable_enums.h
@@ -0,0 +1,37 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.column_enums.conf,v 5.2 2003/02/22 04:09:25 hardaker Exp $
+ */
+#ifndef NETSNMPHOSTSTABLE_ENUMS_H
+#define NETSNMPHOSTSTABLE_ENUMS_H
+
+/*
+ * enums for column netSnmpHostAddressType
+ */
+#define NETSNMPHOSTADDRESSTYPE_UNKNOWN 0
+#define NETSNMPHOSTADDRESSTYPE_IPV4 1
+#define NETSNMPHOSTADDRESSTYPE_IPV6 2
+#define NETSNMPHOSTADDRESSTYPE_IPV4Z 3
+#define NETSNMPHOSTADDRESSTYPE_IPV6Z 4
+#define NETSNMPHOSTADDRESSTYPE_DNS 16
+
+/*
+ * enums for column netSnmpHostStorage
+ */
+#define NETSNMPHOSTSTORAGE_OTHER 1
+#define NETSNMPHOSTSTORAGE_VOLATILE 2
+#define NETSNMPHOSTSTORAGE_NONVOLATILE 3
+#define NETSNMPHOSTSTORAGE_PERMANENT 4
+#define NETSNMPHOSTSTORAGE_READONLY 5
+
+/*
+ * enums for column netSnmpHostRowStatus
+ */
+#define NETSNMPHOSTROWSTATUS_ACTIVE 1
+#define NETSNMPHOSTROWSTATUS_NOTINSERVICE 2
+#define NETSNMPHOSTROWSTATUS_NOTREADY 3
+#define NETSNMPHOSTROWSTATUS_CREATEANDGO 4
+#define NETSNMPHOSTROWSTATUS_CREATEANDWAIT 5
+#define NETSNMPHOSTROWSTATUS_DESTROY 6
+
+#endif /* NETSNMPHOSTSTABLE_ENUMS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/notification.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/notification.c
new file mode 100644
index 0000000000..ab602018cf
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/notification.c
@@ -0,0 +1,175 @@
+/** @example notification.c
+ * This example shows how to send a notification from inside the
+ * agent. In this case we do something really boring to decide
+ * whether to send a notification or not: we simply sleep for 30
+ * seconds and send it, then we sleep for 30 more and send it again.
+ * We do this through the snmp_alarm mechanisms (which are safe to
+ * use within the agent. Don't use the system alarm() call, it won't
+ * work properly). Normally, you would probably want to do something
+ * to test whether or not to send an alarm, based on the type of mib
+ * module you were creating.
+ *
+ * When this module is compiled into the agent (run configure with
+ * --with-mib-modules="examples/notification") then it should send
+ * out traps, which when received by the snmptrapd demon will look
+ * roughly like:
+ *
+ * 2002-05-08 08:57:05 localhost.localdomain [udp:127.0.0.1:32865]:
+ * sysUpTimeInstance = Timeticks: (3803) 0:00:38.03 snmpTrapOID.0 = OID: netSnmpExampleNotification
+ *
+ */
+
+/*
+ * start be including the appropriate header files
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * contains prototypes
+ */
+#include "notification.h"
+
+/*
+ * our initialization routine
+ * (to get called, the function name must match init_FILENAME()
+ */
+void
+init_notification(void)
+{
+ DEBUGMSGTL(("example_notification",
+ "initializing (setting callback alarm)\n"));
+ snmp_alarm_register(30, /* seconds */
+ SA_REPEAT, /* repeat (every 30 seconds). */
+ send_example_notification, /* our callback */
+ NULL /* no callback data needed */
+ );
+}
+
+/** here we send a SNMP v2 trap (which can be sent through snmpv3 and
+ * snmpv1 as well) and send it out.
+ *
+ * The various "send_trap()" calls allow you to specify traps in different
+ * formats. And the various "trapsink" directives allow you to specify
+ * destinations to receive different formats.
+ * But *all* traps are sent to *all* destinations, regardless of how they
+ * were specified.
+ *
+ *
+ * I.e. it's
+ * @verbatim
+ * ___ trapsink
+ * /
+ * send_easy_trap \___ [ Trap ] ____ trap2sink
+ * ___ [ Generator ]
+ * send_v2trap / [ ] ----- informsink
+ * \____
+ * trapsess
+ *
+ * *Not*
+ * send_easy_trap -------------------> trapsink
+ * send_v2trap -------------------> trap2sink
+ * ???? -------------------> informsink
+ * ???? -------------------> trapsess
+ * @endverbatim
+ */
+void
+send_example_notification(unsigned int clientreg, void *clientarg)
+{
+ /*
+ * define the OID for the notification we're going to send
+ * NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatNotification
+ */
+ oid notification_oid[] =
+ { 1, 3, 6, 1, 4, 1, 8072, 2, 3, 0, 1 };
+ size_t notification_oid_len = OID_LENGTH(notification_oid);
+ static u_long count = 0;
+
+ /*
+ * In the notification, we have to assign our notification OID to
+ * the snmpTrapOID.0 object. Here is it's definition.
+ */
+ oid objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
+ size_t objid_snmptrap_len = OID_LENGTH(objid_snmptrap);
+
+ /*
+ * define the OIDs for the varbinds we're going to include
+ * with the notification -
+ * NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatRate and
+ * NET-SNMP-EXAMPLES-MIB::netSnmpExampleHeartbeatName
+ */
+ oid hbeat_rate_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 2, 3, 2, 1, 0 };
+ size_t hbeat_rate_oid_len = OID_LENGTH(hbeat_rate_oid);
+ oid hbeat_name_oid[] = { 1, 3, 6, 1, 4, 1, 8072, 2, 3, 2, 2, 0 };
+ size_t hbeat_name_oid_len = OID_LENGTH(hbeat_name_oid);
+
+ /*
+ * here is where we store the variables to be sent in the trap
+ */
+ netsnmp_variable_list *notification_vars = NULL;
+ const char *heartbeat_name = "A girl named Maria";
+#ifdef RANDOM_HEARTBEAT
+ int heartbeat_rate = rand() % 60;
+#else
+ int heartbeat_rate = 30;
+#endif
+
+ DEBUGMSGTL(("example_notification", "defining the trap\n"));
+
+ /*
+ * add in the trap definition object
+ */
+ snmp_varlist_add_variable(&notification_vars,
+ /*
+ * the snmpTrapOID.0 variable
+ */
+ objid_snmptrap, objid_snmptrap_len,
+ /*
+ * value type is an OID
+ */
+ ASN_OBJECT_ID,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) notification_oid,
+ /*
+ * size in bytes = oid length * sizeof(oid)
+ */
+ notification_oid_len * sizeof(oid));
+
+ /*
+ * add in the additional objects defined as part of the trap
+ */
+
+ snmp_varlist_add_variable(&notification_vars,
+ hbeat_rate_oid, hbeat_rate_oid_len,
+ ASN_INTEGER,
+ (u_char *)&heartbeat_rate,
+ sizeof(heartbeat_rate));
+
+ /*
+ * if we want to insert additional objects, we do it here
+ */
+ if (heartbeat_rate < 30 ) {
+ snmp_varlist_add_variable(&notification_vars,
+ hbeat_name_oid, hbeat_name_oid_len,
+ ASN_OCTET_STR,
+ heartbeat_name, strlen(heartbeat_name));
+ }
+
+ /*
+ * send the trap out. This will send it to all registered
+ * receivers (see the "SETTING UP TRAP AND/OR INFORM DESTINATIONS"
+ * section of the snmpd.conf manual page.
+ */
+ ++count;
+ DEBUGMSGTL(("example_notification", "sending trap %ld\n",count));
+ send_v2trap(notification_vars);
+
+ /*
+ * free the created notification variable list
+ */
+ DEBUGMSGTL(("example_notification", "cleaning up\n"));
+ snmp_free_varbind(notification_vars);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/notification.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/notification.h
new file mode 100644
index 0000000000..2adfdb2bbf
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/notification.h
@@ -0,0 +1,17 @@
+#ifndef NOTIFICATION_H
+#define NOTIFICATION_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* prototypes for the example */
+void init_notification(void);
+SNMPAlarmCallback send_example_notification;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NOTIFICATION_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/scalar_int.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/scalar_int.c
new file mode 100644
index 0000000000..20afabd041
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/scalar_int.c
@@ -0,0 +1,77 @@
+/** @example scalar_int.c
+ * This example creates some scalar registrations that allows
+ * some simple variables to be accessed via SNMP. In a more
+ * realistic example, it is likely that these variables would also be
+ * manipulated in other ways outside of SNMP gets/sets.
+ *
+ * If this module is compiled into an agent, you should be able to
+ * issue snmp commands that look something like (authentication
+ * information not shown in these commands):
+ *
+ * - snmpget localhost netSnmpExampleInteger.0
+ * - netSnmpExampleScalars = 42
+ *
+ * - snmpset localhost netSnmpExampleInteger.0 = 1234
+ * - netSnmpExampleScalars = 1234
+ *
+ * - snmpget localhost netSnmpExampleInteger.0
+ * - netSnmpExampleScalars = 1234
+ *
+ */
+
+/*
+ * start be including the appropriate header files
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * Then, we declare the variables we want to be accessed
+ */
+static int example1 = 42; /* default value */
+
+/*
+ * our initialization routine, automatically called by the agent
+ * (to get called, the function name must match init_FILENAME())
+ */
+void
+init_scalar_int(void)
+{
+ /*
+ * the OID we want to register our integer at. This should be a
+ * fully qualified instance. In our case, it's a scalar at:
+ * NET-SNMP-EXAMPLES-MIB::netSnmpExampleInteger.0 (note the
+ * trailing 0 which is required for any instantiation of any
+ * scalar object)
+ */
+ oid my_registration_oid[] =
+ { 1, 3, 6, 1, 4, 1, 8072, 2, 1, 1, 0 };
+
+ /*
+ * a debugging statement. Run the agent with -Dexample_scalar_int to see
+ * the output of this debugging statement.
+ */
+ DEBUGMSGTL(("example_scalar_int",
+ "Initalizing example scalar int. Default value = %d\n",
+ example1));
+
+ /*
+ * the line below registers our "example1" variable above as
+ * accessible and makes it writable. A read only version of the
+ * same registration would merely call
+ * register_read_only_int_instance() instead.
+ *
+ * If we wanted a callback when the value was retrieved or set
+ * (even though the details of doing this are handled for you),
+ * you could change the NULL pointer below to a valid handler
+ * function.
+ */
+ netsnmp_register_int_instance("my example int variable",
+ my_registration_oid,
+ OID_LENGTH(my_registration_oid),
+ &example1, NULL);
+
+ DEBUGMSGTL(("example_scalar_int",
+ "Done initalizing example scalar int\n"));
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/scalar_int.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/scalar_int.h
new file mode 100644
index 0000000000..223b5681dd
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/scalar_int.h
@@ -0,0 +1,14 @@
+#ifndef SCALAR_INT_H
+#define SCALAR_INT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void init_scalar_int(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SCALAR_INT_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/ucdDemoPublic.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/ucdDemoPublic.c
new file mode 100644
index 0000000000..bdab64afea
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/ucdDemoPublic.c
@@ -0,0 +1,228 @@
+/*
+ * ucdDemoPublic.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+#include "ucdDemoPublic.h"
+
+#define MYMAX 1024
+#define MAXUSERS 10
+
+int num = 0;
+static char demoUsers[MAXUSERS][MYMAX + 1];
+static char demopass[MYMAX + 1];
+
+void
+ucdDemo_parse_user(const char *word, char *line)
+{
+ if (num == MAXUSERS)
+ return;
+
+ if (strlen(line) > MYMAX)
+ return;
+
+ strcpy(demoUsers[num++], line);
+}
+
+
+void
+ucdDemo_parse_userpass(const char *word, char *line)
+{
+ if (strlen(line) > MYMAX)
+ return;
+
+ strcpy(demopass, line);
+}
+
+/*
+ * this variable defines function callbacks and type return information
+ * for the ucdDemoPublic mib
+ */
+
+struct variable2 ucdDemoPublic_variables[] = {
+ {UCDDEMORESETKEYS, ASN_INTEGER, RWRITE, var_ucdDemoPublic, 1, {1}},
+ {UCDDEMOPUBLICSTRING, ASN_OCTET_STR, RWRITE, var_ucdDemoPublic, 1,
+ {2}},
+ {UCDDEMOUSERLIST, ASN_OCTET_STR, RWRITE, var_ucdDemoPublic, 1, {3}},
+ {UCDDEMOPASSPHRASE, ASN_OCTET_STR, RWRITE, var_ucdDemoPublic, 1, {4}},
+
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+oid ucdDemoPublic_variables_oid[] =
+ { 1, 3, 6, 1, 4, 1, 2021, 14, 1, 1 };
+
+void
+init_ucdDemoPublic(void)
+{
+ REGISTER_MIB("examples/ucdDemoPublic", ucdDemoPublic_variables,
+ variable2, ucdDemoPublic_variables_oid);
+ snmpd_register_config_handler("demoUser",
+ ucdDemo_parse_user, NULL, "USER");
+ snmpd_register_config_handler("demoPass",
+ ucdDemo_parse_userpass, NULL,
+ "PASSPHASE");
+}
+
+unsigned char publicString[MYMAX + 1];
+
+unsigned char *
+var_ucdDemoPublic(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+ static char string[MYMAX + 1], *cp;
+ int i;
+
+ *write_method = 0; /* assume it isnt writable for the time being */
+ *var_len = sizeof(long_ret); /* assume an integer and change later if not */
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return 0;
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+
+ case UCDDEMORESETKEYS:
+ *write_method = write_ucdDemoResetKeys;
+ long_ret = 0;
+ return (unsigned char *) &long_ret;
+
+ case UCDDEMOPUBLICSTRING:
+ *write_method = write_ucdDemoPublicString;
+ *var_len = strlen(publicString);
+ return (unsigned char *) publicString;
+
+ case UCDDEMOUSERLIST:
+ cp = string;
+ for (i = 0; i < num; i++) {
+ snprintf(cp, sizeof(string)-strlen(string), " %s", demoUsers[i]);
+ string[MYMAX] = 0;
+ cp = cp + strlen(cp);
+ }
+ *var_len = strlen(string);
+ return (unsigned char *) string;
+
+ case UCDDEMOPASSPHRASE:
+ *var_len = strlen(demopass);
+ return (unsigned char *) demopass;
+
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ucdDemoPublic\n",
+ vp->magic));
+ }
+ return 0;
+}
+
+int
+write_ucdDemoResetKeys(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ /*
+ * variables we may use later
+ */
+ static long long_ret;
+ unsigned char *engineID;
+ size_t engineIDLen;
+ int i;
+ struct usmUser *user;
+
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("ucdDemoPublic",
+ "write to ucdDemoResetKeys not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(long_ret)) {
+ DEBUGMSGTL(("ucdDemoPublic",
+ "write to ucdDemoResetKeys: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (action == COMMIT) {
+ long_ret = *((long *) var_val);
+ if (long_ret == 1) {
+ engineID = snmpv3_generate_engineID(&engineIDLen);
+ for (i = 0; i < num; i++) {
+ user = usm_get_user(engineID, engineIDLen, demoUsers[i]);
+ if (user) {
+ usm_set_user_password(user, "userSetAuthPass",
+ demopass);
+ usm_set_user_password(user, "userSetPrivPass",
+ demopass);
+ }
+ }
+ /*
+ * reset the keys
+ */
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_ucdDemoPublicString(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ if (var_val_type != ASN_OCTET_STR) {
+ DEBUGMSGTL(("ucdDemoPublic",
+ "write to ucdDemoPublicString not ASN_OCTET_STR\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > MYMAX) {
+ DEBUGMSGTL(("ucdDemoPublic",
+ "write to ucdDemoPublicString: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (action == COMMIT) {
+ if (var_val_len != 0) {
+ strcpy(publicString, var_val);
+ publicString[var_val_len] = '\0';
+ } else
+ publicString[0] = '\0';
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/ucdDemoPublic.cmds b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/ucdDemoPublic.cmds
new file mode 100755
index 0000000000..41ce10e6a4
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/ucdDemoPublic.cmds
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+snmpusm -e 800007e501d0d6a623 -v 3 -p 1633 localhost create noAuthUser
+snmpusm -e 800007e501d0d6a623 -v 3 -p 1633 localhost create MD5DESUser templateMD5
+snmpusm -e 800007e501d0d6a623 -v 3 -p 1633 localhost create SHADESUser templateSHA
+snmpusm -e 800007e501d0d6a623 -v 3 -p 1633 localhost create MD5User templateMD5
+snmpusm -e 800007e501d0d6a623 -v 3 -p 1633 localhost create SHAUser templateSHA
+snmpset -R -v 3 -p 1633 localhost usmUserPrivProtocol.9.128.0.7.229.1.208.214.166.35.7.77.68.53.85.115.101.114 o .1.3.6.1.6.3.10.1.2.1 usmUserPrivProtocol.9.128.0.7.229.1.208.214.166.35.7.83.72.65.85.115.101.114 o .1.3.6.1.6.3.10.1.2.1
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/ucdDemoPublic.conf b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/ucdDemoPublic.conf
new file mode 100644
index 0000000000..ff4a207272
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/ucdDemoPublic.conf
@@ -0,0 +1,89 @@
+#*************************************************************
+# Define the views that the demogroup will be
+# restricted to.
+#
+# Format:
+# view NAME TYPE SUBTREE [MASK]
+#
+view demoWrite included .1.3.6.1.4.1.2021.14.1.1
+view demoRead included .1.3.6.1.4.1.2021.14.1.1
+view demoRead included .1.3.6.1.2.1.1
+# ---+----
+# +---------------------------------------------------------+
+# |
+#************************************************************* |
+# Map any v1 style communities to a securityName |
+# |
+# Format: |
+# com2sec NAME SOURCE COMMUNITY |
+# |
+com2sec v1User default v1demopublic |
+com2sec v2cUser default demopublic |
+# ---+--- |
+# +----------------------------------------------------+ |
+# | |
+# | |
+#************************************************************** | |
+# Define the demogroup users and their access models | |
+# | |
+# Format: | |
+# group NAME MODEL SECURITY | |
+# | |
+# +----------------------------------------+ |
+# \|/ |
+# _______ |
+group demogroup v1 v1User |
+group demogroup v2c v2cUser |
+# ----+---- |
+# +---------------------------------------------------+ |
+# | |
+# | |
+#*********************************************************** | |
+# Define views for the group | |
+# | |
+# Format: | |
+# access NAME CONTEXT MODEL LEVEL PREFX READ WRITE NOTIFY | |
+# | |
+# +--------------------------------------------------+ |
+# | +--------+---------------+
+# \|/ \|/ \|/
+# _________ ________ _________
+access demogroup "" any noauth prefix demoRead demoWrite none
+
+#
+# the demoUser token is supported by the examples/ucdDempPublic module
+#
+demoUser noAuthUser
+demoUser MD5User
+demoUser MD5DESUser
+demoUser SHAUser
+demoUser SHADESUser
+demoPass The Net-SNMP Demo Password
+
+#
+# more security names for demogroup
+#
+group demogroup usm noAuthUser
+group demogroup usm MD5User
+group demogroup usm SHAUser
+group demogroup usm MD5DESUser
+group demogroup usm SHADESUser
+#
+# more views for demowrite
+#
+view demowrite included .1.3.6.1.6.3.12.1.2.2.1.10.9.128.0.7.229.1.208.214.166.35.7.77.68.53.85.115.101.114
+view demowrite included .1.3.6.1.6.3.12.1.2.2.1.10.9.128.0.7.229.1.208.214.166.35.7.83.72.65.85.115.101.114
+view demowrite included .1.3.6.1.6.3.12.1.2.2.1.10.9.128.0.7.229.1.208.214.166.35.10.77.68.53.68.69.83.85.115.101.114
+view demowrite included .1.3.6.1.6.3.12.1.2.2.1.10.9.128.0.7.229.1.208.214.166.35.10.83.72.65.68.69.83.85.115.101.114
+view demowrite included .1.3.6.1.6.3.12.1.2.2.1.10.9.128.0.7.229.1.208.214.166.35.10.110.111.65.117.116.104.85.115.101.114
+#
+#
+# normally these would be added in /var/net-snmp/snmpd.conf (while
+# snmpd was not running), where they will be replaced by a local
+# key when the agent started up, thus providing a bit more security.
+#
+createUser noAuthUser
+createUser MD5User MD5 "The Net-SNMP Demo Password"
+createUser SHAUser SHA "The Net-SNMP Demo Password"
+createUser MD5DESUser MD5 "The Net-SNMP Demo Password" DES "The Net-SNMP Demo Password"
+createUser SHADESUser SHA "The Net-SNMP Demo Password" DES "The Net-SNMP Demo Password"
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/ucdDemoPublic.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/ucdDemoPublic.h
new file mode 100644
index 0000000000..fd9f12fdb1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/ucdDemoPublic.h
@@ -0,0 +1,38 @@
+/*
+ * ucdDemoPublic.h
+ */
+
+#ifndef _MIBGROUP_UCDDEMOPUBLIC_H
+#define _MIBGROUP_UCDDEMOPUBLIC_H
+
+/*
+ * we use header_generic and checkmib from the util_funcs module
+ */
+
+config_require(util_funcs)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * Magic number definitions:
+ */
+#define UCDDEMORESETKEYS 1
+#define UCDDEMOPUBLICSTRING 2
+#define UCDDEMOUSERLIST 3
+#define UCDDEMOPASSPHRASE 4
+ /*
+ * function definitions
+ */
+ void init_ucdDemoPublic(void);
+ FindVarMethod var_ucdDemoPublic;
+ WriteMethod write_ucdDemoResetKeys;
+ WriteMethod write_ucdDemoPublicString;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MIBGROUP_UCDDEMOPUBLIC_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/watched.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/watched.c
new file mode 100644
index 0000000000..a1b58b6288
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/watched.c
@@ -0,0 +1,104 @@
+/*
+ * watched.c
+ * $Id: watched.c 12097 2005-04-20 18:03:47Z rstory $
+ *
+ */
+/** @example watched.c
+ * These examples creates some scalar registrations that allows
+ * some simple variables to be accessed via SNMP. In a more
+ * realistic example, it is likely that these variables would also be
+ * manipulated in other ways outside of SNMP gets/sets.
+ */
+
+/*
+ * start by including the appropriate header files
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+void init_watched_string(void);
+
+void init_watched(void)
+{
+ init_watched_string();
+}
+
+void init_watched_string(void)
+{
+ /*
+ * the storage for our string. It must be static or allocated.
+ * we use static here for simplicity.
+ */
+ static char my_string[256] = "So long, and thanks for all the fish!";
+
+ /*
+ * the OID we want to register our string at. This should be a
+ * fully qualified instance. In our case, it's a scalar at:
+ * NET-SNMP-EXAMPLES-MIB::netSnmpExampleString.0 (note the trailing
+ * 0 which is required for any instantiation of any scalar object)
+ */
+ oid my_registration_oid[] =
+ { 1, 3, 6, 1, 4, 1, 8072, 2, 1, 3, 0 };
+
+ /*
+ * variables needed for registration
+ */
+ netsnmp_handler_registration *reginfo;
+ netsnmp_watcher_info *watcher_info;
+ int watcher_flags;
+
+ /*
+ * a debugging statement. Run the agent with -Dexample_string_instance
+ * to see the output of this debugging statement.
+ */
+ DEBUGMSGTL(("example_string_instance",
+ "Initalizing example string instance. Default value = %s\n",
+ my_string));
+
+ /*
+ * create the registration info for our string. If you want to
+ *
+ * If we wanted a callback when the value was retrieved or set
+ * (even though the details of doing this are handled for you),
+ * you could change the NULL pointer below to a valid handler
+ * function.
+ *
+ * Change RWRITE to RONLY for a read-only string.
+ */
+ reginfo = netsnmp_create_handler_registration("my example string", NULL,
+ my_registration_oid,
+ OID_LENGTH(my_registration_oid),
+ HANDLER_CAN_RWRITE);
+
+ /*
+ * the two options for a string watcher are:
+ * fixed size string (length never changes)
+ * variable size (length can be 0 - MAX, for some MAX)
+ *
+ * we'll use a variable length string.
+ */
+ watcher_flags = WATCHER_MAX_SIZE;
+
+ /*
+ * create the watcher info for our string, and set the max size.
+ */
+ watcher_info =
+ netsnmp_create_watcher_info(my_string, strlen(my_string),
+ ASN_OCTET_STR, watcher_flags);
+ watcher_info->max_size = sizeof(my_string);
+
+ /*
+ * the line below registers our "my_string" variable above as
+ * accessible and makes it writable.
+ *
+ * If we wanted a callback when the value was retrieved or set
+ * (even though the details of doing this are handled for you),
+ * you could change the NULL pointer below to a valid handler
+ * function.
+ */
+ netsnmp_register_watched_instance(reginfo, watcher_info);
+
+ DEBUGMSGTL(("example_string_instance",
+ "Done initalizing example string instance\n"));
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/watched.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/watched.h
new file mode 100644
index 0000000000..84e5f335c5
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/examples/watched.h
@@ -0,0 +1,14 @@
+#ifndef EXAMPLES_WATCHED_H
+#define EXAMPLES_WATCHED_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void init_watched(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* EXAMPLES_WATCHED_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu.h
new file mode 100644
index 0000000000..3ee7162c67
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu.h
@@ -0,0 +1,32 @@
+config_require(hardware/cpu/cpu)
+
+#if defined(linux)
+config_require(hardware/cpu/cpu_linux)
+
+#elif defined(darwin)
+config_require(hardware/cpu/cpu_mach)
+
+#elif (defined(irix6) && defined(NETSNMP_INCLUDE_HARDWARE_CPU_PCP_MODULE))
+config_require(hardware/cpu/cpu_pcp)
+
+#elif defined(irix6)
+config_require(hardware/cpu/cpu_sysinfo)
+
+#elif (defined(netbsd) || defined(netbsd1) || defined(netbsdelf) || defined(netbsdelf2)|| defined(netbsdelf3) || defined(openbsd2) || defined(openbsd3) || defined(openbsd4) || defined(freebsd4) || defined(freebsd5) || defined(freebsd6))
+config_require(hardware/cpu/cpu_sysctl)
+
+#elif (defined(freebsd2) || defined(freebsd3))
+config_require(hardware/cpu/cpu_nlist)
+
+#elif (defined(aix4) || defined(aix5) || defined(aix6))
+config_require(hardware/cpu/cpu_perfstat)
+
+#elif (defined(solaris2))
+config_require(hardware/cpu/cpu_kstat)
+
+#elif (defined(hpux10) || defined(hpux11))
+config_require(hardware/cpu/cpu_pstat)
+
+#else
+config_require(hardware/cpu/cpu_null)
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu.c
new file mode 100644
index 0000000000..201eff7128
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu.c
@@ -0,0 +1,246 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/cpu.h>
+
+extern NetsnmpCacheLoad netsnmp_cpu_arch_load;
+static void _cpu_update_stats( unsigned int, void* );
+
+static int _cpuAutoUpdate = 5;
+static int _cpuHistoryLen;
+int cpu_num = 0;
+
+static netsnmp_cpu_info *_cpu_head = NULL;
+static netsnmp_cpu_info *_cpu_tail = NULL;
+static netsnmp_cache *_cpu_cache = NULL;
+
+void init_cpu( void ) {
+ /*
+ * If we're sampling the CPU statistics automatically,
+ * then arrange for this to be triggered regularly,
+ * keeping sufficient samples to cover the last minute.
+ * If the system-specific code has already initialised
+ * the list of CPU entries, then retrieve the first set
+ * of stats immediately.
+ * Otherwise, wait until the regular sampling kicks in.
+ *
+ * If we're not sampling these statistics regularly,
+ * create a suitable cache handler instead.
+ */
+ if ( _cpuAutoUpdate ) {
+
+ _cpuHistoryLen = 60/_cpuAutoUpdate;
+ snmp_alarm_register( _cpuAutoUpdate, SA_REPEAT, _cpu_update_stats,
+ NULL );
+ if ( _cpu_head )
+ _cpu_update_stats( 0, NULL );
+ } else
+ _cpu_cache = netsnmp_cache_create( 5, netsnmp_cpu_arch_load,
+ NULL, NULL, 0 );
+}
+
+void shutdown_cpu( void ) {
+ while ( _cpu_head ) {
+ netsnmp_cpu_info *tmp = _cpu_head;
+ _cpu_head = _cpu_head->next;
+ SNMP_FREE(tmp->history);
+ SNMP_FREE(tmp);
+ }
+ _cpu_tail = NULL;
+}
+
+
+netsnmp_cpu_info *netsnmp_cpu_get_first( void ) {
+ return _cpu_head;
+}
+netsnmp_cpu_info *netsnmp_cpu_get_next( netsnmp_cpu_info *this_ptr ) {
+ return ( this_ptr ? this_ptr->next : NULL );
+}
+
+ /*
+ * Work with a list of CPU entries, indexed numerically
+ */
+netsnmp_cpu_info *netsnmp_cpu_get_byIdx( int idx, int create ) {
+ netsnmp_cpu_info *cpu, *cpu2;
+
+ /*
+ * Find the specified CPU entry
+ */
+ DEBUGMSGTL(("cpu", "cpu_get_byIdx %d ", idx));
+ for ( cpu=_cpu_head; cpu; cpu=cpu->next ) {
+ if ( cpu->idx == idx ) {
+ DEBUGMSG(("cpu", "(found)\n"));
+ return cpu;
+ }
+ }
+ if (!create) {
+ DEBUGMSG(("cpu", "(not found)\n"));
+ return NULL;
+ }
+
+ /*
+ * Create a new CPU entry, and insert it into the list....
+ */
+ cpu = SNMP_MALLOC_TYPEDEF( netsnmp_cpu_info );
+ if (!cpu) {
+ return NULL;
+ DEBUGMSG(("cpu", "(failed)\n"));
+ }
+ DEBUGMSG(("cpu", "(created)\n"));
+ cpu->idx = idx;
+ /* ... either as the first (or only) entry.... */
+ if ( !_cpu_head || _cpu_head->idx > idx ) {
+ cpu->next = _cpu_head;
+ _cpu_head = cpu;
+ if (!_cpu_tail)
+ _cpu_tail = cpu;
+ return cpu;
+ }
+ /* ... or in the appropriate position */
+ for ( cpu2=_cpu_head; cpu2; cpu2=cpu2->next ) {
+ if ( !cpu2->next || cpu2->next->idx > idx ) {
+ cpu->next = cpu2->next;
+ cpu2->next = cpu;
+ if (!cpu->next)
+ _cpu_tail = cpu;
+ return cpu;
+ }
+ }
+ if (cpu)
+ SNMP_FREE(cpu); /* just in case */
+ return NULL; /* Shouldn't happen! */
+}
+
+ /*
+ * Work with a list of CPU entries, indexed by name
+ */
+netsnmp_cpu_info *netsnmp_cpu_get_byName( char *name, int create ) {
+ netsnmp_cpu_info *cpu;
+
+ /*
+ * Find the specified CPU entry
+ */
+ for ( cpu=_cpu_head; cpu; cpu=cpu->next ) {
+ if ( !strcmp(cpu->name, name))
+ return cpu;
+ }
+ if (!create)
+ return NULL;
+
+ /*
+ * Create a new CPU entry, and append it to the list
+ */
+ cpu = SNMP_MALLOC_TYPEDEF( netsnmp_cpu_info );
+ if (!cpu)
+ return NULL;
+ strcpy(cpu->name, name);
+ if ( _cpu_tail ) {
+ cpu->idx = _cpu_tail->idx+1;
+ _cpu_tail->next = cpu;
+ _cpu_tail = cpu;
+ } else {
+ cpu->idx = 0;
+ _cpu_head = cpu;
+ _cpu_tail = cpu;
+ }
+ return cpu;
+}
+
+netsnmp_cache *netsnmp_cpu_get_cache( void ) {
+ return _cpu_cache;
+}
+
+int netsnmp_cpu_load( void ) {
+ /*
+ * If we're automatically updating the stats regularly,
+ * then don't invoke the cache handling.
+ */
+ return ( _cpuAutoUpdate ? 1
+ : netsnmp_cache_check_and_reload( _cpu_cache ));
+}
+
+ /*
+ * Call the system-specific load routine regularly,
+ * keeping track of the relevant earlier results.
+ */
+static void
+_cpu_update_stats( unsigned int reg, void* magic ) {
+ netsnmp_cpu_info *cpu;
+ int i;
+
+ for ( cpu=_cpu_head; cpu; cpu=cpu->next ) {
+ if ( !cpu->history ) {
+ /*
+ * First time through, we need to create buffers
+ * for the historical stats
+ */
+ cpu->history = calloc( _cpuHistoryLen, sizeof(struct netsnmp_cpu_history));
+ } else {
+ /*
+ * Otherwise, rotate these values - in descending order
+ * with the earliest (relevant) statistics in entry 0.
+ * This means that the code to calculate the rolling averages
+ * is independent of the number of historical samples saved.
+ */
+ for (i=0; i<_cpuHistoryLen-2; i++) {
+ cpu->history[i] = cpu->history[i+1];
+ }
+ cpu->history[i].user_hist = cpu->user_ticks;
+ cpu->history[i].sys_hist = cpu->sys_ticks;
+ cpu->history[i].idle_hist = cpu->idle_ticks;
+ cpu->history[i].nice_hist = cpu->nice_ticks;
+ cpu->history[i].total_hist = cpu->total_ticks;
+
+ cpu->history[i].ctx_hist = cpu->nCtxSwitches;
+ cpu->history[i].intr_hist = cpu->nInterrupts;
+ cpu->history[i].swpi_hist = cpu->swapIn;
+ cpu->history[i].swpo_hist = cpu->swapOut;
+ cpu->history[i].pagei_hist = cpu->pageIn;
+ cpu->history[i].pageo_hist = cpu->pageOut;
+ }
+ }
+
+ /*
+ * Now call the system-specific load routine, to
+ * retrieve the latest set of data.
+ */
+ netsnmp_cpu_arch_load( NULL, NULL );
+ for ( cpu=_cpu_head; cpu; cpu=cpu->next ) {
+ cpu->total_ticks = cpu->user_ticks +
+ cpu->nice_ticks +
+ cpu->sys_ticks +
+ cpu->idle_ticks +
+ cpu->wait_ticks +
+ cpu->kern_ticks +
+ cpu->intrpt_ticks +
+ cpu->sirq_ticks;
+ }
+}
+
+void _cpu_copy_stats( netsnmp_cpu_info *cpu )
+{
+ netsnmp_cpu_info *cpu2;
+
+ /*
+ * Copy "overall" statistics to the 'cpu0' entry
+ * on single CPU systems where this isn't done automatically
+ */
+ cpu2 = netsnmp_cpu_get_byIdx( 0, 1 );
+ if (!cpu || !cpu2) return;
+ cpu2->user_ticks = cpu->user_ticks;
+ cpu2->nice_ticks = cpu->nice_ticks;
+ cpu2->sys_ticks = cpu->sys_ticks;
+ cpu2->sys2_ticks = cpu->sys2_ticks;
+ cpu2->idle_ticks = cpu->idle_ticks;
+ cpu2->wait_ticks = cpu->wait_ticks;
+ cpu2->kern_ticks = cpu->kern_ticks;
+ cpu2->intrpt_ticks = cpu->intrpt_ticks;
+ cpu2->sirq_ticks = cpu->sirq_ticks;
+
+ cpu2->nInterrupts = cpu->nInterrupts;
+ cpu2->nCtxSwitches = cpu->nCtxSwitches;
+ cpu2->swapIn = cpu->swapIn;
+ cpu2->swapOut = cpu->swapOut;
+ cpu2->pageIn = cpu->pageIn;
+ cpu2->pageOut = cpu->pageOut;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu.h
new file mode 100644
index 0000000000..bb7a1e465f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu.h
@@ -0,0 +1,2 @@
+void init_cpu(void);
+void shutdown_cpu(void);
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_kerndata.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_kerndata.c
new file mode 100644
index 0000000000..9a9c4a4d6f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_kerndata.c
@@ -0,0 +1,95 @@
+/*
+ * getkerndata() interface
+ * e.g. Dynix
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/cpu.h>
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+#include <vm/vm_param.h>
+#include <vm/vm_extern.h>
+
+
+ /*
+ * Initialise the list of CPUs on the system
+ * (including descriptions)
+ */
+void init_cpu_nlist( void ) {
+ int i;
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 1 );
+ strcpy(cpu->name, "Overall CPU statistics");
+
+ cpu_num = tmp_ctl( TMP_NENG, 0 );
+ if ( cpu_num <= 0 )
+ cpu_num = 1; /* Single CPU system */
+ for ( i=0; i < cpu_num; i++ ) {
+ cpu = netsnmp_cpu_get_byIdx( i, 1 );
+ sprintf( cpu->name, "cpu%d", i );
+ }
+}
+
+
+ /*
+ * Load the latest CPU usage statistics
+ */
+int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+ int i;
+ exp_vmmeter_t *vminfo;
+ size_t vminfo_size;
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 0 );
+ netsnmp_cpu_info *cpu2;
+
+ /* Clear overall stats, ready for summing individual CPUs */
+ cpu->user_ticks = 0;
+ cpu->idle_ticks = 0;
+ cpu->kern_ticks = 0;
+ cpu->wait_ticks = 0;
+ cpu->sys2_ticks = 0;
+ cpu->swapIn = 0;
+ cpu->swapOut = 0;
+ cpu->nInterrupts = 0;
+ cpu->nCtxSwitches = 0;
+
+ vminfo_size = cpu_num * sizeof(exp_vmmeter_t);
+ vminfo = (exp_vmmeter_t *)malloc( vminfo_size );
+ getkerninfo(VMMETER_DATAID, vminfo, vminfo_size);
+
+ for ( i=0; i < cpu_num; i++ ) {
+ cpu2 = netsnmp_cpu_get_byIdx( i, 0 );
+
+ cpu2->user_ticks = (unsigned long)vminfo[i].v_time[V_CPU_USER];
+ cpu2->idle_ticks = (unsigned long)vminfo[i].v_time[V_CPU_IDLE];
+ cpu2->kern_ticks = (unsigned long)vminfo[i].v_time[V_CPU_KERNEL];
+ cpu2->wait_ticks = (unsigned long)vminfo[i].v_time[V_CPU_STREAM];
+ cpu2->sys2_ticks = (unsigned long)vminfo[i].v_time[V_CPU_KERNEL]+
+ vminfo[i].v_time[V_CPU_STREAM];
+ /* nice_ticks, intrpt_ticks, sirq_ticks unused */
+
+ /* sum these for the overall stats */
+ cpu->user_ticks += (unsigned long)vminfo[i].v_time[V_CPU_USER];
+ cpu->idle_ticks += (unsigned long)vminfo[i].v_time[V_CPU_IDLE];
+ cpu->kern_ticks += (unsigned long)vminfo[i].v_time[V_CPU_KERNEL];
+ cpu->wait_ticks += (unsigned long)vminfo[i].v_time[V_CPU_STREAM];
+ cpu->sys2_ticks += (unsigned long)vminfo[i].v_time[V_CPU_KERNEL]+
+ vminfo[i].v_time[V_CPU_STREAM];
+
+ /*
+ * Interrupt/Context Switch statistics
+ * XXX - Do these really belong here ?
+ */
+ cpu->swapIn += (unsigned long)vminfo[i].v_swpin;
+ cpu->swapOut += (unsigned long)vminfo[i].v_swpout;
+ cpu->pageIn += (unsigned long)vminfo[i].v_phread;
+ cpu->pageOut += (unsigned long)vminfo[i].v_phwrite;
+ cpu->nInterrupts += (unsigned long)vminfo[i].v_intr;
+ cpu->nCtxSwitches += (unsigned long)vminfo[i].v_swtch;
+ }
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_kerndata.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_kerndata.h
new file mode 100755
index 0000000000..7a0d9c786e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_kerndata.h
@@ -0,0 +1,2 @@
+config_require(hardware/cpu/cpu)
+void init_cpu_kerndata(void);
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_kstat.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_kstat.c
new file mode 100644
index 0000000000..e7b8c5e719
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_kstat.c
@@ -0,0 +1,162 @@
+/*
+ * kstat() interface
+ * e.g. Solaris
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/cpu.h>
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#include <kstat.h>
+#include <sys/sysinfo.h>
+
+extern kstat_ctl_t *kstat_fd;
+extern int cpu_num;
+int _cpu_status(char *state);
+
+ /*
+ * Initialise the list of CPUs on the system
+ * (including descriptions)
+ */
+void init_cpu_kstat( void ) {
+ int i, n=0, clock, state_begin;
+ char ctype[15], ftype[15], state[10];
+ kstat_t *ksp;
+ kstat_named_t *ks_data;
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 1 );
+ strcpy(cpu->name, "Overall CPU statistics");
+
+ if (kstat_fd == NULL)
+ kstat_fd = kstat_open();
+ kstat_chain_update( kstat_fd );
+
+ DEBUGMSGTL(("cpu", "cpu_kstat init\n "));
+ for (ksp = kstat_fd->kc_chain; ksp != NULL; ksp = ksp->ks_next) {
+ if (ksp->ks_flags & KSTAT_FLAG_INVALID)
+ continue;
+ if ((strcmp(ksp->ks_module, "cpu_info") == 0) &&
+ (strcmp(ksp->ks_class, "misc" ) == 0)) {
+ kstat_read(kstat_fd, ksp, NULL );
+ n++;
+ clock = 999999;
+ memset(ctype, 0, sizeof(ctype));
+ memset(ftype, 0, sizeof(ftype));
+ memset(state, 0, sizeof(state));
+ for (i=0, ks_data = ksp->ks_data; i < ksp->ks_ndata; i++, ks_data++) {
+ if ( strcmp( ks_data->name, "state" ) == 0 ) {
+ strncpy( state, ks_data->value.c, sizeof(state));
+ state[sizeof(state)-1] = '\0';
+ } else if ( strcmp( ks_data->name, "state_begin" ) == 0 ) {
+ state_begin = ks_data->value.i32;
+ } else if ( strcmp( ks_data->name, "cpu_type" ) == 0 ) {
+ strncpy( ctype, ks_data->value.c, sizeof(ctype));
+ state[sizeof(ctype)-1] = '\0';
+ } else if ( strcmp( ks_data->name, "fpu_type" ) == 0 ) {
+ strncpy( ftype, ks_data->value.c, sizeof(ftype));
+ state[sizeof(ftype)-1] = '\0';
+ } else if ( strcmp( ks_data->name, "clock_MHz" ) == 0 ) {
+ clock = ks_data->value.i32;
+ }
+ }
+ i = ksp->ks_instance;
+ cpu = netsnmp_cpu_get_byIdx( i, 1 );
+ sprintf( cpu->name, "cpu%d", i );
+ sprintf( cpu->descr, "CPU %d Sun %d MHz %s with %s FPU %s",
+ i, clock, ctype, ftype, state );
+ cpu->status = _cpu_status(state); /* XXX - or in 'n_c_a_load' ? */
+ }
+ }
+ cpu_num = i;
+}
+
+
+ /*
+ * Load the latest CPU usage statistics
+ */
+int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+ int i=1;
+ kstat_t *ksp;
+ cpu_stat_t cs;
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 0 );
+ netsnmp_cpu_info *cpu2;
+
+ /* Clear overall stats, ready for summing individual CPUs */
+ cpu->user_ticks = 0;
+ cpu->idle_ticks = 0;
+ cpu->kern_ticks = 0;
+ cpu->wait_ticks = 0;
+ cpu->sys2_ticks = 0;
+ cpu->swapIn = 0;
+ cpu->swapOut = 0;
+ cpu->nInterrupts = 0;
+ cpu->nCtxSwitches = 0;
+
+ kstat_chain_update( kstat_fd );
+ DEBUGMSGTL(("cpu", "cpu_kstat load\n "));
+ for (ksp = kstat_fd->kc_chain; ksp != NULL; ksp = ksp->ks_next) {
+ if (ksp->ks_flags & KSTAT_FLAG_INVALID)
+ continue;
+ if (strcmp(ksp->ks_module, "cpu_stat") == 0) {
+ i = ksp->ks_instance;
+ cpu2 = netsnmp_cpu_get_byIdx( i, 0 );
+ if ((ksp->ks_type != KSTAT_TYPE_RAW) ||
+ (ksp->ks_data_size != sizeof(cs))||
+ (kstat_read(kstat_fd, ksp, &cs) == -1)) {
+ DEBUGMSGTL(("cpu", "cpu_kstat load failed (%d)\n ", i));
+ break; /* or continue ? */
+ }
+
+ cpu2->user_ticks = (unsigned long)cs.cpu_sysinfo.cpu[CPU_USER];
+ cpu2->idle_ticks = (unsigned long)cs.cpu_sysinfo.cpu[CPU_IDLE];
+ cpu2->kern_ticks = (unsigned long)cs.cpu_sysinfo.cpu[CPU_KERNEL];
+ cpu2->wait_ticks = (unsigned long)cs.cpu_sysinfo.cpu[CPU_WAIT];
+ /* or cs.cpu_sysinfo.wait[W_IO]+cs.cpu_sysinfo.wait[W_PIO] */
+ cpu2->sys2_ticks = (unsigned long)cpu2->kern_ticks+cpu2->wait_ticks;
+ /* nice_ticks, intrpt_ticks, sirq_ticks unused */
+
+ /* sum these for the overall stats */
+ cpu->user_ticks += (unsigned long)cs.cpu_sysinfo.cpu[CPU_USER];
+ cpu->idle_ticks += (unsigned long)cs.cpu_sysinfo.cpu[CPU_IDLE];
+ cpu->kern_ticks += (unsigned long)cs.cpu_sysinfo.cpu[CPU_KERNEL];
+ cpu->wait_ticks += (unsigned long)cs.cpu_sysinfo.cpu[CPU_WAIT];
+ /* or cs.cpu_sysinfo.wait[W_IO]+cs.cpu_sysinfo.wait[W_PIO] */
+ cpu->sys2_ticks += (unsigned long)cpu2->kern_ticks+cpu2->wait_ticks;
+
+ /*
+ * Interrupt/Context Switch statistics
+ * XXX - Do these really belong here ?
+ */
+ cpu->swapIn += (unsigned long)cs.cpu_vminfo.swapin;
+ cpu->swapOut += (unsigned long)cs.cpu_vminfo.swapout;
+ cpu->nInterrupts += (unsigned long)cs.cpu_sysinfo.intr;
+ cpu->nCtxSwitches += (unsigned long)cs.cpu_sysinfo.pswitch;
+ }
+ }
+ return 0;
+}
+
+int
+_cpu_status( char *state)
+{
+ /*
+ * hrDeviceStatus OBJECT-TYPE
+ * SYNTAX INTEGER {
+ * unknown(1), running(2), warning(3), testing(4), down(5)
+ * }
+ */
+ if (strcmp(state,"on-line")==0)
+ { return 2; /* running */ }
+ else if (strcmp(state,"off-line")==0)
+ { return 5; /* down */ }
+ else if (strcmp(state,"missing")==0)
+ { return 3; /* warning, went missing */ }
+ else if (strcmp(state,"testing")==0)
+ { return 4; /* somebody must be testing code somewhere */ }
+ else
+ { return 1; /* unknown */ }
+}
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_kstat.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_kstat.h
new file mode 100755
index 0000000000..ce3862865c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_kstat.h
@@ -0,0 +1,2 @@
+config_require(hardware/cpu/cpu)
+void init_cpu_kstat(void);
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_linux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_linux.c
new file mode 100644
index 0000000000..7ee82ede12
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_linux.c
@@ -0,0 +1,301 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/cpu.h>
+
+#include <unistd.h>
+#include <fcntl.h>
+
+#define CPU_FILE "/proc/cpuinfo"
+#define STAT_FILE "/proc/stat"
+#define VMSTAT_FILE "/proc/vmstat"
+
+
+ /* Which field(s) describe the type of CPU */
+#if defined(__i386__) || defined(__x86_64__)
+#define DESCR_FIELD "vendor_id"
+#define DESCR2_FIELD "model name"
+#endif
+#if defined(__powerpc__) || defined(__powerpc64__)
+#define DESCR_FIELD "cpu\t"
+#endif
+#if defined(__ia64__)
+ /* since vendor is always Intel ... we don't parse vendor */
+#define DESCR_FIELD "family"
+#endif
+
+
+ /*
+ * Initialise the list of CPUs on the system
+ * (including descriptions)
+ *
+ * XXX - Assumes x86-style /proc/cpuinfo format
+ * See CPUinfo database at
+ * http://www.rush3d.com/gcc/
+ * for info on alternative styles
+ */
+void init_cpu_linux( void ) {
+ FILE *fp;
+ char buf[1024], *cp;
+ int i, n = 0;
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 1 );
+ strcpy(cpu->name, "Overall CPU statistics");
+
+ fp = fopen( CPU_FILE, "r" );
+ if (!fp) {
+ snmp_log(LOG_ERR, "Can't open procinfo file %s\n", CPU_FILE);
+ return;
+ }
+ while ( fgets( buf, sizeof(buf), fp)) {
+ if ( sscanf( buf, "processor : %d", &i ) == 1) {
+ n++;
+ cpu = netsnmp_cpu_get_byIdx( i, 1 );
+ cpu->status = 2; /* running */
+ sprintf( cpu->name, "cpu%d", i );
+#if defined(__s390__) || defined(__s390x__)
+ strcat( cpu->descr, "An S/390 CPU" );
+#endif
+ }
+#if defined(__s390__) || defined(__s390x__)
+ /* s390 may different format of CPU_FILE */
+ else {
+ if (sscanf( buf, "processor %d:", &i ) == 1) {
+ n++;
+ cpu = netsnmp_cpu_get_byIdx( i, 1 );
+ cpu->status = 2; /* running */
+ sprintf( cpu->name, "cpu%d", i );
+ strcat( cpu->descr, "An S/390 CPU" );
+ }
+ }
+#endif
+
+#ifdef DESCR_FIELD
+ if (!strncmp( buf, DESCR_FIELD, strlen(DESCR_FIELD))) {
+ cp = strchr( buf, ':' );
+ strcpy( cpu->descr, cp+2 );
+ cp = strchr( cpu->descr, '\n' );
+ *cp = 0;
+ }
+#endif
+#ifdef DESCR2_FIELD
+ if (!strncmp( buf, DESCR2_FIELD, strlen(DESCR2_FIELD))) {
+ cp = strchr( buf, ':' );
+ strcat( cpu->descr, cp );
+ cp = strchr( cpu->descr, '\n' );
+ *cp = 0;
+ }
+#endif
+ }
+ fclose(fp);
+ cpu_num = n;
+}
+
+void _cpu_load_swap_etc( char *buff, netsnmp_cpu_info *cpu );
+
+ /*
+ * Load the latest CPU usage statistics
+ */
+int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+ static char *buff = NULL;
+ static int bsize = 0;
+ static int first = 1;
+ static int has_cpu_26 = 1;
+ int statfd, i;
+ char *b1, *b2;
+ unsigned long long cusell = 0, cicell = 0, csysll = 0, cidell = 0,
+ ciowll = 0, cirqll = 0, csoftll = 0;
+ netsnmp_cpu_info* cpu;
+
+ if ((statfd = open(STAT_FILE, O_RDONLY, 0)) == -1) {
+ snmp_log_perror(STAT_FILE);
+ return -1;
+ }
+ if (bsize == 0) {
+ bsize = 256;
+ buff = malloc(bsize);
+ }
+ while (read(statfd, buff, bsize) == bsize) {
+ bsize += 256;
+ buff = realloc(buff, bsize);
+ DEBUGMSGTL(("cpu", "/proc/stat buffer increased to %d\n", bsize));
+ close(statfd);
+ statfd = open(STAT_FILE, O_RDONLY, 0);
+ }
+ close(statfd);
+
+ /*
+ * CPU statistics (overall and per-CPU)
+ */
+ b1 = buff;
+ while ((b2 = strstr( b1, "cpu" ))) {
+ if (b2[3] == ' ') {
+ cpu = netsnmp_cpu_get_byIdx( -1, 0 );
+ if (!cpu) {
+ snmp_log_perror("No (overall) CPU info entry");
+ return -1;
+ }
+ b1 = b2+4; /* Skip "cpu " */
+ } else {
+ sscanf( b2, "cpu%d", &i );
+ /* Create on the fly to support non-x86 systems - see init */
+ cpu = netsnmp_cpu_get_byIdx( i, 1 );
+ if (!cpu) {
+ snmp_log_perror("Missing CPU info entry");
+ break;
+ }
+ b1 = b2+5; /* Skip "cpuN " */
+ }
+
+ if (!has_cpu_26 ||
+ sscanf(b1, "%llu %llu %llu %llu %llu %llu %llu", &cusell,
+ &cicell, &csysll, &cidell, &ciowll, &cirqll, &csoftll) != 7) {
+ has_cpu_26 = 0;
+ sscanf(b1, "%llu %llu %llu %llu", &cusell, &cicell, &csysll,
+ &cidell);
+
+ } else {
+ cpu->wait_ticks = (unsigned long)ciowll;
+ cpu->intrpt_ticks = (unsigned long)cirqll;
+ cpu->sirq_ticks = (unsigned long)csoftll;
+ }
+ cpu->user_ticks = (unsigned long)cusell;
+ cpu->nice_ticks = (unsigned long)cicell;
+ cpu->sys_ticks = (unsigned long)csysll;
+ cpu->idle_ticks = (unsigned long)cidell;
+ }
+ if ( b1 == buff ) {
+ if (first)
+ snmp_log(LOG_ERR, "No cpu line in %s\n", STAT_FILE);
+ }
+
+ /*
+ * Interrupt/Context Switch statistics
+ * XXX - Do these really belong here ?
+ */
+ cpu = netsnmp_cpu_get_byIdx( -1, 0 );
+ _cpu_load_swap_etc( buff, cpu );
+
+ /*
+ * XXX - TODO: extract per-CPU statistics
+ * (Into separate netsnmp_cpu_info data structures)
+ */
+
+ first = 0;
+ return 0;
+}
+
+
+ /*
+ * Interrupt/Context Switch statistics
+ * XXX - Do these really belong here ?
+ */
+void _cpu_load_swap_etc( char *buff, netsnmp_cpu_info *cpu ) {
+ static int has_vmstat = 1;
+ static char *vmbuff = NULL;
+ static int vmbsize = 0;
+ static int first = 1;
+ int vmstatfd;
+ char *b;
+ unsigned long long pin, pout, swpin, swpout;
+ unsigned long long itot, iticks, ctx;
+
+ if (has_vmstat && (vmstatfd = open(VMSTAT_FILE, O_RDONLY, 0)) != -1) {
+ if (vmbsize == 0) {
+ vmbsize = 256;
+ vmbuff = malloc(vmbsize);
+ }
+ while (read(vmstatfd, vmbuff, vmbsize) == vmbsize) {
+ vmbsize += 256;
+ vmbuff = realloc(vmbuff, vmbsize);
+ close(vmstatfd);
+ vmstatfd = open(VMSTAT_FILE, O_RDONLY, 0);
+ }
+ close(vmstatfd);
+ }
+ else
+ has_vmstat = 0;
+
+ if (has_vmstat) {
+ b = strstr(vmbuff, "pgpgin ");
+ if (b) {
+ sscanf(b, "pgpgin %llu", &pin);
+ cpu->pageIn = (unsigned long)pin*2; /* ??? */
+ } else {
+ if (first)
+ snmp_log(LOG_ERR, "No pgpgin line in %s\n", VMSTAT_FILE);
+ cpu->pageIn = 0;
+ }
+ b = strstr(vmbuff, "pgpgout ");
+ if (b) {
+ sscanf(b, "pgpgout %llu", &pout);
+ cpu->pageOut = (unsigned long)pout*2; /* ??? */
+ } else {
+ if (first)
+ snmp_log(LOG_ERR, "No pgpgout line in %s\n", VMSTAT_FILE);
+ cpu->pageOut = 0;
+ }
+ b = strstr(vmbuff, "pswpin ");
+ if (b) {
+ sscanf(b, "pswpin %llu", &swpin);
+ cpu->swapIn = (unsigned long)swpin;
+ } else {
+ if (first)
+ snmp_log(LOG_ERR, "No pswpin line in %s\n", VMSTAT_FILE);
+ cpu->swapIn = 0;
+ }
+ b = strstr(vmbuff, "pswpout ");
+ if (b) {
+ sscanf(b, "pswpout %llu", &swpout);
+ cpu->swapOut = (unsigned long)swpout;
+ } else {
+ if (first)
+ snmp_log(LOG_ERR, "No pswpout line in %s\n", VMSTAT_FILE);
+ cpu->swapOut = 0;
+ }
+ }
+ else {
+ b = strstr(buff, "page ");
+ if (b) {
+ sscanf(b, "page %llu %llu", &pin, &pout);
+ cpu->pageIn = (unsigned long)pin;
+ cpu->pageOut = (unsigned long)pout;
+ } else {
+ if (first)
+ snmp_log(LOG_ERR, "No page line in %s\n", STAT_FILE);
+ cpu->pageIn = cpu->pageOut = 0;
+ }
+ b = strstr(buff, "swap ");
+ if (b) {
+ sscanf(b, "swap %llu %llu", &swpin, &swpout);
+ cpu->swapIn = (unsigned long)swpin;
+ cpu->swapOut = (unsigned long)swpout;
+ } else {
+ if (first)
+ snmp_log(LOG_ERR, "No swap line in %s\n", STAT_FILE);
+ cpu->swapIn = cpu->swapOut = 0;
+ }
+ }
+
+
+
+ b = strstr(buff, "intr ");
+ if (b) {
+ sscanf(b, "intr %llu %llu", &itot, &iticks);
+ cpu->nInterrupts = (unsigned long)itot;
+ /* iticks not used? */
+ } else {
+ if (first)
+ snmp_log(LOG_ERR, "No intr line in %s\n", STAT_FILE);
+ }
+ b = strstr(buff, "ctxt ");
+ if (b) {
+ sscanf(b, "ctxt %llu", &ctx);
+ cpu->nCtxSwitches = (unsigned long)ctx;
+ } else {
+ if (first)
+ snmp_log(LOG_ERR, "No ctxt line in %s\n", STAT_FILE);
+ }
+
+
+}
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_linux.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_linux.h
new file mode 100644
index 0000000000..9bcdb19332
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_linux.h
@@ -0,0 +1,2 @@
+config_require(hardware/cpu/cpu)
+void init_cpu_linux(void);
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_mach.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_mach.c
new file mode 100644
index 0000000000..d527b3df89
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_mach.c
@@ -0,0 +1,113 @@
+/*
+ * mach interface
+ * Apple darwin specific
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/cpu.h>
+
+#include <mach/mach.h>
+
+#include <errno.h>
+
+static host_name_port_t host;
+static struct host_basic_info hi;
+
+ /*
+ * Initialise the list of CPUs on the system
+ * (including descriptions)
+ */
+void init_cpu_mach( void ) {
+ int ret, i;
+ mach_msg_type_number_t size;
+ char *cpu_type, *cpu_subtype;
+ netsnmp_cpu_info *cpu;
+
+ cpu = netsnmp_cpu_get_byIdx( -1, 1 );
+ strcpy(cpu->name, "Overall CPU statistics");
+
+ host = mach_host_self();
+ size = sizeof(hi);
+ ret = host_info(host, HOST_BASIC_INFO, (host_info_t)&hi, &size);
+ if (ret != KERN_SUCCESS) {
+ snmp_log(LOG_ERR, "HOST_BASIC_INFO: %s - %s\n", mach_error_string(ret), strerror(errno));
+ return;
+ }
+ for ( i = 0; i < hi.avail_cpus; i++) {
+ cpu = netsnmp_cpu_get_byIdx( i, 1 );
+ cpu->status = 2; /* running */
+ sprintf( cpu->name, "cpu%d", i );
+ /* XXX get per-cpu type? Could it be different? */
+ slot_name(hi.cpu_type, hi.cpu_subtype, &cpu_type, &cpu_subtype);
+ sprintf( cpu->descr, "%s - %s", cpu_type, cpu_subtype );
+ }
+ cpu_num = hi.avail_cpus;
+}
+
+int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+ int i, ret;
+ mach_msg_type_number_t numcpu, nummsg;
+ processor_cpu_load_info_t pcli;
+ vm_statistics_data_t vmstat;
+ netsnmp_cpu_info *cpu, *cpu0;
+
+ /*
+ * Load the latest CPU usage statistics
+ */
+ ret = host_processor_info(host, PROCESSOR_CPU_LOAD_INFO, &numcpu,
+ (processor_info_array_t *)&pcli,
+ &nummsg);
+ if (ret != KERN_SUCCESS) {
+ snmp_log(LOG_ERR, "PROCESSOR_CPU_LOAD_INFO: %s - %s\n", mach_error_string(ret), strerror(errno));
+ return 0;
+ }
+
+ cpu0 = netsnmp_cpu_get_byIdx( -1, 0 );
+ for ( i = 0; i < numcpu; i++) {
+ /* Note: using sys_ticks so that CPUSYSTEM gets calculated right. */
+ /* many collectors use sys2_ticks instead. */
+ if (i == 0) {
+ cpu0->user_ticks = pcli[i].cpu_ticks[CPU_STATE_USER];
+ cpu0->nice_ticks = pcli[i].cpu_ticks[CPU_STATE_NICE];
+ cpu0->sys_ticks = pcli[i].cpu_ticks[CPU_STATE_SYSTEM];
+ cpu0->idle_ticks = pcli[i].cpu_ticks[CPU_STATE_IDLE];
+ } else {
+ cpu0->user_ticks += pcli[i].cpu_ticks[CPU_STATE_USER];
+ cpu0->nice_ticks += pcli[i].cpu_ticks[CPU_STATE_NICE];
+ cpu0->sys_ticks += pcli[i].cpu_ticks[CPU_STATE_SYSTEM];
+ cpu0->idle_ticks += pcli[i].cpu_ticks[CPU_STATE_IDLE];
+ }
+ cpu = netsnmp_cpu_get_byIdx( i, 0 );
+ if (cpu == NULL) {
+ snmp_log(LOG_ERR, "forgot to create cpu #%d\n", i);
+ continue;
+ }
+ cpu->user_ticks = pcli[i].cpu_ticks[CPU_STATE_USER];
+ cpu->nice_ticks = pcli[i].cpu_ticks[CPU_STATE_NICE];
+ cpu->sys_ticks = pcli[i].cpu_ticks[CPU_STATE_SYSTEM];
+ cpu->idle_ticks = pcli[i].cpu_ticks[CPU_STATE_IDLE];
+ /* kern_ticks, intrpt_ticks, wait_ticks, sirq_ticks unused */
+ }
+ ret = vm_deallocate(mach_task_self(), (vm_address_t)pcli, nummsg * sizeof(int));
+ if (ret != KERN_SUCCESS) {
+ snmp_log(LOG_ERR, "vm_deallocate: %s - %s\n", mach_error_string(ret), strerror(errno));
+ }
+
+ /*
+ * Interrupt/Context Switch statistics
+ * XXX - Do these really belong here ?
+ */
+ /* Darwin doesn't keep paging stats per CPU. */
+ nummsg = HOST_VM_INFO_COUNT;
+ ret = host_statistics(host, HOST_VM_INFO, (host_info_t)&vmstat, &nummsg);
+ if (ret != KERN_SUCCESS) {
+ snmp_log(LOG_ERR, "HOST_VM_INFO: %s - %s\n", mach_error_string(ret), strerror(errno));
+ return 0;
+ }
+ cpu0->pageIn = vmstat.pageins;
+ cpu0->pageOut = vmstat.pageouts;
+ /* not implemented: swapIn, swapOut, nInterrupts, nCtxSwitches */
+}
+
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_mach.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_mach.h
new file mode 100644
index 0000000000..f3f408fd93
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_mach.h
@@ -0,0 +1,4 @@
+config_require(hardware/cpu/cpu)
+void init_cpu_mach( void );
+
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_nlist.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_nlist.c
new file mode 100644
index 0000000000..61ba75615e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_nlist.c
@@ -0,0 +1,109 @@
+/*
+ * nlist() interface
+ * e.g. FreeBSD
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/cpu.h>
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/resource.h>
+
+#ifdef HAVE_SYS_DKSTAT_H
+#include <sys/dkstat.h>
+#endif
+#ifdef HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#ifdef HAVE_SYS_VMMETER_H
+#include <sys/vmmeter.h>
+#endif
+#ifdef HAVE_VM_VM_PARAM_H
+#include <vm/vm_param.h>
+#endif
+#ifdef HAVE_VM_VM_EXTERN_H
+#include <vm/vm_extern.h>
+#endif
+
+#define CPU_SYMBOL "cp_time"
+#define MEM_SYMBOL "cnt"
+
+void _cpu_copy_stats( netsnmp_cpu_info *cpu );
+
+ /*
+ * Initialise the list of CPUs on the system
+ * (including descriptions)
+ */
+void init_cpu_nlist( void ) {
+ int i, n;
+ int ncpu_mib[] = { CTL_HW, HW_NCPU };
+ int model_mib[] = { CTL_HW, HW_MODEL };
+ char descr[ SNMP_MAXBUF ];
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 1 );
+ strcpy(cpu->name, "Overall CPU statistics");
+
+ i = sizeof(n);
+ sysctl(ncpu_mib, 2, &n, &i, NULL, 0);
+ i = sizeof(descr);
+ sysctl(model_mib, 2, descr, &i, NULL, 0);
+
+ if ( n <= 0 )
+ n = 1; /* Single CPU system */
+ for ( i=0; i<n; i++ ) {
+ cpu = netsnmp_cpu_get_byIdx( i, 1 );
+ cpu->status = 2; /* running */
+ sprintf(cpu->name, "cpu%d", i);
+ sprintf(cpu->descr, "%s", descr);
+ }
+ cpu_num = n;
+}
+
+
+ /*
+ * Load the latest CPU usage statistics
+ */
+int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+ long cpu_stats[CPUSTATES];
+ struct vmmeter mem_stats;
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 0 );
+
+ auto_nlist( CPU_SYMBOL, (char *) cpu_stats, sizeof(cpu_stats));
+ auto_nlist( MEM_SYMBOL, (char *)&mem_stats, sizeof(mem_stats));
+
+ cpu->user_ticks = (unsigned long)cpu_stats[CP_USER];
+ cpu->nice_ticks = (unsigned long)cpu_stats[CP_NICE];
+ cpu->sys2_ticks = (unsigned long)cpu_stats[CP_SYS]+cpu_stats[CP_INTR];
+ cpu->idle_ticks = (unsigned long)cpu_stats[CP_IDLE];
+ cpu->kern_ticks = (unsigned long)cpu_stats[CP_SYS];
+ cpu->intrpt_ticks = (unsigned long)cpu_stats[CP_INTR];
+ /* wait_ticks, sirq_ticks unused */
+
+ /*
+ * Interrupt/Context Switch statistics
+ * XXX - Do these really belong here ?
+ */
+#if defined(openbsd2) || defined(darwin)
+ cpu->swapIn = (unsigned long)mem_stats.v_swpin;
+ cpu->swapOut = (unsigned long)mem_stats.v_swpout;
+#else
+ cpu->swapIn = (unsigned long)mem_stats.v_swappgsin+mem_stats.v_vnodepgsin;
+ cpu->swapOut = (unsigned long)mem_stats.v_swappgsout+mem_stats.v_vnodepgsout;
+#endif
+ cpu->nInterrupts = (unsigned long)mem_stats.v_intr;
+ cpu->nCtxSwitches = (unsigned long)mem_stats.v_swtch;
+
+#ifdef PER_CPU_INFO
+ for ( i = 0; i < n; i++ ) {
+ cpu = netsnmp_cpu_get_byIdx( i, 0 );
+ /* XXX - per-CPU statistics */
+ }
+#else
+ /* Copy "overall" figures to cpu0 entry */
+ _cpu_copy_stats( cpu );
+#endif
+
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_nlist.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_nlist.h
new file mode 100755
index 0000000000..d28ba6f58e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_nlist.h
@@ -0,0 +1,2 @@
+config_require(hardware/cpu/cpu)
+void init_cpu_nlist( void );
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_null.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_null.c
new file mode 100644
index 0000000000..3ec19383d3
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_null.c
@@ -0,0 +1,38 @@
+/*
+ * dummy HAL CPU module
+ * for systems not using any of the supported interfaces
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/cpu.h>
+
+ /*
+ * Initialise the HAL CPU system
+ * (including a basic description)
+ */
+void init_cpu_null( void ) {
+
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 1 );
+ strcpy(cpu->name, "Overall CPU statistics");
+ strcpy(cpu->descr, "An electronic chip that makes the computer work");
+ strcat(cpu->descr, " (but that's not important right now)");
+
+ cpu = netsnmp_cpu_get_byIdx( 0, 1 );
+ strcpy(cpu->name, "cpu0");
+ strcpy(cpu->descr, "An electronic chip that makes the computer work");
+ cpu->status = 2; /* running */
+
+ cpu_num = 1;
+}
+
+
+
+ /*
+ * We can't load the CPU usage statistics
+ * because we don't know how to do this!
+ */
+int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+
+ return 0; /* or -1 ? */
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_null.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_null.h
new file mode 100644
index 0000000000..3150358517
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_null.h
@@ -0,0 +1,2 @@
+config_require(hardware/cpu/cpu)
+void init_cpu_null(void);
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_pcp.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_pcp.c
new file mode 100644
index 0000000000..dcc2724e2c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_pcp.c
@@ -0,0 +1,191 @@
+/*
+ * pcp interface
+ * e.g. IRIX
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/cpu.h>
+
+#include <unistd.h>
+#include <pcp/pmapi.h>
+
+/*
+ * Performance Metrics Name Space Map
+ * Built by pmgenmap from the file irix_kernstats.pcp
+ */
+char *kernstats[] = {
+#define NCPU 0
+ "hinv.ncpu",
+#define CPUTYPE 1
+ "hinv.cputype",
+#define CPUIDLE 2
+ "kernel.all.cpu.idle",
+#define CPUINTR 3
+ "kernel.all.cpu.intr",
+#define CPUSYS 4
+ "kernel.all.cpu.sys",
+#define CPUUSER 5
+ "kernel.all.cpu.user",
+#define CPUWAIT 6
+ "kernel.all.cpu.wait.total",
+#define PAGESIN 7
+ "swap.pagesin",
+#define PAGESOUT 8
+ "swap.pagesout",
+#define SWAPIN 9
+ "swap.in",
+#define SWAPOUT 10
+ "swap.out",
+#define INTR 11
+ "kernel.all.intr.non_vme",
+#define CTXT 12
+ "kernel.all.kswitch"
+};
+
+# define MAX_MID 17
+
+pmResult *resp;
+pmID pmidlist[MAX_MID];
+int numpmid;
+int pmInitDone = 0;
+
+/* initialize pcp if necessary */
+void init_pcp () {
+ int err;
+
+ if (pmInitDone == 1) {
+ return;
+ }
+
+ snmp_log_perror("Initializing pcp");
+ numpmid = sizeof(kernstats)/sizeof(kernstats[0]);
+
+ /* Load default namespace */
+ if ((err=pmLoadNameSpace(PM_NS_DEFAULT)) < 0) {
+ snmp_log_perror("pmLoadNameSpace returned an error.");
+ snmp_log_perror(pmErrStr(err));
+ exit (1);
+ }
+
+ /* get mappings between internal IDs and external IDs */
+ if ((err=pmLookupName(numpmid, kernstats, pmidlist)) < 0) {
+ snmp_log_perror("pmLookupName returned an error.");
+ snmp_log_perror(pmErrStr(err));
+ exit (1);
+ }
+
+ /* specify a context to use */
+ /* a type of PM_CONTEXT_HOST lets you specify a hostname */
+ /* a type of PM_CONTEXT_LOCAL should ignore the string param */
+ if ((err=pmNewContext(PM_CONTEXT_LOCAL,"localhost")) < 0) {
+ snmp_log_perror("pmNewContext returned error opening a LOCAL Context");
+ snmp_log_perror(pmErrStr(err));
+
+ if ((err=pmNewContext(PM_CONTEXT_HOST,"localhost")) < 0) {
+ snmp_log_perror("pmNewContext returned error opening a HOST Context");
+ snmp_log_perror(pmErrStr(err));
+ exit(1);
+ }
+ }
+ snmp_log_perror ("done initializing pcp");
+ pmInitDone = 1;
+}
+
+ /*
+ * Initialise the list of CPUs on the system
+ * (including descriptions)
+ */
+void init_cpu_pcp( void ) {
+ int i, n = 0;
+ char tstr[1024];
+ int err;
+ netsnmp_cpu_info *cpu;
+
+ init_pcp();
+
+ /* At this stage, pmidlist contains the PMID for my metrics of interest */
+
+ cpu = netsnmp_cpu_get_byIdx( -1, 1 );
+ strcpy(cpu->name, "Overall CPU statistics");
+
+ if ((err=pmFetch(numpmid, pmidlist, &resp)) < 0) {
+ snmp_log_perror ("init_cpu_pcp: pmFetch returned error");
+ snmp_log_perror (pmErrStr(err));
+ exit (1);
+ }
+ cpu_num = resp->vset[NCPU]->vlist[0].value.lval;
+ pmFreeResult(resp);
+
+ for (i=0; i<cpu_num ; i++) {
+ cpu = netsnmp_cpu_get_byIdx( i, 1 );
+ sprintf(tstr, "cpu%d",i);
+ strcpy(cpu->name, tstr);
+ strcpy(cpu->descr, "An electronic chip that makes the computer work");
+ }
+}
+
+/*void _cpu_load_swap_etc( char *buff, netsnmp_cpu_info *cpu );*/
+
+ /*
+ * Load the latest CPU usage statistics
+ */
+int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+ int err;
+ /*static char *buff = NULL;*/
+ static int first = 1;
+ netsnmp_cpu_info* cpu;
+
+ init_pcp();
+
+ /*
+ * CPU statistics (overall and per-CPU)
+ */
+ if ((err=pmFetch(numpmid, pmidlist, &resp)) < 0) {
+ snmp_log_perror ("netsnmp_cpu_arch_load: pmFetch returned an error.");
+ snmp_log_perror (pmErrStr(err));
+ exit (1);
+ }
+
+ cpu = netsnmp_cpu_get_byIdx( -1, 0 );
+ if (!cpu) {
+ snmp_log_perror ("netsnmp_cpu_arch_load: netsnmp_cpu_get_byIdx failed!");
+ exit(1);
+ }
+
+ cpu->wait_ticks = (unsigned long)resp->vset[CPUWAIT]->vlist[0].value.lval / 10;
+ cpu->intrpt_ticks = (unsigned long)resp->vset[CPUINTR]->vlist[0].value.lval / 10;
+ /*cpu->sirq_ticks = (unsigned long)csoftll / 10;*/
+ cpu->user_ticks = (unsigned long)resp->vset[CPUUSER]->vlist[0].value.lval / 10;
+ /*cpu->nice_ticks = (unsigned long)cicell / 10;*/
+ cpu->sys_ticks = (unsigned long)resp->vset[CPUSYS]->vlist[0].value.lval / 10;
+ cpu->idle_ticks = (unsigned long)resp->vset[CPUIDLE]->vlist[0].value.lval / 10;
+
+
+ /*
+ * Interrupt/Context Switch statistics
+ * XXX - Do these really belong here ?
+ */
+ /*cpu = netsnmp_cpu_get_byIdx( -1, 0 );*/
+ /*_cpu_load_swap_etc( buff, cpu );*/
+ cpu->pageIn = (unsigned long)resp->vset[PAGESIN]->vlist[0].value.lval;
+ cpu->pageOut = (unsigned long)resp->vset[PAGESOUT]->vlist[0].value.lval;
+ cpu->swapIn = (unsigned long)resp->vset[SWAPIN]->vlist[0].value.lval;
+ cpu->swapOut = (unsigned long)resp->vset[SWAPOUT]->vlist[0].value.lval;
+ cpu->nInterrupts = (unsigned long)resp->vset[INTR]->vlist[0].value.lval;
+ cpu->nCtxSwitches = (unsigned long)resp->vset[CTXT]->vlist[0].value.lval;
+
+ /*
+ * XXX - TODO: extract per-CPU statistics
+ * (Into separate netsnmp_cpu_info data structures)
+ */
+
+ /* free pcp response */
+ pmFreeResult(resp);
+
+ first = 0;
+ return 0;
+}
+
+
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_pcp.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_pcp.h
new file mode 100644
index 0000000000..ddb7547bfd
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_pcp.h
@@ -0,0 +1,2 @@
+config_require(hardware/cpu/cpu)
+void init_cpu_pcp(void);
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_perfstat.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_perfstat.c
new file mode 100644
index 0000000000..c15fa2f77c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_perfstat.c
@@ -0,0 +1,107 @@
+/*
+ * perfstat() interface
+ * e.g. AIX
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/cpu.h>
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#include <libperfstat.h>
+
+void _cpu_copy_stats( netsnmp_cpu_info *cpu );
+
+ /*
+ * Initialise the list of CPUs on the system
+ * (including descriptions)
+ */
+void init_cpu_perfstat( void ) {
+ int i;
+ perfstat_id_t name;
+ perfstat_cpu_t *cs2;
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 1 );
+ strcpy(cpu->name, "Overall CPU statistics");
+
+ cpu_num = perfstat_cpu( NULL, NULL, sizeof(perfstat_cpu_t), 0 );
+ cs2 = malloc( cpu_num*sizeof(perfstat_cpu_t));
+
+ strcpy( name.name, "");
+ if (perfstat_cpu(&name, cs2, sizeof(perfstat_cpu_t), cpu_num) > 0) {
+ for ( i = 0; i < cpu_num; i++ ) {
+ cpu = netsnmp_cpu_get_byIdx( i, 1 );
+ sprintf( cpu->name, cs2[i].name);
+ }
+ }
+ free(cs2);
+}
+
+
+ /*
+ * Load the latest CPU usage statistics
+ */
+int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+ int i,n;
+ perfstat_id_t name;
+ perfstat_cpu_total_t cs;
+ perfstat_cpu_t *cs2;
+ perfstat_memory_total_t ms;
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 0 );
+
+ if (perfstat_cpu_total((perfstat_id_t *)NULL, &cs,
+ sizeof(perfstat_cpu_total_t), 1) > 0) {
+
+ /* Returns 'u_longlong_t' statistics */
+ cpu->user_ticks = (unsigned long)cs.user / cs.ncpus;
+ cpu->sys_ticks = ((unsigned long)cs.sys + (unsigned long)cs.wait) / cs.ncpus;
+ cpu->kern_ticks = (unsigned long)cs.sys / cs.ncpus;
+ cpu->wait_ticks = (unsigned long)cs.wait / cs.ncpus;
+ cpu->idle_ticks = (unsigned long)cs.idle / cs.ncpus;
+ /* intrpt_ticks, sirq_ticks, nice_ticks unused */
+
+ /*
+ * Interrupt/Context Switch statistics
+ * XXX - Do these really belong here ?
+ */
+ cpu->pageIn = (unsigned long)cs.sysread;
+ cpu->pageOut = (unsigned long)cs.syswrite;
+ cpu->nInterrupts = (unsigned long)cs.devintrs + cs.softintrs;
+ cpu->nCtxSwitches = (unsigned long)cs.pswitch;
+ }
+
+ if (perfstat_memory_total((perfstat_id_t *)NULL, &ms,
+ sizeof(perfstat_memory_total_t), 1) > 0) {
+ cpu->swapIn = (unsigned long)ms.pgspins;
+ cpu->swapOut = (unsigned long)ms.pgspouts;
+ }
+
+
+ /*
+ * Per-CPU statistics
+ */
+ n = cs.ncpus; /* XXX - Compare against cpu_num */
+ cs2 = malloc( n*sizeof(perfstat_cpu_t));
+ strcpy( name.name, "");
+ if (perfstat_cpu(&name, cs2, sizeof(perfstat_cpu_t), n) > 0) {
+ for ( i = 0; i < n; i++ ) {
+ cpu = netsnmp_cpu_get_byIdx( i, 0 );
+ cpu->user_ticks = (unsigned long)cs2[i].user;
+ cpu->sys_ticks = (unsigned long)cs2[i].sys + (unsigned long)cs2[i].wait;
+ cpu->kern_ticks = (unsigned long)cs2[i].sys;
+ cpu->wait_ticks = (unsigned long)cs2[i].wait;
+ cpu->idle_ticks = (unsigned long)cs2[i].idle;
+ cpu->pageIn = (unsigned long)cs2[i].sysread;
+ cpu->pageOut = (unsigned long)cs2[i].syswrite;
+ cpu->nCtxSwitches = (unsigned long)cs2[i].pswitch;
+ /* Interrupt stats only apply overall, not per-CPU */
+ }
+ } else {
+ _cpu_copy_stats( cpu );
+ }
+ free(cs2);
+
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_perfstat.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_perfstat.h
new file mode 100755
index 0000000000..8b8b62cf9b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_perfstat.h
@@ -0,0 +1,2 @@
+config_require(hardware/cpu/cpu)
+void init_cpu_perfstat(void);
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_pstat.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_pstat.c
new file mode 100644
index 0000000000..c68739b402
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_pstat.c
@@ -0,0 +1,109 @@
+/*
+ * pstat() interface
+ * e.g. HP-UX
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/cpu.h>
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#include <sys/pstat.h>
+#include <sys/dk.h>
+
+
+ /*
+ * Initialise the list of CPUs on the system
+ * (including descriptions)
+ */
+void init_cpu_pstat( void ) {
+ int i, cpuversion;
+ struct pst_dynamic psd;
+ char descr[ SNMP_MAXBUF ];
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 1 );
+ strcpy(cpu->name, "Overall CPU statistics");
+
+#ifdef _SC_CPU_VERSION
+ cpuversion = sysconf( _SC_CPU_VERSION );
+ switch (cpuversion) {
+ case CPU_HP_MC68020:
+ snprintf(descr, SNMP_MAXBUF, " Motorola MC68020 ");
+ case CPU_HP_MC68030:
+ snprintf(descr, SNMP_MAXBUF, " Motorola MC68030 ");
+ case CPU_HP_MC68040:
+ snprintf(descr, SNMP_MAXBUF, " Motorola MC68040 ");
+ case CPU_PA_RISC1_0:
+ snprintf(descr, SNMP_MAXBUF, " HP PA-RISC 1.0 ");
+ case CPU_PA_RISC1_1:
+ snprintf(descr, SNMP_MAXBUF, " HP PA-RISC 1.1 ");
+ case CPU_PA_RISC1_2:
+ snprintf(descr, SNMP_MAXBUF, " HP PA-RISC 1.2 ");
+ case CPU_PA_RISC2_0:
+ snprintf(descr, SNMP_MAXBUF, " HP PA-RISC 2.0 ");
+ default:
+ snprintf(descr, SNMP_MAXBUF, "An electronic chip with an HP label");
+ }
+#else
+ snprintf(descr, SNMP_MAXBUF, "An electronic chip without(?) an HP label");
+#endif
+
+ if (pstat_getdynamic(&psd, sizeof(psd), 1, 0) > 0) {
+ for ( i = 0; i < psd.psd_proc_cnt; i++ ) {
+ cpu = netsnmp_cpu_get_byIdx( i, 1 );
+ sprintf( cpu->name, "cpu%d", i );
+ sprintf( cpu->descr, descr );
+ }
+ }
+ cpu_num = psd.psd_proc_cnt;
+}
+
+
+ /*
+ * Load the latest CPU usage statistics
+ */
+int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+ int i;
+ struct pst_dynamic psd;
+ struct pst_vminfo psv;
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 0 );
+
+ pstat_getdynamic(&psd, sizeof(psd), 1, 0);
+ /* XXX - Compare cpu_num against psd.psd_proc_cnt */
+ cpu->user_ticks = (unsigned long)psd.psd_cpu_time[CP_USER];
+ cpu->nice_ticks = (unsigned long)psd.psd_cpu_time[CP_NICE];
+ cpu->sys2_ticks = (unsigned long)psd.psd_cpu_time[CP_SYS]+
+ psd.psd_cpu_time[CP_WAIT];
+ cpu->idle_ticks = (unsigned long)psd.psd_cpu_time[CP_IDLE];
+ cpu->wait_ticks = (unsigned long)psd.psd_cpu_time[CP_WAIT];
+ cpu->kern_ticks = (unsigned long)psd.psd_cpu_time[CP_SYS];
+ /* XXX - record (sum of) "all other ticks" */
+ /* intrpt_ticks, sirq_ticks unused */
+
+ /*
+ * Interrupt/Context Switch statistics
+ * XXX - Do these really belong here ?
+ */
+ pstat_getvminfo(&psv, sizeof(psv), 1, 0);
+ cpu->swapIn = (unsigned long)psv.psv_sswpin;
+ cpu->swapOut = (unsigned long)psv.psv_sswpout;
+ cpu->nInterrupts = (unsigned long)psv.psv_sintr;
+ cpu->nCtxSwitches = (unsigned long)psv.psv_sswtch;
+
+
+ for ( i = 0; i < psd.psd_proc_cnt; i++ ) {
+ cpu = netsnmp_cpu_get_byIdx( i, 0 );
+ cpu->user_ticks = (unsigned long)psd.psd_mp_cpu_time[i][CP_USER];
+ cpu->nice_ticks = (unsigned long)psd.psd_mp_cpu_time[i][CP_NICE];
+ cpu->sys2_ticks = (unsigned long)psd.psd_mp_cpu_time[i][CP_SYS]+
+ psd.psd_mp_cpu_time[i][CP_WAIT];
+ cpu->idle_ticks = (unsigned long)psd.psd_mp_cpu_time[i][CP_IDLE];
+ cpu->wait_ticks = (unsigned long)psd.psd_mp_cpu_time[i][CP_WAIT];
+ cpu->kern_ticks = (unsigned long)psd.psd_mp_cpu_time[i][CP_SYS];
+ /* XXX - record (sum of) "all other ticks" */
+ }
+
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_pstat.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_pstat.h
new file mode 100755
index 0000000000..2353f68bd6
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_pstat.h
@@ -0,0 +1,2 @@
+config_require(hardware/cpu/cpu)
+void init_cpu_pstat(void);
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_sysctl.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_sysctl.c
new file mode 100644
index 0000000000..0b18b5451a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_sysctl.c
@@ -0,0 +1,205 @@
+/*
+ * sysctl() interface
+ * e.g. BSD/OS, NetBSD, OpenBSD, later Darwin releases
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/cpu.h>
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#if defined(__FreeBSD__)
+#include <sys/resource.h>
+#if !defined(CPUSTATES)
+#include <sys/dkstat.h>
+#endif
+#else
+#include <sys/sched.h>
+#endif
+
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+#ifdef HAVE_VM_VM_PARAM_H
+#include <vm/vm_param.h>
+#endif
+#ifdef HAVE_VM_VM_EXTERN_H
+#include <vm/vm_extern.h>
+#endif
+
+void _cpu_copy_stats( netsnmp_cpu_info *cpu );
+
+ /*
+ * Initialise the list of CPUs on the system
+ * (including descriptions)
+ */
+void init_cpu_sysctl( void ) {
+ int i, n;
+ int ncpu_mib[] = { CTL_HW, HW_NCPU };
+ int model_mib[] = { CTL_HW, HW_MODEL };
+ char descr[ SNMP_MAXBUF ];
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 1 );
+ strcpy(cpu->name, "Overall CPU statistics");
+
+ i = sizeof(n);
+ sysctl(ncpu_mib, 2, &n, (void *)&i, NULL, 0);
+ if ( n <= 0 )
+ n = 1; /* Single CPU system */
+ i = sizeof(descr);
+ sysctl(model_mib, 2, descr, (void *)&i, NULL, 0);
+ for ( i = 0; i < n; i++ ) {
+ cpu = netsnmp_cpu_get_byIdx( i, 1 );
+ cpu->status = 2; /* running */
+ sprintf( cpu->name, "cpu%d", i );
+ sprintf( cpu->descr, "%s", descr );
+ }
+ cpu_num = n;
+}
+
+
+#define NETSNMP_CPU_STATS long
+#if defined(KERN_CPUSTATS) /* BSDi */
+#define NETSNMP_KERN_CPU KERN_CPUSTATS
+#elif defined(KERN_CPTIME) /* OpenBSD */
+#define NETSNMP_KERN_CPU KERN_CPTIME
+#elif defined(KERN_CP_TIME) /* NetBSD */
+#define NETSNMP_KERN_CPU KERN_CP_TIME
+
+#if defined(netbsdelf3)
+#undef NETSNMP_CPU_STATS
+#define NETSNMP_CPU_STATS uint64_t
+#endif
+
+#elif defined(__FreeBSD__)
+#define NETSNMP_KERN_CPU 0 /* dummy value - sysctlnametomib(2) should be used */
+
+#else
+#error "No CPU statistics sysctl token"
+#endif
+
+/*
+ Need to check details before enabling this!
+#if defined(KERN_MPCPUSTATS)
+#define NETSNMP_KERN_MCPU KERN_MPCPUSTATS
+#define NETSNMP_KERN_MCPU_TYPE struct mpcpustats
+#elif defined(KERN_MP_CPUSTATS)
+#define NETSNMP_KERN_MCPU KERN_MP_CPUSTATS
+#define NETSNMP_KERN_MCPU_TYPE struct cpustats
+#endif
+ */
+
+#if defined(VM_UVMEXP2) || defined(VM_UVMEXP)
+ #define NS_VM_INTR intrs
+ #define NS_VM_SWTCH swtch
+ #define NS_VM_PAGEIN pageins
+ #define NS_VM_PAGEOUT pdpageouts
+ #define NS_VM_SWAPIN swapins
+ #define NS_VM_SWAPOUT swapouts
+
+#if defined(VM_UVMEXP2) /* NetBSD 1.6+ */
+#define NETSNMP_VM_STATS VM_UVMEXP2
+#define NETSNMP_VM_STATS_TYPE struct uvmexp_sysctl
+#else /* VM_UVMEXP */ /* OpenBSD 3+, NetBSD 1.6+ */
+#define NETSNMP_VM_STATS VM_UVMEXP
+#define NETSNMP_VM_STATS_TYPE struct uvmexp
+#endif /* VM_UVMEXP2 || VM_UVMEXP */
+
+#elif defined(__FreeBSD__) /* FreeBSD */
+#define NETSNMP_VM_STATS VM_METER
+#define NETSNMP_VM_STATS_TYPE struct vmmeter
+ #define NS_VM_INTR v_intr
+ #define NS_VM_SWTCH v_swtch
+ #define NS_VM_PAGEIN v_swappgsin
+ #define NS_VM_PAGEOUT v_swappgsout
+ #define NS_VM_SWAPIN v_swapin
+ #define NS_VM_SWAPOUT v_swapout
+
+#elif defined(VM_METER) /* OpenBSD, NetBSD */
+#define NETSNMP_VM_STATS VM_METER
+#define NETSNMP_VM_STATS_TYPE struct vmtotal
+
+#elif defined(VM_CNT) /* BSDi */
+#define NETSNMP_VM_STATS VM_CNT
+#define NETSNMP_VM_STATS_TYPE struct vmmeter
+ #define NS_VM_INTR v_intr
+ #define NS_VM_SWTCH v_swtch
+ #undef NS_VM_PAGEIN
+ #undef NS_VM_PAGEOUT
+ #define NS_VM_SWAPIN v_swpin
+ #define NS_VM_SWAPOUT v_swpout
+#endif
+
+
+ /*
+ * Load the latest CPU usage statistics
+ */
+int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic ) {
+ int i;
+
+ /*
+ * Strictly speaking, BSDi ought to use
+ * "struct cpustats cpu_stats"
+ * but this array was used in the previous code, and
+ * is correct for the {Open,Net}BSD versions too.
+ * Don't fight it, Dave - go with the flow....
+ */
+ NETSNMP_CPU_STATS cpu_stats[CPUSTATES];
+ int cpu_mib[] = { CTL_KERN, NETSNMP_KERN_CPU };
+ size_t cpu_size = sizeof(cpu_stats);
+#ifdef NETSNMP_KERN_MCPU
+ NETSNMP_KERN_MCPU_TYPE *mcpu_stats;
+ int mcpu_mib[] = { CTL_KERN, NETSNMP_KERN_MCPU };
+ size_t mcpu_size = sizeof(NETSNMP_KERN_MCPU_TYPE);
+#endif
+ NETSNMP_VM_STATS_TYPE mem_stats;
+ int mem_mib[] = { CTL_VM, NETSNMP_VM_STATS };
+ size_t mem_size = sizeof(NETSNMP_VM_STATS_TYPE);
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 0 );
+
+#if defined(__FreeBSD__)
+ sysctlbyname("kern.cp_time", cpu_stats, &cpu_size, NULL, 0);
+#else
+ sysctl(cpu_mib, 2, cpu_stats, &cpu_size, NULL, 0);
+#endif
+ cpu->user_ticks = (unsigned long)cpu_stats[CP_USER];
+ cpu->nice_ticks = (unsigned long)cpu_stats[CP_NICE];
+ cpu->sys2_ticks = (unsigned long)cpu_stats[CP_SYS]+cpu_stats[CP_INTR];
+ cpu->kern_ticks = (unsigned long)cpu_stats[CP_SYS];
+ cpu->idle_ticks = (unsigned long)cpu_stats[CP_IDLE];
+ cpu->intrpt_ticks = (unsigned long)cpu_stats[CP_INTR];
+ /* wait_ticks, sirq_ticks unused */
+
+ /*
+ * Interrupt/Context Switch statistics
+ * XXX - Do these really belong here ?
+ */
+ sysctl(mem_mib, 2, &mem_stats, &mem_size, NULL, 0);
+ cpu->nInterrupts = (unsigned long)mem_stats.NS_VM_INTR;
+ cpu->nCtxSwitches = (unsigned long)mem_stats.NS_VM_SWTCH;
+ cpu->swapIn = (unsigned long)mem_stats.NS_VM_SWAPIN;
+ cpu->swapOut = (unsigned long)mem_stats.NS_VM_SWAPOUT;
+#ifdef NS_VM_PAGEIN
+ cpu->pageIn = (unsigned long)mem_stats.NS_VM_PAGEIN;
+#endif
+#ifdef NS_VM_PAGEOUT
+ cpu->pageOut = (unsigned long)mem_stats.NS_VM_PAGEOUT;
+#endif
+
+#ifdef NETSNMP_KERN_MCPU
+ mcpu_stats = malloc(cpu_num*sizeof(NETSNMP_KERN_MCPU_TYPE));
+ sysctl(mcpu_mib, 2, mcpu_stats,
+ cpu_num*sizeof(NETSNMP_KERN_MCPU_TYPE), NULL, 0);
+ for ( i = 0; i < cpu_num; i++ ) {
+ cpu = netsnmp_cpu_get_byIdx( i, 0 );
+ /* XXX - per-CPU statistics - mcpu_mib[i].??? */
+ }
+#else
+ /* Copy "overall" figures to cpu0 entry */
+ _cpu_copy_stats( cpu );
+#endif
+
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_sysctl.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_sysctl.h
new file mode 100755
index 0000000000..f37b907aef
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_sysctl.h
@@ -0,0 +1,2 @@
+config_require(hardware/cpu/cpu)
+void init_cpu_sysctl(void);
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_sysinfo.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_sysinfo.c
new file mode 100644
index 0000000000..d510308e24
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_sysinfo.c
@@ -0,0 +1,132 @@
+/*
+ * sysinfo (sysget/sysmp) interface
+ * e.g. IRIX 6.x
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/cpu.h>
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/sysmp.h>
+#include <sys/sysinfo.h>
+#include <sys/sysget.h>
+
+int cpu_count;
+int sinfo_ksize;
+struct sysinfo* sinfo_cpus; /* individual cpu stats */
+struct sysinfo* sinfo_gen; /* global stats */
+
+/*
+* Initialise the list of CPUs on the system
+* (including descriptions)
+*/
+void init_cpu_sysinfo( void )
+{
+ int i;
+ netsnmp_cpu_info *cpu;
+ char tstr[1024];
+
+ cpu_count = sysmp(MP_NPROCS);
+
+ /* fetch struct sysinfo size in kernel */
+
+ if ((sinfo_ksize = sysmp(MP_SASZ, MPSA_SINFO)) < 0) {
+ snmp_log_perror("init_cpu_sysinfo: sysinfo scall interface not supported");
+ exit(1);
+ }
+
+ if (sizeof(struct sysinfo) != sinfo_ksize)
+ {
+ snmp_log_perror("init_cpu_sysinfo: size mismatch between userland and kernel sysinfo struct");
+ exit(1);
+ }
+
+ /* allocate sysinfo for all cpus + global stats */
+
+ sinfo_cpus = (struct sysinfo *) calloc(cpu_count, sinfo_ksize);
+ if (!sinfo_cpus) {
+ snmp_log_perror("init_cpu_sysinfo: Couldn't allocate memory bytes for sinfo_cpus");
+ exit(1);
+ }
+
+ sinfo_gen = (struct sysinfo *) calloc(1, sinfo_ksize);
+ if (!sinfo_gen) {
+ snmp_log_perror("init_cpu_sysinfo: Couldn't allocate memory bytes for sinfo_gen");
+ exit(1);
+ }
+
+ /* register cpus */
+
+ cpu = netsnmp_cpu_get_byIdx(-1, 1);
+ strcpy(cpu->name, "Overall CPU statistics");
+
+ for (i = 0; i < cpu_count ; ++i)
+ {
+ cpu = netsnmp_cpu_get_byIdx(i, 1);
+ sprintf(tstr, "cpu%d",i);
+ strcpy(cpu->name, tstr);
+ strcpy(cpu->descr, "Central Processing Unit");
+ }
+}
+
+/*
+* Load the latest CPU usage statistics
+*/
+int netsnmp_cpu_arch_load( netsnmp_cache *cache, void *magic )
+{
+ int i;
+ netsnmp_cpu_info* cpu;
+ sgt_cookie_t ck;
+
+ /* fetch global stats */
+
+ cpu = netsnmp_cpu_get_byIdx(-1, 0);
+
+ if (sysmp(MP_SAGET, MPSA_SINFO, (char *) sinfo_gen, sinfo_ksize) < 0)
+ {
+ snmp_log_perror("netsnmp_cpu_arch_load: sysmp() failed");
+ exit(1);
+ }
+
+ DEBUGMSGTL(("cpu_sysinfo", "total cpu kernel: %lu\n", sinfo_gen->cpu[CPU_KERNEL]));
+ cpu->sys2_ticks = (unsigned long) sinfo_gen->cpu[CPU_KERNEL] + (unsigned long) sinfo_gen->cpu[CPU_SXBRK] + (unsigned long) sinfo_gen->cpu[CPU_INTR];
+ cpu->kern_ticks = (unsigned long) sinfo_gen->cpu[CPU_KERNEL];
+ cpu->intrpt_ticks = (unsigned long) sinfo_gen->cpu[CPU_INTR];
+ cpu->user_ticks = (unsigned long) sinfo_gen->cpu[CPU_USER];
+ cpu->wait_ticks = (unsigned long) sinfo_gen->cpu[CPU_WAIT];
+ cpu->idle_ticks = (unsigned long) sinfo_gen->cpu[CPU_IDLE];
+
+ /* XXX - Do these really belong here ? */
+ cpu->pageIn = (unsigned long)0;
+ cpu->pageOut = (unsigned long)0;
+ cpu->swapIn = (unsigned long)sinfo_gen->swapin;
+ cpu->swapOut = (unsigned long)sinfo_gen->swapout;
+ cpu->nInterrupts = (unsigned long)sinfo_gen->intr_svcd;
+ cpu->nCtxSwitches = (unsigned long)sinfo_gen->pswitch;
+
+ /* fetch individual cpu stats */
+
+ SGT_COOKIE_INIT(&ck);
+ if (sysget(MPSA_SINFO, (char *) sinfo_cpus, sinfo_ksize * cpu_count, SGT_READ | SGT_CPUS | SGT_SUM, &ck) < 0)
+ {
+ snmp_log_perror("netsnmp_cpu_arch_load: sysget() failed");
+ exit(1);
+ }
+
+ for (i = 0; i < cpu_count ; ++i)
+ {
+ cpu = netsnmp_cpu_get_byIdx(i, 0);
+
+ DEBUGMSGTL(("cpu_sysinfo", "cpu %u kernel: %lu\n", i, sinfo_cpus[i].cpu[CPU_KERNEL]));
+ cpu->sys2_ticks = (unsigned long)sinfo_cpus[i].cpu[CPU_KERNEL] + (unsigned long) sinfo_cpus[i].cpu[CPU_SXBRK] + (unsigned long)sinfo_cpus[i].cpu[CPU_INTR];
+ cpu->intrpt_ticks = (unsigned long)sinfo_cpus[i].cpu[CPU_INTR];
+ cpu->user_ticks = (unsigned long)sinfo_cpus[i].cpu[CPU_USER];
+ cpu->wait_ticks = (unsigned long)sinfo_cpus[i].cpu[CPU_WAIT];
+ cpu->idle_ticks = (unsigned long)sinfo_cpus[i].cpu[CPU_IDLE];
+ }
+
+ return 0;
+}
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_sysinfo.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_sysinfo.h
new file mode 100644
index 0000000000..36c6e13a54
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/cpu/cpu_sysinfo.h
@@ -0,0 +1,2 @@
+config_require(hardware/cpu/cpu)
+void init_cpu_sysinfo(void);
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory.h
new file mode 100644
index 0000000000..fd1e36a90b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory.h
@@ -0,0 +1,32 @@
+config_require(hardware/memory/hw_mem)
+
+#if defined(linux)
+config_require(hardware/memory/memory_linux)
+
+#elif (defined(darwin7) || defined(darwin8) || defined(darwin9))
+config_require(hardware/memory/memory_darwin)
+
+#elif (defined(freebsd2) || defined(freebsd3) || defined(freebsd4) || defined(freebsd5)|| defined(freebsd6))
+config_require(hardware/memory/memory_freebsd)
+
+#elif (defined(netbsd) || defined(netbsd1) || defined(netbsdelf) || defined(netbsdelf2)|| defined(netbsdelf3) || defined(openbsd2) || defined(openbsd3) || defined(openbsd4))
+config_require(hardware/memory/memory_netbsd)
+
+#elif (defined(aix4) || defined(aix5) || defined(aix6))
+config_require(hardware/memory/memory_aix)
+
+#elif (defined(solaris2))
+config_require(hardware/memory/memory_solaris)
+
+#elif (defined(irix6))
+config_require(hardware/memory/memory_irix)
+
+#elif (defined(dynix))
+config_require(hardware/memory/memory_dynix)
+
+#elif (defined(hpux10) || defined(hpux11))
+config_require(hardware/memory/memory_hpux)
+
+#else
+config_require(hardware/memory/memory_null)
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/hw_mem.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/hw_mem.c
new file mode 100644
index 0000000000..d027218e56
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/hw_mem.c
@@ -0,0 +1,94 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/memory.h>
+
+extern NetsnmpCacheLoad netsnmp_mem_arch_load;
+
+netsnmp_memory_info *_mem_head = NULL;
+netsnmp_cache *_mem_cache = NULL;
+
+void init_hw_mem( void ) {
+ _mem_cache = netsnmp_cache_create( 5, netsnmp_mem_arch_load, NULL, NULL, 0);
+}
+
+
+
+netsnmp_memory_info *netsnmp_memory_get_first( int type ) {
+ netsnmp_memory_info *mem;
+
+ for ( mem=_mem_head; mem; mem=mem->next )
+ if (mem->type == type) /* Or treat as bits? */
+ return mem;
+ return NULL;
+}
+
+netsnmp_memory_info *netsnmp_memory_get_next( netsnmp_memory_info *this_ptr, int type ) {
+ netsnmp_memory_info *mem;
+
+ if (this_ptr)
+ for ( mem=this_ptr->next; mem; mem=mem->next )
+ if (mem->type == type) /* Or treat as bits? */
+ return mem;
+ return NULL;
+}
+
+ /*
+ * Work with a list of Memory entries, indexed numerically
+ */
+netsnmp_memory_info *netsnmp_memory_get_byIdx( int idx, int create ) {
+ netsnmp_memory_info *mem, *mem2;
+
+ /*
+ * Find the specified Memory entry
+ */
+ for ( mem=_mem_head; mem; mem=mem->next ) {
+ if ( mem->idx == idx )
+ return mem;
+ }
+ if (!create)
+ return NULL;
+
+ /*
+ * Create a new memory entry, and insert it into the list....
+ */
+ mem = SNMP_MALLOC_TYPEDEF( netsnmp_memory_info );
+ if (!mem)
+ return NULL;
+ mem->idx = idx;
+ /* ... either as the first (or only) entry.... */
+ if ( !_mem_head || _mem_head->idx > idx ) {
+ mem->next = _mem_head;
+ _mem_head = mem;
+ return mem;
+ }
+ /* ... or in the appropriate position */
+ for ( mem2=_mem_head; mem2; mem2=mem2->next ) {
+ if ( !mem2->next || mem2->next->idx > idx ) {
+ mem->next = mem2->next;
+ mem2->next = mem;
+ return mem;
+ }
+ }
+ SNMP_FREE(mem);
+ return NULL; /* Shouldn't happen! */
+}
+
+netsnmp_memory_info *netsnmp_memory_get_next_byIdx( int idx, int type ) {
+ netsnmp_memory_info *mem;
+
+ for ( mem=_mem_head; mem; mem=mem->next )
+ if (mem->type == type && mem->idx > idx) /* Or treat as bits? */
+ return mem;
+ return NULL;
+}
+
+
+
+netsnmp_cache *netsnmp_memory_get_cache( void ) {
+ return _mem_cache;
+}
+
+int netsnmp_memory_load( void ) {
+ return netsnmp_cache_check_and_reload( _mem_cache );
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/hw_mem.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/hw_mem.h
new file mode 100644
index 0000000000..12fd90b41c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/hw_mem.h
@@ -0,0 +1 @@
+void init_hw_mem(void);
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_aix.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_aix.c
new file mode 100644
index 0000000000..2519dd96d3
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_aix.c
@@ -0,0 +1,80 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/memory.h>
+
+#include <unistd.h>
+#include <libperfstat.h>
+#include <sys/stat.h>
+
+
+ /*
+ * Load the latest memory usage statistics
+ */
+int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
+
+ netsnmp_memory_info *mem;
+ perfstat_memory_total_t pstat_mem;
+ long pagesize;
+
+ /*
+ * Retrieve the memory information from the underlying O/S...
+ */
+ if (perfstat_memory_total((perfstat_id_t *)NULL, &pstat_mem,
+ sizeof(perfstat_memory_total_t), 1) < 1) {
+ snmp_log(LOG_ERR, "memory_aix: perfstat_memory_total failed!\n");
+ return -1;
+ }
+ pagesize = getpagesize();
+
+ /*
+ * ... and save this in a standard form.
+ */
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No Physical Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Physical memory");
+ mem->units = pagesize; /* or 4096 */
+ mem->size = pstat_mem.real_total;
+ mem->free = pstat_mem.real_free;
+ }
+
+ /* ??? Duplicates Physical Memory statistics? */
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_USERMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No (user) Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Real memory");
+ mem->units = pagesize; /* or 4096 */
+ mem->size = pstat_mem.real_total; /* ? less system memory ? */
+ mem->free = pstat_mem.real_free;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_VIRTMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No Virtual Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Virtual memory");
+ mem->units = pagesize; /* or 4096 */
+ mem->size = pstat_mem.virt_total;
+ mem->free = pstat_mem.real_free + pstat_mem.pgsp_free;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 1 );
+ if (!mem) {
+ snmp_log_perror("No Swap info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Swap space");
+ mem->units = pagesize; /* or 4096 */
+ mem->size = pstat_mem.pgsp_total;
+ mem->free = pstat_mem.pgsp_free;
+ mem->other = pstat_mem.pgsp_rsvd;
+ }
+
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_darwin.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_darwin.c
new file mode 100644
index 0000000000..4914f0c415
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_darwin.c
@@ -0,0 +1,215 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/memory.h>
+
+#include <dirent.h>
+#include <unistd.h>
+#include <mach/mach_host.h>
+#include <sys/stat.h>
+#include <sys/sysctl.h>
+
+
+/*
+ * Retained from UCD implementation
+ */
+
+/*
+ * Get the number of pages that are swapped out.
+ * We think this is correct and are valid values
+ * but not sure. Time will tell if it's correct.
+ * Note: this routine is _expensive_!!! we run this
+ * as little as possible by caching it's return so
+ * it's not run on every poll.
+ * Apple, please give us a better way! :)
+ */
+int pages_swapped(void) {
+ boolean_t retval;
+ kern_return_t error;
+ processor_set_t *psets, pset;
+ task_t *tasks;
+ unsigned i, j, pcnt, tcnt;
+ int pid;
+ mach_msg_type_number_t count;
+ vm_address_t address;
+ mach_port_t object_name;
+ vm_region_extended_info_data_t info;
+ vm_size_t size;
+ mach_port_t mach_port;
+ int swapped_pages;
+ int swapped_pages_total = 0;
+ char errmsg[1024];
+
+
+ mach_port = mach_host_self();
+ error = host_processor_sets(mach_port, &psets, &pcnt);
+ if (error != KERN_SUCCESS) {
+ snprintf(errmsg, sizeof(errmsg), "Error in host_processor_sets(): %s\n", mach_error_string(error));
+ snmp_log_perror(errmsg);
+ return(0);
+ }
+
+ for (i = 0; i < pcnt; i++) {
+ error = host_processor_set_priv(mach_port, psets[i], &pset);
+ if (error != KERN_SUCCESS) {
+ snprintf(errmsg, sizeof(errmsg),"Error in host_processor_set_priv(): %s\n", mach_error_string(error));
+ snmp_log_perror(errmsg);
+ return(0);
+ }
+
+ error = processor_set_tasks(pset, &tasks, &tcnt);
+ if (error != KERN_SUCCESS) {
+ snprintf(errmsg, sizeof(errmsg),"Error in processor_set_tasks(): %s\n", mach_error_string(error));
+ snmp_log_perror(errmsg);
+ return(0);
+ }
+
+ for (j = 0; j < tcnt; j++) {
+ error = pid_for_task(tasks[j], &pid);
+ if (error != KERN_SUCCESS) {
+ /* Not a process, or the process is gone. */
+ continue;
+ }
+
+ swapped_pages = 0;
+ for (address = 0;; address += size) {
+ /* Get memory region. */
+ count = VM_REGION_EXTENDED_INFO_COUNT;
+ if (vm_region(tasks[j], &address, &size, VM_REGION_EXTENDED_INFO, (vm_region_extended_info_t)&info, &count, &object_name) != KERN_SUCCESS) {
+ /* No more memory regions. */
+ break;
+ }
+
+ if(info.pages_swapped_out > 0) {
+ swapped_pages += info.pages_swapped_out;
+ }
+ }
+
+ if(swapped_pages > 0) {
+ swapped_pages_total += swapped_pages;
+ }
+
+ if (tasks[j] != mach_task_self()) {
+ mach_port_deallocate(mach_task_self(), tasks[j]);
+ }
+ }
+ }
+
+ return(swapped_pages_total);
+}
+
+off_t
+swapsize(void)
+{
+ int pagesize;
+ int i, n;
+ DIR *dirp;
+ struct dirent *dp;
+ struct stat buf;
+ char errmsg[1024];
+ char full_name[1024];
+ off_t swapSize;
+
+ /* we set the size to -1 if we're not supported */
+ swapSize = -1;
+
+#if defined(SWAPFILE_DIR) && defined(SWAPFILE_PREFIX)
+ dirp = opendir((const char *) SWAPFILE_DIR);
+ while((dp = readdir(dirp)) != NULL) {
+ /* if the file starts with the same as SWAPFILE_PREFIX
+ * we want to stat the file to get it's size
+ */
+ if(strspn(dp->d_name,(char *) SWAPFILE_PREFIX) == strlen((char *) SWAPFILE_PREFIX)) {
+ snprintf(full_name, sizeof(full_name),"%s/%s",SWAPFILE_DIR,dp->d_name);
+ /* we need to stat each swapfile to get it's size */
+ if(stat(full_name,&buf) != 0) {
+ snprintf(errmsg, sizeof(errmsg), "swapsize: can't stat file %s",full_name);
+ snmp_log_perror(errmsg);
+ } else {
+ /* total swap allocated is the size of
+ * all the swapfile's that exist in
+ * the SWAPFILE_DIR dir
+ */
+ swapSize += buf.st_size;
+ }
+ }
+
+ }
+ closedir(dirp);
+
+#else
+ /* we set the size to -1 if we're not supported */
+ swapSize = -1;
+#endif
+
+ return swapSize;
+}
+
+ /*
+ * Load the latest memory usage statistics
+ *
+ * HW_PHYSMEM is capped at 2 Gigs so we use HW_MEMSIZE
+ */
+int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
+
+ netsnmp_memory_info *mem;
+
+ uint64_t phys_mem; /* bytes */
+ size_t phys_mem_size = sizeof(phys_mem);
+ int phys_mem_mib[] = { CTL_HW, HW_MEMSIZE };
+
+ int pagesize; /* bytes */
+ size_t pagesize_size = sizeof(pagesize);
+ int pagesize_mib[] = { CTL_HW, HW_PAGESIZE };
+
+ uint64_t pages_used;
+ off_t swapSize;
+ off_t swapUsed;
+ vm_statistics_data_t vm_stat;
+ unsigned int count = HOST_VM_INFO_COUNT;
+
+ sysctl(phys_mem_mib, 2, &phys_mem, &phys_mem_size, NULL, 0);
+ sysctl(pagesize_mib, 2, &pagesize, &pagesize_size, NULL, 0);
+ host_statistics(mach_host_self(),HOST_VM_INFO,(host_info_t)&vm_stat,&count);
+ pages_used = vm_stat.active_count + vm_stat.inactive_count
+ + vm_stat.wire_count;
+ swapSize = swapsize(); /* in bytes */
+ swapUsed = pages_swapped();
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup( "Physical memory" );
+ mem->units = pagesize; /* 4096 */
+ mem->size = phys_mem/pagesize;
+ mem->free = (phys_mem/pagesize) - pages_used;
+ mem->other = -1;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 1 );
+ if (!mem) {
+ snmp_log_perror("No Swap info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup( "Swap space" );
+ mem->units = pagesize; /* 4096 */
+ mem->size = swapSize/pagesize;
+ mem->free = (swapSize/pagesize) - swapUsed;
+ mem->other = -1;
+ }
+
+/*
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_MISC, 1 );
+ if (!mem) {
+ snmp_log_perror("No Buffer, etc info entry");
+ } else {
+ mem->units = pagesize;
+ mem->size = -1;
+ mem->free = (phys_mem - pages_used) + (swapSize - swapUsed);
+ mem->other = -1;
+ }
+*/
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_dynix.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_dynix.c
new file mode 100644
index 0000000000..9b0bc507a3
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_dynix.c
@@ -0,0 +1,117 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/memory.h>
+
+#include <unistd.h>
+
+# ifdef HAVE_SYS_SWAP_H
+# include <sys/swap.h>
+# endif
+# ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+# endif
+
+/*
+ * Retained from UCD implementation
+ */
+long
+getTotalSwap(void)
+{
+ long total_swp_sectors = -1;
+
+ size_t max_elements = MAXSWAPDEVS;
+ swapsize_t swap_dblks[MAXSWAPDEVS];
+ swapstat_t swap_status;
+ int swap_sizes;
+
+ if ((swap_sizes =
+ getswapstat(max_elements, swap_dblks, &swap_status) >= 0))
+ total_swp_sectors =
+ swap_dblks[0].sws_size * swap_dblks[0].sws_total;
+
+ return (total_swp_sectors);
+}
+
+long
+getFreeSwap(void)
+{
+ long free_swp_sectors = -1;
+
+ size_t max_elements = MAXSWAPDEVS;
+ swapsize_t swap_dblks[MAXSWAPDEVS];
+ swapstat_t swap_status;
+ int i, swap_sizes;
+
+ if ((swap_sizes =
+ getswapstat(max_elements, swap_dblks, &swap_status) >= 0)) {
+ for (i = 0; i < swap_sizes; i++)
+ free_swp_sectors +=
+ swap_dblks[0].sws_size * swap_dblks[i].sws_avail;
+ }
+
+ return (free_swp_sectors);
+}
+
+/*
+ * return is in kilobytes
+ */
+long
+getTotalFree(void)
+{
+ long free_swap = S2KB(getFreeSwap());
+ long free_mem = P2KB(sysconf(_SC_FREEMEM));
+
+ if (free_swap < 0)
+ return (free_swap);
+ if (free_mem < 0)
+ return (free_mem);
+
+ free_mem += free_swap;
+ return (free_mem);
+}
+
+
+ /*
+ * Load the latest memory usage statistics
+ */
+int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
+
+ netsnmp_memory_info *mem;
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup( "Physical memory" );
+ mem->units = P2KB(1)*1024;
+ mem->size = sysconf(_SC_PHYSMEM);
+ mem->free = sysconf(_SC_FREEMEM);
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 1 );
+ if (!mem) {
+ snmp_log_perror("No Swap info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup( "Swap space" );
+ mem->units = S2KB(1)*1024;
+ mem->size = getTotalSwap();
+ mem->free = getFreeSwap();
+ }
+
+/*
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_MISC, 1 );
+ if (!mem) {
+ snmp_log_perror("No Buffer, etc info entry");
+ } else {
+ mem->units = 1024;
+ mem->size = -1;
+ mem->free = getTotalFree();
+ mem->other = -1;
+ }
+*/
+
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_freebsd.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_freebsd.c
new file mode 100644
index 0000000000..6df244b206
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_freebsd.c
@@ -0,0 +1,258 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+#include <net-snmp/agent/hardware/memory.h>
+
+#include <unistd.h>
+#include <sys/param.h>
+#include <sys/fcntl.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+#include <kvm.h>
+
+#if HAVE_SYS_VMPARAM_H
+#include <sys/vmparam.h>
+#else
+#include <vm/vm_param.h>
+#endif
+
+#define SUM_SYMBOL "cnt"
+#define BUFSPACE_SYMBOL "bufspace"
+
+quad_t swapTotal;
+quad_t swapUsed;
+quad_t swapFree;
+
+int swapmode(long);
+
+
+ /*
+ * Load the latest memory usage statistics
+ */
+int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
+
+ netsnmp_memory_info *mem;
+ long pagesize;
+ int nswap;
+
+ struct vmmeter vmem;
+ struct vmtotal total;
+ size_t total_size = sizeof(total);
+ int total_mib[] = { CTL_VM, VM_METER };
+
+ u_long phys_mem;
+ u_long user_mem;
+ unsigned int bufspace;
+ unsigned int maxbufspace;
+ size_t mem_size = sizeof(phys_mem);
+ size_t buf_size = sizeof(bufspace);
+ int phys_mem_mib[] = { CTL_HW, HW_PHYSMEM };
+ int user_mem_mib[] = { CTL_HW, HW_USERMEM };
+
+ /*
+ * Retrieve the memory information from the underlying O/S...
+ */
+ sysctl(total_mib, 2, &total, &total_size, NULL, 0);
+ sysctl(phys_mem_mib, 2, &phys_mem, &mem_size, NULL, 0);
+ sysctl(user_mem_mib, 2, &user_mem, &mem_size, NULL, 0);
+ sysctlbyname("vfs.bufspace", &bufspace, &buf_size, NULL, 0);
+ sysctlbyname("vfs.maxbufspace", &maxbufspace, &buf_size, NULL, 0);
+ auto_nlist(SUM_SYMBOL, (char *) &vmem, sizeof(vmem));
+#ifndef freebsd4
+ pagesize = 1024;
+#else
+ pagesize = getpagesize();
+#endif
+
+ /*
+ * ... and save this in a standard form.
+ */
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No Physical Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Physical memory");
+ mem->units = pagesize;
+ mem->size = user_mem/pagesize;
+ mem->free = total.t_free;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_USERMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No (user) Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Real memory");
+ mem->units = pagesize;
+ mem->size = total.t_rm;
+ mem->free = total.t_arm;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_VIRTMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No Virtual Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Virtual memory");
+ mem->units = pagesize;
+ mem->size = total.t_vm;
+ mem->free = total.t_avm;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SHARED, 1 );
+ if (!mem) {
+ snmp_log_perror("No Shared Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Shared virtual memory");
+ mem->units = pagesize;
+ mem->size = total.t_vmshr;
+ mem->free = total.t_avmshr;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SHARED2, 1 );
+ if (!mem) {
+ snmp_log_perror("No Shared2 Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Shared real memory");
+ mem->units = pagesize;
+ mem->size = total.t_rmshr;
+ mem->free = total.t_armshr;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_CACHED, 1 );
+ if (!mem) {
+ snmp_log_perror("No Cached Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Cached memory");
+ mem->units = vmem.v_page_size;
+ mem->size = vmem.v_cache_max;
+ mem->free = vmem.v_cache_max - vmem.v_cache_count;
+ }
+
+ nswap = swapmode(pagesize);
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 1 );
+ if (!mem) {
+ snmp_log_perror("No Swap info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup( (nswap>1) ? "Swap space (total)"
+ : "Swap space");
+ mem->units = pagesize;
+ mem->size = swapTotal;
+ mem->free = swapFree;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_MBUF, 1 );
+ if (!mem) {
+ snmp_log_perror("No Buffer, etc info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Memory buffers");
+ mem->units = 1024;
+ mem->size = maxbufspace / 1024;
+ mem->free = (maxbufspace - bufspace)/1024;
+ }
+
+ return 0;
+}
+
+
+
+/*
+ * Retained from UCD implementation
+ */
+
+
+#ifndef freebsd4
+/*
+ * Executes swapinfo and parses last line
+ * This is just way too ugly ;)
+ */
+
+int
+swapmode(long pagesize)
+{
+ struct extensible ext;
+ int fd;
+ FILE *file;
+
+ strcpy(ext.command, "/usr/sbin/swapinfo -k");
+
+ if ((fd = get_exec_output(&ext)) != -1) {
+ file = fdopen(fd, "r");
+
+ while (fgets(ext.output, sizeof(ext.output), file) != NULL);
+
+ fclose(file);
+ wait_on_exec(&ext);
+
+ sscanf(ext.output, "%*s%*d%qd%qd", &swapUsed, &swapFree);
+
+ swapTotal = swapUsed + swapFree;
+ }
+ return 1;
+}
+#else
+/*
+ * swapmode is based on a program called swapinfo written
+ * by Kevin Lahey <kml@rokkaku.atl.ga.us>.
+ */
+
+#include <sys/conf.h>
+
+int
+swapmode(long pagesize)
+{
+ int i, n;
+ static kvm_t *kd = NULL;
+ struct kvm_swap kswap[16];
+ netsnmp_memory_info *mem;
+ char buf[1024];
+
+ if (kd == NULL)
+ kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
+ n = kvm_getswapinfo(kd, kswap, sizeof(kswap) / sizeof(kswap[0]), 0);
+
+ swapUsed = swapTotal = swapFree = 0;
+
+ if ( n > 1 ) {
+ /*
+ * If there are multiple swap devices, then record
+ * the statistics for each one separately...
+ */
+ for (i = 0; i < n; ++i) {
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP+1+i, 1 );
+ if (!mem)
+ continue;
+ if (!mem->descr) {
+ sprintf(buf, "swap %s", kswap[i].ksw_devname);
+ mem->descr = strdup( buf );
+ }
+ mem->units = pagesize;
+ mem->size = kswap[i].ksw_total;
+ mem->free = kswap[i].ksw_total - kswap[i].ksw_used;
+ /*
+ * ... and keep a running total for the overall swap stats
+ */
+ swapTotal += kswap[i].ksw_total;
+ swapUsed += kswap[i].ksw_used;
+ }
+ } else {
+ /*
+ * If there's only one swap device, then don't bother
+ * with individual statistics.
+ */
+ swapTotal += kswap[0].ksw_total;
+ swapUsed += kswap[0].ksw_used;
+ }
+
+ swapFree = swapTotal - swapUsed;
+ return n;
+}
+#endif
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_hpux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_hpux.c
new file mode 100644
index 0000000000..6e631c6c91
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_hpux.c
@@ -0,0 +1,132 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/memory.h>
+
+#include <sys/pstat.h>
+
+
+void get_swapinfo(long *total, long *free, long *size);
+
+ /*
+ * Load the latest memory usage statistics
+ */
+int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
+
+ struct pst_static pst;
+ struct pst_dynamic psd;
+ netsnmp_memory_info *mem;
+ long total_swap = 0;
+ long free_swap = 0;
+ long size = 0;
+
+ /*
+ * Retrieve the memory information from the underlying O/S...
+ */
+ if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+ snmp_log(LOG_ERR, "memory_hpux: pstat_getstatic failed!\n");
+ return -1;
+ }
+ if (pstat_getdynamic(&psd, sizeof(psd), (size_t) 1, 0) == -1) {
+ snmp_log(LOG_ERR, "memory_hpux: pstat_getdynamic failed!\n");
+ return -1;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup( "Physical memory" );
+ mem->units = pst.page_size;
+ mem->size = pst.physical_memory;
+ mem->free = psd.psd_free;
+ mem->other = -1;
+ }
+
+ get_swapinfo(&total_swap, &free_swap, &size);
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 1 );
+ if (!mem) {
+ snmp_log_perror("No Swap info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup( "Swap space (total)" );
+ mem->units = size;
+ mem->size = total_swap;
+ mem->free = free_swap;
+ mem->other = -1;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_STEXT, 1 );
+ if (!mem) {
+ snmp_log_perror("No Swap text entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup( "Swapped text pages" );
+ mem->units = pst.page_size;
+ mem->size = psd.psd_vmtxt;
+ mem->free = psd.psd_avmtxt;
+ mem->other = -1;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_RTEXT, 1 );
+ if (!mem) {
+ snmp_log_perror("No real text entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup( "Real text pages" );
+ mem->units = pst.page_size;
+ mem->size = psd.psd_rmtxt;
+ mem->free = psd.psd_armtxt;
+ mem->other = -1;
+ }
+
+/*
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_MISC, 1 );
+ if (!mem) {
+ snmp_log_perror("No Buffer, etc info entry");
+ } else {
+ mem->units = 1024;
+ mem->size = -1;
+ mem->free = (pst.page_size/1024)*psd.psd_free + swap.free_swap;
+ mem->other = -1;
+ }
+ */
+ return 0;
+}
+/*
+ * Retained from UCD implementation
+ */
+void
+get_swapinfo(long *total, long *free, long *size)
+{
+ struct pst_swapinfo pss;
+ netsnmp_memory_info *mem;
+ int i = 0;
+ char buf[1024];
+
+ while (pstat_getswap(&pss, sizeof(pss), (size_t) 1, i) != -1) {
+ if (pss.pss_idx == (unsigned) i) {
+ /*
+ * TODO - Skip if only one swap device
+ */
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP+1+i, 1 );
+ if (!mem)
+ continue;
+ if (!mem->descr) {
+ sprintf(buf, "swap #%d %s", i, pss.pss_mntpt);
+ mem->descr = strdup( buf );
+ }
+ mem->units = pss.pss_swapchunk;
+ mem->size = pss.pss_nblksenabled; /* Or pss_nblks ? */
+ mem->free = pss.pss_nfpgs; /* Or pss_nblksavail ? */
+ mem->other = -1;
+ *total += mem->size;
+ *free += mem->other;
+ *size = pss.pss_swapchunk; /* Hopefully consistent! */
+ i++;
+ } else
+ return;
+ }
+} /* end get_swapinfo */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_irix.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_irix.c
new file mode 100644
index 0000000000..377f007025
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_irix.c
@@ -0,0 +1,87 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/memory.h>
+
+#if HAVE_SYS_SWAP_H
+#include <sys/swap.h>
+#endif
+
+#if HAVE_SYS_SYSGET_H
+#include <sys/sysget.h>
+#endif
+
+#if HAVE_SYS_SYSMP_H
+#include <sys/sysmp.h>
+#endif
+
+ /*
+ * Load the latest memory usage statistics
+ */
+int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
+
+ netsnmp_memory_info *mem;
+ struct rminfo meminfo; /* struct for getting memory info, see sys/sysmp.h */
+ int pagesz, rminfosz;
+ off_t swaptotal, swapfree;
+
+ /*
+ * Retrieve the memory information from the underlying O/S...
+ */
+ DEBUGMSGTL(("hardware/memory/memory_irix", "Start retrieving values from OS\n"));
+ pagesz = getpagesize();
+ DEBUGMSGTL(("hardware/memory/memory_irix", "Page size: %d\n", pagesz));
+ rminfosz = (int)sysmp(MP_SASZ, MPSA_RMINFO);
+ DEBUGMSGTL(("hardware/memory/memory_irix", "rminfo size: %d\n", rminfosz));
+ if (sysmp(MP_SAGET, MPSA_RMINFO, &meminfo, rminfosz) < 0) {
+ snmp_log(LOG_ERR, "memory_irix: sysmp failed!\n");
+ return -1;
+ }
+ swapctl(SC_GETSWAPTOT, &swaptotal);
+ swapctl(SC_GETFREESWAP, &swapfree);
+
+ /*
+ * ... and save this in a standard form.
+ */
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No Physical Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Physical memory");
+ mem->units = pagesz;
+ mem->size = meminfo.physmem;
+ mem->free = meminfo.availrmem;
+ mem->other = -1;
+ DEBUGMSGTL(("hardware/memory/memory_irix", "Physical memory: size %u, free %u\n", mem->size, mem->free));
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_VIRTMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No Virtual Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Virtual memory");
+ mem->units = pagesz; /* swaptotal is in blocks, so adjust below */
+ mem->size = meminfo.physmem + (swaptotal*512/pagesz);
+ mem->free = meminfo.availsmem;
+ mem->other = -1;
+ DEBUGMSGTL(("hardware/memory/memory_irix", "Virtual memory: size %u, free %u\n", mem->size, mem->free));
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 1 );
+ if (!mem) {
+ snmp_log_perror("No Swap info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Swap space");
+ mem->units = 1024;
+ mem->size = swaptotal/2; /* blocks to KB */
+ mem->free = swapfree/2; /* blocks to KB */
+ mem->other = -1;
+ DEBUGMSGTL(("hardware/memory/memory_irix", "Swap: size %u, free %u\n", mem->size, mem->free));
+ }
+
+ return 0;
+}
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_linux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_linux.c
new file mode 100644
index 0000000000..40819af273
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_linux.c
@@ -0,0 +1,207 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/memory.h>
+
+#include <unistd.h>
+#include <fcntl.h>
+
+/*
+ * Try to use an initial size that will cover default cases. We aren't talking
+ * about huge files, so why fiddle about with reallocs?
+ * I checked /proc/meminfo sizes on 3 different systems: 598, 644, 654
+ */
+#define MEMINFO_INIT_SIZE 768
+#define MEMINFO_STEP_SIZE 256
+#define MEMINFO_FILE "/proc/meminfo"
+
+ /*
+ * Load the latest memory usage statistics
+ */
+int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
+ int statfd;
+ static char *buff = NULL;
+ static int bsize = 0;
+ static int first = 1;
+ ssize_t bytes_read;
+ char *b;
+ unsigned long memtotal = 0, memfree = 0, memshared = 0,
+ buffers = 0, cached = 0,
+ swaptotal = 0, swapfree = 0;
+
+ netsnmp_memory_info *mem;
+
+ /*
+ * Retrieve the memory information from the underlying O/S...
+ */
+ if ((statfd = open(MEMINFO_FILE, O_RDONLY, 0)) == -1) {
+ snmp_log_perror(MEMINFO_FILE);
+ return -1;
+ }
+ if (bsize == 0) {
+ bsize = MEMINFO_INIT_SIZE;
+ buff = malloc(bsize);
+ if (NULL == buff) {
+ snmp_log(LOG_ERR, "malloc failed\n");
+ return -1;
+ }
+ }
+ while ((bytes_read = read(statfd, buff, bsize)) == bsize) {
+ b = realloc(buff, bsize + MEMINFO_STEP_SIZE);
+ if (NULL == b) {
+ snmp_log(LOG_ERR, "malloc failed\n");
+ return -1;
+ }
+ buff = b;
+ bsize += MEMINFO_STEP_SIZE;
+ DEBUGMSGTL(("mem", "/proc/meminfo buffer increased to %d\n", bsize));
+ close(statfd);
+ statfd = open(MEMINFO_FILE, O_RDONLY, 0);
+ if (statfd == -1) {
+ snmp_log_perror(MEMINFO_FILE);
+ return -1;
+ }
+ }
+ close(statfd);
+ if (bytes_read <= 0) {
+ snmp_log_perror(MEMINFO_FILE);
+ }
+
+ /*
+ * ... parse this into a more useable form...
+ */
+ b = strstr(buff, "MemTotal: ");
+ if (b)
+ sscanf(b, "MemTotal: %lu", &memtotal);
+ else {
+ if (first)
+ snmp_log(LOG_ERR, "No MemTotal line in /proc/meminfo\n");
+ }
+ b = strstr(buff, "MemFree: ");
+ if (b)
+ sscanf(b, "MemFree: %lu", &memfree);
+ else {
+ if (first)
+ snmp_log(LOG_ERR, "No MemFree line in /proc/meminfo\n");
+ }
+ b = strstr(buff, "MemShared: ");
+ if (b)
+ sscanf(b, "MemShared: %lu", &memshared);
+ else {
+ if (first)
+ if (0 == netsnmp_os_prematch("Linux","2.4"))
+ snmp_log(LOG_ERR, "No MemShared line in /proc/meminfo\n");
+ }
+ b = strstr(buff, "Buffers: ");
+ if (b)
+ sscanf(b, "Buffers: %lu", &buffers);
+ else {
+ if (first)
+ snmp_log(LOG_ERR, "No Buffers line in /proc/meminfo\n");
+ }
+ b = strstr(buff, "Cached: ");
+ if (b)
+ sscanf(b, "Cached: %lu", &cached);
+ else {
+ if (first)
+ snmp_log(LOG_ERR, "No Cached line in /proc/meminfo\n");
+ }
+ b = strstr(buff, "SwapTotal: ");
+ if (b)
+ sscanf(b, "SwapTotal: %lu", &swaptotal);
+ else {
+ if (first)
+ snmp_log(LOG_ERR, "No SwapTotal line in /proc/meminfo\n");
+ }
+ b = strstr(buff, "SwapFree: ");
+ if (b)
+ sscanf(b, "SwapFree: %lu", &swapfree);
+ else {
+ if (first)
+ snmp_log(LOG_ERR, "No SwapFree line in /proc/meminfo\n");
+ }
+ first = 0;
+
+
+ /*
+ * ... and save this in a standard form.
+ */
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No Physical Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Physical memory");
+ mem->units = 1024;
+ mem->size = memtotal;
+ mem->free = memfree;
+ mem->other = -1;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_VIRTMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No Virtual Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Virtual memory");
+ mem->units = 1024;
+ mem->size = memtotal+swaptotal;
+ mem->free = memfree +swapfree;
+ mem->other = -1;
+ }
+
+ /* Shared memory is not reported by Linux 2.6 kernel */
+ if (0 != netsnmp_os_prematch("Linux","2.6")) {
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SHARED, 1 );
+ if (!mem) {
+ snmp_log_perror("No Shared Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Shared memory");
+ mem->units = 1024;
+ mem->size = memshared;
+ mem->free = -1;
+ mem->other = -1;
+ }
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_CACHED, 1 );
+ if (!mem) {
+ snmp_log_perror("No Cached Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Cached memory");
+ mem->units = 1024;
+ mem->size = cached;
+ mem->free = 0; /* Report cached size/used as equal */
+ mem->other = -1;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 1 );
+ if (!mem) {
+ snmp_log_perror("No Swap info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Swap space");
+ mem->units = 1024;
+ mem->size = swaptotal;
+ mem->free = swapfree;
+ mem->other = -1;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_MBUF, 1 );
+ if (!mem) {
+ snmp_log_perror("No Buffer, etc info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Memory buffers");
+ mem->units = 1024;
+ mem->size = memtotal; /* Traditionally we've always regarded
+ all memory as potentially available
+ for memory buffers. */
+ mem->free = memtotal - buffers;
+ mem->other = -1;
+ }
+
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_linux.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_linux.h
new file mode 100644
index 0000000000..1b59cfba6f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_linux.h
@@ -0,0 +1 @@
+config_require(hardware/memory/hw_mem)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_netbsd.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_netbsd.c
new file mode 100644
index 0000000000..746fea0490
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_netbsd.c
@@ -0,0 +1,139 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/memory.h>
+
+#include <unistd.h>
+#include <sys/sysctl.h>
+#include <sys/swap.h>
+
+#if defined(HAVE_UVM_UVM_PARAM_H) && defined(HAVE_UVM_UVM_EXTERN_H)
+#include <uvm/uvm_param.h>
+#include <uvm/uvm_extern.h>
+#elif defined(HAVE_VM_VM_PARAM_H) && defined(HAVE_VM_VM_EXTERN_H)
+#include <vm/vm_param.h>
+#include <vm/vm_extern.h>
+#else
+#error memory_netbsd1.c: Is this really a NetBSD system?
+#endif
+
+#ifdef SWAP_NSWAP
+void swapinfo(long);
+#endif
+
+ /*
+ * Load the latest memory usage statistics
+ */
+int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
+
+ netsnmp_memory_info *mem;
+ long pagesize;
+
+ struct uvmexp uvmexp;
+ int uvmexp_size = sizeof(uvmexp);
+ int uvmexp_mib[] = { CTL_VM, VM_UVMEXP };
+
+ struct vmtotal total;
+ size_t total_size = sizeof(total);
+ int total_mib[] = { CTL_VM, VM_METER };
+
+ long phys_mem;
+ long user_mem;
+ size_t mem_size = sizeof(phys_mem);
+ int phys_mem_mib[] = { CTL_HW, HW_PHYSMEM };
+ int user_mem_mib[] = { CTL_HW, HW_USERMEM };
+
+ /*
+ * Retrieve the memory information from the underlying O/S...
+ */
+ sysctl(uvmexp_mib, 2, &uvmexp, &uvmexp_size, NULL, 0);
+ sysctl(total_mib, 2, &total, &total_size, NULL, 0);
+ sysctl(phys_mem_mib, 2, &phys_mem, &mem_size, NULL, 0);
+ sysctl(user_mem_mib, 2, &user_mem, &mem_size, NULL, 0);
+ pagesize = uvmexp.pagesize;
+
+ /*
+ * ... and save this in a standard form.
+ */
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No Physical Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Physical memory");
+ mem->units = pagesize;
+ mem->size = phys_mem/pagesize;
+ mem->free = total.t_free;
+ mem->other = -1;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_USERMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No (user) Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Real memory");
+ mem->units = pagesize;
+ mem->size = user_mem/pagesize;
+ mem->free = uvmexp.free;
+ mem->other = -1;
+ }
+
+#ifdef SWAP_NSWAP
+ swapinfo(pagesize);
+#endif
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 1 );
+ if (!mem) {
+ snmp_log_perror("No Swap info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Swap space");
+ mem->units = pagesize;
+ mem->size = uvmexp.swpages;
+ mem->free = uvmexp.swpages - uvmexp.swpginuse;
+ mem->other = -1;
+ }
+
+ return 0;
+}
+
+
+#ifdef SWAP_NSWAP
+ /*
+ * If there are multiple swap devices, record
+ * the statistics for each one individually.
+ */
+void
+swapinfo(long pagesize)
+{
+ int i, n;
+ struct swapent *s;
+ netsnmp_memory_info *mem;
+ char buf[1024];
+
+ /*
+ * If there's only one swap device, don't bother
+ */
+ n = swapctl( SWAP_NSWAP, NULL, 0 );
+ if ( n <= 1 )
+ return;
+
+ s = (struct swapent*)calloc(n, sizeof(struct swapent));
+ swapctl( SWAP_STATS, s, n );
+
+ for (i = 0; i < n; ++i) {
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP+1+i, 1 );
+ if (!mem)
+ continue;
+ if (!mem->descr) {
+ /* sprintf(buf, "swap #%d", s[i].se_dev); */
+ sprintf(buf, "swap %s", s[i].se_path);
+ mem->descr = strdup( buf );
+ }
+ mem->units = pagesize;
+ mem->size = s[i].se_nblks;
+ mem->free = s[i].se_nblks - s[i].se_inuse;
+ mem->other = -1;
+ }
+}
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_null.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_null.c
new file mode 100644
index 0000000000..54ca6df74d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_null.c
@@ -0,0 +1,18 @@
+/*
+ * dummy HAL memory module
+ * for systems not using any of the supported interfaces
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/memory.h>
+
+
+ /*
+ * We can't load the memory usage statistics
+ * because we don't know how to do this!
+ */
+int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
+
+ return 0; /* or -1 ? */
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_solaris.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_solaris.c
new file mode 100644
index 0000000000..3dfff8b239
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_solaris.c
@@ -0,0 +1,172 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/memory.h>
+
+#include <unistd.h>
+#include <kstat.h>
+#include <sys/stat.h>
+#include <sys/swap.h>
+
+#ifndef MAXSTRSIZE
+#define MAXSTRSIZE 1024
+#endif
+
+void getSwapInfo(long *total_mem, long *free_mem);
+
+
+ /*
+ * Load the latest memory usage statistics
+ */
+int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
+
+#ifndef _SC_PHYS_PAGES
+ extern kstat_ctl_t *kstat_fd; /* defined in kernel_sunos5.c */
+ kstat_t *ksp1;
+ kstat_named_t *kn;
+#endif
+#ifdef SC_AINFO
+ struct anoninfo ai;
+#endif
+
+ long phys_mem = 0;
+ long phys_free = 0;
+ long swap_pages = 0;
+ long swap_free = 0;
+ long pagesize = 0;
+ netsnmp_memory_info *mem;
+
+ /*
+ * Retrieve the memory information from the underlying O/S...
+ */
+ pagesize = getpagesize();
+ getSwapInfo( &swap_pages, &swap_free );
+#ifdef SC_AINFO
+ swapctl(SC_AINFO, &ai);
+#endif
+#ifdef _SC_PHYS_PAGES
+ phys_mem = sysconf(_SC_PHYS_PAGES);
+ phys_free = sysconf(_SC_AVPHYS_PAGES);
+#else
+ ksp1 = kstat_lookup(kstat_fd, "unix", 0, "system_pages");
+ kstat_read(kstat_fd, ksp1, 0);
+ kn = kstat_data_lookup(ksp1, "physmem");
+ phys_mem = kn->value.ul;
+#ifdef SC_AINFO
+ phys_free = (ai.ani_max - ai.ani_resv) - swap_free;
+#else
+ phys_free = -1;
+#endif
+#endif
+
+ /*
+ * ... and save this in a standard form.
+ */
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup( "Physical memory" );
+ mem->units = pagesize;
+ mem->size = phys_mem;
+ mem->free = phys_free;
+ mem->other = -1;
+ }
+
+#ifdef SC_AINFO
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_VIRTMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No Virtual Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup( " Virtual memory" );
+ mem->units = pagesize; /* or 1024? */
+ mem->size = ai.ani_max;
+ mem->free = (ai.ani_max - ai.ani_resv);
+ mem->other = -1;
+ }
+#endif
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 1 );
+ if (!mem) {
+ snmp_log_perror("No Swap info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup( "Swap space" );
+ mem->units = pagesize;
+ mem->size = swap_pages;
+ mem->free = swap_free;
+ mem->other = -1;
+ }
+
+/*
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_MISC, 1 );
+ if (!mem) {
+ snmp_log_perror("No Buffer, etc info entry");
+ } else {
+ mem->units = getpagesize();
+ mem->size = -1;
+ mem->free = getTotalFree();
+ mem->other = -1;
+ }
+*/
+
+ return 0;
+}
+
+/*
+ * Adapted from UCD implementation
+ */
+void
+getSwapInfo(long *total_mem, long *total_free)
+{
+ size_t num;
+ int i, n;
+ swaptbl_t *s;
+ netsnmp_memory_info *mem;
+ char *strtab;
+ char buf[1024];
+
+ num = swapctl(SC_GETNSWP, 0);
+ s = malloc(num * sizeof(swapent_t) + sizeof(struct swaptable));
+ if (!s)
+ return;
+
+ strtab = (char *) malloc((num + 1) * MAXSTRSIZE);
+ if (!strtab) {
+ free(s);
+ return;
+ }
+
+ for (i = 0; i < (num + 1); i++) {
+ s->swt_ent[i].ste_path = strtab + (i * MAXSTRSIZE);
+ }
+ s->swt_n = num + 1;
+ n = swapctl(SC_LIST, s);
+
+ if (n > 1) {
+ for (i = 0; i < n; ++i) {
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP+1+i, 1 );
+ if (!mem)
+ continue;
+ if (!mem->descr) {
+ sprintf(buf, "swap #%d %s", i, s->swt_ent[i].ste_path);
+ mem->descr = strdup( buf );
+ }
+ mem->units = getpagesize();
+ mem->size = s->swt_ent[i].ste_pages;
+ mem->free = s->swt_ent[i].ste_free;
+ mem->other = -1;
+ *total_mem += mem->size;
+ *total_free += mem->free;
+ }
+ }
+ else {
+ *total_mem = s->swt_ent[0].ste_pages;
+ *total_free = s->swt_ent[0].ste_free;
+ }
+
+ free(strtab);
+ free(s);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_win.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_win.c
new file mode 100644
index 0000000000..849aae713d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/hardware/memory/memory_win.c
@@ -0,0 +1,63 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/memory.h>
+
+#include <windows.h>
+
+
+ /*
+ * Load the latest memory usage statistics
+ */
+int netsnmp_mem_arch_load( netsnmp_cache *cache, void *magic ) {
+
+ netsnmp_memory_info *mem;
+ MEMORYSTATUS stat;
+
+ /*
+ * Retrieve the memory information from the underlying O/S...
+ */
+ GlobalMemoryStatus(&stat);
+
+ /*
+ * ... and save this in a standard form.
+ */
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No Physical Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Physical memory");
+ mem->units = 1024;
+ mem->size = stat.dwTotalPhys/1024;
+ mem->free = stat.dwAvailPhys/1024;
+ mem->other = -1;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_VIRTMEM, 1 );
+ if (!mem) {
+ snmp_log_perror("No Virtual Memory info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Virtual memory");
+ mem->units = 1024;
+ mem->size = stat.dwTotalVirtual/1024;
+ mem->free = stat.dwAvailVirtual/1024;
+ mem->other = -1;
+ }
+
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 1 );
+ if (!mem) {
+ snmp_log_perror("No Swap info entry");
+ } else {
+ if (!mem->descr)
+ mem->descr = strdup("Swap space");
+ mem->units = 1024;
+ mem->size = stat.dwTotalPageFile/1024;
+ mem->free = stat.dwAvailPageFile/1024;
+ mem->other = -1;
+ }
+
+ return 0;
+}
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/header_complex.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/header_complex.c
new file mode 100644
index 0000000000..c385ede92c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/header_complex.c
@@ -0,0 +1,595 @@
+/*
+ * header complex: More complex storage and data sorting for mib modules
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "header_complex.h"
+
+int
+header_complex_generate_varoid(netsnmp_variable_list * var)
+{
+ int i;
+
+ if (var->name == NULL) {
+ /*
+ * assume cached value is correct
+ */
+ switch (var->type) {
+ case ASN_INTEGER:
+ case ASN_COUNTER:
+ case ASN_GAUGE:
+ case ASN_TIMETICKS:
+ var->name_length = 1;
+ var->name = (oid *) malloc(sizeof(oid));
+ if (var->name == NULL)
+ return SNMPERR_GENERR;
+ var->name[0] = *(var->val.integer);
+ break;
+
+ case ASN_PRIV_IMPLIED_OBJECT_ID:
+ var->name_length = var->val_len / sizeof(oid);
+ var->name = (oid *) malloc(sizeof(oid) * (var->name_length));
+ if (var->name == NULL)
+ return SNMPERR_GENERR;
+
+ for (i = 0; i < (int) var->name_length; i++)
+ var->name[i] = var->val.objid[i];
+ break;
+
+ case ASN_OBJECT_ID:
+ var->name_length = var->val_len / sizeof(oid) + 1;
+ var->name = (oid *) malloc(sizeof(oid) * (var->name_length));
+ if (var->name == NULL)
+ return SNMPERR_GENERR;
+
+ var->name[0] = var->name_length - 1;
+ for (i = 0; i < (int) var->name_length - 1; i++)
+ var->name[i + 1] = var->val.objid[i];
+ break;
+
+ case ASN_PRIV_IMPLIED_OCTET_STR:
+ var->name_length = var->val_len;
+ var->name = (oid *) malloc(sizeof(oid) * (var->name_length));
+ if (var->name == NULL)
+ return SNMPERR_GENERR;
+
+ for (i = 0; i < (int) var->val_len; i++)
+ var->name[i] = (oid) var->val.string[i];
+ break;
+
+ case ASN_OPAQUE:
+ case ASN_OCTET_STR:
+ var->name_length = var->val_len + 1;
+ var->name = (oid *) malloc(sizeof(oid) * (var->name_length));
+ if (var->name == NULL)
+ return SNMPERR_GENERR;
+
+ var->name[0] = (oid) var->val_len;
+ for (i = 0; i < (int) var->val_len; i++)
+ var->name[i + 1] = (oid) var->val.string[i];
+ break;
+
+ default:
+ DEBUGMSGTL(("header_complex_generate_varoid",
+ "invalid asn type: %d\n", var->type));
+ return SNMPERR_GENERR;
+ }
+ }
+ if (var->name_length > MAX_OID_LEN) {
+ DEBUGMSGTL(("header_complex_generate_varoid",
+ "Something terribly wrong, namelen = %d\n",
+ var->name_length));
+ return SNMPERR_GENERR;
+ }
+
+ return SNMPERR_SUCCESS;
+}
+
+/*
+ * header_complex_parse_oid(): parses an index to the usmTable to
+ * break it down into a engineID component and a name component.
+ * The results are stored in the data pointer, as a varbindlist:
+ *
+ *
+ * returns 1 if an error is encountered, or 0 if successful.
+ */
+int
+header_complex_parse_oid(oid * oidIndex, size_t oidLen,
+ netsnmp_variable_list * data)
+{
+ netsnmp_variable_list *var = data;
+ int i, itmp;
+
+ while (var && oidLen > 0) {
+ switch (var->type) {
+ case ASN_INTEGER:
+ case ASN_COUNTER:
+ case ASN_GAUGE:
+ case ASN_TIMETICKS:
+ var->val.integer = (long *) calloc(1, sizeof(long));
+ if (var->val.string == NULL)
+ return SNMPERR_GENERR;
+
+ *var->val.integer = (long) *oidIndex++;
+ var->val_len = sizeof(long);
+ oidLen--;
+ DEBUGMSGTL(("header_complex_parse_oid",
+ "Parsed int(%d): %d\n", var->type,
+ *var->val.integer));
+ break;
+
+ case ASN_OBJECT_ID:
+ case ASN_PRIV_IMPLIED_OBJECT_ID:
+ if (var->type == ASN_PRIV_IMPLIED_OBJECT_ID) {
+ itmp = oidLen;
+ } else {
+ itmp = (long) *oidIndex++;
+ oidLen--;
+ if (itmp > (int) oidLen)
+ return SNMPERR_GENERR;
+ }
+
+ if (itmp == 0)
+ break; /* zero length strings shouldn't malloc */
+
+ var->val_len = itmp * sizeof(oid);
+ var->val.objid = (oid *) calloc(1, var->val_len);
+ if (var->val.objid == NULL)
+ return SNMPERR_GENERR;
+
+ for (i = 0; i < itmp; i++)
+ var->val.objid[i] = (u_char) * oidIndex++;
+ oidLen -= itmp;
+
+ DEBUGMSGTL(("header_complex_parse_oid", "Parsed oid: "));
+ DEBUGMSGOID(("header_complex_parse_oid", var->val.objid,
+ var->val_len / sizeof(oid)));
+ DEBUGMSG(("header_complex_parse_oid", "\n"));
+ break;
+
+ case ASN_OPAQUE:
+ case ASN_OCTET_STR:
+ case ASN_PRIV_IMPLIED_OCTET_STR:
+ if (var->type == ASN_PRIV_IMPLIED_OCTET_STR) {
+ itmp = oidLen;
+ } else {
+ itmp = (long) *oidIndex++;
+ oidLen--;
+ if (itmp > (int) oidLen)
+ return SNMPERR_GENERR;
+ }
+
+ if (itmp == 0)
+ break; /* zero length strings shouldn't malloc */
+
+ /*
+ * malloc by size+1 to allow a null to be appended.
+ */
+ var->val_len = itmp;
+ var->val.string = (u_char *) calloc(1, itmp + 1);
+ if (var->val.string == NULL)
+ return SNMPERR_GENERR;
+
+ for (i = 0; i < itmp; i++)
+ var->val.string[i] = (u_char) * oidIndex++;
+ var->val.string[itmp] = '\0';
+ oidLen -= itmp;
+
+ DEBUGMSGTL(("header_complex_parse_oid",
+ "Parsed str(%d): %s\n", var->type,
+ var->val.string));
+ break;
+
+ default:
+ DEBUGMSGTL(("header_complex_parse_oid",
+ "invalid asn type: %d\n", var->type));
+ return SNMPERR_GENERR;
+ }
+ var = var->next_variable;
+ }
+ if (var != NULL || oidLen > 0)
+ return SNMPERR_GENERR;
+ return SNMPERR_SUCCESS;
+}
+
+
+void
+header_complex_generate_oid(oid * name, /* out */
+ size_t * length, /* out */
+ oid * prefix,
+ size_t prefix_len,
+ netsnmp_variable_list * data)
+{
+
+ oid *oidptr;
+ netsnmp_variable_list *var;
+
+ if (prefix) {
+ memcpy(name, prefix, prefix_len * sizeof(oid));
+ oidptr = (name + (prefix_len));
+ *length = prefix_len;
+ } else {
+ oidptr = name;
+ *length = 0;
+ }
+
+ for (var = data; var != NULL; var = var->next_variable) {
+ header_complex_generate_varoid(var);
+ memcpy(oidptr, var->name, sizeof(oid) * var->name_length);
+ oidptr = oidptr + var->name_length;
+ *length += var->name_length;
+ }
+
+ DEBUGMSGTL(("header_complex_generate_oid", "generated: "));
+ DEBUGMSGOID(("header_complex_generate_oid", name, *length));
+ DEBUGMSG(("header_complex_generate_oid", "\n"));
+}
+
+/*
+ * finds the data in "datalist" stored at "index"
+ */
+void *
+header_complex_get(struct header_complex_index *datalist,
+ netsnmp_variable_list * index)
+{
+ oid searchfor[MAX_OID_LEN];
+ size_t searchfor_len;
+
+ header_complex_generate_oid(searchfor, /* out */
+ &searchfor_len, /* out */
+ NULL, 0, index);
+ return header_complex_get_from_oid(datalist, searchfor, searchfor_len);
+}
+
+void *
+header_complex_get_from_oid(struct header_complex_index *datalist,
+ oid * searchfor, size_t searchfor_len)
+{
+ struct header_complex_index *nptr;
+ for (nptr = datalist; nptr != NULL; nptr = nptr->next) {
+ if (netsnmp_oid_equals(searchfor, searchfor_len,
+ nptr->name, nptr->namelen) == 0)
+ return nptr->data;
+ }
+ return NULL;
+}
+
+
+void *
+header_complex(struct header_complex_index *datalist,
+ struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+
+ struct header_complex_index *nptr, *found = NULL;
+ oid indexOid[MAX_OID_LEN];
+ size_t len;
+ int result;
+
+ /*
+ * set up some nice defaults for the user
+ */
+ if (write_method)
+ *write_method = NULL;
+ if (var_len)
+ *var_len = sizeof(long);
+
+ for (nptr = datalist; nptr != NULL && found == NULL; nptr = nptr->next) {
+ if (vp) {
+ memcpy(indexOid, vp->name, vp->namelen * sizeof(oid));
+ memcpy(indexOid + vp->namelen, nptr->name,
+ nptr->namelen * sizeof(oid));
+ len = vp->namelen + nptr->namelen;
+ } else {
+ memcpy(indexOid, nptr->name, nptr->namelen * sizeof(oid));
+ len = nptr->namelen;
+ }
+ result = snmp_oid_compare(name, *length, indexOid, len);
+ DEBUGMSGTL(("header_complex", "Checking: "));
+ DEBUGMSGOID(("header_complex", indexOid, len));
+ DEBUGMSG(("header_complex", "\n"));
+
+ if (exact) {
+ if (result == 0) {
+ found = nptr;
+ }
+ } else {
+ if (result == 0) {
+ /*
+ * found an exact match. Need the next one for !exact
+ */
+ if (nptr->next)
+ found = nptr->next;
+ } else if (result == -1) {
+ found = nptr;
+ }
+ }
+ }
+ if (found) {
+ if (vp) {
+ memcpy(name, vp->name, vp->namelen * sizeof(oid));
+ memcpy(name + vp->namelen, found->name,
+ found->namelen * sizeof(oid));
+ *length = vp->namelen + found->namelen;
+ } else {
+ memcpy(name, found->name, found->namelen * sizeof(oid));
+ *length = found->namelen;
+ }
+ return found->data;
+ }
+
+ return NULL;
+}
+
+struct header_complex_index *
+header_complex_add_data(struct header_complex_index **thedata,
+ netsnmp_variable_list * var, void *data)
+{
+ oid newoid[MAX_OID_LEN];
+ size_t newoid_len;
+ struct header_complex_index *ret;
+
+ if (thedata == NULL || var == NULL || data == NULL)
+ return NULL;
+
+ header_complex_generate_oid(newoid, &newoid_len, NULL, 0, var);
+ ret =
+ header_complex_add_data_by_oid(thedata, newoid, newoid_len, data);
+ /*
+ * free the variable list, but not the enclosed data! it's not ours!
+ */
+ snmp_free_varbind(var);
+ return (ret);
+}
+
+struct header_complex_index *
+header_complex_add_data_by_oid(struct header_complex_index **thedata,
+ oid * newoid, size_t newoid_len, void *data)
+{
+ struct header_complex_index *hciptrn, *hciptrp, *ourself;
+ int rc;
+
+ if (thedata == NULL || newoid == NULL || data == NULL)
+ return NULL;
+
+ for (hciptrn = *thedata, hciptrp = NULL;
+ hciptrn != NULL; hciptrp = hciptrn, hciptrn = hciptrn->next) {
+ /*
+ * XXX: check for == and error (overlapping table entries)
+ * 8/2005 rks Ok, I added duplicate entry check, but only log
+ * warning and continue, because it seems that nobody
+ * that calls this fucntion does error checking!.
+ */
+ rc = snmp_oid_compare(hciptrn->name, hciptrn->namelen,
+ newoid, newoid_len);
+ if (rc > 0)
+ break;
+ else if (0 == rc) {
+ snmp_log(LOG_WARNING, "header_complex_add_data_by_oid with "
+ "duplicate index.\n");
+ /** uncomment null return when callers do error checking */
+ /** return NULL; */
+ }
+ }
+
+ /*
+ * nptr should now point to the spot that we need to add ourselves
+ * in front of, and pptr should be our new 'prev'.
+ */
+
+ /*
+ * create ourselves
+ */
+ ourself = (struct header_complex_index *)
+ SNMP_MALLOC_STRUCT(header_complex_index);
+
+ /*
+ * change our pointers
+ */
+ ourself->prev = hciptrp;
+ ourself->next = hciptrn;
+
+ if (ourself->next)
+ ourself->next->prev = ourself;
+
+ if (ourself->prev)
+ ourself->prev->next = ourself;
+
+ ourself->data = data;
+ ourself->name = snmp_duplicate_objid(newoid, newoid_len);
+ ourself->namelen = newoid_len;
+
+ /*
+ * rewind to the head of the list and return it (since the new head
+ * could be us, we need to notify the above routine who the head now is.
+ */
+ for (hciptrp = ourself; hciptrp->prev != NULL;
+ hciptrp = hciptrp->prev);
+
+ *thedata = hciptrp;
+ DEBUGMSGTL(("header_complex_add_data", "adding something...\n"));
+
+ return hciptrp;
+}
+
+/*
+ * extracts an entry from the storage space (removing it from future
+ * accesses) and returns the data stored there
+ *
+ * Modifies "thetop" pointer as needed (and if present) if were
+ * extracting the first node.
+ */
+
+void *
+header_complex_extract_entry(struct header_complex_index **thetop,
+ struct header_complex_index *thespot)
+{
+ struct header_complex_index *hciptrp, *hciptrn;
+ void *retdata;
+
+ if (thespot == NULL) {
+ DEBUGMSGTL(("header_complex_extract_entry",
+ "Null pointer asked to be extracted\n"));
+ return NULL;
+ }
+
+ retdata = thespot->data;
+
+ hciptrp = thespot->prev;
+ hciptrn = thespot->next;
+
+ if (hciptrp)
+ hciptrp->next = hciptrn;
+ else if (thetop)
+ *thetop = hciptrn;
+
+ if (hciptrn)
+ hciptrn->prev = hciptrp;
+
+ if (thespot->name)
+ free(thespot->name);
+
+ free(thespot);
+ return retdata;
+}
+
+/*
+ * wipe out a single entry
+ */
+void
+header_complex_free_entry(struct header_complex_index *theentry,
+ HeaderComplexCleaner * cleaner)
+{
+ void *data;
+ data = header_complex_extract_entry(NULL, theentry);
+ (*cleaner) (data);
+}
+
+/*
+ * completely wipe out all entries in our data store
+ */
+void
+header_complex_free_all(struct header_complex_index *thestuff,
+ HeaderComplexCleaner * cleaner)
+{
+ struct header_complex_index *hciptr, *hciptrn;
+
+ for (hciptr = thestuff; hciptr != NULL; hciptr = hciptrn) {
+ hciptrn = hciptr->next; /* need to extract this before deleting it */
+ header_complex_free_entry(hciptr, cleaner);
+ }
+}
+
+struct header_complex_index *
+header_complex_find_entry(struct header_complex_index *thestuff,
+ void *theentry)
+{
+ struct header_complex_index *hciptr;
+
+ for (hciptr = thestuff; hciptr != NULL && hciptr->data != theentry;
+ hciptr = hciptr->next);
+ return hciptr;
+}
+
+#ifdef TESTING
+
+void
+header_complex_dump(struct header_complex_index *thestuff)
+{
+ struct header_complex_index *hciptr;
+ oid oidsave[MAX_OID_LEN];
+ size_t len;
+
+ for (hciptr = thestuff; hciptr != NULL; hciptr = hciptr->next) {
+ DEBUGMSGTL(("header_complex_dump", "var: "));
+ header_complex_generate_oid(oidsave, &len, NULL, 0, hciptr->);
+ DEBUGMSGOID(("header_complex_dump", oidsave, len));
+ DEBUGMSG(("header_complex_dump", "\n"));
+ }
+}
+
+main()
+{
+ oid oidsave[MAX_OID_LEN];
+ int len = MAX_OID_LEN, len2;
+ netsnmp_variable_list *vars;
+ long ltmp = 4242, ltmp2 = 88, ltmp3 = 1, ltmp4 = 4200;
+ oid ourprefix[] = { 1, 2, 3, 4 };
+ oid testparse[] = { 4, 116, 101, 115, 116, 4200 };
+ int ret;
+
+ char *string = "wes", *string2 = "dawn", *string3 = "test";
+
+ struct header_complex_index *thestorage = NULL;
+
+ debug_register_tokens("header_complex");
+ snmp_set_do_debugging(1);
+
+ vars = NULL;
+ len2 = sizeof(ltmp);
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_INTEGER, (char *) &ltmp,
+ len2);
+ header_complex_add_data(&thestorage, vars, ourprefix);
+
+ vars = NULL;
+ len2 = strlen(string);
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, string, len2);
+ header_complex_add_data(&thestorage, vars, ourprefix);
+
+ vars = NULL;
+ len2 = sizeof(ltmp2);
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_INTEGER, (char *) &ltmp2,
+ len2);
+ header_complex_add_data(&thestorage, vars, ourprefix);
+
+ vars = NULL;
+ len2 = strlen(string2);
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, string2,
+ len2);
+ header_complex_add_data(&thestorage, vars, ourprefix);
+
+ vars = NULL;
+ len2 = sizeof(ltmp3);
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_INTEGER, (char *) &ltmp3,
+ len2);
+ header_complex_add_data(&thestorage, vars, ourprefix);
+
+ vars = NULL;
+ len2 = strlen(string3);
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, string3,
+ len2);
+ len2 = sizeof(ltmp4);
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_INTEGER, (char *) &ltmp4,
+ len2);
+ header_complex_add_data(&thestorage, vars, ourprefix);
+
+ header_complex_dump(thestorage);
+
+ vars = NULL;
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_OCTET_STR, NULL, 0);
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_INTEGER, NULL, 0);
+ ret =
+ header_complex_parse_oid(testparse,
+ sizeof(testparse) / sizeof(oid), vars);
+ DEBUGMSGTL(("header_complex_test", "parse returned %d...\n", ret));
+
+}
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/header_complex.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/header_complex.h
new file mode 100644
index 0000000000..2028ceed82
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/header_complex.h
@@ -0,0 +1,72 @@
+/*
+ * header_complex.h: More complex storage and data sorting for mib modules
+ */
+#ifndef _MIBGROUP_HEADER_COMPLEX_H
+#define _MIBGROUP_HEADER_COMPLEX_H
+
+struct header_complex_index {
+ oid *name;
+ size_t namelen;
+ void *data;
+ struct header_complex_index *next;
+ struct header_complex_index *prev;
+};
+
+/*
+ * Function pointer called by the header_comlpex functions when a client pointer (void * to us) needs to be cleaned.
+ */
+
+typedef void (HeaderComplexCleaner) (void *);
+void *header_complex(struct header_complex_index *datalist,
+ struct variable *vp, oid * name,
+ size_t * length, int exact,
+ size_t * var_len,
+ WriteMethod ** write_method);
+
+int header_complex_generate_varoid(netsnmp_variable_list *
+ var);
+int header_complex_parse_oid(oid * oidIndex, size_t oidLen,
+ netsnmp_variable_list * data);
+void header_complex_generate_oid(oid * name, size_t * length,
+ oid * prefix,
+ size_t prefix_len,
+ netsnmp_variable_list * data);
+void header_complex_free_all(struct header_complex_index
+ *thestuff,
+ HeaderComplexCleaner * cleaner);
+void header_complex_free_entry(struct header_complex_index
+ *theentry,
+ HeaderComplexCleaner * cleaner);
+void *header_complex_extract_entry(struct header_complex_index
+ **thetop,
+ struct header_complex_index
+ *thespot);
+struct header_complex_index *header_complex_find_entry(struct
+ header_complex_index
+ *thestuff,
+ void *entry);
+
+void *header_complex_get(struct header_complex_index *datalist,
+ netsnmp_variable_list * index);
+void *header_complex_get_from_oid(struct header_complex_index
+ *datalist, oid * searchfor,
+ size_t searchfdor_len);
+
+struct header_complex_index *header_complex_add_data(struct
+ header_complex_index
+ **thedata,
+ netsnmp_variable_list
+ * var, void *data);
+
+/*
+ * Note: newoid is copied/cloned for you
+ */
+struct header_complex_index *header_complex_add_data_by_oid(struct
+ header_complex_index
+ **thedata,
+ oid * newoid,
+ size_t
+ newoid_len,
+ void *data);
+
+#endif /* _MIBGROUP_HEADER_COMPLEX_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/host.h
new file mode 100644
index 0000000000..4b7870686f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host.h
@@ -0,0 +1,85 @@
+/*
+ * Host Resources 'wrapper' interface
+ * calls the per-group interfaces from 'hr_*.h'
+ */
+
+ config_require(host/hr_system)
+ config_require(host/hr_storage)
+ config_require(host/hr_device)
+ config_require(host/hr_other)
+ config_require(host/hr_proc)
+ config_require(host/hr_network)
+ config_require(host/hr_print)
+ config_require(host/hr_disk)
+ config_require(host/hr_partition)
+ config_require(host/hr_filesys)
+ config_require(host/hr_swrun)
+ config_require(host/hr_swinst)
+
+/* add the host resources mib to the default mibs to load */
+config_add_mib(HOST-RESOURCES-MIB)
+config_add_mib(HOST-RESOURCES-TYPES)
+
+/*********************************************
+ *
+ * A few words about the design of the Host Resources
+ * implementation - particularly as regards the hrDevice
+ * group and hrDeviceIndex. This (and hrStorageIndex) make
+ * use of the non-consecutive nature of SNMP instance identifiers.
+ *
+ * hrDeviceIndex is structured in a 'major/minor' form,
+ * with the high end indicating the type of device
+ * (following the enumerations of hrDeviceType) and the low
+ * end being used to differentiate between devices of that type.
+ *
+ * The implementation of walking through the available devices
+ * uses a pair of arrays of functions - indexed by hrDeviceType
+ * These are used to perform any initialisation needed for that
+ * type of device, and to step through the instances of that type.
+ * This latter 'get_next' routing returns the hrDeviceIndex (including
+ * the hrDeviceType major number), or -1 if there are no further
+ * instances of that type.
+ * When all devices of a particular type have been processed, the
+ * initialisation function for the next device type is called,
+ * and so on until all devices have been proceesed.
+ *
+ * Similar arrays are used to provide type-specific functions to
+ * return the "common" device information (description, ID, status
+ * and error count), and to save any internal structures needed
+ * to provide these.
+ * A final array is used to indicate whether hrDeviceIndexes are
+ * returned in a random order, or strictly increasing. In the
+ * latter case, this allows the search for a particular index to
+ * terminate as soon as the 'next' device is reached, without needing
+ * to check the rest of them. Similarly, once a particular type of
+ * device has been scanned, further types will not be examined unless
+ * a suitable index has not yet been found.
+ *
+ * The index used for hrFSIndex is also used as hrStorageIndex,
+ * for those storage areas corresponding to filestore.
+ * Additional storage areas (such as memory or swap space) are
+ * distinguished by index values greater than a defined constant.
+ * Currently these are individually defined entries, but other
+ * ranges could be implemented similarly.
+ * If hrFSIndex was re-implemented to reflect internal identifiers,
+ * it would be possible to reverse the sense of the current
+ * implementation, with non-filestore storage having indices
+ * less than a defined constant, rather than greater.
+ *
+ *
+ * Much of the detailed implementation of this group (as opposed to
+ * the implementation infrastructure outlined about) is likely to
+ * be very system-specific.
+ * The initial implementation (for HP-UX 9 and Linux) should be
+ * regarded as a 'proof of concept' example, rather than as
+ * finished, releasable code. This particularly hold for the
+ * disk device discovery code, which is gross in the extreme,
+ * and should never have seen the light of day!
+ * Hopefully this can be ripped out and given a quiet burial as
+ * soon as is decently possible.
+ *
+ * Now it's up to the rest of you to hammer this into some sort of
+ * sensible shape.
+ * Dave Shield
+ *
+ *********************************************/
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_device.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_device.c
new file mode 100644
index 0000000000..86db54ad39
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_device.c
@@ -0,0 +1,350 @@
+/*
+ * Host Resources MIB - Device group implementation - hr_device.c
+ *
+ */
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include "host_res.h"
+#include "hr_device.h"
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+int Get_Next_Device(void);
+
+PFV init_device[HRDEV_TYPE_MAX];
+PFIV next_device[HRDEV_TYPE_MAX];
+PFV save_device[HRDEV_TYPE_MAX];
+int dev_idx_inc[HRDEV_TYPE_MAX];
+
+PFS device_descr[HRDEV_TYPE_MAX];
+PFO device_prodid[HRDEV_TYPE_MAX];
+PFI device_status[HRDEV_TYPE_MAX];
+PFI device_errors[HRDEV_TYPE_MAX];
+
+int current_type;
+
+void Init_Device(void);
+int header_hrdevice(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+
+#define HRDEV_INDEX 1
+#define HRDEV_TYPE 2
+#define HRDEV_DESCR 3
+#define HRDEV_ID 4
+#define HRDEV_STATUS 5
+#define HRDEV_ERRORS 6
+
+struct variable4 hrdevice_variables[] = {
+ {HRDEV_INDEX, ASN_INTEGER, RONLY, var_hrdevice, 2, {1, 1}},
+ {HRDEV_TYPE, ASN_OBJECT_ID, RONLY, var_hrdevice, 2, {1, 2}},
+ {HRDEV_DESCR, ASN_OCTET_STR, RONLY, var_hrdevice, 2, {1, 3}},
+ {HRDEV_ID, ASN_OBJECT_ID, RONLY, var_hrdevice, 2, {1, 4}},
+ {HRDEV_STATUS, ASN_INTEGER, RONLY, var_hrdevice, 2, {1, 5}},
+ {HRDEV_ERRORS, ASN_COUNTER, RONLY, var_hrdevice, 2, {1, 6}}
+};
+oid hrdevice_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 3, 2 };
+
+
+void
+init_hr_device(void)
+{
+ int i;
+
+ /*
+ * Initially assume no devices
+ * Insert pointers to initialisation/get_next routines
+ * for particular device types as they are implemented
+ * (set up in the appropriate 'init_*()' routine )
+ */
+
+ for (i = 0; i < HRDEV_TYPE_MAX; ++i) {
+ init_device[i] = NULL;
+ next_device[i] = NULL;
+ save_device[i] = NULL;
+ dev_idx_inc[i] = 0; /* Assume random indices */
+
+ device_descr[i] = NULL;
+ device_prodid[i] = NULL;
+ device_status[i] = NULL;
+ device_errors[i] = NULL;
+ }
+
+ REGISTER_MIB("host/hr_device", hrdevice_variables, variable4,
+ hrdevice_variables_oid);
+}
+
+
+/*
+ * header_hrdevice(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+
+int
+header_hrdevice(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRDEV_ENTRY_NAME_LENGTH 11
+ oid newname[MAX_OID_LEN];
+ int dev_idx, LowIndex = -1, LowType = -1;
+ int result;
+
+ DEBUGMSGTL(("host/hr_device", "var_hrdevice: "));
+ DEBUGMSGOID(("host/hr_device", name, *length));
+ DEBUGMSG(("host/hr_device", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+
+
+ /*
+ * Find the "next" device entry.
+ * If we're in the middle of the table, then there's
+ * no point in examining earlier types of devices,
+ * so set the starting type to that of the variable
+ * being queried.
+ * If we've moved from one column of the table to another,
+ * then we need to start at the beginning again.
+ * (i.e. the 'compare' fails to match)
+ * Similarly if we're at the start of the table
+ * (i.e. *length is too short to be a full instance)
+ */
+
+ if ((snmp_oid_compare(vp->name, vp->namelen, name, vp->namelen) == 0)
+ && (*length > HRDEV_ENTRY_NAME_LENGTH))
+ current_type = (name[HRDEV_ENTRY_NAME_LENGTH] >> HRDEV_TYPE_SHIFT);
+ else
+ current_type = 0;
+
+ Init_Device();
+ for (;;) {
+ dev_idx = Get_Next_Device();
+ DEBUGMSG(("host/hr_device", "(index %d ....", dev_idx));
+ if (dev_idx == -1)
+ break;
+ if (LowType != -1 && LowType < (dev_idx >> HRDEV_TYPE_SHIFT))
+ break;
+ newname[HRDEV_ENTRY_NAME_LENGTH] = dev_idx;
+ DEBUGMSGOID(("host/hr_device", newname, *length));
+ DEBUGMSG(("host/hr_device", "\n"));
+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+ if (exact && (result == 0)) {
+ if (save_device[current_type] != NULL)
+ (*save_device[current_type]) ();
+ LowIndex = dev_idx;
+ break;
+ }
+ if ((!exact && (result < 0)) &&
+ (LowIndex == -1 || dev_idx < LowIndex)) {
+ if (save_device[current_type] != NULL)
+ (*save_device[current_type]) ();
+ LowIndex = dev_idx;
+ LowType = (dev_idx >> HRDEV_TYPE_SHIFT);
+ if (dev_idx_inc[LowType]) /* Increasing indices => now done */
+ break;
+ }
+
+ }
+
+ if (LowIndex == -1) {
+ DEBUGMSGTL(("host/hr_device", "... index out of range\n"));
+ return (MATCH_FAILED);
+ }
+
+ newname[HRDEV_ENTRY_NAME_LENGTH] = LowIndex;
+ memcpy((char *) name, (char *) newname,
+ ((int) vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+ DEBUGMSGTL(("host/hr_device", "... get device stats "));
+ DEBUGMSGOID(("host/hr_device", name, *length));
+ DEBUGMSG(("host/hr_device", "\n"));
+
+ return LowIndex;
+}
+
+
+oid device_type_id[] = { 1, 3, 6, 1, 2, 1, 25, 3, 1, 99 }; /* hrDeviceType99 */
+int device_type_len =
+ sizeof(device_type_id) / sizeof(device_type_id[0]);
+
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+
+u_char *
+var_hrdevice(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ int dev_idx, type;
+ oid *oid_p;
+ const char *tmp_str;
+ static char string[1024];
+
+really_try_next:
+ dev_idx =
+ header_hrdevice(vp, name, length, exact, var_len, write_method);
+ if (dev_idx == MATCH_FAILED)
+ return NULL;
+
+ type = (dev_idx >> HRDEV_TYPE_SHIFT);
+
+ switch (vp->magic) {
+ case HRDEV_INDEX:
+ long_return = dev_idx;
+ return (u_char *) & long_return;
+ case HRDEV_TYPE:
+ device_type_id[device_type_len - 1] = type;
+ *var_len = sizeof(device_type_id);
+ return (u_char *) device_type_id;
+ case HRDEV_DESCR:
+ if ((device_descr[type] != NULL) &&
+ (NULL!=(tmp_str=((*device_descr[type])(dev_idx))))) {
+ strncpy(string, tmp_str, sizeof(string)-1);
+ string[ sizeof(string)-1] = 0;
+ } else
+#if NETSNMP_NO_DUMMY_VALUES
+ goto try_next;
+#else
+ sprintf(string, "a black box of some sort");
+#endif
+ *var_len = strlen(string);
+ return (u_char *) string;
+ case HRDEV_ID:
+ if (device_prodid[type] != NULL)
+ oid_p = ((*device_prodid[type]) (dev_idx, var_len));
+ else {
+ oid_p = nullOid;
+ *var_len = nullOidLen;
+ }
+ return (u_char *) oid_p;
+ case HRDEV_STATUS:
+ if (device_status[type] != NULL)
+ long_return = ((*device_status[type]) (dev_idx));
+ else
+#if NETSNMP_NO_DUMMY_VALUES
+ goto try_next;
+#else
+ long_return = 2; /* Assume running */
+#endif
+ if ( !long_return )
+ goto try_next;
+ return (u_char *) & long_return;
+ case HRDEV_ERRORS:
+ if (device_errors[type] != NULL)
+ long_return = (*device_errors[type]) (dev_idx);
+ else
+#if NETSNMP_NO_DUMMY_VALUES
+ goto try_next;
+#else
+ long_return = 0; /* Assume OK */
+#endif
+ return (u_char *) & long_return;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrdevice\n",
+ vp->magic));
+ }
+
+ try_next:
+ if (!exact)
+ goto really_try_next;
+
+ return NULL;
+}
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+
+void
+Init_Device(void)
+{
+ /*
+ * Find the first non-NULL initialisation function
+ * and call it
+ */
+ while (current_type < HRDEV_TYPE_MAX &&
+ init_device[current_type] == NULL)
+ if (++current_type >= HRDEV_TYPE_MAX)
+ return;
+ /* Check current_type, if >= MAX first time into loop, would fail below */
+ if (current_type < HRDEV_TYPE_MAX)
+ (*init_device[current_type]) ();
+}
+
+int
+Get_Next_Device(void)
+{
+ int result = -1;
+
+ /*
+ * Call the 'next device' function for the current
+ * type of device
+ *
+ * TODO: save the necessary information about that device
+ */
+ if (current_type < HRDEV_TYPE_MAX && next_device[current_type] != NULL)
+ result = (*next_device[current_type]) ();
+
+ /*
+ * No more devices of the current type.
+ * Try the next type (if any)
+ */
+ if (result == -1) {
+ if (++current_type >= HRDEV_TYPE_MAX) {
+ current_type = 0;
+ return -1;
+ }
+ Init_Device();
+ return Get_Next_Device();
+ }
+ return result;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_device.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_device.h
new file mode 100644
index 0000000000..0e29489a9d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_device.h
@@ -0,0 +1,11 @@
+/*
+ * Host Resources MIB - device group interface - hr_device.h
+ *
+ */
+#ifndef _MIBGROUP_HRDEVICE_H
+#define _MIBGROUP_HRDEVICE_H
+
+extern void init_hr_device(void);
+extern FindVarMethod var_hrdevice;
+
+#endif /* _MIBGROUP_HRDEVICE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_disk.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_disk.c
new file mode 100644
index 0000000000..e4c5b9595f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_disk.c
@@ -0,0 +1,1024 @@
+/*
+ * Host Resources MIB - disk device group implementation - hr_disk.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include "host_res.h"
+#include "hr_disk.h"
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <fcntl.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_KVM_H
+#include <kvm.h>
+#endif
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#else
+# define dirent direct
+# if HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+
+#if HAVE_SYS_DKIO_H
+#include <sys/dkio.h>
+#endif
+#if HAVE_SYS_DISKIO_H /* HP-UX only ? */
+#include <sys/diskio.h>
+#endif
+#if HAVE_LINUX_HDREG_H
+#include <linux/hdreg.h>
+#endif
+#if HAVE_SYS_DISKLABEL_H
+#define DKTYPENAMES
+#include <sys/disklabel.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#ifdef linux
+/*
+ * define BLKGETSIZE from <linux/fs.h>:
+ * Note: cannot include this file completely due to errors with redefinition
+ * of structures (at least with older linux versions) --jsf
+ */
+#define BLKGETSIZE _IO(0x12,96) /* return device size */
+#endif
+
+#include <net-snmp/agent/agent_read_config.h>
+#include <net-snmp/library/read_config.h>
+
+#define HRD_MONOTONICALLY_INCREASING
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+void Init_HR_Disk(void);
+int Get_Next_HR_Disk(void);
+int Get_Next_HR_Disk_Partition(char *, size_t, int);
+static void Add_HR_Disk_entry(const char *, int, int, int, int,
+ const char *, int, int);
+static void Save_HR_Disk_General(void);
+static void Save_HR_Disk_Specific(void);
+static int Query_Disk(int, const char *);
+static int Is_It_Writeable(void);
+static int What_Type_Disk(void);
+static int Is_It_Removeable(void);
+static const char *describe_disk(int);
+
+int header_hrdisk(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+
+static int HRD_type_index;
+static int HRD_index;
+static char HRD_savedModel[40];
+static long HRD_savedCapacity = 1044;
+static int HRD_savedFlags;
+static time_t HRD_history[HRDEV_TYPE_MASK + 1];
+
+#ifdef DIOC_DESCRIBE
+static disk_describe_type HRD_info;
+static capacity_type HRD_cap;
+
+static int HRD_savedIntf_type;
+static int HRD_savedDev_type;
+#endif
+
+#ifdef DKIOCINFO
+static struct dk_cinfo HRD_info;
+static struct dk_geom HRD_cap;
+
+static int HRD_savedCtrl_type;
+#endif
+
+#ifdef HAVE_LINUX_HDREG_H
+static struct hd_driveid HRD_info;
+#endif
+
+#ifdef DIOCGDINFO
+static struct disklabel HRD_info;
+#endif
+
+static void parse_disk_config(const char *, char *);
+static void free_disk_config(void);
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+
+#define HRDISK_ACCESS 1
+#define HRDISK_MEDIA 2
+#define HRDISK_REMOVEABLE 3
+#define HRDISK_CAPACITY 4
+
+struct variable4 hrdisk_variables[] = {
+ {HRDISK_ACCESS, ASN_INTEGER, RONLY, var_hrdisk, 2, {1, 1}},
+ {HRDISK_MEDIA, ASN_INTEGER, RONLY, var_hrdisk, 2, {1, 2}},
+ {HRDISK_REMOVEABLE, ASN_INTEGER, RONLY, var_hrdisk, 2, {1, 3}},
+ {HRDISK_CAPACITY, ASN_INTEGER, RONLY, var_hrdisk, 2, {1, 4}}
+};
+oid hrdisk_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 3, 6 };
+
+
+void
+init_hr_disk(void)
+{
+ int i;
+
+ init_device[HRDEV_DISK] = Init_HR_Disk;
+ next_device[HRDEV_DISK] = Get_Next_HR_Disk;
+ save_device[HRDEV_DISK] = Save_HR_Disk_General;
+#ifdef HRD_MONOTONICALLY_INCREASING
+ dev_idx_inc[HRDEV_DISK] = 1;
+#endif
+
+#if defined(linux)
+ Add_HR_Disk_entry("/dev/hd%c%d", -1, -1, 'a', 'l', "/dev/hd%c", 1, 15);
+ Add_HR_Disk_entry("/dev/sd%c%d", -1, -1, 'a', 'p', "/dev/sd%c", 1, 15);
+ Add_HR_Disk_entry("/dev/md%d", -1, -1, 0, 3, "/dev/md%d", 0, 0);
+ Add_HR_Disk_entry("/dev/fd%d", -1, -1, 0, 1, "/dev/fd%d", 0, 0);
+#elif defined(hpux)
+#if defined(hpux10) || defined(hpux11)
+ Add_HR_Disk_entry("/dev/rdsk/c%dt%xd%d", 0, 1, 0, 15,
+ "/dev/rdsk/c%dt%xd0", 0, 4);
+#else /* hpux9 */
+ Add_HR_Disk_entry("/dev/rdsk/c%dd%xs%d", 201, 201, 0, 15,
+ "/dev/rdsk/c%dd%xs0", 0, 4);
+#endif
+#elif defined(solaris2)
+ Add_HR_Disk_entry("/dev/rdsk/c%dt%dd0s%d", 0, 7, 0, 15,
+ "/dev/rdsk/c%dt%dd0s0", 0, 7);
+ Add_HR_Disk_entry("/dev/rdsk/c%dd%ds%d", 0, 7, 0, 15,
+ "/dev/rdsk/c%dd%ds0", 0, 7);
+#elif defined(freebsd4) || defined(freebsd5)
+ Add_HR_Disk_entry("/dev/ad%ds%d%c", 0, 1, 1, 4, "/dev/ad%ds%d", 'a', 'h');
+ Add_HR_Disk_entry("/dev/da%ds%d%c", 0, 1, 1, 4, "/dev/da%ds%d", 'a', 'h');
+#elif defined(freebsd3)
+ Add_HR_Disk_entry("/dev/wd%ds%d%c", 0, 1, 1, 4, "/dev/wd%ds%d", 'a',
+ 'h');
+ Add_HR_Disk_entry("/dev/sd%ds%d%c", 0, 1, 1, 4, "/dev/sd%ds%d", 'a',
+ 'h');
+#elif defined(freebsd2)
+ Add_HR_Disk_entry("/dev/wd%d%c", -1, -1, 0, 3, "/dev/wd%d", 'a', 'h');
+ Add_HR_Disk_entry("/dev/sd%d%c", -1, -1, 0, 3, "/dev/sd%d", 'a', 'h');
+#elif defined(netbsd1)
+ Add_HR_Disk_entry("/dev/wd%d%c", -1, -1, 0, 3, "/dev/wd%dc", 'a', 'h');
+ Add_HR_Disk_entry("/dev/sd%d%c", -1, -1, 0, 3, "/dev/sd%dc", 'a', 'h');
+#endif
+
+ device_descr[HRDEV_DISK] = describe_disk;
+ HRD_savedModel[0] = '\0';
+ HRD_savedCapacity = 0;
+
+ for (i = 0; i < HRDEV_TYPE_MASK; ++i)
+ HRD_history[i] = -1;
+
+ REGISTER_MIB("host/hr_disk", hrdisk_variables, variable4,
+ hrdisk_variables_oid);
+
+ snmpd_register_config_handler("ignoredisk", parse_disk_config,
+ free_disk_config, "name");
+}
+
+#define ITEM_STRING 1
+#define ITEM_SET 2
+#define ITEM_STAR 3
+#define ITEM_ANY 4
+
+typedef unsigned char details_set[32];
+
+typedef struct _conf_disk_item {
+ int item_type; /* ITEM_STRING, ITEM_SET, ITEM_STAR, ITEM_ANY */
+ void *item_details; /* content depends upon item_type */
+ struct _conf_disk_item *item_next;
+} conf_disk_item;
+
+typedef struct _conf_disk_list {
+ conf_disk_item *list_item;
+ struct _conf_disk_list *list_next;
+} conf_disk_list;
+static conf_disk_list *conf_list = NULL;
+
+static int match_disk_config(const char *);
+static int match_disk_config_item(const char *, conf_disk_item *);
+
+static void
+parse_disk_config(const char *token, char *cptr)
+{
+ conf_disk_list *d_new = 0;
+ conf_disk_item *di_curr = 0;
+ details_set *d_set = 0;
+ char *name = 0, *p = 0, *d_str = 0, c;
+ unsigned int i, neg, c1, c2;
+ char *st = 0;
+
+ name = strtok_r(cptr, " \t", &st);
+ if (!name) {
+ config_perror("Missing NAME parameter");
+ return;
+ }
+ d_new = (conf_disk_list *) malloc(sizeof(conf_disk_list));
+ if (!d_new) {
+ config_perror("Out of memory");
+ return;
+ }
+ di_curr = (conf_disk_item *) malloc(sizeof(conf_disk_item));
+ if (!di_curr) {
+ SNMP_FREE(d_new);
+ config_perror("Out of memory");
+ return;
+ }
+ d_new->list_item = di_curr;
+ /* XXX: on error/return conditions we need to free the entire new
+ list, not just the last node like this is doing! */
+ for (;;) {
+ if (*name == '?') {
+ di_curr->item_type = ITEM_ANY;
+ di_curr->item_details = (void *) 0;
+ name++;
+ } else if (*name == '*') {
+ di_curr->item_type = ITEM_STAR;
+ di_curr->item_details = (void *) 0;
+ name++;
+ } else if (*name == '[') {
+ d_set = (details_set *) malloc(sizeof(details_set));
+ if (!d_set) {
+ config_perror("Out of memory");
+ SNMP_FREE(d_new);
+ SNMP_FREE(di_curr);
+ SNMP_FREE(d_set);
+ SNMP_FREE(d_str);
+ return;
+ }
+ for (i = 0; i < sizeof(details_set); i++)
+ (*d_set)[i] = (unsigned char) 0;
+ name++;
+ if (*name == '^' || *name == '!') {
+ neg = 1;
+ name++;
+ } else {
+ neg = 0;
+ }
+ while (*name && *name != ']') {
+ c1 = ((unsigned int) *name++) & 0xff;
+ if (*name == '-' && *(name + 1) != ']') {
+ name++;
+ c2 = ((unsigned int) *name++) & 0xff;
+ } else {
+ c2 = c1;
+ }
+ for (i = c1; i <= c2; i++)
+ (*d_set)[i / 8] |= (unsigned char) (1 << (i % 8));
+ }
+ if (*name != ']') {
+ config_perror
+ ("Syntax error in NAME: invalid set specified");
+ SNMP_FREE(d_new);
+ SNMP_FREE(di_curr);
+ SNMP_FREE(d_set);
+ SNMP_FREE(d_str);
+ return;
+ }
+ if (neg) {
+ for (i = 0; i < sizeof(details_set); i++)
+ (*d_set)[i] = (*d_set)[i] ^ (unsigned char) 0xff;
+ }
+ di_curr->item_type = ITEM_SET;
+ di_curr->item_details = (void *) d_set;
+ name++;
+ } else {
+ for (p = name;
+ *p != '\0' && *p != '?' && *p != '*' && *p != '['; p++);
+ c = *p;
+ *p = '\0';
+ d_str = (char *) malloc(strlen(name) + 1);
+ if (!d_str) {
+ SNMP_FREE(d_new);
+ SNMP_FREE(d_str);
+ SNMP_FREE(di_curr);
+ SNMP_FREE(d_set);
+ config_perror("Out of memory");
+ return;
+ }
+ strcpy(d_str, name);
+ *p = c;
+ di_curr->item_type = ITEM_STRING;
+ di_curr->item_details = (void *) d_str;
+ name = p;
+ }
+ if (!*name) {
+ di_curr->item_next = (conf_disk_item *) 0;
+ break;
+ }
+ di_curr->item_next =
+ (conf_disk_item *) malloc(sizeof(conf_disk_item));
+ if (!di_curr->item_next) {
+ SNMP_FREE(di_curr->item_next);
+ SNMP_FREE(d_new);
+ SNMP_FREE(di_curr);
+ SNMP_FREE(d_set);
+ SNMP_FREE(d_str);
+ config_perror("Out of memory");
+ return;
+ }
+ di_curr = di_curr->item_next;
+ }
+ d_new->list_next = conf_list;
+ conf_list = d_new;
+}
+
+static void
+free_disk_config(void)
+{
+ conf_disk_list *d_ptr = conf_list, *d_next;
+ conf_disk_item *di_ptr, *di_next;
+
+ while (d_ptr) {
+ d_next = d_ptr->list_next;
+ di_ptr = d_ptr->list_item;
+ while (di_ptr) {
+ di_next = di_ptr->item_next;
+ if (di_ptr->item_details)
+ free(di_ptr->item_details);
+ free((void *) di_ptr);
+ di_ptr = di_next;
+ }
+ free((void *) d_ptr);
+ d_ptr = d_next;
+ }
+ conf_list = (conf_disk_list *) 0;
+}
+
+static int
+match_disk_config_item(const char *name, conf_disk_item * di_ptr)
+{
+ int result = 0;
+ size_t len;
+ details_set *d_set;
+ unsigned int c;
+
+ if (di_ptr) {
+ switch (di_ptr->item_type) {
+ case ITEM_STRING:
+ len = strlen((const char *) di_ptr->item_details);
+ if (!strncmp(name, (const char *) di_ptr->item_details, len))
+ result = match_disk_config_item(name + len,
+ di_ptr->item_next);
+ break;
+ case ITEM_SET:
+ if (*name) {
+ d_set = (details_set *) di_ptr->item_details;
+ c = ((unsigned int) *name) & 0xff;
+ if ((*d_set)[c / 8] & (unsigned char) (1 << (c % 8)))
+ result = match_disk_config_item(name + 1,
+ di_ptr->item_next);
+ }
+ break;
+ case ITEM_STAR:
+ if (di_ptr->item_next) {
+ for (; !result && *name; name++)
+ result = match_disk_config_item(name,
+ di_ptr->item_next);
+ } else {
+ result = 1;
+ }
+ break;
+ case ITEM_ANY:
+ if (*name)
+ result = match_disk_config_item(name + 1,
+ di_ptr->item_next);
+ break;
+ }
+ } else {
+ if (*name == '\0')
+ result = 1;
+ }
+
+ return result;
+}
+
+static int
+match_disk_config(const char *name)
+{
+ conf_disk_list *d_ptr = conf_list;
+
+ while (d_ptr) {
+ if (match_disk_config_item(name, d_ptr->list_item))
+ return 1; /* match found in ignorelist */
+ d_ptr = d_ptr->list_next;
+ }
+
+ /*
+ * no match in ignorelist
+ */
+ return 0;
+}
+
+/*
+ * header_hrdisk(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ */
+
+int
+header_hrdisk(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRDISK_ENTRY_NAME_LENGTH 11
+ oid newname[MAX_OID_LEN];
+ int disk_idx, LowIndex = -1;
+ int result;
+
+ DEBUGMSGTL(("host/hr_disk", "var_hrdisk: "));
+ DEBUGMSGOID(("host/hr_disk", name, *length));
+ DEBUGMSG(("host/hr_disk", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+ /*
+ * Find "next" disk entry
+ */
+
+ Init_HR_Disk();
+ for (;;) {
+ disk_idx = Get_Next_HR_Disk();
+ if (disk_idx == -1)
+ break;
+ newname[HRDISK_ENTRY_NAME_LENGTH] = disk_idx;
+ result =
+ snmp_oid_compare(name, *length, newname,
+ (int) vp->namelen + 1);
+ if (exact && (result == 0)) {
+ LowIndex = disk_idx;
+ Save_HR_Disk_Specific();
+ break;
+ }
+ if ((!exact && (result < 0)) &&
+ (LowIndex == -1 || disk_idx < LowIndex)) {
+ LowIndex = disk_idx;
+ Save_HR_Disk_Specific();
+#ifdef HRD_MONOTONICALLY_INCREASING
+ break;
+#endif
+ }
+ }
+
+ if (LowIndex == -1) {
+ DEBUGMSGTL(("host/hr_disk", "... index out of range\n"));
+ return (MATCH_FAILED);
+ }
+
+ newname[HRDISK_ENTRY_NAME_LENGTH] = LowIndex;
+ memcpy((char *) name, (char *) newname,
+ ((int) vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+ DEBUGMSGTL(("host/hr_disk", "... get disk stats "));
+ DEBUGMSGOID(("host/hr_disk", name, *length));
+ DEBUGMSG(("host/hr_disk", "\n"));
+
+ return LowIndex;
+}
+
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+
+u_char *
+var_hrdisk(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ int disk_idx;
+
+ disk_idx =
+ header_hrdisk(vp, name, length, exact, var_len, write_method);
+ if (disk_idx == MATCH_FAILED)
+ return NULL;
+
+
+ switch (vp->magic) {
+ case HRDISK_ACCESS:
+ long_return = Is_It_Writeable();
+ return (u_char *) & long_return;
+ case HRDISK_MEDIA:
+ long_return = What_Type_Disk();
+ return (u_char *) & long_return;
+ case HRDISK_REMOVEABLE:
+ long_return = Is_It_Removeable();
+ return (u_char *) & long_return;
+ case HRDISK_CAPACITY:
+ long_return = HRD_savedCapacity;
+ return (u_char *) & long_return;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrdisk\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+#define MAX_NUMBER_DISK_TYPES 16 /* probably should be a variable */
+#define MAX_DISKS_PER_TYPE 15 /* SCSI disks - not a hard limit */
+#define HRDISK_TYPE_SHIFT 4 /* log2 (MAX_DISKS_PER_TYPE+1) */
+
+typedef struct {
+ const char *disk_devpart_string; /* printf() format disk part. name */
+ short disk_controller; /* controller id or -1 if NA */
+ short disk_device_first; /* first device id */
+ short disk_device_last; /* last device id */
+ const char *disk_devfull_string; /* printf() format full disk name */
+ short disk_partition_first; /* first partition id */
+ short disk_partition_last; /* last partition id */
+} HRD_disk_t;
+
+static HRD_disk_t disk_devices[MAX_NUMBER_DISK_TYPES];
+static int HR_number_disk_types = 0;
+
+static void
+Add_HR_Disk_entry(const char *devpart_string,
+ int first_ctl,
+ int last_ctl,
+ int first_dev,
+ int last_dev,
+ const char *devfull_string,
+ int first_partn, int last_partn)
+{
+ int lodev, hidev, nbr_created = 0;
+
+ while (first_ctl <= last_ctl) {
+ for (lodev = first_dev;
+ lodev < last_dev && MAX_NUMBER_DISK_TYPES > HR_number_disk_types;
+ lodev += (1+MAX_DISKS_PER_TYPE), HR_number_disk_types++)
+ {
+ nbr_created++;
+ /*
+ * Split long runs of disks into separate "types"
+ */
+ hidev = lodev + MAX_DISKS_PER_TYPE;
+ if (last_dev < hidev)
+ hidev = last_dev;
+ disk_devices[HR_number_disk_types].disk_devpart_string =
+ devpart_string;
+ disk_devices[HR_number_disk_types].disk_controller = first_ctl;
+ disk_devices[HR_number_disk_types].disk_device_first = lodev;
+ disk_devices[HR_number_disk_types].disk_device_last = hidev;
+ disk_devices[HR_number_disk_types].disk_devfull_string =
+ devfull_string;
+ disk_devices[HR_number_disk_types].disk_partition_first =
+ first_partn;
+ disk_devices[HR_number_disk_types].disk_partition_last =
+ last_partn;
+#if DEBUG_TEST
+ DEBUGMSGTL(("host/hr_disk",
+ "Add_HR %02d '%s' first=%d last=%d\n",
+ HR_number_disk_types, devpart_string, lodev, hidev));
+#endif
+ }
+ first_ctl++;
+ }
+
+ if (nbr_created == 0 || MAX_NUMBER_DISK_TYPES < HR_number_disk_types) {
+ HR_number_disk_types = MAX_NUMBER_DISK_TYPES;
+ DEBUGMSGTL(("host/hr_disk",
+ "WARNING! Add_HR_Disk_entry '%s' incomplete, %d created\n",
+ devpart_string, nbr_created));
+ }
+#if DEBUG_TEST
+ else
+ DEBUGMSGTL(("host/hr_disk",
+ "Add_HR_Disk_entry '%s' completed, %d created\n",
+ devpart_string, nbr_created));
+#endif
+}
+
+void
+Init_HR_Disk(void)
+{
+ HRD_type_index = 0;
+ HRD_index = -1;
+ DEBUGMSGTL(("host/hr_disk", "Init_Disk\n"));
+}
+
+int
+Get_Next_HR_Disk(void)
+{
+ char string[1024];
+ int fd, result;
+ int iindex;
+ int max_disks;
+ time_t now;
+
+ HRD_index++;
+ (void *) time(&now);
+ DEBUGMSGTL(("host/hr_disk", "Next_Disk type %d of %d\n",
+ HRD_type_index, HR_number_disk_types));
+ while (HRD_type_index < HR_number_disk_types) {
+ max_disks = disk_devices[HRD_type_index].disk_device_last -
+ disk_devices[HRD_type_index].disk_device_first + 1;
+ DEBUGMSGTL(("host/hr_disk", "Next_Disk max %d of type %d\n",
+ max_disks, HRD_type_index));
+
+ while (HRD_index < max_disks) {
+ iindex = (HRD_type_index << HRDISK_TYPE_SHIFT) + HRD_index;
+
+ /*
+ * Check to see whether this device
+ * has been probed for 'recently'
+ * and skip if so.
+ * This has a *major* impact on run
+ * times (by a factor of 10!)
+ */
+ if ((HRD_history[iindex] > 0) &&
+ ((now - HRD_history[iindex]) < 60)) {
+ HRD_index++;
+ continue;
+ }
+
+ /*
+ * Construct the full device name in "string"
+ */
+ if (disk_devices[HRD_type_index].disk_controller != -1) {
+ snprintf(string, sizeof(string)-1,
+ disk_devices[HRD_type_index].disk_devfull_string,
+ disk_devices[HRD_type_index].disk_controller,
+ disk_devices[HRD_type_index].disk_device_first +
+ HRD_index);
+ } else {
+ snprintf(string, sizeof(string)-1,
+ disk_devices[HRD_type_index].disk_devfull_string,
+ disk_devices[HRD_type_index].disk_device_first +
+ HRD_index);
+ }
+ string[ sizeof(string)-1 ] = 0;
+
+ DEBUGMSGTL(("host/hr_disk", "Get_Next_HR_Disk: %s (%d/%d)\n",
+ string, HRD_type_index, HRD_index));
+
+ if (HRD_history[iindex] == -1) {
+ /*
+ * check whether this device is in the "ignoredisk" list in
+ * the config file. if yes this device will be marked as
+ * invalid for the future, i.e. it won't ever be checked
+ * again.
+ */
+ if (match_disk_config(string)) {
+ /*
+ * device name matches entry in ignoredisk list
+ */
+ DEBUGMSGTL(("host/hr_disk",
+ "Get_Next_HR_Disk: %s ignored\n", string));
+ HRD_history[iindex] = LONG_MAX;
+ HRD_index++;
+ continue;
+ }
+ }
+
+ /*
+ * use O_NDELAY to avoid CDROM spin-up and media detection
+ * * (too slow) --okir
+ */
+ /*
+ * at least with HP-UX 11.0 this doesn't seem to work properly
+ * * when accessing an empty CDROM device --jsf
+ */
+#ifdef O_NDELAY /* I'm sure everything has it, but just in case... --Wes */
+ fd = open(string, O_RDONLY | O_NDELAY);
+#else
+ fd = open(string, O_RDONLY);
+#endif
+ if (fd != -1) {
+ result = Query_Disk(fd, string);
+ close(fd);
+ if (result != -1) {
+ HRD_history[iindex] = 0;
+ return ((HRDEV_DISK << HRDEV_TYPE_SHIFT) + iindex);
+ }
+ }
+ HRD_history[iindex] = now;
+ HRD_index++;
+ }
+ HRD_type_index++;
+ HRD_index = 0;
+ }
+ HRD_index = -1;
+ return -1;
+}
+
+int
+Get_Next_HR_Disk_Partition(char *string, size_t str_len, int HRP_index)
+{
+ DEBUGMSGTL(("host/hr_disk", "Next_Partition type %d/%d:%d\n",
+ HRD_type_index, HRD_index, HRP_index));
+
+ /*
+ * no more partition names => return -1
+ */
+ if (disk_devices[HRD_type_index].disk_partition_last -
+ disk_devices[HRD_type_index].disk_partition_first + 1
+ <= HRP_index) {
+ return -1;
+ }
+
+ /*
+ * Construct the partition name in "string"
+ */
+ if (disk_devices[HRD_type_index].disk_controller != -1) {
+ snprintf(string, str_len-1,
+ disk_devices[HRD_type_index].disk_devpart_string,
+ disk_devices[HRD_type_index].disk_controller,
+ disk_devices[HRD_type_index].disk_device_first + HRD_index,
+ disk_devices[HRD_type_index].disk_partition_first +
+ HRP_index);
+ } else {
+ snprintf(string, str_len-1,
+ disk_devices[HRD_type_index].disk_devpart_string,
+ disk_devices[HRD_type_index].disk_device_first + HRD_index,
+ disk_devices[HRD_type_index].disk_partition_first +
+ HRP_index);
+ }
+ string[ str_len-1 ] = 0;
+
+ DEBUGMSGTL(("host/hr_disk",
+ "Get_Next_HR_Disk_Partition: %s (%d/%d:%d)\n", string,
+ HRD_type_index, HRD_index, HRP_index));
+
+ return 0;
+}
+
+static void
+Save_HR_Disk_Specific(void)
+{
+#ifdef DIOC_DESCRIBE
+ HRD_savedIntf_type = HRD_info.intf_type;
+ HRD_savedDev_type = HRD_info.dev_type;
+ HRD_savedFlags = HRD_info.flags;
+ HRD_savedCapacity = HRD_cap.lba / 2;
+#endif
+#ifdef DKIOCINFO
+ HRD_savedCtrl_type = HRD_info.dki_ctype;
+ HRD_savedFlags = HRD_info.dki_flags;
+ HRD_savedCapacity = HRD_cap.dkg_ncyl * HRD_cap.dkg_nhead * HRD_cap.dkg_nsect / 2; /* ??? */
+#endif
+#ifdef HAVE_LINUX_HDREG_H
+ HRD_savedCapacity = HRD_info.lba_capacity / 2;
+ HRD_savedFlags = HRD_info.config;
+#endif
+#ifdef DIOCGDINFO
+ HRD_savedCapacity = HRD_info.d_secperunit / 2;
+#endif
+}
+
+static void
+Save_HR_Disk_General(void)
+{
+#ifdef DIOC_DESCRIBE
+ strncpy(HRD_savedModel, HRD_info.model_num, sizeof(HRD_savedModel)-1);
+ HRD_savedModel[ sizeof(HRD_savedModel)-1 ] = 0;
+#endif
+#ifdef DKIOCINFO
+ strncpy(HRD_savedModel, HRD_info.dki_dname, sizeof(HRD_savedModel)-1);
+ HRD_savedModel[ sizeof(HRD_savedModel)-1 ] = 0;
+#endif
+#ifdef HAVE_LINUX_HDREG_H
+ strncpy(HRD_savedModel, (const char *) HRD_info.model,
+ sizeof(HRD_savedModel)-1);
+ HRD_savedModel[ sizeof(HRD_savedModel)-1 ] = 0;
+#endif
+#ifdef DIOCGDINFO
+ strncpy(HRD_savedModel, dktypenames[HRD_info.d_type],
+ sizeof(HRD_savedModel)-1);
+ HRD_savedModel[ sizeof(HRD_savedModel)-1 ] = 0;
+#endif
+}
+
+static const char *
+describe_disk(int idx)
+{
+ if (HRD_savedModel[0] == '\0')
+ return ("some sort of disk");
+ else
+ return (HRD_savedModel);
+}
+
+
+static int
+Query_Disk(int fd, const char *devfull)
+{
+ int result = -1;
+
+#ifdef DIOC_DESCRIBE
+ result = ioctl(fd, DIOC_DESCRIBE, &HRD_info);
+ if (result != -1)
+ result = ioctl(fd, DIOC_CAPACITY, &HRD_cap);
+#endif
+
+#ifdef DKIOCINFO
+ result = ioctl(fd, DKIOCINFO, &HRD_info);
+ if (result != -1)
+ result = ioctl(fd, DKIOCGGEOM, &HRD_cap);
+#endif
+
+#ifdef HAVE_LINUX_HDREG_H
+ if (HRD_type_index == 0) /* IDE hard disk */
+ result = ioctl(fd, HDIO_GET_IDENTITY, &HRD_info);
+ else if (HRD_type_index <= 2) { /* SCSI hard disk and md devices */
+ long h;
+ result = ioctl(fd, BLKGETSIZE, &h);
+ if (result != -1 && HRD_type_index == 2 && h == 0L)
+ result = -1; /* ignore empty md devices */
+ if (result != -1) {
+ HRD_info.lba_capacity = h;
+ if (HRD_type_index == 1)
+ snprintf( HRD_info.model, sizeof(HRD_info.model)-1,
+ "SCSI disk (%s)", devfull);
+ else
+ snprintf( HRD_info.model, sizeof(HRD_info.model)-1,
+ "RAID disk (%s)", devfull);
+ HRD_info.model[ sizeof(HRD_info.model)-1 ] = 0;
+ HRD_info.config = 0;
+ }
+ }
+#endif
+
+#ifdef DIOCGDINFO
+ result = ioctl(fd, DIOCGDINFO, &HRD_info);
+#endif
+
+ return (result);
+}
+
+
+static int
+Is_It_Writeable(void)
+{
+#ifdef DIOC_DESCRIBE
+ if ((HRD_savedFlags & WRITE_PROTECT_FLAG) ||
+ (HRD_savedDev_type == CDROM_DEV_TYPE))
+ return (2); /* read only */
+#endif
+
+#ifdef DKIOCINFO
+ if (HRD_savedCtrl_type == DKC_CDROM)
+ return (2); /* read only */
+#endif
+
+ return (1); /* read-write */
+}
+
+static int
+What_Type_Disk(void)
+{
+#ifdef DIOC_DESCRIBE
+ switch (HRD_savedDev_type) {
+ case DISK_DEV_TYPE:
+ if (HRD_savedIntf_type == PC_FDC_INTF)
+ return (4); /* Floppy Disk */
+ else
+ return (3); /* Hard Disk */
+ break;
+ case CDROM_DEV_TYPE:
+ return (5); /* Optical RO */
+ break;
+ case WORM_DEV_TYPE:
+ return (6); /* Optical WORM */
+ break;
+ case MO_DEV_TYPE:
+ return (7); /* Optical R/W */
+ break;
+ default:
+ return (2); /* Unknown */
+ break;
+ }
+#endif
+
+#ifdef DKIOCINFO
+ switch (HRD_savedCtrl_type) {
+ case DKC_WDC2880:
+ case DKC_DSD5215:
+#ifdef DKC_XY450
+ case DKC_XY450:
+#endif
+ case DKC_ACB4000:
+ case DKC_MD21:
+#ifdef DKC_XD7053
+ case DKC_XD7053:
+#endif
+ case DKC_SCSI_CCS:
+#ifdef DKC_PANTHER
+ case DKC_PANTHER:
+#endif
+#ifdef DKC_CDC_9057
+ case DKC_CDC_9057:
+#endif
+#ifdef DKC_FJ_M1060
+ case DKC_FJ_M1060:
+#endif
+ case DKC_DIRECT:
+ case DKC_PCMCIA_ATA:
+ return (3); /* Hard Disk */
+ break;
+ case DKC_NCRFLOPPY:
+ case DKC_SMSFLOPPY:
+ case DKC_INTEL82077:
+ return (4); /* Floppy Disk */
+ break;
+ case DKC_CDROM:
+ return (5); /* Optical RO */
+ break;
+ case DKC_PCMCIA_MEM:
+ return (8); /* RAM disk */
+ break;
+ case DKC_MD: /* "meta-disk" driver */
+ return (1); /* Other */
+ break;
+ }
+#endif
+
+
+ return (2); /* Unknown */
+}
+
+static int
+Is_It_Removeable(void)
+{
+#ifdef DIOC_DESCRIBE
+ if ((HRD_savedIntf_type == PC_FDC_INTF) ||
+ (HRD_savedDev_type == WORM_DEV_TYPE) ||
+ (HRD_savedDev_type == MO_DEV_TYPE) ||
+ (HRD_savedDev_type == CDROM_DEV_TYPE))
+ return (1); /* true */
+#endif
+
+#ifdef DKIOCINFO
+ if ((HRD_savedCtrl_type == DKC_CDROM) ||
+ (HRD_savedCtrl_type == DKC_NCRFLOPPY) ||
+ (HRD_savedCtrl_type == DKC_SMSFLOPPY) ||
+ (HRD_savedCtrl_type == DKC_INTEL82077) ||
+ (HRD_savedCtrl_type == DKC_PCMCIA_MEM) ||
+ (HRD_savedCtrl_type == DKC_PCMCIA_ATA))
+ return (1); /* true */
+#endif
+
+#ifdef HAVE_LINUX_HDREG_H
+ if (HRD_savedFlags & 0x80)
+ return (1); /* true */
+#endif
+
+ return (2); /* false */
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_disk.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_disk.h
new file mode 100644
index 0000000000..eff2a67962
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_disk.h
@@ -0,0 +1,17 @@
+/*
+ * Host Resources MIB - disk device group interface - hr_disk.h
+ *
+ */
+#ifndef _MIBGROUP_HRDISK_H
+#define _MIBGROUP_HRDISK_H
+
+config_require(host/hr_device)
+
+extern void init_hr_disk(void);
+extern void Init_HR_Disk(void);
+extern int Get_Next_HR_Disk(void);
+extern int Get_Next_HR_Disk_Partition(char *, size_t, int);
+extern FindVarMethod var_hrdisk;
+
+
+#endif /* _MIBGROUP_HRDISK_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_filesys.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_filesys.c
new file mode 100644
index 0000000000..c53aa99035
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_filesys.c
@@ -0,0 +1,971 @@
+/*
+ * Host Resources MIB - File System device group implementation - hr_filesys.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/memory.h>
+#include "host_res.h"
+#include "hr_filesys.h"
+#include "hr_storage.h"
+#include <net-snmp/utilities.h>
+
+#if HAVE_MNTENT_H
+#include <mntent.h>
+#endif
+#if HAVE_SYS_MNTENT_H
+#include <sys/mntent.h>
+#endif
+#if HAVE_SYS_MNTTAB_H
+#include <sys/mnttab.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+
+#include <ctype.h>
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#if defined(aix4) || defined(aix5) || defined(aix6)
+#include <sys/mntctl.h>
+#include <sys/vmount.h>
+#include <sys/statfs.h>
+#endif
+
+#if defined(bsdi4) || defined(freebsd3) || defined(freebsd4) || defined(freebsd5) || defined(darwin)
+#if HAVE_GETFSSTAT && defined(MFSNAMELEN)
+#define MOUNT_NFS "nfs"
+#define MNTTYPE_UFS "ufs"
+#define BerkelyFS
+#define MNTTYPE_FFS "ffs"
+#define MNTTYPE_NFS "nfs"
+#define MNTTYPE_NFS3 "nfs"
+#define MNTTYPE_HFS "hfs"
+#define MNTTYPE_MFS "mfs"
+#define MNTTYPE_MSDOS "msdos"
+#define MNTTYPE_LFS "lfs"
+#define MNTTYPE_FDESC "fdesc"
+#define MNTTYPE_PORTAL "portal"
+#define MNTTYPE_NULL "null"
+#define MNTTYPE_UMAP "umap"
+#define MNTTYPE_KERNFS "kernfs"
+#define MNTTYPE_PROCFS "procfs"
+#define MNTTYPE_AFS "afs"
+#define MNTTYPE_CD9660 "cd9660"
+#define MNTTYPE_UNION "union"
+#define MNTTYPE_ADOSFS "adosfs"
+#define MNTTYPE_EXT2FS "ext2fs"
+#define MNTTYPE_CFS "coda"
+#define MNTTYPE_NTFS "ntfs"
+#endif
+#endif /* freebsd3 */
+
+#define HRFS_MONOTONICALLY_INCREASING
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+#ifdef solaris2
+
+struct mnttab HRFS_entry_struct;
+struct mnttab *HRFS_entry = &HRFS_entry_struct;
+#define HRFS_name mnt_special
+#define HRFS_mount mnt_mountp
+#define HRFS_type mnt_fstype
+#define HRFS_statfs statvfs
+
+#elif defined(HAVE_STATVFS) && defined(__NetBSD__)
+
+static struct statvfs *fsstats = NULL;
+struct statvfs *HRFS_entry;
+static int fscount;
+#define HRFS_mount f_mntonname
+#define HRFS_name f_mntfromname
+#define HRFS_statfs statvfs
+#define HRFS_type f_fstypename
+#elif defined(HAVE_GETFSSTAT)
+static struct statfs *fsstats = 0;
+static int fscount;
+struct statfs *HRFS_entry;
+#define HRFS_statfs statfs
+#ifdef MFSNAMELEN
+#define HRFS_type f_fstypename
+#else
+#define HRFS_type f_type
+#endif
+#define HRFS_mount f_mntonname
+#define HRFS_name f_mntfromname
+
+#elif defined(dynix)
+struct mntent *HRFS_entry;
+#define HRFS_name mnt_fsname
+#define HRFS_mount mnt_dir
+#define HRFS_type mnt_type
+#define HRFS_statfs statvfs
+
+#elif defined(WIN32)
+struct win_statfs *HRFS_entry;
+static int fscount;
+#define HRFS_mount f_driveletter
+#define HRFS_name f_fsid
+#define HRFS_statfs win_statfs
+#define HRFS_type f_type
+
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+
+struct vmount *aixmnt, *aixcurr;
+struct HRFS_entry {
+ char *HRFS_name;
+ char *HRFS_mount;
+ int HRFS_type;
+ int HRFS_flags;
+} *HRFS_entry;
+#define HRFS_statfs statfs
+
+#else
+struct mntent *HRFS_entry;
+#define HRFS_name mnt_fsname
+#define HRFS_mount mnt_dir
+#define HRFS_type mnt_type
+#define HRFS_statfs statfs
+
+#ifdef linux
+#define MNTTYPE_CD9660 "iso9660"
+#define MNTTYPE_EXT2FS "ext2"
+#define MNTTYPE_EXT3FS "ext3"
+#define MNTTYPE_SMBFS "smbfs"
+#define MNTTYPE_MSDOS "msdos"
+#define MNTTYPE_FAT32 "vfat"
+#define MNTTYPE_NTFS "ntfs"
+#define MNTTYPE_NFS4 "nfs4"
+#endif /* linux */
+
+#endif
+
+#define FULL_DUMP 0
+#define PART_DUMP 1
+
+extern void Init_HR_FileSys(void);
+extern int Get_Next_HR_FileSys(void);
+char *cook_device(char *);
+static u_char *when_dumped(char *filesys, int level, size_t * length);
+int header_hrfilesys(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+
+#define HRFSYS_INDEX 1
+#define HRFSYS_MOUNT 2
+#define HRFSYS_RMOUNT 3
+#define HRFSYS_TYPE 4
+#define HRFSYS_ACCESS 5
+#define HRFSYS_BOOT 6
+#define HRFSYS_STOREIDX 7
+#define HRFSYS_FULLDUMP 8
+#define HRFSYS_PARTDUMP 9
+
+struct variable4 hrfsys_variables[] = {
+ {HRFSYS_INDEX, ASN_INTEGER, RONLY, var_hrfilesys, 2, {1, 1}},
+ {HRFSYS_MOUNT, ASN_OCTET_STR, RONLY, var_hrfilesys, 2, {1, 2}},
+ {HRFSYS_RMOUNT, ASN_OCTET_STR, RONLY, var_hrfilesys, 2, {1, 3}},
+ {HRFSYS_TYPE, ASN_OBJECT_ID, RONLY, var_hrfilesys, 2, {1, 4}},
+ {HRFSYS_ACCESS, ASN_INTEGER, RONLY, var_hrfilesys, 2, {1, 5}},
+ {HRFSYS_BOOT, ASN_INTEGER, RONLY, var_hrfilesys, 2, {1, 6}},
+ {HRFSYS_STOREIDX, ASN_INTEGER, RONLY, var_hrfilesys, 2, {1, 7}},
+ {HRFSYS_FULLDUMP, ASN_OCTET_STR, RONLY, var_hrfilesys, 2, {1, 8}},
+ {HRFSYS_PARTDUMP, ASN_OCTET_STR, RONLY, var_hrfilesys, 2, {1, 9}},
+};
+oid hrfsys_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 3, 8 };
+
+void
+init_hr_filesys(void)
+{
+ REGISTER_MIB("host/hr_filesys", hrfsys_variables, variable4,
+ hrfsys_variables_oid);
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ /* something leaks, make it idiot-safe */
+ aixmnt = NULL;
+ aixcurr = NULL;
+#endif
+}
+
+/*
+ * header_hrfilesys(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+
+int
+header_hrfilesys(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRFSYS_ENTRY_NAME_LENGTH 11
+ oid newname[MAX_OID_LEN];
+ int fsys_idx, LowIndex = -1;
+ int result;
+
+ DEBUGMSGTL(("host/hr_filesys", "var_hrfilesys: "));
+ DEBUGMSGOID(("host/hr_filesys", name, *length));
+ DEBUGMSG(("host/hr_filesys", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+ /*
+ * Find "next" file system entry
+ */
+
+ Init_HR_FileSys();
+ for (;;) {
+ fsys_idx = Get_Next_HR_FileSys();
+ if (fsys_idx == -1)
+ break;
+ newname[HRFSYS_ENTRY_NAME_LENGTH] = fsys_idx;
+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+ if (exact && (result == 0)) {
+ LowIndex = fsys_idx;
+ break;
+ }
+ if ((!exact && (result < 0)) &&
+ (LowIndex == -1 || fsys_idx < LowIndex)) {
+ LowIndex = fsys_idx;
+#ifdef HRFS_MONOTONICALLY_INCREASING
+ break;
+#endif
+ }
+ }
+
+ if (LowIndex == -1) {
+ DEBUGMSGTL(("host/hr_filesys", "... index out of range\n"));
+ return (MATCH_FAILED);
+ }
+
+ memcpy((char *) name, (char *) newname,
+ (vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+ DEBUGMSGTL(("host/hr_filesys", "... get filesys stats "));
+ DEBUGMSGOID(("host/hr_filesys", name, *length));
+ DEBUGMSG(("host/hr_filesys", "\n"));
+
+ return LowIndex;
+}
+
+
+oid fsys_type_id[] = { 1, 3, 6, 1, 2, 1, 25, 3, 9, 1 }; /* hrFSOther */
+int fsys_type_len =
+ sizeof(fsys_type_id) / sizeof(fsys_type_id[0]);
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+
+u_char *
+var_hrfilesys(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ int fsys_idx;
+ static char string[1024];
+ char *mnt_type;
+
+ fsys_idx =
+ header_hrfilesys(vp, name, length, exact, var_len, write_method);
+ if (fsys_idx == MATCH_FAILED)
+ return NULL;
+
+
+ switch (vp->magic) {
+ case HRFSYS_INDEX:
+ long_return = fsys_idx;
+ return (u_char *) & long_return;
+ case HRFSYS_MOUNT:
+ snprintf(string, sizeof(string), HRFS_entry->HRFS_mount);
+ string[ sizeof(string)-1 ] = 0;
+ *var_len = strlen(string);
+ return (u_char *) string;
+ case HRFSYS_RMOUNT:
+ if (Check_HR_FileSys_NFS()) {
+ snprintf(string, sizeof(string), HRFS_entry->HRFS_name);
+ string[ sizeof(string)-1 ] = 0;
+ } else
+ string[0] = '\0';
+ *var_len = strlen(string);
+ return (u_char *) string;
+
+ case HRFSYS_TYPE:
+ if (Check_HR_FileSys_NFS())
+ fsys_type_id[fsys_type_len - 1] = 14;
+ else {
+ /*
+ * Not sufficient to identity the file
+ * type precisely, but it's a start.
+ */
+#if HAVE_GETFSSTAT && !defined(MFSNAMELEN)
+ switch (HRFS_entry->HRFS_type) {
+ case MOUNT_UFS:
+ fsys_type_id[fsys_type_len - 1] = 3;
+ break;
+ case MOUNT_NFS:
+ fsys_type_id[fsys_type_len - 1] = 14;
+ break;
+ case MOUNT_HFS:
+ fsys_type_id[fsys_type_len - 1] = 7;
+ break;
+ case MOUNT_MFS:
+ fsys_type_id[fsys_type_len - 1] = 8;
+ break;
+ case MOUNT_MSDOS:
+ fsys_type_id[fsys_type_len - 1] = 5;
+ break;
+ case MOUNT_LFS:
+ fsys_type_id[fsys_type_len - 1] = 1;
+ break;
+ case MOUNT_LOFS:
+ fsys_type_id[fsys_type_len - 1] = 1;
+ break;
+ case MOUNT_FDESC:
+ fsys_type_id[fsys_type_len - 1] = 1;
+ break;
+ case MOUNT_PORTAL:
+ fsys_type_id[fsys_type_len - 1] = 1;
+ break;
+ case MOUNT_NULL:
+ fsys_type_id[fsys_type_len - 1] = 1;
+ break;
+ case MOUNT_UMAP:
+ fsys_type_id[fsys_type_len - 1] = 1;
+ break;
+ case MOUNT_KERNFS:
+ fsys_type_id[fsys_type_len - 1] = 1;
+ break;
+ case MOUNT_PROCFS:
+ fsys_type_id[fsys_type_len - 1] = 1;
+ break;
+ case MOUNT_AFS:
+ fsys_type_id[fsys_type_len - 1] = 16;
+ break;
+ case MOUNT_CD9660:
+ fsys_type_id[fsys_type_len - 1] = 12;
+ break;
+ case MOUNT_UNION:
+ fsys_type_id[fsys_type_len - 1] = 1;
+ break;
+ case MOUNT_DEVFS:
+ fsys_type_id[fsys_type_len - 1] = 1;
+ break;
+#ifdef MOUNT_EXT2FS
+ case MOUNT_EXT2FS:
+ fsys_type_id[fsys_type_len - 1] = 23;
+ break;
+#endif
+#ifdef MOUNT_TFS
+ case MOUNT_TFS:
+ fsys_type_id[fsys_type_len - 1] = 15;
+ break;
+#endif
+ }
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+ switch (HRFS_entry->HRFS_type) {
+ case MNT_AIX:
+ case MNT_JFS:
+ fsys_type_id[fsys_type_len - 1] = 3;
+ break;
+ case MNT_CDROM:
+ fsys_type_id[fsys_type_len - 1] = 12;
+ break;
+#ifdef MNT_NAMEFS
+ case MNT_NAMEFS:
+#endif
+#ifdef MNT_PROCFS
+ case MNT_PROCFS:
+#endif
+ case MNT_SFS:
+ case MNT_CACHEFS:
+ fsys_type_id[fsys_type_len - 1] = 1;
+ break;
+ case MNT_NFS:
+ case MNT_NFS3:
+ case MNT_AUTOFS:
+ fsys_type_id[fsys_type_len - 1] = 14;
+ break;
+ }
+#else
+ mnt_type = HRFS_entry->HRFS_type;
+ if (mnt_type == NULL)
+ fsys_type_id[fsys_type_len - 1] = 2; /* unknown */
+#ifdef MNTTYPE_HFS
+ else if (!strcmp(mnt_type, MNTTYPE_HFS))
+ fsys_type_id[fsys_type_len - 1] = 7;
+#endif
+#ifdef MNTTYPE_UFS
+ else if (!strcmp(mnt_type, MNTTYPE_UFS))
+#if (defined(BerkelyFS) && !defined(MNTTYPE_HFS)) || defined(solaris2)
+ fsys_type_id[fsys_type_len - 1] = 3;
+#else /* SysV */
+ fsys_type_id[fsys_type_len - 1] = 4; /* or 3? XXX */
+#endif
+#endif
+#ifdef MNTTYPE_SYSV
+ else if (!strcmp(mnt_type, MNTTYPE_SYSV))
+ fsys_type_id[fsys_type_len - 1] = 4;
+#endif
+#ifdef MNTTYPE_PC
+ else if (!strcmp(mnt_type, MNTTYPE_PC))
+ fsys_type_id[fsys_type_len - 1] = 5;
+#endif
+#ifdef MNTTYPE_MSDOS
+ else if (!strcmp(mnt_type, MNTTYPE_MSDOS))
+ fsys_type_id[fsys_type_len - 1] = 5;
+#endif
+#ifdef MNTTYPE_FAT32
+ else if (!strcmp(mnt_type, MNTTYPE_FAT32))
+ fsys_type_id[fsys_type_len - 1] = 22;
+#endif
+#ifdef MNTTYPE_CDFS
+ else if (!strcmp(mnt_type, MNTTYPE_CDFS))
+#ifdef RockRidge
+ fsys_type_id[fsys_type_len - 1] = 13;
+#else /* ISO 9660 */
+ fsys_type_id[fsys_type_len - 1] = 12;
+#endif
+#endif
+#ifdef MNTTYPE_HSFS
+ else if (!strcmp(mnt_type, MNTTYPE_HSFS))
+ fsys_type_id[fsys_type_len - 1] = 13;
+#endif
+#ifdef MNTTYPE_ISO9660
+ else if (!strcmp(mnt_type, MNTTYPE_ISO9660))
+ fsys_type_id[fsys_type_len - 1] = 12;
+#endif
+#ifdef MNTTYPE_CD9660
+ else if (!strcmp(mnt_type, MNTTYPE_CD9660))
+ fsys_type_id[fsys_type_len - 1] = 12;
+#endif
+#ifdef MNTTYPE_SMBFS
+ else if (!strcmp(mnt_type, MNTTYPE_SMBFS))
+ fsys_type_id[fsys_type_len - 1] = 14;
+#endif
+#ifdef MNTTYPE_NFS
+ else if (!strcmp(mnt_type, MNTTYPE_NFS))
+ fsys_type_id[fsys_type_len - 1] = 14;
+#endif
+#ifdef MNTTYPE_NFS3
+ else if (!strcmp(mnt_type, MNTTYPE_NFS3))
+ fsys_type_id[fsys_type_len - 1] = 14;
+#endif
+#ifdef MNTTYPE_NFS4
+ else if (!strcmp(mnt_type, MNTTYPE_NFS4))
+ fsys_type_id[fsys_type_len - 1] = 14;
+#endif
+#ifdef MNTTYPE_MFS
+ else if (!strcmp(mnt_type, MNTTYPE_MFS))
+ fsys_type_id[fsys_type_len - 1] = 8;
+#endif
+#ifdef MNTTYPE_EXT2FS
+ else if (!strcmp(mnt_type, MNTTYPE_EXT2FS))
+ fsys_type_id[fsys_type_len - 1] = 23;
+#endif
+#ifdef MNTTYPE_EXT3FS
+ else if (!strcmp(mnt_type, MNTTYPE_EXT3FS))
+ fsys_type_id[fsys_type_len - 1] = 23;
+#endif
+#ifdef MNTTYPE_NTFS
+ else if (!strcmp(mnt_type, MNTTYPE_NTFS))
+ fsys_type_id[fsys_type_len - 1] = 9;
+#endif
+ else
+ fsys_type_id[fsys_type_len - 1] = 1; /* Other */
+#endif /* HAVE_GETFSSTAT */
+ }
+
+ *var_len = sizeof(fsys_type_id);
+ return (u_char *) fsys_type_id;
+
+ case HRFSYS_ACCESS:
+#if defined(HAVE_STATVFS) && defined(__NetBSD__)
+ long_return = HRFS_entry->f_flag & MNT_RDONLY ? 2 : 1;
+#elif defined(HAVE_GETFSSTAT)
+ long_return = HRFS_entry->f_flags & MNT_RDONLY ? 2 : 1;
+#elif defined(cygwin)
+ long_return = 1;
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+ long_return = (HRFS_entry->HRFS_flags & MNT_READONLY) == 0 ? 1 : 2;
+#else
+#if HAVE_HASMNTOPT
+ if (hasmntopt(HRFS_entry, "ro") != NULL)
+ long_return = 2; /* Read Only */
+ else
+#endif
+ long_return = 1; /* Read-Write */
+#endif
+ return (u_char *) & long_return;
+ case HRFSYS_BOOT:
+ if (HRFS_entry->HRFS_mount[0] == '/' &&
+ HRFS_entry->HRFS_mount[1] == 0)
+ long_return = 1; /* root is probably bootable! */
+ else
+ long_return = 2; /* others probably aren't */
+ return (u_char *) & long_return;
+ case HRFSYS_STOREIDX:
+ long_return = fsys_idx + NETSNMP_MEM_TYPE_MAX;
+ return (u_char *) & long_return;
+ case HRFSYS_FULLDUMP:
+ return when_dumped(HRFS_entry->HRFS_name, FULL_DUMP, var_len);
+ case HRFSYS_PARTDUMP:
+ return when_dumped(HRFS_entry->HRFS_name, PART_DUMP, var_len);
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrfilesys\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+static int HRFS_index;
+#ifndef HAVE_GETFSSTAT
+static FILE *fp;
+#endif
+
+void
+Init_HR_FileSys(void)
+{
+#if HAVE_GETFSSTAT
+#if defined(HAVE_STATVFS) && defined(__NetBSD__)
+ fscount = getvfsstat(NULL, 0, ST_NOWAIT);
+#else
+ fscount = getfsstat(NULL, 0, MNT_NOWAIT);
+#endif
+ if (fsstats)
+ free((char *) fsstats);
+ fsstats = NULL;
+ fsstats = malloc(fscount * sizeof(*fsstats));
+#if defined(HAVE_STATVFS) && defined(__NetBSD__)
+ getvfsstat(fsstats, fscount * sizeof(*fsstats), ST_NOWAIT);
+#else
+ getfsstat(fsstats, fscount * sizeof(*fsstats), MNT_NOWAIT);
+#endif
+ HRFS_index = 0;
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+ int ret;
+ uint size;
+ ret = 0;
+ size = 0;
+ if(aixmnt != NULL) free(aixmnt); /* something leaks, make it idiot-safe */
+ aixmnt = NULL;
+ aixcurr = NULL;
+ HRFS_index = 0;
+ ret = mntctl(MCTL_QUERY, sizeof(uint), &size);
+ if(ret == 0 && size > 0) {
+ aixmnt = malloc(size + sizeof(struct HRFS_entry));
+ if(aixmnt != NULL) {
+ HRFS_entry = (char *) aixmnt + size;
+ ret = mntctl(MCTL_QUERY, size, aixmnt);
+ HRFS_index = 1;
+ if(ret <= 0) {
+ free(aixmnt);
+ aixmnt = NULL;
+ HRFS_entry = NULL;
+ } else aixcurr = aixmnt;
+ }
+ }
+#else
+ HRFS_index = 1;
+ if (fp != NULL)
+ fclose(fp);
+ fp = fopen(ETC_MNTTAB, "r");
+ if (!fp) {
+ char tmpbuf[STRINGMAX];
+ snprintf( tmpbuf, sizeof(tmpbuf), "Can't open %s\n", ETC_MNTTAB );
+ config_perror(tmpbuf);
+ }
+#endif
+}
+
+const char *HRFS_ignores[] = {
+#ifdef MNTTYPE_IGNORE
+ MNTTYPE_IGNORE,
+#endif
+#ifdef MNTTYPE_SWAP
+ MNTTYPE_SWAP,
+#endif
+#ifdef MNTTYPE_PROC
+ MNTTYPE_PROC,
+#endif
+#ifdef MNTTYPE_PROCFS
+ MNTTYPE_PROCFS,
+#endif
+#ifdef MNTTYPE_AUTOFS
+ MNTTYPE_AUTOFS,
+#else
+ "autofs",
+#endif
+#ifdef linux
+ "autofs",
+ "bdev",
+ "binfmt_misc",
+ "cpuset",
+ "debugfs",
+ "devfs",
+ "devpts",
+ "eventpollfs",
+ "futexfs",
+ "hugetlbfs",
+ "inotifyfs",
+ "mqueue",
+ "nfsd",
+ "pipefs",
+ "proc",
+ "ramfs",
+ "rootfs",
+ "rpc_pipefs",
+ "securityfs",
+ "shm",
+ "sockfs",
+ "sysfs",
+ "tmpfs",
+ "usbdevfs",
+ "usbfs",
+#endif
+#ifdef solaris2
+ "mntfs",
+ "proc",
+ "fd",
+#endif
+ 0
+};
+
+int
+Get_Next_HR_FileSys(void)
+{
+#if HAVE_GETFSSTAT
+ if (HRFS_index >= fscount)
+ return -1;
+ HRFS_entry = fsstats + HRFS_index;
+ return ++HRFS_index;
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+ if(aixcurr == NULL) {
+ if(aixmnt != NULL) free(aixmnt);
+ aixmnt = NULL;
+ HRFS_entry = NULL;
+ return -1;
+ }
+ HRFS_entry->HRFS_name = vmt2dataptr(aixcurr, VMT_OBJECT);
+ HRFS_entry->HRFS_mount = vmt2dataptr(aixcurr, VMT_STUB);
+ HRFS_entry->HRFS_type = aixcurr->vmt_gfstype;
+ HRFS_entry->HRFS_flags = aixcurr->vmt_flags;
+ aixcurr = (char *) aixcurr + aixcurr->vmt_length;
+ if((char *) aixcurr >= (char *) HRFS_entry) aixcurr = NULL;
+ switch(HRFS_entry->HRFS_type) {
+#ifdef MNT_NAMEFS
+ case MNT_NAMEFS:
+#endif
+#ifdef MNT_PROCFS
+ case MNT_PROCFS:
+#endif
+ case MNT_SFS:
+ return Get_Next_HR_FileSys();
+ break;
+ }
+ return HRFS_index++;
+#else
+ const char **cpp;
+
+ if (fp == NULL)
+ return -1;
+
+#ifdef solaris2
+ if (getmntent(fp, HRFS_entry) != 0)
+ return -1;
+#else
+ HRFS_entry = getmntent(fp);
+ if (HRFS_entry == NULL)
+ return -1;
+#endif /* solaris2 */
+
+ DEBUGMSGTL(("host/hr_filesys", "Get_Next_HRFS %s\n", HRFS_entry->HRFS_name));
+
+ for (cpp = HRFS_ignores; *cpp != NULL; ++cpp)
+ if (!strcmp(HRFS_entry->HRFS_type, *cpp)) {
+ DEBUGMSGTL(("host/hr_filesys", "Get_Next_HRFS: skipping %s (%s)\n", HRFS_entry->HRFS_type, cpp));
+ return Get_Next_HR_FileSys();
+ }
+
+ /*
+ * Try and ensure that index values are persistent
+ * at least within a single run of the agent
+ */
+ HRFS_index = se_find_value_in_slist("filesys", HRFS_entry->HRFS_name );
+ if (HRFS_index == SE_DNE) {
+ HRFS_index = se_find_free_value_in_slist("filesys");
+ if (HRFS_index == SE_DNE) { HRFS_index = 1; }
+ se_add_pair_to_slist( "filesys",
+ strdup( HRFS_entry->HRFS_name ), HRFS_index);
+ }
+
+ return HRFS_index++;
+#endif /* HAVE_GETFSSTAT */
+}
+
+/*
+ * this function checks whether the current file system (info can be found
+ * in HRFS_entry) is a NFS file system
+ * HRFS_entry must be valid prior to calling this function
+ * returns 1 if NFS file system, 0 otherwise
+ */
+int
+Check_HR_FileSys_NFS (void)
+{
+#if HAVE_GETFSSTAT && !defined(MFSNAMELEN)
+ if ((HRFS_entry->HRFS_type == MOUNT_NFS) ||
+ (HRFS_entry->HRFS_type == MOUNT_AFS))
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+ if(HRFS_entry->HRFS_type == MNT_NFS || HRFS_entry->HRFS_type == MNT_NFS3)
+#else /* HAVE_GETFSSTAT */
+ if ( HRFS_entry->HRFS_type != NULL && (
+#if defined(MNTTYPE_NFS)
+ !strcmp( HRFS_entry->HRFS_type, MNTTYPE_NFS) ||
+#else
+ !strcmp( HRFS_entry->HRFS_type, "nfs") ||
+#endif
+#if defined(MNTTYPE_NFS3)
+ !strcmp( HRFS_entry->HRFS_type, MNTTYPE_NFS3) ||
+#endif
+#if defined(MNTTYPE_NFS4)
+ !strcmp( HRFS_entry->HRFS_type, MNTTYPE_NFS4) ||
+#endif
+#if defined(MNTTYPE_SMBFS)
+ !strcmp( HRFS_entry->HRFS_type, MNTTYPE_SMBFS) ||
+#endif
+#if defined(MNTTYPE_LOFS)
+ !strcmp( HRFS_entry->HRFS_type, MNTTYPE_LOFS) ||
+#endif
+#if defined(MNTTYPE_AFP)
+ !strcmp( HRFS_entry->HRFS_type, MNTTYPE_AFP) ||
+#endif
+ !strcmp( HRFS_entry->HRFS_type, "cifs") ||
+ /*
+ * MVFS is Rational ClearCase's view file system
+ * it is similiar to NFS file systems in that it is mounted
+ * locally or remotely from the ClearCase server
+ */
+ !strcmp( HRFS_entry->HRFS_type, "mvfs")))
+#endif /* HAVE_GETFSSTAT */
+ return 1; /* NFS file system */
+
+ return 0; /* no NFS file system */
+}
+
+void
+End_HR_FileSys(void)
+{
+#ifdef HAVE_GETFSSTAT
+ if (fsstats)
+ free((char *) fsstats);
+ fsstats = NULL;
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+ if(aixmnt != NULL) {
+ free(aixmnt);
+ aixmnt = NULL;
+ aixcurr = NULL;
+ HRFS_entry = NULL;
+ }
+#else
+ if (fp != NULL)
+ fclose(fp);
+ fp = NULL;
+#endif
+}
+
+
+static u_char *
+when_dumped(char *filesys, int level, size_t * length)
+{
+ time_t dumpdate = 0, tmp;
+ FILE *dump_fp;
+ char line[1024];
+ char *cp1, *cp2, *cp3;
+
+ /*
+ * Look for the relevent entries in /etc/dumpdates
+ *
+ * This is complicated by the fact that disks are
+ * mounted using block devices, but dumps are
+ * done via the raw character devices.
+ * Thus the device names in /etc/dumpdates and
+ * /etc/mnttab don't match.
+ * These comparisons are therefore made using the
+ * final portion of the device name only.
+ */
+
+ if (*filesys == '\0') /* No filesystem name? */
+ return date_n_time(NULL, length);
+ cp1 = strrchr(filesys, '/'); /* Find the last element of the current FS */
+
+ if (cp1 == NULL)
+ cp1 = filesys;
+
+ if ((dump_fp = fopen("/etc/dumpdates", "r")) == NULL)
+ return date_n_time(NULL, length);
+
+ while (fgets(line, sizeof(line), dump_fp) != NULL) {
+ cp2 = strchr(line, ' '); /* Start by looking at the device name only */
+ if (cp2 != NULL) {
+ *cp2 = '\0';
+ cp3 = strrchr(line, '/'); /* and find the last element */
+ if (cp3 == NULL)
+ cp3 = line;
+
+ if (strcmp(cp1, cp3) != 0) /* Wrong FS */
+ continue;
+
+ ++cp2;
+ while (isspace(*cp2))
+ ++cp2; /* Now find the dump level */
+
+ if (level == FULL_DUMP) {
+ if (*(cp2++) != '0')
+ continue; /* Not interested in partial dumps */
+ while (isspace(*cp2))
+ ++cp2;
+
+ dumpdate = ctime_to_timet(cp2);
+ fclose(dump_fp);
+ return date_n_time(&dumpdate, length);
+ } else { /* Partial Dump */
+ if (*(cp2++) == '0')
+ continue; /* Not interested in full dumps */
+ while (isspace(*cp2))
+ ++cp2;
+
+ tmp = ctime_to_timet(cp2);
+ if (tmp > dumpdate)
+ dumpdate = tmp; /* Remember the 'latest' partial dump */
+ }
+ }
+ }
+
+ fclose(dump_fp);
+
+ return date_n_time(&dumpdate, length);
+}
+
+
+#define RAW_DEVICE_PREFIX "/dev/rdsk"
+#define COOKED_DEVICE_PREFIX "/dev/dsk"
+
+char *
+cook_device(char *dev)
+{
+ static char cooked_dev[SNMP_MAXPATH+1];
+
+ if (!strncmp(dev, RAW_DEVICE_PREFIX, strlen(RAW_DEVICE_PREFIX))) {
+ strncpy(cooked_dev, COOKED_DEVICE_PREFIX, sizeof(cooked_dev)-1);
+ cooked_dev[ sizeof(cooked_dev)-1 ] = 0;
+ strncat(cooked_dev, dev + strlen(RAW_DEVICE_PREFIX),
+ sizeof(cooked_dev)-strlen(cooked_dev)-1);
+ cooked_dev[ sizeof(cooked_dev)-1 ] = 0;
+ } else {
+ strncpy(cooked_dev, dev, sizeof(cooked_dev)-1);
+ cooked_dev[ sizeof(cooked_dev)-1 ] = 0;
+ }
+
+ return (cooked_dev);
+}
+
+
+int
+Get_FSIndex(char *dev)
+{
+ int iindex;
+
+ Init_HR_FileSys();
+
+ while ((iindex = Get_Next_HR_FileSys()) != -1)
+ if (!strcmp(HRFS_entry->HRFS_name, cook_device(dev))) {
+ End_HR_FileSys();
+ return iindex;
+ }
+
+ End_HR_FileSys();
+ return 0;
+}
+
+long
+Get_FSSize(char *dev)
+{
+ struct HRFS_statfs statfs_buf;
+
+ Init_HR_FileSys();
+
+ while (Get_Next_HR_FileSys() != -1)
+ if (!strcmp(HRFS_entry->HRFS_name, cook_device(dev))) {
+ End_HR_FileSys();
+
+ if (HRFS_statfs(HRFS_entry->HRFS_mount, &statfs_buf) != -1)
+ /*
+ * with large file systems the following calculation produces
+ * an overflow:
+ * (statfs_buf.f_blocks*statfs_buf.f_bsize)/1024
+ *
+ * assumption: f_bsize is either 512 or a multiple of 1024
+ * in case of 512 (f_blocks/2) is returned
+ * otherwise (f_blocks*(f_bsize/1024)) is returned
+ */
+#if defined(solaris2) && defined(STRUCT_STATVFS_HAS_F_FRSIZE)
+ return (statfs_buf.f_blocks*(statfs_buf.f_frsize/1024));
+#else
+ if (statfs_buf.f_bsize == 512)
+ return (statfs_buf.f_blocks/2);
+ else
+ return (statfs_buf.f_blocks*(statfs_buf.f_bsize/1024));
+#endif
+ else
+ return -1;
+ }
+
+ End_HR_FileSys();
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_filesys.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_filesys.h
new file mode 100644
index 0000000000..2f00355f3b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_filesys.h
@@ -0,0 +1,18 @@
+/*
+ * Host Resources MIB - file system device group interface - hr_filesys.h
+ *
+ */
+#ifndef _MIBGROUP_HRFSYS_H
+#define _MIBGROUP_HRFSYS_H
+
+extern void init_hr_filesys(void);
+extern void Init_HR_FileSys(void);
+extern FindVarMethod var_hrfilesys;
+extern int Get_Next_HR_FileSys(void);
+extern int Check_HR_FileSys_NFS(void);
+
+extern int Get_FSIndex(char *);
+extern long Get_FSSize(char *); /* Temporary */
+
+
+#endif /* _MIBGROUP_HRFSYS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_network.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_network.c
new file mode 100644
index 0000000000..6d267e65ff
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_network.c
@@ -0,0 +1,288 @@
+/*
+ * Host Resources MIB - network device group implementation - hr_network.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/interface.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#ifdef hpux11
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif
+
+#include "host_res.h"
+#include "mibII/interfaces.h"
+#include "hr_network.h"
+
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+void Init_HR_Network(void);
+int Get_Next_HR_Network(void);
+void Save_HR_Network_Info(void);
+
+const char *describe_networkIF(int);
+int network_status(int);
+int network_errors(int);
+int header_hrnet(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+
+#define HRN_MONOTONICALLY_INCREASING
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+
+#define HRNET_IFINDEX 1
+
+struct variable4 hrnet_variables[] = {
+ {HRNET_IFINDEX, ASN_INTEGER, RONLY, var_hrnet, 2, {1, 1}}
+};
+oid hrnet_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 3, 4 };
+
+
+void
+init_hr_network(void)
+{
+ init_device[HRDEV_NETWORK] = Init_HR_Network;
+ next_device[HRDEV_NETWORK] = Get_Next_HR_Network;
+ save_device[HRDEV_NETWORK] = Save_HR_Network_Info;
+#ifdef HRN_MONOTONICALLY_INCREASING
+ dev_idx_inc[HRDEV_NETWORK] = 1;
+#endif
+
+ device_descr[HRDEV_NETWORK] = describe_networkIF;
+ device_status[HRDEV_NETWORK] = network_status;
+ device_errors[HRDEV_NETWORK] = network_errors;
+
+ REGISTER_MIB("host/hr_network", hrnet_variables, variable4,
+ hrnet_variables_oid);
+}
+
+/*
+ * header_hrnet(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+
+int
+header_hrnet(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRNET_ENTRY_NAME_LENGTH 11
+ oid newname[MAX_OID_LEN];
+ int net_idx;
+ int result;
+ int LowIndex = -1;
+
+ DEBUGMSGTL(("host/hr_network", "var_hrnet: "));
+ DEBUGMSGOID(("host/hr_network", name, *length));
+ DEBUGMSG(("host/hr_network", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+ /*
+ * Find "next" net entry
+ */
+
+ Init_HR_Network();
+ for (;;) {
+ net_idx = Get_Next_HR_Network();
+ if (net_idx == -1)
+ break;
+ newname[HRNET_ENTRY_NAME_LENGTH] = net_idx;
+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+ if (exact && (result == 0)) {
+ LowIndex = net_idx;
+ break;
+ }
+ if (!exact && (result < 0) &&
+ (LowIndex == -1 || net_idx < LowIndex)) {
+ LowIndex = net_idx;
+#ifdef HRN_MONOTONICALLY_INCREASING
+ break;
+#endif
+ }
+ }
+
+ if (LowIndex == -1) {
+ DEBUGMSGTL(("host/hr_network", "... index out of range\n"));
+ return (MATCH_FAILED);
+ }
+
+ newname[HRNET_ENTRY_NAME_LENGTH] = LowIndex;
+ memcpy((char *) name, (char *) newname,
+ (vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+ DEBUGMSGTL(("host/hr_network", "... get net stats "));
+ DEBUGMSGOID(("host/hr_network", name, *length));
+ DEBUGMSG(("host/hr_network", "\n"));
+ return LowIndex;
+}
+
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+
+u_char *
+var_hrnet(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ int net_idx;
+
+ net_idx = header_hrnet(vp, name, length, exact, var_len, write_method);
+ if (net_idx == MATCH_FAILED)
+ return NULL;
+
+
+ switch (vp->magic) {
+ case HRNET_IFINDEX:
+ long_return = net_idx & ((1 << HRDEV_TYPE_SHIFT) - 1);
+ return (u_char *) & long_return;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrnet\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+
+#if defined( USING_IF_MIB_IFTABLE_IFTABLE_DATA_ACCESS_MODULE )
+static char HRN_name[16];
+static netsnmp_interface_entry *HRN_ifnet;
+#define M_Interface_Scan_Next(a, b, c, d) Interface_Scan_Next(a, b, c, d)
+#elif defined(hpux11)
+static char HRN_name[MAX_PHYSADDR_LEN];
+static nmapi_phystat HRN_ifnet;
+#define M_Interface_Scan_Next(a, b, c, d) Interface_Scan_Next(a, b, c)
+#else /* hpux11 */
+static char HRN_name[16];
+#ifndef WIN32
+static struct ifnet HRN_ifnet;
+#endif /* WIN32 */
+#define M_Interface_Scan_Next(a, b, c, d) Interface_Scan_Next(a, b, c, d)
+#endif
+
+#ifdef hpux11
+static char HRN_savedName[MAX_PHYSADDR_LEN];
+#else
+static char HRN_savedName[16];
+#endif
+static u_short HRN_savedFlags;
+static int HRN_savedErrors;
+
+
+void
+Init_HR_Network(void)
+{
+#if !defined( solaris2 )
+ Interface_Scan_Init();
+#endif
+}
+
+int
+Get_Next_HR_Network(void)
+{
+short HRN_index;
+#if !defined( solaris2) && ! defined( WIN32 )
+ if (M_Interface_Scan_Next(&HRN_index, HRN_name, &HRN_ifnet, NULL) == 0)
+ HRN_index = -1;
+#else
+ HRN_index = -1;
+#endif
+ if (-1 == HRN_index)
+ return HRN_index;
+
+ return (HRDEV_NETWORK << HRDEV_TYPE_SHIFT) + HRN_index;
+}
+
+void
+Save_HR_Network_Info(void)
+{
+ strcpy(HRN_savedName, HRN_name);
+#if defined( USING_IF_MIB_IFTABLE_IFTABLE_DATA_ACCESS_MODULE )
+ HRN_savedFlags = HRN_ifnet->os_flags;
+ HRN_savedErrors = HRN_ifnet->stats.ierrors + HRN_ifnet->stats.oerrors;
+#elif defined( hpux11 )
+ HRN_savedFlags = HRN_ifnet.if_entry.ifOper;
+ HRN_savedErrors = HRN_ifnet.if_entry.ifInErrors +
+ HRN_ifnet.if_entry.ifOutErrors;
+#else /* hpux11 */
+#ifndef WIN32
+ HRN_savedFlags = HRN_ifnet.if_flags;
+ HRN_savedErrors = HRN_ifnet.if_ierrors + HRN_ifnet.if_oerrors;
+#endif /* WIN32 */
+#endif /* hpux11 */
+}
+
+
+const char *
+describe_networkIF(int idx)
+{
+ static char string[1024];
+
+ snprintf(string, sizeof(string)-1, "network interface %s", HRN_savedName);
+ string[ sizeof(string)-1 ] = 0;
+ return string;
+}
+
+
+int
+network_status(int idx)
+{
+#ifndef WIN32
+#ifdef hpux11
+ if (HRN_savedFlags == LINK_UP)
+#else
+ if (HRN_savedFlags & IFF_UP)
+#endif
+ return 2; /* running */
+ else
+ return 5; /* down */
+#endif /* WIN32 */
+
+}
+
+int
+network_errors(int idx)
+{
+ return HRN_savedErrors;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_network.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_network.h
new file mode 100644
index 0000000000..d7bcb48ee8
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_network.h
@@ -0,0 +1,14 @@
+/*
+ * Host Resources MIB - network device group interface - hr_network.h
+ *
+ */
+#ifndef _MIBGROUP_HRNET_H
+#define _MIBGROUP_HRNET_H
+
+config_require(host/hr_device)
+
+extern void init_hr_network(void);
+extern FindVarMethod var_hrnet;
+
+config_require(host/hr_device mibII/ifTable)
+#endif /* _MIBGROUP_HRNET_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_other.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_other.c
new file mode 100644
index 0000000000..9e4b16a267
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_other.c
@@ -0,0 +1,66 @@
+/*
+ * Host Resources MIB - other device implementation - hr_other.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include "host_res.h"
+#include "hr_other.h"
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+
+void Init_HR_CoProc(void);
+int Get_Next_HR_CoProc(void);
+const char *describe_coproc(int);
+
+void
+init_hr_other(void)
+{
+ init_device[HRDEV_COPROC] = Init_HR_CoProc;
+ next_device[HRDEV_COPROC] = Get_Next_HR_CoProc;
+ device_descr[HRDEV_COPROC] = describe_coproc;
+}
+
+
+
+static int done_coProc;
+
+void
+Init_HR_CoProc(void)
+{
+#ifdef solaris2
+ /*
+ * Sun didn't sell many Windows Co-processor boards
+ * somebody who has one will have to figure out how to discover it
+ * so assume there are none
+ */
+ done_coProc = 1;
+#else
+ done_coProc = 0;
+#endif
+}
+
+int
+Get_Next_HR_CoProc(void)
+{
+ /*
+ * How to identify the presence of a co-processor ?
+ */
+
+ if (done_coProc != 1) {
+ done_coProc = 1;
+ return (HRDEV_COPROC << HRDEV_TYPE_SHIFT);
+ } else
+ return -1;
+}
+
+
+const char *
+describe_coproc(int idx)
+{
+ return ("Guessing that there's a floating point co-processor");
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_other.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_other.h
new file mode 100644
index 0000000000..c1865d1196
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_other.h
@@ -0,0 +1,12 @@
+/*
+ * Host Resources MIB - other devices interface - hr_other.h
+ *
+ */
+#ifndef _MIBGROUP_HROTHER_H
+#define _MIBGROUP_HROTHER_H
+
+config_require(host/hr_device)
+
+void init_hr_other(void);
+
+#endif /* _MIBGROUP_HROTHER_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_partition.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_partition.c
new file mode 100644
index 0000000000..ae0bd8e53f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_partition.c
@@ -0,0 +1,312 @@
+
+/*
+ * Host Resources MIB - partition device group implementation - hr_partition.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <fcntl.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <errno.h>
+
+#include "host_res.h"
+#include "hr_partition.h"
+#include "hr_filesys.h"
+#include "hr_disk.h"
+
+#include <sys/stat.h>
+
+#define HRP_MONOTONICALLY_INCREASING
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+static int HRP_savedDiskIndex;
+static int HRP_savedPartIndex;
+static char HRP_savedName[1024];
+
+static int HRP_DiskIndex;
+
+static void Save_HR_Partition(int, int);
+
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+
+static void Init_HR_Partition(void);
+static int Get_Next_HR_Partition(void);
+int header_hrpartition(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+
+
+#define HRPART_INDEX 1
+#define HRPART_LABEL 2
+#define HRPART_ID 3
+#define HRPART_SIZE 4
+#define HRPART_FSIDX 5
+
+struct variable4 hrpartition_variables[] = {
+ {HRPART_INDEX, ASN_INTEGER, RONLY, var_hrpartition, 2, {1, 1}},
+ {HRPART_LABEL, ASN_OCTET_STR, RONLY, var_hrpartition, 2, {1, 2}},
+ {HRPART_ID, ASN_OCTET_STR, RONLY, var_hrpartition, 2, {1, 3}},
+ {HRPART_SIZE, ASN_INTEGER, RONLY, var_hrpartition, 2, {1, 4}},
+ {HRPART_FSIDX, ASN_INTEGER, RONLY, var_hrpartition, 2, {1, 5}}
+};
+oid hrpartition_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 25, 3, 7 };
+
+
+void
+init_hr_partition(void)
+{
+ REGISTER_MIB("host/hr_partition", hrpartition_variables, variable4,
+ hrpartition_variables_oid);
+}
+
+
+/*
+ * header_hrpartition(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+
+int
+header_hrpartition(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+#define HRPART_DISK_NAME_LENGTH 11
+#define HRPART_ENTRY_NAME_LENGTH 12
+ oid newname[MAX_OID_LEN];
+ int part_idx, LowDiskIndex = -1, LowPartIndex = -1;
+ int result;
+
+ DEBUGMSGTL(("host/hr_partition", "var_hrpartition: "));
+ DEBUGMSGOID(("host/hr_partition", name, *length));
+ DEBUGMSG(("host/hr_partition", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+ /*
+ * Find "next" partition entry
+ */
+
+ Init_HR_Disk();
+ Init_HR_Partition();
+
+ /*
+ * Find the "next" disk and partition entries.
+ * If we're in the middle of the table, then there's
+ * no point in examining earlier disks, so set the
+ * starting disk to that of the variable being queried.
+ *
+ * If we've moved from one column of the table to another,
+ * then we need to start at the beginning again.
+ * (i.e. the 'compare' fails to match)
+ * Similarly if we're at the start of the table
+ * (i.e. *length is too short to be a full instance)
+ */
+
+ if ((snmp_oid_compare(vp->name, vp->namelen, name, vp->namelen) == 0)
+ && (*length > HRPART_DISK_NAME_LENGTH)) {
+ LowDiskIndex =
+ (name[HRPART_DISK_NAME_LENGTH] &
+ ((1 << HRDEV_TYPE_SHIFT) - 1));
+
+ while (HRP_DiskIndex < LowDiskIndex) {
+ Init_HR_Partition(); /* moves to next disk */
+ if (HRP_DiskIndex == -1)
+ return (MATCH_FAILED);
+ }
+ }
+
+ for (;;) {
+ part_idx = Get_Next_HR_Partition();
+ if (part_idx == 0)
+ break;
+ newname[HRPART_DISK_NAME_LENGTH] =
+ (HRDEV_DISK << HRDEV_TYPE_SHIFT) + HRP_DiskIndex;
+ newname[HRPART_ENTRY_NAME_LENGTH] = part_idx;
+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 2);
+ if (exact && (result == 0)) {
+ Save_HR_Partition(HRP_DiskIndex, part_idx);
+ LowDiskIndex = HRP_DiskIndex;
+ LowPartIndex = part_idx;
+ break;
+ }
+ if (!exact && (result < 0)) {
+ if (LowPartIndex == -1) {
+ Save_HR_Partition(HRP_DiskIndex, part_idx);
+ LowDiskIndex = HRP_DiskIndex;
+ LowPartIndex = part_idx;
+ } else if (LowDiskIndex < HRP_DiskIndex)
+ break;
+ else if (part_idx < LowPartIndex) {
+ Save_HR_Partition(HRP_DiskIndex, part_idx);
+ LowDiskIndex = HRP_DiskIndex;
+ LowPartIndex = part_idx;
+ }
+#ifdef HRP_MONOTONICALLY_INCREASING
+ break;
+#endif
+ }
+ }
+
+ if (LowPartIndex == -1) {
+ DEBUGMSGTL(("host/hr_partition", "... index out of range\n"));
+ return (MATCH_FAILED);
+ }
+
+ newname[HRPART_DISK_NAME_LENGTH] =
+ (HRDEV_DISK << HRDEV_TYPE_SHIFT) + LowDiskIndex;
+ newname[HRPART_ENTRY_NAME_LENGTH] = LowPartIndex;
+ memcpy((char *) name, (char *) newname,
+ ((int) vp->namelen + 2) * sizeof(oid));
+ *length = vp->namelen + 2;
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+ DEBUGMSGTL(("host/hr_partition", "... get partition stats "));
+ DEBUGMSGOID(("host/hr_partition", name, *length));
+ DEBUGMSG(("host/hr_partition", "\n"));
+ return LowPartIndex;
+}
+
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+
+u_char *
+var_hrpartition(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ int part_idx;
+ static char string[1024];
+ struct stat stat_buf;
+
+ part_idx =
+ header_hrpartition(vp, name, length, exact, var_len, write_method);
+ if (part_idx == MATCH_FAILED)
+ return NULL;
+
+ if (stat(HRP_savedName, &stat_buf) == -1)
+ return NULL;
+
+ switch (vp->magic) {
+ case HRPART_INDEX:
+ long_return = part_idx;
+ return (u_char *) & long_return;
+ case HRPART_LABEL:
+ *var_len = strlen(HRP_savedName);
+ return (u_char *) HRP_savedName;
+ case HRPART_ID: /* Use the device number */
+ sprintf(string, "0x%x", (int) stat_buf.st_rdev);
+ *var_len = strlen(string);
+ return (u_char *) string;
+ case HRPART_SIZE:
+ /*
+ * XXX - based on single partition assumption
+ */
+ long_return = Get_FSSize(HRP_savedName);
+ return (u_char *) & long_return;
+ case HRPART_FSIDX:
+ long_return = Get_FSIndex(HRP_savedName);
+ return (u_char *) & long_return;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrpartition\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+static int HRP_index;
+
+static void
+Init_HR_Partition(void)
+{
+ HRP_DiskIndex = Get_Next_HR_Disk();
+ if (HRP_DiskIndex != -1)
+ HRP_DiskIndex &= ((1 << HRDEV_TYPE_SHIFT) - 1);
+
+ HRP_index = -1;
+}
+
+static int
+Get_Next_HR_Partition(void)
+{
+ char string[1024];
+ int fd;
+
+ if (HRP_DiskIndex == -1) {
+ return 0;
+ }
+
+ HRP_index++;
+ while (Get_Next_HR_Disk_Partition(string, sizeof(string), HRP_index) != -1) {
+ DEBUGMSGTL(("host/hr_partition",
+ "Get_Next_HR_Partition: %s (:%d)\n",
+ string, HRP_index));
+
+#ifdef O_NDELAY
+ fd = open(string, O_RDONLY|O_NDELAY);
+#else
+ fd = open(string, O_RDONLY);
+#endif
+ if (fd != -1) {
+ close(fd);
+ return HRP_index + 1;
+ } else if (errno == EBUSY) {
+ return HRP_index + 1;
+ }
+ HRP_index++;
+ }
+
+ /*
+ * Finished with this disk, try the next
+ */
+ Init_HR_Partition();
+ return (Get_Next_HR_Partition());
+}
+
+static void
+Save_HR_Partition(int disk_idx, int part_idx)
+{
+ HRP_savedDiskIndex = disk_idx;
+ HRP_savedPartIndex = part_idx;
+ (void) Get_Next_HR_Disk_Partition(HRP_savedName, sizeof(HRP_savedName), HRP_index);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_partition.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_partition.h
new file mode 100644
index 0000000000..c4992dd80e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_partition.h
@@ -0,0 +1,14 @@
+/*
+ * Host Resources MIB - partition device group interface - hr_partition.h
+ *
+ */
+#ifndef _MIBGROUP_HRPART_H
+#define _MIBGROUP_HRPART_H
+
+config_require(host/hr_disk)
+
+extern void init_hr_partition(void);
+extern FindVarMethod var_hrpartition;
+
+
+#endif /* _MIBGROUP_HRPART_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_print.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_print.c
new file mode 100644
index 0000000000..488b55afea
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_print.c
@@ -0,0 +1,365 @@
+/*
+ * Host Resources MIB - printer device group implementation - hr_print.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include "host_res.h"
+#include "hr_print.h"
+#include "struct.h"
+#include "util_funcs.h"
+
+#define HRPRINT_MONOTONICALLY_INCREASING
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+void Init_HR_Print(void);
+int Get_Next_HR_Print(void);
+void Save_HR_Print(void);
+const char *describe_printer(int);
+int printer_status(int);
+int printer_detail_status(int);
+int printer_errors(int);
+int header_hrprint(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+FILE *run_lpstat(int *);
+
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+
+#define HRPRINT_STATUS 1
+#define HRPRINT_ERROR 2
+
+struct variable4 hrprint_variables[] = {
+ {HRPRINT_STATUS, ASN_INTEGER, RONLY, var_hrprint, 2, {1, 1}},
+ {HRPRINT_ERROR, ASN_OCTET_STR, RONLY, var_hrprint, 2, {1, 2}}
+};
+oid hrprint_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 3, 5 };
+
+
+void
+init_hr_print(void)
+{
+ init_device[HRDEV_PRINTER] = Init_HR_Print;
+ next_device[HRDEV_PRINTER] = Get_Next_HR_Print;
+ /*
+ * save_device[ HRDEV_PRINTER ] = Save_HR_Print;
+ */
+#ifdef HRPRINT_MONOTONICALLY_INCREASING
+ dev_idx_inc[HRDEV_PRINTER] = 1;
+#endif
+
+ device_descr[HRDEV_PRINTER] = describe_printer;
+ device_status[HRDEV_PRINTER] = printer_status;
+ device_errors[HRDEV_PRINTER] = printer_errors;
+
+ REGISTER_MIB("host/hr_print", hrprint_variables, variable4,
+ hrprint_variables_oid);
+}
+
+/*
+ * header_hrprint(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+int
+header_hrprint(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRPRINT_ENTRY_NAME_LENGTH 11
+ oid newname[MAX_OID_LEN];
+ int print_idx, LowIndex = -1;
+ int result;
+
+ DEBUGMSGTL(("host/hr_print", "var_hrprint: "));
+ DEBUGMSGOID(("host/hr_print", name, *length));
+ DEBUGMSG(("host/hr_print", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+ /*
+ * Find "next" print entry
+ */
+
+ Init_HR_Print();
+ for (;;) {
+ print_idx = Get_Next_HR_Print();
+ if (print_idx == -1)
+ break;
+ newname[HRPRINT_ENTRY_NAME_LENGTH] = print_idx;
+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+ if (exact && (result == 0)) {
+ LowIndex = print_idx;
+ /*
+ * Save printer status information
+ */
+ break;
+ }
+ if ((!exact && (result < 0)) &&
+ (LowIndex == -1 || print_idx < LowIndex)) {
+ LowIndex = print_idx;
+ /*
+ * Save printer status information
+ */
+#ifdef HRPRINT_MONOTONICALLY_INCREASING
+ break;
+#endif
+ }
+ }
+
+ if (LowIndex == -1) {
+ DEBUGMSGTL(("host/hr_print", "... index out of range\n"));
+ return (MATCH_FAILED);
+ }
+
+ memcpy((char *) name, (char *) newname,
+ (vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+ DEBUGMSGTL(("host/hr_print", "... get print stats "));
+ DEBUGMSGOID(("host/hr_print", name, *length));
+ DEBUGMSG(("host/hr_print", "\n"));
+ return LowIndex;
+}
+
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+
+u_char *
+var_hrprint(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ int print_idx;
+
+ print_idx =
+ header_hrprint(vp, name, length, exact, var_len, write_method);
+ if (print_idx == MATCH_FAILED)
+ return NULL;
+
+
+ switch (vp->magic) {
+ case HRPRINT_STATUS:
+ long_return = printer_detail_status(print_idx);
+ return (u_char *) & long_return;
+ case HRPRINT_ERROR:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = 0; /* Null string */
+ return (u_char *) & long_return;
+ default:
+ DEBUGMSGTL(("host/hr_print", "unknown sub-id %d in var_hrprint\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+static int HRP_index;
+static char **HRP_name;
+static int HRP_nbrnames, HRP_maxnames;
+
+#define HRP_MAX_INCR 10
+
+void
+Init_HR_Print(void)
+{
+#if HAVE_LPSTAT || HAVE_CGETNEXT || HAVE_PRINTCAP
+ int i;
+#if HAVE_PRINTCAP
+ FILE *p;
+#elif HAVE_CGETNEXT
+ const char *caps[] = { "/etc/printcap", NULL };
+#elif HAVE_LPSTAT
+ int fd;
+ FILE *p;
+#endif
+
+ HRP_index = 0; /* fail safe at Get_Next_HR_Print */
+
+ if (HRP_name) {
+ for (i = 0; i < HRP_nbrnames; i++)
+ free(HRP_name[i]);
+ HRP_nbrnames = 0;
+ HRP_maxnames = 0;
+ SNMP_FREE(HRP_name);
+ }
+
+#if HAVE_PRINTCAP
+ if ((p = fopen("/etc/printcap", "r")) != NULL) {
+ char buf[BUFSIZ], *ptr;
+ while (fgets(buf, sizeof buf, p)) {
+ buf[strlen(buf) - 1] = 0;
+ if (buf[0] == '#' || buf[0] == 0 || buf[0] == ' '
+ || buf[0] == '\t')
+ continue;
+ if ((ptr = strchr(buf, '\\')))
+ *ptr = 0;
+ if ((ptr = strchr(buf, ':')))
+ *ptr = 0;
+ if ((ptr = strchr(buf, '|')))
+ *ptr = 0;
+ ptr = buf;
+#elif HAVE_CGETNEXT
+ {
+ char *buf = NULL, *ptr;
+ while (cgetnext(&buf, caps) > 0) {
+ if ((ptr = strchr(buf, ':')))
+ *ptr = 0;
+ if ((ptr = strchr(buf, '|')))
+ *ptr = 0;
+ ptr = buf;
+#elif HAVE_LPSTAT
+ if ((p = run_lpstat(&fd)) != NULL) {
+ char buf[BUFSIZ], ptr[BUFSIZ];
+ while (fgets(buf, sizeof buf, p)) {
+ sscanf(buf, "%*s %*s %[^:]", ptr);
+#endif
+ if (HRP_nbrnames == HRP_maxnames) {
+ char **tmp;
+ tmp = (char **) calloc(HRP_maxnames + HRP_MAX_INCR, sizeof(char *));
+ if (!tmp)
+ goto finish;
+ if (HRP_name) {
+ memcpy(tmp, HRP_name, HRP_nbrnames * sizeof(char *));
+ free(HRP_name);
+ }
+ HRP_maxnames += HRP_MAX_INCR;
+ HRP_name = tmp;
+ }
+ HRP_name[HRP_nbrnames++] = strdup(ptr);
+#if !defined(HAVE_PRINTCAP) && defined(HAVE_CGETNEXT)
+ if (buf)
+ free(buf);
+#endif
+ }
+finish:
+#if HAVE_PRINTCAP
+ fclose(p);
+#elif HAVE_CGETNEXT
+ cgetclose();
+#elif HAVE_LPSTAT
+ fclose(p);
+ close(fd);
+#endif
+ }
+#endif /* HAVE_anything */
+}
+
+int
+Get_Next_HR_Print(void)
+{
+ /*
+ * The initial implementation system
+ * has no printers attached, and I've
+ * no real idea how to detect them,
+ * so don't bother.
+ */
+ if (HRP_index < HRP_nbrnames) /* No printer */
+ return (HRDEV_PRINTER << HRDEV_TYPE_SHIFT) + HRP_index++;
+ else
+ return -1;
+}
+
+const char *
+describe_printer(int idx)
+{
+ if (HRP_index == 0) /* return empty string if not initialized */
+ return "";
+
+ DEBUGMSGTL(("host/hr_print", "describe p: %d/%d %s\n", HRP_index, idx,
+ HRP_name[HRP_index - 1]));
+ return HRP_name[HRP_index - 1];
+}
+
+int
+printer_status(int idx)
+{
+ /*
+ * hrDeviceStatus OBJECT-TYPE
+ * SYNTAX INTEGER {
+ * unknown(1), running(2), warning(3), testing(4), down(5)
+ * }
+ */
+
+ return 1; /* unknown */
+}
+
+int
+printer_detail_status(int idx)
+{
+ /*
+ * hrPrinterStatus OBJECT-TYPE
+ * SYNTAX INTEGER {
+ * other(1), unknown(2), idle(3), printing(4), warmup(5)
+ * }
+ */
+
+ return 2; /* unknown */
+}
+
+int
+printer_errors(int idx)
+{
+ return 0;
+}
+
+#ifdef HAVE_LPSTAT
+/*
+ * Run the lpstat command. If compiled with EXCACHE support, this
+ * will actually cache the output for a while which helps a lot
+ * with snmpbulkwalk (in fact, it keeps the client from exiting
+ * due to timeouts).
+ */
+FILE *
+run_lpstat(int *fd)
+{
+ struct extensible ex;
+
+ memset(&ex, 0, sizeof(ex));
+ strcpy(ex.command, LPSTAT_PATH " -v");
+ if ((*fd = get_exec_output(&ex)) < 0)
+ return NULL;
+
+ return fdopen(*fd, "r");
+}
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_print.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_print.h
new file mode 100644
index 0000000000..23ca143ef8
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_print.h
@@ -0,0 +1,14 @@
+/*
+ * Host Resources MIB - printer device group interface - hr_print.h
+ *
+ */
+#ifndef _MIBGROUP_HRPRINT_H
+#define _MIBGROUP_HRPRINT_H
+
+config_require(host/hr_device)
+
+extern void init_hr_print(void);
+extern FindVarMethod var_hrprint;
+
+
+#endif /* _MIBGROUP_HRPRINT_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_proc.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_proc.c
new file mode 100644
index 0000000000..6728fce147
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_proc.c
@@ -0,0 +1,229 @@
+/*
+ * Host Resources MIB - proc processor group implementation - hr_proc.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <ctype.h>
+
+#include "host_res.h"
+#include "hr_proc.h"
+#include <net-snmp/agent/auto_nlist.h>
+#include <net-snmp/agent/agent_read_config.h>
+#include <net-snmp/agent/hardware/cpu.h>
+#include "ucd-snmp/loadave.h"
+
+#define HRPROC_MONOTONICALLY_INCREASING
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+extern void Init_HR_Proc(void);
+extern int Get_Next_HR_Proc(void);
+const char *describe_proc(int);
+int proc_status(int);
+int header_hrproc(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+netsnmp_cpu_info *HRP_cpu;
+
+#define HRPROC_ID 1
+#define HRPROC_LOAD 2
+
+struct variable4 hrproc_variables[] = {
+ {HRPROC_ID, ASN_OBJECT_ID, RONLY, var_hrproc, 2, {1, 1}},
+ {HRPROC_LOAD, ASN_INTEGER, RONLY, var_hrproc, 2, {1, 2}}
+};
+oid hrproc_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 3, 3 };
+
+
+void
+init_hr_proc(void)
+{
+ init_device[HRDEV_PROC] = Init_HR_Proc;
+ next_device[HRDEV_PROC] = Get_Next_HR_Proc;
+ device_descr[HRDEV_PROC] = describe_proc;
+ device_status[HRDEV_PROC] = proc_status;
+#ifdef HRPROC_MONOTONICALLY_INCREASING
+ dev_idx_inc[HRDEV_PROC] = 1;
+#endif
+
+ REGISTER_MIB("host/hr_proc", hrproc_variables, variable4,
+ hrproc_variables_oid);
+}
+
+/*
+ * header_hrproc(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+
+int
+header_hrproc(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRPROC_ENTRY_NAME_LENGTH 11
+ oid newname[MAX_OID_LEN];
+ int proc_idx, LowIndex = -1;
+ int result;
+
+ DEBUGMSGTL(("host/hr_proc", "var_hrproc: "));
+ DEBUGMSGOID(("host/hr_proc", name, *length));
+ DEBUGMSG(("host/hr_proc", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+ /*
+ * Find "next" proc entry
+ */
+
+ Init_HR_Proc();
+ for (;;) {
+ proc_idx = Get_Next_HR_Proc();
+ if (proc_idx == -1)
+ break;
+ newname[HRPROC_ENTRY_NAME_LENGTH] = proc_idx;
+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+ if (exact && (result == 0)) {
+ LowIndex = proc_idx;
+ /*
+ * Save processor status information
+ */
+ break;
+ }
+ if ((!exact && (result < 0)) &&
+ (LowIndex == -1 || proc_idx < LowIndex)) {
+ LowIndex = proc_idx;
+ /*
+ * Save processor status information
+ */
+#ifdef HRPROC_MONOTONICALLY_INCREASING
+ break;
+#endif
+ }
+ }
+
+ if (LowIndex == -1) {
+ DEBUGMSGTL(("host/hr_proc", "... index out of range\n"));
+ return (MATCH_FAILED);
+ }
+
+ memcpy((char *) name, (char *) newname,
+ (vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+ DEBUGMSGTL(("host/hr_proc", "... get proc stats "));
+ DEBUGMSGOID(("host/hr_proc", name, *length));
+ DEBUGMSG(("host/hr_proc", "\n"));
+ return LowIndex;
+}
+
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+
+u_char *
+var_hrproc(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ int proc_idx;
+ netsnmp_cpu_info *cpu;
+
+ proc_idx =
+ header_hrproc(vp, name, length, exact, var_len, write_method);
+ if (proc_idx == MATCH_FAILED)
+ return NULL;
+
+ switch (vp->magic) {
+ case HRPROC_ID:
+ *var_len = nullOidLen;
+ return (u_char *) nullOid;
+ case HRPROC_LOAD:
+ cpu = netsnmp_cpu_get_byIdx( proc_idx & HRDEV_TYPE_MASK, 0 );
+ if ( !cpu || !cpu->history || !cpu->history[0].total_hist )
+ return NULL;
+
+ long_return = (cpu->idle_ticks - cpu->history[0].idle_hist)*100;
+ long_return /= (cpu->total_ticks - cpu->history[0].total_hist);
+ long_return = 100 - long_return;
+ if (long_return < 0)
+ long_return = 0;
+ return (u_char *) & long_return;
+ default:
+ DEBUGMSGTL(("host/hr_proc", "unknown sub-id %d in var_hrproc\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+void
+Init_HR_Proc(void)
+{
+ HRP_cpu = netsnmp_cpu_get_first(); /* 'Overall' entry */
+}
+
+int
+Get_Next_HR_Proc(void)
+{
+ HRP_cpu = netsnmp_cpu_get_next( HRP_cpu );
+ if ( HRP_cpu )
+ return (HRDEV_PROC << HRDEV_TYPE_SHIFT) + HRP_cpu->idx;
+ else
+ return -1;
+}
+
+const char *
+describe_proc(int idx)
+{
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( idx & HRDEV_TYPE_MASK, 0 );
+ return (cpu ? cpu->descr : NULL );
+}
+
+int
+proc_status(int idx)
+{
+ netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( idx & HRDEV_TYPE_MASK, 0 );
+ return (cpu ? cpu->status : 0 );
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_proc.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_proc.h
new file mode 100644
index 0000000000..1e4a926b70
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_proc.h
@@ -0,0 +1,14 @@
+/*
+ * Host Resources MIB - processor device group interface - hr_proc.h
+ *
+ */
+#ifndef _MIBGROUP_HRPROC_H
+#define _MIBGROUP_HRPROC_H
+
+config_require(hardware/cpu)
+config_require(host/hr_device)
+
+extern void init_hr_proc(void);
+extern FindVarMethod var_hrproc;
+
+#endif /* _MIBGROUP_HRPROC_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_storage.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_storage.c
new file mode 100644
index 0000000000..c525452ddd
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_storage.c
@@ -0,0 +1,780 @@
+/*
+ * Host Resources MIB - storage group implementation - hr_storage.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if defined(freebsd5)
+/* undefine these in order to use getfsstat */
+#undef HAVE_STATVFS
+#undef STRUCT_STATVFS_HAS_F_FRSIZE
+#endif
+
+#include <sys/types.h>
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <windows.h>
+# include <errno.h>
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#if (!defined(mingw32) && !defined(WIN32))
+#if HAVE_UTMPX_H
+#include <utmpx.h>
+#else
+#include <utmp.h>
+#endif
+#endif /* mingw32 */
+#ifndef dynix
+#if HAVE_SYS_VM_H
+#include <sys/vm.h>
+#if (!defined(KERNEL) || defined(MACH_USER_API)) && defined(HAVE_SYS_VMMETER_H) /*OS X does not #include <sys/vmmeter.h> if (defined(KERNEL) && !defined(MACH_USER_API)) */
+#include <sys/vmmeter.h>
+#endif
+#else
+#if HAVE_VM_VM_H
+#include <vm/vm.h>
+#if HAVE_MACHINE_TYPES_H
+#include <machine/types.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#include <sys/vmmeter.h>
+#endif
+#if HAVE_VM_VM_PARAM_H
+#include <vm/vm_param.h>
+#endif
+#else
+#if HAVE_SYS_VMPARAM_H
+#include <sys/vmparam.h>
+#endif
+#if HAVE_SYS_VMMAC_H
+#include <sys/vmmac.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#include <sys/vmmeter.h>
+#endif
+#if HAVE_SYS_VMSYSTM_H
+#include <sys/vmsystm.h>
+#endif
+#endif /* vm/vm.h */
+#endif /* sys/vm.h */
+#if defined(HAVE_UVM_UVM_PARAM_H) && defined(HAVE_UVM_UVM_EXTERN_H)
+#include <uvm/uvm_param.h>
+#include <uvm/uvm_extern.h>
+#elif defined(HAVE_VM_VM_PARAM_H) && defined(HAVE_VM_VM_EXTERN_H)
+#include <vm/vm_param.h>
+#include <vm/vm_extern.h>
+#endif
+#if HAVE_KVM_H
+#include <kvm.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#if HAVE_SYS_POOL_H
+#if defined(MBPOOL_SYMBOL) && defined(MCLPOOL_SYMBOL)
+#define __POOL_EXPOSE
+#include <sys/pool.h>
+#else
+#undef HAVE_SYS_POOL_H
+#endif
+#endif
+#if HAVE_SYS_MBUF_H
+#include <sys/mbuf.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#if defined(CTL_HW) && defined(HW_PAGESIZE)
+#define USE_SYSCTL
+#endif
+#if USE_MACH_HOST_STATISTICS
+#include <mach/mach.h>
+#elif defined(CTL_VM) && (defined(VM_METER) || defined(VM_UVMEXP))
+#define USE_SYSCTL_VM
+#endif
+#endif /* if HAVE_SYS_SYSCTL_H */
+#endif /* ifndef dynix */
+
+#if (defined(aix4) || defined(aix5) || defined(aix6)) && HAVE_LIBPERFSTAT_H
+#include <libperfstat.h>
+#endif
+
+
+#include "host_res.h"
+#include "hr_storage.h"
+#include "hr_filesys.h"
+#include <net-snmp/agent/auto_nlist.h>
+
+#if HAVE_MNTENT_H
+#include <mntent.h>
+#endif
+#if HAVE_SYS_MNTTAB_H
+#include <sys/mnttab.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#if HAVE_SYS_MOUNT_H
+#ifdef __osf__
+#undef m_next
+#undef m_data
+#endif
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#include <sys/stat.h>
+
+#if defined(hpux10) || defined(hpux11)
+#include <sys/pstat.h>
+#endif
+#if defined(solaris2)
+#if HAVE_SYS_SWAP_H
+#include <sys/swap.h>
+#endif
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/utilities.h>
+#include <net-snmp/output_api.h>
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/memory.h>
+
+#ifdef solaris2
+#include "kernel_sunos5.h"
+#endif
+
+#include <net-snmp/agent/agent_read_config.h>
+#include <net-snmp/library/read_config.h>
+
+#define HRSTORE_MONOTONICALLY_INCREASING
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+
+#ifdef solaris2
+
+extern struct mnttab *HRFS_entry;
+#define HRFS_mount mnt_mountp
+#define HRFS_statfs statvfs
+#define HRFS_HAS_FRSIZE STRUCT_STATVFS_HAS_F_FRSIZE
+
+#elif defined(WIN32)
+/* fake block size */
+#define FAKED_BLOCK_SIZE 512
+
+extern struct win_statfs *HRFS_entry;
+#define HRFS_statfs win_statfs
+#define HRFS_mount f_driveletter
+
+#elif defined(HAVE_STATVFS) && defined(__NetBSD__)
+
+extern struct statvfs *HRFS_entry;
+extern int fscount;
+#define HRFS_statfs statvfs
+#define HRFS_mount f_mntonname
+#define HRFS_HAS_FRSIZE STRUCT_STATVFS_HAS_F_FRSIZE
+
+#elif defined(HAVE_STATVFS) && defined(STRUCT_STATVFS_HAS_MNT_DIR)
+
+extern struct mntent *HRFS_entry;
+extern int fscount;
+#define HRFS_statfs statvfs
+#define HRFS_mount mnt_dir
+#define HRFS_HAS_FRSIZE STRUCT_STATVFS_HAS_F_FRSIZE
+
+#elif defined(HAVE_GETFSSTAT)
+
+extern struct statfs *HRFS_entry;
+extern int fscount;
+#define HRFS_statfs statfs
+#define HRFS_mount f_mntonname
+#define HRFS_HAS_FRSIZE STRUCT_STATFS_HAS_F_FRSIZE
+
+#else
+
+extern struct mntent *HRFS_entry;
+#define HRFS_mount mnt_dir
+#define HRFS_statfs statfs
+#define HRFS_HAS_FRSIZE STRUCT_STATFS_HAS_F_FRSIZE
+
+#endif
+
+#if defined(USE_MACH_HOST_STATISTICS)
+mach_port_t myHost;
+#endif
+
+static void parse_storage_config(const char *, char *);
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+int Get_Next_HR_Store(void);
+void Init_HR_Store(void);
+int header_hrstore(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+void* header_hrstoreEntry(struct variable *, oid *, size_t *,
+ int, size_t *, WriteMethod **);
+
+#ifdef solaris2
+void sol_get_swapinfo(int *, int *);
+#endif
+
+#define HRSTORE_MEMSIZE 1
+#define HRSTORE_INDEX 2
+#define HRSTORE_TYPE 3
+#define HRSTORE_DESCR 4
+#define HRSTORE_UNITS 5
+#define HRSTORE_SIZE 6
+#define HRSTORE_USED 7
+#define HRSTORE_FAILS 8
+
+struct variable4 hrstore_variables[] = {
+ {HRSTORE_MEMSIZE, ASN_INTEGER, RONLY, var_hrstore, 1, {2}},
+ {HRSTORE_INDEX, ASN_INTEGER, RONLY, var_hrstore, 3, {3, 1, 1}},
+ {HRSTORE_TYPE, ASN_OBJECT_ID, RONLY, var_hrstore, 3, {3, 1, 2}},
+ {HRSTORE_DESCR, ASN_OCTET_STR, RONLY, var_hrstore, 3, {3, 1, 3}},
+ {HRSTORE_UNITS, ASN_INTEGER, RONLY, var_hrstore, 3, {3, 1, 4}},
+ {HRSTORE_SIZE, ASN_INTEGER, RONLY, var_hrstore, 3, {3, 1, 5}},
+ {HRSTORE_USED, ASN_INTEGER, RONLY, var_hrstore, 3, {3, 1, 6}},
+ {HRSTORE_FAILS, ASN_COUNTER, RONLY, var_hrstore, 3, {3, 1, 7}}
+};
+oid hrstore_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 2 };
+
+
+void
+init_hr_storage(void)
+{
+ char *appname;
+
+ REGISTER_MIB("host/hr_storage", hrstore_variables, variable4,
+ hrstore_variables_oid);
+
+ appname = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_APPTYPE);
+ netsnmp_ds_register_config(ASN_BOOLEAN, appname, "skipNFSInHostResources",
+ NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES);
+
+ snmpd_register_config_handler("storageUseNFS", parse_storage_config, NULL,
+ "1 | 2\t\t(1 = enable, 2 = disable)");
+}
+
+static int storageUseNFS = 1; /* Default to reporting NFS mounts as NetworkDisk */
+
+static void
+parse_storage_config(const char *token, char *cptr)
+{
+ char *val;
+ int ival;
+ char *st;
+
+ val = strtok_r(cptr, " \t", &st);
+ if (!val) {
+ config_perror("Missing FLAG parameter in storageUseNFS");
+ return;
+ }
+ ival = atoi(val);
+ if (ival < 1 || ival > 2) {
+ config_perror("storageUseNFS must be 1 or 2");
+ return;
+ }
+ storageUseNFS = (ival == 1) ? 1 : 0;
+}
+
+/*
+ * header_hrstore(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+
+int
+header_hrstore(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRSTORE_NAME_LENGTH 9
+ oid newname[MAX_OID_LEN];
+ int result;
+
+ DEBUGMSGTL(("host/hr_storage", "var_hrstore: "));
+ DEBUGMSGOID(("host/hr_storage", name, *length));
+ DEBUGMSG(("host/hr_storage", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+ newname[HRSTORE_NAME_LENGTH] = 0;
+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+ if ((exact && (result != 0)) || (!exact && (result >= 0)))
+ return (MATCH_FAILED);
+ memcpy((char *) name, (char *) newname,
+ (vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+ return (MATCH_SUCCEEDED);
+}
+
+void *
+header_hrstoreEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+#define HRSTORE_ENTRY_NAME_LENGTH 11
+ oid newname[MAX_OID_LEN];
+ int storage_idx, LowIndex = -1;
+ int result;
+ int idx = -1;
+ netsnmp_memory_info *mem = NULL;
+
+ DEBUGMSGTL(("host/hr_storage", "var_hrstoreEntry: request "));
+ DEBUGMSGOID(("host/hr_storage", name, *length));
+ DEBUGMSG(("host/hr_storage", " exact=%d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+ result = snmp_oid_compare(name, *length, vp->name, vp->namelen);
+
+ DEBUGMSGTL(("host/hr_storage", "var_hrstoreEntry: compare "));
+ DEBUGMSGOID(("host/hr_storage", vp->name, vp->namelen));
+ DEBUGMSG(("host/hr_storage", " => %d\n", result));
+
+
+ if (result < 0 ||
+ *length <= HRSTORE_ENTRY_NAME_LENGTH ) {
+ /*
+ * Requested OID too early or too short to refer
+ * to a valid row (for the current column object).
+ * GET requests should fail, GETNEXT requests
+ * should use the first row.
+ */
+ if ( exact )
+ return NULL;
+ netsnmp_memory_load();
+ mem = netsnmp_memory_get_first( 0 );
+ }
+ else {
+ /*
+ * Otherwise, retrieve the requested
+ * (or following) row as appropriate.
+ */
+ if ( exact && *length > HRSTORE_ENTRY_NAME_LENGTH+1 )
+ return NULL; /* Too long for a valid instance */
+ idx = name[ HRSTORE_ENTRY_NAME_LENGTH ];
+ if ( idx < NETSNMP_MEM_TYPE_MAX ) {
+ netsnmp_memory_load();
+ mem = ( exact ? netsnmp_memory_get_byIdx( idx, 0 ) :
+ netsnmp_memory_get_next_byIdx( idx, 0 ));
+ }
+ }
+
+ /*
+ * If this matched a memory-based entry, then
+ * update the OID parameter(s) for GETNEXT requests.
+ */
+ if ( mem ) {
+ if ( !exact ) {
+ newname[ HRSTORE_ENTRY_NAME_LENGTH ] = mem->idx;
+ memcpy((char *) name, (char *) newname,
+ ((int) vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+ }
+ }
+ /*
+ * If this didn't match a memory-based entry,
+ * then consider the disk-based storage.
+ */
+ else {
+ Init_HR_Store();
+ for (;;) {
+ storage_idx = Get_Next_HR_Store();
+ DEBUGMSG(("host/hr_storage", "(index %d ....", storage_idx));
+ if (storage_idx == -1)
+ break;
+ newname[HRSTORE_ENTRY_NAME_LENGTH] = storage_idx;
+ DEBUGMSGOID(("host/hr_storage", newname, *length));
+ DEBUGMSG(("host/hr_storage", "\n"));
+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+ if (exact && (result == 0)) {
+ LowIndex = storage_idx;
+ /*
+ * Save storage status information
+ */
+ break;
+ }
+ if ((!exact && (result < 0)) &&
+ (LowIndex == -1 || storage_idx < LowIndex)) {
+ LowIndex = storage_idx;
+ /*
+ * Save storage status information
+ */
+#ifdef HRSTORE_MONOTONICALLY_INCREASING
+ break;
+#endif
+ }
+ }
+ if ( LowIndex != -1 ) {
+ if ( !exact ) {
+ newname[ HRSTORE_ENTRY_NAME_LENGTH ] = LowIndex;
+ memcpy((char *) name, (char *) newname,
+ ((int) vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+ }
+ mem = (netsnmp_memory_info*)0xffffffff; /* To indicate 'success' */
+ }
+ }
+
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+ /*
+ * ... and return the appropriate row
+ */
+ DEBUGMSGTL(("host/hr_storage", "var_hrstoreEntry: process "));
+ DEBUGMSGOID(("host/hr_storage", name, *length));
+ DEBUGMSG(("host/hr_storage", " (%x)\n", mem));
+ return (void*)mem;
+}
+
+oid storage_type_id[] = { 1, 3, 6, 1, 2, 1, 25, 2, 1, 1 }; /* hrStorageOther */
+int storage_type_len =
+ sizeof(storage_type_id) / sizeof(storage_type_id[0]);
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+static const char *hrs_descr[] = {
+ NULL,
+ "Memory Buffers", /* HRS_TYPE_MBUF */
+ "Real Memory", /* HRS_TYPE_MEM */
+ "Swap Space" /* HRS_TYPE_SWAP */
+};
+
+
+
+u_char *
+var_hrstore(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ int store_idx = 0;
+ static char string[1024];
+ struct HRFS_statfs stat_buf;
+ void *ptr;
+ netsnmp_memory_info *mem = NULL;
+
+ if (vp->magic == HRSTORE_MEMSIZE) {
+ if (header_hrstore(vp, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+ } else {
+
+really_try_next:
+ ptr = header_hrstoreEntry(vp, name, length, exact, var_len,
+ write_method);
+ if (ptr == NULL)
+ return NULL;
+
+ store_idx = name[ HRSTORE_ENTRY_NAME_LENGTH ];
+ if (HRFS_entry &&
+ netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
+ Check_HR_FileSys_NFS())
+ return NULL;
+ if (store_idx > NETSNMP_MEM_TYPE_MAX ) {
+ if (HRFS_statfs(HRFS_entry->HRFS_mount, &stat_buf) < 0) {
+ snmp_log_perror(HRFS_entry->HRFS_mount);
+ goto try_next;
+ }
+ } else {
+ mem = (netsnmp_memory_info*)ptr;
+ }
+ }
+
+
+
+ switch (vp->magic) {
+ case HRSTORE_MEMSIZE:
+ netsnmp_memory_load();
+ mem = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 0 );
+ if ( !mem || mem->size == -1 || mem->units == -1 )
+ return NULL;
+ long_return = mem->size * (mem->units / 1024);
+ return (u_char *) & long_return;
+
+ case HRSTORE_INDEX:
+ long_return = store_idx;
+ return (u_char *) & long_return;
+ case HRSTORE_TYPE:
+ if (store_idx > NETSNMP_MEM_TYPE_MAX)
+ if (storageUseNFS && Check_HR_FileSys_NFS())
+ storage_type_id[storage_type_len - 1] = 10; /* Network Disk */
+#if HAVE_HASMNTOPT
+ else if (hasmntopt(HRFS_entry, "loop") != NULL)
+ storage_type_id[storage_type_len - 1] = 5; /* Removable Disk */
+#endif
+ else
+ storage_type_id[storage_type_len - 1] = 4; /* Assume fixed */
+ else
+ switch (store_idx) {
+ case NETSNMP_MEM_TYPE_PHYSMEM:
+ case NETSNMP_MEM_TYPE_USERMEM:
+ storage_type_id[storage_type_len - 1] = 2; /* RAM */
+ break;
+ case NETSNMP_MEM_TYPE_VIRTMEM:
+ case NETSNMP_MEM_TYPE_SWAP:
+ storage_type_id[storage_type_len - 1] = 3; /* Virtual Mem */
+ break;
+ default:
+ storage_type_id[storage_type_len - 1] = 1; /* Other */
+ break;
+ }
+ *var_len = sizeof(storage_type_id);
+ return (u_char *) storage_type_id;
+ case HRSTORE_DESCR:
+ if (store_idx > NETSNMP_MEM_TYPE_MAX) {
+ strncpy(string, HRFS_entry->HRFS_mount, sizeof(string)-1);
+ string[ sizeof(string)-1 ] = 0;
+ *var_len = strlen(string);
+ return (u_char *) string;
+ } else {
+ if ( !mem || !mem->descr )
+ goto try_next;
+ *var_len = strlen(mem->descr);
+ return (u_char *) mem->descr;
+ }
+ case HRSTORE_UNITS:
+ if (store_idx > NETSNMP_MEM_TYPE_MAX)
+#if HRFS_HAS_FRSIZE
+ long_return = stat_buf.f_frsize;
+#else
+ long_return = stat_buf.f_bsize;
+#endif
+ else {
+ if ( !mem || mem->units == -1 )
+ goto try_next;
+ long_return = mem->units;
+ }
+ return (u_char *) & long_return;
+ case HRSTORE_SIZE:
+ if (store_idx > NETSNMP_MEM_TYPE_MAX)
+ long_return = stat_buf.f_blocks;
+ else {
+ if ( !mem || mem->size == -1 )
+ goto try_next;
+ long_return = mem->size;
+ }
+ return (u_char *) & long_return;
+ case HRSTORE_USED:
+ if (store_idx > NETSNMP_MEM_TYPE_MAX)
+ long_return = (stat_buf.f_blocks - stat_buf.f_bfree);
+ else {
+ if ( !mem || mem->size == -1 || mem->free == -1 )
+ goto try_next;
+ long_return = mem->size - mem->free;
+ }
+ return (u_char *) & long_return;
+ case HRSTORE_FAILS:
+ if (store_idx > NETSNMP_MEM_TYPE_MAX)
+#if NETSNMP_NO_DUMMY_VALUES
+ goto try_next;
+#else
+ long_return = 0;
+#endif
+ else {
+ if ( !mem || mem->other == -1 )
+ goto try_next;
+ long_return = mem->other;
+ }
+ return (u_char *) & long_return;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrstore\n",
+ vp->magic));
+ }
+ return NULL;
+
+ try_next:
+ if (!exact)
+ goto really_try_next;
+
+ return NULL;
+}
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+static int FS_storage;
+static int HRS_index;
+
+void
+Init_HR_Store(void)
+{
+ HRS_index = 0;
+ Init_HR_FileSys();
+}
+
+int
+Get_Next_HR_Store(void)
+{
+ /*
+ * File-based storage
+ */
+ for (;;) {
+ HRS_index = Get_Next_HR_FileSys();
+ if (HRS_index >= 0) {
+ if (!(netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES) &&
+ Check_HR_FileSys_NFS())) {
+ return HRS_index + NETSNMP_MEM_TYPE_MAX;
+ }
+ } else {
+ return -1;
+ }
+ }
+}
+
+#ifdef solaris2
+void
+sol_get_swapinfo(int *totalP, int *usedP)
+{
+ struct anoninfo ainfo;
+
+ if (swapctl(SC_AINFO, &ainfo) < 0) {
+ *totalP = *usedP = 0;
+ return;
+ }
+
+ *totalP = ainfo.ani_max;
+ *usedP = ainfo.ani_resv;
+}
+#endif /* solaris2 */
+
+#ifdef WIN32
+char *win_realpath(const char *file_name, char *resolved_name)
+{
+ char szFile[_MAX_PATH + 1];
+ char *pszRet;
+
+ pszRet = _fullpath(szFile, resolved_name, MAX_PATH);
+
+ return pszRet;
+}
+
+static int win_statfs (const char *path, struct win_statfs *buf)
+{
+ HINSTANCE h;
+ FARPROC f;
+ int retval = 0;
+ char tmp [MAX_PATH], resolved_path [MAX_PATH];
+ GetFullPathName(path, MAX_PATH, resolved_path, NULL);
+ /* TODO - Fix this! The realpath macro needs defined
+ * or rewritten into the function.
+ */
+
+ win_realpath(path, resolved_path);
+
+ if (!resolved_path)
+ retval = - 1;
+ else {
+ /* check whether GetDiskFreeSpaceExA is supported */
+ h = LoadLibraryA ("kernel32.dll");
+ if (h)
+ f = GetProcAddress (h, "GetDiskFreeSpaceExA");
+ else
+ f = NULL;
+
+ if (f) {
+ ULARGE_INTEGER bytes_free, bytes_total, bytes_free2;
+ if (!f (resolved_path, &bytes_free2, &bytes_total, &bytes_free)) {
+ errno = ENOENT;
+ retval = - 1;
+ } else {
+ buf -> f_bsize = FAKED_BLOCK_SIZE;
+ buf -> f_bfree = (bytes_free.QuadPart) / FAKED_BLOCK_SIZE;
+ buf -> f_files = buf -> f_blocks = (bytes_total.QuadPart) / FAKED_BLOCK_SIZE;
+ buf -> f_ffree = buf -> f_bavail = (bytes_free2.QuadPart) / FAKED_BLOCK_SIZE;
+ }
+ } else {
+ DWORD sectors_per_cluster, bytes_per_sector;
+ if (h) FreeLibrary (h);
+ if (!GetDiskFreeSpaceA (resolved_path, &sectors_per_cluster,
+ &bytes_per_sector, &buf -> f_bavail, &buf -> f_blocks)) {
+ errno = ENOENT;
+ retval = - 1;
+ } else {
+ buf -> f_bsize = sectors_per_cluster * bytes_per_sector;
+ buf -> f_files = buf -> f_blocks;
+ buf -> f_ffree = buf -> f_bavail;
+ buf -> f_bfree = buf -> f_bavail;
+ }
+ }
+ if (h) FreeLibrary (h);
+ }
+
+ /* get the FS volume information */
+ if (strspn (":", resolved_path) > 0) resolved_path [3] = '\0'; /* we want only the root */
+ if (GetVolumeInformation (resolved_path, NULL, 0, &buf -> f_fsid, &buf -> f_namelen,
+ NULL, tmp, MAX_PATH)) {
+ if (strcasecmp ("NTFS", tmp) == 0) {
+ buf -> f_type = NTFS_SUPER_MAGIC;
+ } else {
+ buf -> f_type = MSDOS_SUPER_MAGIC;
+ }
+ } else {
+ errno = ENOENT;
+ retval = - 1;
+ }
+ return retval;
+}
+#endif /* WIN32 */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_storage.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_storage.h
new file mode 100644
index 0000000000..ffa1f52abf
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_storage.h
@@ -0,0 +1,43 @@
+/*
+ * Host Resources MIB - storage group interface - hr_system.h
+ *
+ */
+#ifndef _MIBGROUP_HRSTORAGE_H
+#define _MIBGROUP_HRSTORAGE_H
+
+config_require(hardware/memory)
+config_require(host/hr_filesys)
+
+extern void init_hr_storage(void);
+extern FindVarMethod var_hrstore;
+
+
+#define HRS_TYPE_MBUF 1
+#define HRS_TYPE_MEM 2
+#define HRS_TYPE_SWAP 3
+#define HRS_TYPE_FIXED_MAX 3 /* the largest fixed type */
+
+#ifdef WIN32
+/* linux-compatible values for fs type */
+#define MSDOS_SUPER_MAGIC 0x4d44
+#define NTFS_SUPER_MAGIC 0x5346544E
+
+/* Define the statfs structure for Windows. */
+struct win_statfs {
+ long f_type; /* type of filesystem */
+ long f_bsize; /* optimal transfer block size */
+ long f_blocks; /* total data blocks in file system */
+ long f_bfree; /* free blocks in fs */
+ long f_bavail; /* free blocks avail to non-superuser */
+ long f_files; /* total file nodes in file system */
+ long f_ffree; /* free file nodes in fs */
+ long f_fsid; /* file system id */
+ long f_namelen; /* maximum length of filenames */
+ long f_spare[6]; /* spare for later */
+ char f_driveletter[6];
+};
+
+static int win_statfs (const char *path, struct win_statfs *buf);
+#endif /* WIN32*/
+
+#endif /* _MIBGROUP_HRSTORAGE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_swinst.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_swinst.c
new file mode 100644
index 0000000000..3d67a83f53
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_swinst.c
@@ -0,0 +1,718 @@
+/*
+ * Host Resources MIB - Installed Software group implementation - hr_swinst.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/stat.h>
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#else
+# define dirent direct
+# if HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif
+#ifdef HAVE_PKGLOCS_H
+#include <pkglocs.h>
+#endif
+#ifdef HAVE_PKGINFO_H
+#include <pkginfo.h>
+#endif
+
+#ifdef HAVE_LIBRPM
+#include <rpm/rpmlib.h>
+#include <rpm/header.h>
+#include <fcntl.h>
+
+#ifdef HAVE_RPMGETPATH
+#include <rpm/rpmmacro.h>
+#endif
+
+#ifdef HAVE_RPM_RPMDB_H
+#include <rpm/rpmdb.h>
+#endif
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include "host_res.h"
+#include "hr_swinst.h"
+#include <net-snmp/utilities.h>
+
+#define HRSWINST_MONOTONICALLY_INCREASING
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+/*
+ * Reorganize the global data into a single static structure.
+ *
+ * Old New
+ *======================================================
+ * HRSW_directory swi->swi_directory
+ * HRSW_name[100] swi->swi_name[SNMP_MAXPATH]
+ * HRSW_index swi->swi_index
+ *
+ * swi->swi_dbpath (RPM only)
+ * swi->swi_maxrec (RPM only)
+ * swi->swi_nrec (RPM only)
+ * swi->swi_recs (RPM only)
+ * rpm_db swi->swi_rpmdb (RPM only)
+ * swi->swi_h (RPM only)
+ * swi->swi_prevx (RPM only)
+ *
+ * dp swi->swi_dp
+ * de_p swi->swi_dep
+ */
+typedef struct {
+#if HAVE_LIBRPM
+ char *swi_directory;
+#else
+ const char *swi_directory;
+#endif
+ char swi_name[SNMP_MAXPATH]; /* XXX longest file name */
+ int swi_index;
+
+#if HAVE_LIBRPM
+ const char *swi_dbpath;
+
+ time_t swi_timestamp; /* modify time on database */
+ int swi_maxrec; /* no. of allocations */
+ int swi_nrec; /* no. of valid offsets */
+ int *swi_recs; /* db record offsets */
+ rpmdb swi_rpmdb;
+ Header swi_h;
+ int swi_prevx;
+#else
+ DIR *swi_dp;
+ struct dirent *swi_dep;
+#endif
+
+} SWI_t;
+
+static SWI_t _myswi = { NULL, "", 0 }; /* XXX static for now */
+
+int header_hrswinst(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+int header_hrswInstEntry(struct variable *, oid *, size_t *,
+ int, size_t *, WriteMethod **);
+
+extern struct timeval starttime;
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+extern void Init_HR_SWInst(void);
+extern int Get_Next_HR_SWInst(void);
+extern void End_HR_SWInst(void);
+extern void Save_HR_SW_info(int ix);
+
+#ifdef HAVE_LIBRPM
+static void Mark_HRSW_token(void);
+static void Release_HRSW_token(void);
+#else
+#define Mark_HRSW_token()
+#define Release_HRSW_token()
+#endif
+
+
+#define HRSWINST_CHANGE 1
+#define HRSWINST_UPDATE 2
+#define HRSWINST_INDEX 3
+#define HRSWINST_NAME 4
+#define HRSWINST_ID 5
+#define HRSWINST_TYPE 6
+#define HRSWINST_DATE 7
+
+struct variable4 hrswinst_variables[] = {
+ {HRSWINST_CHANGE, ASN_TIMETICKS, RONLY, var_hrswinst, 1, {1}},
+ {HRSWINST_UPDATE, ASN_TIMETICKS, RONLY, var_hrswinst, 1, {2}},
+ {HRSWINST_INDEX, ASN_INTEGER, RONLY, var_hrswinst, 3, {3, 1, 1}},
+ {HRSWINST_NAME, ASN_OCTET_STR, RONLY, var_hrswinst, 3, {3, 1, 2}},
+ {HRSWINST_ID, ASN_OBJECT_ID, RONLY, var_hrswinst, 3, {3, 1, 3}},
+ {HRSWINST_TYPE, ASN_INTEGER, RONLY, var_hrswinst, 3, {3, 1, 4}},
+ {HRSWINST_DATE, ASN_OCTET_STR, RONLY, var_hrswinst, 3, {3, 1, 5}}
+};
+oid hrswinst_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 6 };
+
+
+#ifdef PKGLOC /* Description from HRSW_dir/.../pkginfo: DESC= */
+#define _PATH_HRSW_directory PKGLOC
+#endif
+#ifdef hpux9 /* Description from HRSW_dir/.../index: fd: */
+#define _PATH_HRSW_directory "/system"
+#endif
+#ifdef hpux10 /* Description from HRSW_dir/.../pfiles/INDEX: title */
+#define _PATH_HRSW_directory "/var/adm/sw/products"
+#endif
+#ifdef hpux11 /* Description from HRSW_dir/.../pfiles/INDEX: title */
+#define _PATH_HRSW_directory "/var/adm/sw/products"
+#endif
+#ifdef freebsd2
+#define _PATH_HRSW_directory "/var/db/pkg"
+#endif
+
+void
+init_hr_swinst(void)
+{
+#if defined(HAVE_LIBRPM) || defined(_PATH_HRSW_directory)
+ SWI_t *swi = &_myswi; /* XXX static for now */
+#endif
+#ifdef HAVE_LIBRPM
+ struct stat stat_buf;
+#endif
+
+ /*
+ * Read settings from config file,
+ * or take system-specific defaults
+ */
+
+#ifdef HAVE_LIBRPM
+ if (swi->swi_directory == NULL) {
+ char path[SNMP_MAXPATH];
+
+ /*
+ * XXX distinguish between rpm-2.5.x and rpm-2.9x
+ */
+#ifdef HAVE_RPMGETPATH
+ rpmReadConfigFiles(NULL, NULL);
+ swi->swi_dbpath = rpmGetPath("%{_dbpath}", NULL);
+#else
+ rpmReadConfigFiles(NULL, NULL, NULL, 0);
+ swi->swi_dbpath = rpmGetVar(RPMVAR_DBPATH);
+#endif
+ if (swi->swi_directory != NULL)
+ free(swi->swi_directory);
+ snprintf(path, sizeof(path), "%s/Packages", swi->swi_dbpath);
+ if (stat(path, &stat_buf) == -1)
+ snprintf(path, sizeof(path), "%s/packages.rpm", swi->swi_dbpath);
+ path[ sizeof(path)-1 ] = 0;
+ swi->swi_directory = strdup(path);
+ }
+#else
+# ifdef _PATH_HRSW_directory
+ if (swi->swi_directory == NULL) {
+ swi->swi_directory = _PATH_HRSW_directory;
+ }
+ strcpy(swi->swi_name, "[installed name]"); /* default name */
+# else
+ /*
+ * XXX SunOS4 package directory is ?? -MJS
+ */
+ return; /* packages not known - don't register */
+# endif
+#endif
+
+ REGISTER_MIB("host/hr_swinst", hrswinst_variables, variable4,
+ hrswinst_variables_oid);
+}
+
+/*
+ * header_hrswinst(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ */
+
+int
+header_hrswinst(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRSWINST_NAME_LENGTH 9
+ oid newname[MAX_OID_LEN];
+ int result;
+
+ DEBUGMSGTL(("host/hr_swinst", "var_hrswinst: "));
+ DEBUGMSGOID(("host/hr_swinst", name, *length));
+ DEBUGMSG(("host/hr_swinst", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+ newname[HRSWINST_NAME_LENGTH] = 0;
+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+ if ((exact && (result != 0)) || (!exact && (result >= 0)))
+ return (MATCH_FAILED);
+ memcpy((char *) name, (char *) newname,
+ (vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+ return (MATCH_SUCCEEDED);
+}
+
+int
+header_hrswInstEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+#define HRSWINST_ENTRY_NAME_LENGTH 11
+ oid newname[MAX_OID_LEN];
+ int swinst_idx, LowIndex = -1;
+ int result;
+
+ DEBUGMSGTL(("host/hr_swinst", "var_hrswinstEntry: "));
+ DEBUGMSGOID(("host/hr_swinst", name, *length));
+ DEBUGMSG(("host/hr_swinst", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+ /*
+ * Find "next" installed software entry
+ */
+
+ Init_HR_SWInst();
+ while ((swinst_idx = Get_Next_HR_SWInst()) != -1) {
+ DEBUGMSG(("host/hr_swinst", "(index %d ....", swinst_idx));
+
+ newname[HRSWINST_ENTRY_NAME_LENGTH] = swinst_idx;
+ DEBUGMSGOID(("host/hr_swinst", newname, *length));
+ DEBUGMSG(("host/hr_swinst", "\n"));
+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+ if (exact && (result == 0)) {
+ LowIndex = swinst_idx;
+ Save_HR_SW_info(LowIndex);
+ break;
+ }
+ if ((!exact && (result < 0)) &&
+ (LowIndex == -1 || swinst_idx < LowIndex)) {
+ LowIndex = swinst_idx;
+ Save_HR_SW_info(LowIndex);
+#ifdef HRSWINST_MONOTONICALLY_INCREASING
+ break;
+#endif
+ }
+ }
+
+ Mark_HRSW_token();
+ End_HR_SWInst();
+
+ if (LowIndex == -1) {
+ DEBUGMSGTL(("host/hr_swinst", "... index out of range\n"));
+ return (MATCH_FAILED);
+ }
+
+ memcpy((char *) name, (char *) newname,
+ (vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+ DEBUGMSGTL(("host/hr_inst", "... get installed S/W stats "));
+ DEBUGMSGOID(("host/hr_inst", name, *length));
+ DEBUGMSG(("host/hr_inst", "\n"));
+ return LowIndex;
+}
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+
+u_char *
+var_hrswinst(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ SWI_t *swi = &_myswi; /* XXX static for now */
+ int sw_idx = 0;
+ static char string[SNMP_MAXPATH];
+ u_char *ret = NULL;
+ struct stat stat_buf;
+
+ if (vp->magic < HRSWINST_INDEX) {
+ if (header_hrswinst(vp, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+ } else {
+
+ sw_idx =
+ header_hrswInstEntry(vp, name, length, exact, var_len,
+ write_method);
+ if (sw_idx == MATCH_FAILED)
+ return NULL;
+ }
+
+ switch (vp->magic) {
+ case HRSWINST_CHANGE:
+ case HRSWINST_UPDATE:
+ string[0] = '\0';
+
+ if (swi->swi_directory != NULL) {
+ strncpy(string, swi->swi_directory, sizeof(string));
+ string[ sizeof(string)-1 ] = 0;
+ }
+
+ if (*string && (stat(string, &stat_buf) != -1)) {
+ if (stat_buf.st_mtime > starttime.tv_sec)
+ /*
+ * changed 'recently' - i.e. since this agent started
+ */
+ long_return = (stat_buf.st_mtime - starttime.tv_sec) * 100;
+ else
+ long_return = 0; /* predates this agent */
+ } else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#else
+ long_return = 363136200;
+#endif
+ ret = (u_char *) & long_return;
+ break;
+
+ case HRSWINST_INDEX:
+ long_return = sw_idx;
+ ret = (u_char *) & long_return;
+ break;
+ case HRSWINST_NAME:
+ {
+#ifdef HAVE_PKGINFO
+ char *pver;
+# endif
+ strncpy(string, swi->swi_name, sizeof(string) - 1);
+
+/* If we are on a solaris machine, the package names do not include versioning info,
+ * so we must add it manually
+ */
+#ifdef HAVE_PKGINFO
+ pver = pkgparam(swi->swi_name, "VERSION");
+ /* 1 spot for the terminating null and one for the dash */
+ if (strlen(pver) + 2 + strlen(string) <= sizeof(string)) {
+ strcat(string, "-");
+ strcat(string, pver);
+ }
+# endif
+
+ /*
+ * This will be unchanged from the initial "null"
+ * value, if swi->swi_name is not defined
+ */
+ string[sizeof(string) - 1] = '\0';
+ *var_len = strlen(string);
+ ret = (u_char *) string;
+ }
+ break;
+ case HRSWINST_ID:
+ *var_len = nullOidLen;
+ ret = (u_char *) nullOid;
+ break;
+ case HRSWINST_TYPE:
+ {
+#ifdef HAVE_PKGINFO
+ /*
+ * at least on solaris2 this works
+ */
+ char *catg = pkgparam(swi->swi_name, "CATEGORY");
+
+ if (catg == NULL) {
+ long_return = 1; /* unknown */
+ } else {
+ if (strstr(catg, "system") != NULL) {
+ long_return = 2; /* operatingSystem */
+ } else if (strstr(catg, "application") != NULL) {
+ long_return = 4; /* applcation */
+ } else {
+ long_return = 1; /* unknown */
+ }
+ free(catg);
+ }
+#else
+# ifdef HAVE_LIBRPM
+ char *rpm_groups;
+ if ( headerGetEntry(swi->swi_h, RPMTAG_GROUP, NULL, (void **) &rpm_groups, NULL) ) {
+ if ( strstr(rpm_groups, "System Environment") != NULL )
+ long_return = 2; /* operatingSystem */
+ else
+ long_return = 4; /* applcation */
+ } else {
+ long_return = 1; /* unknown */
+ }
+# else
+ long_return = 1; /* unknown */
+# endif
+#endif
+ ret = (u_char *) & long_return;
+ }
+ break;
+ case HRSWINST_DATE:
+ {
+#ifdef HAVE_LIBRPM
+ int_32 *rpm_data;
+ if ( headerGetEntry(swi->swi_h, RPMTAG_INSTALLTIME, NULL, (void **) &rpm_data, NULL) ) {
+ time_t installTime = *rpm_data;
+ ret = date_n_time(&installTime, var_len);
+ } else {
+ ret = date_n_time(0, var_len);
+ }
+#else
+ if (swi->swi_directory != NULL) {
+ snprintf(string, sizeof(string), "%s/%s",
+ swi->swi_directory, swi->swi_name);
+ string[ sizeof(string)-1 ] = 0;
+ stat(string, &stat_buf);
+ ret = date_n_time(&stat_buf.st_mtime, var_len);
+ } else {
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ sprintf(string, "back in the mists of time");
+ *var_len = strlen(string);
+ ret = (u_char *) string;
+ }
+#endif
+ }
+ break;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrswinst\n",
+ vp->magic));
+ ret = NULL;
+ break;
+ }
+ Release_HRSW_token();
+ return ret;
+}
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+#ifdef HAVE_LIBRPM
+static void
+Check_HRSW_cache(void *xxx)
+{
+ SWI_t *swi = (SWI_t *) xxx;
+
+ /*
+ * Make sure cache is up-to-date
+ */
+ if (swi->swi_recs != NULL) {
+ struct stat sb;
+ lstat(swi->swi_directory, &sb);
+ if (swi->swi_timestamp == sb.st_mtime)
+ return;
+ swi->swi_timestamp = sb.st_mtime;
+ swi->swi_maxrec = 0;
+ }
+
+ /*
+ * Get header offsets
+ */
+ {
+ int ix = 0;
+ int offset;
+
+#if defined(RPMDBI_PACKAGES)
+ rpmdbMatchIterator mi = NULL;
+ Header h;
+ mi = rpmdbInitIterator(swi->swi_rpmdb, RPMDBI_PACKAGES, NULL, 0);
+ while ((h = rpmdbNextIterator(mi)) != NULL) {
+ offset = rpmdbGetIteratorOffset(mi);
+#else
+ for (offset = rpmdbFirstRecNum(swi->swi_rpmdb);
+ offset != 0;
+ offset = rpmdbNextRecNum(swi->swi_rpmdb, offset)) {
+#endif
+
+ if (ix >= swi->swi_maxrec) {
+ swi->swi_maxrec += 256;
+ swi->swi_recs = (swi->swi_recs == NULL)
+ ? (int *) malloc(swi->swi_maxrec * sizeof(int))
+ : (int *) realloc(swi->swi_recs,
+ swi->swi_maxrec * sizeof(int));
+ }
+ swi->swi_recs[ix++] = offset;
+
+#if !defined(RPMDBI_PACKAGES)
+ }
+#else
+ }
+ rpmdbFreeIterator(mi);
+#endif
+
+ swi->swi_nrec = ix;
+ }
+}
+#endif /* HAVE_LIBRPM */
+
+void
+Init_HR_SWInst(void)
+{
+ SWI_t *swi = &_myswi; /* XXX static for now */
+ swi->swi_index = 0;
+
+#ifdef HAVE_LIBRPM
+ if (swi->swi_rpmdb != NULL)
+ return;
+ if (rpmdbOpen("", &swi->swi_rpmdb, O_RDONLY, 0644) != 0)
+ swi->swi_index = -1;
+ Check_HRSW_cache(swi);
+#else
+ if (swi->swi_directory != NULL) {
+ if (swi->swi_dp != NULL) {
+ closedir(swi->swi_dp);
+ swi->swi_dp = NULL;
+ }
+ if ((swi->swi_dp = opendir(swi->swi_directory)) == NULL)
+ swi->swi_index = -1;
+ } else
+ swi->swi_index = -1;
+#endif
+}
+
+int
+Get_Next_HR_SWInst(void)
+{
+ SWI_t *swi = &_myswi; /* XXX static for now */
+
+ if (swi->swi_index == -1)
+ return -1;
+
+#ifdef HAVE_LIBRPM
+ /*
+ * XXX Watchout: index starts with 1
+ */
+ if (0 <= swi->swi_index && swi->swi_index < swi->swi_nrec)
+ return ++swi->swi_index;
+#else
+ if (swi->swi_directory != NULL) {
+ while ((swi->swi_dep = readdir(swi->swi_dp)) != NULL) {
+ if (swi->swi_dep->d_name[0] == '.')
+ continue;
+
+ /*
+ * Ought to check for "properly-formed" entry
+ */
+
+ return ++swi->swi_index;
+ }
+ }
+#endif
+
+ return -1;
+}
+
+void
+Save_HR_SW_info(int ix)
+{
+ SWI_t *swi = &_myswi; /* XXX static for now */
+
+#ifdef HAVE_LIBRPM
+ /*
+ * XXX Watchout: ix starts with 1
+ */
+ if (1 <= ix && ix <= swi->swi_nrec && ix != swi->swi_prevx) {
+ int offset;
+ Header h;
+ char *n, *v, *r;
+
+ offset = swi->swi_recs[ix - 1];
+
+#if defined(RPMDBI_PACKAGES)
+ {
+ rpmdbMatchIterator mi;
+ mi = rpmdbInitIterator(swi->swi_rpmdb, RPMDBI_PACKAGES,
+ &offset, sizeof(offset));
+ if ((h = rpmdbNextIterator(mi)) != NULL)
+ h = headerLink(h);
+ rpmdbFreeIterator(mi);
+ }
+#else
+ h = rpmdbGetRecord(swi->swi_rpmdb, offset);
+#endif
+
+ if (h == NULL)
+ return;
+ if (swi->swi_h != NULL)
+ headerFree(swi->swi_h);
+ swi->swi_h = h;
+ swi->swi_prevx = ix;
+
+ headerGetEntry(swi->swi_h, RPMTAG_NAME, NULL, (void **) &n, NULL);
+ headerGetEntry(swi->swi_h, RPMTAG_VERSION, NULL, (void **) &v,
+ NULL);
+ headerGetEntry(swi->swi_h, RPMTAG_RELEASE, NULL, (void **) &r,
+ NULL);
+ snprintf(swi->swi_name, sizeof(swi->swi_name), "%s-%s-%s", n, v, r);
+ swi->swi_name[ sizeof(swi->swi_name)-1 ] = 0;
+ }
+#else
+ snprintf(swi->swi_name, sizeof(swi->swi_name), swi->swi_dep->d_name);
+ swi->swi_name[ sizeof(swi->swi_name)-1 ] = 0;
+#endif
+}
+
+#ifdef HAVE_LIBRPM
+void
+Mark_HRSW_token(void)
+{
+}
+
+void
+Release_HRSW_token(void)
+{
+ SWI_t *swi = &_myswi; /* XXX static for now */
+ if (swi != NULL && swi->swi_h) {
+ headerFree(swi->swi_h);
+ swi->swi_h = NULL;
+ swi->swi_prevx = -1;
+ }
+}
+#endif /* HAVE_LIBRPM */
+
+void
+End_HR_SWInst(void)
+{
+ SWI_t *swi = &_myswi; /* XXX static for now */
+
+#ifdef HAVE_LIBRPM
+ rpmdbClose(swi->swi_rpmdb); /* or only on finishing ? */
+ swi->swi_rpmdb = NULL;
+#else
+ if (swi->swi_dp != NULL)
+ closedir(swi->swi_dp);
+ swi->swi_dp = NULL;
+#endif
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_swinst.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_swinst.h
new file mode 100644
index 0000000000..0c95ce15c3
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_swinst.h
@@ -0,0 +1,12 @@
+/*
+ * Host Resources MIB - Running Software group interface - hr_swinst.h
+ *
+ */
+#ifndef _MIBGROUP_HRSWINST_H
+#define _MIBGROUP_HRSWINST_H
+
+extern void init_hr_swinst(void);
+extern FindVarMethod var_hrswinst;
+
+
+#endif /* _MIBGROUP_HRSWINST_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_swrun.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_swrun.c
new file mode 100644
index 0000000000..2d85be71c9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_swrun.c
@@ -0,0 +1,1545 @@
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+/*
+ * Host Resources MIB - Running Software group implementation - hr_swrun.c
+ * (also includes Running Software Performance group )
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <fcntl.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <sys/param.h>
+#include <ctype.h>
+#if HAVE_SYS_PSTAT_H
+#include <sys/pstat.h>
+#endif
+#if HAVE_SYS_USER_H
+#ifdef solaris2
+#include <libgen.h>
+#define _KMEMUSER
+#endif
+#include <sys/user.h>
+#endif
+#if HAVE_SYS_PROC_H
+#include <sys/proc.h>
+#endif
+#if HAVE_KVM_H
+#include <kvm.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#if HAVE_DIRENT_H && !defined(cygwin)
+#include <dirent.h>
+#else
+# define dirent direct
+# if HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif
+#ifdef cygwin
+#include <windows.h>
+#include <sys/cygwin.h>
+#include <tlhelp32.h>
+#include <psapi.h>
+#endif
+
+#if _SLASH_PROC_METHOD_
+#include <procfs.h>
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <stdio.h>
+
+#include <net-snmp/output_api.h>
+#include "host_res.h"
+#include "hr_swrun.h"
+#include <net-snmp/agent/auto_nlist.h>
+#include "kernel.h"
+#ifdef solaris2
+#include "kernel_sunos5.h"
+#endif
+#if defined(aix4) || defined(aix5) || defined(aix6)
+#include <procinfo.h>
+#include <sys/types.h>
+#endif
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+void Init_HR_SWRun(void);
+int Get_Next_HR_SWRun(void);
+void End_HR_SWRun(void);
+int header_hrswrun(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+int header_hrswrunEntry(struct variable *, oid *, size_t *,
+ int, size_t *, WriteMethod **);
+
+#ifdef dynix
+pid_t nextproc;
+static prpsinfo_t lowpsinfo, mypsinfo;
+#endif
+#ifdef cygwin
+static struct external_pinfo *curproc;
+static struct external_pinfo lowproc;
+#elif !defined(linux)
+static int LowProcIndex;
+#endif
+#if defined(hpux10) || defined(hpux11)
+struct pst_status *proc_table;
+struct pst_dynamic pst_dyn;
+#elif HAVE_KVM_GETPROCS
+struct kinfo_proc *proc_table;
+#elif defined(solaris2)
+int *proc_table;
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+struct procsinfo *proc_table;
+#else
+struct proc *proc_table;
+#endif
+#ifndef dynix
+int current_proc_entry;
+#endif
+
+
+#define HRSWRUN_OSINDEX 1
+
+#define HRSWRUN_INDEX 2
+#define HRSWRUN_NAME 3
+#define HRSWRUN_ID 4
+#define HRSWRUN_PATH 5
+#define HRSWRUN_PARAMS 6
+#define HRSWRUN_TYPE 7
+#define HRSWRUN_STATUS 8
+
+#define HRSWRUNPERF_CPU 9
+#define HRSWRUNPERF_MEM 10
+
+struct variable4 hrswrun_variables[] = {
+ {HRSWRUN_OSINDEX, ASN_INTEGER, RONLY, var_hrswrun, 1, {1}},
+ {HRSWRUN_INDEX, ASN_INTEGER, RONLY, var_hrswrun, 3, {2, 1, 1}},
+ {HRSWRUN_NAME, ASN_OCTET_STR, RONLY, var_hrswrun, 3, {2, 1, 2}},
+ {HRSWRUN_ID, ASN_OBJECT_ID, RONLY, var_hrswrun, 3, {2, 1, 3}},
+ {HRSWRUN_PATH, ASN_OCTET_STR, RONLY, var_hrswrun, 3, {2, 1, 4}},
+ {HRSWRUN_PARAMS, ASN_OCTET_STR, RONLY, var_hrswrun, 3, {2, 1, 5}},
+ {HRSWRUN_TYPE, ASN_INTEGER, RONLY, var_hrswrun, 3, {2, 1, 6}},
+ {HRSWRUN_STATUS, ASN_INTEGER, RONLY, var_hrswrun, 3, {2, 1, 7}}
+};
+
+struct variable4 hrswrunperf_variables[] = {
+ {HRSWRUNPERF_CPU, ASN_INTEGER, RONLY, var_hrswrun, 3, {1, 1, 1}},
+ {HRSWRUNPERF_MEM, ASN_INTEGER, RONLY, var_hrswrun, 3, {1, 1, 2}}
+};
+
+oid hrswrun_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 4 };
+oid hrswrunperf_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 5 };
+
+#ifdef cygwin
+
+/*
+ * a lot of this is "stolen" from cygwin ps.cc
+ */
+
+typedef BOOL(WINAPI * ENUMPROCESSMODULES) (HANDLE hProcess,
+ HMODULE * lphModule,
+ DWORD cb,
+ LPDWORD lpcbNeeded);
+
+typedef DWORD(WINAPI * GETMODULEFILENAME) (HANDLE hProcess,
+ HMODULE hModule,
+ LPTSTR lpstrFIleName,
+ DWORD nSize);
+
+typedef DWORD(WINAPI * GETPROCESSMEMORYINFO) (HANDLE hProcess,
+ PPROCESS_MEMORY_COUNTERS
+ pmc, DWORD nSize);
+
+typedef HANDLE(WINAPI * CREATESNAPSHOT) (DWORD dwFlags,
+ DWORD th32ProcessID);
+
+typedef BOOL(WINAPI * PROCESSWALK) (HANDLE hSnapshot,
+ LPPROCESSENTRY32 lppe);
+
+ENUMPROCESSMODULES myEnumProcessModules;
+GETMODULEFILENAME myGetModuleFileNameEx;
+CREATESNAPSHOT myCreateToolhelp32Snapshot;
+PROCESSWALK myProcess32First;
+PROCESSWALK myProcess32Next;
+GETPROCESSMEMORYINFO myGetProcessMemoryInfo = NULL;
+cygwin_getinfo_types query = CW_GETPINFO;
+
+static BOOL WINAPI
+dummyprocessmodules(HANDLE hProcess,
+ HMODULE * lphModule, DWORD cb, LPDWORD lpcbNeeded)
+{
+ lphModule[0] = (HMODULE) * lpcbNeeded;
+ *lpcbNeeded = 1;
+ return 1;
+}
+
+static DWORD WINAPI
+GetModuleFileNameEx95(HANDLE hProcess,
+ HMODULE hModule, LPTSTR lpstrFileName, DWORD n)
+{
+ HANDLE h;
+ DWORD pid = (DWORD) hModule;
+ PROCESSENTRY32 proc;
+
+ h = myCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
+ if (!h)
+ return 0;
+ proc.dwSize = sizeof(proc);
+ if (myProcess32First(h, &proc))
+ do
+ if (proc.th32ProcessID == pid) {
+ CloseHandle(h);
+ strcpy(lpstrFileName, proc.szExeFile);
+ return 1;
+ }
+ while (myProcess32Next(h, &proc));
+ CloseHandle(h);
+ return 0;
+}
+
+#define FACTOR (0x19db1ded53ea710LL)
+#define NSPERSEC 10000000LL
+#define NSPERMSEC 10000LL
+
+static time_t __stdcall
+to_time_t(PFILETIME ptr)
+{
+ long rem;
+ long long x =
+ ((long long) ptr->dwHighDateTime << 32) +
+ ((unsigned) ptr->dwLowDateTime);
+ x -= FACTOR;
+ rem = x % NSPERSEC;
+ rem += NSPERSEC / 2;
+ x /= NSPERSEC;
+ x += rem / NSPERSEC;
+ return x;
+}
+
+static long
+to_msec(PFILETIME ptr)
+{
+ long long x =
+ ((long long) ptr->dwHighDateTime << 32) +
+ (unsigned) ptr->dwLowDateTime;
+ x /= NSPERMSEC;
+ return x;
+}
+
+#endif /* cygwin */
+
+
+void
+init_hr_swrun(void)
+{
+#ifdef cygwin
+ OSVERSIONINFO ver;
+ HMODULE h;
+
+ memset(&ver, 0, sizeof ver);
+ ver.dwOSVersionInfoSize = sizeof ver;
+ GetVersionEx(&ver);
+
+ if (ver.dwPlatformId == VER_PLATFORM_WIN32_NT) {
+ h = LoadLibrary("psapi.dll");
+ if (h) {
+ myEnumProcessModules =
+ (ENUMPROCESSMODULES) GetProcAddress(h,
+ "EnumProcessModules");
+ myGetModuleFileNameEx =
+ (GETMODULEFILENAME) GetProcAddress(h,
+ "GetModuleFileNameExA");
+ myGetProcessMemoryInfo =
+ (GETPROCESSMEMORYINFO) GetProcAddress(h,
+ "GetProcessMemoryInfo");
+ if (myEnumProcessModules && myGetModuleFileNameEx)
+ query = CW_GETPINFO_FULL;
+ else
+ snmp_log(LOG_ERR, "hr_swrun failed NT init\n");
+ } else
+ snmp_log(LOG_ERR, "hr_swrun failed to load psapi.dll\n");
+ } else {
+ h = GetModuleHandle("KERNEL32.DLL");
+ myCreateToolhelp32Snapshot =
+ (CREATESNAPSHOT) GetProcAddress(h, "CreateToolhelp32Snapshot");
+ myProcess32First =
+ (PROCESSWALK) GetProcAddress(h, "Process32First");
+ myProcess32Next = (PROCESSWALK) GetProcAddress(h, "Process32Next");
+ myEnumProcessModules = dummyprocessmodules;
+ myGetModuleFileNameEx = GetModuleFileNameEx95;
+ if (myCreateToolhelp32Snapshot && myProcess32First
+ && myProcess32Next)
+#if 0
+ /*
+ * This doesn't work after all on Win98 SE
+ */
+ query = CW_GETPINFO_FULL;
+#else
+ query = CW_GETPINFO;
+#endif
+ else
+ snmp_log(LOG_ERR, "hr_swrun failed non-NT init\n");
+ }
+#endif /* cygwin */
+#ifdef PROC_SYMBOL
+ auto_nlist(PROC_SYMBOL, 0, 0);
+#endif
+#ifdef NPROC_SYMBOL
+ auto_nlist(NPROC_SYMBOL, 0, 0);
+#endif
+
+ proc_table = 0;
+
+ REGISTER_MIB("host/hr_swrun", hrswrun_variables, variable4,
+ hrswrun_variables_oid);
+ REGISTER_MIB("host/hr_swrun", hrswrunperf_variables, variable4,
+ hrswrunperf_variables_oid);
+}
+
+/*
+ * header_hrswrun(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+
+int
+header_hrswrun(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRSWRUN_NAME_LENGTH 9
+ oid newname[MAX_OID_LEN];
+ int result;
+
+ DEBUGMSGTL(("host/hr_swrun", "var_hrswrun: "));
+ DEBUGMSGOID(("host/hr_swrun", name, *length));
+ DEBUGMSG(("host/hr_swrun", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+ newname[HRSWRUN_NAME_LENGTH] = 0;
+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+ if ((exact && (result != 0)) || (!exact && (result >= 0)))
+ return (MATCH_FAILED);
+ memcpy((char *) name, (char *) newname,
+ (vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+ return (MATCH_SUCCEEDED);
+}
+
+int
+header_hrswrunEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+#define HRSWRUN_ENTRY_NAME_LENGTH 11
+ oid newname[MAX_OID_LEN];
+ int pid, LowPid = -1;
+ int result;
+
+ DEBUGMSGTL(("host/hr_swrun", "var_hrswrunEntry: "));
+ DEBUGMSGOID(("host/hr_swrun", name, *length));
+ DEBUGMSG(("host/hr_swrun", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+
+ /*
+ * Find the "next" running process
+ */
+ Init_HR_SWRun();
+ for (;;) {
+ pid = Get_Next_HR_SWRun();
+#ifndef linux
+#ifndef dynix
+ DEBUGMSG(("host/hr_swrun",
+ "(index %d (entry #%d) ....", pid, current_proc_entry));
+#else
+ DEBUGMSG(("host/hr_swrun", "pid %d; nextproc %d ....", pid,
+ nextproc));
+#endif
+#endif
+ if (pid == -1)
+ break;
+ newname[HRSWRUN_ENTRY_NAME_LENGTH] = pid;
+ DEBUGMSGOID(("host/hr_swrun", newname, *length));
+ DEBUGMSG(("host/hr_swrun", "\n"));
+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+ if (exact && (result == 0)) {
+ LowPid = pid;
+#ifdef cygwin
+ lowproc = *curproc;
+#elif dynix
+ memcpy(&lowpsinfo, &mypsinfo, sizeof(prpsinfo_t));
+#elif !defined(linux)
+ LowProcIndex = current_proc_entry - 1;
+#endif
+ DEBUGMSGTL(("host/hr_swrun", " saved\n"));
+ /*
+ * Save process status information
+ */
+ break;
+ }
+ if ((!exact && (result < 0)) && (LowPid == -1 || pid < LowPid)) {
+ LowPid = pid;
+#ifdef cygwin
+ lowproc = *curproc;
+#elif !defined(linux)
+ LowProcIndex = current_proc_entry - 1;
+#endif
+ /*
+ * Save process status information
+ */
+ DEBUGMSG(("host/hr_swrun", " saved"));
+ }
+ DEBUGMSG(("host/hr_swrun", "\n"));
+ }
+ End_HR_SWRun();
+
+ if (LowPid == -1) {
+ DEBUGMSGTL(("host/hr_swrun", "... index out of range\n"));
+ return (MATCH_FAILED);
+ }
+
+ newname[HRSWRUN_ENTRY_NAME_LENGTH] = LowPid;
+ memcpy((char *) name, (char *) newname,
+ (vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+ DEBUGMSGTL(("host/hr_swrun", "... get process stats "));
+ DEBUGMSGOID(("host/hr_swrun", name, *length));
+ DEBUGMSG(("host/hr_swrun", "\n"));
+ return LowPid;
+}
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+
+u_char *
+var_hrswrun(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ int pid = 0;
+ static char string[1024];
+#ifdef HAVE_SYS_PSTAT_H
+ struct pst_status proc_buf;
+#elif defined(solaris2)
+#if _SLASH_PROC_METHOD_
+ static psinfo_t psinfo;
+ static psinfo_t *proc_buf;
+ int procfd;
+ int ret;
+ char procfn[sizeof "/proc/00000/psinfo"];
+#else
+ static struct proc *proc_buf;
+ char *cp1;
+#endif /* _SLASH_PROC_METHOD_ */
+ static time_t when = 0;
+ time_t now;
+ static int oldpid = -1;
+#endif
+#if HAVE_KVM_GETPROCS
+ char **argv;
+#endif
+#ifdef linux
+ FILE *fp;
+ char buf[1024];
+ int i;
+#endif
+ char *cp;
+
+ if (vp->magic == HRSWRUN_OSINDEX) {
+ if (header_hrswrun(vp, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+ } else {
+
+ pid =
+ header_hrswrunEntry(vp, name, length, exact, var_len,
+ write_method);
+ if (pid == MATCH_FAILED)
+ return NULL;
+ }
+
+#ifdef HAVE_SYS_PSTAT_H
+ if (pstat_getproc(&proc_buf, sizeof(struct pst_status), 0, pid) == -1)
+ return NULL;
+#elif defined(solaris2)
+ time(&now);
+ if (pid == oldpid) {
+ if (now != when)
+ oldpid = -1;
+ }
+ if (oldpid != pid || proc_buf == NULL) {
+#if _SLASH_PROC_METHOD_
+ proc_buf = &psinfo;
+ sprintf(procfn, "/proc/%.5d/psinfo", pid);
+ if ((procfd = open(procfn, O_RDONLY)) != -1) {
+ ret = read(procfd, proc_buf, sizeof(*proc_buf));
+ close(procfd);
+ if (ret != sizeof(*proc_buf))
+ proc_buf = NULL;
+ } else
+ proc_buf = NULL;
+#else
+ if (kd == NULL)
+ return NULL;
+ if ((proc_buf = kvm_getproc(kd, pid)) == NULL)
+ return NULL;
+#endif
+ oldpid = pid;
+ when = now;
+ }
+#endif
+
+ switch (vp->magic) {
+ case HRSWRUN_OSINDEX:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#else
+ /*
+ * per dts, on coders:
+ * cos (in general) we won't know which process should
+ * be regarded as "the primary O/S process".
+ * The most obvious candidate on a Unix box is probably 'init'
+ * which is typically (always?) process #1.
+ */
+ long_return = 1; /* Probably! */
+ return (u_char *) & long_return;
+#endif
+
+ case HRSWRUN_INDEX:
+ long_return = pid;
+ return (u_char *) & long_return;
+ case HRSWRUN_NAME:
+#ifdef HAVE_SYS_PSTAT_H
+ snprintf(string, sizeof(string), "%s", proc_buf.pst_cmd);
+ string[ sizeof(string)-1 ] = 0;
+ cp = strchr(string, ' ');
+ if (cp != NULL)
+ *cp = '\0';
+#elif defined(dynix)
+ snprintf(string, sizeof(string), "%s", lowpsinfo.pr_fname);
+ string[ sizeof(string)-1 ] = 0;
+ cp = strchr(string, ' ');
+ if (cp != NULL)
+ *cp = '\0';
+#elif defined(solaris2)
+#if _SLASH_PROC_METHOD_
+ if (proc_buf) {
+ char *pos=strchr(proc_buf->pr_psargs,' ');
+ if (pos != NULL) *pos = '\0';
+ strlcpy(string, basename(proc_buf->pr_psargs),sizeof(string));
+ if (pos != NULL) *pos=' ';
+ } else {
+ strcpy(string, "<exited>");
+ }
+ string[ sizeof(string)-1 ] = 0;
+#else
+ strncpy(string, proc_buf->p_user.u_comm, sizeof(string));
+ string[ sizeof(string)-1 ] = 0;
+#endif
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+ strncpy(string, proc_table[LowProcIndex].pi_comm, sizeof(string));
+ string[ sizeof(string)-1 ] = 0;
+ cp = strchr(string, ' ');
+ if (cp != NULL)
+ *cp = '\0';
+#elif HAVE_KVM_GETPROCS
+ #if defined(freebsd5) && __FreeBSD_version >= 500014
+ strcpy(string, proc_table[LowProcIndex].ki_comm);
+ #else
+ strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm);
+ #endif
+#elif defined(linux)
+ sprintf(string, "/proc/%d/status", pid);
+ if ((fp = fopen(string, "r")) == NULL) {
+ strcpy(string, "<exited>");
+ *var_len = strlen(string);
+ return (u_char *) string;
+ }
+ fgets(buf, sizeof(buf), fp); /* Name: process name */
+ cp = buf;
+ while (*cp != ':')
+ ++cp;
+ ++cp;
+ while (isspace(*cp))
+ ++cp;
+ strcpy(string, cp);
+ fclose(fp);
+#elif defined(cygwin)
+ /* if (lowproc.process_state & (PID_ZOMBIE | PID_EXITED)) */
+ if (lowproc.process_state & PID_EXITED || (lowproc.exitcode & ~0xffff))
+ strcpy(string, "<defunct>");
+ else if (lowproc.ppid) {
+ cygwin_conv_to_posix_path(lowproc.progname, string);
+ cp = strrchr(string, '/');
+ if (cp)
+ strcpy(string, cp + 1);
+ } else if (query == CW_GETPINFO_FULL) {
+ DWORD n = lowproc.dwProcessId & 0xffff;
+ HANDLE h =
+ OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
+ FALSE, n);
+
+ if (h) {
+ HMODULE hm[1000];
+ if (!myEnumProcessModules(h, hm, sizeof hm, &n)) {
+ snmp_log(LOG_DEBUG, "no module handle for %lu\n", n);
+ n = 0;
+ }
+ if (n
+ && myGetModuleFileNameEx(h, hm[0], string,
+ sizeof string)) {
+ cp = strrchr(string, '\\');
+ if (cp)
+ strcpy(string, cp + 1);
+ } else
+ strcpy(string, "*** unknown");
+ CloseHandle(h);
+ } else {
+ snmp_log(LOG_INFO, "no process handle for %lu\n", n);
+ strcpy(string, "** unknown");
+ }
+ } else
+ strcpy(string, "* unknown");
+ cp = strchr(string, '\0') - 4;
+ if (cp > string && strcasecmp(cp, ".exe") == 0)
+ *cp = '\0';
+#else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ sprintf(string, "process name");
+#endif
+ *var_len = strlen(string);
+ /*
+ * remove trailing newline
+ */
+ if (*var_len) {
+ cp = string + *var_len - 1;
+ if (*cp == '\n')
+ --(*var_len);
+ }
+ if (*var_len > 64) { /* MIB limit */
+ *var_len = 64;
+ string[64] = '\0';
+ }
+ return (u_char *) string;
+ case HRSWRUN_ID:
+ *var_len = nullOidLen;
+ return (u_char *) nullOid;
+ case HRSWRUN_PATH:
+#ifdef HAVE_SYS_PSTAT_H
+ /*
+ * Path not available - use argv[0]
+ */
+ sprintf(string, "%s", proc_buf.pst_cmd);
+ cp = strchr(string, ' ');
+ if (cp != NULL)
+ *cp = '\0';
+#elif defined(dynix)
+ /*
+ * Path not available - use argv[0]
+ */
+ sprintf(string, "%s", lowpsinfo.pr_psargs);
+ cp = strchr(string, ' ');
+ if (cp != NULL)
+ *cp = '\0';
+#elif defined(solaris2)
+#ifdef _SLASH_PROC_METHOD_
+ if (proc_buf)
+ strcpy(string, proc_buf->pr_psargs);
+ else
+ sprintf(string, "<exited>");
+ cp = strchr(string, ' ');
+ if (cp)
+ *cp = 0;
+#else
+ cp = proc_buf->p_user.u_psargs;
+ cp1 = string;
+ while (*cp && *cp != ' ')
+ *cp1++ = *cp++;
+ *cp1 = 0;
+#endif
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+ strncpy(string, proc_table[LowProcIndex].pi_comm, sizeof(string));
+ string[ sizeof(string)-1 ] = 0;
+ cp = strchr(string, ' ');
+ if (cp != NULL)
+ *cp = '\0';
+#elif HAVE_KVM_GETPROCS
+ #if defined(freebsd5) && __FreeBSD_version >= 500014
+ strcpy(string, proc_table[LowProcIndex].ki_comm);
+ #else
+ strcpy(string, proc_table[LowProcIndex].kp_proc.p_comm);
+ #endif
+#elif defined(linux)
+ sprintf(string, "/proc/%d/cmdline", pid);
+ if ((fp = fopen(string, "r")) == NULL) {
+ strcpy(string, "<exited>");
+ *var_len = strlen(string);
+ return (u_char *) string;
+ }
+ if (fgets(buf, sizeof(buf) - 1, fp)) /* argv[0] '\0' argv[1] '\0' .... */
+ strcpy(string, buf);
+ else {
+ /*
+ * swapped out - no cmdline
+ */
+ fclose(fp);
+ sprintf(string, "/proc/%d/status", pid);
+ if ((fp = fopen(string, "r")) == NULL)
+ return NULL;
+ fgets(buf, sizeof(buf), fp); /* Name: process name */
+ if ( cp == NULL ) {
+ fclose(fp);
+ return NULL; /* the process probably died */
+ }
+ cp = strchr(buf, ':');
+ if ( cp == NULL ) {
+ fclose(fp);
+ return NULL; /* the process file is malformed */
+ }
+ ++cp;
+ while (isspace(*cp))
+ ++cp;
+ strcpy(string, cp);
+ cp = strchr(string, '\n');
+ if (cp)
+ *cp = 0;
+ }
+ fclose(fp);
+#elif defined(cygwin)
+ /* if (lowproc.process_state & (PID_ZOMBIE | PID_EXITED)) */
+ if (lowproc.process_state & PID_EXITED || (lowproc.exitcode & ~0xffff))
+ strcpy(string, "<defunct>");
+ else if (lowproc.ppid)
+ cygwin_conv_to_posix_path(lowproc.progname, string);
+ else if (query == CW_GETPINFO_FULL) {
+ DWORD n = lowproc.dwProcessId & 0xFFFF;
+ HANDLE h =
+ OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
+ FALSE, n);
+ if (h) {
+ HMODULE hm[1000];
+ if (!myEnumProcessModules(h, hm, sizeof hm, &n))
+ n = 0;
+ if (!n
+ || !myGetModuleFileNameEx(h, hm[0], string,
+ sizeof string))
+ strcpy(string, "*** unknown");
+ CloseHandle(h);
+ } else
+ strcpy(string, "** unknown");
+ } else
+ strcpy(string, "* unknown");
+#else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ sprintf(string, "/bin/wombat");
+#endif
+ *var_len = strlen(string);
+ if (*var_len > 128) { /* MIB limit */
+ *var_len = 128;
+ string[128] = '\0';
+ }
+ return (u_char *) string;
+ case HRSWRUN_PARAMS:
+#ifdef HAVE_SYS_PSTAT_H
+ cp = strchr(proc_buf.pst_cmd, ' ');
+ if (cp != NULL) {
+ cp++;
+ sprintf(string, "%s", cp);
+ } else
+ string[0] = '\0';
+#elif defined(dynix)
+ cp = strchr(lowpsinfo.pr_psargs, ' ');
+ if (cp != NULL) {
+ cp++;
+ sprintf(string, "%s", cp);
+ } else
+ string[0] = '\0';
+#elif defined(solaris2)
+#ifdef _SLASH_PROC_METHOD_
+ if (proc_buf) {
+ cp = strchr(proc_buf->pr_psargs, ' ');
+ if (cp)
+ strcpy(string, cp + 1);
+ else
+ string[0] = 0;
+ } else
+ string[0] = 0;
+#else
+ cp = proc_buf->p_user.u_psargs;
+ while (*cp && *cp != ' ')
+ cp++;
+ if (*cp == ' ')
+ cp++;
+ strcpy(string, cp);
+#endif
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+ cp = strchr(proc_table[LowProcIndex].pi_comm, ' ');
+ if (cp != NULL) {
+ cp++;
+ sprintf(string, "%s", cp);
+ } else
+ string[0] = '\0';
+#elif HAVE_KVM_GETPROCS
+ string[0] = 0;
+ argv = kvm_getargv(kd, proc_table + LowProcIndex, sizeof(string));
+ if (argv)
+ argv++;
+ while (argv && *argv) {
+ if (string[0] != 0)
+ strcat(string, " ");
+ strcat(string, *argv);
+ argv++;
+ }
+#elif defined(linux)
+ sprintf(string, "/proc/%d/cmdline", pid);
+ if ((fp = fopen(string, "r")) == NULL) {
+ strcpy(string, "");
+ *var_len = 0;
+ return (u_char *) string;
+ }
+ memset(buf, 0, sizeof(buf));
+
+ /*
+ * argv[0] '\0' argv[1] '\0' ....
+ */
+ if (!fgets(buf, sizeof(buf) - 2, fp)) {
+ /*
+ * maybe be empty (even argv[0] is missing)
+ */
+ string[0] = '\0';
+ *var_len = 0;
+ fclose(fp);
+ return string;
+ }
+
+ /*
+ * Skip over argv[0]
+ */
+ cp = buf;
+ while (*cp)
+ ++cp;
+ ++cp;
+ /*
+ * Now join together separate arguments.
+ */
+ while (1) {
+ while (*cp)
+ ++cp;
+ if (*(cp + 1) == '\0')
+ break; /* '\0''\0' => End of command line */
+ *cp = ' ';
+ }
+
+ cp = buf;
+ while (*cp)
+ ++cp;
+ ++cp;
+ strcpy(string, cp);
+ fclose(fp);
+#elif defined(cygwin)
+ string[0] = 0;
+#else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ sprintf(string, "-h -q -v");
+#endif
+ *var_len = strlen(string);
+ if (*var_len > 128) { /* MIB limit */
+ *var_len = 128;
+ string[128] = '\0';
+ }
+ return (u_char *) string;
+ case HRSWRUN_TYPE:
+#ifdef PID_MAXSYS
+ if (pid < PID_MAXSYS)
+ long_return = 2; /* operatingSystem */
+ else
+ long_return = 4; /* application */
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+ if (proc_table[LowProcIndex].pi_flags & SKPROC) {
+ long_return = 2; /* kernel process */
+ } else
+ long_return = 4; /* application */
+#elif HAVE_KVM_GETPROCS
+ #if defined(freebsd5) && __FreeBSD_version >= 500014
+ if (proc_table[LowProcIndex].ki_flag & P_SYSTEM) {
+ if (proc_table[LowProcIndex].ki_pri.pri_class == PRI_ITHD)
+ long_return = 3;/* deviceDriver */
+ else
+ long_return = 2;/* operatingSystem */
+ } else
+ long_return = 4; /* application */
+ #else
+ if (proc_table[LowProcIndex].kp_proc.p_flag & P_SYSTEM)
+ long_return = 2; /* operatingSystem */
+ else
+ long_return = 4; /* application */
+ #endif
+#else
+ long_return = 4; /* application */
+#endif
+ return (u_char *) & long_return;
+ case HRSWRUN_STATUS:
+#if defined(cygwin)
+ if (lowproc.process_state & PID_STOPPED)
+ long_return = 3; /* notRunnable */
+ /* else if (lowproc.process_state & PID_ZOMBIE) */
+ else if (lowproc.exitcode & ~0xffff)
+ long_return = 4; /* invalid */
+ else
+ long_return = 1; /* running */
+#elif !defined(linux)
+#if defined(hpux10) || defined(hpux11)
+ switch (proc_table[LowProcIndex].pst_stat) {
+ case PS_STOP:
+ long_return = 3; /* notRunnable */
+ break;
+ case PS_SLEEP:
+ long_return = 2; /* runnable */
+ break;
+ case PS_RUN:
+ long_return = 1; /* running */
+ break;
+ case PS_ZOMBIE:
+ case PS_IDLE:
+ case PS_OTHER:
+ default:
+ long_return = 4; /* invalid */
+ break;
+ }
+#else
+#if HAVE_KVM_GETPROCS
+ #if defined(freebsd5) && __FreeBSD_version >= 500014
+ switch (proc_table[LowProcIndex].ki_stat) {
+ #else
+ switch (proc_table[LowProcIndex].kp_proc.p_stat) {
+ #endif
+#elif defined(dynix)
+ switch (lowpsinfo.pr_state) {
+#elif defined(solaris2)
+#if _SLASH_PROC_METHOD_
+ switch (proc_buf ? proc_buf->pr_lwp.pr_state : SIDL) {
+#else
+ switch (proc_buf->p_stat) {
+#endif
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+ switch (proc_table[LowProcIndex].pi_state) {
+#else
+ switch (proc_table[LowProcIndex].p_stat) {
+#endif
+ case SSTOP:
+ long_return = 3; /* notRunnable */
+ break;
+ case 0:
+#ifdef SSWAP
+ case SSWAP:
+#endif
+#ifdef SSLEEP
+ case SSLEEP:
+#endif
+#ifdef SWAIT
+ case SWAIT:
+#endif
+ long_return = 2; /* runnable */
+ break;
+#ifdef SACTIVE
+ case SACTIVE:
+#endif
+#ifdef SRUN
+ case SRUN:
+#endif
+#ifdef SONPROC
+ case SONPROC:
+#endif
+ long_return = 1; /* running */
+ break;
+ case SIDL:
+ case SZOMB:
+ default:
+ long_return = 4; /* invalid */
+ break;
+ }
+#endif
+#else
+ sprintf(string, "/proc/%d/stat", pid);
+ if ((fp = fopen(string, "r")) != NULL) {
+ fgets(buf, sizeof(buf), fp);
+ cp = buf;
+ for (i = 0; i < 2; ++i) { /* skip two fields */
+ while (*cp != ' ')
+ ++cp;
+ ++cp;
+ }
+
+ switch (*cp) {
+ case 'R':
+ long_return = 1; /* running */
+ break;
+ case 'S':
+ long_return = 2; /* runnable */
+ break;
+ case 'D':
+ case 'T':
+ long_return = 3; /* notRunnable */
+ break;
+ case 'Z':
+ default:
+ long_return = 4; /* invalid */
+ break;
+ }
+ fclose(fp);
+ } else
+ long_return = 4; /* invalid */
+#endif
+ return (u_char *) & long_return;
+
+ case HRSWRUNPERF_CPU:
+#ifdef HAVE_SYS_PSTAT_H
+ long_return = proc_buf.pst_cptickstotal;
+ /*
+ * Not convinced this is right, but....
+ */
+#elif defined(dynix)
+ long_return = lowpsinfo.pr_time.tv_sec * 100 +
+ lowpsinfo.pr_time.tv_nsec / 10000000;
+#elif defined(solaris2)
+#if _SLASH_PROC_METHOD_
+ long_return = proc_buf ? proc_buf->pr_time.tv_sec * 100 +
+ proc_buf->pr_time.tv_nsec / 10000000 : 0;
+#else
+ long_return = proc_buf->p_utime * 100 + proc_buf->p_stime * 100;
+#endif
+#elif HAVE_KVM_GETPROCS
+ #if defined(NOT_DEFINED) && defined(freebsd5) && __FreeBSD_version >= 500014
+ /* XXX: Accessing ki_paddr causes sig10 ...
+ long_return = proc_table[LowProcIndex].ki_paddr->p_uticks +
+ proc_table[LowProcIndex].ki_paddr->p_sticks +
+ proc_table[LowProcIndex].ki_paddr->p_iticks; */
+ long_return = 0;
+ #elif defined(freebsd5)
+ long_return = proc_table[LowProcIndex].ki_runtime / 100000;
+ #else
+ long_return = proc_table[LowProcIndex].kp_proc.p_uticks +
+ proc_table[LowProcIndex].kp_proc.p_sticks +
+ proc_table[LowProcIndex].kp_proc.p_iticks;
+ #endif
+#elif defined(linux)
+ sprintf(string, "/proc/%d/stat", pid);
+ if ((fp = fopen(string, "r")) == NULL) {
+ long_return = 0;
+ return (u_char *) & long_return;
+ }
+ fgets(buf, sizeof(buf), fp);
+ cp = buf;
+ for (i = 0; i < 13; ++i) { /* skip 13 fields */
+ while (*cp != ' ')
+ ++cp;
+ ++cp;
+ }
+
+ long_return = atoi(cp); /* utime */
+
+ while (*cp != ' ')
+ ++cp;
+ ++cp;
+ long_return += atoi(cp); /* + stime */
+ fclose(fp);
+#elif defined(sunos4)
+ long_return = proc_table[LowProcIndex].p_time;
+#elif defined(cygwin)
+ {
+ DWORD n = lowproc.dwProcessId;
+ HANDLE h =
+ OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
+ FALSE, n);
+ FILETIME ct, et, kt, ut;
+
+ if (h) {
+ if (GetProcessTimes(h, &ct, &et, &kt, &ut))
+ long_return = (to_msec(&kt) + to_msec(&ut)) / 10;
+ else {
+ snmp_log(LOG_INFO, "no process times for %lu (%lu)\n",
+ lowproc.pid, n);
+ long_return = 0;
+ }
+ CloseHandle(h);
+ } else {
+ snmp_log(LOG_INFO, "no process handle for %lu (%lu)\n",
+ lowproc.pid, n);
+ long_return = 0;
+ }
+ }
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+ long_return = proc_table[LowProcIndex].pi_ru.ru_utime.tv_sec * 100 +
+ proc_table[LowProcIndex].pi_ru.ru_utime.tv_usec / 10000000 + /* nanoseconds */
+ proc_table[LowProcIndex].pi_ru.ru_stime.tv_sec * 100 +
+ proc_table[LowProcIndex].pi_ru.ru_stime.tv_usec / 10000000; /* nanoseconds */
+#else
+ long_return = proc_table[LowProcIndex].p_utime.tv_sec * 100 +
+ proc_table[LowProcIndex].p_utime.tv_usec / 10000 +
+ proc_table[LowProcIndex].p_stime.tv_sec * 100 +
+ proc_table[LowProcIndex].p_stime.tv_usec / 10000;
+#endif
+ return (u_char *) & long_return;
+ case HRSWRUNPERF_MEM:
+#ifdef HAVE_SYS_PSTAT_H
+# ifdef PGSHIFT
+ long_return = (proc_buf.pst_rssize << PGSHIFT) / 1024;
+# else
+ long_return = proc_buf.pst_rssize * getpagesize() / 1024;
+# endif
+#elif defined(dynix)
+ long_return = (lowpsinfo.pr_rssize * MMU_PAGESIZE) / 1024;
+#elif defined(solaris2)
+#if _SLASH_PROC_METHOD_
+ long_return = proc_buf ? proc_buf->pr_rssize : 0;
+#else
+ long_return = proc_buf->p_swrss;
+#endif
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+ long_return = proc_table[LowProcIndex].pi_size * getpagesize() / 1024;
+#elif HAVE_KVM_GETPROCS && !defined(darwin8)
+ #if defined(NOT_DEFINED) && defined(freebsd5) && __FreeBSD_version >= 500014
+ /* XXX
+ long_return = proc_table[LowProcIndex].ki_vmspace->vm_tsize +
+ proc_table[LowProcIndex].ki_vmspace->vm_ssize +
+ proc_table[LowProcIndex].ki_vmspace->vm_dsize;
+ long_return = long_return * (getpagesize() / 1024); */
+ long_return = 0;
+ #elif defined(freebsd3) && !defined(darwin)
+ long_return =
+ #if defined(freebsd5)
+ proc_table[LowProcIndex].ki_size / 1024;
+ #else
+ proc_table[LowProcIndex].kp_eproc.e_vm.vm_map.size / 1024;
+ #endif
+ #else
+ long_return = proc_table[LowProcIndex].kp_eproc.e_vm.vm_tsize +
+ proc_table[LowProcIndex].kp_eproc.e_vm.vm_ssize +
+ proc_table[LowProcIndex].kp_eproc.e_vm.vm_dsize;
+ long_return = long_return * (getpagesize() / 1024);
+ #endif
+#elif defined(linux)
+ sprintf(string, "/proc/%d/stat", pid);
+ if ((fp = fopen(string, "r")) == NULL) {
+ long_return = 0;
+ return (u_char *) & long_return;
+ }
+ fgets(buf, sizeof(buf), fp);
+ cp = buf;
+ for (i = 0; i < 23; ++i) { /* skip 23 fields */
+ while (*cp != ' ')
+ ++cp;
+ ++cp;
+ }
+ long_return = atoi(cp) * (getpagesize() / 1024); /* rss */
+ fclose(fp);
+#elif defined(cygwin)
+ {
+ DWORD n = lowproc.dwProcessId;
+ HANDLE h =
+ OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
+ FALSE, n);
+ PROCESS_MEMORY_COUNTERS pmc;
+
+ if (h) {
+ if (myGetProcessMemoryInfo
+ && myGetProcessMemoryInfo(h, &pmc, sizeof pmc))
+ long_return = pmc.WorkingSetSize / 1024;
+ else {
+ snmp_log(LOG_INFO, "no process times for %lu (%lu)\n",
+ lowproc.pid, n);
+ long_return = 0;
+ }
+ CloseHandle(h);
+ } else {
+ snmp_log(LOG_INFO, "no process handle for %lu (%lu)\n",
+ lowproc.pid, n);
+ long_return = 0;
+ }
+ }
+#else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = 16 * 1024; /* XXX - 16M! */
+#endif
+ return (u_char *) & long_return;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrswrun\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+#if defined(linux)
+
+DIR *procdir = NULL;
+struct dirent *procentry_p;
+
+void
+Init_HR_SWRun(void)
+{
+ if (procdir != NULL)
+ closedir(procdir);
+ procdir = opendir("/proc");
+}
+
+int
+Get_Next_HR_SWRun(void)
+{
+ int pid;
+ if (procdir == NULL)
+ return -1;
+ procentry_p = readdir(procdir);
+
+ if (procentry_p == NULL)
+ return -1;
+
+ pid = atoi(procentry_p->d_name);
+ if (pid == 0)
+ return (Get_Next_HR_SWRun());
+ return pid;
+}
+
+void
+End_HR_SWRun(void)
+{
+ if (procdir)
+ closedir(procdir);
+ procdir = NULL;
+}
+
+#elif defined(cygwin)
+
+static pid_t curpid;
+
+void
+Init_HR_SWRun(void)
+{
+ cygwin_internal(CW_LOCK_PINFO, 1000);
+ curpid = 0;
+}
+
+int
+Get_Next_HR_SWRun(void)
+{
+ curproc =
+ (struct external_pinfo *) cygwin_internal(query,
+ curpid | CW_NEXTPID);
+ if (curproc)
+ curpid = curproc->pid;
+ else {
+ curpid = -1;
+ }
+ return curpid;
+}
+
+void
+End_HR_SWRun(void)
+{
+ cygwin_internal(CW_UNLOCK_PINFO);
+}
+
+#elif defined(dynix)
+
+void
+Init_HR_SWRun(void)
+{
+ nextproc = 0;
+}
+
+int
+Get_Next_HR_SWRun(void)
+{
+ getprpsinfo_t *select = 0;
+
+ DEBUGMSGTL(("host/hr_swrun::GetNextHR_SWRun",
+ "nextproc == %d... &nextproc = %u\n", nextproc,
+ &nextproc));
+ if ((nextproc = getprpsinfo(nextproc, select, &mypsinfo)) < 0) {
+ return -1;
+ } else {
+ DEBUGMSGTL(("host/hr_swrun::GetNextHR_SWRun",
+ "getprpsinfo returned %d\n", nextproc));
+ return mypsinfo.pr_pid;
+ }
+
+}
+
+void
+End_HR_SWRun(void)
+{
+ /*
+ * just a stub... because it's declared
+ */
+}
+
+#else /* linux */
+
+static int nproc;
+
+void
+Init_HR_SWRun(void)
+{
+ size_t bytes;
+ static time_t iwhen = 0;
+ time_t now;
+
+ time(&now);
+ if (now == iwhen) {
+ current_proc_entry = 0;
+ return;
+ }
+ iwhen = now;
+
+#if defined(hpux10) || defined(hpux11)
+ pstat_getdynamic(&pst_dyn, sizeof(struct pst_dynamic), 1, 0);
+ nproc = pst_dyn.psd_activeprocs;
+ bytes = nproc * sizeof(struct pst_status);
+ if ((proc_table =
+ (struct pst_status *) realloc(proc_table, bytes)) == NULL) {
+ current_proc_entry = nproc + 1;
+ return;
+ }
+ pstat_getproc(proc_table, sizeof(struct pst_status), nproc, 0);
+
+#elif defined(solaris2)
+ if (getKstatInt("unix", "system_misc", "nproc", &nproc)) {
+ current_proc_entry = nproc + 1;
+ return;
+ }
+ bytes = nproc * sizeof(int);
+ if ((proc_table = (int *) realloc(proc_table, bytes)) == NULL) {
+ current_proc_entry = nproc + 1;
+ return;
+ }
+ {
+ DIR *f;
+ struct dirent *dp;
+#if _SLASH_PROC_METHOD_ == 0
+ if (kd == NULL) {
+ current_proc_entry = nproc + 1;
+ return;
+ }
+#endif
+ f = opendir("/proc");
+ current_proc_entry = 0;
+ while ((dp = readdir(f)) != NULL && current_proc_entry < nproc)
+ if (dp->d_name[0] != '.')
+ proc_table[current_proc_entry++] = atoi(dp->d_name);
+ /*
+ * if we are in a Solaris zone, nproc > current_proc_entry !
+ * but we only want the processes from the local zone
+ */
+ if (current_proc_entry != nproc)
+ nproc = current_proc_entry;
+ closedir(f);
+ }
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+ {
+ pid_t proc_index = 0;
+ int avail = 1024;
+ if (proc_table) {
+ free(proc_table);
+ }
+ nproc = 0;
+ proc_table = malloc(sizeof(proc_table[0]) * avail);
+ for (;;) {
+ int got;
+ if (!proc_table) {
+ nproc = 0;
+ snmp_log_perror("Init_HR_SWRun-malloc");
+ return;
+ }
+ got = getprocs(proc_table + nproc, sizeof(proc_table[0]),
+ 0, sizeof(struct fdsinfo),
+ &proc_index, avail - nproc);
+ nproc += got;
+ if (nproc < avail) {
+ break;
+ }
+ avail += 1024;
+ proc_table = realloc(proc_table, avail * sizeof(proc_table[0]));
+ }
+ }
+#elif HAVE_KVM_GETPROCS
+ {
+ if (kd == NULL) {
+ nproc = 0;
+ return;
+ }
+ proc_table = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc);
+ }
+#else
+
+ current_proc_entry = 1;
+#ifndef bsdi2
+ nproc = 0;
+
+ if (auto_nlist(NPROC_SYMBOL, (char *) &nproc, sizeof(int)) == 0) {
+ snmp_log_perror("Init_HR_SWRun-auto_nlist NPROC");
+ return;
+ }
+#endif
+ bytes = nproc * sizeof(struct proc);
+
+ if (proc_table)
+ free((char *) proc_table);
+ if ((proc_table = (struct proc *) malloc(bytes)) == NULL) {
+ nproc = 0;
+ snmp_log_perror("Init_HR_SWRun-malloc");
+ return;
+ }
+
+ {
+ int proc_table_base;
+ if (auto_nlist
+ (PROC_SYMBOL, (char *) &proc_table_base,
+ sizeof(proc_table_base)) == 0) {
+ nproc = 0;
+ snmp_log_perror("Init_HR_SWRun-auto_nlist PROC");
+ return;
+ }
+ if (NETSNMP_KLOOKUP(proc_table_base, (char *) proc_table, bytes) == 0) {
+ nproc = 0;
+ snmp_log_perror("Init_HR_SWRun-klookup");
+ return;
+ }
+ }
+#endif
+ current_proc_entry = 0;
+}
+
+int
+Get_Next_HR_SWRun(void)
+{
+ while (current_proc_entry < nproc) {
+#if defined(hpux10) || defined(hpux11)
+ return proc_table[current_proc_entry++].pst_pid;
+#elif defined(solaris2)
+ return proc_table[current_proc_entry++];
+#elif HAVE_KVM_GETPROCS
+ #if defined(freebsd5) && __FreeBSD_version >= 500014
+ if (proc_table[current_proc_entry].ki_stat != 0)
+ return proc_table[current_proc_entry++].ki_pid;
+ #else
+ if (proc_table[current_proc_entry].kp_proc.p_stat != 0)
+ return proc_table[current_proc_entry++].kp_proc.p_pid;
+ #endif
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+ if (proc_table[current_proc_entry].pi_state != 0)
+ return proc_table[current_proc_entry++].pi_pid;
+ else
+ ++current_proc_entry;
+#else
+ if (proc_table[current_proc_entry].p_stat != 0)
+ return proc_table[current_proc_entry++].p_pid;
+ else
+ ++current_proc_entry;
+#endif
+
+ }
+ return -1;
+}
+
+void
+End_HR_SWRun(void)
+{
+ current_proc_entry = nproc + 1;
+}
+#endif
+
+int
+count_processes(void)
+{
+#if !(defined(linux) || defined(cygwin) || defined(hpux10) || defined(hpux11) || defined(solaris2) || HAVE_KVM_GETPROCS || defined(dynix))
+ int i;
+#endif
+ int total = 0;
+
+ Init_HR_SWRun();
+#if defined(hpux10) || defined(hpux11) || HAVE_KVM_GETPROCS || defined(solaris2)
+ total = nproc;
+#else
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ for (i = 0; i < nproc; ++i) {
+ if (proc_table[i].pi_state != 0)
+#elif !defined(linux) && !defined(cygwin) && !defined(dynix)
+ for (i = 0; i < nproc; ++i) {
+ if (proc_table[i].p_stat != 0)
+#else
+ while (Get_Next_HR_SWRun() != -1) {
+#endif
+ ++total;
+ }
+#endif /* !hpux10 && !hpux11 && !HAVE_KVM_GETPROCS && !solaris2 */
+ End_HR_SWRun();
+ return total;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_swrun.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_swrun.h
new file mode 100644
index 0000000000..ce19629282
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_swrun.h
@@ -0,0 +1,13 @@
+/*
+ * Host Resources MIB - Running Software group interface - hr_swrun.h
+ * (also includes Running Software Performance group )
+ *
+ */
+#ifndef _MIBGROUP_HRSWRUN_H
+#define _MIBGROUP_HRSWRUN_H
+
+extern void init_hr_swrun(void);
+extern FindVarMethod var_hrswrun;
+
+
+#endif /* _MIBGROUP_HRSWRUN_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_system.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_system.c
new file mode 100644
index 0000000000..6d6afb56dd
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_system.c
@@ -0,0 +1,681 @@
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+/*
+ * Host Resources MIB - system group implementation - hr_system.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "host.h"
+#include "host_res.h"
+#include "hr_system.h"
+#include <net-snmp/agent/auto_nlist.h>
+
+#ifdef HAVE_SYS_PROC_H
+#include <sys/param.h>
+#include "sys/proc.h"
+#endif
+#ifndef mingw32
+#if HAVE_UTMPX_H
+#include <utmpx.h>
+#else
+#include <utmp.h>
+#endif
+#endif /* mingw32 */
+#include <signal.h>
+#include <errno.h>
+
+#ifdef WIN32
+#include <lm.h>
+#endif
+
+#ifdef linux
+#ifdef HAVE_LINUX_TASKS_H
+#include <linux/tasks.h>
+#else
+/*
+ * If this file doesn't exist, then there is no hard limit on the number
+ * of processes, so return 0 for hrSystemMaxProcesses.
+ */
+#define NR_TASKS 0
+#endif
+#endif
+
+#if defined(hpux10) || defined(hpux11)
+#include <sys/pstat.h>
+#endif
+
+#if defined(solaris2)
+#include <kstat.h>
+#include <sys/var.h>
+#include <time.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/openpromio.h>
+#endif
+
+#ifdef HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+
+#if !defined(UTMP_FILE) && defined(_PATH_UTMP)
+#define UTMP_FILE _PATH_UTMP
+#endif
+
+#if defined(UTMP_FILE) && !HAVE_UTMPX_H
+void setutent(void);
+void endutent(void);
+struct utmp *getutent(void);
+#endif /* UTMP_FILE */
+
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+#if defined(solaris2)
+static struct openpromio * op_malloc(size_t size);
+static void op_free(struct openpromio *op);
+static int set_solaris_bootcommand_parameter(int action, u_char * var_val, u_char var_val_type, size_t var_val_len, u_char * statP, oid * name, size_t name_len);
+static int set_solaris_eeprom_parameter(const char *key, const char *value, size_t value_len);
+static int get_solaris_eeprom_parameter(const char *parameter, char *output);
+static long get_max_solaris_processes(void);
+#endif
+static int get_load_dev(void);
+static int count_users(void);
+extern int count_processes(void);
+
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+
+#define HRSYS_UPTIME 1
+#define HRSYS_DATE 2
+#define HRSYS_LOAD_DEV 3
+#define HRSYS_LOAD_PARAM 4
+#define HRSYS_USERS 5
+#define HRSYS_PROCS 6
+#define HRSYS_MAXPROCS 7
+
+#if defined(solaris2)
+struct variable2 hrsystem_variables[] = {
+ {HRSYS_UPTIME, ASN_TIMETICKS, RONLY, var_hrsys, 1, {1}},
+ {HRSYS_DATE, ASN_OCTET_STR, RWRITE, var_hrsys, 1, {2}},
+ {HRSYS_LOAD_DEV, ASN_INTEGER, RONLY, var_hrsys, 1, {3}},
+ {HRSYS_LOAD_PARAM, ASN_OCTET_STR, RWRITE, var_hrsys, 1, {4}},
+ {HRSYS_USERS, ASN_GAUGE, RONLY, var_hrsys, 1, {5}},
+ {HRSYS_PROCS, ASN_GAUGE, RONLY, var_hrsys, 1, {6}},
+ {HRSYS_MAXPROCS, ASN_INTEGER, RONLY, var_hrsys, 1, {7}}
+};
+#else
+struct variable2 hrsystem_variables[] = {
+ {HRSYS_UPTIME, ASN_TIMETICKS, RONLY, var_hrsys, 1, {1}},
+ {HRSYS_DATE, ASN_OCTET_STR, RONLY, var_hrsys, 1, {2}},
+ {HRSYS_LOAD_DEV, ASN_INTEGER, RONLY, var_hrsys, 1, {3}},
+ {HRSYS_LOAD_PARAM, ASN_OCTET_STR, RONLY, var_hrsys, 1, {4}},
+ {HRSYS_USERS, ASN_GAUGE, RONLY, var_hrsys, 1, {5}},
+ {HRSYS_PROCS, ASN_GAUGE, RONLY, var_hrsys, 1, {6}},
+ {HRSYS_MAXPROCS, ASN_INTEGER, RONLY, var_hrsys, 1, {7}}
+};
+#endif
+oid hrsystem_variables_oid[] = { 1, 3, 6, 1, 2, 1, 25, 1 };
+
+
+void
+init_hr_system(void)
+{
+#ifdef NPROC_SYMBOL
+ auto_nlist(NPROC_SYMBOL, 0, 0);
+#endif
+
+ REGISTER_MIB("host/hr_system", hrsystem_variables, variable2,
+ hrsystem_variables_oid);
+} /* end init_hr_system */
+
+/*
+ * header_hrsys(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ */
+
+int
+header_hrsys(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define HRSYS_NAME_LENGTH 9
+ oid newname[MAX_OID_LEN];
+ int result;
+
+ DEBUGMSGTL(("host/hr_system", "var_hrsys: "));
+ DEBUGMSGOID(("host/hr_system", name, *length));
+ DEBUGMSG(("host/hr_system", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name, vp->namelen * sizeof(oid));
+ newname[HRSYS_NAME_LENGTH] = 0;
+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+ if ((exact && (result != 0)) || (!exact && (result >= 0)))
+ return (MATCH_FAILED);
+ memcpy((char *) name, (char *) newname,
+ (vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+ return (MATCH_SUCCEEDED);
+} /* end header_hrsys */
+
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+u_char *
+var_hrsys(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ static char string[129]; /* per MIB, max size is 128 */
+#if defined(solaris2)
+ /* max size of nvram property */
+ char bootparam[8192];
+#endif
+ time_t now;
+#if !(defined(NR_TASKS) || defined(solaris2) || defined(hpux10) || defined(hpux11))
+ int nproc = 0;
+#endif
+#ifdef linux
+ FILE *fp;
+#endif
+#if NETSNMP_CAN_USE_SYSCTL && defined(CTL_KERN) && defined(KERN_MAXPROC)
+ static int maxproc_mib[] = { CTL_KERN, KERN_MAXPROC };
+ int buf_size;
+#endif
+#if defined(hpux10) || defined(hpux11)
+ struct pst_static pst_buf;
+#endif
+
+ if (header_hrsys(vp, name, length, exact, var_len, write_method) ==
+ MATCH_FAILED)
+ return NULL;
+
+ switch (vp->magic) {
+ case HRSYS_UPTIME:
+ long_return = get_uptime();
+ return (u_char *) & long_return;
+ case HRSYS_DATE:
+#if defined(HAVE_MKTIME) && defined(HAVE_STIME)
+ *write_method=ns_set_time;
+#endif
+ (void *) time(&now);
+ return (u_char *) date_n_time(&now, var_len);
+ case HRSYS_LOAD_DEV:
+ long_return = get_load_dev();
+ return (u_char *) & long_return;
+ case HRSYS_LOAD_PARAM:
+#ifdef linux
+ if((fp = fopen("/proc/cmdline", "r")) != NULL) {
+ fgets(string, sizeof(string), fp);
+ fclose(fp);
+ } else {
+ return NULL;
+ }
+#elif defined(solaris2)
+ *write_method=set_solaris_bootcommand_parameter;
+ if ( get_solaris_eeprom_parameter("boot-command",bootparam) ) {
+ snmp_log(LOG_ERR,"unable to lookup boot-command from eeprom\n");
+ return NULL;
+ }
+ strlcpy(string,bootparam,sizeof(string));
+#else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ sprintf(string, "ask Dave"); /* XXX */
+#endif
+ *var_len = strlen(string);
+ return (u_char *) string;
+ case HRSYS_USERS:
+ long_return = count_users();
+ return (u_char *) & long_return;
+ case HRSYS_PROCS:
+#if USING_HOST_HR_SWRUN_MODULE
+ long_return = count_processes();
+#else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = 0;
+#endif
+ return (u_char *) & long_return;
+ case HRSYS_MAXPROCS:
+#if defined(NR_TASKS)
+ long_return = NR_TASKS; /* <linux/tasks.h> */
+#elif NETSNMP_CAN_USE_SYSCTL && defined(CTL_KERN) && defined(KERN_MAXPROC)
+ buf_size = sizeof(nproc);
+ if (sysctl(maxproc_mib, 2, &nproc, &buf_size, NULL, 0) < 0)
+ return NULL;
+ long_return = nproc;
+#elif defined(hpux10) || defined(hpux11)
+ pstat_getstatic(&pst_buf, sizeof(struct pst_static), 1, 0);
+ long_return = pst_buf.max_proc;
+#elif defined(solaris2)
+ long_return=get_max_solaris_processes();
+ if(long_return == -1) return NULL;
+#elif defined(NPROC_SYMBOL)
+ auto_nlist(NPROC_SYMBOL, (char *) &nproc, sizeof(int));
+ long_return = nproc;
+#else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = 0;
+#endif
+ return (u_char *) & long_return;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_hrsys\n",
+ vp->magic));
+ }
+ return NULL;
+} /* end var_hrsys */
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+
+#if defined(solaris2)
+
+/* functions for malloc and freeing openpromio structure */
+static struct openpromio * op_malloc(size_t size)
+{
+ struct openpromio *op;
+ op=malloc(sizeof(struct openpromio) + size);
+ if(op == NULL) {
+ snmp_log(LOG_ERR,"unable to malloc memory\n");
+ return NULL;
+ }
+
+ memset(op, 0, sizeof(struct openpromio)+size);
+ op->oprom_size=size;
+
+ return op;
+}
+
+static void op_free(struct openpromio *op) {
+ free(op);
+}
+
+static int
+set_solaris_bootcommand_parameter(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len) {
+
+ static char old_value[1024],*p_old_value=old_value;
+ int status=0;
+
+ switch (action) {
+ case RESERVE1:
+ /* check type */
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,"write to set_solaris_bootcommand_parameter not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ break;
+
+ case RESERVE2: {
+ /* create copy of old value */
+ if(statP) {
+ int old_val_len=strlen(statP);
+ if(old_val_len >= sizeof(old_value)) {
+ p_old_value=(char *)malloc(old_val_len+1);
+ if(p_old_value==NULL) {
+ snmp_log(LOG_ERR,"unable to malloc memory\n");
+ return SNMP_ERR_GENERR;
+ }
+ }
+ strlcpy(p_old_value,statP,old_val_len+1);
+ } else {
+ p_old_value=NULL;
+ }
+ break;
+ }
+
+ case ACTION: {
+ status=set_solaris_eeprom_parameter("boot-command",(char *)var_val,var_val_len);
+ if(status!=0) return SNMP_ERR_GENERR;
+ break;
+ }
+
+ case UNDO: {
+ /* revert to old value */
+ if(p_old_value) {
+ status=set_solaris_eeprom_parameter("boot-command",(char *)p_old_value,strlen(p_old_value));
+ p_old_value=old_value;
+ if(status!=0) return SNMP_ERR_GENERR;
+ }
+ break;
+ }
+
+ case FREE:
+ case COMMIT:
+ /* free memory if necessary */
+ if(p_old_value != old_value) {
+ free(p_old_value);
+ p_old_value=old_value;
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+static int set_solaris_eeprom_parameter(const char *key, const char *value,
+ size_t var_val_len) {
+
+ int status=0;
+ char buffer[1024],*pbuffer=buffer;
+
+ if( strlen(key)+strlen(value)+16 > sizeof(buffer) ) {
+ pbuffer=(char *)malloc(strlen(key)+strlen(value)+16);
+ }
+
+
+ sprintf(pbuffer,"eeprom %s=\"",key);
+ strncat(pbuffer,value,var_val_len);
+ strcat(pbuffer,"\"\n");
+
+ status=system(pbuffer);
+
+ if(pbuffer!=buffer) free(pbuffer);
+ return status;
+}
+
+static int get_solaris_eeprom_parameter(const char *parameter, char *outbuffer) {
+
+ int fd=0,status=0;
+ struct openpromio *openprominfo=NULL;
+
+ fd=open("/dev/openprom",O_RDONLY);
+ if ( fd == -1 ) {
+ snmp_log_perror("/dev/openprom");
+ return 1;
+ }
+
+ openprominfo = op_malloc(8192);
+ if(!openprominfo) return 1;
+
+ strcpy(openprominfo->oprom_array,parameter);
+
+ status=ioctl(fd,OPROMGETOPT,openprominfo);
+ if ( status == -1 ) {
+ snmp_log_perror("/dev/openprom");
+ close(fd);
+ op_free(openprominfo);
+ return 1;
+ }
+ strcpy(outbuffer,openprominfo->oprom_array);
+
+ op_free(openprominfo);
+
+ /* close file */
+ close(fd);
+
+ return(0);
+}
+
+static long get_max_solaris_processes(void) {
+
+ kstat_ctl_t *ksc=NULL;
+ kstat_t *ks=NULL;
+ struct var v;
+ static long maxprocs=-1;
+
+ /* assume only necessary to compute once, since /etc/system must be modified */
+ if (maxprocs == -1) {
+ if ( (ksc=kstat_open()) != NULL &&
+ (ks=kstat_lookup(ksc, "unix", 0, "var")) != NULL &&
+ (kstat_read(ksc, ks, &v) != -1)) {
+
+ maxprocs=v.v_proc;
+ }
+ if(ksc) {
+ kstat_close(ksc);
+ }
+ }
+
+ return maxprocs;
+}
+
+#endif
+
+#if defined(HAVE_MKTIME) && defined(HAVE_STIME)
+int
+ns_set_time(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+
+ static time_t oldtime=0;
+
+ switch (action) {
+ case RESERVE1:
+ /* check type */
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR,"write to ns_set_time not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != 8 && var_val_len!=11) {
+ snmp_log(LOG_ERR,"write to ns_set_time not a proper length\n");
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+
+ case RESERVE2:
+ break;
+
+ case FREE:
+ break;
+
+ case ACTION: {
+ long status=0;
+ time_t seconds=0;
+ struct tm newtimetm;
+ int hours_from_utc= 0;
+ int minutes_from_utc= 0;
+
+ if (var_val_len == 11) {
+ /* timezone inforamation was present */
+ hours_from_utc=(int)var_val[9];
+ minutes_from_utc=(int)var_val[10];
+ }
+
+ newtimetm.tm_sec=(int)var_val[6];;
+ newtimetm.tm_min=(int)var_val[5];
+ newtimetm.tm_hour=(int)var_val[4];
+
+ newtimetm.tm_mon=(int)var_val[2]-1;
+ newtimetm.tm_year=256*(int)var_val[0]+(int)var_val[1]-1900;
+ newtimetm.tm_mday=(int)var_val[3];
+
+ /* determine if day light savings time in effect DST */
+ if ( ( hours_from_utc*60*60+minutes_from_utc*60 ) == abs(timezone) ) {
+ newtimetm.tm_isdst=0;
+ } else {
+ newtimetm.tm_isdst=1;
+ }
+
+ /* create copy of old value */
+ oldtime=time(NULL);
+
+ seconds=mktime(&newtimetm);
+ if(seconds == (time_t)-1) {
+ snmp_log(LOG_ERR, "Unable to convert time value\n");
+ return SNMP_ERR_GENERR;
+ }
+ status=stime(&seconds);
+ if(status!=0) {
+ snmp_log(LOG_ERR, "Unable to set time\n");
+ return SNMP_ERR_GENERR;
+ }
+ break;
+ }
+ case UNDO: {
+ /* revert to old value */
+ int status=0;
+ if(oldtime != 0) {
+ status=stime(&oldtime);
+ oldtime=0;
+ if(status!=0) {
+ snmp_log(LOG_ERR, "Unable to set time\n");
+ return SNMP_ERR_GENERR;
+ }
+ }
+ break;
+ }
+
+ case COMMIT: {
+ oldtime=0;
+ break;
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+#endif
+
+ /*
+ * Return the DeviceIndex corresponding
+ * to the boot device
+ */
+static int
+get_load_dev(void)
+{
+ return (HRDEV_DISK << HRDEV_TYPE_SHIFT); /* XXX */
+} /* end get_load_dev */
+
+static int
+count_users(void)
+{
+ int total = 0;
+#ifndef WIN32
+#if HAVE_UTMPX_H
+#define setutent setutxent
+#define pututline pututxline
+#define getutent getutxent
+#define endutent endutxent
+ struct utmpx *utmp_p;
+#else
+ struct utmp *utmp_p;
+#endif
+
+ setutent();
+ while ((utmp_p = getutent()) != NULL) {
+#ifndef UTMP_HAS_NO_TYPE
+ if (utmp_p->ut_type != USER_PROCESS)
+ continue;
+#endif
+#ifndef UTMP_HAS_NO_PID
+ /* This block of code fixes zombie user PIDs in the
+ utmp/utmpx file that would otherwise be counted as a
+ current user */
+ if (kill(utmp_p->ut_pid, 0) == -1 && errno == ESRCH) {
+ utmp_p->ut_type = DEAD_PROCESS;
+ pututline(utmp_p);
+ continue;
+ }
+#endif
+ ++total;
+ }
+ endutent();
+#else /* WIN32 */
+ /*
+ * TODO - Error checking.
+ */
+ LPWKSTA_INFO_102 wkinfo;
+ NET_API_STATUS nstatus;
+
+ nstatus = NetWkstaGetInfo(NULL, 102, (LPBYTE*)&wkinfo);
+ if (nstatus != NERR_Success) {
+ return 0;
+ }
+ total = (int)wkinfo->wki102_logged_on_users;
+
+ NetApiBufferFree(wkinfo);
+#endif /* WIN32 */
+ return total;
+}
+
+#if defined(UTMP_FILE) && !HAVE_UTMPX_H
+
+static FILE *utmp_file;
+static struct utmp utmp_rec;
+
+void
+setutent(void)
+{
+ if (utmp_file)
+ fclose(utmp_file);
+ utmp_file = fopen(UTMP_FILE, "r");
+}
+
+void
+endutent(void)
+{
+ if (utmp_file) {
+ fclose(utmp_file);
+ utmp_file = NULL;
+ }
+}
+
+struct utmp *
+getutent(void)
+{
+ if (!utmp_file)
+ return NULL;
+ while (fread(&utmp_rec, sizeof(utmp_rec), 1, utmp_file) == 1)
+ if (*utmp_rec.ut_name && *utmp_rec.ut_line)
+ return &utmp_rec;
+ return NULL;
+}
+
+#endif /* UTMP_FILE */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_system.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_system.h
new file mode 100644
index 0000000000..5e12c0df6c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host/hr_system.h
@@ -0,0 +1,15 @@
+/*
+ * Host Resources MIB - system group interface - hr_system.h
+ *
+ */
+#ifndef _MIBGROUP_HRSYSTEM_H
+#define _MIBGROUP_HRSYSTEM_H
+
+extern void init_hr_system(void);
+extern FindVarMethod var_hrsys;
+
+#if defined(HAVE_MKTIME) && defined(HAVE_STIME)
+int ns_set_time(int action, u_char * var_val, u_char var_val_type, size_t var_val_len, u_char * statP, oid * name, size_t name_len);
+#endif
+
+#endif /* _MIBGROUP_HRSYSTEM_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/host_res.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/host_res.h
new file mode 100644
index 0000000000..fcb4db97dc
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/host_res.h
@@ -0,0 +1,88 @@
+/*
+ * Host Resources
+ * Device index manipulation data
+ */
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/snmp_agent.h>
+#include <net-snmp/agent/agent_handler.h>
+#include <net-snmp/agent/snmp_vars.h>
+#include <net-snmp/agent/var_struct.h>
+
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#if defined (WIN32) && !defined (cygwin)
+#include <winsock.h>
+#else /* WIN32 */
+#include <sys/socket.h>
+#include <net/if.h>
+#endif /* WIN32 */
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#if HAVE_NETINET_IN_VAR_H
+#ifdef HAVE_SYS_QUEUE_H
+#include <sys/queue.h>
+#endif
+#include <netinet/in_var.h>
+#endif
+
+/*
+ * #include "snmp_vars.linux.h"
+ */
+
+ /*
+ * Deliberately set to the same values as hrDeviceTypes
+ */
+#define HRDEV_OTHER 1
+#define HRDEV_UNKNOWN 2
+#define HRDEV_PROC 3
+#define HRDEV_NETWORK 4
+#define HRDEV_PRINTER 5
+#define HRDEV_DISK 6
+#define HRDEV_VIDEO 10
+#define HRDEV_AUDIO 11
+#define HRDEV_COPROC 12
+#define HRDEV_KEYBOARD 13
+#define HRDEV_MODEM 14
+#define HRDEV_PARALLEL 15
+#define HRDEV_POINTER 16
+#define HRDEV_SERIAL 17
+#define HRDEV_TAPE 18
+#define HRDEV_CLOCK 19
+#define HRDEV_VMEM 20
+#define HRDEV_NVMEM 21
+
+#define HRDEV_TYPE_MAX 22 /* one greater than largest device type */
+#define HRDEV_TYPE_SHIFT 8
+#define HRDEV_TYPE_MASK 0xff
+
+typedef void (*PFV) (void);
+typedef int (*PFI) (int);
+typedef int (*PFIV) (void);
+typedef const char *(*PFS) (int);
+typedef oid *(*PFO) (int, size_t *);
+
+extern PFV init_device[]; /* Routines for stepping through devices */
+extern PFIV next_device[];
+extern PFV save_device[];
+extern int dev_idx_inc[]; /* Flag - are indices returned in strictly
+ * increasing order */
+
+extern PFS device_descr[]; /* Return data for a particular device */
+extern PFO device_prodid[];
+extern PFI device_status[];
+extern PFI device_errors[];
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib.h
new file mode 100644
index 0000000000..998a46b5da
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib.h
@@ -0,0 +1,7 @@
+/*
+ * module to include the modules
+ */
+
+config_require(if-mib/ifTable);
+config_require(if-mib/ifXTable);
+config_add_mib(IF-MIB)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface.c
new file mode 100644
index 0000000000..1afc655137
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface.c
@@ -0,0 +1,783 @@
+/*
+ * Interface MIB architecture support
+ *
+ * $Id: interface.c 16830 2008-02-22 23:52:33Z hardaker $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include "mibII/mibII_common.h"
+#include "if-mib/ifTable/ifTable_constants.h"
+#include "if-mib/data_access/interface.h"
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/library/snmp_enum.h>
+#include <net-snmp/data_access/interface.h>
+
+
+/**---------------------------------------------------------------------*/
+/*
+ * local static vars
+ */
+static netsnmp_conf_if_list *conf_list = NULL;
+static int need_wrap_check = -1;
+static int _access_interface_init = 0;
+
+/*
+ * local static prototypes
+ */
+static int _access_interface_entry_compare_name(const void *lhs,
+ const void *rhs);
+#ifndef NETSNMP_ACCESS_INTERFACE_NOARCH
+static void _access_interface_entry_release(netsnmp_interface_entry * entry,
+ void *unused);
+#endif
+static void _access_interface_entry_save_name(const char *name, oid index);
+static void _parse_interface_config(const char *token, char *cptr);
+static void _free_interface_config(void);
+
+/**---------------------------------------------------------------------*/
+/*
+ * external per-architecture functions prototypes
+ *
+ * These shouldn't be called by the general public, so they aren't in
+ * the header file.
+ */
+#ifndef NETSNMP_ACCESS_INTERFACE_NOARCH
+extern void netsnmp_arch_interface_init(void);
+extern int
+netsnmp_arch_interface_container_load(netsnmp_container* container,
+ u_int load_flags);
+extern int
+netsnmp_arch_set_admin_status(netsnmp_interface_entry * entry,
+ int ifAdminStatus);
+extern int netsnmp_arch_interface_index_find(const char*name);
+#endif
+
+
+/**
+ * initialization
+ */
+void
+init_interface(void)
+{
+ snmpd_register_config_handler("interface", _parse_interface_config,
+ _free_interface_config,
+ "name type speed");
+}
+
+
+void
+netsnmp_access_interface_init(void)
+{
+ netsnmp_assert(0 == _access_interface_init); /* who is calling twice? */
+
+ if (1 == _access_interface_init)
+ return;
+
+ _access_interface_init = 1;
+
+#ifndef NETSNMP_ACCESS_INTERFACE_NOARCH
+ {
+ netsnmp_container * ifcontainer;
+
+ netsnmp_arch_interface_init();
+
+ /*
+ * load once to set up ifIndexes
+ */
+ ifcontainer = netsnmp_access_interface_container_load(NULL, 0);
+ if(NULL != ifcontainer)
+ netsnmp_access_interface_container_free(ifcontainer, 0);
+ }
+#endif
+}
+
+/**---------------------------------------------------------------------*/
+/*
+ * container functions
+ */
+/**
+ * initialize interface container
+ */
+netsnmp_container *
+netsnmp_access_interface_container_init(u_int flags)
+{
+ netsnmp_container *container1;
+
+ DEBUGMSGTL(("access:interface:container", "init\n"));
+
+ /*
+ * create the containers. one indexed by ifIndex, the other
+ * indexed by ifName.
+ */
+ container1 = netsnmp_container_find("access_interface:table_container");
+ if (NULL == container1)
+ return NULL;
+
+ container1->container_name = strdup("interface container");
+ if (flags & NETSNMP_ACCESS_INTERFACE_INIT_ADDL_IDX_BY_NAME) {
+ netsnmp_container *container2 =
+ netsnmp_container_find("access_interface_by_name:access_interface:table_container");
+ if (NULL == container2)
+ return NULL;
+
+ container2->container_name = strdup("interface name container");
+ container2->compare = _access_interface_entry_compare_name;
+
+ netsnmp_container_add_index(container1, container2);
+ }
+
+ return container1;
+}
+
+/**
+ * load interface information in specified container
+ *
+ * @param container empty container, or NULL to have one created for you
+ * @param load_flags flags to modify behaviour. Examples:
+ * NETSNMP_ACCESS_INTERFACE_INIT_ADDL_IDX_BY_NAME
+ *
+ * @retval NULL error
+ * @retval !NULL pointer to container
+ */
+#ifndef NETSNMP_ACCESS_INTERFACE_NOARCH
+netsnmp_container*
+netsnmp_access_interface_container_load(netsnmp_container* container, u_int load_flags)
+{
+ int rc;
+
+ DEBUGMSGTL(("access:interface:container", "load\n"));
+ netsnmp_assert(1 == _access_interface_init);
+
+ if (NULL == container)
+ container = netsnmp_access_interface_container_init(load_flags);
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "no container specified/found for access_interface\n");
+ return NULL;
+ }
+
+ rc = netsnmp_arch_interface_container_load(container, load_flags);
+ if (0 != rc) {
+ netsnmp_access_interface_container_free(container,
+ NETSNMP_ACCESS_INTERFACE_FREE_NOFLAGS);
+ container = NULL;
+ }
+
+ return container;
+}
+
+void
+netsnmp_access_interface_container_free(netsnmp_container *container, u_int free_flags)
+{
+ DEBUGMSGTL(("access:interface:container", "free\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "invalid container for netsnmp_access_interface_free\n");
+ return;
+ }
+
+ if(! (free_flags & NETSNMP_ACCESS_INTERFACE_FREE_DONT_CLEAR)) {
+ /*
+ * free all items.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func*)_access_interface_entry_release,
+ NULL);
+ }
+
+ CONTAINER_FREE(container);
+}
+
+/**
+ * @retval 0 interface not found
+ */
+oid
+netsnmp_access_interface_index_find(const char *name)
+{
+ DEBUGMSGTL(("access:interface:find", "index\n"));
+ netsnmp_assert(1 == _access_interface_init);
+
+ return netsnmp_arch_interface_index_find(name);
+}
+#endif
+
+/**---------------------------------------------------------------------*/
+/*
+ * ifentry functions
+ */
+/**
+ */
+netsnmp_interface_entry *
+netsnmp_access_interface_entry_get_by_index(netsnmp_container *container, oid index)
+{
+ netsnmp_index tmp;
+
+ DEBUGMSGTL(("access:interface:entry", "by_index\n"));
+ netsnmp_assert(1 == _access_interface_init);
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container for netsnmp_access_interface_entry_get_by_index\n");
+ return NULL;
+ }
+
+ tmp.len = 1;
+ tmp.oids = &index;
+
+ return (netsnmp_interface_entry *) CONTAINER_FIND(container, &tmp);
+}
+
+/**
+ */
+netsnmp_interface_entry *
+netsnmp_access_interface_entry_get_by_name(netsnmp_container *container,
+ const char *name)
+{
+ netsnmp_interface_entry tmp;
+
+ DEBUGMSGTL(("access:interface:entry", "by_name\n"));
+ netsnmp_assert(1 == _access_interface_init);
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container for netsnmp_access_interface_entry_get_by_name\n");
+ return NULL;
+ }
+
+ if (NULL == container->next) {
+ snmp_log(LOG_ERR,
+ "secondary index missing for netsnmp_access_interface_entry_get_by_name\n");
+ return NULL;
+ }
+
+ tmp.name = (char *)name;
+ return CONTAINER_FIND(container->next, &tmp);
+}
+
+/**
+ * @retval NULL index not found
+ */
+const char *
+netsnmp_access_interface_name_find(oid index)
+{
+ DEBUGMSGTL(("access:interface:find", "name\n"));
+ netsnmp_assert(1 == _access_interface_init);
+
+ return se_find_label_in_slist("interfaces", index);
+}
+
+/**
+ */
+netsnmp_interface_entry *
+netsnmp_access_interface_entry_create(const char *name, oid if_index)
+{
+ netsnmp_interface_entry *entry =
+ SNMP_MALLOC_TYPEDEF(netsnmp_interface_entry);
+
+ DEBUGMSGTL(("access:interface:entry", "create\n"));
+ netsnmp_assert(1 == _access_interface_init);
+
+ if(NULL == entry)
+ return NULL;
+
+ if(NULL != name)
+ entry->name = strdup(name);
+
+ /*
+ * get if index, and save name for reverse lookup
+ */
+#ifndef NETSNMP_ACCESS_INTERFACE_NOARCH
+ if (0 == if_index)
+ entry->index = netsnmp_access_interface_index_find(name);
+ else
+#endif
+ entry->index = if_index;
+ _access_interface_entry_save_name(name, entry->index);
+
+ entry->descr = strdup(name);
+
+ /*
+ * make some assumptions
+ */
+ entry->connector_present = 1;
+
+ entry->oid_index.len = 1;
+ entry->oid_index.oids = (oid *) & entry->index;
+
+ return entry;
+}
+
+/**
+ */
+void
+netsnmp_access_interface_entry_free(netsnmp_interface_entry * entry)
+{
+ DEBUGMSGTL(("access:interface:entry", "free\n"));
+
+ if (NULL == entry)
+ return;
+
+ /*
+ * SNMP_FREE not needed, for any of these,
+ * since the whole entry is about to be freed
+ */
+
+ if (NULL != entry->old_stats)
+ free(entry->old_stats);
+
+ if (NULL != entry->name)
+ free(entry->name);
+
+ if (NULL != entry->descr)
+ free(entry->descr);
+
+ if (NULL != entry->paddr)
+ free(entry->paddr);
+
+ free(entry);
+}
+
+/*
+ * Blech - backwards compatible mibII/interfaces style interface
+ * functions, so we don't have to update older modules to use
+ * the new code to get correct ifIndex values.
+ */
+#if defined( USING_IF_MIB_IFTABLE_IFTABLE_DATA_ACCESS_MODULE ) && \
+ ! defined( NETSNMP_NO_BACKWARDS_COMPATABILITY )
+
+static netsnmp_iterator *it = NULL;
+static netsnmp_container *c = NULL;
+static netsnmp_interface_entry *e = NULL;
+
+/**
+ *
+ */
+void
+Interface_Scan_Init(void)
+{
+ /*
+ * ifTable container shouldn't change, so we shouldn' have to
+ * re-fetch it every time.
+ */
+ if (NULL != c)
+ netsnmp_access_interface_container_free(c, 0);
+
+ c = netsnmp_access_interface_container_load(NULL, 0);
+
+ if (NULL != c) {
+ if (NULL != it)
+ ITERATOR_RELEASE(it);
+
+ it = CONTAINER_ITERATOR(c);
+ }
+
+ if (NULL != it)
+ e = ITERATOR_FIRST(it);
+}
+
+int
+Interface_Scan_Next(short *index, char *name, netsnmp_interface_entry **entry,
+ void *dc)
+{
+ if (NULL == e)
+ return 0;
+
+ if(index)
+ *index = e->index;
+
+ if(name)
+ strcpy(name, e->name);
+
+ if (entry)
+ *entry = e;
+
+ e = ITERATOR_NEXT(it);
+
+ return 1;
+}
+#endif /* NETSNMP_NO_BACKWARDS_COMPATABILITY */
+
+
+/**
+ *
+ * @retval 0 : success
+ * @retval < 0 : error
+ */
+#ifndef NETSNMP_ACCESS_INTERFACE_NOARCH
+int
+netsnmp_access_interface_entry_set_admin_status(netsnmp_interface_entry * entry,
+ int ifAdminStatus)
+{
+ int rc;
+
+ DEBUGMSGTL(("access:interface:entry", "set_admin_status\n"));
+
+ if (NULL == entry)
+ return -1;
+
+ if ((ifAdminStatus < IFADMINSTATUS_UP) ||
+ (ifAdminStatus > IFADMINSTATUS_TESTING))
+ return -2;
+
+ rc = netsnmp_arch_set_admin_status(entry, ifAdminStatus);
+ if (0 == rc) /* success */
+ entry->admin_status = ifAdminStatus;
+
+ return rc;
+}
+#endif
+
+/**---------------------------------------------------------------------*/
+/*
+ * Utility routines
+ */
+
+/**
+ */
+static int
+_access_interface_entry_compare_name(const void *lhs, const void *rhs)
+{
+ return strcmp(((const netsnmp_interface_entry *) lhs)->name,
+ ((const netsnmp_interface_entry *) rhs)->name);
+}
+
+/**
+ */
+static void
+_access_interface_entry_release(netsnmp_interface_entry * entry, void *context)
+{
+ netsnmp_access_interface_entry_free(entry);
+}
+
+/**
+ */
+static void
+_access_interface_entry_save_name(const char *name, oid index)
+{
+ oid tmp;
+
+ if(NULL == name)
+ return;
+
+ tmp = se_find_value_in_slist("interfaces", name);
+ if (tmp == SE_DNE) {
+ se_add_pair_to_slist("interfaces", strdup(name), index);
+ DEBUGMSGTL(("access:interface:ifIndex", "saved ifIndex %d for %s\n",
+ index, name));
+ }
+ else
+ if (index != tmp) {
+ static int logged = 0;
+ if (!logged) {
+ snmp_log(LOG_ERR, "IfIndex of an interface changed. Such " \
+ "interfaces will appear multiple times in IF-MIB.\n");
+ logged = 1;
+ }
+ DEBUGMSGTL(("access:interface:ifIndex", "index %d != tmp for %s\n",
+ index, name));
+ }
+}
+
+/**
+ * update stats
+ *
+ * @retval 0 : success
+ * @retval -1 : error
+ */
+int
+netsnmp_access_interface_entry_update_stats(netsnmp_interface_entry * prev_vals,
+ netsnmp_interface_entry * new_vals)
+{
+ DEBUGMSGTL(("access:interface", "check_wrap\n"));
+
+ /*
+ * sanity checks
+ */
+ if ((NULL == prev_vals) || (NULL == new_vals) ||
+ (NULL == prev_vals->name) || (NULL == new_vals->name) ||
+ (0 != strncmp(prev_vals->name, new_vals->name, strlen(prev_vals->name))))
+ return -1;
+
+ /*
+ * if we've determined that we have 64 bit counters, just copy them.
+ */
+ if (0 == need_wrap_check) {
+ memcpy(&prev_vals->stats, &new_vals->stats, sizeof(new_vals->stats));
+ return 0;
+ }
+
+ if (NULL == prev_vals->old_stats) {
+ /*
+ * if we don't have old stats, copy previous stats
+ */
+ prev_vals->old_stats = SNMP_MALLOC_TYPEDEF(netsnmp_interface_stats);
+ if (NULL == prev_vals->old_stats) {
+ return -2;
+ }
+ memcpy(prev_vals->old_stats, &prev_vals->stats, sizeof(new_vals->stats));
+ }
+
+ netsnmp_c64_check32_and_update(&prev_vals->stats.ibytes,
+ &new_vals->stats.ibytes,
+ &prev_vals->old_stats->ibytes,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.iucast,
+ &new_vals->stats.iucast,
+ &prev_vals->old_stats->iucast,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.imcast,
+ &new_vals->stats.imcast,
+ &prev_vals->old_stats->imcast,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.ibcast,
+ &new_vals->stats.ibcast,
+ &prev_vals->old_stats->ibcast,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.obytes,
+ &new_vals->stats.obytes,
+ &prev_vals->old_stats->obytes,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.oucast,
+ &new_vals->stats.oucast,
+ &prev_vals->old_stats->oucast,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.omcast,
+ &new_vals->stats.omcast,
+ &prev_vals->old_stats->omcast,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.obcast,
+ &new_vals->stats.obcast,
+ &prev_vals->old_stats->obcast,
+ &need_wrap_check);
+
+ /*
+ * Copy 32 bit counters
+ */
+ prev_vals->stats.ierrors = new_vals->stats.ierrors;
+ prev_vals->stats.idiscards = new_vals->stats.idiscards;
+ prev_vals->stats.iunknown_protos = new_vals->stats.iunknown_protos;
+ prev_vals->stats.inucast = new_vals->stats.inucast;
+ prev_vals->stats.oerrors = new_vals->stats.oerrors;
+ prev_vals->stats.odiscards = new_vals->stats.odiscards;
+ prev_vals->stats.oqlen = new_vals->stats.oqlen;
+ prev_vals->stats.collisions = new_vals->stats.collisions;
+ prev_vals->stats.onucast = new_vals->stats.onucast;
+
+ /*
+ * if we've decided we no longer need to check wraps, free old stats
+ */
+ if (0 == need_wrap_check) {
+ SNMP_FREE(prev_vals->old_stats);
+ }
+ else {
+ /*
+ * update old stats from new stats.
+ * careful - old_stats is a pointer to stats...
+ */
+ memcpy(prev_vals->old_stats, &new_vals->stats, sizeof(new_vals->stats));
+ }
+
+ return 0;
+}
+
+/**
+ * copy interface entry data (after checking for counter wraps)
+ *
+ * @retval -2 : malloc failed
+ * @retval -1 : interfaces not the same
+ * @retval 0 : no error
+ */
+int
+netsnmp_access_interface_entry_copy(netsnmp_interface_entry * lhs,
+ netsnmp_interface_entry * rhs)
+{
+ DEBUGMSGTL(("access:interface", "copy\n"));
+
+ if ((NULL == lhs) || (NULL == rhs) ||
+ (NULL == lhs->name) || (NULL == rhs->name) ||
+ (0 != strncmp(lhs->name, rhs->name, strlen(rhs->name))))
+ return -1;
+
+ /*
+ * update stats
+ */
+ netsnmp_access_interface_entry_update_stats(lhs, rhs);
+
+ /*
+ * update data
+ */
+ lhs->ns_flags = rhs->ns_flags;
+ if((NULL != lhs->descr) && (NULL != rhs->descr) &&
+ (0 == strcmp(lhs->descr, rhs->descr)))
+ ;
+ else {
+ if (NULL != lhs->descr)
+ SNMP_FREE(lhs->descr);
+ if (rhs->descr) {
+ lhs->descr = strdup(rhs->descr);
+ if(NULL == lhs->descr)
+ return -2;
+ }
+ }
+ lhs->type = rhs->type;
+ lhs->speed = rhs->speed;
+ lhs->speed_high = rhs->speed_high;
+ lhs->retransmit_v6 = rhs->retransmit_v6;
+ lhs->retransmit_v4 = rhs->retransmit_v4;
+ lhs->reachable_time = rhs->reachable_time;
+ lhs->mtu = rhs->mtu;
+ lhs->lastchange = rhs->lastchange;
+ lhs->discontinuity = rhs->discontinuity;
+ lhs->reasm_max_v4 = rhs->reasm_max_v4;
+ lhs->reasm_max_v6 = rhs->reasm_max_v6;
+ lhs->admin_status = rhs->admin_status;
+ lhs->oper_status = rhs->oper_status;
+ lhs->promiscuous = rhs->promiscuous;
+ lhs->connector_present = rhs->connector_present;
+ lhs->forwarding_v6 = rhs->forwarding_v6;
+ lhs->os_flags = rhs->os_flags;
+ if(lhs->paddr_len == rhs->paddr_len) {
+ if(rhs->paddr_len)
+ memcpy(lhs->paddr,rhs->paddr,rhs->paddr_len);
+ } else {
+ if (NULL != lhs->paddr)
+ SNMP_FREE(lhs->paddr);
+ if (rhs->paddr) {
+ lhs->paddr = malloc(rhs->paddr_len);
+ if(NULL == lhs->paddr)
+ return -2;
+ memcpy(lhs->paddr,rhs->paddr,rhs->paddr_len);
+ }
+ }
+ lhs->paddr_len = rhs->paddr_len;
+
+ return 0;
+}
+
+void
+netsnmp_access_interface_entry_guess_speed(netsnmp_interface_entry *entry)
+{
+ if (entry->type == IANAIFTYPE_ETHERNETCSMACD)
+ entry->speed = 10000000;
+ else if (entry->type == IANAIFTYPE_SOFTWARELOOPBACK)
+ entry->speed = 10000000;
+ else if (entry->type == IANAIFTYPE_ISO88025TOKENRING)
+ entry->speed = 4000000;
+ else
+ entry->speed = 0;
+}
+
+netsnmp_conf_if_list *
+netsnmp_access_interface_entry_overrides_get(const char * name)
+{
+ netsnmp_conf_if_list * if_ptr;
+
+ netsnmp_assert(1 == _access_interface_init);
+ if(NULL == name)
+ return NULL;
+
+ for (if_ptr = conf_list; if_ptr; if_ptr = if_ptr->next)
+ if (!strcmp(if_ptr->name, name))
+ break;
+
+ return if_ptr;
+}
+
+void
+netsnmp_access_interface_entry_overrides(netsnmp_interface_entry *entry)
+{
+ netsnmp_conf_if_list * if_ptr;
+
+ netsnmp_assert(1 == _access_interface_init);
+ if (NULL == entry)
+ return;
+
+ /*
+ * enforce mib size limit
+ */
+ if(entry->descr && (strlen(entry->descr) > 255))
+ entry->descr[255] = 0;
+
+ if_ptr =
+ netsnmp_access_interface_entry_overrides_get(entry->name);
+ if (if_ptr) {
+ entry->type = if_ptr->type;
+ entry->speed = if_ptr->speed;
+ }
+}
+
+/**---------------------------------------------------------------------*/
+/*
+ * interface config token
+ */
+/**
+ */
+static void
+_parse_interface_config(const char *token, char *cptr)
+{
+ netsnmp_conf_if_list *if_ptr, *if_new;
+ char *name, *type, *speed, *ecp;
+ char *st;
+
+ name = strtok_r(cptr, " \t", &st);
+ if (!name) {
+ config_perror("Missing NAME parameter");
+ return;
+ }
+ type = strtok_r(NULL, " \t", &st);
+ if (!type) {
+ config_perror("Missing TYPE parameter");
+ return;
+ }
+ speed = strtok_r(NULL, " \t", &st);
+ if (!speed) {
+ config_perror("Missing SPEED parameter");
+ return;
+ }
+ if_ptr = conf_list;
+ while (if_ptr)
+ if (strcmp(if_ptr->name, name))
+ if_ptr = if_ptr->next;
+ else
+ break;
+ if (if_ptr)
+ config_pwarn("Duplicate interface specification");
+ if_new = SNMP_MALLOC_TYPEDEF(netsnmp_conf_if_list);
+ if (!if_new) {
+ config_perror("Out of memory");
+ return;
+ }
+ if_new->speed = strtoul(speed, &ecp, 0);
+ if (*ecp) {
+ config_perror("Bad SPEED value");
+ free(if_new);
+ return;
+ }
+ if_new->type = strtol(type, &ecp, 0);
+ if (*ecp || if_new->type < 0) {
+ config_perror("Bad TYPE");
+ free(if_new);
+ return;
+ }
+ if_new->name = strdup(name);
+ if (!if_new->name) {
+ config_perror("Out of memory");
+ free(if_new);
+ return;
+ }
+ if_new->next = conf_list;
+ conf_list = if_new;
+}
+
+static void
+_free_interface_config(void)
+{
+ netsnmp_conf_if_list *if_ptr = conf_list, *if_next;
+ while (if_ptr) {
+ if_next = if_ptr->next;
+ free(if_ptr->name);
+ free(if_ptr);
+ if_ptr = if_next;
+ }
+ conf_list = NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface.h
new file mode 100644
index 0000000000..74ea4baaed
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface.h
@@ -0,0 +1,56 @@
+/*
+ * interface data access header
+ *
+ * $Id: interface.h 16536 2007-06-18 21:13:46Z hardaker $
+ */
+#ifndef NETSNMP_ACCESS_INTERFACE_CONFIG_H
+#define NETSNMP_ACCESS_INTERFACE_CONFIG_H
+
+/*
+ * all platforms use this generic code
+ */
+config_require(if-mib/data_access/interface)
+
+/**---------------------------------------------------------------------*/
+/*
+ * configure required files
+ *
+ * Notes:
+ *
+ * 1) prefer functionality over platform, where possible. If a method
+ * is available for multiple platforms, test that first. That way
+ * when a new platform is ported, it won't need a new test here.
+ *
+ * 2) don't do detail requirements here. If, for example,
+ * HPUX11 had different reuirements than other HPUX, that should
+ * be handled in the *_hpux.h header file.
+ */
+
+#ifdef NETSNMP_INCLUDE_IFTABLE_REWRITES
+
+config_exclude(mibII/interfaces)
+
+# if defined( linux )
+
+ config_require(if-mib/data_access/interface_linux)
+ config_require(if-mib/data_access/interface_ioctl)
+
+# elif defined( openbsd3 ) || defined( openbsd4 ) || \
+ defined( freebsd4 ) || defined( freebsd5 ) || defined( freebsd6 ) || defined (darwin)
+
+ config_require(if-mib/data_access/interface_sysctl)
+
+# elif defined( solaris2 )
+
+ config_require(if-mib/data_access/interface_solaris2)
+
+# else
+
+ config_error(This platform does not yet support IF-MIB rewrites)
+
+# endif
+#else
+# define NETSNMP_ACCESS_INTERFACE_NOARCH 1
+#endif
+
+#endif /* NETSNMP_ACCESS_INTERFACE_CONFIG_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_ioctl.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_ioctl.c
new file mode 100644
index 0000000000..ecc8222110
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_ioctl.c
@@ -0,0 +1,494 @@
+/*
+ * Interface MIB architecture support
+ *
+ * $Id: interface_ioctl.c 15638 2006-12-06 14:34:11Z rstory $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include "mibII/mibII_common.h"
+#include "if-mib/ifTable/ifTable_constants.h"
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/interface.h>
+#include <net-snmp/data_access/ipaddress.h>
+#include "if-mib/data_access/interface.h"
+
+#ifdef HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#ifdef HAVE_NET_IF_ARP_H
+#include <net/if_arp.h>
+#endif
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+
+#include "interface_ioctl.h"
+#include "ip-mib/data_access/ipaddress_ioctl.h"
+
+/**
+ * ioctl wrapper
+ *
+ * @param fd : socket fd to use w/ioctl, or -1 to open/close one
+ * @param which
+ * @param ifrq
+ * param ifentry : ifentry to update
+ * @param name
+ *
+ * @retval 0 : success
+ * @retval -1 : invalid parameters
+ * @retval -2 : couldn't create socket
+ * @retval -3 : ioctl call failed
+ */
+static int
+_ioctl_get(int fd, int which, struct ifreq *ifrq, const char* name)
+{
+ int ourfd = -1, rc = 0;
+
+ DEBUGMSGTL(("verbose:access:interface:ioctl",
+ "ioctl %d for %s\n", which, name));
+
+ /*
+ * sanity checks
+ */
+ if(NULL == name) {
+ snmp_log(LOG_ERR, "invalid ifentry\n");
+ return -1;
+ }
+
+ /*
+ * create socket for ioctls
+ */
+ if(fd < 0) {
+ fd = ourfd = socket(AF_INET, SOCK_DGRAM, 0);
+ if(ourfd < 0) {
+ snmp_log(LOG_ERR,"couldn't create socket\n");
+ return -2;
+ }
+ }
+
+ strncpy(ifrq->ifr_name, name, sizeof(ifrq->ifr_name));
+ ifrq->ifr_name[ sizeof(ifrq->ifr_name)-1 ] = 0;
+ rc = ioctl(fd, which, ifrq);
+ if (rc < 0) {
+ snmp_log(LOG_ERR,"ioctl %d returned %d\n", which, rc);
+ rc = -3;
+ }
+
+ if(ourfd >= 0)
+ close(ourfd);
+
+ return rc;
+}
+
+#ifdef SIOCGIFHWADDR
+/**
+ * interface entry physaddr ioctl wrapper
+ *
+ * @param fd : socket fd to use w/ioctl, or -1 to open/close one
+ * @param ifentry : ifentry to update
+ *
+ * @retval 0 : success
+ * @retval -1 : invalid parameters
+ * @retval -2 : couldn't create socket
+ * @retval -3 : ioctl call failed
+ * @retval -4 : malloc error
+ */
+int
+netsnmp_access_interface_ioctl_physaddr_get(int fd,
+ netsnmp_interface_entry *ifentry)
+{
+ struct ifreq ifrq;
+ int rc = 0;
+
+ DEBUGMSGTL(("access:interface:ioctl", "physaddr_get\n"));
+
+ if((NULL != ifentry->paddr) &&
+ (ifentry->paddr_len != IFHWADDRLEN)) {
+ SNMP_FREE(ifentry->paddr);
+ }
+ if(NULL == ifentry->paddr)
+ ifentry->paddr = malloc(IFHWADDRLEN);
+
+ if(NULL == ifentry->paddr) {
+ rc = -4;
+ } else {
+
+ /*
+ * NOTE: this ioctl does not guarantee 6 bytes of a physaddr.
+ * In particular, a 'sit0' interface only appears to get back
+ * 4 bytes of sa_data. Uncomment this memset, and suddenly
+ * the sit interface will be 0:0:0:0:?:? where ? is whatever was
+ * in the memory before. Not sure if this memset should be done
+ * for every ioctl, as the rest seem to work ok...
+ */
+ memset(ifrq.ifr_hwaddr.sa_data, (0), IFHWADDRLEN);
+ ifentry->paddr_len = IFHWADDRLEN;
+ rc = _ioctl_get(fd, SIOCGIFHWADDR, &ifrq, ifentry->name);
+ if (rc < 0) {
+ memset(ifentry->paddr, (0), IFHWADDRLEN);
+ rc = -3; /* msg already logged */
+ }
+ else {
+ memcpy(ifentry->paddr, ifrq.ifr_hwaddr.sa_data, IFHWADDRLEN);
+
+ /*
+ * arphrd defines vary greatly. ETHER seems to be the only common one
+ */
+#ifdef ARPHRD_ETHER
+ switch (ifrq.ifr_hwaddr.sa_family) {
+ case ARPHRD_ETHER:
+ ifentry->type = 6;
+ break;
+#if defined(ARPHRD_TUNNEL) || defined(ARPHRD_IPGRE) || defined(ARPHRD_SIT)
+#ifdef ARPHRD_TUNNEL
+ case ARPHRD_TUNNEL:
+ case ARPHRD_TUNNEL6:
+#endif
+#ifdef ARPHRD_IPGRE
+ case ARPHRD_IPGRE:
+#endif
+#ifdef ARPHRD_SIT
+ case ARPHRD_SIT:
+#endif
+ ifentry->type = 131;
+ break; /* tunnel */
+#endif
+#ifdef ARPHRD_SLIP
+ case ARPHRD_SLIP:
+ case ARPHRD_CSLIP:
+ case ARPHRD_SLIP6:
+ case ARPHRD_CSLIP6:
+ ifentry->type = 28;
+ break; /* slip */
+#endif
+#ifdef ARPHRD_PPP
+ case ARPHRD_PPP:
+ ifentry->type = 23;
+ break; /* ppp */
+#endif
+#ifdef ARPHRD_LOOPBACK
+ case ARPHRD_LOOPBACK:
+ ifentry->type = 24;
+ break; /* softwareLoopback */
+#endif
+#ifdef ARPHRD_FDDI
+ case ARPHRD_FDDI:
+ ifentry->type = 15;
+ break;
+#endif
+#ifdef ARPHRD_ARCNET
+ case ARPHRD_ARCNET:
+ ifentry->type = 35;
+ break;
+#endif
+#ifdef ARPHRD_LOCALTLK
+ case ARPHRD_LOCALTLK:
+ ifentry->type = 42;
+ break;
+#endif
+#ifdef ARPHRD_HIPPI
+ case ARPHRD_HIPPI:
+ ifentry->type = 47;
+ break;
+#endif
+#ifdef ARPHRD_ATM
+ case ARPHRD_ATM:
+ ifentry->type = 37;
+ break;
+#endif
+ /*
+ * XXX: more if_arp.h:ARPHRD_xxx to IANAifType mappings...
+ */
+ default:
+ DEBUGMSGTL(("access:interface:ioctl", "unknown entry type %d\n",
+ ifrq.ifr_hwaddr.sa_family));
+ } /* switch */
+#endif /* ARPHRD_LOOPBACK */
+
+ }
+ }
+
+ return rc;
+}
+#endif /* SIOCGIFHWADDR */
+
+
+#ifdef SIOCGIFFLAGS
+/**
+ * interface entry flags ioctl wrapper
+ *
+ * @param fd : socket fd to use w/ioctl, or -1 to open/close one
+ * @param ifentry : ifentry to update
+ *
+ * @retval 0 : success
+ * @retval -1 : invalid parameters
+ * @retval -2 : couldn't create socket
+ * @retval -3 : ioctl call failed
+ */
+int
+netsnmp_access_interface_ioctl_flags_get(int fd,
+ netsnmp_interface_entry *ifentry)
+{
+ struct ifreq ifrq;
+ int rc = 0;
+
+ DEBUGMSGTL(("access:interface:ioctl", "flags_get\n"));
+
+ rc = _ioctl_get(fd, SIOCGIFFLAGS, &ifrq, ifentry->name);
+ if (rc < 0) {
+ ifentry->ns_flags &= ~NETSNMP_INTERFACE_FLAGS_HAS_IF_FLAGS;
+ return rc; /* msg already logged */
+ }
+ else {
+ ifentry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_IF_FLAGS;
+ ifentry->os_flags = ifrq.ifr_flags;
+
+ /*
+ * ifOperStatus description:
+ * If ifAdminStatus is down(2) then ifOperStatus should be down(2).
+ */
+ if(ifentry->os_flags & IFF_UP) {
+ ifentry->admin_status = IFADMINSTATUS_UP;
+ if(ifentry->os_flags & IFF_RUNNING)
+ ifentry->oper_status = IFOPERSTATUS_UP;
+ else
+ ifentry->oper_status = IFOPERSTATUS_DOWN;
+ }
+ else {
+ ifentry->admin_status = IFADMINSTATUS_DOWN;
+ ifentry->oper_status = IFOPERSTATUS_DOWN;
+ }
+
+ /*
+ * ifConnectorPresent description:
+ * This object has the value 'true(1)' if the interface sublayer has a
+ * physical connector and the value 'false(2)' otherwise."
+ * So, at very least, false(2) should be returned for loopback devices.
+ */
+ if(ifentry->os_flags & IFF_LOOPBACK) {
+ ifentry->connector_present = 0;
+ }
+ else {
+ ifentry->connector_present = 1;
+ }
+ }
+
+ return rc;
+}
+
+/**
+ * interface entry flags ioctl wrapper
+ *
+ * @param fd : socket fd to use w/ioctl, or -1 to open/close one
+ * @param ifentry : ifentry to update
+ *
+ * @retval 0 : success
+ * @retval -1 : invalid parameters
+ * @retval -2 : couldn't create socket
+ * @retval -3 : ioctl get call failed
+ * @retval -4 : ioctl set call failed
+ */
+int
+netsnmp_access_interface_ioctl_flags_set(int fd,
+ netsnmp_interface_entry *ifentry,
+ unsigned int flags, int and_complement)
+{
+ struct ifreq ifrq;
+ int ourfd = -1, rc = 0;
+
+ DEBUGMSGTL(("access:interface:ioctl", "flags_set\n"));
+
+ /*
+ * sanity checks
+ */
+ if((NULL == ifentry) || (NULL == ifentry->name)) {
+ snmp_log(LOG_ERR, "invalid ifentry\n");
+ return -1;
+ }
+
+ /*
+ * create socket for ioctls
+ */
+ if(fd < 0) {
+ fd = ourfd = socket(AF_INET, SOCK_DGRAM, 0);
+ if(ourfd < 0) {
+ snmp_log(LOG_ERR,"couldn't create socket\n");
+ return -2;
+ }
+ }
+
+ strncpy(ifrq.ifr_name, ifentry->name, sizeof(ifrq.ifr_name));
+ ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+ rc = ioctl(fd, SIOCGIFFLAGS, &ifrq);
+ if(rc < 0) {
+ snmp_log(LOG_ERR,"error getting flags\n");
+ close(fd);
+ return -3;
+ }
+ if(0 == and_complement)
+ ifrq.ifr_flags |= flags;
+ else
+ ifrq.ifr_flags &= ~flags;
+ rc = ioctl(fd, SIOCSIFFLAGS, &ifrq);
+ if(rc < 0) {
+ close(fd);
+ snmp_log(LOG_ERR,"error setting flags\n");
+ ifentry->os_flags = 0;
+ return -4;
+ }
+
+ if(ourfd >= 0)
+ close(ourfd);
+
+ ifentry->os_flags = ifrq.ifr_flags;
+
+ return 0;
+}
+#endif /* SIOCGIFFLAGS */
+
+#ifdef SIOCGIFMTU
+/**
+ * interface entry mtu ioctl wrapper
+ *
+ * @param fd : socket fd to use w/ioctl, or -1 to open/close one
+ * @param ifentry : ifentry to update
+ *
+ * @retval 0 : success
+ * @retval -1 : invalid parameters
+ * @retval -2 : couldn't create socket
+ * @retval -3 : ioctl call failed
+ */
+int
+netsnmp_access_interface_ioctl_mtu_get(int fd,
+ netsnmp_interface_entry *ifentry)
+{
+ struct ifreq ifrq;
+ int rc = 0;
+
+ DEBUGMSGTL(("access:interface:ioctl", "mtu_get\n"));
+
+ rc = _ioctl_get(fd, SIOCGIFMTU, &ifrq, ifentry->name);
+ if (rc < 0) {
+ ifentry->mtu = 0;
+ return rc; /* msg already logged */
+ }
+ else {
+ ifentry->mtu = ifrq.ifr_mtu;
+ }
+
+ return rc;
+}
+#endif /* SIOCGIFMTU */
+
+/**
+ * interface entry ifIndex ioctl wrapper
+ *
+ * @param fd : socket fd to use w/ioctl, or -1 to open/close one
+ * @param name : ifentry to update
+ *
+ * @retval 0 : not found
+ * @retval !0 : ifIndex
+ */
+oid
+netsnmp_access_interface_ioctl_ifindex_get(int fd, const char *name)
+{
+#ifndef SIOCGIFINDEX
+ return 0;
+#else
+ struct ifreq ifrq;
+ int rc = 0;
+
+ DEBUGMSGTL(("access:interface:ioctl", "ifindex_get\n"));
+
+ rc = _ioctl_get(fd, SIOCGIFINDEX, &ifrq, name);
+ if (rc < 0) {
+ DEBUGMSGTL(("access:interface:ioctl",
+ "ifindex_get error on inerface '%s'\n", name));
+ return 0;
+ }
+
+ return ifrq.ifr_ifindex;
+#endif /* SIOCGIFINDEX */
+}
+
+/**
+ * check an interface for ipv4 addresses
+ *
+ * @param sd : open socket descriptor
+ * @param if_name : optional name. takes precedent over if_index.
+ * @param if_index: optional if index. only used if no if_name specified
+ * @param flags :
+ *
+ * @retval < 0 : error
+ * @retval 0 : no ip v4 addresses
+ * @retval 1 : 1 or more ip v4 addresses
+ */
+int
+netsnmp_access_interface_ioctl_has_ipv4(int sd, const char *if_name,
+ int if_index, u_int *flags)
+{
+ int i, interfaces = 0;
+ struct ifconf ifc;
+ struct ifreq *ifrp;
+
+ /*
+ * one or the other
+ */
+ if ((NULL == flags) ||
+ ((0 == if_index) && (NULL == if_name))) {
+ return -1;
+ }
+
+ interfaces = netsnmp_access_ipaddress_ioctl_get_interface_count(sd, &ifc);
+ if(interfaces < 0) {
+ close(sd);
+ return -2;
+ }
+ netsnmp_assert(NULL != ifc.ifc_buf);
+
+ *flags &= ~NETSNMP_INTERFACE_FLAGS_HAS_IPV4;
+
+ ifrp = ifc.ifc_req;
+ for(i=0; i < interfaces; ++i, ++ifrp) {
+
+ DEBUGMSGTL(("access:ipaddress:container",
+ " interface %d, %s\n", i, ifrp->ifr_name));
+
+ /*
+ * search for matching if_name or if_index
+ */
+ if (NULL != if_name) {
+ if (strncmp(if_name, ifrp->ifr_name, sizeof(ifrp->ifr_name)) != 0)
+ continue;
+ }
+ else {
+ /*
+ * I think that Linux and Solaris both use ':' in the
+ * interface name for aliases.
+ */
+ char *ptr = strchr(ifrp->ifr_name, ':');
+ if (NULL != ptr)
+ *ptr = 0;
+
+ if (if_index !=
+ netsnmp_access_interface_ioctl_ifindex_get(sd, ifrp->ifr_name))
+ continue;
+ }
+
+ /*
+ * check and set v4 or v6 flag, and break if we've found both
+ */
+ if (AF_INET == ifrp->ifr_addr.sa_family) {
+ *flags |= NETSNMP_INTERFACE_FLAGS_HAS_IPV4;
+ break;
+ }
+ }
+
+ /*
+ * clean up
+ */
+ free(ifc.ifc_buf);
+
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_ioctl.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_ioctl.h
new file mode 100644
index 0000000000..611880b468
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_ioctl.h
@@ -0,0 +1,52 @@
+/*
+ * ioctl interface data access header
+ *
+ * $Id: interface_ioctl.h 13309 2005-10-29 03:30:43Z rstory $
+ */
+#ifndef NETSNMP_ACCESS_INTERFACE_IOCTL_H
+#define NETSNMP_ACCESS_INTERFACE_IOCTL_H
+
+/*
+ * need ipaddress functions to get ipversions of an interface
+*/
+config_require(ip-mib/data_access/ipaddress)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**---------------------------------------------------------------------*/
+/**/
+
+int
+netsnmp_access_interface_ioctl_physaddr_get(int fd,
+ netsnmp_interface_entry *ifentry);
+
+int
+netsnmp_access_interface_ioctl_flags_get(int fd,
+ netsnmp_interface_entry *ifentry);
+
+int
+netsnmp_access_interface_ioctl_flags_set(int fd,
+ netsnmp_interface_entry *ifentry,
+ unsigned int flags,
+ int and_complement);
+
+int
+netsnmp_access_interface_ioctl_mtu_get(int fd,
+ netsnmp_interface_entry *ifentry);
+
+oid
+netsnmp_access_interface_ioctl_ifindex_get(int fd, const char *name);
+
+int
+netsnmp_access_interface_ioctl_has_ipv4(int sd, const char *if_name,
+ int if_index, u_int *flags);
+
+/**---------------------------------------------------------------------*/
+
+# ifdef __cplusplus
+}
+#endif
+
+#endif /* NETSNMP_ACCESS_INTERFACE_IOCTL_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_linux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_linux.c
new file mode 100644
index 0000000000..245fa99e77
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_linux.c
@@ -0,0 +1,856 @@
+/*
+ * Interface MIB architecture support
+ *
+ * $Id: interface_linux.c 16944 2008-05-14 13:35:40Z tanders $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+#ifdef HAVE_LINUX_ETHTOOL_H
+#include <linux/types.h>
+typedef __u64 u64; /* hack, so we may include kernel's ethtool.h */
+typedef __u32 u32; /* ditto */
+typedef __u16 u16; /* ditto */
+typedef __u8 u8; /* ditto */
+#include <linux/ethtool.h>
+#endif /* HAVE_LINUX_ETHTOOL_H */
+
+#include "mibII/mibII_common.h"
+#include "if-mib/ifTable/ifTable_constants.h"
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#else
+#error "linux should have sys/ioctl header"
+#endif
+
+#include <net-snmp/data_access/interface.h>
+#include <net-snmp/data_access/ipaddress.h>
+#include "if-mib/data_access/interface.h"
+#include "interface_ioctl.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <linux/sockios.h>
+
+#ifndef IF_NAMESIZE
+#define IF_NAMESIZE 16
+#endif
+
+unsigned int
+netsnmp_linux_interface_get_if_speed(int fd, const char *name);
+#ifdef HAVE_LINUX_ETHTOOL_H
+unsigned int
+netsnmp_linux_interface_get_if_speed_mii(int fd, const char *name);
+#endif
+
+#define PROC_SYS_NET_IPVx_NEIGH_RETRANS_TIME_MS "/proc/sys/net/ipv%d/neigh/%s/retrans_time_ms"
+#define PROC_SYS_NET_IPVx_NEIGH_RETRANS_TIME "/proc/sys/net/ipv%d/neigh/%s/retrans_time"
+static const char *proc_sys_retrans_time;
+static unsigned short retrans_time_factor = 1;
+
+
+#define PROC_SYS_NET_IPVx_BASE_REACHABLE_TIME_MS "/proc/sys/net/ipv%d/neigh/%s/base_reachable_time_ms"
+#define PROC_SYS_NET_IPVx_BASE_REACHABLE_TIME "/proc/sys/net/ipv%d/neigh/%s/base_reachable_time"
+static const char *proc_sys_basereachable_time;
+static unsigned short basereachable_time_ms = 0;
+void
+netsnmp_arch_interface_init(void)
+{
+ /*
+ * Check which retransmit time interface is available
+ */
+ char proc_path[ 64+IF_NAMESIZE];
+ char proc_path2[64+IF_NAMESIZE];
+ struct stat st;
+
+ snprintf(proc_path, sizeof(proc_path),
+ PROC_SYS_NET_IPVx_NEIGH_RETRANS_TIME_MS, 6, "default");
+ snprintf(proc_path2, sizeof(proc_path2),
+ PROC_SYS_NET_IPVx_NEIGH_RETRANS_TIME_MS, 4, "default");
+
+ if ((stat(proc_path, &st) == 0) || (stat(proc_path2, &st) == 0)) {
+ proc_sys_retrans_time = PROC_SYS_NET_IPVx_NEIGH_RETRANS_TIME_MS;
+ } else {
+ proc_sys_retrans_time = PROC_SYS_NET_IPVx_NEIGH_RETRANS_TIME;
+ retrans_time_factor = 10;
+ }
+
+ snprintf(proc_path, sizeof(proc_path), PROC_SYS_NET_IPVx_BASE_REACHABLE_TIME_MS, 6, "default");
+ snprintf(proc_path2, sizeof(proc_path), PROC_SYS_NET_IPVx_BASE_REACHABLE_TIME, 4, "default");
+
+ if ((stat(proc_path, &st) == 0) || (stat(proc_path2, &st) == 0)) {
+ proc_sys_basereachable_time = PROC_SYS_NET_IPVx_BASE_REACHABLE_TIME_MS;
+ basereachable_time_ms = 1;
+ }
+ else {
+ proc_sys_basereachable_time = PROC_SYS_NET_IPVx_BASE_REACHABLE_TIME;
+ }
+}
+
+/*
+ * find the ifIndex for an interface name
+ * NOTE: The Linux version is not efficient for large numbers of calls.
+ * consider using netsnmp_access_interface_ioctl_ifindex_get()
+ * for loops which need to look up a lot of indexes.
+ *
+ * @retval 0 : no index found
+ * @retval >0: ifIndex for interface
+ */
+oid
+netsnmp_arch_interface_index_find(const char *name)
+{
+ return netsnmp_access_interface_ioctl_ifindex_get(-1, name);
+}
+
+
+/*
+ * check for ipv6 addresses
+ */
+void
+_arch_interface_has_ipv6(oid if_index, u_int *flags,
+ netsnmp_container *addr_container)
+{
+#ifdef NETSNMP_ENABLE_IPV6
+ netsnmp_ipaddress_entry *addr_entry = NULL;
+ netsnmp_iterator *addr_it = NULL;
+ u_int addr_container_flags = 0; /* must init to 0 */
+#endif
+
+ if (NULL == flags)
+ return;
+
+ *flags &= ~NETSNMP_INTERFACE_FLAGS_HAS_IPV6;
+
+#ifndef SIOCGMIIPHY
+#define SIOCGMIIPHY 0x8947
+#endif
+
+#ifndef SIOCGMIIREG
+#define SIOCGMIIREG 0x8948
+#endif
+
+#ifdef NETSNMP_ENABLE_IPV6
+ /*
+ * get ipv6 addresses
+ */
+ if (NULL == addr_container) {
+ /*
+ * we only care about ipv6, if we need to allocate our own
+ * temporary container. set the flags (which we also use later
+ * to determine if we need to free the container).
+ */
+ addr_container_flags = NETSNMP_ACCESS_IPADDRESS_LOAD_IPV6_ONLY;
+ addr_container =
+ netsnmp_access_ipaddress_container_load(NULL,
+ addr_container_flags);
+ if (NULL == addr_container) {
+ DEBUGMSGTL(("access:ifcontainer",
+ "couldn't get ip addresses container\n"));
+ return;
+ }
+ }
+ else {
+ /*
+ * addr_container flags must be 0, so we don't release the
+ * user's container.
+ */
+ netsnmp_assert(0 == addr_container_flags);
+ }
+
+
+ /*
+ * get an ipaddress container iterator, and look for ipv6 addrs
+ */
+ addr_it = CONTAINER_ITERATOR(addr_container);
+ if (NULL == addr_it) {
+ DEBUGMSGTL(("access:ifcontainer",
+ "couldn't get ip addresses iterator\n"));
+ if (0!=addr_container_flags)
+ netsnmp_access_ipaddress_container_free(addr_container, 0);
+ return;
+ }
+
+ addr_entry = ITERATOR_FIRST(addr_it);
+ for( ; addr_entry ; addr_entry = ITERATOR_NEXT(addr_it) ) {
+ /*
+ * skip non matching indexes and ipv4 addresses
+ */
+ if ((if_index != addr_entry->if_index) ||
+ (4 == addr_entry->ia_address_len))
+ continue;
+
+ /*
+ * found one! no need to keep looking, set the flag and bail
+ */
+ *flags |= NETSNMP_INTERFACE_FLAGS_HAS_IPV6;
+ break;
+ }
+
+ /*
+ * make mama proud and clean up after ourselves
+ */
+ ITERATOR_RELEASE(addr_it);
+ if (0!=addr_container_flags)
+ netsnmp_access_ipaddress_container_free(addr_container, 0);
+#endif
+}
+
+/**
+ * @internal
+ */
+static void
+_arch_interface_flags_v4_get(netsnmp_interface_entry *entry)
+{
+ FILE *fin;
+ char line[256];
+
+ /*
+ * get the retransmit time
+ */
+ snprintf(line,sizeof(line), proc_sys_retrans_time, 4,
+ entry->name);
+ if (!(fin = fopen(line, "r"))) {
+ DEBUGMSGTL(("access:interface",
+ "Failed to open %s\n", line));
+ }
+ else {
+ if (fgets(line, sizeof(line), fin)) {
+ entry->retransmit_v4 = atoi(line) * retrans_time_factor;
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_V4_RETRANSMIT;
+ }
+ fclose(fin);
+ }
+}
+
+
+#ifdef NETSNMP_ENABLE_IPV6
+/**
+ * @internal
+ */
+static void
+_arch_interface_flags_v6_get(netsnmp_interface_entry *entry)
+{
+ FILE *fin;
+ char line[256];
+
+ /*
+ * get the retransmit time
+ */
+ snprintf(line,sizeof(line), proc_sys_retrans_time, 6,
+ entry->name);
+ if (!(fin = fopen(line, "r"))) {
+ DEBUGMSGTL(("access:interface",
+ "Failed to open %s\n", line));
+ }
+ else {
+ if (fgets(line, sizeof(line), fin)) {
+ entry->retransmit_v6 = atoi(line) * retrans_time_factor;
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_V6_RETRANSMIT;
+ }
+ fclose(fin);
+ }
+
+ /*
+ * get the forwarding status
+ */
+ snprintf(line, sizeof(line), "/proc/sys/net/ipv6/conf/%s/forwarding",
+ entry->name);
+ if (!(fin = fopen(line, "r"))) {
+ DEBUGMSGTL(("access:interface",
+ "Failed to open %s\n", line));
+ }
+ else {
+ if (fgets(line, sizeof(line), fin)) {
+ entry->forwarding_v6 = atoi(line);
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_V6_FORWARDING;
+ }
+ fclose(fin);
+ }
+
+ /*
+ * get the reachable time
+ */
+ snprintf(line, sizeof(line), proc_sys_basereachable_time, 6, entry->name);
+ if (!(fin = fopen(line, "r"))) {
+ DEBUGMSGTL(("access:interface",
+ "Failed to open %s\n", line));
+ }
+ else {
+ if (fgets(line, sizeof(line), fin)) {
+ if (basereachable_time_ms) {
+ entry->reachable_time = atoi(line); /* millisec */
+ } else {
+ entry->reachable_time = atoi(line)*1000; /* sec to millisec */
+ }
+
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_V6_REACHABLE;
+ }
+ fclose(fin);
+ }
+}
+#endif /* NETSNMP_ENABLE_IPV6 */
+
+/**
+ * @internal
+ */
+static int
+_parse_stats(netsnmp_interface_entry *entry, char *stats, int expected)
+{
+ /*
+ * scanline_2_2:
+ * [ IN ]
+ * byte pkts errs drop fifo frame cmprs mcst |
+ * [ OUT ]
+ * byte pkts errs drop fifo colls carrier compressed
+ */
+#ifdef SCNuMAX
+ uintmax_t rec_pkt, rec_oct, rec_err, rec_drop, rec_mcast;
+ uintmax_t snd_pkt, snd_oct, snd_err, snd_drop, coll;
+ const char *scan_line_2_2 =
+ "%" SCNuMAX " %" SCNuMAX " %" SCNuMAX " %" SCNuMAX
+ " %*" SCNuMAX " %*" SCNuMAX " %*" SCNuMAX " %" SCNuMAX
+ " %" SCNuMAX " %" SCNuMAX " %" SCNuMAX " %" SCNuMAX
+ " %*" SCNuMAX " %" SCNuMAX;
+ const char *scan_line_2_0 =
+ "%" SCNuMAX " %" SCNuMAX " %*" SCNuMAX " %*" SCNuMAX
+ " %*" SCNuMAX " %" SCNuMAX " %" SCNuMAX " %*" SCNuMAX
+ " %*" SCNuMAX " %" SCNuMAX;
+#else
+ unsigned long rec_pkt, rec_oct, rec_err, rec_drop, rec_mcast;
+ unsigned long snd_pkt, snd_oct, snd_err, snd_drop, coll;
+ const char *scan_line_2_2 =
+ "%lu %lu %lu %lu %*lu %*lu %*lu %lu %lu %lu %lu %lu %*lu %lu";
+ const char *scan_line_2_0 =
+ "%lu %lu %*lu %*lu %*lu %lu %lu %*lu %*lu %lu";
+#endif
+ static const char *scan_line_to_use = NULL;
+ int scan_count;
+
+ if (10 == expected)
+ scan_line_to_use = scan_line_2_2;
+ else {
+ netsnmp_assert(5 == expected);
+ scan_line_to_use = scan_line_2_0;
+ }
+
+ while (*stats == ' ')
+ stats++;
+
+ if ((*stats == 'N') &&
+ (0 == strncmp(stats, "No statistics available",
+ sizeof("No statistics available"))))
+ return -1;
+
+ /*
+ * Now parse the rest of the line (i.e. starting from 'stats')
+ * to extract the relevant statistics, and populate
+ * data structure accordingly.
+ * Use the entry flags field to indicate which counters are valid
+ */
+ rec_pkt = rec_oct = rec_err = rec_drop = rec_mcast = 0;
+ snd_pkt = snd_oct = snd_err = snd_drop = coll = 0;
+ if (scan_line_to_use == scan_line_2_2) {
+ scan_count = sscanf(stats, scan_line_to_use,
+ &rec_oct, &rec_pkt, &rec_err, &rec_drop, &rec_mcast,
+ &snd_oct, &snd_pkt, &snd_err, &snd_drop,
+ &coll);
+ if (scan_count == expected) {
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_BYTES;
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_DROPS;
+ /*
+ * 2.4 kernel includes a single multicast (input) counter?
+ */
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_MCAST_PKTS;
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_HIGH_SPEED;
+#ifdef SCNuMAX /* XXX - should be flag for 64-bit variables */
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_HIGH_BYTES;
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_HIGH_PACKETS;
+#endif
+ }
+ } else {
+ scan_count = sscanf(stats, scan_line_to_use,
+ &rec_pkt, &rec_err,
+ &snd_pkt, &snd_err, &coll);
+ if (scan_count == expected) {
+ entry->ns_flags &= ~NETSNMP_INTERFACE_FLAGS_HAS_MCAST_PKTS;
+ rec_oct = rec_drop = 0;
+ snd_oct = snd_drop = 0;
+ }
+ }
+ if(scan_count != expected) {
+ snmp_log(LOG_ERR,
+ "error scanning interface data (expected %d, got %d)\n",
+ expected, scan_count);
+ return scan_count;
+ }
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_ACTIVE;
+
+ /*
+ * linux previous to 1.3.~13 may miss transmitted loopback pkts:
+ */
+ if (!strcmp(entry->name, "lo") && rec_pkt > 0 && !snd_pkt)
+ snd_pkt = rec_pkt;
+
+ /*
+ * subtract out multicast packets from rec_pkt before
+ * we store it as unicast counter.
+ */
+ rec_pkt -= rec_mcast;
+
+ entry->stats.ibytes.low = rec_oct & 0xffffffff;
+ entry->stats.iucast.low = rec_pkt & 0xffffffff;
+ entry->stats.imcast.low = rec_mcast & 0xffffffff;
+ entry->stats.obytes.low = snd_oct & 0xffffffff;
+ entry->stats.oucast.low = snd_pkt & 0xffffffff;
+#ifdef SCNuMAX /* XXX - should be flag for 64-bit variables */
+ entry->stats.ibytes.high = rec_oct >> 32;
+ entry->stats.iucast.high = rec_pkt >> 32;
+ entry->stats.imcast.high = rec_mcast >> 32;
+ entry->stats.obytes.high = snd_oct >> 32;
+ entry->stats.oucast.high = snd_pkt >> 32;
+#endif
+ entry->stats.ierrors = rec_err;
+ entry->stats.idiscards = rec_drop;
+ entry->stats.oerrors = snd_err;
+ entry->stats.odiscards = snd_drop;
+ entry->stats.collisions = coll;
+
+ /*
+ * calculated stats.
+ *
+ * we have imcast, but not ibcast.
+ */
+ entry->stats.inucast = entry->stats.imcast.low +
+ entry->stats.ibcast.low;
+ entry->stats.onucast = entry->stats.omcast.low +
+ entry->stats.obcast.low;
+
+ return 0;
+}
+
+/*
+ *
+ * @retval 0 success
+ * @retval -1 no container specified
+ * @retval -2 could not open /proc/net/dev
+ * @retval -3 could not create entry (probably malloc)
+ */
+int
+netsnmp_arch_interface_container_load(netsnmp_container* container,
+ u_int load_flags)
+{
+ FILE *devin;
+ char line[256];
+ netsnmp_interface_entry *entry = NULL;
+ static char scan_expected = 0;
+ int fd;
+#ifdef NETSNMP_ENABLE_IPV6
+ netsnmp_container *addr_container;
+#endif
+
+ DEBUGMSGTL(("access:interface:container:arch", "load (flags %p)\n",
+ load_flags));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "no container specified/found for interface\n");
+ return -1;
+ }
+
+ if (!(devin = fopen("/proc/net/dev", "r"))) {
+ DEBUGMSGTL(("access:interface",
+ "Failed to load Interface Table (linux1)\n"));
+ snmp_log(LOG_ERR, "cannot open /proc/net/dev ...\n");
+ return -2;
+ }
+
+ /*
+ * create socket for ioctls
+ */
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if(fd < 0) {
+ snmp_log(LOG_ERR, "could not create socket\n");
+ return -2;
+ }
+
+#ifdef NETSNMP_ENABLE_IPV6
+ /*
+ * get ipv6 addresses
+ */
+ addr_container = netsnmp_access_ipaddress_container_load(NULL, 0);
+#endif
+
+ /*
+ * Read the first two lines of the file, containing the header
+ * This indicates which version of the kernel we're working with,
+ * and hence which statistics are actually available.
+ *
+ * Wes originally suggested parsing the field names in this header
+ * to detect the position of individual fields directly,
+ * but I suspect this is probably more trouble than it's worth.
+ */
+ fgets(line, sizeof(line), devin);
+ fgets(line, sizeof(line), devin);
+
+ if( 0 == scan_expected ) {
+ if (strstr(line, "compressed")) {
+ scan_expected = 10;
+ DEBUGMSGTL(("access:interface",
+ "using linux 2.2 kernel /proc/net/dev\n"));
+ } else {
+ scan_expected = 5;
+ DEBUGMSGTL(("access:interface",
+ "using linux 2.0 kernel /proc/net/dev\n"));
+ }
+ }
+
+ /*
+ * The rest of the file provides the statistics for each interface.
+ * Read in each line in turn, isolate the interface name
+ * and retrieve (or create) the corresponding data structure.
+ */
+ while (fgets(line, sizeof(line), devin)) {
+ char *stats, *ifstart = line;
+ u_int flags;
+ oid if_index;
+
+ flags = 0;
+ if (line[strlen(line) - 1] == '\n')
+ line[strlen(line) - 1] = '\0';
+
+ while (*ifstart && *ifstart == ' ')
+ ifstart++;
+
+ if ((!*ifstart) || ((stats = strrchr(ifstart, ':')) == NULL)) {
+ snmp_log(LOG_ERR,
+ "interface data format error 1, line ==|%s|\n", line);
+ continue;
+ }
+ if ((scan_expected == 10) && ((stats - line) < 6)) {
+ snmp_log(LOG_ERR,
+ "interface data format error 2 (%d < 6), line ==|%s|\n",
+ stats - line, line);
+ }
+
+ DEBUGMSGTL(("9:access:ifcontainer", "processing '%s'\n", ifstart));
+
+ /*
+ * get index via ioctl.
+ * If we've met this interface before, use the same index.
+ * Otherwise find an unused index value and use that.
+ */
+ *stats++ = 0; /* null terminate name */
+
+ if_index = netsnmp_arch_interface_index_find(ifstart);
+
+ /*
+ * set address type flags.
+ * the only way I know of to check an interface for
+ * ip version is to look for ip addresses. If anyone
+ * knows a better way, put it here!
+ */
+#ifdef NETSNMP_ENABLE_IPV6
+ _arch_interface_has_ipv6(if_index, &flags, addr_container);
+#endif
+ netsnmp_access_interface_ioctl_has_ipv4(fd, ifstart, 0, &flags);
+
+ /*
+ * do we only want one address type?
+ */
+ if (((load_flags & NETSNMP_ACCESS_INTERFACE_LOAD_IP4_ONLY) &&
+ ((flags & NETSNMP_INTERFACE_FLAGS_HAS_IPV4) == 0)) ||
+ ((load_flags & NETSNMP_ACCESS_INTERFACE_LOAD_IP6_ONLY) &&
+ ((flags & NETSNMP_INTERFACE_FLAGS_HAS_IPV6) == 0))) {
+ DEBUGMSGTL(("9:access:ifcontainer",
+ "interface '%s' excluded by ip version\n",
+ ifstart));
+ continue;
+ }
+
+ entry = netsnmp_access_interface_entry_create(ifstart, 0);
+ if(NULL == entry) {
+#ifdef NETSNMP_ENABLE_IPV6
+ netsnmp_access_ipaddress_container_free(addr_container, 0);
+#endif
+ netsnmp_access_interface_container_free(container,
+ NETSNMP_ACCESS_INTERFACE_FREE_NOFLAGS);
+ fclose(devin);
+ close(fd);
+ return -3;
+ }
+ entry->ns_flags = flags; /* initial flags; we'll set more later */
+
+ /*
+ * xxx-rks: get descr by linking mem from /proc/pci and /proc/iomem
+ */
+
+
+ /*
+ * use ioctls for some stuff
+ * (ignore rc, so we get as much info as possible)
+ */
+ netsnmp_access_interface_ioctl_physaddr_get(fd, entry);
+
+ /*
+ * physaddr should have set type. make some guesses (based
+ * on name) if not.
+ */
+ if(0 == entry->type) {
+ typedef struct _match_if {
+ int mi_type;
+ const char *mi_name;
+ } *pmatch_if, match_if;
+
+ static match_if lmatch_if[] = {
+ {IANAIFTYPE_SOFTWARELOOPBACK, "lo"},
+ {IANAIFTYPE_ETHERNETCSMACD, "eth"},
+ {IANAIFTYPE_ETHERNETCSMACD, "vmnet"},
+ {IANAIFTYPE_ISO88025TOKENRING, "tr"},
+ {IANAIFTYPE_FASTETHER, "feth"},
+ {IANAIFTYPE_GIGABITETHERNET,"gig"},
+ {IANAIFTYPE_PPP, "ppp"},
+ {IANAIFTYPE_SLIP, "sl"},
+ {IANAIFTYPE_TUNNEL, "sit"},
+ {IANAIFTYPE_BASICISDN, "ippp"},
+ {IANAIFTYPE_PROPVIRTUAL, "bond"}, /* Bonding driver find fastest slave */
+ {IANAIFTYPE_PROPVIRTUAL, "vad"}, /* ANS driver - ?speed? */
+ {0, 0} /* end of list */
+ };
+
+ int ii, len;
+ register pmatch_if pm;
+
+ for (ii = 0, pm = lmatch_if; pm->mi_name; pm++) {
+ len = strlen(pm->mi_name);
+ if (0 == strncmp(entry->name, pm->mi_name, len)) {
+ entry->type = pm->mi_type;
+ break;
+ }
+ }
+ if(NULL == pm->mi_name)
+ entry->type = IANAIFTYPE_OTHER;
+ }
+
+ if (IANAIFTYPE_ETHERNETCSMACD == entry->type)
+ entry->speed =
+ netsnmp_linux_interface_get_if_speed(fd, entry->name);
+#ifdef APPLIED_PATCH_836390 /* xxx-rks ifspeed fixes */
+ else if (IANAIFTYPE_PROPVIRTUAL == entry->type)
+ entry->speed = _get_bonded_if_speed(entry);
+#endif
+ else
+ netsnmp_access_interface_entry_guess_speed(entry);
+
+ netsnmp_access_interface_ioctl_flags_get(fd, entry);
+
+ netsnmp_access_interface_ioctl_mtu_get(fd, entry);
+
+ /*
+ * Zero speed means link problem.
+ * - i'm not sure this is always true...
+ */
+ if((entry->speed == 0) && (entry->os_flags & IFF_UP)) {
+ entry->os_flags &= ~IFF_RUNNING;
+ }
+
+ /*
+ * check for promiscuous mode.
+ * NOTE: there are 2 ways to set promiscuous mode in Linux
+ * (kernels later than 2.2.something) - using ioctls and
+ * using setsockopt. The ioctl method tested here does not
+ * detect if an interface was set using setsockopt. google
+ * on IFF_PROMISC and linux to see lots of arguments about it.
+ */
+ if(entry->os_flags & IFF_PROMISC) {
+ entry->promiscuous = 1; /* boolean */
+ }
+
+ /*
+ * hardcoded max packet size
+ * (see ip_frag_reasm: if(len > 65535) goto out_oversize;)
+ */
+ entry->reasm_max_v4 = entry->reasm_max_v6 = 65535;
+ entry->ns_flags |=
+ NETSNMP_INTERFACE_FLAGS_HAS_V4_REASMMAX |
+ NETSNMP_INTERFACE_FLAGS_HAS_V6_REASMMAX;
+
+ netsnmp_access_interface_entry_overrides(entry);
+
+ entry->speed_high = entry->speed / 1000000;
+
+ if (! (load_flags & NETSNMP_ACCESS_INTERFACE_LOAD_NO_STATS))
+ _parse_stats(entry, stats, scan_expected);
+
+ if (flags & NETSNMP_INTERFACE_FLAGS_HAS_IPV4)
+ _arch_interface_flags_v4_get(entry);
+
+#ifdef NETSNMP_ENABLE_IPV6
+ if (flags & NETSNMP_INTERFACE_FLAGS_HAS_IPV6)
+ _arch_interface_flags_v6_get(entry);
+#endif /* NETSNMP_ENABLE_IPV6 */
+
+ /*
+ * add to container
+ */
+ CONTAINER_INSERT(container, entry);
+ }
+#ifdef NETSNMP_ENABLE_IPV6
+ netsnmp_access_ipaddress_container_free(addr_container, 0);
+#endif
+ fclose(devin);
+ close(fd);
+ return 0;
+}
+
+int
+netsnmp_arch_set_admin_status(netsnmp_interface_entry * entry,
+ int ifAdminStatus_val)
+{
+ int and_complement;
+
+ DEBUGMSGTL(("access:interface:arch", "set_admin_status\n"));
+
+ if(IFADMINSTATUS_UP == ifAdminStatus_val)
+ and_complement = 0; /* |= */
+ else
+ and_complement = 1; /* &= ~ */
+
+ return netsnmp_access_interface_ioctl_flags_set(-1, entry,
+ IFF_UP, and_complement);
+}
+
+#ifdef HAVE_LINUX_ETHTOOL_H
+/**
+ * Determines network interface speed from ETHTOOL_GSET
+ */
+unsigned int
+netsnmp_linux_interface_get_if_speed(int fd, const char *name)
+{
+ struct ifreq ifr;
+ struct ethtool_cmd edata;
+
+ memset(&ifr, 0, sizeof(ifr));
+ edata.cmd = ETHTOOL_GSET;
+
+ strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)-1);
+ ifr.ifr_data = (char *) &edata;
+
+ if (ioctl(fd, SIOCETHTOOL, &ifr) == -1) {
+ DEBUGMSGTL(("mibII/interfaces", "ETHTOOL_GSET on %s failed\n",
+ ifr.ifr_name));
+ return netsnmp_linux_interface_get_if_speed_mii(fd,name);
+ }
+
+ if (edata.speed != SPEED_10 && edata.speed != SPEED_100 &&
+ edata.speed != SPEED_1000) {
+ DEBUGMSGTL(("mibII/interfaces", "fallback to mii for %s\n",
+ ifr.ifr_name));
+ /* try MII */
+ return netsnmp_linux_interface_get_if_speed_mii(fd,name);
+ }
+
+ /* return in bps */
+ DEBUGMSGTL(("mibII/interfaces", "ETHTOOL_GSET on %s speed = %d\n",
+ ifr.ifr_name, edata.speed));
+ return edata.speed*1000*1000;
+}
+#endif
+
+/**
+ * Determines network interface speed from MII
+ */
+unsigned int
+#ifdef HAVE_LINUX_ETHTOOL_H
+netsnmp_linux_interface_get_if_speed_mii(int fd, const char *name)
+#else
+netsnmp_linux_interface_get_if_speed(int fd, const char *name)
+#endif
+{
+ unsigned int retspeed = 10000000;
+ struct ifreq ifr;
+
+ /* the code is based on mii-diag utility by Donald Becker
+ * see ftp://ftp.scyld.com/pub/diag/mii-diag.c
+ */
+ ushort *data = (ushort *)(&ifr.ifr_data);
+ unsigned phy_id;
+ int mii_reg, i;
+ ushort mii_val[32];
+ ushort bmcr, bmsr, nway_advert, lkpar;
+ const unsigned int media_speeds[] = {10000000, 10000000, 100000000, 100000000, 10000000, 0};
+ /* It corresponds to "10baseT", "10baseT-FD", "100baseTx", "100baseTx-FD", "100baseT4", "Flow-control", 0, */
+
+ strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
+ ifr.ifr_name[ sizeof(ifr.ifr_name)-1 ] = 0;
+ data[0] = 0;
+
+ /*
+ * SIOCGMIIPHY has been defined since at least kernel 2.4.10 (Sept 2001).
+ * It's probably safe to drop the interim SIOCDEVPRIVATE handling now!
+ */
+ if (ioctl(fd, SIOCGMIIPHY, &ifr) < 0) {
+ DEBUGMSGTL(("mibII/interfaces", "SIOCGMIIPHY on %s failed\n",
+ ifr.ifr_name));
+ return retspeed;
+ }
+
+ /* Begin getting mii register values */
+ phy_id = data[0];
+ for (mii_reg = 0; mii_reg < 8; mii_reg++){
+ data[0] = phy_id;
+ data[1] = mii_reg;
+ if(ioctl(fd, SIOCGMIIREG, &ifr) <0){
+ DEBUGMSGTL(("mibII/interfaces", "SIOCGMIIREG on %s failed\n", ifr.ifr_name));
+ }
+ mii_val[mii_reg] = data[3];
+ }
+ /*Parsing of mii values*/
+ /*Invalid basic mode control register*/
+ if (mii_val[0] == 0xffff || mii_val[1] == 0x0000) {
+ DEBUGMSGTL(("mibII/interfaces", "No MII transceiver present!.\n"));
+ return retspeed;
+ }
+ /* Descriptive rename. */
+ bmcr = mii_val[0]; /*basic mode control register*/
+ bmsr = mii_val[1]; /* basic mode status register*/
+ nway_advert = mii_val[4]; /* autonegotiation advertisement*/
+ lkpar = mii_val[5]; /*link partner ability*/
+
+ /*Check for link existence, returns 0 if link is absent*/
+ if ((bmsr & 0x0016) != 0x0004){
+ DEBUGMSGTL(("mibII/interfaces", "No link...\n"));
+ retspeed = 0;
+ return retspeed;
+ }
+
+ if(!(bmcr & 0x1000) ){
+ DEBUGMSGTL(("mibII/interfaces", "Auto-negotiation disabled.\n"));
+ retspeed = bmcr & 0x2000 ? 100000000 : 10000000;
+ return retspeed;
+ }
+ /* Link partner got our advertised abilities */
+ if (lkpar & 0x4000) {
+ int negotiated = nway_advert & lkpar & 0x3e0;
+ int max_capability = 0;
+ /* Scan for the highest negotiated capability, highest priority
+ (100baseTx-FDX) to lowest (10baseT-HDX). */
+ int media_priority[] = {8, 9, 7, 6, 5}; /* media_names[i-5] */
+ for (i = 0; media_priority[i]; i++){
+ if (negotiated & (1 << media_priority[i])) {
+ max_capability = media_priority[i];
+ break;
+ }
+ }
+ if (max_capability)
+ retspeed = media_speeds[max_capability - 5];
+ else
+ DEBUGMSGTL(("mibII/interfaces", "No common media type was autonegotiated!\n"));
+ }else if(lkpar & 0x00A0){
+ retspeed = (lkpar & 0x0080) ? 100000000 : 10000000;
+ }
+ return retspeed;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_solaris2.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_solaris2.c
new file mode 100644
index 0000000000..66fb22f7f1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_solaris2.c
@@ -0,0 +1,358 @@
+/*
+ * Interface MIB architecture support for Solaris
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include "mibII/mibII_common.h"
+#include "if-mib/ifTable/ifTable_constants.h"
+#include "kernel_sunos5.h"
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/data_access/interface.h>
+#include "if-mib/data_access/interface.h"
+#include <sys/ioctl.h>
+#include <sys/sockio.h>
+#include <strings.h>
+#include <string.h>
+
+static int _set_ip_flags_v4(netsnmp_interface_entry *, mib2_ifEntry_t *);
+static int _match_ifname_v4addr(void *ifname, void *ipaddr);
+static int _get_v4addr(mib2_ifEntry_t *ife, mib2_ipAddrEntry_t *e);
+
+static int _set_ip_flags_v6(netsnmp_interface_entry *, mib2_ifEntry_t *);
+#ifdef SOLARIS_HAVE_IPV6_MIB_SUPPORT
+static int _get_v6addr(mib2_ifEntry_t *ife, mib2_ipv6AddrEntry_t *ipv6e);
+static int _match_ifname_v6addr(void *ifname, void *ipaddr);
+#endif
+
+void
+netsnmp_arch_interface_init(void)
+{
+ init_kernel_sunos5();
+}
+
+/*
+ * find the ifIndex for an interface name
+ *
+ * @retval 0 : no index found
+ * @retval >0: ifIndex for interface
+ */
+oid
+netsnmp_arch_interface_index_find(const char *name)
+{
+#if defined(HAVE_IF_NAMETOINDEX)
+ return if_nametoindex(name);
+#else /* use GIFINDEX */
+ return solaris2_if_nametoindex(name, strlen(name));
+#endif /* defined(HAVE_IF_NAMETOINDEX) */
+}
+
+/*
+ * @retval 0 success
+ * @retval -1 no container specified
+ * @retval -2 could not create entry (probably malloc)
+ */
+int
+netsnmp_arch_interface_container_load(netsnmp_container* container,
+ u_int l_flags)
+{
+ netsnmp_interface_entry *entry = NULL;
+ mib2_ifEntry_t ife;
+ int rc;
+ req_e req = GET_FIRST;
+ int error = 0;
+
+ DEBUGMSGTL(("access:interface:container:arch", "load (flags %p)\n",
+ l_flags));
+
+ if (container == NULL) {
+ snmp_log(LOG_ERR,
+ "no container specified/found for interface\n");
+ return -1;
+ }
+
+ while ((rc = getMibstat(MIB_INTERFACES, &ife, sizeof(ife), req,
+ &Get_everything, NULL)) == 0) {
+
+ req = GET_NEXT;
+
+ DEBUGMSGTL(("access:interface:container:arch",
+ "processing '%s'\n", ife.ifDescr.o_bytes));
+ entry =
+ netsnmp_access_interface_entry_create(ife.ifDescr.o_bytes,
+ ife.ifIndex);
+ if (entry == NULL) {
+ error = 1;
+ break;
+ }
+ entry->ns_flags = 0;
+
+ if (l_flags & NETSNMP_ACCESS_INTERFACE_LOAD_IP4_ONLY &&
+ _set_ip_flags_v4(entry, &ife) == 0) {
+ netsnmp_access_interface_entry_free(entry);
+ continue;
+ } else if (l_flags & NETSNMP_ACCESS_INTERFACE_LOAD_IP6_ONLY &&
+ _set_ip_flags_v6(entry, &ife) == 0) {
+ netsnmp_access_interface_entry_free(entry);
+ continue;
+ } else {
+ (void) _set_ip_flags_v4(entry, &ife);
+ (void) _set_ip_flags_v6(entry, &ife);
+ }
+
+ /*
+ * collect the information needed by IF-MIB
+ */
+ entry->paddr = malloc(ife.ifPhysAddress.o_length);
+ if (entry->paddr == NULL) {
+ netsnmp_access_interface_entry_free(entry);
+ error = 1;
+ break;
+ }
+ entry->paddr_len = ife.ifPhysAddress.o_length;
+ (void)memcpy(entry->paddr, ife.ifPhysAddress.o_bytes,
+ ife.ifPhysAddress.o_length);
+
+ entry->type = ife.ifType;
+ entry->mtu = ife.ifMtu;
+ entry->speed = ife.ifSpeed;
+ entry->speed_high = entry->speed / 1000000;
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_HIGH_SPEED;
+ entry->oper_status = ife.ifOperStatus;
+ entry->admin_status = ife.ifAdminStatus;
+
+ if (ife.flags & IFF_PROMISC)
+ entry->promiscuous = 1;
+
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_ACTIVE;
+
+ /*
+ * Interface Stats.
+ */
+ if (! (l_flags & NETSNMP_ACCESS_INTERFACE_LOAD_NO_STATS)) {
+ entry->ns_flags |=
+ NETSNMP_INTERFACE_FLAGS_HAS_BYTES |
+ NETSNMP_INTERFACE_FLAGS_HAS_DROPS |
+ NETSNMP_INTERFACE_FLAGS_HAS_MCAST_PKTS;
+ if (ife.ifHCInOctets > 0 || ife.ifHCOutOctets > 0) {
+ /*
+ * We make the assumption that if we have
+ * a 64-bit Octet counter, then the other
+ * counters are 64-bit as well.
+ */
+ DEBUGMSGTL(("access:interface:container:arch",
+ "interface '%s' have 64-bit stat counters\n",
+ entry->name));
+ entry->ns_flags |=
+ NETSNMP_INTERFACE_FLAGS_HAS_HIGH_BYTES |
+ NETSNMP_INTERFACE_FLAGS_HAS_HIGH_PACKETS;
+ /* in stats */
+ entry->stats.ibytes.low = ife.ifHCInOctets & 0xffffffff;
+ entry->stats.ibytes.high = ife.ifHCInOctets >> 32;
+ entry->stats.iucast.low = ife.ifHCInUcastPkts & 0xffffffff;
+ entry->stats.iucast.high = ife.ifHCInUcastPkts >> 32;
+ entry->stats.imcast.low = ife.ifHCInMulticastPkts & 0xffffffff;
+ entry->stats.imcast.high = ife.ifHCInMulticastPkts >> 32;
+ entry->stats.ibcast.low = ife.ifHCInBroadcastPkts & 0xffffffff;
+ entry->stats.ibcast.high = ife.ifHCInBroadcastPkts >> 32;
+ /* out stats */
+ entry->stats.obytes.low = ife.ifHCOutOctets & 0xffffffff;
+ entry->stats.obytes.high = ife.ifHCOutOctets >> 32;
+ entry->stats.oucast.low = ife.ifHCOutUcastPkts & 0xffffffff;
+ entry->stats.oucast.high = ife.ifHCOutUcastPkts >> 32;
+ entry->stats.omcast.low = ife.ifHCOutMulticastPkts & 0xffffffff;
+ entry->stats.omcast.high = ife.ifHCOutMulticastPkts >> 32;
+ entry->stats.obcast.low = ife.ifHCOutBroadcastPkts & 0xffffffff;
+ entry->stats.obcast.high = ife.ifHCOutBroadcastPkts >> 32;
+ } else {
+ DEBUGMSGTL(("access:interface:container:arch",
+ "interface '%s' have 32-bit stat counters\n",
+ entry->name));
+ /* in stats */
+ entry->stats.ibytes.low = ife.ifInOctets;
+ entry->stats.iucast.low = ife.ifInUcastPkts;
+ entry->stats.imcast.low = ife.ifHCInMulticastPkts & 0xffffffff;
+ entry->stats.ibcast.low = ife.ifHCInBroadcastPkts & 0xffffffff;
+ /* out stats */
+ entry->stats.obytes.low = ife.ifOutOctets;
+ entry->stats.oucast.low = ife.ifOutUcastPkts;
+ entry->stats.omcast.low = ife.ifHCOutMulticastPkts & 0xffffffff;
+ entry->stats.obcast.low = ife.ifHCOutBroadcastPkts & 0xffffffff;
+ }
+ /* in stats */
+ entry->stats.ierrors = ife.ifInErrors;
+ entry->stats.idiscards = ife.ifInDiscards;
+ entry->stats.iunknown_protos = ife.ifInUnknownProtos;
+ entry->stats.inucast = ife.ifInNUcastPkts;
+ /* out stats */
+ entry->stats.oerrors = ife.ifOutErrors;
+ entry->stats.odiscards = ife.ifOutDiscards;
+ entry->stats.onucast = ife.ifOutNUcastPkts;
+ entry->stats.oqlen = ife.ifOutQLen;
+
+ /* other stats */
+ entry->stats.collisions = ife.ifCollisions;
+ }
+
+ netsnmp_access_interface_entry_overrides(entry);
+
+ /*
+ * add to container
+ */
+ CONTAINER_INSERT(container, entry);
+ }
+ DEBUGMSGTL(("access:interface:container:arch", "rc = %d\n", rc));
+
+ if (error) {
+ DEBUGMSGTL(("access:interface:container:arch",
+ "error %d, free container\n", error));
+ netsnmp_access_interface_container_free(container,
+ NETSNMP_ACCESS_INTERFACE_FREE_NOFLAGS);
+ return -2;
+ }
+
+ return 0;
+}
+/**
+ * @internal
+ */
+static int
+_set_ip_flags_v4(netsnmp_interface_entry *entry, mib2_ifEntry_t *ife)
+{
+ mib2_ipAddrEntry_t ipv4e;
+
+ if (_get_v4addr(ife, &ipv4e) > 0) {
+ entry->reasm_max_v4 = ipv4e.ipAdEntReasmMaxSize;
+ entry->ns_flags |=
+ NETSNMP_INTERFACE_FLAGS_HAS_IPV4 |
+ NETSNMP_INTERFACE_FLAGS_HAS_V4_REASMMAX;
+#if defined( SOLARIS_HAVE_RFC4293_SUPPORT )
+ entry->retransmit_v4 = ipv4e.ipAdEntRetransmitTime;
+ entry->ns_flags |=
+ NETSNMP_INTERFACE_FLAGS_HAS_V4_RETRANSMIT;
+#endif
+ return (1);
+ }
+ return (0);
+}
+
+/**
+ * @internal
+ */
+static int
+_set_ip_flags_v6(netsnmp_interface_entry *entry, mib2_ifEntry_t *ife)
+{
+#ifdef SOLARIS_HAVE_IPV6_MIB_SUPPORT
+ mib2_ipv6AddrEntry_t ipv6e;
+
+ if (_get_v6addr(ife, &ipv6e) > 0) {
+ entry->ns_flags |=
+ NETSNMP_INTERFACE_FLAGS_HAS_IPV6;
+#if defined( SOLARIS_HAVE_RFC4293_SUPPORT )
+ if (ipv6e.ipv6AddrIdentifierLen <= sizeof(entry->v6_if_id)) {
+ entry->v6_if_id_len = ipv6e.ipv6AddrIdentifierLen;
+ (void)memcpy(&entry->v6_if_id, &ipv6e.ipv6AddrIdentifier,
+ entry->v6_if_id_len);
+ entry->ns_flags |=
+ NETSNMP_INTERFACE_FLAGS_HAS_V6_IFID;
+ }
+ entry->reasm_max_v6 = ipv6e.ipv6AddrReasmMaxSize;
+ entry->retransmit_v6 = ipv6e.ipv6AddrRetransmitTime;
+ entry->reachable_time = ipv6e.ipv6AddrReachableTime;
+ entry->ns_flags |=
+ NETSNMP_INTERFACE_FLAGS_HAS_V6_REASMMAX |
+ NETSNMP_INTERFACE_FLAGS_HAS_V6_RETRANSMIT |
+ NETSNMP_INTERFACE_FLAGS_HAS_V6_REACHABLE;
+
+ /* XXX forwarding info missing */
+#else
+ /* XXX Don't have this info, 1500 is the minimum */
+ entry->reasm_max_v6 = 1500;
+ entry->ns_flags |=
+ NETSNMP_INTERFACE_FLAGS_HAS_V6_REASMMAX; /* ??? */
+#endif /* SOLARIS_HAVE_RFC4293_SUPPORT */
+ return (1);
+ }
+#endif /* SOLARIS_HAVE_IPV6_MIB_SUPPORT */
+ return (0);
+}
+
+/**
+ * @internal
+ */
+static int
+_match_ifname_v4addr(void *ifname, void *ipaddr)
+{
+ DeviceName *devname = &((mib2_ipAddrEntry_t *)ipaddr)->ipAdEntIfIndex;
+
+ return (strncmp((char *)ifname, devname->o_bytes, devname->o_length));
+
+}
+
+/**
+ * @internal
+ *
+ * Search for address entry that belongs to the IF entry.
+ * Returns 1 if an address was found, in which case the entry
+ * will be stored in ipv4e. If not entry was found, 0 is returned.
+ *
+ */
+static int
+_get_v4addr(mib2_ifEntry_t *ife, mib2_ipAddrEntry_t *ipv4e)
+{
+ int rc;
+
+ if ((rc = getMibstat(MIB_IP_ADDR, ipv4e, sizeof(*ipv4e), GET_EXACT,
+ &_match_ifname_v4addr, &ife->ifDescr.o_bytes)) == 0)
+ return (1);
+ bzero((void *)ipv4e, sizeof(*ipv4e));
+ return (0);
+}
+
+#ifdef SOLARIS_HAVE_IPV6_MIB_SUPPORT
+/**
+ * @internal
+ */
+static int
+_match_ifname_v6addr(void *ifname, void *ipaddr)
+{
+ DeviceName *devname = &((mib2_ipv6AddrEntry_t*)ipaddr)->ipv6AddrIfIndex;
+
+ return (strncmp((char *)ifname, devname->o_bytes, devname->o_length));
+
+}
+
+/**
+ * @internal
+ *
+ * Search for address entry that belongs to the IF entry.
+ * Returns 1 if an address was found, in which case the entry
+ * will be stored in ipv4e. If not entry was found, 0 is returned.
+ *
+ */
+static int
+_get_v6addr(mib2_ifEntry_t *ife, mib2_ipv6AddrEntry_t *ipv6e)
+{
+ int rc;
+
+ if ((rc = getMibstat(MIB_IP6_ADDR, ipv6e, sizeof(*ipv6e), GET_EXACT,
+ &_match_ifname_v6addr, &ife->ifDescr.o_bytes)) == 0) {
+ return (1);
+ }
+ bzero((void *)ipv6e, sizeof(*ipv6e));
+ return (0);
+}
+#endif /* SOLARIS_HAVE_IPV6_MIB_SUPPORT */
+
+int
+netsnmp_arch_set_admin_status(netsnmp_interface_entry * entry,
+ int ifAdminStatus_val)
+{
+ DEBUGMSGTL(("access:interface:arch", "set_admin_status\n"));
+
+ /*
+ * XXX Not supported yet
+ */
+ return (-1);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_sysctl.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_sysctl.c
new file mode 100644
index 0000000000..27b2aae5d6
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_sysctl.c
@@ -0,0 +1,565 @@
+/*
+ * Interface MIB architecture support
+ *
+ * Based on patch 1362403, submited by Rojer
+ *
+ * $Id: interface_sysctl.c 16552 2007-06-20 21:34:24Z tanders $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include "mibII/mibII_common.h"
+#include "if-mib/ifTable/ifTable_constants.h"
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#else
+#error "BSD should have sys/ioctl header"
+#endif
+
+#include <net-snmp/data_access/interface.h>
+#include <net-snmp/data_access/ipaddress.h>
+#include "if-mib/data_access/interface.h"
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_types.h>
+#include <net/if_media.h>
+
+/*
+ * account for minor differences between FreeBSD and OpenBSD.
+ * If this gets unruly, split stuff out into the respective
+ * files (interface_*BDS.c).
+ */
+/*
+ * FreeBSD has 2 promiscuous flags: kernel/user; check either
+ * http://unix.derkeiler.com/Mailing-Lists/FreeBSD/net/2004-09/0289.html
+ * which says:
+ * The first flag (IFF_PROMISC) is the one that the kernel code uses and
+ * sets on an interface's ifp structure. The second one is the one that
+ * comes from user space programs and is sent to the routine ifhwioctl()
+ * to set the first flag.
+ */
+#ifdef IFF_PPROMISC
+# define ARCH_PROMISC_FLAG (IFF_PPROMISC|IFF_PROMISC)
+#else
+# define ARCH_PROMISC_FLAG IFF_PROMISC
+#endif
+
+extern struct timeval starttime;
+
+/* sa_len roundup macro. */
+#define ROUNDUP(a) \
+ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+
+void
+netsnmp_arch_interface_init(void)
+{
+ /*
+ * nothing to do
+ */
+}
+
+/*
+ * find the ifIndex for an interface name
+ *
+ * @retval 0 : no index found
+ * @retval >0: ifIndex for interface
+ */
+oid
+netsnmp_arch_interface_index_find(const char *name)
+{
+ return if_nametoindex(name);
+}
+
+/*
+ * subroutine to translate known media typed to speed.
+ * see /usr/include/net/if_media.h for definitions
+ */
+
+void
+netsnmp_sysctl_ifmedia_to_speed(int media, u_int *speed,
+ u_int *speed_high)
+{
+ *speed = 0;
+ *speed_high = 0;
+
+ switch (IFM_TYPE(media)) {
+ case IFM_ETHER:
+ switch (IFM_SUBTYPE(media)) {
+ case IFM_10_T:
+ case IFM_10_2:
+ case IFM_10_5:
+ case IFM_10_STP:
+ case IFM_10_FL:
+ *speed = 10000000;
+ *speed_high = 10; break;
+ case IFM_100_TX:
+ case IFM_100_FX:
+ case IFM_100_T4:
+ case IFM_100_VG:
+ case IFM_100_T2:
+ *speed = 100000000;
+ *speed_high = 100; break;
+ case IFM_1000_LX:
+ case IFM_1000_CX:
+#ifdef IFM_1000_T
+ case IFM_1000_T:
+#endif
+ *speed = 1000000000;
+ *speed_high = 1000; break;
+#ifdef IFM_10GBASE_SR
+ case IFM_10GBASE_SR:
+ case IFM_10GBASE_LR:
+ *speed = (u_int) -1; /* 4294967295; */
+ *speed_high = 10000; break;
+#endif
+ }
+ break;
+ case IFM_IEEE80211:
+ switch (IFM_SUBTYPE(media)) {
+ case IFM_IEEE80211_FH1:
+ case IFM_IEEE80211_DS1:
+ *speed = 1000000;
+ *speed_high = 1;
+ break;
+ case IFM_IEEE80211_FH2:
+ case IFM_IEEE80211_DS2:
+ *speed = 2000000;
+ *speed_high = 2;
+ break;
+ case IFM_IEEE80211_DS5:
+ *speed = 5500000;
+ *speed_high = 5;
+ break;
+ case IFM_IEEE80211_DS11:
+ *speed = 11000000;
+ *speed_high = 11;
+ break;
+ case IFM_IEEE80211_DS22:
+ *speed = 22000000;
+ *speed_high = 22;
+ break;
+#ifdef IFM_IEEE80211_OFDM6
+ case IFM_IEEE80211_OFDM6:
+ *speed = 6000000;
+ *speed_high = 6;
+ break;
+ case IFM_IEEE80211_OFDM9:
+ *speed = 9000000;
+ *speed_high = 9;
+ break;
+ case IFM_IEEE80211_OFDM12:
+ *speed = 12000000;
+ *speed_high = 12;
+ break;
+ case IFM_IEEE80211_OFDM18:
+ *speed = 18000000;
+ *speed_high = 18;
+ break;
+ case IFM_IEEE80211_OFDM24:
+ *speed = 24000000;
+ *speed_high = 24;
+ break;
+ case IFM_IEEE80211_OFDM36:
+ *speed = 36000000;
+ *speed_high = 36;
+ break;
+ case IFM_IEEE80211_OFDM48:
+ *speed = 48000000;
+ *speed_high = 48;
+ break;
+ case IFM_IEEE80211_OFDM54:
+ *speed = 54000000;
+ *speed_high = 54;
+ break;
+ case IFM_IEEE80211_OFDM72:
+ *speed = 72000000;
+ *speed_high = 72;
+ break;
+#endif
+ }
+ break;
+ case IFM_TOKEN:
+ switch (IFM_SUBTYPE(media)) {
+ case IFM_TOK_STP4:
+ case IFM_TOK_UTP4:
+ *speed = 4000000;
+ *speed_high = 4;
+ break;
+ case IFM_TOK_STP16:
+ case IFM_TOK_UTP16:
+ *speed = 16000000;
+ *speed_high = 16;
+ break;
+#if defined(IFM_TOK_STP100) /* guessing if you've got one, you've got the other.. */
+ case IFM_TOK_STP100:
+ case IFM_TOK_UTP100:
+ *speed = 100000000;
+ *speed_high = 100;
+ break;
+#endif
+ }
+ break;
+#ifdef IFM_ATM
+ case IFM_ATM:
+ switch (IFM_SUBTYPE(media)) {
+ case IFM_ATM_MM_155:
+ case IFM_ATM_SM_155:
+ *speed = 155000000;
+ *speed_high = 155;
+ break;
+ case IFM_ATM_MM_622:
+ case IFM_ATM_SM_622:
+ *speed = 622000000;
+ *speed_high = 622;
+ break;
+ }
+#endif
+ }
+ return;
+}
+
+/*
+ * @retval 0 speed could not be determined (error, unknown media)
+ * @retval >0 speed, equal to *speed.
+ * sets *speed=2^31 and returns *speed_high=speed/10^6 as required
+ * by ifSpeed/ifHighSpeed.
+ */
+
+int
+netsnmp_sysctl_get_if_speed(char *name, u_int *speed,
+ u_int *speed_high)
+{
+ int s;
+ struct ifmediareq ifmr;
+ int *media_list, i;
+ u_int t_speed, t_speed_high;
+ u_int m_speed, m_speed_high;
+
+ *speed = 0;
+ *speed_high = 0;
+
+ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ return 0;
+ }
+
+ (void) memset(&ifmr, 0, sizeof(ifmr));
+ (void) strncpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name));
+
+ DEBUGMSGTL(("access:interface:container:sysctl"," speed in\n"));
+ if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0 ||
+ ifmr.ifm_count == 0) {
+
+ close(s);
+ return 0;
+ }
+
+ /*
+ * try to get speed from current media.
+ * if unsuccessful (e.g., interface is down), get a list of capabilities,
+ * try each and return maximum speed the interface is capable of.
+ */
+
+ netsnmp_sysctl_ifmedia_to_speed(ifmr.ifm_current, speed, speed_high);
+
+ if (*speed == 0 &&
+ (media_list = (int *) malloc(ifmr.ifm_count * sizeof(int))) != NULL ) {
+
+ ifmr.ifm_ulist = media_list;
+
+ if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) == 0) {
+ m_speed = 0;
+ m_speed_high = 0;
+ for (i = 0; i < ifmr.ifm_count; i++) {
+
+ netsnmp_sysctl_ifmedia_to_speed(media_list[i], &t_speed,
+ &t_speed_high);
+ if (t_speed_high > m_speed_high ||
+ (t_speed_high == m_speed_high && t_speed > t_speed)) {
+ m_speed_high = t_speed_high;
+ m_speed = t_speed;
+ }
+ }
+ *speed = m_speed;
+ *speed_high = m_speed_high;
+ }
+ free(media_list);
+ }
+
+ close(s);
+
+ DEBUGMSGTL(("access:interface:container:sysctl",
+ "%s: speed: %u, speed_high: %u\n",
+ name, *speed, *speed_high));
+
+ return *speed;
+}
+
+/*
+ *
+ * @retval 0 success
+ * @retval -1 no container specified
+ * @retval -2 could not get interface info
+ * @retval -3 could not create entry (probably malloc)
+ */
+int
+netsnmp_arch_interface_container_load(netsnmp_container* container,
+ u_int load_flags)
+{
+ netsnmp_interface_entry *entry = NULL;
+ u_char *if_list = NULL, *cp;
+ size_t if_list_size = 0;
+ struct if_msghdr *ifp;
+ int sysctl_oid[] = { CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST, 0 };
+ struct ifa_msghdr *ifa;
+ struct sockaddr *a;
+ struct sockaddr_dl *adl;
+ int amask;
+ char *if_name;
+ int flags;
+
+ DEBUGMSGTL(("access:interface:container:sysctl",
+ "load (flags %p)\n", load_flags));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "no container specified/found for interface\n");
+ return -1;
+ }
+
+ if (sysctl(sysctl_oid, sizeof(sysctl_oid)/sizeof(int), 0,
+ &if_list_size, 0, 0) == -1) {
+ snmp_log(LOG_ERR, "could not get interface info (size)\n");
+ return -2;
+ }
+
+ if_list = malloc(if_list_size);
+ if (if_list == NULL) {
+ snmp_log(LOG_ERR, "could not allocate memory for interface info "
+ "(%lu bytes)\n", if_list_size);
+ return -3;
+ } else {
+ DEBUGMSGTL(("access:interface:container:sysctl",
+ "allocated %lu bytes for if_list\n", if_list_size));
+ }
+
+ if (sysctl(sysctl_oid, sizeof(sysctl_oid)/sizeof(int), if_list,
+ &if_list_size, 0, 0) == -1) {
+ snmp_log(LOG_ERR, "could not get interface info\n");
+ free(if_list);
+ return -2;
+ }
+
+ /* 1st pass: create interface entries */
+ for (cp = if_list; cp < if_list + if_list_size; cp += ifp->ifm_msglen) {
+
+ ifp = (struct if_msghdr *) cp;
+ if_name = NULL;
+ flags = 0;
+ adl = NULL;
+
+ if (ifp->ifm_type != RTM_IFINFO)
+ continue;
+
+ if (ifp->ifm_addrs & RTA_IFP) {
+ a = (struct sockaddr *) (ifp + 1);
+ /*
+ * if_msghdr is followed by one or more sockaddrs, of which we
+ * need only RTA_IFP. most of the time RTA_IFP is the first
+ * address we get, hence the shortcut.
+ */
+ if ((ifp->ifm_addrs & (~RTA_IFP - 1)) != 0) {
+ /* skip all addresses up to RTA_IFP. */
+ for (amask = (RTA_IFP >> 1); amask != 0; amask >>= 1) {
+ if (ifp->ifm_addrs & amask)
+ a = (struct sockaddr *)
+ ( ((char *) a) + ROUNDUP(a->sa_len) );
+ }
+ }
+ adl = (struct sockaddr_dl *) a;
+ if_name = (char *) adl->sdl_data;
+ if_name[adl->sdl_nlen] = '\0';
+ }
+ if (!(ifp->ifm_addrs & RTA_IFP) || if_name == NULL) {
+ snmp_log(LOG_ERR, "ifm_index %u: no interface name in message, "
+ "skipping\n", ifp->ifm_index);
+ continue;
+ }
+
+ entry = netsnmp_access_interface_entry_create(if_name, ifp->ifm_index);
+ if(NULL == entry) {
+ netsnmp_access_interface_container_free(container,
+ NETSNMP_ACCESS_INTERFACE_FREE_NOFLAGS);
+ free(if_list);
+ return -3;
+ }
+
+ /* get physical address */
+ if (adl != NULL && adl->sdl_alen > 0) {
+ entry->paddr_len = adl->sdl_alen;
+ entry->paddr = malloc(entry->paddr_len);
+ memcpy(entry->paddr, adl->sdl_data + adl->sdl_nlen, adl->sdl_alen);
+ DEBUGMSGTL(("access:interface:container:sysctl",
+ "%s: paddr_len=%d, entry->paddr=%x:%x:%x:%x:%x:%x\n",
+ if_name, entry->paddr_len,
+ entry->paddr[0], entry->paddr[1], entry->paddr[2],
+ entry->paddr[3], entry->paddr[4], entry->paddr[5]));
+ } else {
+ entry->paddr = malloc(6);
+ entry->paddr_len = 6;
+ memset(entry->paddr, 0, 6);
+ }
+
+ entry->mtu = ifp->ifm_data.ifi_mtu;
+ entry->type = ifp->ifm_data.ifi_type;
+
+
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_IF_FLAGS;
+ entry->os_flags = ifp->ifm_flags;
+
+ if (ifp->ifm_flags & IFF_UP) {
+ entry->admin_status = IFADMINSTATUS_UP;
+#if defined( LINK_STATE_UP ) && defined( LINK_STATE_DOWN )
+ if (ifp->ifm_data.ifi_link_state == LINK_STATE_UP) {
+ entry->oper_status = IFOPERSTATUS_UP;
+ } else if (ifp->ifm_data.ifi_link_state == LINK_STATE_DOWN) {
+ entry->oper_status = IFOPERSTATUS_DOWN;
+ } else
+#endif
+ {
+ /*
+ * link state is unknown, which is not very useful to report.
+ * use running state instead.
+ */
+ entry->oper_status = ifp->ifm_flags & IFF_RUNNING ? 1 : 2;
+ }
+ } else {
+ entry->admin_status = IFADMINSTATUS_DOWN;
+ /*
+ * IF-MIB specifically says that ifOperStatus should be down in
+ * this case
+ */
+ entry->oper_status = IFOPERSTATUS_DOWN;
+ }
+
+ entry->reasm_max_v4 = entry->reasm_max_v6 = IP_MAXPACKET;
+ entry->ns_flags |=
+ NETSNMP_INTERFACE_FLAGS_HAS_V4_REASMMAX |
+ NETSNMP_INTERFACE_FLAGS_HAS_V6_REASMMAX;
+
+ /* get counters */
+ entry->stats.ibytes.low = ifp->ifm_data.ifi_ibytes;
+ entry->stats.ibytes.high = 0;
+ entry->stats.iucast.low = ifp->ifm_data.ifi_ipackets;
+ entry->stats.iucast.high = 0;
+ entry->stats.imcast.low = ifp->ifm_data.ifi_imcasts;
+ entry->stats.imcast.high = 0;
+ entry->stats.ierrors = ifp->ifm_data.ifi_ierrors;
+ entry->stats.idiscards = ifp->ifm_data.ifi_iqdrops;
+ entry->stats.iunknown_protos = ifp->ifm_data.ifi_noproto;
+
+ entry->stats.obytes.low = ifp->ifm_data.ifi_obytes;
+ entry->stats.obytes.high = 0;
+ entry->stats.oucast.low = ifp->ifm_data.ifi_opackets;
+ entry->stats.oucast.high = 0;
+ entry->stats.omcast.low = ifp->ifm_data.ifi_omcasts;
+ entry->stats.omcast.high = 0;
+ entry->stats.oerrors = ifp->ifm_data.ifi_oerrors;
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_BYTES |
+ NETSNMP_INTERFACE_FLAGS_HAS_DROPS |
+ NETSNMP_INTERFACE_FLAGS_HAS_MCAST_PKTS;
+
+ if (timercmp(&ifp->ifm_data.ifi_lastchange, &starttime, >)) {
+ entry->lastchange = (ifp->ifm_data.ifi_lastchange.tv_sec -
+ starttime.tv_sec) * 100;
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_LASTCHANGE;
+ } else {
+ entry->lastchange = 0;
+ }
+
+ if (ifp->ifm_flags & ARCH_PROMISC_FLAG)
+ entry->promiscuous = 1;
+
+ /* try to guess the speed from media type */
+ netsnmp_sysctl_get_if_speed(entry->name, &entry->speed,
+ &entry->speed_high);
+ if (entry->speed_high != 0) {
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_HIGH_SPEED;
+ } else {
+ /* or resort to ifi_baudrate */
+ entry->speed = ifp->ifm_data.ifi_baudrate;
+ }
+
+ netsnmp_access_interface_entry_overrides(entry);
+
+ CONTAINER_INSERT(container, entry);
+ DEBUGMSGTL(("access:interface:container:sysctl",
+ "created entry %u for %s\n", entry->index, entry->name));
+ } /* for (each interface entry) */
+
+ /* pass 2: walk addresses */
+ for (cp = if_list; cp < if_list + if_list_size; cp += ifa->ifam_msglen) {
+
+ ifa = (struct ifa_msghdr *) cp;
+
+ if (ifa->ifam_type != RTM_NEWADDR)
+ continue;
+
+ DEBUGMSGTL(("access:interface:container:sysctl",
+ "received 0x%x in RTM_NEWADDR for ifindex %u\n",
+ ifa->ifam_addrs, ifa->ifam_index));
+
+ entry = netsnmp_access_interface_entry_get_by_index(container,
+ ifa->ifam_index);
+ if (entry == NULL) {
+ snmp_log(LOG_ERR, "address for a nonexistent interface? index=%d",
+ ifa->ifam_index);
+ continue;
+ }
+
+ /*
+ * walk the list of addresses received. we do not use actual
+ * addresses, the sole purpose of this is to set flags
+ */
+ a = (struct sockaddr *) (ifa + 1);
+ for (amask = ifa->ifam_addrs; amask != 0; amask >>= 1) {
+ if ((amask & 1) != 0) {
+ DEBUGMSGTL(("access:interface:container:sysctl",
+ "%s: a=%p, sa_len=%d, sa_family=0x%x\n",
+ entry->name, a, a->sa_len, a->sa_family));
+
+ if (a->sa_family == AF_INET)
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_IPV4;
+ else if (a->sa_family == AF_INET6)
+ entry->ns_flags |= NETSNMP_INTERFACE_FLAGS_HAS_IPV6;
+
+ a = (struct sockaddr *) ( ((char *) a) + ROUNDUP(a->sa_len) );
+ }
+ }
+ DEBUGMSGTL(("access:interface:container:sysctl",
+ "%s: flags=0x%x\n", entry->name, entry->ns_flags));
+ }
+
+ if (if_list != NULL)
+ free(if_list);
+
+ return 0;
+}
+
+int
+netsnmp_arch_set_admin_status(netsnmp_interface_entry * entry,
+ int ifAdminStatus_val)
+{
+ DEBUGMSGTL(("access:interface:arch", "set_admin_status\n"));
+
+ /* TODO: implement this call */
+
+ /* not implemented */
+ snmp_log(LOG_ERR, "netsnmp_arch_set_admin_status not (yet) implemented "
+ "for BSD sysctl.\n");
+
+ return -4;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_sysctl.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_sysctl.h
new file mode 100644
index 0000000000..ea5c05c2f7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/data_access/interface_sysctl.h
@@ -0,0 +1,31 @@
+/*
+ * Interface MIB architecture support
+ *
+ * Based on patch 1362403, submited by Rojer
+ *
+ * $Id: interface_sysctl.h 15068 2006-08-24 14:30:04Z rstory $
+ */
+#ifndef INTERFACE_SYSCTL_H
+#define INTERFACE_SYSCTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int
+netsnmp_access_interface_sysctl_container_load(netsnmp_container* container,
+ u_int load_flags);
+
+void
+netsnmp_access_interface_sysctl_ifmedia_to_speed(int media, u_int *speed,
+ u_int *speed_high);
+
+int
+netsnmp_access_interface_sysctl_get_if_speed(char *name, u_int *speed,
+ u_int *speed_high);
+
+# ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable.h
new file mode 100644
index 0000000000..65fa09a80e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable.h
@@ -0,0 +1,5 @@
+/*
+ * module to include the modules
+ */
+
+config_require(if-mib/ifTable/ifTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable.c
new file mode 100644
index 0000000000..1710b519d9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable.c
@@ -0,0 +1,2352 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: ifTable.c 15461 2006-10-19 20:38:00Z hardaker $
+ */
+/** \page MFD helper for ifTable
+ *
+ * \section intro Introduction
+ * Introductory text.
+ *
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ifTable.h"
+#include "ifTable_defs.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "ifTable_interface.h"
+
+#ifdef USING_IP_MIB_IPV4INTERFACETABLE_IPV4INTERFACETABLE_MODULE
+# include "ip-mib/ipv4InterfaceTable/ipv4InterfaceTable.h"
+#endif
+#ifdef USING_IP_MIB_IPV6INTERFACETABLE_IPV6INTERFACETABLE_MODULE
+# include "ip-mib/ipv4InterfaceTable/ipv4InterfaceTable.h"
+#endif
+#ifdef USING_IF_MIB_IFXTABLE_IFXTABLE_MODULE
+# include "if-mib/ifXTable/ifXTable.h"
+#endif
+
+oid ifTable_oid[] = { IFTABLE_OID };
+int ifTable_oid_size = OID_LENGTH(ifTable_oid);
+
+ifTable_registration ifTable_user_context;
+
+void initialize_table_ifTable(void);
+void shutdown_table_ifTable(void);
+
+static int
+_if_number_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests);
+
+
+/**
+ * Initializes the ifTable module
+ */
+void
+init_ifTable(void)
+{
+ static int ifTable_did_init = 0;
+
+ DEBUGMSGTL(("verbose:ifTable:init_ifTable", "called\n"));
+
+ /*
+ * TODO:300:o: Perform ifTable one-time module initialization.
+ */
+ if (++ifTable_did_init != 1) {
+ DEBUGMSGTL(("ifTable:init_ifTable", "ignoring duplicate call\n"));
+ return;
+ }
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ if (should_init("ifTable")) {
+
+#ifdef USING_IP_MIB_IPV4INTERFACETABLE_IPV4INTERFACETABLE_MODULE
+ if (should_init("ipv4InterfaceTable"))
+ initialize_table_ipv4InterfaceTable();
+#endif
+
+#ifdef USING_IP_MIB_IPV6INTERFACETABLE_IPV6INTERFACETABLE_MODULE
+ if (should_init("ipv6InterfaceTable"))
+ initialize_table_ipv6InterfaceTable();
+#endif
+
+ initialize_table_ifTable();
+
+#ifdef USING_IF_MIB_IFXTABLE_IFXTABLE_MODULE
+ if (should_init("ifXTable"))
+ initialize_table_ifXTable();
+#endif
+ }
+} /* init_ifTable */
+
+/**
+ * Shut-down the ifTable module (agent is exiting)
+ */
+void
+shutdown_ifTable(void)
+{
+ if (should_init("ifTable"))
+ shutdown_table_ifTable();
+
+}
+
+/**
+ * Initialize the table ifTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_ifTable(void)
+{
+ ifTable_registration *user_context;
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:ifTable:initialize_table_ifTable", "called\n"));
+
+ /*
+ * TODO:301:o: Perform ifTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize ifTable user context
+ * if you'd like to pass in a pointer to some data for this
+ * table, allocate or set it up here.
+ */
+ /*
+ * a netsnmp_data_list is a simple way to store void pointers. A simple
+ * string token is used to add, find or remove pointers.
+ */
+ user_context = netsnmp_create_data_list("ifTable", NULL, NULL);
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _ifTable_initialize_interface(user_context, flags);
+
+ /*
+ * register scalar for ifNumber
+ */
+ {
+ oid reg_oid[] =
+ { IFTABLE_NUMBER };
+ netsnmp_handler_registration *myreg;
+
+ myreg =
+ netsnmp_create_handler_registration("if number",
+ _if_number_handler,
+ reg_oid,
+ OID_LENGTH(reg_oid),
+ HANDLER_CAN_RONLY);
+ netsnmp_register_scalar(myreg);
+ }
+
+} /* initialize_table_ifTable */
+
+/**
+ * Shutdown the table ifTable
+ */
+void
+shutdown_table_ifTable(void)
+{
+ /*
+ * call interface shutdown code
+ */
+ _ifTable_shutdown_interface(&ifTable_user_context);
+}
+
+/**
+ * extra context initialization (eg default values)
+ *
+ * @param rowreq_ctx : row request context
+ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
+ *
+ * @retval MFD_SUCCESS : no errors
+ * @retval MFD_ERROR : error (context allocate will fail)
+ */
+int
+ifTable_rowreq_ctx_init(ifTable_rowreq_ctx * rowreq_ctx,
+ void *user_init_ctx)
+{
+ DEBUGMSGTL(("verbose:ifTable:ifTable_rowreq_ctx_init", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:210:o: |-> Perform extra ifTable rowreq initialization. (eg DEFVALS)
+ */
+ if (NULL == user_init_ctx)
+ rowreq_ctx->data.ifentry =
+ netsnmp_access_interface_entry_create(NULL, 0);
+ else
+ rowreq_ctx->data.ifentry =
+ (netsnmp_interface_entry *) user_init_ctx;
+
+ return MFD_SUCCESS;
+} /* ifTable_rowreq_ctx_init */
+
+/**
+ * extra context cleanup
+ * @param rowreq_ctx
+ */
+void
+ifTable_rowreq_ctx_cleanup(ifTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ifTable:ifTable_rowreq_ctx_cleanup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:211:o: |-> Perform extra ifTable rowreq cleanup.
+ */
+ if (NULL != rowreq_ctx->data.ifentry) {
+ netsnmp_access_interface_entry_free(rowreq_ctx->data.ifentry);
+ rowreq_ctx->data.ifentry = NULL;
+ }
+} /* ifTable_rowreq_ctx_cleanup */
+
+/**
+ * pre-request callback
+ * @param user_context
+ *
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+ifTable_pre_request(ifTable_registration * user_context)
+{
+ DEBUGMSGTL(("verbose:ifTable:ifTable_pre_request", "called\n"));
+
+ /*
+ * TODO:510:o: Perform ifTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* ifTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ * Note:
+ * New rows have been inserted into the container, and
+ * deleted rows have been removed from the container and
+ * released.
+ *
+ * @param user_context
+ * @param rc : MFD_SUCCESS if all requests succeeded
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+ifTable_post_request(ifTable_registration * user_context, int rc)
+{
+ DEBUGMSGTL(("verbose:ifTable:ifTable_post_request", "called\n"));
+
+ /*
+ * TODO:511:o: Perform ifTable post-request actions.
+ */
+
+ /*
+ * check to set if any rows were changed.
+ */
+ if (ifTable_dirty_get()) {
+ /*
+ * check if request was successful. If so, this would be
+ * a good place to save data to its persistent store.
+ */
+ if (MFD_SUCCESS == rc) {
+ /*
+ * save changed rows, if you haven't already
+ */
+ snmp_store(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_APPTYPE));
+ }
+
+ ifTable_dirty_set(0); /* clear table dirty flag */
+ }
+
+ return MFD_SUCCESS;
+} /* ifTable_post_request */
+
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ifTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IF-MIB::ifTable is subid 2 of interfaces.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.2.2, length: 8
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement ifTable data context functions.
+ */
+
+
+/**
+ * set mib index(es)
+ *
+ * @param tbl_idx mib index structure
+ * @param ifIndex_val
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This convenience function is useful for setting all the MIB index
+ * components with a single function call. It is assume that the C values
+ * have already been mapped from their native/rawformat to the MIB format.
+ */
+int
+ifTable_indexes_set_tbl_idx(ifTable_mib_index * tbl_idx, long ifIndex_val)
+{
+ DEBUGMSGTL(("verbose:ifTable:ifTable_indexes_set_tbl_idx",
+ "called\n"));
+
+ /*
+ * ifIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H
+ */
+ tbl_idx->ifIndex = ifIndex_val;
+
+
+ return MFD_SUCCESS;
+} /* ifTable_indexes_set_tbl_idx */
+
+/**
+ * @internal
+ * set row context indexes
+ *
+ * @param reqreq_ctx the row context that needs updated indexes
+ * @param ifIndex_val
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This function sets the mib indexs, then updates the oid indexs
+ * from the mib index.
+ */
+int
+ifTable_indexes_set(ifTable_rowreq_ctx * rowreq_ctx, long ifIndex_val)
+{
+ DEBUGMSGTL(("verbose:ifTable:ifTable_indexes_set", "called\n"));
+
+ if (MFD_SUCCESS !=
+ ifTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx, ifIndex_val))
+ return MFD_ERROR;
+
+ /*
+ * convert mib index to oid index
+ */
+ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
+ if (0 != ifTable_index_to_oid(&rowreq_ctx->oid_idx,
+ &rowreq_ctx->tbl_idx)) {
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS;
+} /* ifTable_indexes_set */
+
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifDescr
+ * ifDescr is subid 2 of ifEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.2
+ * Description:
+A textual string containing information about the
+ interface. This string should include the name of the
+ manufacturer, the product name and the version of the
+ interface hardware/software.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 1
+ * settable 0
+ * hint: 255a
+ *
+ * Ranges: 0 - 255;
+ *
+ * Its syntax is DisplayString (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 255)
+ */
+/**
+ * Extract the current value of the ifDescr data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifDescr_val_ptr_ptr
+ * Pointer to storage for a char variable
+ * @param ifDescr_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by ifDescr.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*ifDescr_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update ifDescr_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+ifDescr_get(ifTable_rowreq_ctx * rowreq_ctx, char **ifDescr_val_ptr_ptr,
+ size_t * ifDescr_val_ptr_len_ptr)
+{
+ char *tmp_descr = NULL;
+ u_char tmp_len = 0;
+
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert((NULL != ifDescr_val_ptr_ptr)
+ && (NULL != *ifDescr_val_ptr_ptr));
+ netsnmp_assert(NULL != ifDescr_val_ptr_len_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifDescr_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * if ifDescr is NULL, use the ifName
+ */
+ if (NULL == rowreq_ctx->data.ifDescr) {
+#ifdef USING_IF_MIB_IFXTABLE_IFXTABLE_MODULE
+ tmp_descr = rowreq_ctx->data.ifName;
+#else
+ tmp_descr = NULL;
+#endif
+ } else
+ tmp_descr = rowreq_ctx->data.ifDescr;
+
+ if (NULL != tmp_descr)
+ tmp_len = strlen(tmp_descr);
+ else
+ tmp_len = 0;
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifDescr data.
+ * copy (* ifDescr_val_ptr_ptr ) data and (* ifDescr_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * make sure there is enough space for ifDescr data
+ */
+ if ((NULL == (*ifDescr_val_ptr_ptr)) ||
+ ((*ifDescr_val_ptr_len_ptr) < tmp_len)) {
+ /*
+ * allocate space for ifDescr data
+ */
+ (*ifDescr_val_ptr_ptr) =
+ malloc(tmp_len * sizeof(rowreq_ctx->data.ifDescr[0]));
+ if (NULL == (*ifDescr_val_ptr_ptr)) {
+ snmp_log(LOG_ERR, "could not allocate memory\n");
+ return MFD_ERROR;
+ }
+ }
+ (*ifDescr_val_ptr_len_ptr) =
+ tmp_len * sizeof(rowreq_ctx->data.ifDescr[0]);
+ memcpy((*ifDescr_val_ptr_ptr), tmp_descr, (*ifDescr_val_ptr_len_ptr));
+
+ return MFD_SUCCESS;
+} /* ifDescr_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifType
+ * ifType is subid 3 of ifEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.3
+ * Description:
+The type of interface. Additional values for ifType are
+ assigned by the Internet Assigned Numbers Authority (IANA),
+ through updating the syntax of the IANAifType textual
+ convention.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ * Enum range: 149/256. Values: other(1), regular1822(2), hdh1822(3), ddnX25(4), rfc877x25(5), ethernetCsmacd(6), iso88023Csmacd(7), iso88024TokenBus(8), iso88025TokenRing(9), iso88026Man(10), starLan(11), proteon10Mbit(12), proteon80Mbit(13), hyperchannel(14), fddi(15), lapb(16), sdlc(17), ds1(18), e1(19), basicISDN(20), primaryISDN(21), propPointToPointSerial(22), ppp(23), softwareLoopback(24), eon(25), ethernet3Mbit(26), nsip(27), slip(28), ultra(29), ds3(30), sip(31), frameRelay(32), rs232(33), para(34), arcnet(35), arcnetPlus(36), atm(37), miox25(38), sonet(39), x25ple(40), iso88022llc(41), localTalk(42), smdsDxi(43), frameRelayService(44), v35(45), hssi(46), hippi(47), modem(48), aal5(49), sonetPath(50), sonetVT(51), smdsIcip(52), propVirtual(53), propMultiplexor(54), ieee80212(55), fibreChannel(56), hippiInterface(57), frameRelayInterconnect(58), aflane8023(59), aflane8025(60), cctEmul(61), fastEther(62), isdn(63), v11(64), v36(65), g703at64k(66), g703at2mb(67), qllc(68), fastEtherFX(69), channel(70), ieee80211(71), ibm370parChan(72), escon(73), dlsw(74), isdns(75), isdnu(76), lapd(77), ipSwitch(78), rsrb(79), atmLogical(80), ds0(81), ds0Bundle(82), bsc(83), async(84), cnr(85), iso88025Dtr(86), eplrs(87), arap(88), propCnls(89), hostPad(90), termPad(91), frameRelayMPI(92), x213(93), adsl(94), radsl(95), sdsl(96), vdsl(97), iso88025CRFPInt(98), myrinet(99), voiceEM(100), voiceFXO(101), voiceFXS(102), voiceEncap(103), voiceOverIp(104), atmDxi(105), atmFuni(106), atmIma(107), pppMultilinkBundle(108), ipOverCdlc(109), ipOverClaw(110), stackToStack(111), virtualIpAddress(112), mpc(113), ipOverAtm(114), iso88025Fiber(115), tdlc(116), gigabitEthernet(117), hdlc(118), lapf(119), v37(120), x25mlp(121), x25huntGroup(122), trasnpHdlc(123), interleave(124), fast(125), ip(126), docsCableMaclayer(127), docsCableDownstream(128), docsCableUpstream(129), a12MppSwitch(130), tunnel(131), coffee(132), ces(133), atmSubInterface(134), l2vlan(135), l3ipvlan(136), l3ipxvlan(137), digitalPowerline(138), mediaMailOverIp(139), dtm(140), dcn(141), ipForward(142), msdsl(143), ieee1394(144), if_gsn(145), dvbRccMacLayer(146), dvbRccDownstream(147), dvbRccUpstream(148), atmVirtual(149), mplsTunnel(150), srp(151), voiceOverAtm(152), voiceOverFrameRelay(153), idsl(154), compositeLink(155), ss7SigLink(156), propWirelessP2P(157), frForward(158), rfc1483(159), usb(160), ieee8023adLag(161), bgppolicyaccounting(162), frf16MfrBundle(163), h323Gatekeeper(164), h323Proxy(165), mpls(166), mfSigLink(167), hdsl2(168), shdsl(169), ds1FDL(170), pos(171), dvbAsiIn(172), dvbAsiOut(173), plc(174), nfas(175), tr008(176), gr303RDT(177), gr303IDT(178), isup(179), propDocsWirelessMaclayer(180), propDocsWirelessDownstream(181), propDocsWirelessUpstream(182), hiperlan2(183), propBWAp2Mp(184), sonetOverheadChannel(185), digitalWrapperOverheadChannel(186), aal2(187), radioMAC(188), atmRadio(189), imt(190), mvl(191), reachDSL(192), frDlciEndPt(193), atmVciEndPt(194), opticalChannel(195), opticalTransport(196), propAtm(197), voiceOverCable(198), infiniband(199), teLink(200), q2931(201), virtualTg(202), sipTg(203), sipSig(204), docsCableUpstreamChannel(205), econet(206), pon155(207), pon622(208), bridge(209), linegroup(210), voiceEMFGD(211), voiceFGDEANA(212), voiceDID(213), mpegTransport(214), sixToFour(215), gtp(216), pdnEtherLoop1(217), pdnEtherLoop2(218), opticalChannelGroup(219), homepna(220), gfp(221), ciscoISLvlan(222), actelisMetaLOOP(223), fcipLink(224)
+ *
+ * Its syntax is IANAifType (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ifType data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifType_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifType_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifType_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifType_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifType_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifType data.
+ * copy (* ifType_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifType_val_ptr) = rowreq_ctx->data.ifType;
+
+ return MFD_SUCCESS;
+} /* ifType_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifMtu
+ * ifMtu is subid 4 of ifEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.4
+ * Description:
+The size of the largest packet which can be sent/received
+ on the interface, specified in octets. For interfaces that
+ are used for transmitting network datagrams, this is the
+ size of the largest network datagram that can be sent on the
+ interface.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the ifMtu data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifMtu_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifMtu_get(ifTable_rowreq_ctx * rowreq_ctx, long *ifMtu_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifMtu_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifMtu_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifMtu data.
+ * copy (* ifMtu_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifMtu_val_ptr) = rowreq_ctx->data.ifMtu;
+
+ return MFD_SUCCESS;
+} /* ifMtu_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifSpeed
+ * ifSpeed is subid 5 of ifEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.5
+ * Description:
+An estimate of the interface's current bandwidth in bits
+ per second. For interfaces which do not vary in bandwidth
+ or for those where no accurate estimation can be made, this
+ object should contain the nominal bandwidth. If the
+ bandwidth of the interface is greater than the maximum value
+ reportable by this object then this object should report its
+ maximum value (4,294,967,295) and ifHighSpeed must be used
+ to report the interace's speed. For a sub-layer which has
+ no concept of bandwidth, this object should be zero.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is GAUGE (based on perltype GAUGE)
+ * The net-snmp type is ASN_GAUGE. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifSpeed data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifSpeed_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifSpeed_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifSpeed_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifSpeed_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifSpeed_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifSpeed data.
+ * copy (* ifSpeed_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifSpeed_val_ptr) = rowreq_ctx->data.ifSpeed;
+
+ return MFD_SUCCESS;
+} /* ifSpeed_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifPhysAddress
+ * ifPhysAddress is subid 6 of ifEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.6
+ * Description:
+The interface's address at its protocol sub-layer. For
+ example, for an 802.x interface, this object normally
+ contains a MAC address. The interface's media-specific MIB
+ must define the bit and byte ordering and the format of the
+ value of this object. For interfaces which do not have such
+ an address (e.g., a serial line), this object should contain
+ an octet string of zero length.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 1
+ * settable 0
+ * hint: 1x:
+ *
+ *
+ * Its syntax is PhysAddress (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 255)
+ */
+/**
+ * Extract the current value of the ifPhysAddress data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifPhysAddress_val_ptr_ptr
+ * Pointer to storage for a char variable
+ * @param ifPhysAddress_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by ifPhysAddress.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*ifPhysAddress_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update ifPhysAddress_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+ifPhysAddress_get(ifTable_rowreq_ctx * rowreq_ctx,
+ char **ifPhysAddress_val_ptr_ptr,
+ size_t * ifPhysAddress_val_ptr_len_ptr)
+{
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert((NULL != ifPhysAddress_val_ptr_ptr)
+ && (NULL != *ifPhysAddress_val_ptr_ptr));
+ netsnmp_assert(NULL != ifPhysAddress_val_ptr_len_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifPhysAddress_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if ((rowreq_ctx->data.ifPhysAddress[0] == 0) &&
+ (rowreq_ctx->data.ifPhysAddress[1] == 0) &&
+ (rowreq_ctx->data.ifPhysAddress[2] == 0) &&
+ (rowreq_ctx->data.ifPhysAddress[3] == 0) &&
+ (rowreq_ctx->data.ifPhysAddress[4] == 0) &&
+ (rowreq_ctx->data.ifPhysAddress[5] == 0)) {
+ /*
+ * all 0s = empty string
+ */
+ (*ifPhysAddress_val_ptr_len_ptr) = 0;
+ return MFD_SUCCESS;
+ }
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifPhysAddress data.
+ * copy (* ifPhysAddress_val_ptr_ptr ) data and (* ifPhysAddress_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * make sure there is enough space for ifPhysAddress data
+ */
+ if ((NULL == (*ifPhysAddress_val_ptr_ptr)) ||
+ ((*ifPhysAddress_val_ptr_len_ptr) <
+ (rowreq_ctx->data.ifPhysAddress_len *
+ sizeof(rowreq_ctx->data.ifPhysAddress[0])))) {
+ /*
+ * allocate space for ifPhysAddress data
+ */
+ (*ifPhysAddress_val_ptr_ptr) =
+ malloc(rowreq_ctx->data.ifPhysAddress_len *
+ sizeof(rowreq_ctx->data.ifPhysAddress[0]));
+ if (NULL == (*ifPhysAddress_val_ptr_ptr)) {
+ snmp_log(LOG_ERR, "could not allocate memory\n");
+ return MFD_ERROR;
+ }
+ }
+ (*ifPhysAddress_val_ptr_len_ptr) =
+ rowreq_ctx->data.ifPhysAddress_len *
+ sizeof(rowreq_ctx->data.ifPhysAddress[0]);
+ memcpy((*ifPhysAddress_val_ptr_ptr), rowreq_ctx->data.ifPhysAddress,
+ (*ifPhysAddress_val_ptr_len_ptr));
+
+ return MFD_SUCCESS;
+} /* ifPhysAddress_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifAdminStatus
+ * ifAdminStatus is subid 7 of ifEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.2.2.1.7
+ * Description:
+The desired state of the interface. The testing(3) state
+ indicates that no operational packets can be passed. When a
+ managed system initializes, all interfaces start with
+ ifAdminStatus in the down(2) state. As a result of either
+ explicit management action or per configuration information
+ retained by the managed system, ifAdminStatus is then
+ changed to either the up(1) or testing(3) states (or remains
+ in the down(2) state).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 2/8. Values: up(1), down(2), testing(3)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ifAdminStatus data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifAdminStatus_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifAdminStatus_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifAdminStatus_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifAdminStatus_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifAdminStatus_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifAdminStatus data.
+ * copy (* ifAdminStatus_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifAdminStatus_val_ptr) = rowreq_ctx->data.ifAdminStatus;
+
+ return MFD_SUCCESS;
+} /* ifAdminStatus_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifOperStatus
+ * ifOperStatus is subid 8 of ifEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.8
+ * Description:
+The current operational state of the interface. The
+ testing(3) state indicates that no operational packets can
+ be passed. If ifAdminStatus is down(2) then ifOperStatus
+ should be down(2). If ifAdminStatus is changed to up(1)
+ then ifOperStatus should change to up(1) if the interface is
+ ready to transmit and receive network traffic; it should
+ change to dormant(5) if the interface is waiting for
+ external actions (such as a serial line waiting for an
+ incoming connection); it should remain in the down(2) state
+ if and only if there is a fault that prevents it from going
+ to the up(1) state; it should remain in the notPresent(6)
+ state if the interface has missing (typically, hardware)
+ components.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ * Enum range: 5/8. Values: up(1), down(2), testing(3), unknown(4), dormant(5), notPresent(6), lowerLayerDown(7)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ifOperStatus data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifOperStatus_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifOperStatus_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifOperStatus_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifOperStatus_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifOperStatus_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifOperStatus data.
+ * copy (* ifOperStatus_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifOperStatus_val_ptr) = rowreq_ctx->data.ifOperStatus;
+
+ return MFD_SUCCESS;
+} /* ifOperStatus_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifLastChange
+ * ifLastChange is subid 9 of ifEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.9
+ * Description:
+The value of sysUpTime at the time the interface entered
+ its current operational state. If the current state was
+ entered prior to the last re-initialization of the local
+ network management subsystem, then this object contains a
+ zero value.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is TICKS (based on perltype TICKS)
+ * The net-snmp type is ASN_TIMETICKS. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifLastChange data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifLastChange_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifLastChange_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifLastChange_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifLastChange_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifLastChange_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifLastChange data.
+ * copy (* ifLastChange_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifLastChange_val_ptr) = rowreq_ctx->data.ifLastChange;
+
+ return MFD_SUCCESS;
+} /* ifLastChange_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifInOctets
+ * ifInOctets is subid 10 of ifEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.10
+ * Description:
+The total number of octets received on the interface,
+ including framing characters.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifInOctets data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifInOctets_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifInOctets_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifInOctets_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifInOctets_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifInOctets_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifInOctets data.
+ * copy (* ifInOctets_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifInOctets_val_ptr) = rowreq_ctx->data.ifInOctets;
+
+ return MFD_SUCCESS;
+} /* ifInOctets_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifInUcastPkts
+ * ifInUcastPkts is subid 11 of ifEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.11
+ * Description:
+The number of packets, delivered by this sub-layer to a
+ higher (sub-)layer, which were not addressed to a multicast
+ or broadcast address at this sub-layer.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifInUcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifInUcastPkts_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifInUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifInUcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifInUcastPkts_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifInUcastPkts_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifInUcastPkts data.
+ * copy (* ifInUcastPkts_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifInUcastPkts_val_ptr) = rowreq_ctx->data.ifInUcastPkts;
+
+ return MFD_SUCCESS;
+} /* ifInUcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifInNUcastPkts
+ * ifInNUcastPkts is subid 12 of ifEntry.
+ * Its status is Deprecated, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.12
+ * Description:
+The number of packets, delivered by this sub-layer to a
+ higher (sub-)layer, which were addressed to a multicast or
+ broadcast address at this sub-layer.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+
+ This object is deprecated in favour of ifInMulticastPkts and
+ ifInBroadcastPkts.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifInNUcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifInNUcastPkts_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifInNUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifInNUcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifInNUcastPkts_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifInNUcastPkts_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifInNUcastPkts data.
+ * copy (* ifInNUcastPkts_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifInNUcastPkts_val_ptr) = rowreq_ctx->data.ifInNUcastPkts;
+
+ return MFD_SUCCESS;
+} /* ifInNUcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifInDiscards
+ * ifInDiscards is subid 13 of ifEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.13
+ * Description:
+The number of inbound packets which were chosen to be
+ discarded even though no errors had been detected to prevent
+
+ their being deliverable to a higher-layer protocol. One
+ possible reason for discarding such a packet could be to
+ free up buffer space.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifInDiscards data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifInDiscards_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifInDiscards_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifInDiscards_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifInDiscards_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifInDiscards_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifInDiscards data.
+ * copy (* ifInDiscards_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifInDiscards_val_ptr) = rowreq_ctx->data.ifInDiscards;
+
+ return MFD_SUCCESS;
+} /* ifInDiscards_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifInErrors
+ * ifInErrors is subid 14 of ifEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.14
+ * Description:
+For packet-oriented interfaces, the number of inbound
+ packets that contained errors preventing them from being
+ deliverable to a higher-layer protocol. For character-
+ oriented or fixed-length interfaces, the number of inbound
+ transmission units that contained errors preventing them
+ from being deliverable to a higher-layer protocol.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifInErrors data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifInErrors_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifInErrors_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifInErrors_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifInErrors_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifInErrors_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifInErrors data.
+ * copy (* ifInErrors_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifInErrors_val_ptr) = rowreq_ctx->data.ifInErrors;
+
+ return MFD_SUCCESS;
+} /* ifInErrors_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifInUnknownProtos
+ * ifInUnknownProtos is subid 15 of ifEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.15
+ * Description:
+For packet-oriented interfaces, the number of packets
+ received via the interface which were discarded because of
+ an unknown or unsupported protocol. For character-oriented
+ or fixed-length interfaces that support protocol
+ multiplexing the number of transmission units received via
+ the interface which were discarded because of an unknown or
+ unsupported protocol. For any interface that does not
+ support protocol multiplexing, this counter will always be
+ 0.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifInUnknownProtos data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifInUnknownProtos_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifInUnknownProtos_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifInUnknownProtos_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifInUnknownProtos_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifInUnknownProtos_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifInUnknownProtos data.
+ * copy (* ifInUnknownProtos_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifInUnknownProtos_val_ptr) = rowreq_ctx->data.ifInUnknownProtos;
+
+ return MFD_SUCCESS;
+} /* ifInUnknownProtos_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifOutOctets
+ * ifOutOctets is subid 16 of ifEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.16
+ * Description:
+The total number of octets transmitted out of the
+ interface, including framing characters.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifOutOctets data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifOutOctets_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifOutOctets_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifOutOctets_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifOutOctets_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifOutOctets_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifOutOctets data.
+ * copy (* ifOutOctets_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifOutOctets_val_ptr) = rowreq_ctx->data.ifOutOctets;
+
+ return MFD_SUCCESS;
+} /* ifOutOctets_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifOutUcastPkts
+ * ifOutUcastPkts is subid 17 of ifEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.17
+ * Description:
+The total number of packets that higher-level protocols
+ requested be transmitted, and which were not addressed to a
+ multicast or broadcast address at this sub-layer, including
+ those that were discarded or not sent.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifOutUcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifOutUcastPkts_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifOutUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifOutUcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifOutUcastPkts_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifOutUcastPkts_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifOutUcastPkts data.
+ * copy (* ifOutUcastPkts_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifOutUcastPkts_val_ptr) = rowreq_ctx->data.ifOutUcastPkts;
+
+ return MFD_SUCCESS;
+} /* ifOutUcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifOutNUcastPkts
+ * ifOutNUcastPkts is subid 18 of ifEntry.
+ * Its status is Deprecated, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.18
+ * Description:
+The total number of packets that higher-level protocols
+ requested be transmitted, and which were addressed to a
+ multicast or broadcast address at this sub-layer, including
+ those that were discarded or not sent.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+
+ This object is deprecated in favour of ifOutMulticastPkts
+ and ifOutBroadcastPkts.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifOutNUcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifOutNUcastPkts_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifOutNUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifOutNUcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifOutNUcastPkts_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifOutNUcastPkts_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifOutNUcastPkts data.
+ * copy (* ifOutNUcastPkts_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifOutNUcastPkts_val_ptr) = rowreq_ctx->data.ifOutNUcastPkts;
+
+ return MFD_SUCCESS;
+} /* ifOutNUcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifOutDiscards
+ * ifOutDiscards is subid 19 of ifEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.19
+ * Description:
+The number of outbound packets which were chosen to be
+ discarded even though no errors had been detected to prevent
+ their being transmitted. One possible reason for discarding
+ such a packet could be to free up buffer space.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifOutDiscards data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifOutDiscards_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifOutDiscards_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifOutDiscards_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifOutDiscards_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifOutDiscards_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifOutDiscards data.
+ * copy (* ifOutDiscards_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifOutDiscards_val_ptr) = rowreq_ctx->data.ifOutDiscards;
+
+ return MFD_SUCCESS;
+} /* ifOutDiscards_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifOutErrors
+ * ifOutErrors is subid 20 of ifEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.20
+ * Description:
+For packet-oriented interfaces, the number of outbound
+ packets that could not be transmitted because of errors.
+ For character-oriented or fixed-length interfaces, the
+ number of outbound transmission units that could not be
+ transmitted because of errors.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifOutErrors data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifOutErrors_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifOutErrors_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifOutErrors_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifOutErrors_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifOutErrors_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifOutErrors data.
+ * copy (* ifOutErrors_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifOutErrors_val_ptr) = rowreq_ctx->data.ifOutErrors;
+
+ return MFD_SUCCESS;
+} /* ifOutErrors_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifOutQLen
+ * ifOutQLen is subid 21 of ifEntry.
+ * Its status is Deprecated, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.21
+ * Description:
+The length of the output packet queue (in packets).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is GAUGE (based on perltype GAUGE)
+ * The net-snmp type is ASN_GAUGE. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifOutQLen data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifOutQLen_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifOutQLen_get(ifTable_rowreq_ctx * rowreq_ctx, u_long * ifOutQLen_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifOutQLen_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifOutQLen_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifOutQLen data.
+ * copy (* ifOutQLen_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifOutQLen_val_ptr) = rowreq_ctx->data.ifOutQLen;
+
+ return MFD_SUCCESS;
+} /* ifOutQLen_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifSpecific
+ * ifSpecific is subid 22 of ifEntry.
+ * Its status is Deprecated, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.2.2.1.22
+ * Description:
+A reference to MIB definitions specific to the particular
+ media being used to realize the interface. It is
+
+ recommended that this value point to an instance of a MIB
+ object in the media-specific MIB, i.e., that this object
+ have the semantics associated with the InstancePointer
+ textual convention defined in RFC 2579. In fact, it is
+ recommended that the media-specific MIB specify what value
+ ifSpecific should/can take for values of ifType. If no MIB
+ definitions specific to the particular media are available,
+ the value should be set to the OBJECT IDENTIFIER { 0 0 }.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is OBJECTID (based on perltype OBJECTID)
+ * The net-snmp type is ASN_OBJECT_ID. The C type decl is oid (oid)
+ * This data type requires a length. (Max 255)
+ */
+/**
+ * Extract the current value of the ifSpecific data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifSpecific_val_ptr_ptr
+ * Pointer to storage for a oid variable
+ * @param ifSpecific_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by ifSpecific.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*ifSpecific_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update ifSpecific_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+ifSpecific_get(ifTable_rowreq_ctx * rowreq_ctx,
+ oid ** ifSpecific_val_ptr_ptr,
+ size_t * ifSpecific_val_ptr_len_ptr)
+{
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert((NULL != ifSpecific_val_ptr_ptr)
+ && (NULL != *ifSpecific_val_ptr_ptr));
+ netsnmp_assert(NULL != ifSpecific_val_ptr_len_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifSpecific_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifSpecific data.
+ * copy (* ifSpecific_val_ptr_ptr ) data and (* ifSpecific_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+#ifdef IFTABLE_HAS_IFSPECIFIC
+ /*
+ * make sure there is enough space for ifSpecific data
+ */
+ if ((NULL == (*ifSpecific_val_ptr_ptr)) ||
+ ((*ifSpecific_val_ptr_len_ptr) <
+ (rowreq_ctx->data.ifSpecific_len *
+ sizeof(rowreq_ctx->data.ifSpecific[0])))) {
+ /*
+ * allocate space for ifSpecific data
+ */
+ (*ifSpecific_val_ptr_ptr) =
+ malloc(rowreq_ctx->data.ifSpecific_len *
+ sizeof(rowreq_ctx->data.ifSpecific[0]));
+ if (NULL == (*ifSpecific_val_ptr_ptr)) {
+ snmp_log(LOG_ERR, "could not allocate memory\n");
+ return MFD_ERROR;
+ }
+ }
+ (*ifSpecific_val_ptr_len_ptr) =
+ rowreq_ctx->data.ifSpecific_len *
+ sizeof(rowreq_ctx->data.ifSpecific[0]);
+ memcpy((*ifSpecific_val_ptr_ptr), rowreq_ctx->data.ifSpecific,
+ (*ifSpecific_val_ptr_len_ptr));
+#else
+ /*
+ * hard coded
+ */
+ netsnmp_assert((*ifSpecific_val_ptr_len_ptr) > nullOidLen);
+ (*ifSpecific_val_ptr_len_ptr) = nullOidLen;
+ memcpy(*ifSpecific_val_ptr_ptr, &nullOid, nullOidLen);
+#endif
+
+ return MFD_SUCCESS;
+} /* ifSpecific_get */
+
+
+
+/** @} */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ifTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IF-MIB::ifTable is subid 2 of interfaces.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.2.2, length: 8
+ */
+ /*
+ * NOTE: if you update this chart, please update the versions in
+ * local/mib2c-conf.d/parent-set.m2i
+ * agent/mibgroup/helpers/baby_steps.c
+ * while you're at it.
+ */
+ /*
+ ***********************************************************************
+ * Baby Steps Flow Chart (2004.06.05) *
+ * *
+ * +--------------+ +================+ U = unconditional path *
+ * |optional state| ||required state|| S = path for success *
+ * +--------------+ +================+ E = path for error *
+ ***********************************************************************
+ *
+ * +--------------+
+ * | pre |
+ * | request |
+ * +--------------+
+ * | U
+ * +==============+
+ * +----------------|| object ||
+ * | E || lookup ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | E || check ||
+ * |<---------------|| values ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | +<-------|| undo ||
+ * | | E || setup ||
+ * | | +==============+
+ * | | | S
+ * | | +==============+
+ * | | || set ||-------------------------->+
+ * | | || value || E |
+ * | | +==============+ |
+ * | | | S |
+ * | | +--------------+ |
+ * | | | check |-------------------------->|
+ * | | | consistency | E |
+ * | | +--------------+ |
+ * | | | S |
+ * | | +==============+ +==============+ |
+ * | | || commit ||-------->|| undo || |
+ * | | || || E || commit || |
+ * | | +==============+ +==============+ |
+ * | | | S U |<--------+
+ * | | +--------------+ +==============+
+ * | | | irreversible | || undo ||
+ * | | | commit | || set ||
+ * | | +--------------+ +==============+
+ * | | | U U |
+ * | +-------------->|<------------------------+
+ * | +==============+
+ * | || undo ||
+ * | || cleanup ||
+ * | +==============+
+ * +---------------------->| U
+ * +--------------+
+ * | post |
+ * | request |
+ * +--------------+
+ *
+ */
+
+/**
+ * Setup up context with information needed to undo a set request.
+ *
+ * Undo storage is in (* ifSpecific_val_ptr_ptr )*
+ * This function will be called before the individual node undo setup
+ * functions are called. If you need to do any undo setup that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that the undo context has been allocated with
+ * ifTable_allocate_data(), but may need extra
+ * initialization similar to what you may have done in
+ * ifTable_rowreq_ctx_init().
+ * Note that an individual node's undo_setup function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in the node's undo_setup
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ifTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * Undo storage is in (* ifSpecific_val_ptr_ptr )*
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+ifTable_undo_setup(ifTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ifTable:ifTable_undo_setup", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> Setup ifTable undo.
+ * set up ifTable undo information, in preparation for a set.
+ * Undo storage is in (* ifSpecific_val_ptr_ptr )*
+ */
+
+ return rc;
+} /* ifTable_undo_setup */
+
+/**
+ * Undo a set request.
+ *
+ * This function will be called before the individual node undo
+ * functions are called. If you need to do any undo that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that an individual node's undo function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is anything specific to a particular column (e.g. releasing
+ * memory for a string), you should do that setup in the node's undo
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ifTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+ifTable_undo(ifTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ifTable:ifTable_undo", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> ifTable undo.
+ * ifTable undo information, in response to a failed set.
+ * Undo storage is in (* ifSpecific_val_ptr_ptr )*
+ */
+
+ return rc;
+} /* ifTable_undo_setup */
+
+/**
+ * Cleanup up context undo information.
+ *
+ * This function will be called after set/commit processing. If you
+ * allocated any resources in undo_setup, this is the place to release
+ * those resources.
+ *
+ * This function is called regardless of the success or failure of the set
+ * request. If you need to perform different steps for cleanup depending
+ * on success or failure, you can add a flag to the rowreq_ctx.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ifTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ifTable_undo_cleanup(ifTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ifTable:ifTable_undo_cleanup", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:452:M: |-> Cleanup ifTable undo.
+ * Undo storage is in (* ifSpecific_val_ptr_ptr )*
+ */
+
+ return rc;
+} /* ifTable_undo_cleanup */
+
+/**
+ * commit new values.
+ *
+ * At this point, you should have done everything you can to ensure that
+ * this commit will not fail.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * ifTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ifTable_commit(ifTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+ int save_flags;
+
+ DEBUGMSGTL(("verbose:ifTable:ifTable_commit", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * save flags, then clear until we actually do something
+ */
+ save_flags = rowreq_ctx->column_set_flags;
+ rowreq_ctx->column_set_flags = 0;
+
+ /*
+ * commit ifTable data
+ * 1) check the column's flag in save_flags to see if it was set.
+ * 2) clear the flag when you handle that column
+ * 3) set the column's flag in column_set_flags if it needs undo
+ * processing in case of a failure.
+ */
+ if (save_flags & COLUMN_IFADMINSTATUS_FLAG) {
+ save_flags &= ~COLUMN_IFADMINSTATUS_FLAG; /* clear ifAdminStatus */
+ /*
+ * TODO:482:o: |-> commit column ifAdminStatus.
+ */
+ rc = netsnmp_access_interface_entry_set_admin_status(rowreq_ctx->
+ data.ifentry,
+ rowreq_ctx->
+ data.
+ ifAdminStatus);
+ if (0 != rc) {
+ snmp_log(LOG_ERR,
+ "ifTable column ifAdminStatus commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo ifAdminStatus
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_IFADMINSTATUS_FLAG;
+ }
+ }
+
+ /*
+ * if we successfully commited this row, set the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY;
+ }
+
+ if (save_flags) {
+ snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n",
+ save_flags);
+ return MFD_ERROR;
+ }
+
+ return rc;
+} /* ifTable_commit */
+
+/**
+ * undo commit new values.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * ifTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ifTable_undo_commit(ifTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ifTable:ifTable_undo_commit", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:485:M: |-> Undo ifTable commit.
+ * check the column's flag in rowreq_ctx->column_set_flags to see
+ * if it was set during commit, then undo it.
+ *
+ * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
+ */
+ /*
+ * no undo cleanup, undo entry simply freed
+ */
+
+
+ /*
+ * if we successfully un-commited this row, clear the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return rc;
+} /* ifTable_undo_commit */
+
+/*
+ * TODO:440:M: Implement ifTable node value checks.
+ * TODO:450:M: Implement ifTable undo functions.
+ * TODO:460:M: Implement ifTable set functions.
+ * TODO:480:M: Implement ifTable commit functions.
+ */
+/*---------------------------------------------------------------------
+ * IF-MIB::ifEntry.ifAdminStatus
+ * ifAdminStatus is subid 7 of ifEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.2.2.1.7
+ * Description:
+The desired state of the interface. The testing(3) state
+ indicates that no operational packets can be passed. When a
+ managed system initializes, all interfaces start with
+ ifAdminStatus in the down(2) state. As a result of either
+ explicit management action or per configuration information
+ retained by the managed system, ifAdminStatus is then
+ changed to either the up(1) or testing(3) states (or remains
+ in the down(2) state).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 2/8. Values: up(1), down(2), testing(3)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifAdminStatus_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ifTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of up(1), down(2), testing(3)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ifAdminStatus_check_value(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifAdminStatus_val)
+{
+ DEBUGMSGTL(("verbose:ifTable:ifAdminStatus_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ifAdminStatus value.
+ */
+ /*
+ * we don't support test
+ */
+ if (ifAdminStatus_val == IFADMINSTATUS_TESTING)
+ return MFD_ERROR;
+
+ return MFD_SUCCESS; /* ifAdminStatus value not illegal */
+} /* ifAdminStatus_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ifTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ifTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ifAdminStatus_undo_setup(ifTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ifTable:ifAdminStatus_undo_setup", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ifAdminStatus undo.
+ */
+ /*
+ * copy ifAdminStatus data
+ * set rowreq_ctx->undo->ifAdminStatus from rowreq_ctx->data.ifAdminStatus
+ */
+ rowreq_ctx->undo->ifAdminStatus = rowreq_ctx->data.ifAdminStatus;
+
+ return MFD_SUCCESS;
+} /* ifAdminStatus_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ifAdminStatus_val
+ * A long containing the new value.
+ */
+int
+ifAdminStatus_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifAdminStatus_val)
+{
+
+ DEBUGMSGTL(("verbose:ifTable:ifAdminStatus_set", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ifAdminStatus value.
+ * set ifAdminStatus value in rowreq_ctx->data
+ */
+ rowreq_ctx->data.ifAdminStatus = ifAdminStatus_val;
+
+ return MFD_SUCCESS;
+} /* ifAdminStatus_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ifAdminStatus_undo(ifTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ifTable:ifAdminStatus_undo", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ifAdminStatus undo.
+ */
+ /*
+ * copy ifAdminStatus data
+ * set rowreq_ctx->data.ifAdminStatus from rowreq_ctx->undo->ifAdminStatus
+ */
+ rowreq_ctx->data.ifAdminStatus = rowreq_ctx->undo->ifAdminStatus;
+
+
+ return MFD_SUCCESS;
+} /* ifAdminStatus_undo */
+
+/**
+ * check dependencies
+ *
+ * This is useful for for tables which have dependencies between columns
+ * (or rows, or tables). For example, two columns allocating a percentage
+ * of something add up 100%.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * ifTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ *
+ * @retval MFD_SUCCESS all the changes to the row are legal
+ * @retval MFD_ERROR one or more changes are not legal
+ *
+ * (see README-table-ifTable if you don't have dependencies)
+ */
+int
+ifTable_check_dependencies(ifTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("internal:ifTable:ifTable_check_dependencies",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:470:o: Check ifTable row dependencies.
+ * check that all new value are legal and consistent with each other
+ */
+ return rc;
+} /* ifTable_check_dependencies */
+
+
+static int
+_if_number_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ if (MODE_GET == reqinfo->mode) {
+ int val = ifTable_container_size();
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
+ (u_char *) &val, sizeof(val));
+ } else
+ netsnmp_assert("bad mode in RO handler");
+
+ if (handler->next && handler->next->access_method)
+ return netsnmp_call_next_handler(handler, reginfo, reqinfo,
+ requests);
+
+ return SNMP_ERR_NOERROR;
+}
+
+/** @} */
+/** @{ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable.h
new file mode 100644
index 0000000000..6b73c40e59
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable.h
@@ -0,0 +1,683 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: ifTable.h 15461 2006-10-19 20:38:00Z hardaker $
+ */
+#ifndef IFTABLE_H
+#define IFTABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @ingroup agent
+ * @defgroup misc misc: Miscellaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/data_access/interface.h>
+
+ /*
+ * other required module components
+ */
+ /* *INDENT-OFF* */
+config_require(if-mib/data_access/interface)
+config_require(if-mib/ifTable/ifTable_interface)
+config_require(if-mib/ifTable/ifTable_data_access)
+/*
+ * conflicts with mibII/interfaces
+ */
+config_exclude(mibII/interfaces)
+ /* *INDENT-ON* */
+
+ /*
+ * OID, column number and enum definions for ifTable
+ */
+#include "ifTable_constants.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_ifTable(void);
+ void shutdown_ifTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ifTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IF-MIB::ifTable is subid 2 of interfaces.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.2.2, length: 8
+ */
+ /*
+ *********************************************************************
+ * When you register your mib, you get to provide a generic
+ * pointer that will be passed back to you for most of the
+ * functions calls.
+ *
+ * TODO:100:r: Review all context structures
+ */
+ /*
+ * TODO:101:o: |-> Review ifTable registration context.
+ */
+ typedef netsnmp_data_list ifTable_registration;
+
+/**********************************************************************/
+ /*
+ * TODO:110:r: |-> Review ifTable data context structure.
+ * This structure is used to represent the data for ifTable.
+ */
+ /*
+ * This structure contains storage for all the columns defined in the
+ * ifTable.
+ */
+ typedef struct ifTable_data_s {
+
+ /*
+ * ifDescr(2)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/h
+ */
+
+ /*
+ * ifType(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+
+ /*
+ * ifMtu(4)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifSpeed(5)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifPhysAddress(6)/PhysAddress/ASN_OCTET_STR/char(char)//L/A/w/e/r/d/h
+ */
+
+ /*
+ * ifAdminStatus(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+
+ /*
+ * ifOperStatus(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+
+ /*
+ * ifLastChange(9)/TICKS/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifInOctets(10)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifInUcastPkts(11)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifInNUcastPkts(12)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifInDiscards(13)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifInErrors(14)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifInUnknownProtos(15)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifOutOctets(16)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifOutUcastPkts(17)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifOutNUcastPkts(18)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifOutDiscards(19)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifOutErrors(20)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifOutQLen(21)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifSpecific(22)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/w/e/r/d/h
+ */
+#ifdef IFTABLE_HAS_IFSPECIFIC
+ oid ifSpecific[128];
+ size_t ifSpecific_len; /* # of oid elements, not bytes */
+#endif
+
+#ifdef USING_IF_MIB_IFXTABLE_IFXTABLE_MODULE
+ /*
+ * ifXTable stuff
+ */
+ /*
+ * ifName(1)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H
+ */
+
+ /*
+ * ifInMulticastPkts(2)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifInBroadcastPkts(3)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifOutMulticastPkts(4)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifOutBroadcastPkts(5)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifHCInOctets(6)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifHCInUcastPkts(7)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifHCInMulticastPkts(8)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifHCInBroadcastPkts(9)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifHCOutOctets(10)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifHCOutUcastPkts(11)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifHCOutMulticastPkts(12)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifHCOutBroadcastPkts(13)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifLinkUpDownTrapEnable(14)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ u_long ifLinkUpDownTrapEnable;
+
+ /*
+ * ifHighSpeed(15)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h
+ */
+
+ /*
+ * ifPromiscuousMode(16)/TruthValue/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+
+ /*
+ * ifConnectorPresent(17)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+
+ /*
+ * ifAlias(18)/DisplayString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ char ifAlias[64];
+ size_t ifAlias_len; /* # of char elements, not bytes */
+
+ /*
+ * ifCounterDiscontinuityTime(19)/TimeStamp/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ u_long ifCounterDiscontinuityTime;
+#endif /* USING_IF_MIB_IFXTABLE_IFXTABLE_MODULE */
+
+
+ /*
+ * some data kept externally
+ */
+ netsnmp_interface_entry *ifentry;
+ } ifTable_data;
+
+
+ /*
+ *********************************************************************
+ * TODO:115:o: |-> Review ifTable undo context.
+ * We're just going to use the same data structure for our
+ * undo_context. If you want to do something more efficent,
+ * define your typedef here.
+ */
+ typedef ifTable_data ifTable_undo_data;
+
+ /*
+ * TODO:120:r: |-> Review ifTable mib index.
+ * This structure is used to represent the index for ifTable.
+ */
+ typedef struct ifTable_mib_index_s {
+
+ /*
+ * ifIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H
+ */
+ long ifIndex;
+
+
+ } ifTable_mib_index;
+
+ /*
+ * TODO:121:r: | |-> Review ifTable max index length.
+ * If you KNOW that your indexes will never exceed a certain
+ * length, update this macro to that length.
+ */
+#define MAX_ifTable_IDX_LEN 1
+
+
+ /*
+ *********************************************************************
+ * TODO:130:o: |-> Review ifTable Row request (rowreq) context.
+ * When your functions are called, you will be passed a
+ * ifTable_rowreq_ctx pointer.
+ */
+ typedef struct ifTable_rowreq_ctx_s {
+
+ /** this must be first for container compare to work */
+ netsnmp_index oid_idx;
+ oid oid_tmp[MAX_ifTable_IDX_LEN];
+
+ ifTable_mib_index tbl_idx;
+
+ ifTable_data data;
+ ifTable_undo_data *undo;
+ unsigned int column_set_flags; /* flags for set columns */
+
+
+ /*
+ * flags per row. Currently, the first (lower) 8 bits are reserved
+ * for the user. See mfd.h for other flags.
+ */
+ u_int rowreq_flags;
+
+ /*
+ * TODO:131:o: | |-> Add useful data to ifTable rowreq context.
+ */
+ char known_missing;
+ u_char undo_ref_count;
+
+ /*
+ * storage for future expansion
+ */
+ netsnmp_data_list *ifTable_data_list;
+
+ } ifTable_rowreq_ctx;
+
+ typedef struct ifTable_ref_rowreq_ctx_s {
+ ifTable_rowreq_ctx *rowreq_ctx;
+ } ifTable_ref_rowreq_ctx;
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int ifTable_pre_request(ifTable_registration *
+ user_context);
+ int ifTable_post_request(ifTable_registration *
+ user_context, int rc);
+
+ int ifTable_rowreq_ctx_init(ifTable_rowreq_ctx *
+ rowreq_ctx,
+ void *user_init_ctx);
+ void ifTable_rowreq_ctx_cleanup(ifTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifTable_check_dependencies(ifTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifTable_commit(ifTable_rowreq_ctx * rowreq_ctx);
+
+ ifTable_rowreq_ctx *ifTable_row_find_by_mib_index(ifTable_mib_index *
+ mib_idx);
+
+ extern oid ifTable_oid[];
+ extern int ifTable_oid_size;
+
+
+#include "ifTable_interface.h"
+#include "ifTable_data_access.h"
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ifTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IF-MIB::ifTable is subid 2 of interfaces.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.2.2, length: 8
+ */
+ /*
+ * indexes
+ */
+
+ int ifDescr_get(ifTable_rowreq_ctx * rowreq_ctx,
+ char **ifDescr_val_ptr_ptr,
+ size_t * ifDescr_val_ptr_len_ptr);
+ int ifType_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifType_val_ptr);
+ int ifMtu_get(ifTable_rowreq_ctx * rowreq_ctx,
+ long *ifMtu_val_ptr);
+ int ifSpeed_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifSpeed_val_ptr);
+ int ifPhysAddress_get(ifTable_rowreq_ctx * rowreq_ctx,
+ char **ifPhysAddress_val_ptr_ptr,
+ size_t
+ * ifPhysAddress_val_ptr_len_ptr);
+ int ifAdminStatus_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifAdminStatus_val_ptr);
+ int ifOperStatus_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifOperStatus_val_ptr);
+ int ifLastChange_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifLastChange_val_ptr);
+ int ifInOctets_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifInOctets_val_ptr);
+ int ifInUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifInUcastPkts_val_ptr);
+ int ifInNUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifInNUcastPkts_val_ptr);
+ int ifInDiscards_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifInDiscards_val_ptr);
+ int ifInErrors_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifInErrors_val_ptr);
+ int ifInUnknownProtos_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long *
+ ifInUnknownProtos_val_ptr);
+ int ifOutOctets_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifOutOctets_val_ptr);
+ int ifOutUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifOutUcastPkts_val_ptr);
+ int ifOutNUcastPkts_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifOutNUcastPkts_val_ptr);
+ int ifOutDiscards_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifOutDiscards_val_ptr);
+ int ifOutErrors_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifOutErrors_val_ptr);
+ int ifOutQLen_get(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifOutQLen_val_ptr);
+ int ifSpecific_get(ifTable_rowreq_ctx * rowreq_ctx,
+ oid ** ifSpecific_val_ptr_ptr,
+ size_t * ifSpecific_val_ptr_len_ptr);
+
+
+ int ifTable_indexes_set_tbl_idx(ifTable_mib_index *
+ tbl_idx, long ifIndex_val);
+ int ifTable_indexes_set(ifTable_rowreq_ctx * rowreq_ctx,
+ long ifIndex_val);
+
+
+
+ /*
+ *********************************************************************
+ * SET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * SET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ifTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IF-MIB::ifTable is subid 2 of interfaces.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.2.2, length: 8
+ */
+
+
+ int ifTable_undo_setup(ifTable_rowreq_ctx * rowreq_ctx);
+ int ifTable_undo_cleanup(ifTable_rowreq_ctx * rowreq_ctx);
+ int ifTable_undo(ifTable_rowreq_ctx * rowreq_ctx);
+ int ifTable_commit(ifTable_rowreq_ctx * rowreq_ctx);
+ int ifTable_undo_commit(ifTable_rowreq_ctx * rowreq_ctx);
+
+
+ int ifDescr_check_value(ifTable_rowreq_ctx * rowreq_ctx,
+ char *ifDescr_val_ptr,
+ size_t ifDescr_val_ptr_len);
+ int ifDescr_undo_setup(ifTable_rowreq_ctx * rowreq_ctx);
+ int ifDescr_set(ifTable_rowreq_ctx * rowreq_ctx,
+ char *ifDescr_val_ptr,
+ size_t ifDescr_val_ptr_len);
+ int ifDescr_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifType_check_value(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifType_val);
+ int ifType_undo_setup(ifTable_rowreq_ctx * rowreq_ctx);
+ int ifType_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifType_val);
+ int ifType_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifMtu_check_value(ifTable_rowreq_ctx * rowreq_ctx,
+ long ifMtu_val);
+ int ifMtu_undo_setup(ifTable_rowreq_ctx * rowreq_ctx);
+ int ifMtu_set(ifTable_rowreq_ctx * rowreq_ctx,
+ long ifMtu_val);
+ int ifMtu_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifSpeed_check_value(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifSpeed_val);
+ int ifSpeed_undo_setup(ifTable_rowreq_ctx * rowreq_ctx);
+ int ifSpeed_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifSpeed_val);
+ int ifSpeed_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifPhysAddress_check_value(ifTable_rowreq_ctx *
+ rowreq_ctx,
+ char *ifPhysAddress_val_ptr,
+ size_t
+ ifPhysAddress_val_ptr_len);
+ int ifPhysAddress_undo_setup(ifTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifPhysAddress_set(ifTable_rowreq_ctx * rowreq_ctx,
+ char *ifPhysAddress_val_ptr,
+ size_t ifPhysAddress_val_ptr_len);
+ int ifPhysAddress_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifAdminStatus_check_value(ifTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ifAdminStatus_val);
+ int ifAdminStatus_undo_setup(ifTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifAdminStatus_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifAdminStatus_val);
+ int ifAdminStatus_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifOperStatus_check_value(ifTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ifOperStatus_val);
+ int ifOperStatus_undo_setup(ifTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifOperStatus_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifOperStatus_val);
+ int ifOperStatus_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifLastChange_check_value(ifTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ifLastChange_val);
+ int ifLastChange_undo_setup(ifTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifLastChange_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifLastChange_val);
+ int ifLastChange_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifInOctets_check_value(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifInOctets_val);
+ int ifInOctets_undo_setup(ifTable_rowreq_ctx * rowreq_ctx);
+ int ifInOctets_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifInOctets_val);
+ int ifInOctets_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifInUcastPkts_check_value(ifTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ifInUcastPkts_val);
+ int ifInUcastPkts_undo_setup(ifTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifInUcastPkts_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifInUcastPkts_val);
+ int ifInUcastPkts_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifInNUcastPkts_check_value(ifTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ifInNUcastPkts_val);
+ int ifInNUcastPkts_undo_setup(ifTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifInNUcastPkts_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifInNUcastPkts_val);
+ int ifInNUcastPkts_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifInDiscards_check_value(ifTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ifInDiscards_val);
+ int ifInDiscards_undo_setup(ifTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifInDiscards_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifInDiscards_val);
+ int ifInDiscards_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifInErrors_check_value(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifInErrors_val);
+ int ifInErrors_undo_setup(ifTable_rowreq_ctx * rowreq_ctx);
+ int ifInErrors_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifInErrors_val);
+ int ifInErrors_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifInUnknownProtos_check_value(ifTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ifInUnknownProtos_val);
+ int ifInUnknownProtos_undo_setup(ifTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifInUnknownProtos_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifInUnknownProtos_val);
+ int ifInUnknownProtos_undo(ifTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifOutOctets_check_value(ifTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ifOutOctets_val);
+ int ifOutOctets_undo_setup(ifTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifOutOctets_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifOutOctets_val);
+ int ifOutOctets_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifOutUcastPkts_check_value(ifTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ifOutUcastPkts_val);
+ int ifOutUcastPkts_undo_setup(ifTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifOutUcastPkts_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifOutUcastPkts_val);
+ int ifOutUcastPkts_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifOutNUcastPkts_check_value(ifTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ifOutNUcastPkts_val);
+ int ifOutNUcastPkts_undo_setup(ifTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifOutNUcastPkts_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifOutNUcastPkts_val);
+ int ifOutNUcastPkts_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifOutDiscards_check_value(ifTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ifOutDiscards_val);
+ int ifOutDiscards_undo_setup(ifTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifOutDiscards_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifOutDiscards_val);
+ int ifOutDiscards_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifOutErrors_check_value(ifTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ifOutErrors_val);
+ int ifOutErrors_undo_setup(ifTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifOutErrors_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifOutErrors_val);
+ int ifOutErrors_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifOutQLen_check_value(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifOutQLen_val);
+ int ifOutQLen_undo_setup(ifTable_rowreq_ctx * rowreq_ctx);
+ int ifOutQLen_set(ifTable_rowreq_ctx * rowreq_ctx,
+ u_long ifOutQLen_val);
+ int ifOutQLen_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+ int ifSpecific_check_value(ifTable_rowreq_ctx * rowreq_ctx,
+ oid * ifSpecific_val_ptr,
+ size_t ifSpecific_val_ptr_len);
+ int ifSpecific_undo_setup(ifTable_rowreq_ctx * rowreq_ctx);
+ int ifSpecific_set(ifTable_rowreq_ctx * rowreq_ctx,
+ oid * ifSpecific_val_ptr,
+ size_t ifSpecific_val_ptr_len);
+ int ifSpecific_undo(ifTable_rowreq_ctx * rowreq_ctx);
+
+
+ int ifTable_check_dependencies(ifTable_rowreq_ctx * ctx);
+
+
+ /*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IFTABLE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_constants.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_constants.h
new file mode 100644
index 0000000000..17a87c7f13
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_constants.h
@@ -0,0 +1,381 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $
+ *
+ * $Id: ifTable_constants.h 14253 2006-02-14 14:40:55Z dts12 $
+ */
+#ifndef IFTABLE_CONSTANTS_H
+#define IFTABLE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * scalars
+ */
+#define IFTABLE_LAST_CHANGE 1,3,6,1,2,1,31,1,5
+#define IFTABLE_NUMBER 1,3,6,1,2,1,2,1
+
+
+ /*
+ * column number definitions for table ifTable
+ */
+#define IFTABLE_OID 1,3,6,1,2,1,2,2
+
+#define COLUMN_IFINDEX 1
+
+#define COLUMN_IFDESCR 2
+
+#define COLUMN_IFTYPE 3
+
+#define COLUMN_IFADMINSTATUS_FLAG (0x1 << 6)
+#define COLUMN_IFMTU 4
+
+#define COLUMN_IFSPEED 5
+
+#define COLUMN_IFPHYSADDRESS 6
+
+#define COLUMN_IFADMINSTATUS 7
+#define COLUMN_IFADMINSTATUS_FLAG (0x1 << 6)
+
+#define COLUMN_IFOPERSTATUS 8
+
+#define COLUMN_IFLASTCHANGE 9
+
+#define COLUMN_IFINOCTETS 10
+
+#define COLUMN_IFINUCASTPKTS 11
+
+#define COLUMN_IFINNUCASTPKTS 12
+
+#define COLUMN_IFINDISCARDS 13
+
+#define COLUMN_IFINERRORS 14
+
+#define COLUMN_IFINUNKNOWNPROTOS 15
+
+#define COLUMN_IFOUTOCTETS 16
+
+#define COLUMN_IFOUTUCASTPKTS 17
+
+#define COLUMN_IFOUTNUCASTPKTS 18
+
+#define COLUMN_IFOUTDISCARDS 19
+
+#define COLUMN_IFOUTERRORS 20
+
+#define COLUMN_IFOUTQLEN 21
+
+#define COLUMN_IFSPECIFIC 22
+
+
+#define IFTABLE_MIN_COL COLUMN_IFINDEX
+#define IFTABLE_MAX_COL COLUMN_IFSPECIFIC
+
+
+ /*
+ * TODO:405:r: Review IFTABLE_SETTABLE_COLS macro.
+ * OR together all the writable cols.
+ */
+#define IFTABLE_SETTABLE_COLS (COLUMN_IFADMINSTATUS_FLAG)
+ /*
+ * NOTES on enums
+ * ==============
+ *
+ * Value Mapping
+ * -------------
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them
+ * below. For example, a boolean flag (1/0) is usually represented
+ * as a TruthValue in a MIB, which maps to the values (1/2).
+ *
+ */
+/*************************************************************************
+ *************************************************************************
+ *
+ * enum definitions for table ifTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ifType (IANAifType / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef IANAIFTYPE_ENUMS
+#define IANAIFTYPE_ENUMS
+
+#define IANAIFTYPE_OTHER 1
+#define IANAIFTYPE_REGULAR1822 2
+#define IANAIFTYPE_HDH1822 3
+#define IANAIFTYPE_DDNX25 4
+#define IANAIFTYPE_RFC877X25 5
+#define IANAIFTYPE_ETHERNETCSMACD 6
+#define IANAIFTYPE_ISO88023CSMACD 7
+#define IANAIFTYPE_ISO88024TOKENBUS 8
+#define IANAIFTYPE_ISO88025TOKENRING 9
+#define IANAIFTYPE_ISO88026MAN 10
+#define IANAIFTYPE_STARLAN 11
+#define IANAIFTYPE_PROTEON10MBIT 12
+#define IANAIFTYPE_PROTEON80MBIT 13
+#define IANAIFTYPE_HYPERCHANNEL 14
+#define IANAIFTYPE_FDDI 15
+#define IANAIFTYPE_LAPB 16
+#define IANAIFTYPE_SDLC 17
+#define IANAIFTYPE_DS1 18
+#define IANAIFTYPE_E1 19
+#define IANAIFTYPE_BASICISDN 20
+#define IANAIFTYPE_PRIMARYISDN 21
+#define IANAIFTYPE_PROPPOINTTOPOINTSERIAL 22
+#define IANAIFTYPE_PPP 23
+#define IANAIFTYPE_SOFTWARELOOPBACK 24
+#define IANAIFTYPE_EON 25
+#define IANAIFTYPE_ETHERNET3MBIT 26
+#define IANAIFTYPE_NSIP 27
+#define IANAIFTYPE_SLIP 28
+#define IANAIFTYPE_ULTRA 29
+#define IANAIFTYPE_DS3 30
+#define IANAIFTYPE_SIP 31
+#define IANAIFTYPE_FRAMERELAY 32
+#define IANAIFTYPE_RS232 33
+#define IANAIFTYPE_PARA 34
+#define IANAIFTYPE_ARCNET 35
+#define IANAIFTYPE_ARCNETPLUS 36
+#define IANAIFTYPE_ATM 37
+#define IANAIFTYPE_MIOX25 38
+#define IANAIFTYPE_SONET 39
+#define IANAIFTYPE_X25PLE 40
+#define IANAIFTYPE_ISO88022LLC 41
+#define IANAIFTYPE_LOCALTALK 42
+#define IANAIFTYPE_SMDSDXI 43
+#define IANAIFTYPE_FRAMERELAYSERVICE 44
+#define IANAIFTYPE_V35 45
+#define IANAIFTYPE_HSSI 46
+#define IANAIFTYPE_HIPPI 47
+#define IANAIFTYPE_MODEM 48
+#define IANAIFTYPE_AAL5 49
+#define IANAIFTYPE_SONETPATH 50
+#define IANAIFTYPE_SONETVT 51
+#define IANAIFTYPE_SMDSICIP 52
+#define IANAIFTYPE_PROPVIRTUAL 53
+#define IANAIFTYPE_PROPMULTIPLEXOR 54
+#define IANAIFTYPE_IEEE80212 55
+#define IANAIFTYPE_FIBRECHANNEL 56
+#define IANAIFTYPE_HIPPIINTERFACE 57
+#define IANAIFTYPE_FRAMERELAYINTERCONNECT 58
+#define IANAIFTYPE_AFLANE8023 59
+#define IANAIFTYPE_AFLANE8025 60
+#define IANAIFTYPE_CCTEMUL 61
+#define IANAIFTYPE_FASTETHER 62
+#define IANAIFTYPE_ISDN 63
+#define IANAIFTYPE_V11 64
+#define IANAIFTYPE_V36 65
+#define IANAIFTYPE_G703AT64K 66
+#define IANAIFTYPE_G703AT2MB 67
+#define IANAIFTYPE_QLLC 68
+#define IANAIFTYPE_FASTETHERFX 69
+#define IANAIFTYPE_CHANNEL 70
+#define IANAIFTYPE_IEEE80211 71
+#define IANAIFTYPE_IBM370PARCHAN 72
+#define IANAIFTYPE_ESCON 73
+#define IANAIFTYPE_DLSW 74
+#define IANAIFTYPE_ISDNS 75
+#define IANAIFTYPE_ISDNU 76
+#define IANAIFTYPE_LAPD 77
+#define IANAIFTYPE_IPSWITCH 78
+#define IANAIFTYPE_RSRB 79
+#define IANAIFTYPE_ATMLOGICAL 80
+#define IANAIFTYPE_DS0 81
+#define IANAIFTYPE_DS0BUNDLE 82
+#define IANAIFTYPE_BSC 83
+#define IANAIFTYPE_ASYNC 84
+#define IANAIFTYPE_CNR 85
+#define IANAIFTYPE_ISO88025DTR 86
+#define IANAIFTYPE_EPLRS 87
+#define IANAIFTYPE_ARAP 88
+#define IANAIFTYPE_PROPCNLS 89
+#define IANAIFTYPE_HOSTPAD 90
+#define IANAIFTYPE_TERMPAD 91
+#define IANAIFTYPE_FRAMERELAYMPI 92
+#define IANAIFTYPE_X213 93
+#define IANAIFTYPE_ADSL 94
+#define IANAIFTYPE_RADSL 95
+#define IANAIFTYPE_SDSL 96
+#define IANAIFTYPE_VDSL 97
+#define IANAIFTYPE_ISO88025CRFPINT 98
+#define IANAIFTYPE_MYRINET 99
+#define IANAIFTYPE_VOICEEM 100
+#define IANAIFTYPE_VOICEFXO 101
+#define IANAIFTYPE_VOICEFXS 102
+#define IANAIFTYPE_VOICEENCAP 103
+#define IANAIFTYPE_VOICEOVERIP 104
+#define IANAIFTYPE_ATMDXI 105
+#define IANAIFTYPE_ATMFUNI 106
+#define IANAIFTYPE_ATMIMA 107
+#define IANAIFTYPE_PPPMULTILINKBUNDLE 108
+#define IANAIFTYPE_IPOVERCDLC 109
+#define IANAIFTYPE_IPOVERCLAW 110
+#define IANAIFTYPE_STACKTOSTACK 111
+#define IANAIFTYPE_VIRTUALIPADDRESS 112
+#define IANAIFTYPE_MPC 113
+#define IANAIFTYPE_IPOVERATM 114
+#define IANAIFTYPE_ISO88025FIBER 115
+#define IANAIFTYPE_TDLC 116
+#define IANAIFTYPE_GIGABITETHERNET 117
+#define IANAIFTYPE_HDLC 118
+#define IANAIFTYPE_LAPF 119
+#define IANAIFTYPE_V37 120
+#define IANAIFTYPE_X25MLP 121
+#define IANAIFTYPE_X25HUNTGROUP 122
+#define IANAIFTYPE_TRASNPHDLC 123
+#define IANAIFTYPE_INTERLEAVE 124
+#define IANAIFTYPE_FAST 125
+#define IANAIFTYPE_IP 126
+#define IANAIFTYPE_DOCSCABLEMACLAYER 127
+#define IANAIFTYPE_DOCSCABLEDOWNSTREAM 128
+#define IANAIFTYPE_DOCSCABLEUPSTREAM 129
+#define IANAIFTYPE_A12MPPSWITCH 130
+#define IANAIFTYPE_TUNNEL 131
+#define IANAIFTYPE_COFFEE 132
+#define IANAIFTYPE_CES 133
+#define IANAIFTYPE_ATMSUBINTERFACE 134
+#define IANAIFTYPE_L2VLAN 135
+#define IANAIFTYPE_L3IPVLAN 136
+#define IANAIFTYPE_L3IPXVLAN 137
+#define IANAIFTYPE_DIGITALPOWERLINE 138
+#define IANAIFTYPE_MEDIAMAILOVERIP 139
+#define IANAIFTYPE_DTM 140
+#define IANAIFTYPE_DCN 141
+#define IANAIFTYPE_IPFORWARD 142
+#define IANAIFTYPE_MSDSL 143
+#define IANAIFTYPE_IEEE1394 144
+#define IANAIFTYPE_IF_GSN 145
+#define IANAIFTYPE_DVBRCCMACLAYER 146
+#define IANAIFTYPE_DVBRCCDOWNSTREAM 147
+#define IANAIFTYPE_DVBRCCUPSTREAM 148
+#define IANAIFTYPE_ATMVIRTUAL 149
+#define IANAIFTYPE_MPLSTUNNEL 150
+#define IANAIFTYPE_SRP 151
+#define IANAIFTYPE_VOICEOVERATM 152
+#define IANAIFTYPE_VOICEOVERFRAMERELAY 153
+#define IANAIFTYPE_IDSL 154
+#define IANAIFTYPE_COMPOSITELINK 155
+#define IANAIFTYPE_SS7SIGLINK 156
+#define IANAIFTYPE_PROPWIRELESSP2P 157
+#define IANAIFTYPE_FRFORWARD 158
+#define IANAIFTYPE_RFC1483 159
+#define IANAIFTYPE_USB 160
+#define IANAIFTYPE_IEEE8023ADLAG 161
+#define IANAIFTYPE_BGPPOLICYACCOUNTING 162
+#define IANAIFTYPE_FRF16MFRBUNDLE 163
+#define IANAIFTYPE_H323GATEKEEPER 164
+#define IANAIFTYPE_H323PROXY 165
+#define IANAIFTYPE_MPLS 166
+#define IANAIFTYPE_MFSIGLINK 167
+#define IANAIFTYPE_HDSL2 168
+#define IANAIFTYPE_SHDSL 169
+#define IANAIFTYPE_DS1FDL 170
+#define IANAIFTYPE_POS 171
+#define IANAIFTYPE_DVBASIIN 172
+#define IANAIFTYPE_DVBASIOUT 173
+#define IANAIFTYPE_PLC 174
+#define IANAIFTYPE_NFAS 175
+#define IANAIFTYPE_TR008 176
+#define IANAIFTYPE_GR303RDT 177
+#define IANAIFTYPE_GR303IDT 178
+#define IANAIFTYPE_ISUP 179
+#define IANAIFTYPE_PROPDOCSWIRELESSMACLAYER 180
+#define IANAIFTYPE_PROPDOCSWIRELESSDOWNSTREAM 181
+#define IANAIFTYPE_PROPDOCSWIRELESSUPSTREAM 182
+#define IANAIFTYPE_HIPERLAN2 183
+#define IANAIFTYPE_PROPBWAP2MP 184
+#define IANAIFTYPE_SONETOVERHEADCHANNEL 185
+#define IANAIFTYPE_DIGITALWRAPPEROVERHEADCHANNEL 186
+#define IANAIFTYPE_AAL2 187
+#define IANAIFTYPE_RADIOMAC 188
+#define IANAIFTYPE_ATMRADIO 189
+#define IANAIFTYPE_IMT 190
+#define IANAIFTYPE_MVL 191
+#define IANAIFTYPE_REACHDSL 192
+#define IANAIFTYPE_FRDLCIENDPT 193
+#define IANAIFTYPE_ATMVCIENDPT 194
+#define IANAIFTYPE_OPTICALCHANNEL 195
+#define IANAIFTYPE_OPTICALTRANSPORT 196
+#define IANAIFTYPE_PROPATM 197
+#define IANAIFTYPE_VOICEOVERCABLE 198
+#define IANAIFTYPE_INFINIBAND 199
+#define IANAIFTYPE_TELINK 200
+#define IANAIFTYPE_Q2931 201
+#define IANAIFTYPE_VIRTUALTG 202
+#define IANAIFTYPE_SIPTG 203
+#define IANAIFTYPE_SIPSIG 204
+#define IANAIFTYPE_DOCSCABLEUPSTREAMCHANNEL 205
+#define IANAIFTYPE_ECONET 206
+#define IANAIFTYPE_PON155 207
+#define IANAIFTYPE_PON622 208
+#define IANAIFTYPE_BRIDGE 209
+#define IANAIFTYPE_LINEGROUP 210
+#define IANAIFTYPE_VOICEEMFGD 211
+#define IANAIFTYPE_VOICEFGDEANA 212
+#define IANAIFTYPE_VOICEDID 213
+#define IANAIFTYPE_MPEGTRANSPORT 214
+#define IANAIFTYPE_SIXTOFOUR 215
+#define IANAIFTYPE_GTP 216
+#define IANAIFTYPE_PDNETHERLOOP1 217
+#define IANAIFTYPE_PDNETHERLOOP2 218
+#define IANAIFTYPE_OPTICALCHANNELGROUP 219
+#define IANAIFTYPE_HOMEPNA 220
+#define IANAIFTYPE_GFP 221
+#define IANAIFTYPE_CISCOISLVLAN 222
+#define IANAIFTYPE_ACTELISMETALOOP 223
+#define IANAIFTYPE_FCIPLINK 224
+
+#endif /* IANAIFTYPE_ENUMS */
+/*************************************************************
+ * constants for enums for the MIB node
+ * ifAdminStatus (INTEGER / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef IFADMINSTATUS_ENUMS
+#define IFADMINSTATUS_ENUMS
+
+#define IFADMINSTATUS_UP 1
+#define IFADMINSTATUS_DOWN 2
+#define IFADMINSTATUS_TESTING 3
+
+#endif /* IFADMINSTATUS_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ifOperStatus (INTEGER / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef IFOPERSTATUS_ENUMS
+#define IFOPERSTATUS_ENUMS
+
+#define IFOPERSTATUS_UP 1
+#define IFOPERSTATUS_DOWN 2
+#define IFOPERSTATUS_TESTING 3
+#define IFOPERSTATUS_UNKNOWN 4
+#define IFOPERSTATUS_DORMANT 5
+#define IFOPERSTATUS_NOTPRESENT 6
+#define IFOPERSTATUS_LOWERLAYERDOWN 7
+
+#endif /* IFOPERSTATUS_ENUMS */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IFTABLE_OIDS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_data_access.c
new file mode 100644
index 0000000000..327c3dc470
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_data_access.c
@@ -0,0 +1,480 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: ifTable_data_access.c 16790 2008-02-12 19:05:24Z hardaker $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ifTable.h"
+#include "ifTable_defs.h"
+
+#include "ifTable_data_access.h"
+
+#ifdef USING_IP_MIB_IPV4INTERFACETABLE_IPV4INTERFACETABLE_MODULE
+# include "mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable.h"
+#endif
+
+/*
+ * flag so we know not to set row/table last change times
+ * during startup.
+ */
+static int _first_load = 1;
+
+/** @ingroup interface
+ * @defgroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ifTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IF-MIB::ifTable is subid 2 of interfaces.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.2.2, length: 8
+ */
+
+/**
+ * initialization for ifTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param ifTable_reg
+ * Pointer to ifTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+ifTable_init_data(ifTable_registration * ifTable_reg)
+{
+ DEBUGMSGTL(("verbose:ifTable:ifTable_init_data", "called\n"));
+
+ /*
+ * TODO:303:o: Initialize ifTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* ifTable_init_data */
+
+/**
+ * container overview
+ *
+ */
+
+/**
+ * container initialization
+ *
+ * @param container_ptr_ptr A pointer to a container pointer. If you
+ * create a custom container, use this parameter to return it
+ * to the MFD helper. If set to NULL, the MFD helper will
+ * allocate a container for you.
+ * @param cache A pointer to a cache structure. You can set the timeout
+ * and other cache flags using this pointer.
+ *
+ * This function is called at startup to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases. If no custom
+ * container is allocated, the MFD code will create one for your.
+ *
+ * This is also the place to set up cache behavior. The default, to
+ * simply set the cache timeout, will work well with the default
+ * container. If you are using a custom container, you may want to
+ * look at the cache helper documentation to see if there are any
+ * flags you want to set.
+ *
+ * @remark
+ * This would also be a good place to do any initialization needed
+ * for you data source. For example, opening a connection to another
+ * process that will supply the data, opening a database, etc.
+ */
+void
+ifTable_container_init(netsnmp_container **container_ptr_ptr,
+ netsnmp_cache * cache)
+{
+ DEBUGMSGTL(("verbose:ifTable:ifTable_container_init", "called\n"));
+
+ if (NULL == container_ptr_ptr) {
+ snmp_log(LOG_ERR,
+ "bad container param to ifTable_container_init\n");
+ return;
+ }
+
+ /*
+ * For advanced users, you can use a custom container. If you
+ * do not create one, one will be created for you.
+ */
+ *container_ptr_ptr = NULL;
+
+ if (NULL == cache) {
+ snmp_log(LOG_ERR, "bad cache param to ifTable_container_init\n");
+ return;
+ }
+
+ /*
+ * TODO:345:A: Set up ifTable cache properties.
+ *
+ * Also for advanced users, you can set parameters for the
+ * cache. Do not change the magic pointer, as it is used
+ * by the MFD helper. To completely disable caching, set
+ * cache->enabled to 0.
+ */
+ /*
+ * since we set AUTO_RELOAD below, this timer controls how
+ * often the cache is reloaded. A 10 Mbps stream can wrap if*Octets in ~57 minutes.
+ * At 100 Mbps it is ~5 minutes, and at 1 Gbps, ~34 seconds.
+ */
+ cache->timeout = IFTABLE_CACHE_TIMEOUT; /* seconds */
+
+ /*
+ * don't release resources
+ */
+ cache->flags |=
+ (NETSNMP_CACHE_DONT_AUTO_RELEASE | NETSNMP_CACHE_DONT_FREE_EXPIRED
+ | NETSNMP_CACHE_DONT_FREE_BEFORE_LOAD | NETSNMP_CACHE_PRELOAD |
+ NETSNMP_CACHE_AUTO_RELOAD | NETSNMP_CACHE_DONT_INVALIDATE_ON_SET);
+} /* ifTable_container_init */
+
+/**
+ * check entry for update
+ *
+ */
+static void
+_check_interface_entry_for_updates(ifTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_container *ifcontainer)
+{
+ char oper_changed = 0;
+ u_long lastchange = rowreq_ctx->data.ifLastChange;
+
+ /*
+ * check for matching entry. We can do this directly, since
+ * both containers use the same index.
+ */
+ netsnmp_interface_entry *ifentry =
+ CONTAINER_FIND(ifcontainer, rowreq_ctx);
+
+#ifdef USING_IP_MIB_IPV4INTERFACETABLE_IPV4INTERFACETABLE_MODULE
+ /*
+ * give ipv4If table a crack at the entry
+ */
+ ipv4InterfaceTable_check_entry_for_updates(rowreq_ctx, ifentry);
+#endif
+
+#ifdef USING_IP_MIB_IPV6INTERFACETABLE_IPV6INTERFACETABLE_MODULE
+ /*
+ * give ipv6If table a crack at the entry
+ */
+ ipv6InterfaceTable_check_entry_for_updates(rowreq_ctx, ifentry);
+#endif
+
+ if (NULL == ifentry) {
+ /*
+ * if this is the first time we detected that this interface is
+ * missing, set admin/oper status down, and set last change.
+ *
+ * yyy-rks: when, if ever, would we consider an entry
+ * deleted (and thus need to update ifTableLastChanged)?
+ */
+ if (!rowreq_ctx->known_missing) {
+ DEBUGMSGTL(("ifTable:access", "updating missing entry\n"));
+ rowreq_ctx->known_missing = 1;
+ rowreq_ctx->data.ifAdminStatus = IFADMINSTATUS_DOWN;
+ if ((!(rowreq_ctx->data.ifentry->ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_LASTCHANGE))
+ && (rowreq_ctx->data.ifOperStatus != IFOPERSTATUS_DOWN))
+ oper_changed = 1;
+ rowreq_ctx->data.ifOperStatus = IFOPERSTATUS_DOWN;
+ }
+ } else {
+ DEBUGMSGTL(("ifTable:access", "updating existing entry\n"));
+
+#ifdef USING_IF_MIB_IFXTABLE_IFXTABLE_MODULE
+ {
+ int rc = strcmp(rowreq_ctx->data.ifName,
+ ifentry->name);
+ if (rc != 0) {
+ static int logged = 0;
+ if (!logged) {
+ snmp_log(LOG_ERR, "Name of an interface changed. Such " \
+ "interfaces will keep its old name in IF-MIB.\n");
+ logged = 1;
+ }
+ DEBUGMSGTL(("ifTable:access", "interface %s changed name to %s, ignoring\n",
+ rowreq_ctx->data.ifName, ifentry->name));
+ }
+ }
+#endif
+ /*
+ * if the interface was missing, but came back, clear the
+ * missing flag and set the discontinuity time. (if an os keeps
+ * persistent counters, tough cookies. We'll cross that
+ * bridge if we come to it).
+ */
+ if (rowreq_ctx->known_missing) {
+ rowreq_ctx->known_missing = 0;
+#ifdef USING_IF_MIB_IFXTABLE_IFXTABLE_MODULE
+ rowreq_ctx->data.ifCounterDiscontinuityTime =
+ netsnmp_get_agent_uptime();
+#endif
+ }
+
+ /*
+ * Check for changes, then update
+ */
+ if ((!(ifentry->ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_LASTCHANGE))
+ && (rowreq_ctx->data.ifOperStatus != ifentry->oper_status))
+ oper_changed = 1;
+ netsnmp_access_interface_entry_copy(rowreq_ctx->data.ifentry,
+ ifentry);
+
+ /*
+ * remove entry from temporary ifcontainer
+ */
+ CONTAINER_REMOVE(ifcontainer, ifentry);
+ netsnmp_access_interface_entry_free(ifentry);
+ }
+
+ /*
+ * if ifOperStatus changed, update ifLastChange
+ */
+ if (oper_changed)
+ rowreq_ctx->data.ifLastChange = netsnmp_get_agent_uptime();
+ else
+ rowreq_ctx->data.ifLastChange = lastchange;
+}
+
+/**
+ * add new entry
+ */
+static void
+_add_new_interface(netsnmp_interface_entry *ifentry,
+ netsnmp_container *container)
+{
+ ifTable_rowreq_ctx *rowreq_ctx;
+
+ DEBUGMSGTL(("ifTable:access", "creating new entry\n"));
+
+ /*
+ * allocate an row context and set the index(es), then add it to
+ * the container and set ifTableLastChanged.
+ */
+ rowreq_ctx = ifTable_allocate_rowreq_ctx(ifentry);
+ if ((NULL != rowreq_ctx) &&
+ (MFD_SUCCESS == ifTable_indexes_set(rowreq_ctx, ifentry->index))) {
+ CONTAINER_INSERT(container, rowreq_ctx);
+ /*
+ * fix this when we hit an arch that reports its own last change
+ */
+ netsnmp_assert(0 == (ifentry->ns_flags &
+ NETSNMP_INTERFACE_FLAGS_HAS_LASTCHANGE));
+ if (0 == _first_load) {
+ rowreq_ctx->data.ifLastChange = netsnmp_get_agent_uptime();
+ ifTable_lastChange_set(rowreq_ctx->data.ifLastChange);
+ }
+#ifdef USING_IP_MIB_IPV4INTERFACETABLE_IPV4INTERFACETABLE_MODULE
+ /*
+ * give ipv4If table a crack at the entry
+ */
+ ipv4InterfaceTable_check_entry_for_updates(rowreq_ctx, ifentry);
+#endif
+#ifdef USING_IP_MIB_IPV6INTERFACETABLE_IPV6INTERFACETABLE_MODULE
+ /*
+ * give ipv6If table a crack at the entry
+ */
+ ipv6InterfaceTable_check_entry_for_updates(rowreq_ctx, ifentry);
+#endif
+ } else {
+ if (rowreq_ctx) {
+ snmp_log(LOG_ERR, "error setting index while loading "
+ "ifTable cache.\n");
+ ifTable_release_rowreq_ctx(rowreq_ctx);
+ } else {
+ snmp_log(LOG_ERR, "memory allocation failed while loading "
+ "ifTable cache.\n");
+ netsnmp_access_interface_entry_free(ifentry);
+ }
+ }
+}
+
+/**
+ * container shutdown
+ *
+ * @param container_ptr A pointer to the container.
+ *
+ * This function is called at shutdown to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases.
+ *
+ * This function is called before ifTable_container_free().
+ *
+ * @remark
+ * This would also be a good place to do any cleanup needed
+ * for you data source. For example, closing a connection to another
+ * process that supplied the data, closing a database, etc.
+ */
+void
+ifTable_container_shutdown(netsnmp_container *container_ptr)
+{
+ DEBUGMSGTL(("verbose:ifTable:ifTable_container_shutdown", "called\n"));
+
+ if (NULL == container_ptr) {
+ snmp_log(LOG_ERR, "bad params to ifTable_container_shutdown\n");
+ return;
+ }
+
+} /* ifTable_container_shutdown */
+
+/**
+ * load initial data
+ *
+ * TODO:350:M: Implement ifTable data load
+ * This function will also be called by the cache helper to load
+ * the container again (after the container free function has been
+ * called to free the previous contents).
+ *
+ * @param container container to which items should be inserted
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
+ * @retval MFD_ERROR : other error.
+ *
+ * This function is called to load the index(es) (and data, optionally)
+ * for the every row in the data set.
+ *
+ * @remark
+ * While loading the data, the only important thing is the indexes.
+ * If access to your data is cheap/fast (e.g. you have a pointer to a
+ * structure in memory), it would make sense to update the data here.
+ * If, however, the accessing the data invovles more work (e.g. parsing
+ * some other existing data, or peforming calculations to derive the data),
+ * then you can limit yourself to setting the indexes and saving any
+ * information you will need later. Then use the saved information in
+ * ifTable_row_prep() for populating data.
+ *
+ * @note
+ * If you need consistency between rows (like you want statistics
+ * for each row to be from the same time frame), you should set all
+ * data here.
+ *
+ */
+int
+ifTable_container_load(netsnmp_container *container)
+{
+ netsnmp_container *ifcontainer;
+
+ DEBUGMSGTL(("verbose:ifTable:ifTable_container_load", "called\n"));
+
+ /*
+ * TODO:351:M: |-> Load/update data in the ifTable container.
+ * loop over your ifTable data, allocate a rowreq context,
+ * set the index(es) [and data, optionally] and insert into
+ * the container.
+ */
+ /*
+ * ifTable gets its data from the netsnmp_interface API.
+ */
+ ifcontainer =
+ netsnmp_access_interface_container_load(NULL,
+ NETSNMP_ACCESS_INTERFACE_INIT_NOFLAGS);
+ if (NULL == ifcontainer)
+ return MFD_RESOURCE_UNAVAILABLE; /* msg already logged */
+
+ /*
+ * we just got a fresh copy of interface data. compare it to
+ * what we've already got, and make any adjustements...
+ */
+ CONTAINER_FOR_EACH(container, (netsnmp_container_obj_func *)
+ _check_interface_entry_for_updates, ifcontainer);
+
+ /*
+ * now add any new interfaces
+ */
+ CONTAINER_FOR_EACH(ifcontainer,
+ (netsnmp_container_obj_func *) _add_new_interface,
+ container);
+
+ /*
+ * free the container. we've either claimed each ifentry, or released it,
+ * so the dal function doesn't need to clear the container.
+ */
+ netsnmp_access_interface_container_free(ifcontainer,
+ NETSNMP_ACCESS_INTERFACE_FREE_DONT_CLEAR);
+
+ DEBUGMSGT(("verbose:ifTable:ifTable_cache_load",
+ "%d records\n", CONTAINER_SIZE(container)));
+
+ if (_first_load)
+ _first_load = 0;
+
+ return MFD_SUCCESS;
+} /* ifTable_container_load */
+
+/**
+ * container clean up
+ *
+ * @param container container with all current items
+ *
+ * This optional callback is called prior to all
+ * item's being removed from the container. If you
+ * need to do any processing before that, do it here.
+ *
+ * @note
+ * The MFD helper will take care of releasing all the row contexts.
+ *
+ */
+void
+ifTable_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("verbose:ifTable:ifTable_container_free", "called\n"));
+
+ /*
+ * TODO:380:M: Free ifTable container data.
+ */
+} /* ifTable_container_free */
+
+/**
+ * prepare row for processing.
+ *
+ * When the agent has located the row for a request, this function is
+ * called to prepare the row for processing. If you fully populated
+ * the data context during the index setup phase, you may not need to
+ * do anything.
+ *
+ * @param rowreq_ctx pointer to a context.
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ */
+int
+ifTable_row_prep(ifTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ifTable:ifTable_row_prep", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+
+ return MFD_SUCCESS;
+} /* ifTable_row_prep */
+
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_data_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_data_access.h
new file mode 100644
index 0000000000..8a2875d550
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_data_access.h
@@ -0,0 +1,84 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: ifTable_data_access.h 14459 2006-04-10 04:59:10Z hardaker $
+ */
+#ifndef IFTABLE_DATA_ACCESS_H
+#define IFTABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ifTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IF-MIB::ifTable is subid 2 of interfaces.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.2.2, length: 8
+ */
+
+
+ int ifTable_init_data(ifTable_registration * ifTable_reg);
+
+
+ /*
+ * TODO:180:o: Review ifTable cache timeout.
+ * The number of seconds before the cache times out
+ */
+ /*
+ * A 10 Mbps stream can wrap if*Octets in ~57 minutes.
+ * At 100 Mbps it is ~5 minutes, and at 1 Gbps, ~34 seconds.
+ */
+#define IFTABLE_CACHE_TIMEOUT 15
+
+ void ifTable_container_init(netsnmp_container
+ **container_ptr_ptr,
+ netsnmp_cache * cache);
+ void ifTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int ifTable_container_load(netsnmp_container *container);
+ void ifTable_container_free(netsnmp_container *container);
+
+ void ifTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int ifTable_container_load(netsnmp_container *container);
+ void ifTable_container_free(netsnmp_container *container);
+
+ void ifTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int ifTable_container_load(netsnmp_container *container);
+ void ifTable_container_free(netsnmp_container *container);
+
+ int ifTable_cache_load(netsnmp_container *container);
+ void ifTable_cache_free(netsnmp_container *container);
+
+ int ifTable_row_prep(ifTable_rowreq_ctx * rowreq_ctx);
+
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IFTABLE_DATA_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_defs.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_defs.h
new file mode 100644
index 0000000000..b9750e9344
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_defs.h
@@ -0,0 +1,37 @@
+#define ifDescr ifentry->descr
+#define ifType ifentry->type
+#define ifMtu ifentry->mtu
+#define ifSpeed ifentry->speed
+#define ifPhysAddress ifentry->paddr
+#define ifPhysAddress_len ifentry->paddr_len /* # of char elements, not bytes */
+#define ifAdminStatus ifentry->admin_status
+#define ifOperStatus ifentry->oper_status
+#define ifLastChange ifentry->lastchange
+#define ifInOctets ifentry->stats.ibytes.low
+#define ifInUcastPkts ifentry->stats.iucast.low
+#define ifInNUcastPkts ifentry->stats.inucast
+#define ifInDiscards ifentry->stats.idiscards
+#define ifInErrors ifentry->stats.ierrors
+#define ifInUnknownProtos ifentry->stats.iunknown_protos
+#define ifOutOctets ifentry->stats.obytes.low
+#define ifOutUcastPkts ifentry->stats.oucast.low
+#define ifOutNUcastPkts ifentry->stats.onucast
+#define ifOutDiscards ifentry->stats.odiscards
+#define ifOutErrors ifentry->stats.oerrors
+#define ifOutQLen ifentry->stats.oqlen
+#define ifName ifentry->name
+#define ifInMulticastPkts ifentry->stats.imcast.low
+#define ifInBroadcastPkts ifentry->stats.ibcast.low
+#define ifOutMulticastPkts ifentry->stats.omcast.low
+#define ifOutBroadcastPkts ifentry->stats.obcast.low
+#define ifHCInOctets ifentry->stats.ibytes
+#define ifHCInUcastPkts ifentry->stats.iucast
+#define ifHCInMulticastPkts ifentry->stats.imcast
+#define ifHCInBroadcastPkts ifentry->stats.ibcast
+#define ifHCOutOctets ifentry->stats.obytes
+#define ifHCOutUcastPkts ifentry->stats.oucast
+#define ifHCOutMulticastPkts ifentry->stats.omcast
+#define ifHCOutBroadcastPkts ifentry->stats.obcast
+#define ifHighSpeed ifentry->speed_high
+#define ifPromiscuousMode ifentry->promiscuous
+#define ifConnectorPresent ifentry->connector_present
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_interface.c
new file mode 100644
index 0000000000..1c8b795b78
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_interface.c
@@ -0,0 +1,1980 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: ifTable_interface.c 15461 2006-10-19 20:38:00Z hardaker $
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ifTable.h"
+#include "ifTable_defs.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "ifTable_interface.h"
+
+#include <ctype.h>
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ifTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IF-MIB::ifTable is subid 2 of interfaces.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.2.2, length: 8
+ */
+typedef struct ifTable_interface_ctx_s {
+
+ netsnmp_container *container;
+ netsnmp_cache *cache;
+
+ ifTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+ u_int table_dirty;
+
+ u_long last_changed;
+
+} ifTable_interface_ctx;
+
+static ifTable_interface_ctx ifTable_if_ctx;
+
+static void _ifTable_container_init(ifTable_interface_ctx * if_ctx);
+static void _ifTable_container_shutdown(ifTable_interface_ctx *
+ if_ctx);
+
+
+netsnmp_container *
+ifTable_container_get(void)
+{
+ return ifTable_if_ctx.container;
+}
+
+ifTable_registration *
+ifTable_registration_get(void)
+{
+ return ifTable_if_ctx.user_ctx;
+}
+
+ifTable_registration *
+ifTable_registration_set(ifTable_registration * newreg)
+{
+ ifTable_registration *old = ifTable_if_ctx.user_ctx;
+ ifTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+
+int
+ifTable_container_size(void)
+{
+ return CONTAINER_SIZE(ifTable_if_ctx.container);
+}
+
+u_int
+ifTable_dirty_get(void)
+{
+ return ifTable_if_ctx.table_dirty;
+}
+
+void
+ifTable_dirty_set(u_int status)
+{
+ DEBUGMSGTL(("ifTable:ifTable_dirty_set",
+ "called. was %d, now %d\n",
+ ifTable_if_ctx.table_dirty, status));
+ ifTable_if_ctx.table_dirty = status;
+}
+
+/*
+ * ifTableLastChanged, which is not the last time that a row in
+ * the table was changed, but rather is the last time a row was
+ * added/deleted from the table.
+ */
+void
+ifTable_lastChange_set(u_long table_changed)
+{
+ DEBUGMSGTL(("ifTable:ifTable_lastChanged_set",
+ "called. was %ld, now %ld\n",
+ ifTable_if_ctx.last_changed, table_changed));
+ ifTable_if_ctx.last_changed = table_changed;
+}
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_ifTable_pre_request;
+static Netsnmp_Node_Handler _mfd_ifTable_post_request;
+static Netsnmp_Node_Handler _mfd_ifTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_ifTable_get_values;
+static Netsnmp_Node_Handler _mfd_ifTable_check_objects;
+static Netsnmp_Node_Handler _mfd_ifTable_undo_setup;
+static Netsnmp_Node_Handler _mfd_ifTable_set_values;
+static Netsnmp_Node_Handler _mfd_ifTable_undo_cleanup;
+static Netsnmp_Node_Handler _mfd_ifTable_undo_values;
+static Netsnmp_Node_Handler _mfd_ifTable_commit;
+static Netsnmp_Node_Handler _mfd_ifTable_undo_commit;
+static Netsnmp_Node_Handler _mfd_ifTable_irreversible_commit;
+static Netsnmp_Node_Handler _mfd_ifTable_check_dependencies;
+
+NETSNMP_STATIC_INLINE int _ifTable_undo_column(ifTable_rowreq_ctx *
+ rowreq_ctx,
+ netsnmp_variable_list * var,
+ int column);
+
+ifTable_data *ifTable_allocate_data(void);
+
+/**
+ * common init of container for ifTable and ifXTable
+ */
+void
+if_mib_container_init(void)
+{
+ static int done = 0;
+
+ if (done)
+ return;
+
+ DEBUGMSGTL(("internal:ifTable:ifTable_container_init", "called\n"));
+
+ done = 1;
+
+ /*
+ * set up the container. This is outside the rewrite ifdef, because
+ * the container is used by the ifXTable too..
+ */
+ _ifTable_container_init(&ifTable_if_ctx);
+}
+
+/**
+ * @internal
+ * Initialize the table ifTable
+ * (Define its contents and how it's structured)
+ */
+void
+_ifTable_initialize_interface(ifTable_registration * reg_ptr, u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &ifTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info = &ifTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:ifTable:_ifTable_initialize_interface",
+ "called\n"));
+
+ (void) if_mib_container_init();
+ if (NULL == ifTable_if_ctx.container)
+ return; /* msg already logged */
+
+#ifndef USING_MIBII_INTERFACES_MODULE
+ /*************************************************
+ *
+ * save interface context for ifTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
+ /** index: ifIndex */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrival.
+ */
+ tbl_info->min_column = IFTABLE_MIN_COL;
+ tbl_info->max_column = IFTABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ ifTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ ifTable_init_data(reg_ptr);
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup = _mfd_ifTable_object_lookup;
+ access_multiplexer->get_values = _mfd_ifTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request = _mfd_ifTable_pre_request;
+ access_multiplexer->post_request = _mfd_ifTable_post_request;
+
+
+ /*
+ * REQUIRED wrappers for set request handling
+ */
+ access_multiplexer->object_syntax_checks = _mfd_ifTable_check_objects;
+ access_multiplexer->undo_setup = _mfd_ifTable_undo_setup;
+ access_multiplexer->undo_cleanup = _mfd_ifTable_undo_cleanup;
+ access_multiplexer->set_values = _mfd_ifTable_set_values;
+ access_multiplexer->undo_sets = _mfd_ifTable_undo_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->commit = _mfd_ifTable_commit;
+ access_multiplexer->undo_commit = _mfd_ifTable_undo_commit;
+ access_multiplexer->irreversible_commit =
+ _mfd_ifTable_irreversible_commit;
+
+ /*
+ * REQUIRED for tables with dependencies
+ */
+ access_multiplexer->consistency_checks =
+ _mfd_ifTable_check_dependencies;
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("ifTable:init_ifTable",
+ "Registering ifTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("ifTable", handler,
+ ifTable_oid, ifTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RWRITE);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR, "error registering table ifTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &ifTable_if_ctx;
+
+ /*************************************************
+ *
+ * set up baby steps handler, create it and inject it
+ */
+ if (access_multiplexer->object_lookup)
+ mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
+ if (access_multiplexer->set_values)
+ mfd_modes |= BABY_STEP_SET_VALUES;
+ if (access_multiplexer->irreversible_commit)
+ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
+ if (access_multiplexer->object_syntax_checks)
+ mfd_modes |= BABY_STEP_CHECK_OBJECT;
+
+ if (access_multiplexer->pre_request)
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if (access_multiplexer->post_request)
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+ if (access_multiplexer->undo_setup)
+ mfd_modes |= BABY_STEP_UNDO_SETUP;
+ if (access_multiplexer->undo_cleanup)
+ mfd_modes |= BABY_STEP_UNDO_CLEANUP;
+ if (access_multiplexer->undo_sets)
+ mfd_modes |= BABY_STEP_UNDO_SETS;
+
+ if (access_multiplexer->row_creation)
+ mfd_modes |= BABY_STEP_ROW_CREATE;
+ if (access_multiplexer->consistency_checks)
+ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
+ if (access_multiplexer->commit)
+ mfd_modes |= BABY_STEP_COMMIT;
+ if (access_multiplexer->undo_commit)
+ mfd_modes |= BABY_STEP_UNDO_COMMIT;
+
+ handler = netsnmp_baby_steps_handler_get(mfd_modes);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
+ */
+ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler =
+ netsnmp_container_table_handler_get(tbl_info,
+ ifTable_if_ctx.container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject cache helper
+ */
+ if (NULL != ifTable_if_ctx.cache) {
+ handler = netsnmp_cache_handler_get(ifTable_if_ctx.cache);
+ netsnmp_inject_handler(reginfo, handler);
+ }
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+
+ /*
+ * register ifTableLastChanged
+ */
+ {
+ oid iftlc_oid[] = { IFTABLE_LAST_CHANGE };
+ netsnmp_register_watched_scalar(netsnmp_create_handler_registration
+ ("ifTableLastChanged", NULL,
+ iftlc_oid, OID_LENGTH(iftlc_oid),
+ HANDLER_CAN_RONLY),
+ netsnmp_create_watcher_info((void
+ *)
+ &ifTable_if_ctx.
+ last_changed,
+ sizeof
+ (u_long),
+ ASN_TIMETICKS,
+ WATCHER_FIXED_SIZE));
+ }
+#endif /* USING_MIBII_INTERFACES_MODULE */
+
+} /* _ifTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table ifTable
+ */
+void
+_ifTable_shutdown_interface(ifTable_registration * reg_ptr)
+{
+ /*
+ * shutdown the container
+ */
+ _ifTable_container_shutdown(&ifTable_if_ctx);
+}
+
+void
+ifTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ ifTable_if_ctx.tbl_info.valid_columns = vc;
+} /* ifTable_valid_columns_set */
+
+/**
+ * @internal
+ * convert the index component stored in the context to an oid
+ */
+int
+ifTable_index_to_oid(netsnmp_index * oid_idx, ifTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * ifIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H
+ */
+ netsnmp_variable_list var_ifIndex;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_ifIndex, 0x00, sizeof(var_ifIndex));
+ var_ifIndex.type = ASN_INTEGER;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_ifIndex.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifTable_index_to_oid", "called\n"));
+
+ /*
+ * ifIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H
+ */
+ snmp_set_var_value(&var_ifIndex, (u_char *) & mib_idx->ifIndex,
+ sizeof(mib_idx->ifIndex));
+
+
+ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
+ NULL, 0, &var_ifIndex);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_ifIndex);
+
+ return err;
+} /* ifTable_index_to_oid */
+
+/**
+ * extract ifTable indexes from a netsnmp_index
+ *
+ * @retval SNMP_ERR_NOERROR : no error
+ * @retval SNMP_ERR_GENERR : error
+ */
+int
+ifTable_index_from_oid(netsnmp_index * oid_idx,
+ ifTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * ifIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H
+ */
+ netsnmp_variable_list var_ifIndex;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_ifIndex, 0x00, sizeof(var_ifIndex));
+ var_ifIndex.type = ASN_INTEGER;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_ifIndex.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:ifTable:ifTable_index_from_oid", "called\n"));
+
+ /*
+ * parse the oid into the individual index components
+ */
+ err = parse_oid_indexes(oid_idx->oids, oid_idx->len, &var_ifIndex);
+ if (err == SNMP_ERR_NOERROR) {
+ /*
+ * copy out values
+ */
+ mib_idx->ifIndex = *((long *) var_ifIndex.val.string);
+ }
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_ifIndex);
+
+ return err;
+} /* ifTable_index_from_oid */
+
+
+/*
+ * ifTable_allocate_data
+ *
+ * Purpose: create new ifTable_data.
+ */
+ifTable_data *
+ifTable_allocate_data(void)
+{
+ ifTable_data *rtn = SNMP_MALLOC_TYPEDEF(ifTable_data);
+
+ DEBUGMSGTL(("verbose:ifTable:ifTable_allocate_data", "called\n"));
+
+ if (NULL == rtn) {
+ snmp_log(LOG_ERR, "unable to malloc memory for new "
+ "ifTable_data.\n");
+ }
+
+ return rtn;
+} /* ifTable_allocate_data */
+
+/*
+ * ifTable_release_data
+ *
+ * Purpose: release ifTable data.
+ */
+void
+ifTable_release_data(ifTable_data * data)
+{
+ DEBUGMSGTL(("verbose:ifTable:ifTable_release_data", "called\n"));
+
+ free(data);
+} /* ifTable_release_data */
+
+/*
+ *********************************************************************
+ * @internal
+ * allocate resources for a ifTable_rowreq_ctx
+ */
+ifTable_rowreq_ctx *
+ifTable_allocate_rowreq_ctx(void *user_init_ctx)
+{
+ ifTable_rowreq_ctx *rowreq_ctx =
+ SNMP_MALLOC_TYPEDEF(ifTable_rowreq_ctx);
+
+ DEBUGMSGTL(("internal:ifTable:ifTable_allocate_rowreq_ctx",
+ "called\n"));
+
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "Couldn't allocate memory for a "
+ "ifTable_rowreq_ctx.\n");
+ return NULL;
+ }
+
+ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
+
+ rowreq_ctx->ifTable_data_list = NULL;
+
+ /*
+ * if we allocated data, call init routine
+ */
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) {
+ if (SNMPERR_SUCCESS !=
+ ifTable_rowreq_ctx_init(rowreq_ctx, user_init_ctx)) {
+ ifTable_release_rowreq_ctx(rowreq_ctx);
+ rowreq_ctx = NULL;
+ }
+ }
+
+ return rowreq_ctx;
+} /* ifTable_allocate_rowreq_ctx */
+
+/*
+ * @internal
+ * release resources for a ifTable_rowreq_ctx
+ */
+void
+ifTable_release_rowreq_ctx(ifTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("internal:ifTable:ifTable_release_rowreq_ctx",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ ifTable_rowreq_ctx_cleanup(rowreq_ctx);
+
+ if (rowreq_ctx->undo) {
+ ifTable_release_data(rowreq_ctx->undo);
+ rowreq_ctx->undo = NULL;
+ }
+
+ /*
+ * free index oid pointer
+ */
+ if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp)
+ free(rowreq_ctx->oid_idx.oids);
+
+ SNMP_FREE(rowreq_ctx);
+} /* ifTable_release_rowreq_ctx */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ifTable_pre_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_pre_request", "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ifTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = ifTable_pre_request(ifTable_if_ctx.user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ifTable", "error %d from "
+ "ifTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ifTable_post_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ifTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_post_request", "called\n"));
+
+ /*
+ * release row context, if deleted
+ */
+ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
+ ifTable_release_rowreq_ctx(rowreq_ctx);
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ifTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ if ((MFD_SUCCESS != packet_rc) && ifTable_dirty_get()) {
+ /*
+ * we shouldn't get here. the undo steps should also clear
+ * the dirty flags.
+ */
+ snmp_log(LOG_WARNING, "ifTable dirty flag set in post_request "
+ "but status != SUCCESS.\n");
+ }
+
+ rc = ifTable_post_request(ifTable_if_ctx.user_ctx, packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ifTable", "error %d from "
+ "ifTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ifTable_object_lookup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = SNMP_ERR_NOERROR;
+ ifTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_object_lookup",
+ "called\n"));
+
+ /*
+ * get our context from mfd
+ * ifTable_interface_ctx *if_ctx =
+ * (ifTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if (NULL == rowreq_ctx) {
+ rc = SNMP_ERR_NOCREATION;
+ }
+
+ if (MFD_SUCCESS != rc)
+ netsnmp_request_set_error_all(requests, rc);
+ else
+ ifTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_ifTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ifTable_get_column(ifTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_get_column",
+ "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * (INDEX) ifIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H
+ */
+ case COLUMN_IFINDEX:
+ var->type = ASN_INTEGER;
+ var->val_len = sizeof(long);
+ (*var->val.integer) = rowreq_ctx->tbl_idx.ifIndex;
+ break;
+
+ /*
+ * ifDescr(2)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H
+ */
+ case COLUMN_IFDESCR:
+ var->type = ASN_OCTET_STR;
+ rc = ifDescr_get(rowreq_ctx, (char **) &var->val.string,
+ &var->val_len);
+ break;
+
+ /*
+ * ifType(3)/IANAifType/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_IFTYPE:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ifType_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifMtu(4)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFMTU:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = ifMtu_get(rowreq_ctx, (long *) var->val.string);
+ break;
+
+ /*
+ * ifSpeed(5)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFSPEED:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_GAUGE;
+ rc = ifSpeed_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifPhysAddress(6)/PhysAddress/ASN_OCTET_STR/char(char)//L/A/w/e/r/d/H
+ */
+ case COLUMN_IFPHYSADDRESS:
+ var->type = ASN_OCTET_STR;
+ rc = ifPhysAddress_get(rowreq_ctx, (char **) &var->val.string,
+ &var->val_len);
+ break;
+
+ /*
+ * ifAdminStatus(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IFADMINSTATUS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ifAdminStatus_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifOperStatus(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_IFOPERSTATUS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ifOperStatus_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifLastChange(9)/TICKS/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFLASTCHANGE:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_TIMETICKS;
+ rc = ifLastChange_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifInOctets(10)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFINOCTETS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ifInOctets_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifInUcastPkts(11)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFINUCASTPKTS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ifInUcastPkts_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifInNUcastPkts(12)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFINNUCASTPKTS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ifInNUcastPkts_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifInDiscards(13)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFINDISCARDS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ifInDiscards_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifInErrors(14)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFINERRORS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ifInErrors_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifInUnknownProtos(15)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFINUNKNOWNPROTOS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ifInUnknownProtos_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifOutOctets(16)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFOUTOCTETS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ifOutOctets_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifOutUcastPkts(17)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFOUTUCASTPKTS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ifOutUcastPkts_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifOutNUcastPkts(18)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFOUTNUCASTPKTS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ifOutNUcastPkts_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifOutDiscards(19)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFOUTDISCARDS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ifOutDiscards_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifOutErrors(20)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFOUTERRORS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ifOutErrors_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifOutQLen(21)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFOUTQLEN:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_GAUGE;
+ rc = ifOutQLen_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifSpecific(22)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/w/e/r/d/h
+ */
+ case COLUMN_IFSPECIFIC:
+ var->type = ASN_OBJECT_ID;
+ rc = ifSpecific_get(rowreq_ctx, (oid **) & var->val.string,
+ &var->val_len);
+ break;
+
+ default:
+ snmp_log(LOG_ERR, "unknown column %d in _ifTable_get_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ifTable_get_column */
+
+int
+_mfd_ifTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ifTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ u_char *old_string;
+ void (*dataFreeHook) (void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_get_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+ /*
+ * save old pointer, so we can free it if replaced
+ */
+ old_string = requests->requestvb->val.string;
+ dataFreeHook = requests->requestvb->dataFreeHook;
+ if (NULL == requests->requestvb->val.string) {
+ requests->requestvb->val.string = requests->requestvb->buf;
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ } else if (requests->requestvb->buf ==
+ requests->requestvb->val.string) {
+ if (requests->requestvb->val_len !=
+ sizeof(requests->requestvb->buf))
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ }
+
+ /*
+ * get column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ifTable_get_column(rowreq_ctx, requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ if (MFD_SKIP == rc) {
+ requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+ rc = SNMP_ERR_NOERROR;
+ }
+ } else if (NULL == requests->requestvb->val.string) {
+ snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
+ rc = SNMP_ERR_GENERR;
+ }
+ if (rc)
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+
+ /*
+ * if the buffer wasn't used previously for the old data (i.e. it
+ * was allcoated memory) and the get routine replaced the pointer,
+ * we need to free the previous pointer.
+ */
+ if (old_string && (old_string != requests->requestvb->buf) &&
+ (requests->requestvb->val.string != old_string)) {
+ if (dataFreeHook)
+ (*dataFreeHook) (old_string);
+ else
+ free(old_string);
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifTable_get_values */
+
+
+
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Syntax checks
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check the syntax for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ifTable_check_column(ifTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ifTable:_ifTable_check_column",
+ "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+ /*
+ * (INDEX) ifIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H
+ */
+ case COLUMN_IFINDEX:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+
+ /*
+ * ifDescr(2)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H
+ */
+ case COLUMN_IFDESCR:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifType(3)/IANAifType/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_IFTYPE:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifMtu(4)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFMTU:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifSpeed(5)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFSPEED:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifPhysAddress(6)/PhysAddress/ASN_OCTET_STR/char(char)//L/A/w/e/r/d/H
+ */
+ case COLUMN_IFPHYSADDRESS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifAdminStatus(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IFADMINSTATUS:
+ /** special case: we are using exernal storage w/smaller data size
+ ** for storage, so we can't use sizeof on data context. So we
+ ** just check that it's the expected size. The enum tests below
+ ** will ensure that there is no data overflow. */
+ rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
+ sizeof(u_long));
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (*var->val.integer != IFADMINSTATUS_UP)
+ && (*var->val.integer != IFADMINSTATUS_DOWN)
+ && (*var->val.integer != IFADMINSTATUS_TESTING)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ifTable:_ifTable_check_column:ifAdminStatus",
+ "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ifAdminStatus_check_value(rowreq_ctx,
+ *((u_long *) var->val.string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ifAdminStatus_check_value\n", rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ifOperStatus(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_IFOPERSTATUS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifLastChange(9)/TICKS/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFLASTCHANGE:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifInOctets(10)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFINOCTETS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifInUcastPkts(11)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFINUCASTPKTS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifInNUcastPkts(12)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFINNUCASTPKTS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifInDiscards(13)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFINDISCARDS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifInErrors(14)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFINERRORS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifInUnknownProtos(15)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFINUNKNOWNPROTOS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifOutOctets(16)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFOUTOCTETS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifOutUcastPkts(17)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFOUTUCASTPKTS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifOutNUcastPkts(18)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFOUTNUCASTPKTS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifOutDiscards(19)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFOUTDISCARDS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifOutErrors(20)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFOUTERRORS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifOutQLen(21)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFOUTQLEN:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifSpecific(22)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/w/e/r/d/h
+ */
+ case COLUMN_IFSPECIFIC:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ default: /** We shouldn't get here */
+ rc = SNMP_ERR_GENERR;
+ snmp_log(LOG_ERR, "unknown column %d in _ifTable_check_column\n",
+ column);
+ }
+
+ return rc;
+} /* _ifTable_check_column */
+
+int
+_mfd_ifTable_check_objects(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ifTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc;
+
+ DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_check_objects",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+
+ /*
+ * get column number from table request info, and check that column
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ifTable_check_column(rowreq_ctx, requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+ break;
+ }
+
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifTable_check_objects */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: check dependencies
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check dependencies wrapper
+ */
+static int
+_mfd_ifTable_check_dependencies(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ifTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_check_dependencies",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = ifTable_check_dependencies(rowreq_ctx);
+ if (rc) {
+ DEBUGMSGTL(("ifTable:mfd", "error %d from "
+ "ifTable_check_dependencies\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifTable_check_dependencies */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo setup
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ifTable_undo_setup_column(ifTable_rowreq_ctx * rowreq_ctx, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ifTable:_ifTable_undo_setup_column",
+ "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ifAdminStatus(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IFADMINSTATUS:
+ rowreq_ctx->column_set_flags |= COLUMN_IFADMINSTATUS_FLAG;
+ rc = ifAdminStatus_undo_setup(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ifTable_undo_setup_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ifTable_undo_setup_column */
+
+int
+_mfd_ifTable_undo_setup_allocate(ifTable_rowreq_ctx *rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ if (NULL == rowreq_ctx)
+ return MFD_ERROR;
+
+ /*
+ * other tables share our container/context and call
+ * this function. so we need to check and see if
+ * someone else already allocated the ifentry
+ */
+ if (NULL == rowreq_ctx->undo) {
+ rowreq_ctx->undo = ifTable_allocate_data();
+ if (NULL == rowreq_ctx->undo) {
+ /** msg already logged */
+ rc = SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ else {
+ rowreq_ctx->undo->ifentry =
+ netsnmp_access_interface_entry_create(rowreq_ctx->data.ifentry->
+ name,
+ rowreq_ctx->data.ifentry->
+ index);
+ if (NULL == rowreq_ctx->undo->ifentry) {
+ rc = SNMP_ERR_RESOURCEUNAVAILABLE;
+ ifTable_release_data(rowreq_ctx->undo);
+ rowreq_ctx->undo = NULL;
+ }
+ else {
+ netsnmp_access_interface_entry_copy(rowreq_ctx->undo->ifentry,
+ rowreq_ctx->data.ifentry);
+ netsnmp_assert(0 == rowreq_ctx->undo_ref_count);
+ }
+ }
+ }
+ ++rowreq_ctx->undo_ref_count;
+ DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_undo_setup_allocate",
+ "++undo_refcount = %d\n",rowreq_ctx->undo_ref_count));
+
+ return rc;
+}
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_ifTable_undo_setup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ifTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_undo_setup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * allocate undo context
+ */
+ rc = _mfd_ifTable_undo_setup_allocate(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ netsnmp_request_set_error_all(requests, rc);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * row undo setup
+ */
+ rc = ifTable_undo_setup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ifTable:mfd", "error %d from "
+ "ifTable_undo_setup\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ } else {
+ /*
+ * column undo setup
+ */
+ netsnmp_table_request_info *tri;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ifTable_undo_setup_column(rowreq_ctx, tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ifTable:mfd", "error %d from "
+ "ifTable_undo_setup_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifTable_undo_setup */
+
+void
+_mfd_ifTable_undo_setup_release(ifTable_rowreq_ctx *rowreq_ctx)
+{
+ netsnmp_assert(rowreq_ctx->undo_ref_count > 0);
+ --rowreq_ctx->undo_ref_count;
+ snmp_log(LOG_ERR, "undo_refcount at %d\n", rowreq_ctx->undo_ref_count);
+
+ if (0 == rowreq_ctx->undo_ref_count) {
+ netsnmp_access_interface_entry_free(rowreq_ctx->undo->ifentry);
+ ifTable_release_data(rowreq_ctx->undo);
+ rowreq_ctx->undo = NULL;
+ }
+}
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_ifTable_undo_cleanup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ifTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc;
+
+ DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_undo_cleanup", "called\n"));
+
+ /*
+ * failed row create in early stages has no rowreq_ctx
+ */
+ if (NULL == rowreq_ctx)
+ return MFD_SUCCESS;
+
+ /*
+ * call user cleanup
+ */
+ rc = ifTable_undo_cleanup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ifTable:mfd", "error %d from "
+ "ifTable_undo_cleanup\n", rc));
+ }
+
+ /*
+ * release undo context, if needed
+ */
+ _mfd_ifTable_undo_setup_release(rowreq_ctx);
+
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifTable_undo_cleanup */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Set values
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ifTable_set_column(ifTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ifTable:_ifTable_set_column",
+ "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ifAdminStatus(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IFADMINSTATUS:
+ rowreq_ctx->column_set_flags |= COLUMN_IFADMINSTATUS_FLAG;
+ rc = ifAdminStatus_set(rowreq_ctx, *((u_long *) var->val.string));
+ break;
+
+ default:
+ snmp_log(LOG_ERR, "unknown column %d in _ifTable_set_column\n",
+ column);
+ rc = SNMP_ERR_GENERR;
+ break;
+ }
+
+ return rc;
+} /* _ifTable_set_column */
+
+int
+_mfd_ifTable_set_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ifTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc = SNMP_ERR_NOERROR;
+
+ DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_set_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rowreq_ctx->column_set_flags = 0;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ifTable_set_column(rowreq_ctx,
+ requests->requestvb, tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ifTable:mfd", "error %d from "
+ "ifTable_set_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifTable_set_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit the values
+ */
+int
+_mfd_ifTable_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ifTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = ifTable_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ifTable:mfd", "error %d from "
+ "ifTable_commit\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ /*
+ * if we successfully commited this row, set the dirty flag. Use the
+ * current value + 1 (i.e. dirty = # rows changed).
+ * this is checked in post_request...
+ */
+ ifTable_dirty_set(ifTable_dirty_get() + 1); /* set table dirty flag */
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ /*
+ * if we successfully commited this row, set the dirty flag. Use the
+ * current value + 1 (i.e. dirty = # rows changed).
+ * this is checked in post_request...
+ */
+ ifTable_dirty_set(ifTable_dirty_get() + 1); /* set table dirty flag */
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+_mfd_ifTable_undo_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ifTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_undo_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ u_int d = ifTable_dirty_get();
+
+ netsnmp_assert(d != 0);
+ if (d)
+ ifTable_dirty_set(d - 1);
+ }
+
+ rc = ifTable_undo_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ifTable:mfd", "error %d from "
+ "ifTable_undo_commit\n", rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ snmp_log(LOG_WARNING,
+ "ifTable row dirty flag still set after undo_commit\n");
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifTable_commit */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * undo the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ifTable_undo_column(ifTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ifTable:_ifTable_undo_column",
+ "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ifAdminStatus(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IFADMINSTATUS:
+ rc = ifAdminStatus_undo(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR, "unknown column %d in _ifTable_undo_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ifTable_undo_column */
+
+int
+_mfd_ifTable_undo_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ifTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+
+ DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_undo_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = ifTable_undo(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ifTable:mfd", "error %d from " "ifTable_undo\n", rc));
+ }
+
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ifTable_undo_column(rowreq_ctx, requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ifTable:mfd", "error %d from "
+ "ifTable_undo_column\n", rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifTable_undo_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: irreversible commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit irreversible actions
+ */
+int
+_mfd_ifTable_irreversible_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ifTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ifTable:_mfd_ifTable_irreversible:commit",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * check for and handle row creation/deletion
+ * and update column exist flags...
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) {
+ CONTAINER_REMOVE(ifTable_if_ctx.container, rowreq_ctx);
+ } else {
+ if (rowreq_ctx->column_set_flags) {
+ rowreq_ctx->column_set_flags = 0;
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifTable_irreversible_commit */
+
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+static void _container_free(netsnmp_container *container);
+
+/**
+ * @internal
+ */
+static int
+_cache_load(netsnmp_cache * cache, void *vmagic)
+{
+ DEBUGMSGTL(("internal:ifTable:_cache_load", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR, "invalid cache for ifTable_cache_load\n");
+ return -1;
+ }
+
+ /** should only be called for an invalid or expired cache */
+ netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
+
+ /*
+ * call user code
+ */
+ return ifTable_container_load((netsnmp_container *) cache->magic);
+} /* _cache_load */
+
+/**
+ * @internal
+ */
+static void
+_cache_free(netsnmp_cache * cache, void *magic)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("internal:ifTable:_cache_free", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR, "invalid cache in ifTable_cache_free\n");
+ return;
+ }
+
+ container = (netsnmp_container *) cache->magic;
+
+ _container_free(container);
+} /* _cache_free */
+
+/**
+ * @internal
+ */
+static void
+_container_item_free(ifTable_rowreq_ctx * rowreq_ctx, void *context)
+{
+ DEBUGMSGTL(("internal:ifTable:_container_item_free", "called\n"));
+
+ if (NULL == rowreq_ctx)
+ return;
+
+ ifTable_release_rowreq_ctx(rowreq_ctx);
+} /* _container_item_free */
+
+/**
+ * @internal
+ */
+static void
+_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("internal:ifTable:_container_free", "called\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "invalid container in ifTable_container_free\n");
+ return;
+ }
+
+ /*
+ * call user code
+ */
+ ifTable_container_free(container);
+
+ /*
+ * free all items. inefficient, but easy.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func *) _container_item_free,
+ NULL);
+} /* _container_free */
+
+/**
+ * @internal
+ * initialize the container with functions or wrappers
+ */
+void
+_ifTable_container_init(ifTable_interface_ctx * if_ctx)
+{
+ DEBUGMSGTL(("internal:ifTable:_ifTable_container_init", "called\n"));
+
+ /*
+ * cache init
+ */
+ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */
+ _cache_load, _cache_free,
+ ifTable_oid, ifTable_oid_size);
+
+ if (NULL == if_ctx->cache) {
+ snmp_log(LOG_ERR, "error creating cache for ifTable\n");
+ return;
+ }
+
+ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
+
+ ifTable_container_init(&if_ctx->container, if_ctx->cache);
+ if (NULL == if_ctx->container)
+ if_ctx->container =
+ netsnmp_container_find("ifTable:table_container");
+ if (NULL == if_ctx->container) {
+ snmp_log(LOG_ERR, "error creating container in "
+ "ifTable_container_init\n");
+ return;
+ }
+
+ if_ctx->container->container_name = strdup("ifTable container");
+ if (NULL != if_ctx->cache)
+ if_ctx->cache->magic = (void *) if_ctx->container;
+} /* _ifTable_container_init */
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+_ifTable_container_shutdown(ifTable_interface_ctx * if_ctx)
+{
+ DEBUGMSGTL(("internal:ifTable:_ifTable_container_shutdown",
+ "called\n"));
+
+ ifTable_container_shutdown(if_ctx->container);
+
+ _container_free(if_ctx->container);
+
+} /* _ifTable_container_shutdown */
+
+
+ifTable_rowreq_ctx *
+ifTable_row_find_by_mib_index(ifTable_mib_index * mib_idx)
+{
+ ifTable_rowreq_ctx *rowreq_ctx;
+ oid oid_tmp[MAX_OID_LEN];
+ netsnmp_index oid_idx;
+ int rc;
+
+ /*
+ * set up storage for OID
+ */
+ oid_idx.oids = oid_tmp;
+ oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
+
+ /*
+ * convert
+ */
+ rc = ifTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx = CONTAINER_FIND(ifTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_interface.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_interface.h
new file mode 100644
index 0000000000..f28de78a60
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifTable/ifTable_interface.h
@@ -0,0 +1,101 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: ifTable_interface.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** @ingroup misc
+ * @defgroup interface Routines to interface to Net-SNMP
+ *
+ * \warning This code should not be modified, called directly,
+ * or used to interpret functionality. It is subject to
+ * change at any time.
+ *
+ * @{
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+#ifndef IFTABLE_INTERFACE_H
+#define IFTABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "ifTable.h"
+
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void _ifTable_initialize_interface(ifTable_registration *
+ user_ctx, u_long flags);
+ void _ifTable_shutdown_interface(ifTable_registration *
+ user_ctx);
+
+ ifTable_registration *ifTable_registration_get(void);
+
+ ifTable_registration *ifTable_registration_set(ifTable_registration *
+ newreg);
+
+ netsnmp_container *ifTable_container_get(void);
+ int ifTable_container_size(void);
+
+ u_int ifTable_dirty_get(void);
+ void ifTable_dirty_set(u_int status);
+
+ ifTable_rowreq_ctx *ifTable_allocate_rowreq_ctx(void *);
+ void ifTable_release_rowreq_ctx(ifTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifTable_index_to_oid(netsnmp_index * oid_idx,
+ ifTable_mib_index * mib_idx);
+ int ifTable_index_from_oid(netsnmp_index * oid_idx,
+ ifTable_mib_index * mib_idx);
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void ifTable_valid_columns_set(netsnmp_column_info *vc);
+
+ /*
+ * special container init for shared ifTable/ifXTable container
+ */
+ void if_mib_container_init(void);
+
+ /*
+ */
+ void ifTable_lastChange_set(u_long uptime);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IFTABLE_INTERFACE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable.h
new file mode 100644
index 0000000000..5e99c0acfc
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable.h
@@ -0,0 +1,6 @@
+/*
+ * module to include the modules
+ */
+
+config_require(if-mib/ifXTable/ifXTable)
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable.c
new file mode 100644
index 0000000000..4cf4d4634e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable.c
@@ -0,0 +1,2535 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: ifXTable.c 15462 2006-10-19 21:42:46Z hardaker $
+ */
+/** \page MFD helper for ifXTable
+ *
+ * \section intro Introduction
+ * Introductory text.
+ *
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <ctype.h>
+
+/*
+ * include our parent header
+ */
+#include "ifXTable.h"
+#include "if-mib/ifTable/ifTable_defs.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "ifXTable_interface.h"
+
+/*
+ * not sure if we want to support set for promiscuous mode, because
+ * 1) careful thought should go into any settable object that performs
+ * an action that requires root access
+ * 2) i don't want to write the code right now
+ *
+ */
+#undef NETSNMP_ENABLE_PROMISCUOUSMODE_SET
+
+oid ifXTable_oid[] = { IFXTABLE_OID };
+int ifXTable_oid_size = OID_LENGTH(ifXTable_oid);
+const char *row_token = "ifXTable";
+
+ifXTable_registration ifXTable_user_context;
+
+/**
+ * Initializes the ifXTable module
+ */
+void
+init_ifXTable(void)
+{
+ DEBUGMSGTL(("verbose:ifXTable:init_ifXTable", "called\n"));
+
+ /*
+ * TODO:300:o: Perform ifXTable one-time module initialization.
+ */
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ init_ifTable();
+
+} /* init_ifXTable */
+
+/**
+ * Initialize the table ifXTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_ifXTable(void)
+{
+ ifXTable_registration *user_context;
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:ifXTable:initialize_table_ifXTable", "called\n"));
+
+ /*
+ * TODO:301:o: Perform ifXTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize ifXTable user context
+ * if you'd like to pass in a pointer to some data for this
+ * table, allocate or set it up here.
+ */
+ /*
+ * a netsnmp_data_list is a simple way to store void pointers. A simple
+ * string token is used to add, find or remove pointers.
+ */
+ user_context = netsnmp_create_data_list("ifXTable", NULL, NULL);
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _ifXTable_initialize_interface(user_context, flags);
+
+ /*
+ * if there is no container, bail. otherwise, register the callbacks
+ * for persistent storage.
+ */
+ if (NULL == ifTable_container_get())
+ return; /* msg already logged */
+
+} /* initialize_table_ifXTable */
+
+/**
+ * extra context initialization (eg default values)
+ *
+ * @param rowreq_ctx : row request context
+ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
+ *
+ * @retval MFD_SUCCESS : no errors
+ * @retval MFD_ERROR : error (context allocate will fail)
+ */
+int
+ifXTable_rowreq_ctx_init(ifXTable_rowreq_ctx * rowreq_ctx,
+ void *user_init_ctx)
+{
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_rowreq_ctx_init", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:210:o: |-> Perform extra ifXTable rowreq initialization. (eg DEFVALS)
+ * should never get here - ifTable should handle this
+ */
+ netsnmp_assert(0);
+
+ return MFD_ERROR;
+} /* ifXTable_rowreq_ctx_init */
+
+/**
+ * extra context cleanup
+ *
+ */
+void
+ifXTable_rowreq_ctx_cleanup(ifXTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_rowreq_ctx_cleanup",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:211:o: |-> Perform extra ifXTable rowreq cleanup.
+ */
+ /*
+ * should never get here - ifTable should handle this
+ */
+ netsnmp_assert(0);
+} /* ifXTable_rowreq_ctx_cleanup */
+
+/**
+ * the *_should_save routine is called to determine if a row
+ * should be stored persistently.
+ *
+ * Note that this is not a 'dirty' check (i.e. if a row has changed),
+ * but a check for volatile rows that should not be saved between
+ * restarts.
+ *
+ * @param rowreq_ctx
+ *
+ * @return 1 if the row should be stored
+ * @return 0 if the row should not be stored
+ */
+int
+ifXTable_container_should_save(ifXTable_rowreq_ctx * rowreq_ctx)
+{
+
+ return 1; /* save the row */
+}
+
+/**
+ * pre-request callback
+ *
+ * @param user_context
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+ifXTable_pre_request(ifXTable_registration * user_context)
+{
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_pre_request", "called\n"));
+
+ /*
+ * TODO:510:o: Perform ifXTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* ifXTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ * Note:
+ * New rows have been inserted into the container, and
+ * deleted rows have been removed from the container and
+ * released.
+ *
+ * @param user_context
+ * @param rc : MFD_SUCCESS if all requests succeeded
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+ifXTable_post_request(ifXTable_registration * user_context, int rc)
+{
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_post_request", "called\n"));
+
+ /*
+ * TODO:511:o: Perform ifXTable post-request actions.
+ */
+
+ /*
+ * check to set if any rows were changed.
+ */
+ if (ifXTable_dirty_get()) {
+ /*
+ * check if request was successful. If so, this would be
+ * a good place to save data to its persistent store.
+ */
+ if (MFD_SUCCESS == rc) {
+ /*
+ * save changed rows, if you haven't already
+ */
+ snmp_store(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_APPTYPE));
+ }
+
+ ifXTable_dirty_set(0); /* clear table dirty flag */
+ }
+
+ return MFD_SUCCESS;
+} /* ifXTable_post_request */
+
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ifXTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IF-MIB::ifXTable is subid 1 of ifMIBObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.31.1.1, length: 9
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement ifXTable data context functions.
+ */
+
+
+/**
+ * set mib index(es)
+ *
+ * @param tbl_idx mib index structure
+ * @param ifIndex_val
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This convenience function is useful for setting all the MIB index
+ * components with a single function call. It is assume that the C values
+ * have already been mapped from their native/rawformat to the MIB format.
+ */
+int
+ifXTable_indexes_set_tbl_idx(ifXTable_mib_index * tbl_idx,
+ long ifIndex_val)
+{
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_indexes_set_tbl_idx",
+ "called\n"));
+
+ /*
+ * ifIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H
+ */
+ tbl_idx->ifIndex = ifIndex_val;
+
+
+ return MFD_SUCCESS;
+} /* ifXTable_indexes_set_tbl_idx */
+
+/**
+ * @internal
+ * set row context indexes
+ *
+ * @param reqreq_ctx the row context that needs updated indexes
+ * @param ifIndex_val
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This function sets the mib indexs, then updates the oid indexs
+ * from the mib index.
+ */
+int
+ifXTable_indexes_set(ifXTable_rowreq_ctx * rowreq_ctx, long ifIndex_val)
+{
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_indexes_set", "called\n"));
+
+ if (MFD_SUCCESS !=
+ ifXTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx, ifIndex_val))
+ return MFD_ERROR;
+
+ /*
+ * convert mib index to oid index
+ */
+ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
+ if (0 != ifXTable_index_to_oid(&rowreq_ctx->oid_idx,
+ &rowreq_ctx->tbl_idx)) {
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS;
+} /* ifXTable_indexes_set */
+
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifName
+ * ifName is subid 1 of ifXEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.31.1.1.1.1
+ * Description:
+The textual name of the interface. The value of this
+ object should be the name of the interface as assigned by
+ the local device and should be suitable for use in commands
+ entered at the device's `console'. This might be a text
+ name, such as `le0' or a simple port number, such as `1',
+ depending on the interface naming syntax of the device. If
+ several entries in the ifTable together represent a single
+ interface as named by the device, then each will have the
+ same value of ifName. Note that for an agent which responds
+ to SNMP queries concerning an interface on some other
+ (proxied) device, then the value of ifName for such an
+ interface is the proxied device's local name for it.
+
+ If there is no local name, or this object is otherwise not
+ applicable, then this object contains a zero-length string.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 1
+ * settable 0
+ * hint: 255a
+ *
+ * Ranges: 0 - 255;
+ *
+ * Its syntax is DisplayString (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 255)
+ */
+/**
+ * Extract the current value of the ifName data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifName_val_ptr_ptr
+ * Pointer to storage for a char variable
+ * @param ifName_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by ifName.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*ifName_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update ifName_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+ifName_get(ifXTable_rowreq_ctx * rowreq_ctx, char **ifName_val_ptr_ptr,
+ size_t * ifName_val_ptr_len_ptr)
+{
+ int tmp_len;
+
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert((NULL != ifName_val_ptr_ptr)
+ && (NULL != *ifName_val_ptr_ptr));
+ netsnmp_assert(NULL != ifName_val_ptr_len_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifXTable:ifName_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifName data.
+ * copy (* ifName_val_ptr_ptr ) data and (* ifName_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * make sure there is enough space for ifName data
+ */
+ tmp_len = strlen(rowreq_ctx->data.ifName);
+ if ((NULL == (*ifName_val_ptr_ptr)) ||
+ ((*ifName_val_ptr_len_ptr) < tmp_len)) {
+ /*
+ * allocate space for ifName data
+ */
+ (*ifName_val_ptr_ptr) = malloc(tmp_len);
+ if (NULL == (*ifName_val_ptr_ptr)) {
+ snmp_log(LOG_ERR, "could not allocate memory\n");
+ return MFD_ERROR;
+ }
+ }
+ (*ifName_val_ptr_len_ptr) = tmp_len;
+ memcpy((*ifName_val_ptr_ptr), rowreq_ctx->data.ifName, tmp_len);
+
+ return MFD_SUCCESS;
+} /* ifName_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifInMulticastPkts
+ * ifInMulticastPkts is subid 2 of ifXEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.31.1.1.1.2
+ * Description:
+The number of packets, delivered by this sub-layer to a
+ higher (sub-)layer, which were addressed to a multicast
+ address at this sub-layer. For a MAC layer protocol, this
+ includes both Group and Functional addresses.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifInMulticastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifInMulticastPkts_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifInMulticastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifInMulticastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifInMulticastPkts_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifXTable:ifInMulticastPkts_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifInMulticastPkts data.
+ * copy (* ifInMulticastPkts_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifInMulticastPkts_val_ptr) = rowreq_ctx->data.ifInMulticastPkts;
+
+ return MFD_SUCCESS;
+} /* ifInMulticastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifInBroadcastPkts
+ * ifInBroadcastPkts is subid 3 of ifXEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.31.1.1.1.3
+ * Description:
+The number of packets, delivered by this sub-layer to a
+ higher (sub-)layer, which were addressed to a broadcast
+ address at this sub-layer.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifInBroadcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifInBroadcastPkts_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifInBroadcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifInBroadcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifInBroadcastPkts_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifXTable:ifInBroadcastPkts_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifInBroadcastPkts data.
+ * copy (* ifInBroadcastPkts_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifInBroadcastPkts_val_ptr) = rowreq_ctx->data.ifInBroadcastPkts;
+
+ return MFD_SUCCESS;
+} /* ifInBroadcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifOutMulticastPkts
+ * ifOutMulticastPkts is subid 4 of ifXEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.31.1.1.1.4
+ * Description:
+The total number of packets that higher-level protocols
+ requested be transmitted, and which were addressed to a
+ multicast address at this sub-layer, including those that
+ were discarded or not sent. For a MAC layer protocol, this
+ includes both Group and Functional addresses.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifOutMulticastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifOutMulticastPkts_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifOutMulticastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifOutMulticastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifOutMulticastPkts_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifXTable:ifOutMulticastPkts_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifOutMulticastPkts data.
+ * copy (* ifOutMulticastPkts_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifOutMulticastPkts_val_ptr) = rowreq_ctx->data.ifOutMulticastPkts;
+
+ return MFD_SUCCESS;
+} /* ifOutMulticastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifOutBroadcastPkts
+ * ifOutBroadcastPkts is subid 5 of ifXEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.31.1.1.1.5
+ * Description:
+The total number of packets that higher-level protocols
+ requested be transmitted, and which were addressed to a
+ broadcast address at this sub-layer, including those that
+ were discarded or not sent.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifOutBroadcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifOutBroadcastPkts_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifOutBroadcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifOutBroadcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifOutBroadcastPkts_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifXTable:ifOutBroadcastPkts_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifOutBroadcastPkts data.
+ * copy (* ifOutBroadcastPkts_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifOutBroadcastPkts_val_ptr) = rowreq_ctx->data.ifOutBroadcastPkts;
+
+ return MFD_SUCCESS;
+} /* ifOutBroadcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifHCInOctets
+ * ifHCInOctets is subid 6 of ifXEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.31.1.1.1.6
+ * Description:
+The total number of octets received on the interface,
+ including framing characters. This object is a 64-bit
+ version of ifInOctets.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ifHCInOctets data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifHCInOctets_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifHCInOctets_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ U64 * ifHCInOctets_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHCInOctets_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ifHCInOctets data.
+ * get (* ifHCInOctets_val_ptr ).low and (* ifHCInOctets_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ifHCInOctets_val_ptr).high = rowreq_ctx->data.ifHCInOctets.high;
+ (*ifHCInOctets_val_ptr).low = rowreq_ctx->data.ifHCInOctets.low;
+
+
+ return MFD_SUCCESS;
+} /* ifHCInOctets_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifHCInUcastPkts
+ * ifHCInUcastPkts is subid 7 of ifXEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.31.1.1.1.7
+ * Description:
+The number of packets, delivered by this sub-layer to a
+ higher (sub-)layer, which were not addressed to a multicast
+ or broadcast address at this sub-layer. This object is a
+ 64-bit version of ifInUcastPkts.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ifHCInUcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifHCInUcastPkts_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifHCInUcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ U64 * ifHCInUcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHCInUcastPkts_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ifHCInUcastPkts data.
+ * get (* ifHCInUcastPkts_val_ptr ).low and (* ifHCInUcastPkts_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ifHCInUcastPkts_val_ptr).high =
+ rowreq_ctx->data.ifHCInUcastPkts.high;
+ (*ifHCInUcastPkts_val_ptr).low = rowreq_ctx->data.ifHCInUcastPkts.low;
+
+
+ return MFD_SUCCESS;
+} /* ifHCInUcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifHCInMulticastPkts
+ * ifHCInMulticastPkts is subid 8 of ifXEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.31.1.1.1.8
+ * Description:
+The number of packets, delivered by this sub-layer to a
+ higher (sub-)layer, which were addressed to a multicast
+ address at this sub-layer. For a MAC layer protocol, this
+ includes both Group and Functional addresses. This object
+ is a 64-bit version of ifInMulticastPkts.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ifHCInMulticastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifHCInMulticastPkts_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifHCInMulticastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ U64 * ifHCInMulticastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHCInMulticastPkts_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ifHCInMulticastPkts data.
+ * get (* ifHCInMulticastPkts_val_ptr ).low and (* ifHCInMulticastPkts_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ifHCInMulticastPkts_val_ptr).high =
+ rowreq_ctx->data.ifHCInMulticastPkts.high;
+ (*ifHCInMulticastPkts_val_ptr).low =
+ rowreq_ctx->data.ifHCInMulticastPkts.low;
+
+
+ return MFD_SUCCESS;
+} /* ifHCInMulticastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifHCInBroadcastPkts
+ * ifHCInBroadcastPkts is subid 9 of ifXEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.31.1.1.1.9
+ * Description:
+The number of packets, delivered by this sub-layer to a
+ higher (sub-)layer, which were addressed to a broadcast
+ address at this sub-layer. This object is a 64-bit version
+ of ifInBroadcastPkts.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ifHCInBroadcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifHCInBroadcastPkts_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifHCInBroadcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ U64 * ifHCInBroadcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHCInBroadcastPkts_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ifHCInBroadcastPkts data.
+ * get (* ifHCInBroadcastPkts_val_ptr ).low and (* ifHCInBroadcastPkts_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ifHCInBroadcastPkts_val_ptr).high =
+ rowreq_ctx->data.ifHCInBroadcastPkts.high;
+ (*ifHCInBroadcastPkts_val_ptr).low =
+ rowreq_ctx->data.ifHCInBroadcastPkts.low;
+
+
+ return MFD_SUCCESS;
+} /* ifHCInBroadcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifHCOutOctets
+ * ifHCOutOctets is subid 10 of ifXEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.31.1.1.1.10
+ * Description:
+The total number of octets transmitted out of the
+ interface, including framing characters. This object is a
+ 64-bit version of ifOutOctets.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ifHCOutOctets data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifHCOutOctets_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifHCOutOctets_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ U64 * ifHCOutOctets_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHCOutOctets_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ifHCOutOctets data.
+ * get (* ifHCOutOctets_val_ptr ).low and (* ifHCOutOctets_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ifHCOutOctets_val_ptr).high = rowreq_ctx->data.ifHCOutOctets.high;
+ (*ifHCOutOctets_val_ptr).low = rowreq_ctx->data.ifHCOutOctets.low;
+
+
+ return MFD_SUCCESS;
+} /* ifHCOutOctets_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifHCOutUcastPkts
+ * ifHCOutUcastPkts is subid 11 of ifXEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.31.1.1.1.11
+ * Description:
+The total number of packets that higher-level protocols
+ requested be transmitted, and which were not addressed to a
+ multicast or broadcast address at this sub-layer, including
+ those that were discarded or not sent. This object is a
+ 64-bit version of ifOutUcastPkts.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ifHCOutUcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifHCOutUcastPkts_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifHCOutUcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ U64 * ifHCOutUcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHCOutUcastPkts_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ifHCOutUcastPkts data.
+ * get (* ifHCOutUcastPkts_val_ptr ).low and (* ifHCOutUcastPkts_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ifHCOutUcastPkts_val_ptr).high =
+ rowreq_ctx->data.ifHCOutUcastPkts.high;
+ (*ifHCOutUcastPkts_val_ptr).low =
+ rowreq_ctx->data.ifHCOutUcastPkts.low;
+
+
+ return MFD_SUCCESS;
+} /* ifHCOutUcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifHCOutMulticastPkts
+ * ifHCOutMulticastPkts is subid 12 of ifXEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.31.1.1.1.12
+ * Description:
+The total number of packets that higher-level protocols
+ requested be transmitted, and which were addressed to a
+ multicast address at this sub-layer, including those that
+ were discarded or not sent. For a MAC layer protocol, this
+ includes both Group and Functional addresses. This object
+ is a 64-bit version of ifOutMulticastPkts.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ifHCOutMulticastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifHCOutMulticastPkts_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifHCOutMulticastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ U64 * ifHCOutMulticastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHCOutMulticastPkts_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ifHCOutMulticastPkts data.
+ * get (* ifHCOutMulticastPkts_val_ptr ).low and (* ifHCOutMulticastPkts_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ifHCOutMulticastPkts_val_ptr).high =
+ rowreq_ctx->data.ifHCOutMulticastPkts.high;
+ (*ifHCOutMulticastPkts_val_ptr).low =
+ rowreq_ctx->data.ifHCOutMulticastPkts.low;
+
+
+ return MFD_SUCCESS;
+} /* ifHCOutMulticastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifHCOutBroadcastPkts
+ * ifHCOutBroadcastPkts is subid 13 of ifXEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.31.1.1.1.13
+ * Description:
+The total number of packets that higher-level protocols
+ requested be transmitted, and which were addressed to a
+ broadcast address at this sub-layer, including those that
+ were discarded or not sent. This object is a 64-bit version
+ of ifOutBroadcastPkts.
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ifHCOutBroadcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifHCOutBroadcastPkts_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifHCOutBroadcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ U64 * ifHCOutBroadcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHCOutBroadcastPkts_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ifHCOutBroadcastPkts data.
+ * get (* ifHCOutBroadcastPkts_val_ptr ).low and (* ifHCOutBroadcastPkts_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ifHCOutBroadcastPkts_val_ptr).high =
+ rowreq_ctx->data.ifHCOutBroadcastPkts.high;
+ (*ifHCOutBroadcastPkts_val_ptr).low =
+ rowreq_ctx->data.ifHCOutBroadcastPkts.low;
+
+
+ return MFD_SUCCESS;
+} /* ifHCOutBroadcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifLinkUpDownTrapEnable
+ * ifLinkUpDownTrapEnable is subid 14 of ifXEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.31.1.1.1.14
+ * Description:
+Indicates whether linkUp/linkDown traps should be generated
+ for this interface.
+
+ By default, this object should have the value enabled(1) for
+ interfaces which do not operate on 'top' of any other
+ interface (as defined in the ifStackTable), and disabled(2)
+ otherwise.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 2/8. Values: enabled(1), disabled(2)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ifLinkUpDownTrapEnable data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifLinkUpDownTrapEnable_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifLinkUpDownTrapEnable_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifLinkUpDownTrapEnable_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifLinkUpDownTrapEnable_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifXTable:ifLinkUpDownTrapEnable_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (0 == rowreq_ctx->data.ifLinkUpDownTrapEnable)
+ return MFD_SKIP;
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifLinkUpDownTrapEnable data.
+ * copy (* ifLinkUpDownTrapEnable_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifLinkUpDownTrapEnable_val_ptr) =
+ rowreq_ctx->data.ifLinkUpDownTrapEnable;
+
+ return MFD_SUCCESS;
+} /* ifLinkUpDownTrapEnable_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifHighSpeed
+ * ifHighSpeed is subid 15 of ifXEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.31.1.1.1.15
+ * Description:
+An estimate of the interface's current bandwidth in units
+ of 1,000,000 bits per second. If this object reports a
+ value of `n' then the speed of the interface is somewhere in
+ the range of `n-500,000' to `n+499,999'. For interfaces
+ which do not vary in bandwidth or for those where no
+ accurate estimation can be made, this object should contain
+ the nominal bandwidth. For a sub-layer which has no concept
+ of bandwidth, this object should be zero.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is GAUGE (based on perltype GAUGE)
+ * The net-snmp type is ASN_GAUGE. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifHighSpeed data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifHighSpeed_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifHighSpeed_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifHighSpeed_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifHighSpeed_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifXTable:ifHighSpeed_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifHighSpeed data.
+ * copy (* ifHighSpeed_val_ptr ) from rowreq_ctx->data
+ */
+ if (0 == rowreq_ctx->data.ifHighSpeed)
+ (*ifHighSpeed_val_ptr) = rowreq_ctx->data.ifSpeed / 100000;
+ else
+ (*ifHighSpeed_val_ptr) = rowreq_ctx->data.ifHighSpeed;
+
+ return MFD_SUCCESS;
+} /* ifHighSpeed_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifPromiscuousMode
+ * ifPromiscuousMode is subid 16 of ifXEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.31.1.1.1.16
+ * Description:
+This object has a value of false(2) if this interface only
+ accepts packets/frames that are addressed to this station.
+ This object has a value of true(1) when the station accepts
+ all packets/frames transmitted on the media. The value
+ true(1) is only legal on certain types of media. If legal,
+ setting this object to a value of true(1) may require the
+ interface to be reset before becoming effective.
+
+ The value of ifPromiscuousMode does not affect the reception
+ of broadcast and multicast packets/frames by the interface.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 2/8. Values: true(1), false(2)
+ *
+ * Its syntax is TruthValue (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ifPromiscuousMode data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifPromiscuousMode_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifPromiscuousMode_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifPromiscuousMode_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifPromiscuousMode_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifXTable:ifPromiscuousMode_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifPromiscuousMode data.
+ * copy (* ifPromiscuousMode_val_ptr ) from rowreq_ctx->data
+ */
+ /** this is coming from the interface entry, which is a boolean */
+ if (rowreq_ctx->data.ifPromiscuousMode)
+ (*ifPromiscuousMode_val_ptr) = 1;
+ else
+ (*ifPromiscuousMode_val_ptr) = 2;
+
+ return MFD_SUCCESS;
+} /* ifPromiscuousMode_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifConnectorPresent
+ * ifConnectorPresent is subid 17 of ifXEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.31.1.1.1.17
+ * Description:
+This object has the value 'true(1)' if the interface
+ sublayer has a physical connector and the value 'false(2)'
+ otherwise.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ * Enum range: 2/8. Values: true(1), false(2)
+ *
+ * Its syntax is TruthValue (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ifConnectorPresent data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifConnectorPresent_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifConnectorPresent_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifConnectorPresent_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifConnectorPresent_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifXTable:ifConnectorPresent_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (0 == rowreq_ctx->data.ifConnectorPresent)
+ return MFD_SKIP;
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifConnectorPresent data.
+ * copy (* ifConnectorPresent_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifConnectorPresent_val_ptr) = rowreq_ctx->data.ifConnectorPresent ?
+ TV_TRUE : TV_FALSE;
+
+ return MFD_SUCCESS;
+} /* ifConnectorPresent_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifAlias
+ * ifAlias is subid 18 of ifXEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.31.1.1.1.18
+ * Description:
+This object is an 'alias' name for the interface as
+ specified by a network manager, and provides a non-volatile
+ 'handle' for the interface.
+
+ On the first instantiation of an interface, the value of
+ ifAlias associated with that interface is the zero-length
+ string. As and when a value is written into an instance of
+ ifAlias through a network management set operation, then the
+ agent must retain the supplied value in the ifAlias instance
+ associated with the same interface for as long as that
+ interface remains instantiated, including across all re-
+ initializations/reboots of the network management system,
+ including those which result in a change of the interface's
+ ifIndex value.
+
+ An example of the value which a network manager might store
+ in this object for a WAN interface is the (Telco's) circuit
+ number/identifier of the interface.
+
+ Some agents may support write-access only for interfaces
+ having particular values of ifType. An agent which supports
+ write access to this object is required to keep the value in
+ non-volatile storage, but it may limit the length of new
+ values depending on how much storage is already occupied by
+ the current values for other interfaces.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 1
+ * settable 1
+ * hint: 255a
+ *
+ * Ranges: 0 - 64;
+ *
+ * Its syntax is DisplayString (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 64)
+ */
+/**
+ * Extract the current value of the ifAlias data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifAlias_val_ptr_ptr
+ * Pointer to storage for a char variable
+ * @param ifAlias_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by ifAlias.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*ifAlias_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update ifAlias_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+ifAlias_get(ifXTable_rowreq_ctx * rowreq_ctx, char **ifAlias_val_ptr_ptr,
+ size_t * ifAlias_val_ptr_len_ptr)
+{
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert((NULL != ifAlias_val_ptr_ptr)
+ && (NULL != *ifAlias_val_ptr_ptr));
+ netsnmp_assert(NULL != ifAlias_val_ptr_len_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifXTable:ifAlias_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifAlias data.
+ * copy (* ifAlias_val_ptr_ptr ) data and (* ifAlias_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * make sure there is enough space for ifAlias data
+ */
+ if ((NULL == (*ifAlias_val_ptr_ptr)) ||
+ ((*ifAlias_val_ptr_len_ptr) <
+ (rowreq_ctx->data.ifAlias_len *
+ sizeof(rowreq_ctx->data.ifAlias[0])))) {
+ /*
+ * allocate space for ifAlias data
+ */
+ (*ifAlias_val_ptr_ptr) =
+ malloc(rowreq_ctx->data.ifAlias_len *
+ sizeof(rowreq_ctx->data.ifAlias[0]));
+ if (NULL == (*ifAlias_val_ptr_ptr)) {
+ snmp_log(LOG_ERR, "could not allocate memory\n");
+ return MFD_ERROR;
+ }
+ }
+ (*ifAlias_val_ptr_len_ptr) =
+ rowreq_ctx->data.ifAlias_len * sizeof(rowreq_ctx->data.ifAlias[0]);
+ memcpy((*ifAlias_val_ptr_ptr), rowreq_ctx->data.ifAlias,
+ rowreq_ctx->data.ifAlias_len *
+ sizeof(rowreq_ctx->data.ifAlias[0]));
+
+ return MFD_SUCCESS;
+} /* ifAlias_get */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifCounterDiscontinuityTime
+ * ifCounterDiscontinuityTime is subid 19 of ifXEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.31.1.1.1.19
+ * Description:
+The value of sysUpTime on the most recent occasion at which
+ any one or more of this interface's counters suffered a
+ discontinuity. The relevant counters are the specific
+ instances associated with this interface of any Counter32 or
+
+ Counter64 object contained in the ifTable or ifXTable. If
+ no such discontinuities have occurred since the last re-
+ initialization of the local management subsystem, then this
+ object contains a zero value.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is TimeStamp (based on perltype TICKS)
+ * The net-snmp type is ASN_TIMETICKS. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ifCounterDiscontinuityTime data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifCounterDiscontinuityTime_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ifCounterDiscontinuityTime_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifCounterDiscontinuityTime_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ifCounterDiscontinuityTime_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ifXTable:ifCounterDiscontinuityTime_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ifCounterDiscontinuityTime data.
+ * copy (* ifCounterDiscontinuityTime_val_ptr ) from rowreq_ctx->data
+ */
+ (*ifCounterDiscontinuityTime_val_ptr) =
+ rowreq_ctx->data.ifCounterDiscontinuityTime;
+
+ return MFD_SUCCESS;
+} /* ifCounterDiscontinuityTime_get */
+
+
+
+/** @} */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ifXTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IF-MIB::ifXTable is subid 1 of ifMIBObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.31.1.1, length: 9
+ */
+ /*
+ * NOTE: if you update this chart, please update the versions in
+ * local/mib2c-conf.d/parent-set.m2i
+ * agent/mibgroup/helpers/baby_steps.c
+ * while you're at it.
+ */
+ /*
+ ***********************************************************************
+ * Baby Steps Flow Chart (2004.06.05) *
+ * *
+ * +--------------+ +================+ U = unconditional path *
+ * |optional state| ||required state|| S = path for success *
+ * +--------------+ +================+ E = path for error *
+ ***********************************************************************
+ *
+ * +--------------+
+ * | pre |
+ * | request |
+ * +--------------+
+ * | U
+ * +==============+
+ * +----------------|| object ||
+ * | E || lookup ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | E || check ||
+ * |<---------------|| values ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | +<-------|| undo ||
+ * | | E || setup ||
+ * | | +==============+
+ * | | | S
+ * | | +==============+
+ * | | || set ||-------------------------->+
+ * | | || value || E |
+ * | | +==============+ |
+ * | | | S |
+ * | | +--------------+ |
+ * | | | check |-------------------------->|
+ * | | | consistency | E |
+ * | | +--------------+ |
+ * | | | S |
+ * | | +==============+ +==============+ |
+ * | | || commit ||-------->|| undo || |
+ * | | || || E || commit || |
+ * | | +==============+ +==============+ |
+ * | | | S U |<--------+
+ * | | +--------------+ +==============+
+ * | | | irreversible | || undo ||
+ * | | | commit | || set ||
+ * | | +--------------+ +==============+
+ * | | | U U |
+ * | +-------------->|<------------------------+
+ * | +==============+
+ * | || undo ||
+ * | || cleanup ||
+ * | +==============+
+ * +---------------------->| U
+ * +--------------+
+ * | post |
+ * | request |
+ * +--------------+
+ *
+ */
+
+/**
+ * Setup up context with information needed to undo a set request.
+ *
+ * This function will be called before the individual node undo setup
+ * functions are called. If you need to do any undo setup that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that the undo context has been allocated with
+ * ifXTable_allocate_data(), but may need extra
+ * initialization similar to what you may have done in
+ * ifXTable_rowreq_ctx_init().
+ * Note that an individual node's undo_setup function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in the node's undo_setup
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ifXTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+ifXTable_undo_setup(ifXTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_undo_setup", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> Setup ifXTable undo.
+ * set up ifXTable undo information, in preparation for a set.
+ * Undo storage is in (* ifCounterDiscontinuityTime_val_ptr )*
+ */
+
+ return rc;
+} /* ifXTable_undo_setup */
+
+/**
+ * Undo a set request.
+ *
+ * This function will be called before the individual node undo
+ * functions are called. If you need to do any undo that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that an individual node's undo function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is anything specific to a particular column (e.g. releasing
+ * memory for a string), you should do that setup in the node's undo
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ifXTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+ifXTable_undo(ifXTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_undo", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> ifXTable undo.
+ * ifXTable undo information, in response to a failed set.
+ * Undo storage is in (* ifCounterDiscontinuityTime_val_ptr )*
+ */
+
+ return rc;
+} /* ifXTable_undo_setup */
+
+/**
+ * Cleanup up context undo information.
+ *
+ * This function will be called after set/commit processing. If you
+ * allocated any resources in undo_setup, this is the place to release
+ * those resources.
+ *
+ * This function is called regardless of the success or failure of the set
+ * request. If you need to perform different steps for cleanup depending
+ * on success or failure, you can add a flag to the rowreq_ctx.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ifXTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ifXTable_undo_cleanup(ifXTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_undo_cleanup", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:452:M: |-> Cleanup ifXTable undo.
+ * Undo storage is in (* ifCounterDiscontinuityTime_val_ptr )*
+ */
+
+ return rc;
+} /* ifXTable_undo_cleanup */
+
+/**
+ * commit new values.
+ *
+ * At this point, you should have done everything you can to ensure that
+ * this commit will not fail.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * ifXTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ifXTable_commit(ifXTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+ int save_flags;
+
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_commit", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * save flags, then clear until we actually do something
+ */
+ save_flags = rowreq_ctx->column_set_flags;
+ rowreq_ctx->column_set_flags = 0;
+
+ /*
+ * commit ifXTable data
+ * 1) check the column's flag in save_flags to see if it was set.
+ * 2) clear the flag when you handle that column
+ * 3) set the column's flag in column_set_flags if it needs undo
+ * processing in case of a failure.
+ *
+ * this is where one would usually commit data. In this case,
+ * ifLinkUpDownTrapEnable and ifAlias are purely internal, so
+ * nothing needs to be done. That leaves ifPromiscuosMode,
+ * which I'm leery about implementing. Thus, at this point,
+ * there is nothing to do except twiddle flag bits.
+ */
+ if (save_flags & COLUMN_IFLINKUPDOWNTRAPENABLE_FLAG) {
+ save_flags &= ~COLUMN_IFLINKUPDOWNTRAPENABLE_FLAG; /* clear ifLinkUpDownTrapEnable */
+ /*
+ * TODO:482:o: |-> commit column ifLinkUpDownTrapEnable.
+ */
+ /*
+ * set flag, in case we need to undo ifLinkUpDownTrapEnable
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_IFLINKUPDOWNTRAPENABLE_FLAG;
+ }
+#ifdef NETSNMP_ENABLE_PROMISCUOUSMODE_SET
+ if (save_flags & COLUMN_IFPROMISCUOUSMODE_FLAG) {
+ save_flags &= ~COLUMN_IFPROMISCUOUSMODE_FLAG; /* clear ifPromiscuousMode */
+ /*
+ * TODO:482:o: |-> commit column ifPromiscuousMode.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "ifXTable column ifPromiscuousMode commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo ifPromiscuousMode
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_IFPROMISCUOUSMODE_FLAG;
+ }
+ }
+#endif /* NETSNMP_ENABLE_PROMISCUOUSMODE_SET */
+
+ if (save_flags & COLUMN_IFALIAS_FLAG) {
+ save_flags &= ~COLUMN_IFALIAS_FLAG; /* clear ifAlias */
+ /*
+ * set flag, in case we need to undo ifAlias
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_IFALIAS_FLAG;
+ }
+
+ /*
+ * if we successfully commited this row, set the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY;
+ }
+
+ if (save_flags) {
+ snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n",
+ save_flags);
+ return MFD_ERROR;
+ }
+
+ return rc;
+} /* ifXTable_commit */
+
+/**
+ * undo commit new values.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * ifXTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ifXTable_undo_commit(ifXTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_undo_commit", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:485:M: |-> Undo ifXTable commit.
+ * check the column's flag in rowreq_ctx->column_set_flags to see
+ * if it was set during commit, then undo it.
+ *
+ * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
+ */
+
+
+ /*
+ * if we successfully un-commited this row, clear the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return rc;
+} /* ifXTable_undo_commit */
+
+/*
+ * TODO:440:M: Implement ifXTable node value checks.
+ * TODO:450:M: Implement ifXTable undo functions.
+ * TODO:460:M: Implement ifXTable set functions.
+ * TODO:480:M: Implement ifXTable commit functions.
+ */
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifLinkUpDownTrapEnable
+ * ifLinkUpDownTrapEnable is subid 14 of ifXEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.31.1.1.1.14
+ * Description:
+Indicates whether linkUp/linkDown traps should be generated
+ for this interface.
+
+ By default, this object should have the value enabled(1) for
+ interfaces which do not operate on 'top' of any other
+ interface (as defined in the ifStackTable), and disabled(2)
+ otherwise.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 2/8. Values: enabled(1), disabled(2)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifLinkUpDownTrapEnable_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ifXTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of enabled(1), disabled(2)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ifLinkUpDownTrapEnable_check_value(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long ifLinkUpDownTrapEnable_val)
+{
+ DEBUGMSGTL(("verbose:ifXTable:ifLinkUpDownTrapEnable_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ifLinkUpDownTrapEnable value.
+ */
+
+ return MFD_SUCCESS; /* ifLinkUpDownTrapEnable value not illegal */
+} /* ifLinkUpDownTrapEnable_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ifXTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ifXTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ifLinkUpDownTrapEnable_undo_setup(ifXTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ifXTable:ifLinkUpDownTrapEnable_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ifLinkUpDownTrapEnable undo.
+ */
+ /*
+ * copy ifLinkUpDownTrapEnable data
+ * set rowreq_ctx->undo->ifLinkUpDownTrapEnable from rowreq_ctx->data.ifLinkUpDownTrapEnable
+ */
+ rowreq_ctx->undo->ifLinkUpDownTrapEnable =
+ rowreq_ctx->data.ifLinkUpDownTrapEnable;
+
+
+ return MFD_SUCCESS;
+} /* ifLinkUpDownTrapEnable_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ifLinkUpDownTrapEnable_val
+ * A long containing the new value.
+ */
+int
+ifLinkUpDownTrapEnable_set(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long ifLinkUpDownTrapEnable_val)
+{
+
+ DEBUGMSGTL(("verbose:ifXTable:ifLinkUpDownTrapEnable_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ifLinkUpDownTrapEnable value.
+ * set ifLinkUpDownTrapEnable value in rowreq_ctx->data
+ */
+ rowreq_ctx->data.ifLinkUpDownTrapEnable = ifLinkUpDownTrapEnable_val;
+
+ return MFD_SUCCESS;
+} /* ifLinkUpDownTrapEnable_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ifLinkUpDownTrapEnable_undo(ifXTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ifXTable:ifLinkUpDownTrapEnable_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ifLinkUpDownTrapEnable undo.
+ */
+ /*
+ * copy ifLinkUpDownTrapEnable data
+ * set rowreq_ctx->data.ifLinkUpDownTrapEnable from rowreq_ctx->undo->ifLinkUpDownTrapEnable
+ */
+ rowreq_ctx->data.ifLinkUpDownTrapEnable =
+ rowreq_ctx->undo->ifLinkUpDownTrapEnable;
+
+
+ return MFD_SUCCESS;
+} /* ifLinkUpDownTrapEnable_undo */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifPromiscuousMode
+ * ifPromiscuousMode is subid 16 of ifXEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.31.1.1.1.16
+ * Description:
+This object has a value of false(2) if this interface only
+ accepts packets/frames that are addressed to this station.
+ This object has a value of true(1) when the station accepts
+ all packets/frames transmitted on the media. The value
+ true(1) is only legal on certain types of media. If legal,
+ setting this object to a value of true(1) may require the
+ interface to be reset before becoming effective.
+
+ The value of ifPromiscuousMode does not affect the reception
+ of broadcast and multicast packets/frames by the interface.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 2/8. Values: true(1), false(2)
+ *
+ * Its syntax is TruthValue (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifPromiscuousMode_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ifXTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of true(1), false(2)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ifPromiscuousMode_check_value(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long ifPromiscuousMode_val)
+{
+ DEBUGMSGTL(("verbose:ifXTable:ifPromiscuousMode_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ifPromiscuousMode value.
+ */
+
+ return MFD_SUCCESS; /* ifPromiscuousMode value not illegal */
+} /* ifPromiscuousMode_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ifXTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ifXTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ifPromiscuousMode_undo_setup(ifXTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ifXTable:ifPromiscuousMode_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ifPromiscuousMode undo.
+ */
+#ifdef NETSNMP_ENABLE_PROMISCUOUSMODE_SET
+ /*
+ * copy ifPromiscuousMode data
+ * set rowreq_ctx->undo->ifPromiscuousMode from rowreq_ctx->data.ifPromiscuousMode
+ */
+ rowreq_ctx->undo->ifPromiscuousMode =
+ rowreq_ctx->data.ifPromiscuousMode;
+
+
+ return MFD_SUCCESS;
+#else
+ return MFD_NOT_VALID_EVER;
+#endif
+} /* ifPromiscuousMode_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ifPromiscuousMode_val
+ * A long containing the new value.
+ */
+int
+ifPromiscuousMode_set(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long ifPromiscuousMode_val)
+{
+
+ DEBUGMSGTL(("verbose:ifXTable:ifPromiscuousMode_set", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ifPromiscuousMode value.
+ * set ifPromiscuousMode value in rowreq_ctx->data
+ */
+ rowreq_ctx->data.ifPromiscuousMode = ifPromiscuousMode_val;
+
+ return MFD_SUCCESS;
+} /* ifPromiscuousMode_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ifPromiscuousMode_undo(ifXTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ifXTable:ifPromiscuousMode_undo", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ifPromiscuousMode undo.
+ */
+#ifdef NETSNMP_ENABLE_PROMISCUOUSMODE_SET
+ /*
+ * copy ifPromiscuousMode data
+ * set rowreq_ctx->data.ifPromiscuousMode from rowreq_ctx->undo->ifPromiscuousMode
+ */
+ rowreq_ctx->data.ifPromiscuousMode =
+ rowreq_ctx->undo->ifPromiscuousMode;
+#endif
+
+ return MFD_SUCCESS;
+} /* ifPromiscuousMode_undo */
+
+/*---------------------------------------------------------------------
+ * IF-MIB::ifXEntry.ifAlias
+ * ifAlias is subid 18 of ifXEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.31.1.1.1.18
+ * Description:
+This object is an 'alias' name for the interface as
+ specified by a network manager, and provides a non-volatile
+ 'handle' for the interface.
+
+ On the first instantiation of an interface, the value of
+ ifAlias associated with that interface is the zero-length
+ string. As and when a value is written into an instance of
+ ifAlias through a network management set operation, then the
+ agent must retain the supplied value in the ifAlias instance
+ associated with the same interface for as long as that
+ interface remains instantiated, including across all re-
+ initializations/reboots of the network management system,
+ including those which result in a change of the interface's
+ ifIndex value.
+
+ An example of the value which a network manager might store
+ in this object for a WAN interface is the (Telco's) circuit
+ number/identifier of the interface.
+
+ Some agents may support write-access only for interfaces
+ having particular values of ifType. An agent which supports
+ write access to this object is required to keep the value in
+ non-volatile storage, but it may limit the length of new
+ values depending on how much storage is already occupied by
+ the current values for other interfaces.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 1
+ * settable 1
+ * hint: 255a
+ *
+ * Ranges: 0 - 64;
+ *
+ * Its syntax is DisplayString (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 64)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ifAlias_val_ptr
+ * A char containing the new value.
+ * @param ifAlias_val_ptr_len
+ * The size (in bytes) of the data pointed to by ifAlias_val_ptr
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ifXTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_OCTET_STR
+ * The length is < sizeof(rowreq_ctx->data.ifAlias).
+ * The length is in (one of) the range set(s): 0 - 64
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ifAlias_check_value(ifXTable_rowreq_ctx * rowreq_ctx,
+ char *ifAlias_val_ptr, size_t ifAlias_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:ifXTable:ifAlias_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert(NULL != ifAlias_val_ptr);
+
+ /*
+ * TODO:441:o: |-> Check for valid ifAlias value.
+ */
+
+ return MFD_SUCCESS; /* ifAlias value not illegal */
+} /* ifAlias_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ifXTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ifXTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ifAlias_undo_setup(ifXTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ifXTable:ifAlias_undo_setup", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ifAlias undo.
+ */
+ /*
+ * copy ifAlias and ifAlias_len data
+ * set rowreq_ctx->undo->ifAlias from rowreq_ctx->data.ifAlias
+ */
+ memcpy(rowreq_ctx->undo->ifAlias, rowreq_ctx->data.ifAlias,
+ (rowreq_ctx->data.ifAlias_len *
+ sizeof(rowreq_ctx->undo->ifAlias[0])));
+ rowreq_ctx->undo->ifAlias_len = rowreq_ctx->data.ifAlias_len;
+
+
+ return MFD_SUCCESS;
+} /* ifAlias_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ifAlias_val_ptr
+ * A char containing the new value.
+ * @param ifAlias_val_ptr_len
+ * The size (in bytes) of the data pointed to by ifAlias_val_ptr
+ */
+int
+ifAlias_set(ifXTable_rowreq_ctx * rowreq_ctx, char *ifAlias_val_ptr,
+ size_t ifAlias_val_ptr_len)
+{
+
+ DEBUGMSGTL(("verbose:ifXTable:ifAlias_set", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert(NULL != ifAlias_val_ptr);
+
+ /*
+ * TODO:461:M: |-> Set ifAlias value.
+ * set ifAlias value in rowreq_ctx->data
+ */
+ memcpy(rowreq_ctx->data.ifAlias, ifAlias_val_ptr, ifAlias_val_ptr_len);
+ /** convert bytes to number of char */
+ rowreq_ctx->data.ifAlias_len =
+ ifAlias_val_ptr_len / sizeof(ifAlias_val_ptr[0]);
+
+ return MFD_SUCCESS;
+} /* ifAlias_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ifAlias_undo(ifXTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ifXTable:ifAlias_undo", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ifAlias undo.
+ */
+ /*
+ * copy ifAlias and ifAlias_len data
+ * set rowreq_ctx->data.ifAlias from rowreq_ctx->undo->ifAlias
+ */
+ memcpy(rowreq_ctx->data.ifAlias, rowreq_ctx->undo->ifAlias,
+ (rowreq_ctx->undo->ifAlias_len *
+ sizeof(rowreq_ctx->data.ifAlias[0])));
+ rowreq_ctx->data.ifAlias_len = rowreq_ctx->undo->ifAlias_len;
+
+
+ return MFD_SUCCESS;
+} /* ifAlias_undo */
+
+/**
+ * check dependencies
+ *
+ * This is useful for for tables which have dependencies between columns
+ * (or rows, or tables). For example, two columns allocating a percentage
+ * of something add up 100%.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * ifXTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @retval MFD_SUCCESS all the changes to the row are legal
+ * @retval MFD_ERROR one or more changes are not legal
+ *
+ * (see README-table-ifXTable if you don't have dependencies)
+ */
+int
+ifXTable_check_dependencies(ifXTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("internal:ifXTable:ifXTable_check_dependencies",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:470:o: Check ifXTable row dependencies.
+ * check that all new value are legal and consistent with each other
+ */
+ return rc;
+} /* ifXTable_check_dependencies */
+
+/** @} */
+/** @{ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable.h
new file mode 100644
index 0000000000..72c0c84324
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable.h
@@ -0,0 +1,458 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: ifXTable.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+#ifndef IFXTABLE_H
+#define IFXTABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @addtogroup misc misc: Miscellaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/data_access/interface.h>
+
+#include "if-mib/ifTable/ifTable.h"
+
+ /*
+ * other required module components
+ */
+ /* *INDENT-OFF* */
+config_require(if-mib/ifTable/ifTable)
+config_require(if-mib/ifXTable/ifXTable_interface)
+config_require(if-mib/ifXTable/ifXTable_data_access)
+ /* *INDENT-ON* */
+
+ /*
+ * OID, column number and enum definions for ifXTable
+ */
+#include "ifXTable_constants.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_ifXTable(void);
+ void initialize_table_ifXTable(void);
+ void shutdown_ifXTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ifXTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IF-MIB::ifXTable is subid 1 of ifMIBObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.31.1.1, length: 9
+ *
+ * we share data structures (data too, in fact) with ifTable
+ */
+
+ typedef ifTable_registration ifXTable_registration;
+ typedef ifTable_data ifXTable_data;
+ typedef ifTable_undo_data ifXTable_undo_data;
+ typedef ifTable_mib_index ifXTable_mib_index;
+ typedef ifTable_rowreq_ctx ifXTable_rowreq_ctx;
+ typedef ifTable_ref_rowreq_ctx ifXTable_ref_rowreq_ctx;
+
+#define ifXTable_data_list ifTable_data_list
+#define ifXTable_reg ifTable_reg
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int ifXTable_pre_request(ifXTable_registration *
+ user_context);
+ int ifXTable_post_request(ifXTable_registration *
+ user_context, int rc);
+
+ int ifXTable_rowreq_ctx_init(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ void *user_init_ctx);
+ void ifXTable_rowreq_ctx_cleanup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifXTable_check_dependencies(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifXTable_commit(ifXTable_rowreq_ctx * rowreq_ctx);
+
+ ifXTable_rowreq_ctx *ifXTable_row_find_by_mib_index(ifXTable_mib_index
+ * mib_idx);
+
+ extern oid ifXTable_oid[];
+ extern int ifXTable_oid_size;
+
+
+#include "ifXTable_interface.h"
+#include "ifXTable_data_access.h"
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ifXTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IF-MIB::ifXTable is subid 1 of ifMIBObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.31.1.1, length: 9
+ */
+ /*
+ * indexes
+ */
+
+ int ifName_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ char **ifName_val_ptr_ptr,
+ size_t * ifName_val_ptr_len_ptr);
+ int ifInMulticastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long *
+ ifInMulticastPkts_val_ptr);
+ int ifInBroadcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long *
+ ifInBroadcastPkts_val_ptr);
+ int ifOutMulticastPkts_get(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ifOutMulticastPkts_val_ptr);
+ int ifOutBroadcastPkts_get(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ifOutBroadcastPkts_val_ptr);
+ int ifHCInOctets_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ U64 * ifHCInOctets_val_ptr);
+ int ifHCInUcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ U64 * ifHCInUcastPkts_val_ptr);
+ int ifHCInMulticastPkts_get(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ifHCInMulticastPkts_val_ptr);
+ int ifHCInBroadcastPkts_get(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ifHCInBroadcastPkts_val_ptr);
+ int ifHCOutOctets_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ U64 * ifHCOutOctets_val_ptr);
+ int ifHCOutUcastPkts_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ U64 * ifHCOutUcastPkts_val_ptr);
+ int ifHCOutMulticastPkts_get(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ifHCOutMulticastPkts_val_ptr);
+ int ifHCOutBroadcastPkts_get(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ifHCOutBroadcastPkts_val_ptr);
+ int ifLinkUpDownTrapEnable_get(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ifLinkUpDownTrapEnable_val_ptr);
+ int ifHighSpeed_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long * ifHighSpeed_val_ptr);
+ int ifPromiscuousMode_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long *
+ ifPromiscuousMode_val_ptr);
+ int ifConnectorPresent_get(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ifConnectorPresent_val_ptr);
+ int ifAlias_get(ifXTable_rowreq_ctx * rowreq_ctx,
+ char **ifAlias_val_ptr_ptr,
+ size_t * ifAlias_val_ptr_len_ptr);
+ int ifCounterDiscontinuityTime_get(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ifCounterDiscontinuityTime_val_ptr);
+
+
+ int ifXTable_indexes_set_tbl_idx(ifXTable_mib_index *
+ tbl_idx,
+ long ifIndex_val);
+ int ifXTable_indexes_set(ifXTable_rowreq_ctx * rowreq_ctx,
+ long ifIndex_val);
+
+
+
+ /*
+ *********************************************************************
+ * SET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * SET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ifXTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IF-MIB::ifXTable is subid 1 of ifMIBObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.31.1.1, length: 9
+ */
+
+
+ int ifXTable_undo_setup(ifXTable_rowreq_ctx * rowreq_ctx);
+ int ifXTable_undo_cleanup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifXTable_undo(ifXTable_rowreq_ctx * rowreq_ctx);
+ int ifXTable_commit(ifXTable_rowreq_ctx * rowreq_ctx);
+ int ifXTable_undo_commit(ifXTable_rowreq_ctx * rowreq_ctx);
+
+
+ int ifName_check_value(ifXTable_rowreq_ctx * rowreq_ctx,
+ char *ifName_val_ptr,
+ size_t ifName_val_ptr_len);
+ int ifName_undo_setup(ifXTable_rowreq_ctx * rowreq_ctx);
+ int ifName_set(ifXTable_rowreq_ctx * rowreq_ctx,
+ char *ifName_val_ptr,
+ size_t ifName_val_ptr_len);
+ int ifName_undo(ifXTable_rowreq_ctx * rowreq_ctx);
+
+ int ifInMulticastPkts_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ifInMulticastPkts_val);
+ int ifInMulticastPkts_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifInMulticastPkts_set(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long ifInMulticastPkts_val);
+ int ifInMulticastPkts_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifInBroadcastPkts_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ifInBroadcastPkts_val);
+ int ifInBroadcastPkts_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifInBroadcastPkts_set(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long ifInBroadcastPkts_val);
+ int ifInBroadcastPkts_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifOutMulticastPkts_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ifOutMulticastPkts_val);
+ int ifOutMulticastPkts_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifOutMulticastPkts_set(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ifOutMulticastPkts_val);
+ int ifOutMulticastPkts_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifOutBroadcastPkts_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ifOutBroadcastPkts_val);
+ int ifOutBroadcastPkts_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifOutBroadcastPkts_set(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ifOutBroadcastPkts_val);
+ int ifOutBroadcastPkts_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifHCInOctets_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 ifHCInOctets_val);
+ int ifHCInOctets_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHCInOctets_set(ifXTable_rowreq_ctx * rowreq_ctx,
+ U64 ifHCInOctets_val);
+ int ifHCInOctets_undo(ifXTable_rowreq_ctx * rowreq_ctx);
+
+ int ifHCInUcastPkts_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 ifHCInUcastPkts_val);
+ int ifHCInUcastPkts_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHCInUcastPkts_set(ifXTable_rowreq_ctx * rowreq_ctx,
+ U64 ifHCInUcastPkts_val);
+ int ifHCInUcastPkts_undo(ifXTable_rowreq_ctx * rowreq_ctx);
+
+ int ifHCInMulticastPkts_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ U64
+ ifHCInMulticastPkts_val);
+ int ifHCInMulticastPkts_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHCInMulticastPkts_set(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 ifHCInMulticastPkts_val);
+ int ifHCInMulticastPkts_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifHCInBroadcastPkts_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ U64
+ ifHCInBroadcastPkts_val);
+ int ifHCInBroadcastPkts_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHCInBroadcastPkts_set(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 ifHCInBroadcastPkts_val);
+ int ifHCInBroadcastPkts_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifHCOutOctets_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 ifHCOutOctets_val);
+ int ifHCOutOctets_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHCOutOctets_set(ifXTable_rowreq_ctx * rowreq_ctx,
+ U64 ifHCOutOctets_val);
+ int ifHCOutOctets_undo(ifXTable_rowreq_ctx * rowreq_ctx);
+
+ int ifHCOutUcastPkts_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 ifHCOutUcastPkts_val);
+ int ifHCOutUcastPkts_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHCOutUcastPkts_set(ifXTable_rowreq_ctx * rowreq_ctx,
+ U64 ifHCOutUcastPkts_val);
+ int ifHCOutUcastPkts_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifHCOutMulticastPkts_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ U64
+ ifHCOutMulticastPkts_val);
+ int ifHCOutMulticastPkts_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHCOutMulticastPkts_set(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 ifHCOutMulticastPkts_val);
+ int ifHCOutMulticastPkts_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifHCOutBroadcastPkts_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ U64
+ ifHCOutBroadcastPkts_val);
+ int ifHCOutBroadcastPkts_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHCOutBroadcastPkts_set(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 ifHCOutBroadcastPkts_val);
+ int ifHCOutBroadcastPkts_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifLinkUpDownTrapEnable_check_value(ifXTable_rowreq_ctx
+ * rowreq_ctx,
+ u_long
+ ifLinkUpDownTrapEnable_val);
+ int ifLinkUpDownTrapEnable_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifLinkUpDownTrapEnable_set(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ifLinkUpDownTrapEnable_val);
+ int ifLinkUpDownTrapEnable_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifHighSpeed_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ifHighSpeed_val);
+ int ifHighSpeed_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifHighSpeed_set(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long ifHighSpeed_val);
+ int ifHighSpeed_undo(ifXTable_rowreq_ctx * rowreq_ctx);
+
+ int ifPromiscuousMode_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ifPromiscuousMode_val);
+ int ifPromiscuousMode_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifPromiscuousMode_set(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_long ifPromiscuousMode_val);
+ int ifPromiscuousMode_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifConnectorPresent_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ifConnectorPresent_val);
+ int ifConnectorPresent_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifConnectorPresent_set(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ifConnectorPresent_val);
+ int ifConnectorPresent_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifAlias_check_value(ifXTable_rowreq_ctx * rowreq_ctx,
+ char *ifAlias_val_ptr,
+ size_t ifAlias_val_ptr_len);
+ int ifAlias_undo_setup(ifXTable_rowreq_ctx * rowreq_ctx);
+ int ifAlias_set(ifXTable_rowreq_ctx * rowreq_ctx,
+ char *ifAlias_val_ptr,
+ size_t ifAlias_val_ptr_len);
+ int ifAlias_undo(ifXTable_rowreq_ctx * rowreq_ctx);
+
+ int
+ ifCounterDiscontinuityTime_check_value(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ifCounterDiscontinuityTime_val);
+ int
+ ifCounterDiscontinuityTime_undo_setup(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+ int ifCounterDiscontinuityTime_set(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ifCounterDiscontinuityTime_val);
+ int ifCounterDiscontinuityTime_undo(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+ int ifXTable_check_dependencies(ifXTable_rowreq_ctx * ctx);
+
+
+ /*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IFXTABLE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_constants.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_constants.h
new file mode 100644
index 0000000000..51770ecf23
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_constants.h
@@ -0,0 +1,144 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $
+ *
+ * $Id: ifXTable_constants.h 14043 2006-01-05 23:48:58Z rstory $
+ */
+#ifndef IFXTABLE_CONSTANTS_H
+#define IFXTABLE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ * column number definitions for table ifXTable
+ */
+#define IFXTABLE_OID 1,3,6,1,2,1,31,1,1
+
+#define COLUMN_IFNAME 1
+
+#define COLUMN_IFINMULTICASTPKTS 2
+
+#define COLUMN_IFINBROADCASTPKTS 3
+
+#define COLUMN_IFOUTMULTICASTPKTS 4
+
+#define COLUMN_IFOUTBROADCASTPKTS 5
+
+#define COLUMN_IFHCINOCTETS 6
+
+#define COLUMN_IFHCINUCASTPKTS 7
+
+#define COLUMN_IFHCINMULTICASTPKTS 8
+
+#define COLUMN_IFHCINBROADCASTPKTS 9
+
+#define COLUMN_IFHCOUTOCTETS 10
+
+#define COLUMN_IFHCOUTUCASTPKTS 11
+
+#define COLUMN_IFHCOUTMULTICASTPKTS 12
+
+#define COLUMN_IFHCOUTBROADCASTPKTS 13
+
+#define COLUMN_IFLINKUPDOWNTRAPENABLE 14
+#define COLUMN_IFLINKUPDOWNTRAPENABLE_FLAG (0x1 << 13)
+
+#define COLUMN_IFHIGHSPEED 15
+
+#define COLUMN_IFPROMISCUOUSMODE 16
+#define COLUMN_IFPROMISCUOUSMODE_FLAG (0x1 << 15)
+
+#define COLUMN_IFCONNECTORPRESENT 17
+
+#define COLUMN_IFALIAS 18
+#define COLUMN_IFALIAS_FLAG (0x1 << 17)
+
+#define COLUMN_IFCOUNTERDISCONTINUITYTIME 19
+
+
+#define IFXTABLE_MIN_COL COLUMN_IFNAME
+#define IFXTABLE_MAX_COL COLUMN_IFCOUNTERDISCONTINUITYTIME
+
+
+ /*
+ * TODO:405:r: Review IFXTABLE_SETTABLE_COLS macro.
+ * OR together all the writable cols.
+ */
+#define IFXTABLE_SETTABLE_COLS (COLUMN_IFLINKUPDOWNTRAPENABLE_FLAG | COLUMN_IFALIAS_FLAG)
+ /*
+ * NOTES on enums
+ * ==============
+ *
+ * Value Mapping
+ * -------------
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them
+ * below. For example, a boolean flag (1/0) is usually represented
+ * as a TruthValue in a MIB, which maps to the values (1/2).
+ *
+ */
+/*************************************************************************
+ *************************************************************************
+ *
+ * enum definitions for table ifXTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ifLinkUpDownTrapEnable (INTEGER / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef IFLINKUPDOWNTRAPENABLE_ENUMS
+#define IFLINKUPDOWNTRAPENABLE_ENUMS
+
+#define IFLINKUPDOWNTRAPENABLE_ENABLED 1
+#define IFLINKUPDOWNTRAPENABLE_DISABLED 2
+
+#endif /* IFLINKUPDOWNTRAPENABLE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ifPromiscuousMode (TruthValue / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef TRUTHVALUE_ENUMS
+#define TRUTHVALUE_ENUMS
+
+#define TRUTHVALUE_TRUE 1
+#define TRUTHVALUE_FALSE 2
+
+#endif /* TRUTHVALUE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ifConnectorPresent (TruthValue / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef TRUTHVALUE_ENUMS
+#define TRUTHVALUE_ENUMS
+
+#define TRUTHVALUE_TRUE 1
+#define TRUTHVALUE_FALSE 2
+
+#endif /* TRUTHVALUE_ENUMS */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IFXTABLE_OIDS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_data_access.c
new file mode 100644
index 0000000000..d87369bc2f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_data_access.c
@@ -0,0 +1,104 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: ifXTable_data_access.c 15462 2006-10-19 21:42:46Z hardaker $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ifXTable.h"
+
+
+#include "ifXTable_data_access.h"
+#include "if-mib/ifTable/ifTable_defs.h"
+
+/** @ingroup interface
+ * @addtogroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ifXTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IF-MIB::ifXTable is subid 1 of ifMIBObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.31.1.1, length: 9
+ */
+
+/**
+ * initialization for ifXTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param ifXTable_reg
+ * Pointer to ifXTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+ifXTable_init_data(ifXTable_registration * ifXTable_reg)
+{
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_init_data", "called\n"));
+
+ /*
+ * TODO:303:o: Initialize ifXTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* ifXTable_init_data */
+
+/**
+ * container overview
+ *
+ * N/A; we use the ifTable container
+ */
+
+
+/**
+ * prepare row for processing.
+ *
+ * When the agent has located the row for a request, this function is
+ * called to prepare the row for processing. If you fully populated
+ * the data context during the index setup phase, you may not need to
+ * do anything.
+ *
+ * @param rowreq_ctx pointer to a context.
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ */
+int
+ifXTable_row_prep(ifXTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_row_prep", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+
+ return MFD_SUCCESS;
+} /* ifXTable_row_prep */
+
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_data_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_data_access.h
new file mode 100644
index 0000000000..82646fba83
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_data_access.h
@@ -0,0 +1,44 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: ifXTable_data_access.h 13748 2005-11-30 20:16:18Z rstory $
+ */
+#ifndef IFXTABLE_DATA_ACCESS_H
+#define IFXTABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ifXTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IF-MIB::ifXTable is subid 1 of ifMIBObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.31.1.1, length: 9
+ */
+ int ifXTable_init_data(ifXTable_registration *
+ ifXTable_reg);
+
+ int ifXTable_row_prep(ifXTable_rowreq_ctx * rowreq_ctx);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IFXTABLE_DATA_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_interface.c
new file mode 100644
index 0000000000..8c329bc8f9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_interface.c
@@ -0,0 +1,2160 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: ifXTable_interface.c 15462 2006-10-19 21:42:46Z hardaker $
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ifXTable.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "ifXTable_interface.h"
+#include "if-mib/ifTable/ifTable_interface.h"
+#include "if-mib/ifTable/ifTable_defs.h"
+
+#include <ctype.h>
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ifXTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IF-MIB::ifXTable is subid 1 of ifMIBObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.31.1.1, length: 9
+ */
+typedef struct ifXTable_interface_ctx_s {
+
+ netsnmp_container *container;
+ netsnmp_cache *cache;
+
+ ifXTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+ u_int table_dirty;
+
+} ifXTable_interface_ctx;
+
+static ifXTable_interface_ctx ifXTable_if_ctx;
+
+static void _ifXTable_container_init(ifXTable_interface_ctx * if_ctx);
+static void _ifXTable_container_shutdown(ifXTable_interface_ctx *
+ if_ctx);
+
+
+netsnmp_container *
+ifXTable_container_get(void)
+{
+ return ifXTable_if_ctx.container;
+}
+
+ifXTable_registration *
+ifXTable_registration_get(void)
+{
+ return ifXTable_if_ctx.user_ctx;
+}
+
+ifXTable_registration *
+ifXTable_registration_set(ifXTable_registration * newreg)
+{
+ ifXTable_registration *old = ifXTable_if_ctx.user_ctx;
+ ifXTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+
+int
+ifXTable_container_size(void)
+{
+ return CONTAINER_SIZE(ifXTable_if_ctx.container);
+}
+
+u_int
+ifXTable_dirty_get(void)
+{
+ return ifXTable_if_ctx.table_dirty;
+}
+
+void
+ifXTable_dirty_set(u_int status)
+{
+ DEBUGMSGTL(("ifXTable:ifXTable_dirty_set",
+ "called. was %d, now %d\n",
+ ifXTable_if_ctx.table_dirty, status));
+ ifXTable_if_ctx.table_dirty = status;
+}
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_ifXTable_pre_request;
+static Netsnmp_Node_Handler _mfd_ifXTable_post_request;
+static Netsnmp_Node_Handler _mfd_ifXTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_ifXTable_get_values;
+static Netsnmp_Node_Handler _mfd_ifXTable_check_objects;
+static Netsnmp_Node_Handler _mfd_ifXTable_undo_setup;
+static Netsnmp_Node_Handler _mfd_ifXTable_set_values;
+static Netsnmp_Node_Handler _mfd_ifXTable_undo_cleanup;
+static Netsnmp_Node_Handler _mfd_ifXTable_undo_values;
+static Netsnmp_Node_Handler _mfd_ifXTable_commit;
+static Netsnmp_Node_Handler _mfd_ifXTable_undo_commit;
+static Netsnmp_Node_Handler _mfd_ifXTable_irreversible_commit;
+static Netsnmp_Node_Handler _mfd_ifXTable_check_dependencies;
+
+NETSNMP_STATIC_INLINE int _ifXTable_undo_column(ifXTable_rowreq_ctx *
+ rowreq_ctx,
+ netsnmp_variable_list *
+ var, int column);
+
+ifXTable_data *ifXTable_allocate_data(void);
+
+/**
+ * @internal
+ * Initialize the table ifXTable
+ * (Define its contents and how it's structured)
+ */
+void
+_ifXTable_initialize_interface(ifXTable_registration * reg_ptr,
+ u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &ifXTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info = &ifXTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:ifXTable:_ifXTable_initialize_interface",
+ "called\n"));
+
+ /*
+ * make sure the ifTable container has been initialized, since
+ * we use its container, and we can't guarantee that it has
+ * already been initialized.
+ */
+ (void) if_mib_container_init();
+
+ /*************************************************
+ *
+ * save interface context for ifXTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
+ /** index: ifIndex */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrival.
+ */
+ tbl_info->min_column = IFXTABLE_MIN_COL;
+ tbl_info->max_column = IFXTABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ ifXTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ ifXTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _ifXTable_container_init(&ifXTable_if_ctx);
+ if (NULL == ifXTable_if_ctx.container)
+ return; /* msg already logged */
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup = _mfd_ifXTable_object_lookup;
+ access_multiplexer->get_values = _mfd_ifXTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request = _mfd_ifXTable_pre_request;
+ access_multiplexer->post_request = _mfd_ifXTable_post_request;
+
+
+ /*
+ * REQUIRED wrappers for set request handling
+ */
+ access_multiplexer->object_syntax_checks = _mfd_ifXTable_check_objects;
+ access_multiplexer->undo_setup = _mfd_ifXTable_undo_setup;
+ access_multiplexer->undo_cleanup = _mfd_ifXTable_undo_cleanup;
+ access_multiplexer->set_values = _mfd_ifXTable_set_values;
+ access_multiplexer->undo_sets = _mfd_ifXTable_undo_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->commit = _mfd_ifXTable_commit;
+ access_multiplexer->undo_commit = _mfd_ifXTable_undo_commit;
+ access_multiplexer->irreversible_commit =
+ _mfd_ifXTable_irreversible_commit;
+
+ /*
+ * REQUIRED for tables with dependencies
+ */
+ access_multiplexer->consistency_checks =
+ _mfd_ifXTable_check_dependencies;
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("ifXTable:init_ifXTable",
+ "Registering ifXTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("ifXTable", handler,
+ ifXTable_oid,
+ ifXTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RWRITE);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR, "error registering table ifXTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &ifXTable_if_ctx;
+
+ /*************************************************
+ *
+ * set up baby steps handler, create it and inject it
+ */
+ if (access_multiplexer->object_lookup)
+ mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
+ if (access_multiplexer->set_values)
+ mfd_modes |= BABY_STEP_SET_VALUES;
+ if (access_multiplexer->irreversible_commit)
+ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
+ if (access_multiplexer->object_syntax_checks)
+ mfd_modes |= BABY_STEP_CHECK_OBJECT;
+
+ if (access_multiplexer->pre_request)
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if (access_multiplexer->post_request)
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+ if (access_multiplexer->undo_setup)
+ mfd_modes |= BABY_STEP_UNDO_SETUP;
+ if (access_multiplexer->undo_cleanup)
+ mfd_modes |= BABY_STEP_UNDO_CLEANUP;
+ if (access_multiplexer->undo_sets)
+ mfd_modes |= BABY_STEP_UNDO_SETS;
+
+ if (access_multiplexer->row_creation)
+ mfd_modes |= BABY_STEP_ROW_CREATE;
+ if (access_multiplexer->consistency_checks)
+ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
+ if (access_multiplexer->commit)
+ mfd_modes |= BABY_STEP_COMMIT;
+ if (access_multiplexer->undo_commit)
+ mfd_modes |= BABY_STEP_UNDO_COMMIT;
+
+ handler = netsnmp_baby_steps_handler_get(mfd_modes);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
+ */
+ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler =
+ netsnmp_container_table_handler_get(tbl_info,
+ ifXTable_if_ctx.container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject cache helper
+ */
+ if (NULL != ifXTable_if_ctx.cache) {
+ handler = netsnmp_cache_handler_get(ifXTable_if_ctx.cache);
+ netsnmp_inject_handler(reginfo, handler);
+ }
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+ /*
+ * register config/persistence callbacks
+ */
+ ifXTable_container_init_persistence(ifXTable_if_ctx.container);
+
+} /* _ifXTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table ifXTable
+ */
+void
+_ifXTable_shutdown_interface(ifXTable_registration * reg_ptr)
+{
+ /*
+ * shutdown the container
+ */
+ _ifXTable_container_shutdown(&ifXTable_if_ctx);
+}
+
+void
+ifXTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ ifXTable_if_ctx.tbl_info.valid_columns = vc;
+} /* ifXTable_valid_columns_set */
+
+/**
+ * @internal
+ * convert the index component stored in the context to an oid
+ */
+int
+ifXTable_index_to_oid(netsnmp_index * oid_idx,
+ ifXTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * ifIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H
+ */
+ netsnmp_variable_list var_ifIndex;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_ifIndex, 0x00, sizeof(var_ifIndex));
+ var_ifIndex.type = ASN_INTEGER;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_ifIndex.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_index_to_oid", "called\n"));
+
+ /*
+ * ifIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H
+ */
+ snmp_set_var_value(&var_ifIndex, (u_char *) & mib_idx->ifIndex,
+ sizeof(mib_idx->ifIndex));
+
+
+ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
+ NULL, 0, &var_ifIndex);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_ifIndex);
+
+ return err;
+} /* ifXTable_index_to_oid */
+
+/**
+ * extract ifXTable indexes from a netsnmp_index
+ *
+ * @retval SNMP_ERR_NOERROR : no error
+ * @retval SNMP_ERR_GENERR : error
+ */
+int
+ifXTable_index_from_oid(netsnmp_index * oid_idx,
+ ifXTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * ifIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/w/e/R/d/H
+ */
+ netsnmp_variable_list var_ifIndex;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_ifIndex, 0x00, sizeof(var_ifIndex));
+ var_ifIndex.type = ASN_INTEGER;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_ifIndex.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_index_from_oid", "called\n"));
+
+ /*
+ * parse the oid into the individual index components
+ */
+ err = parse_oid_indexes(oid_idx->oids, oid_idx->len, &var_ifIndex);
+ if (err == SNMP_ERR_NOERROR) {
+ /*
+ * copy out values
+ */
+ mib_idx->ifIndex = *((long *) var_ifIndex.val.string);
+
+
+ }
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_ifIndex);
+
+ return err;
+} /* ifXTable_index_from_oid */
+
+
+/*
+ * ifXTable_allocate_data
+ *
+ * Purpose: create new ifXTable_data.
+ */
+ifXTable_data *
+ifXTable_allocate_data(void)
+{
+ ifXTable_data *rtn = SNMP_MALLOC_TYPEDEF(ifXTable_data);
+
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_allocate_data", "called\n"));
+
+ if (NULL == rtn) {
+ snmp_log(LOG_ERR, "unable to malloc memory for new "
+ "ifXTable_data.\n");
+ }
+
+ return rtn;
+} /* ifXTable_allocate_data */
+
+/*
+ * ifXTable_release_data
+ *
+ * Purpose: release ifXTable data.
+ */
+void
+ifXTable_release_data(ifXTable_data * data)
+{
+ DEBUGMSGTL(("verbose:ifXTable:ifXTable_release_data", "called\n"));
+
+ free(data);
+} /* ifXTable_release_data */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ifXTable_pre_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:ifXTable:_mfd_ifXTable_pre_request",
+ "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ifXTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = ifXTable_pre_request(ifXTable_if_ctx.user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ifXTable", "error %d from "
+ "ifXTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifXTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ifXTable_post_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ifXTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:ifXTable:_mfd_ifXTable_post_request",
+ "called\n"));
+
+ /*
+ * release row context, if deleted
+ */
+ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
+ ifTable_release_rowreq_ctx(rowreq_ctx);
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ifXTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ if ((MFD_SUCCESS != packet_rc) && ifXTable_dirty_get()) {
+ /*
+ * we shouldn't get here. the undo steps should also clear
+ * the dirty flags.
+ */
+ snmp_log(LOG_WARNING, "ifXTable dirty flag set in post_request "
+ "but status != SUCCESS.\n");
+ }
+
+ rc = ifXTable_post_request(ifXTable_if_ctx.user_ctx, packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ifXTable", "error %d from "
+ "ifXTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifXTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ifXTable_object_lookup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = SNMP_ERR_NOERROR;
+ ifXTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ifXTable:_mfd_ifXTable_object_lookup",
+ "called\n"));
+
+ /*
+ * get our context from mfd
+ * ifXTable_interface_ctx *if_ctx =
+ * (ifXTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if (NULL == rowreq_ctx) {
+ rc = SNMP_ERR_NOCREATION;
+ }
+
+ if (MFD_SUCCESS != rc)
+ netsnmp_request_set_error_all(requests, rc);
+ else
+ ifXTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_ifXTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ifXTable_get_column(ifXTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ifXTable:_mfd_ifXTable_get_column",
+ "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ifName(1)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H
+ */
+ case COLUMN_IFNAME:
+ var->type = ASN_OCTET_STR;
+ rc = ifName_get(rowreq_ctx, (char **) &var->val.string,
+ &var->val_len);
+ break;
+
+ /*
+ * ifInMulticastPkts(2)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFINMULTICASTPKTS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ifInMulticastPkts_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifInBroadcastPkts(3)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFINBROADCASTPKTS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ifInBroadcastPkts_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifOutMulticastPkts(4)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFOUTMULTICASTPKTS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ifOutMulticastPkts_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifOutBroadcastPkts(5)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFOUTBROADCASTPKTS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ifOutBroadcastPkts_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifHCInOctets(6)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCINOCTETS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ifHCInOctets_get(rowreq_ctx, (U64 *) var->val.string);
+ break;
+
+ /*
+ * ifHCInUcastPkts(7)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCINUCASTPKTS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ifHCInUcastPkts_get(rowreq_ctx, (U64 *) var->val.string);
+ break;
+
+ /*
+ * ifHCInMulticastPkts(8)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCINMULTICASTPKTS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ifHCInMulticastPkts_get(rowreq_ctx, (U64 *) var->val.string);
+ break;
+
+ /*
+ * ifHCInBroadcastPkts(9)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCINBROADCASTPKTS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ifHCInBroadcastPkts_get(rowreq_ctx, (U64 *) var->val.string);
+ break;
+
+ /*
+ * ifHCOutOctets(10)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCOUTOCTETS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ifHCOutOctets_get(rowreq_ctx, (U64 *) var->val.string);
+ break;
+
+ /*
+ * ifHCOutUcastPkts(11)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCOUTUCASTPKTS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ifHCOutUcastPkts_get(rowreq_ctx, (U64 *) var->val.string);
+ break;
+
+ /*
+ * ifHCOutMulticastPkts(12)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCOUTMULTICASTPKTS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ifHCOutMulticastPkts_get(rowreq_ctx, (U64 *) var->val.string);
+ break;
+
+ /*
+ * ifHCOutBroadcastPkts(13)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCOUTBROADCASTPKTS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ifHCOutBroadcastPkts_get(rowreq_ctx, (U64 *) var->val.string);
+ break;
+
+ /*
+ * ifLinkUpDownTrapEnable(14)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IFLINKUPDOWNTRAPENABLE:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ifLinkUpDownTrapEnable_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifHighSpeed(15)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHIGHSPEED:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_GAUGE;
+ rc = ifHighSpeed_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifPromiscuousMode(16)/TruthValue/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IFPROMISCUOUSMODE:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ifPromiscuousMode_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifConnectorPresent(17)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_IFCONNECTORPRESENT:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ifConnectorPresent_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ifAlias(18)/DisplayString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ case COLUMN_IFALIAS:
+ var->type = ASN_OCTET_STR;
+ rc = ifAlias_get(rowreq_ctx, (char **) &var->val.string,
+ &var->val_len);
+ break;
+
+ /*
+ * ifCounterDiscontinuityTime(19)/TimeStamp/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFCOUNTERDISCONTINUITYTIME:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_TIMETICKS;
+ rc = ifCounterDiscontinuityTime_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ default:
+ snmp_log(LOG_ERR, "unknown column %d in _ifXTable_get_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ifXTable_get_column */
+
+int
+_mfd_ifXTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ifXTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ u_char *old_string;
+ void (*dataFreeHook) (void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:ifXTable:_mfd_ifXTable_get_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+ /*
+ * save old pointer, so we can free it if replaced
+ */
+ old_string = requests->requestvb->val.string;
+ dataFreeHook = requests->requestvb->dataFreeHook;
+ if (NULL == requests->requestvb->val.string) {
+ requests->requestvb->val.string = requests->requestvb->buf;
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ } else if (requests->requestvb->buf ==
+ requests->requestvb->val.string) {
+ if (requests->requestvb->val_len !=
+ sizeof(requests->requestvb->buf))
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ }
+
+ /*
+ * get column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ifXTable_get_column(rowreq_ctx, requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ if (MFD_SKIP == rc) {
+ requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+ rc = SNMP_ERR_NOERROR;
+ }
+ } else if (NULL == requests->requestvb->val.string) {
+ snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
+ rc = SNMP_ERR_GENERR;
+ }
+ if (rc)
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+
+ /*
+ * if the buffer wasn't used previously for the old data (i.e. it
+ * was allcoated memory) and the get routine replaced the pointer,
+ * we need to free the previous pointer.
+ */
+ if (old_string && (old_string != requests->requestvb->buf) &&
+ (requests->requestvb->val.string != old_string)) {
+ if (dataFreeHook)
+ (*dataFreeHook) (old_string);
+ else
+ free(old_string);
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifXTable_get_values */
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Syntax checks
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check the syntax for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ifXTable_check_column(ifXTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ifXTable:_ifXTable_check_column",
+ "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ifName(1)/DisplayString/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H
+ */
+ case COLUMN_IFNAME:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifInMulticastPkts(2)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFINMULTICASTPKTS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifInBroadcastPkts(3)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFINBROADCASTPKTS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifOutMulticastPkts(4)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFOUTMULTICASTPKTS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifOutBroadcastPkts(5)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFOUTBROADCASTPKTS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifHCInOctets(6)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCINOCTETS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifHCInUcastPkts(7)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCINUCASTPKTS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifHCInMulticastPkts(8)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCINMULTICASTPKTS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifHCInBroadcastPkts(9)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCINBROADCASTPKTS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifHCOutOctets(10)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCOUTOCTETS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifHCOutUcastPkts(11)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCOUTUCASTPKTS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifHCOutMulticastPkts(12)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCOUTMULTICASTPKTS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifHCOutBroadcastPkts(13)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHCOUTBROADCASTPKTS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifLinkUpDownTrapEnable(14)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IFLINKUPDOWNTRAPENABLE:
+ rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
+ sizeof(rowreq_ctx->data.
+ ifLinkUpDownTrapEnable));
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (*var->val.integer != IFLINKUPDOWNTRAPENABLE_ENABLED)
+ && (*var->val.integer != IFLINKUPDOWNTRAPENABLE_DISABLED)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ifXTable:_ifXTable_check_column:ifLinkUpDownTrapEnable", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ifLinkUpDownTrapEnable_check_value(rowreq_ctx,
+ *((u_long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ifLinkUpDownTrapEnable_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ifHighSpeed(15)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFHIGHSPEED:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifPromiscuousMode(16)/TruthValue/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IFPROMISCUOUSMODE:
+ rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
+ sizeof(rowreq_ctx->data.
+ ifPromiscuousMode));
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (*var->val.integer != TRUTHVALUE_TRUE)
+ && (*var->val.integer != TRUTHVALUE_FALSE)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ifXTable:_ifXTable_check_column:ifPromiscuousMode", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ifPromiscuousMode_check_value(rowreq_ctx,
+ *((u_long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ifPromiscuousMode_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ifConnectorPresent(17)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_IFCONNECTORPRESENT:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ifAlias(18)/DisplayString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ case COLUMN_IFALIAS:
+ rc = netsnmp_check_vb_type_and_max_size(var, ASN_OCTET_STR,
+ sizeof(rowreq_ctx->data.
+ ifAlias));
+ /*
+ * check defined range(s).
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && ((var->val_len < 0) || (var->val_len > 64))
+ ) {
+ rc = SNMP_ERR_WRONGLENGTH;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ifXTable:_ifXTable_check_column:ifAlias",
+ "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ifAlias_check_value(rowreq_ctx, (char *) var->val.string,
+ var->val_len);
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR, "bad rc %d from ifAlias_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ifCounterDiscontinuityTime(19)/TimeStamp/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IFCOUNTERDISCONTINUITYTIME:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ default: /** We shouldn't get here */
+ rc = SNMP_ERR_GENERR;
+ snmp_log(LOG_ERR, "unknown column %d in _ifXTable_check_column\n",
+ column);
+ }
+
+ return rc;
+} /* _ifXTable_check_column */
+
+int
+_mfd_ifXTable_check_objects(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ifXTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc;
+
+ DEBUGMSGTL(("internal:ifXTable:_mfd_ifXTable_check_objects",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+
+ /*
+ * get column number from table request info, and check that column
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ifXTable_check_column(rowreq_ctx, requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+ break;
+ }
+
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifXTable_check_objects */
+
+
+/*----------------------------------------------------------------------
+ *
+ * SET: check dependencies
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check dependencies wrapper
+ */
+static int
+_mfd_ifXTable_check_dependencies(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ifXTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ DEBUGMSGTL(("internal:ifXTable:_mfd_ifXTable_check_dependencies",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = ifXTable_check_dependencies(rowreq_ctx);
+ if (rc) {
+ DEBUGMSGTL(("ifXTable:mfd", "error %d from "
+ "ifXTable_check_dependencies\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifXTable_check_dependencies */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo setup
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ifXTable_undo_setup_column(ifXTable_rowreq_ctx * rowreq_ctx, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ifXTable:_ifXTable_undo_setup_column",
+ "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ifLinkUpDownTrapEnable(14)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IFLINKUPDOWNTRAPENABLE:
+ rowreq_ctx->column_set_flags |= COLUMN_IFLINKUPDOWNTRAPENABLE_FLAG;
+ rc = ifLinkUpDownTrapEnable_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * ifPromiscuousMode(16)/TruthValue/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IFPROMISCUOUSMODE:
+ rowreq_ctx->column_set_flags |= COLUMN_IFPROMISCUOUSMODE_FLAG;
+ rc = ifPromiscuousMode_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * ifAlias(18)/DisplayString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ case COLUMN_IFALIAS:
+ rowreq_ctx->column_set_flags |= COLUMN_IFALIAS_FLAG;
+ rc = ifAlias_undo_setup(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ifXTable_undo_setup_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ifXTable_undo_setup_column */
+
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_ifXTable_undo_setup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ifXTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ifXTable:_mfd_ifXTable_undo_setup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * allocate undo context
+ */
+ rowreq_ctx->undo = ifXTable_allocate_data();
+ if (NULL == rowreq_ctx->undo) {
+ /** msg already logged */
+ netsnmp_request_set_error_all(requests,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * row undo setup
+ */
+ rowreq_ctx->column_set_flags = 0;
+ rc = ifXTable_undo_setup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ifXTable:mfd", "error %d from "
+ "ifXTable_undo_setup\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ } else {
+ /*
+ * column undo setup
+ */
+ netsnmp_table_request_info *tri;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ifXTable_undo_setup_column(rowreq_ctx, tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ifXTable:mfd", "error %d from "
+ "ifXTable_undo_setup_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifXTable_undo_setup */
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_ifXTable_undo_cleanup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ifXTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc;
+
+ DEBUGMSGTL(("internal:ifXTable:_mfd_ifXTable_undo_cleanup",
+ "called\n"));
+
+ /*
+ * failed row create in early stages has no rowreq_ctx
+ */
+ if (NULL == rowreq_ctx)
+ return MFD_SUCCESS;
+
+ /*
+ * call user cleanup
+ */
+ rc = ifXTable_undo_cleanup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ifXTable:mfd", "error %d from "
+ "ifXTable_undo_cleanup\n", rc));
+ }
+
+ /*
+ * release undo context, if needed
+ */
+ if (rowreq_ctx->undo) {
+ ifXTable_release_data(rowreq_ctx->undo);
+ rowreq_ctx->undo = NULL;
+ }
+
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifXTable_undo_cleanup */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Set values
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ifXTable_set_column(ifXTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ifXTable:_ifXTable_set_column",
+ "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ifLinkUpDownTrapEnable(14)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IFLINKUPDOWNTRAPENABLE:
+ rowreq_ctx->column_set_flags |= COLUMN_IFLINKUPDOWNTRAPENABLE_FLAG;
+ rc = ifLinkUpDownTrapEnable_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ /*
+ * ifPromiscuousMode(16)/TruthValue/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IFPROMISCUOUSMODE:
+ rowreq_ctx->column_set_flags |= COLUMN_IFPROMISCUOUSMODE_FLAG;
+ rc = ifPromiscuousMode_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ /*
+ * ifAlias(18)/DisplayString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ case COLUMN_IFALIAS:
+ rowreq_ctx->column_set_flags |= COLUMN_IFALIAS_FLAG;
+ rc = ifAlias_set(rowreq_ctx, (char *) var->val.string,
+ var->val_len);
+ break;
+
+ default:
+ snmp_log(LOG_ERR, "unknown column %d in _ifXTable_set_column\n",
+ column);
+ rc = SNMP_ERR_GENERR;
+ break;
+ }
+
+ return rc;
+} /* _ifXTable_set_column */
+
+int
+_mfd_ifXTable_set_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ifXTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc = SNMP_ERR_NOERROR;
+
+ DEBUGMSGTL(("internal:ifXTable:_mfd_ifXTable_set_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rowreq_ctx->column_set_flags = 0;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ifXTable_set_column(rowreq_ctx,
+ requests->requestvb, tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ifXTable:mfd", "error %d from "
+ "ifXTable_set_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifXTable_set_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit the values
+ */
+int
+_mfd_ifXTable_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ifXTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ifXTable:_mfd_ifXTable_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = ifXTable_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ifXTable:mfd", "error %d from "
+ "ifXTable_commit\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ /*
+ * if we successfully commited this row, set the dirty flag. Use the
+ * current value + 1 (i.e. dirty = # rows changed).
+ * this is checked in post_request...
+ */
+ ifXTable_dirty_set(ifXTable_dirty_get() + 1); /* set table dirty flag */
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+_mfd_ifXTable_undo_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ifXTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ifXTable:_mfd_ifXTable_undo_commit",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ u_int d = ifXTable_dirty_get();
+
+ netsnmp_assert(d != 0);
+ if (d)
+ ifXTable_dirty_set(d - 1);
+ }
+
+ rc = ifXTable_undo_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ifXTable:mfd", "error %d from "
+ "ifXTable_undo_commit\n", rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ snmp_log(LOG_WARNING,
+ "ifXTable row dirty flag still set after undo_commit\n");
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifXTable_commit */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * undo the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ifXTable_undo_column(ifXTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ifXTable:_ifXTable_undo_column",
+ "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ifLinkUpDownTrapEnable(14)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IFLINKUPDOWNTRAPENABLE:
+ rc = ifLinkUpDownTrapEnable_undo(rowreq_ctx);
+ break;
+
+ /*
+ * ifPromiscuousMode(16)/TruthValue/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IFPROMISCUOUSMODE:
+ rc = ifPromiscuousMode_undo(rowreq_ctx);
+ break;
+
+ /*
+ * ifAlias(18)/DisplayString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ case COLUMN_IFALIAS:
+ rc = ifAlias_undo(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR, "unknown column %d in _ifXTable_undo_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ifXTable_undo_column */
+
+int
+_mfd_ifXTable_undo_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ifXTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+
+ DEBUGMSGTL(("internal:ifXTable:_mfd_ifXTable_undo_values",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = ifXTable_undo(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ifXTable:mfd", "error %d from "
+ "ifXTable_undo\n", rc));
+ }
+
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ifXTable_undo_column(rowreq_ctx, requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ifXTable:mfd", "error %d from "
+ "ifXTable_undo_column\n", rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifXTable_undo_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: irreversible commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit irreversible actions
+ */
+int
+_mfd_ifXTable_irreversible_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ifXTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ifXTable:_mfd_ifXTable_irreversible:commit",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * check for and handle row creation/deletion
+ * and update column exist flags...
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) {
+ CONTAINER_REMOVE(ifXTable_if_ctx.container, rowreq_ctx);
+ } else {
+ if (rowreq_ctx->column_set_flags) {
+ rowreq_ctx->column_set_flags = 0;
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ifXTable_irreversible_commit */
+
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+/**
+ * @internal
+ * initialize the container with functions or wrappers
+ */
+void
+_ifXTable_container_init(ifXTable_interface_ctx * if_ctx)
+{
+ DEBUGMSGTL(("internal:ifXTable:_ifXTable_container_init", "called\n"));
+
+ /*
+ * cache init
+ *
+ * special case: sharing a cache
+ */
+ if_ctx->cache =
+ netsnmp_cache_find_by_oid(ifTable_oid, ifTable_oid_size);
+ if (NULL != if_ctx->cache) {
+ if_ctx->container = (netsnmp_container *) if_ctx->cache->magic;
+ return;
+ } else {
+ snmp_log(LOG_ERR, "error finding ifTable cache\n");
+ }
+}
+
+/*
+ * allow direct access to container.
+ */
+netsnmp_container *
+_ifXTable_container_get(void)
+{
+ return ifXTable_if_ctx.container;
+}
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+_ifXTable_container_shutdown(ifXTable_interface_ctx * if_ctx)
+{
+ DEBUGMSGTL(("internal:ifXTable:_ifXTable_container_shutdown",
+ "called\n"));
+
+ /*
+ * ifTable does this for us
+ */
+} /* _ifXTable_container_shutdown */
+
+/***********************************************************************
+ *
+ * PERSISTENCE
+ *
+ ***********************************************************************/
+
+static int _ifXTable_container_save_rows(int majorID, int minorID,
+ void *serverarg,
+ void *clientarg);
+static void _ifXTable_container_row_restore(const char *token,
+ char *buf);
+static int _ifXTable_container_row_save(ifXTable_rowreq_ctx *
+ rowreq_ctx, void *type);
+static char *_ifXTable_container_col_restore(ifXTable_rowreq_ctx *
+ rowreq_ctx, u_int col,
+ char *buf);
+static char *_ifXTable_container_col_save(ifXTable_rowreq_ctx *
+ rowreq_ctx, u_int col,
+ char *buf);
+
+static char row_token[] = "ifXTable";
+
+/************************************************************
+ * *_init_persistence should be called from the main table
+ * init routine.
+ *
+ * If your table depends on rows in another table,
+ * you should register your callback after the other table,
+ * which should ensure the rows on which you depend are saved
+ * (and re-created) before the dependent rows.
+ */
+void
+ifXTable_container_init_persistence(netsnmp_container *container)
+{
+ int rc;
+
+ register_config_handler(NULL, row_token,
+ _ifXTable_container_row_restore, NULL, NULL);
+ rc = snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+ SNMP_CALLBACK_STORE_DATA,
+ _ifXTable_container_save_rows, container);
+
+ if (rc != SNMP_ERR_NOERROR)
+ snmp_log(LOG_ERR, "error registering for STORE_DATA callback "
+ "in _ifXTable_container_init_persistence\n");
+}
+
+static int
+_ifXTable_container_save_rows(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ char sep[] =
+ "##############################################################";
+ char buf[] = "#\n" "# ifXTable persistent data\n" "#";
+ char *type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_APPTYPE);
+
+ read_config_store((char *) type, sep);
+ read_config_store((char *) type, buf);
+
+ /*
+ * save all rows
+ */
+ CONTAINER_FOR_EACH((netsnmp_container *) clientarg,
+ (netsnmp_container_obj_func *)
+ _ifXTable_container_row_save, type);
+
+ read_config_store((char *) type, sep);
+ read_config_store((char *) type, "\n");
+
+ /*
+ * never fails
+ */
+ return SNMPERR_SUCCESS;
+}
+
+
+
+/************************************************************
+ * _ifXTable_container_row_save
+ */
+static int
+_ifXTable_container_row_save(ifXTable_rowreq_ctx * rowreq_ctx, void *type)
+{
+ /*
+ * Allocate space for a line with all data for a row. An
+ * attempt is made to come up with a default maximum size, but
+ * there is no guarantee it will be enough. It probably will be,
+ * unless you are dealing with large values or you have external
+ * indexes.
+ *
+ * 1) allocate space for each column. Comment out columns you don't
+ * intend to save. You may also need to add room for any non-
+ * column data you want to store. Remeber, data will be stored in
+ * ASCII form, so you need to allow for that. Here are some
+ * general guidelines:
+ *
+ * Object ID : 12 * len [ASCII len of max int + 1 for .]
+ * Octet String: (2 * len) + 2 [2 ASCII chars per byte + "0x"]
+ * Integers : 12 [ASCII len for smallest negative number]
+ *
+ * 2) You also need to allocate space for the row index. This will
+ * be stored as an OID, which means that Octet Strings need to
+ * be treated a little differently. Specifically, you will need
+ * (4 * len) + 4 [3 ASCII chars per byte + 1 for ., + 4 for len].
+ *
+ * 3) Also, remeber to add space for the identifier and seperator
+ * characters (for example, each column is prefixed by the
+ * column number and a semicolon. To allow for the maximum
+ * column values, 12 bytes [11 for oid + 1 for ':'] per
+ * column are added).
+ */
+ /** xxx: add storage for external index(s)! */
+#define MAX_ROW_SIZE (sizeof(row_token) + 1 + \
+ ( 12 ) + /* ASN_INTEGER ifLinkUpDownTrapEnable */ \
+ ( 12 ) + /* ASN_INTEGER ifPromiscuousMode */ \
+ ( ( 2 * sizeof(rowreq_ctx->data.ifAlias) ) + 3 ) + /* ASN_OCTET_STR */ \
+ ( IFXTABLE_MAX_COL * 12 ) + /* column num prefix + : */ \
+ 2 /* LINE_TERM_CHAR + \n */ )
+
+ char buf[MAX_ROW_SIZE], *pos = buf, *max =
+ &buf[MAX_ROW_SIZE - 1];
+ char *tmp;
+ int i;
+
+ if (ifXTable_container_should_save(rowreq_ctx) == 0) {
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * build the line
+ */
+ pos += sprintf(pos, "%s ", row_token);
+ pos = read_config_save_objid(pos, rowreq_ctx->oid_idx.oids,
+ rowreq_ctx->oid_idx.len);
+ if (NULL == pos) {
+ snmp_log(LOG_ERR, "error saving ifXTable row "
+ "to persistent file\n");
+ return SNMP_ERR_GENERR;
+ }
+ *pos++ = ' ';
+ if (pos > max) {
+ snmp_log(LOG_ERR, "error saving ifXTable row "
+ "to persistent file (too long)\n");
+ return SNMP_ERR_GENERR;
+ }
+
+ /*
+ * add each column
+ */
+ for (i = IFXTABLE_MIN_COL; i <= IFXTABLE_MAX_COL; ++i) {
+
+ if ((0x1 << (i - 1)) & ~IFXTABLE_SETTABLE_COLS)
+ continue;
+
+ tmp = pos;
+ pos = _ifXTable_container_col_save(rowreq_ctx, i, pos);
+ if (NULL == pos)
+ pos = tmp;
+ else
+ *pos++ = ' ';
+ if (pos > max) {
+ snmp_log(LOG_ERR, "error saving ifXTable row "
+ "to persistent file (too long)\n");
+ return SNMP_ERR_GENERR;
+ }
+ }
+
+ /*
+ * if you have non-column data, add it here
+ */
+
+
+ /*
+ * store the line
+ */
+ pos += sprintf(pos, "%c", LINE_TERM_CHAR);
+ if (pos > max) {
+ snmp_log(LOG_ERR, "error saving ifXTable row "
+ "to persistent file (too long)\n");
+ return SNMP_ERR_GENERR;
+ }
+ read_config_store((char *) type, buf);
+
+ DEBUGMSGTL(("internal:ifXTable:_ifXTable_container_row_save",
+ "saving line '%s'\n", buf));
+
+ return SNMP_ERR_NOERROR;
+}
+
+static void
+_ifXTable_container_row_restore(const char *token, char *buf)
+{
+ ifXTable_rowreq_ctx *rowreq_ctx;
+ netsnmp_container *container;
+ netsnmp_index index;
+ oid tmp_oid[MAX_ifTable_IDX_LEN];
+ u_int col = 0, found = 0;
+
+
+ if (strncmp(token, row_token, sizeof(row_token)) != 0) {
+ snmp_log(LOG_ERR,
+ "unknown token in _ifXTable_container_row_restore\n");
+ return;
+ }
+
+ container = _ifXTable_container_get();
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "null container in _ifXTable_restore\n");
+ return;
+ }
+
+ DEBUGMSGTL(("internal:ifXTable:_ifXTable_container_row_restore",
+ "parsing line '%s'\n", buf));
+
+ /*
+ * pull out index and find row. (Since we populate the cache
+ * during startup, all rows should exist.)
+ */
+ index.oids = tmp_oid;
+ index.len = OID_LENGTH(tmp_oid);
+ buf = read_config_read_objid(buf, &index.oids, &index.len);
+ if (NULL == buf) {
+ snmp_log(LOG_ERR, "error reading row index in "
+ "_ifXTable_container_row_restore\n");
+ return;
+ }
+ rowreq_ctx = CONTAINER_FIND(container, &index);
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "error finding row index in "
+ "_ifXTable_container_row_restore\n");
+ return;
+ }
+
+ /*
+ * loop through and get each column
+ */
+ buf = skip_white(buf);
+ while ((NULL != buf) && isdigit(*buf)) {
+ /*
+ * extract column, skip ':'
+ */
+ col = (u_int) strtol(buf, &buf, 10);
+ if (NULL == buf)
+ break;
+ if (*buf != ':') {
+ buf = NULL;
+ break;
+ }
+ ++buf; /* skip : */
+
+ /*
+ * parse value
+ */
+ DEBUGMSGTL(("_ifXTable_container_row_restore",
+ "parsing column %d\n", col));
+ buf = _ifXTable_container_col_restore(rowreq_ctx, col, buf);
+ ++found;
+ }
+ if (0 == found) {
+ snmp_log(LOG_ERR, "error parsing ifXTable row; no columns found\n");
+ ifTable_release_rowreq_ctx(rowreq_ctx);
+ return;
+ }
+
+ /*
+ * if you added any non-column data, this is where
+ * you should handle it.
+ */
+
+ /*
+ * if the pointer is NULL and we didn't reach the
+ * end of the line, something went wrong. Log message,
+ * and bail.
+ */
+ if ((buf == NULL) || (*buf != LINE_TERM_CHAR)) {
+ snmp_log(LOG_ERR, "error parsing ifXTable row around column %d\n",
+ col);
+ return;
+ }
+
+ DEBUGMSGTL(("internal:ifXTable:_ifXTable_container_row_restore",
+ "inserting row\n"));
+}
+
+/************************************************************
+ * _ifXTable_container_col_save
+ */
+static char *
+_ifXTable_container_col_save(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_int col, char *buf)
+{
+ if ((NULL == rowreq_ctx) || (NULL == buf)) {
+ snmp_log(LOG_ERR, "bad parameter in "
+ "_ifXTable_container_col_save\n");
+ return NULL;
+ }
+
+ DEBUGMSGTL(("internal:ifXTable:_ifXTable_container_col_save",
+ "processing column %d\n", col));
+
+ /*
+ * prefix with column number, so we don't ever depend on
+ * order saved.
+ */
+ buf += sprintf(buf, "%u:", col);
+
+ /*
+ * save data for the column
+ */
+ switch (col) {
+
+ case COLUMN_IFLINKUPDOWNTRAPENABLE: /** INTEGER = ASN_INTEGER */
+ buf +=
+ sprintf(buf, "%ld", rowreq_ctx->data.ifLinkUpDownTrapEnable);
+ break;
+
+ case COLUMN_IFALIAS: /** DisplayString = ASN_OCTET_STR */
+ buf = read_config_save_octet_string(buf, rowreq_ctx->data.ifAlias,
+ rowreq_ctx->data.ifAlias_len);
+ break;
+
+ default:
+ /** We shouldn't get here */
+ snmp_log(LOG_ERR, "unknown column %d in "
+ "_ifXTable_container_col_save\n", col);
+ return NULL;
+ }
+
+ return buf;
+}
+
+/************************************************************
+ * _ifXTable_container_col_restore
+ */
+static char *
+_ifXTable_container_col_restore(ifXTable_rowreq_ctx * rowreq_ctx,
+ u_int col, char *buf)
+{
+ size_t len;
+ if ((NULL == rowreq_ctx) || (NULL == buf)) {
+ snmp_log(LOG_ERR, "bad parameter in "
+ "_ifXTable_container_col_restore\n");
+ return NULL;
+ }
+
+ DEBUGMSGTL(("verbose:ifXTable:_ifXTable_container_col_restore",
+ "processing column %d\n", col));
+
+ /*
+ * restore data for the column
+ */
+ switch (col) {
+
+ case COLUMN_IFLINKUPDOWNTRAPENABLE: /** INTEGER = ASN_INTEGER */
+ len = sizeof(rowreq_ctx->data.ifLinkUpDownTrapEnable);
+ buf = read_config_read_memory(ASN_INTEGER, buf,
+ (char *) &rowreq_ctx->data.
+ ifLinkUpDownTrapEnable, &len);
+ break;
+
+ case COLUMN_IFALIAS: /** DisplayString = ASN_OCTET_STR */
+ rowreq_ctx->data.ifAlias_len = sizeof(rowreq_ctx->data.ifAlias);
+ buf = read_config_read_memory(ASN_OCTET_STR, buf,
+ (char *) &rowreq_ctx->data.ifAlias,
+ (size_t *) & rowreq_ctx->data.
+ ifAlias_len);
+ break;
+
+ default:
+ /** We shouldn't get here */
+ snmp_log(LOG_ERR, "unknown column %d in "
+ "_ifXTable_container_col_restore\n", col);
+ return NULL;
+ }
+
+ return buf;
+}
+
+
+ifXTable_rowreq_ctx *
+ifXTable_row_find_by_mib_index(ifXTable_mib_index * mib_idx)
+{
+ ifXTable_rowreq_ctx *rowreq_ctx;
+ oid oid_tmp[MAX_OID_LEN];
+ netsnmp_index oid_idx;
+ int rc;
+
+ /*
+ * set up storage for OID
+ */
+ oid_idx.oids = oid_tmp;
+ oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
+
+ /*
+ * convert
+ */
+ rc = ifXTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx = CONTAINER_FIND(ifXTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_interface.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_interface.h
new file mode 100644
index 0000000000..f94fb5720b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/if-mib/ifXTable/ifXTable_interface.h
@@ -0,0 +1,105 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: ifXTable_interface.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** @ingroup interface Routines to interface to Net-SNMP
+ *
+ * \warning This code should not be modified, called directly,
+ * or used to interpret functionality. It is subject to
+ * change at any time.
+ *
+ * @{
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+#ifndef IFXTABLE_INTERFACE_H
+#define IFXTABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "ifXTable.h"
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void _ifXTable_initialize_interface(ifXTable_registration *
+ user_ctx, u_long flags);
+ void _ifXTable_shutdown_interface(ifXTable_registration *
+ user_ctx);
+
+ ifXTable_registration *ifXTable_registration_get(void);
+
+ ifXTable_registration *ifXTable_registration_set(ifXTable_registration
+ * newreg);
+
+ netsnmp_container *ifXTable_container_get(void);
+ int ifXTable_container_size(void);
+
+ u_int ifXTable_dirty_get(void);
+ void ifXTable_dirty_set(u_int status);
+
+ ifXTable_rowreq_ctx *ifXTable_allocate_rowreq_ctx(void *);
+ void ifXTable_release_rowreq_ctx(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ifXTable_index_to_oid(netsnmp_index * oid_idx,
+ ifXTable_mib_index * mib_idx);
+ int ifXTable_index_from_oid(netsnmp_index * oid_idx,
+ ifXTable_mib_index * mib_idx);
+
+ /*
+ *********************************************************************
+ * Persistent declarations
+ */
+ /*
+ * persistence
+ */
+#define LINE_TERM_CHAR '$'
+
+ void ifXTable_container_init_persistence(netsnmp_container
+ *container);
+ int ifXTable_container_should_save(ifXTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void ifXTable_valid_columns_set(netsnmp_column_info *vc);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IFXTABLE_INTERFACE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib.h
new file mode 100644
index 0000000000..969ba17bd6
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib.h
@@ -0,0 +1,7 @@
+/*
+ * module to include the modules
+ */
+
+config_require(ip-forward-mib/ipCidrRouteTable);
+config_require(ip-forward-mib/inetCidrRouteTable);
+config_add_mib(IP-FORWARD-MIB)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route.h
new file mode 100644
index 0000000000..83eb6518d0
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route.h
@@ -0,0 +1,31 @@
+/*
+ * route data access header
+ *
+ * $Id: route.h 13271 2005-10-28 15:29:23Z rstory $
+ */
+/**---------------------------------------------------------------------*/
+/*
+ * configure required files
+ *
+ * Notes:
+ *
+ * 1) prefer functionality over platform, where possible. If a method
+ * is available for multiple platforms, test that first. That way
+ * when a new platform is ported, it won't need a new test here.
+ *
+ * 2) don't do detail requirements here. If, for example,
+ * HPUX11 had different reuirements than other HPUX, that should
+ * be handled in the *_hpux.h header file.
+ */
+config_require(ip-forward-mib/data_access/route_common)
+
+#if defined( linux )
+config_require(ip-forward-mib/data_access/route_linux)
+config_require(ip-forward-mib/data_access/route_ioctl)
+#else
+#error "the route data access library is not available for this platform."
+#endif
+
+/** need interface for ifIndex */
+config_require(if-mib/data_access/interface)
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_common.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_common.c
new file mode 100644
index 0000000000..4882615c3a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_common.c
@@ -0,0 +1,279 @@
+/*
+ * Interface MIB architecture support
+ *
+ * $Id: route_common.c 16612 2007-07-16 23:59:44Z hardaker $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include "mibII/mibII_common.h"
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/route.h>
+
+/**---------------------------------------------------------------------*/
+/*
+ * local static prototypes
+ */
+static void _access_route_entry_release(netsnmp_route_entry * entry, void *unused);
+
+/**---------------------------------------------------------------------*/
+/*
+ * external per-architecture functions prototypes
+ *
+ * These shouldn't be called by the general public, so they aren't in
+ * the header file.
+ */
+extern int netsnmp_access_route_container_arch_load(netsnmp_container* container,
+ u_int load_flags);
+extern int
+netsnmp_arch_route_create(netsnmp_route_entry *entry);
+extern int
+netsnmp_arch_route_delete(netsnmp_route_entry *entry);
+
+
+/**---------------------------------------------------------------------*/
+/*
+ * container functions
+ */
+
+/**
+ * @retval NULL error
+ * @retval !NULL pointer to container
+ */
+netsnmp_container*
+netsnmp_access_route_container_load(netsnmp_container* container, u_int load_flags)
+{
+ int rc;
+
+ DEBUGMSGTL(("access:route:container", "load\n"));
+
+ if (NULL == container)
+ container = netsnmp_container_find("access:_route:table_container");
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "no container specified/found for access_route\n");
+ return NULL;
+ }
+
+ rc = netsnmp_access_route_container_arch_load(container, load_flags);
+ if (0 != rc) {
+ netsnmp_access_route_container_free(container, NETSNMP_ACCESS_ROUTE_FREE_NOFLAGS);
+ container = NULL;
+ }
+
+ return container;
+}
+
+void
+netsnmp_access_route_container_free(netsnmp_container *container, u_int free_flags)
+{
+ DEBUGMSGTL(("access:route:container", "free\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "invalid container for netsnmp_access_route_free\n");
+ return;
+ }
+
+ if(! (free_flags & NETSNMP_ACCESS_ROUTE_FREE_DONT_CLEAR)) {
+ /*
+ * free all items.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func*)_access_route_entry_release,
+ NULL);
+ }
+
+ if(! (free_flags & NETSNMP_ACCESS_ROUTE_FREE_KEEP_CONTAINER))
+ CONTAINER_FREE(container);
+}
+
+/**---------------------------------------------------------------------*/
+/*
+ * ifentry functions
+ */
+/** create route entry
+ *
+ * @note:
+ * if you create a route for entry into a container of your own, you
+ * must set ns_rt_index to a unique index for your container.
+ */
+netsnmp_route_entry *
+netsnmp_access_route_entry_create(void)
+{
+ netsnmp_route_entry *entry = SNMP_MALLOC_TYPEDEF(netsnmp_route_entry);
+ if(NULL == entry) {
+ snmp_log(LOG_ERR, "could not allocate route entry\n");
+ return NULL;
+ }
+
+ entry->oid_index.oids = &entry->ns_rt_index;
+ entry->oid_index.len = 1;
+
+ entry->rt_metric1 = -1;
+ entry->rt_metric2 = -1;
+ entry->rt_metric3 = -1;
+ entry->rt_metric4 = -1;
+ entry->rt_metric5 = -1;
+
+ /** entry->row_status? */
+
+ return entry;
+}
+
+/**
+ */
+void
+netsnmp_access_route_entry_free(netsnmp_route_entry * entry)
+{
+ if (NULL == entry)
+ return;
+
+#ifdef USING_IP_FORWARD_MIB_INETCIDRROUTETABLE_INETCIDRROUTETABLE_MODULE
+ if ((NULL != entry->rt_policy) &&
+ !(entry->flags & NETSNMP_ACCESS_ROUTE_POLICY_STATIC))
+ free(entry->rt_policy);
+#endif
+#ifdef USING_IP_FORWARD_MIB_IPCIDRROUTETABLE_IPCIDRROUTETABLE_MODULE
+ if (NULL != entry->rt_info)
+ free(entry->rt_info);
+#endif
+
+ free(entry);
+}
+
+
+/**
+ * update underlying data store (kernel) for entry
+ *
+ * @retval 0 : success
+ * @retval -1 : error
+ */
+int
+netsnmp_access_route_entry_set(netsnmp_route_entry * entry)
+{
+ int rc = SNMP_ERR_NOERROR;
+
+ if (NULL == entry) {
+ netsnmp_assert(NULL != entry);
+ return -1;
+ }
+
+ /*
+ *
+ */
+ if (entry->flags & NETSNMP_ACCESS_ROUTE_CREATE) {
+ rc = netsnmp_arch_route_create(entry);
+ }
+ else if (entry->flags & NETSNMP_ACCESS_ROUTE_CHANGE) {
+ /** xxx-rks:9 route change not implemented */
+ snmp_log(LOG_ERR,"netsnmp_access_route_entry_set change not supported yet\n");
+ rc = -1;
+ }
+ else if (entry->flags & NETSNMP_ACCESS_ROUTE_DELETE) {
+ rc = netsnmp_arch_route_delete(entry);
+ }
+ else {
+ snmp_log(LOG_ERR,"netsnmp_access_route_entry_set with no mode\n");
+ netsnmp_assert(!"route_entry_set == unknown mode"); /* always false */
+ rc = -1;
+ }
+
+ return rc;
+}
+
+/**
+ * copy an route_entry
+ *
+ * @retval -1 : error
+ * @retval 0 : no error
+ */
+int
+netsnmp_access_route_entry_copy(netsnmp_route_entry *lhs,
+ netsnmp_route_entry *rhs)
+{
+#if 0 /* no arch stuff in route (yet) */
+ int rc;
+
+ /*
+ * copy arch stuff. we don't care if it changed
+ */
+ rc = netsnmp_arch_route_entry_copy(lhs,rhs);
+ if (0 != rc) {
+ snmp_log(LOG_ERR,"arch route copy failed\n");
+ return -1;
+ }
+#endif
+
+ lhs->if_index = rhs->if_index;
+
+ lhs->rt_dest_len = rhs->rt_dest_len;
+ memcpy(lhs->rt_dest, rhs->rt_dest, rhs->rt_dest_len);
+ lhs->rt_dest_type = rhs->rt_dest_type;
+
+ lhs->rt_nexthop_len = rhs->rt_nexthop_len;
+ memcpy(lhs->rt_nexthop, rhs->rt_nexthop, rhs->rt_nexthop_len);
+ lhs->rt_nexthop_type = rhs->rt_nexthop_type;
+
+#ifdef USING_IP_FORWARD_MIB_INETCIDRROUTETABLE_INETCIDRROUTETABLE_MODULE
+ if (NULL != lhs->rt_policy) {
+ if (NETSNMP_ACCESS_ROUTE_POLICY_STATIC & lhs->flags)
+ lhs->rt_policy = NULL;
+ else {
+ SNMP_FREE(lhs->rt_policy);
+ }
+ }
+ if (NULL != rhs->rt_policy) {
+ if ((NETSNMP_ACCESS_ROUTE_POLICY_STATIC & rhs->flags) &&
+ ! (NETSNMP_ACCESS_ROUTE_POLICY_DEEP_COPY & rhs->flags)) {
+ lhs->rt_policy = rhs->rt_policy;
+ }
+ else {
+ snmp_clone_mem((void **) &lhs->rt_policy, rhs->rt_policy,
+ rhs->rt_policy_len * sizeof(oid));
+ }
+ }
+ lhs->rt_policy_len = rhs->rt_policy_len;
+#endif
+
+ lhs->rt_pfx_len = rhs->rt_pfx_len;
+ lhs->rt_type = rhs->rt_type;
+ lhs->rt_proto = rhs->rt_proto;
+
+#ifdef USING_IP_FORWARD_MIB_IPCIDRROUTETABLE_IPCIDRROUTETABLE_MODULE
+ if (NULL != lhs->rt_info)
+ SNMP_FREE(lhs->rt_info);
+ if (NULL != rhs->rt_info)
+ snmp_clone_mem((void **) &lhs->rt_info, rhs->rt_info,
+ rhs->rt_info_len * sizeof(oid));
+ lhs->rt_info_len = rhs->rt_info_len;
+
+ lhs->rt_mask = rhs->rt_mask;
+ lhs->rt_tos = rhs->rt_tos;
+#endif
+
+ lhs->rt_age = rhs->rt_age;
+ lhs->rt_nexthop_as = rhs->rt_nexthop_as;
+
+ lhs->rt_metric1 = rhs->rt_metric1;
+ lhs->rt_metric2 = rhs->rt_metric2;
+ lhs->rt_metric3 = rhs->rt_metric3;
+ lhs->rt_metric4 = rhs->rt_metric4;
+ lhs->rt_metric5 = rhs->rt_metric5;
+
+ lhs->flags = rhs->flags;
+
+ return 0;
+}
+
+
+/**---------------------------------------------------------------------*/
+/*
+ * Utility routines
+ */
+
+/**
+ */
+void
+_access_route_entry_release(netsnmp_route_entry * entry, void *context)
+{
+ netsnmp_access_route_entry_free(entry);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_ioctl.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_ioctl.c
new file mode 100644
index 0000000000..de42920bbc
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_ioctl.c
@@ -0,0 +1,197 @@
+/*
+ * Portions of this file are subject to copyright(s). See the Net-SNMP's
+ * COPYING file for more details and other copyrights that may apply.
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_FILE_H
+#include <sys/file.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#if HAVE_SYS_MBUF_H
+#include <sys/mbuf.h>
+#endif
+
+
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#include <errno.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/route.h>
+
+#include "ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable.h"
+#include "route_ioctl.h"
+
+#ifdef cygwin
+#include <windows.h>
+#endif
+
+#ifndef STRUCT_RTENTRY_HAS_RT_DST
+# define rt_dst rt_nodes->rn_key
+#endif
+#ifndef STRUCT_RTENTRY_HAS_RT_HASH
+# define rt_hash rt_pad1
+#endif
+
+
+#ifdef linux
+# define NETSNMP_ROUTE_WRITE_PROTOCOL PF_ROUTE
+#else
+# define NETSNMP_ROUTE_WRITE_PROTOCOL 0
+#endif
+
+#ifdef irix6
+#define SIOCADDRT SIOCADDMULTI
+#define SIOCDELRT SIOCDELMULTI
+#endif
+
+#if defined SIOCADDRT && !defined(irix6)
+int _netsnmp_ioctl_route_set_v4(netsnmp_route_entry * entry)
+{
+ struct sockaddr_in dst, gateway, mask;
+ int s, rc;
+ RTENTRY route;
+ char * DEBUGSTR;
+
+ netsnmp_assert(NULL != entry); /* checked in netsnmp_arch_route_create */
+ netsnmp_assert((4 == entry->rt_dest_len) && (4 == entry->rt_nexthop_len));
+
+ s = socket(AF_INET, SOCK_RAW, NETSNMP_ROUTE_WRITE_PROTOCOL);
+ if (s < 0) {
+ snmp_log_perror("socket");
+ return -3;
+ }
+
+ memset(&route, 0, sizeof(route));
+
+ dst.sin_family = AF_INET;
+ memcpy(&dst.sin_addr.s_addr, entry->rt_dest, 4);
+ DEBUGSTR = inet_ntoa(dst.sin_addr);
+ DEBUGMSGTL(("access:route","*** route to %s\n", DEBUGSTR));
+
+ gateway.sin_family = AF_INET;
+ memcpy(&gateway.sin_addr.s_addr, entry->rt_nexthop, 4);
+ DEBUGSTR = inet_ntoa(gateway.sin_addr);
+ DEBUGMSGTL(("access:route"," via %s\n", DEBUGSTR));
+
+ mask.sin_family = AF_INET;
+ mask.sin_addr.s_addr = htonl(0);
+ DEBUGSTR = inet_ntoa(mask.sin_addr);
+ DEBUGMSGTL(("access:route"," mask %s\n", DEBUGSTR));
+
+ memcpy(&route.rt_dst, &dst, sizeof(struct sockaddr_in));
+ memcpy(&route.rt_gateway, &gateway, sizeof(struct sockaddr_in));
+ memcpy(&route.rt_genmask, &mask, sizeof(struct sockaddr_in));
+
+ if (32 == entry->rt_pfx_len)
+ route.rt_flags |= RTF_HOST;
+ if (INETCIDRROUTETYPE_REMOTE == entry->rt_type)
+ route.rt_flags |= RTF_GATEWAY;
+ route.rt_flags |= RTF_UP;
+
+#ifndef RTENTRY_4_4
+ route.rt_hash = entry->if_index;
+#endif
+
+ rc = ioctl(s, SIOCADDRT, (caddr_t) & route);
+ close(s);
+ if (rc < 0) {
+ snmp_log_perror("ioctl");
+ return -4;
+ }
+
+ return 0;
+}
+#endif
+
+#if defined SIOCDELRT && !defined(irix6)
+int _netsnmp_ioctl_route_delete_v4(netsnmp_route_entry * entry)
+{
+ struct sockaddr_in dst;
+ struct sockaddr_in gateway;
+ int s, rc;
+ RTENTRY route;
+
+ netsnmp_assert(NULL != entry); /* checked in netsnmp_arch_route_delete */
+ netsnmp_assert((4 == entry->rt_dest_len) && (4 == entry->rt_nexthop_len));
+
+ s = socket(AF_INET, SOCK_RAW, NETSNMP_ROUTE_WRITE_PROTOCOL);
+ if (s < 0) {
+ snmp_log_perror("socket");
+ return -3;
+ }
+
+ memset(&route, 0, sizeof(route));
+
+ dst.sin_family = AF_INET;
+ memcpy(&dst.sin_addr.s_addr, entry->rt_dest, 4);
+
+ gateway.sin_family = AF_INET;
+ memcpy(&gateway.sin_addr.s_addr, entry->rt_nexthop, 4);
+
+ memcpy(&route.rt_dst, &dst, sizeof(struct sockaddr_in));
+ memcpy(&route.rt_gateway, &gateway, sizeof(struct sockaddr_in));
+
+ if (32 == entry->rt_pfx_len)
+ route.rt_flags |= RTF_HOST;
+ if (INETCIDRROUTETYPE_REMOTE == entry->rt_type)
+ route.rt_flags |= RTF_GATEWAY;
+ route.rt_flags |= RTF_UP;
+
+#ifndef RTENTRY_4_4
+ route.rt_hash = entry->if_index;
+#endif
+
+ rc = ioctl(s, SIOCDELRT, (caddr_t) & route);
+ close(s);
+ if (rc < 0) {
+ snmp_log_perror("ioctl");
+ rc = -4;
+ }
+
+ return rc;
+}
+#endif /* SIOCDELRT */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_ioctl.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_ioctl.h
new file mode 100644
index 0000000000..18c24afad7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_ioctl.h
@@ -0,0 +1,8 @@
+/*
+ * internal header, not for distribution
+ */
+
+int _netsnmp_ioctl_route_set_v4(netsnmp_route_entry * entry);
+int _netsnmp_ioctl_route_remove_v4(netsnmp_route_entry * entry);
+int _netsnmp_ioctl_route_delete_v4(netsnmp_route_entry * entry);
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_linux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_linux.c
new file mode 100644
index 0000000000..0bbabb9c26
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_linux.c
@@ -0,0 +1,427 @@
+/*
+ * Interface MIB architecture support
+ *
+ * $Id: route_linux.c 17099 2008-07-02 12:39:23Z jsafranek $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include "mibII/mibII_common.h"
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/interface.h>
+#include <net-snmp/data_access/route.h>
+#include <net-snmp/data_access/ipaddress.h>
+
+#include "ip-forward-mib/data_access/route_ioctl.h"
+#include "ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_constants.h"
+#include "if-mib/data_access/interface_ioctl.h"
+
+static int
+_type_from_flags(unsigned int flags)
+{
+ /*
+ * RTF_GATEWAY RTF_UP RTF_DYNAMIC RTF_CACHE
+ * RTF_MODIFIED RTF_EXPIRES RTF_NONEXTHOP
+ * RTF_DYNAMIC RTF_LOCAL RTF_PREFIX_RT
+ *
+ * xxx: can we distinguish between reject & blackhole?
+ */
+ if (flags & RTF_UP) {
+ if (flags & RTF_GATEWAY)
+ return INETCIDRROUTETYPE_REMOTE;
+ else /*if (flags & RTF_LOCAL) */
+ return INETCIDRROUTETYPE_LOCAL;
+ } else
+ return 0; /* route not up */
+
+}
+static int
+_load_ipv4(netsnmp_container* container, u_long *index )
+{
+ FILE *in;
+ char line[256];
+ netsnmp_route_entry *entry = NULL;
+ char name[16];
+ int fd;
+
+ DEBUGMSGTL(("access:route:container",
+ "route_container_arch_load ipv4\n"));
+
+ netsnmp_assert(NULL != container);
+
+ /*
+ * fetch routes from the proc file-system:
+ */
+ if (!(in = fopen("/proc/net/route", "r"))) {
+ snmp_log(LOG_ERR, "cannot open /proc/net/route\n");
+ return -2;
+ }
+
+ /*
+ * create socket for ioctls (see NOTE[1], below)
+ */
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if(fd < 0) {
+ snmp_log(LOG_ERR, "could not create socket\n");
+ fclose(in);
+ return -2;
+ }
+
+ fgets(line, sizeof(line), in); /* skip header */
+
+ while (fgets(line, sizeof(line), in)) {
+ char rtent_name[32];
+ int refcnt, flags, rc;
+ uint32_t dest, nexthop, mask, tmp_mask;
+ unsigned use;
+
+ entry = netsnmp_access_route_entry_create();
+
+ /*
+ * as with 1.99.14:
+ * Iface Dest GW Flags RefCnt Use Met Mask MTU Win IRTT
+ * BE eth0 00000000 C0A80101 0003 0 0 0 FFFFFFFF 1500 0 0
+ * LE eth0 00000000 0101A8C0 0003 0 0 0 00FFFFFF 0 0 0
+ */
+ rc = sscanf(line, "%s %x %x %x %u %d %d %x %*d %*d %*d\n",
+ rtent_name, &dest, &nexthop,
+ /*
+ * XXX: fix type of the args
+ */
+ &flags, &refcnt, &use, &entry->rt_metric1,
+ &tmp_mask);
+ DEBUGMSGTL(("9:access:route:container", "line |%s|\n", line));
+ if (8 != rc) {
+ snmp_log(LOG_ERR,
+ "/proc/net/route data format error (%d!=8), line ==|%s|",
+ rc, line);
+
+ netsnmp_access_route_entry_free(entry);
+ continue;
+ }
+
+ /*
+ * temporary null terminated name
+ */
+ strncpy(name, rtent_name, sizeof(name));
+ name[ sizeof(name)-1 ] = 0;
+
+ /*
+ * don't bother to try and get the ifindex for routes with
+ * no interface name.
+ * NOTE[1]: normally we'd use netsnmp_access_interface_index_find,
+ * but since that will open/close a socket, and we might
+ * have a lot of routes, call the ioctl routine directly.
+ */
+ if ('*' != name[0])
+ entry->if_index =
+ netsnmp_access_interface_ioctl_ifindex_get(fd,name);
+
+ /*
+ * arbitrary index
+ */
+ entry->ns_rt_index = ++(*index);
+
+ mask = htonl(tmp_mask);
+
+#ifdef USING_IP_FORWARD_MIB_IPCIDRROUTETABLE_IPCIDRROUTETABLE_MODULE
+ entry->rt_mask = mask;
+ /** entry->rt_tos = XXX; */
+ /** rt info ?? */
+#endif
+ /*
+ * copy dest & next hop
+ */
+ entry->rt_dest_type = INETADDRESSTYPE_IPV4;
+ entry->rt_dest_len = 4;
+ memcpy(entry->rt_dest, &dest, 4);
+
+ entry->rt_nexthop_type = INETADDRESSTYPE_IPV4;
+ entry->rt_nexthop_len = 4;
+ memcpy(entry->rt_nexthop, &nexthop, 4);
+
+ /*
+ * count bits in mask
+ */
+ entry->rt_pfx_len = netsnmp_ipaddress_ipv4_prefix_len(mask);
+
+#ifdef USING_IP_FORWARD_MIB_INETCIDRROUTETABLE_INETCIDRROUTETABLE_MODULE
+ /*
+ inetCidrRoutePolicy OBJECT-TYPE
+ SYNTAX OBJECT IDENTIFIER
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "This object is an opaque object without any defined
+ semantics. Its purpose is to serve as an additional
+ index which may delineate between multiple entries to
+ the same destination. The value { 0 0 } shall be used
+ as the default value for this object."
+ */
+ /*
+ * on linux, default routes all look alike, and would have the same
+ * indexed based on dest and next hop. So we use the if index
+ * as the policy, to distinguise between them. Hopefully this is
+ * unique.
+ * xxx-rks: It should really only be for the duplicate case, but that
+ * would be more complicated thanI want to get into now. Fix later.
+ */
+ if (0 == nexthop) {
+ entry->rt_policy = &entry->if_index;
+ entry->rt_policy_len = 1;
+ entry->flags |= NETSNMP_ACCESS_ROUTE_POLICY_STATIC;
+ }
+#endif
+
+ /*
+ * get protocol and type from flags
+ */
+ entry->rt_type = _type_from_flags(flags);
+
+ entry->rt_proto = (flags & RTF_DYNAMIC)
+ ? IANAIPROUTEPROTOCOL_ICMP : IANAIPROUTEPROTOCOL_LOCAL;
+
+ /*
+ * insert into container
+ */
+ if (CONTAINER_INSERT(container, entry) < 0)
+ {
+ DEBUGMSGTL(("access:route:container", "error with route_entry: insert into container failed.\n"));
+ netsnmp_access_route_entry_free(entry);
+ continue;
+ }
+ }
+
+ fclose(in);
+ close(fd);
+ return 0;
+}
+
+#ifdef NETSNMP_ENABLE_IPV6
+static int
+_load_ipv6(netsnmp_container* container, u_long *index )
+{
+ FILE *in;
+ char line[256];
+ netsnmp_route_entry *entry = NULL;
+ char name[16];
+ static int log_open_err = 1;
+
+ DEBUGMSGTL(("access:route:container",
+ "route_container_arch_load ipv6\n"));
+
+ netsnmp_assert(NULL != container);
+
+ /*
+ * fetch routes from the proc file-system:
+ */
+ if (!(in = fopen("/proc/net/ipv6_route", "r"))) {
+ if (1 == log_open_err) {
+ snmp_log(LOG_ERR, "cannot open /proc/net/ipv6_route\n");
+ log_open_err = 0;
+ }
+ return -2;
+ }
+ /*
+ * if we turned off logging of open errors, turn it back on now that
+ * we have been able to open the file.
+ */
+ if (0 == log_open_err)
+ log_open_err = 1;
+ fgets(line,sizeof(line),in); /* skip header */
+ while (fgets(line, sizeof(line), in)) {
+ char c_name[IFNAMSIZ+1];
+ char c_dest[33], c_src[33], c_next[33];
+ int rc;
+ unsigned int dest_pfx, flags;
+ size_t buf_len, buf_offset;
+ u_char *temp_uchar_ptr;
+
+ entry = netsnmp_access_route_entry_create();
+
+ /*
+ * based on /usr/src/linux/net/ipv6/route.c, kernel 2.6.7:
+ *
+ * [ Dest addr / plen ]
+ * fe80000000000000025056fffec00008 80 \
+ *
+ * [ (?subtree) : src addr/plen : 0/0]
+ * 00000000000000000000000000000000 00 \
+ *
+ * [ next hop ][ metric ][ref ctn][ use ]
+ * 00000000000000000000000000000000 00000000 00000000 00000000 \
+ *
+ * [ flags ][dev name]
+ * 80200001 lo
+ */
+ rc = sscanf(line, "%32s %2x %32s %*x %32s %x %*x %*x %x %"
+ SNMP_MACRO_VAL_TO_STR(IFNAMSIZ) "s\n",
+ c_dest, &dest_pfx, c_src, /*src_pfx,*/ c_next,
+ &entry->rt_metric1, /** ref,*/ /* use, */ &flags, c_name);
+ DEBUGMSGTL(("9:access:route:container", "line |%s|\n", line));
+ if (7 != rc) {
+ snmp_log(LOG_ERR,
+ "/proc/net/ipv6_route data format error (%d!=8), "
+ "line ==|%s|", rc, line);
+ continue;
+ }
+
+ /*
+ * temporary null terminated name
+ */
+ c_name[ sizeof(c_name)-1 ] = 0;
+ entry->if_index = se_find_value_in_slist("interfaces", c_name);
+ if(SE_DNE == entry->if_index) {
+ snmp_log(LOG_ERR,"unknown interface in /proc/net/ipv6_route "
+ "('%s')\n", name);
+ netsnmp_access_route_entry_free(entry);
+ continue;
+ }
+ /*
+ * arbitrary index
+ */
+ entry->ns_rt_index = ++(*index);
+
+#ifdef USING_IP_FORWARD_MIB_IPCIDRROUTETABLE_IPCIDRROUTETABLE_MODULE
+ /** entry->rt_mask = mask; */ /* IPv4 only */
+ /** entry->rt_tos = XXX; */
+ /** rt info ?? */
+#endif
+ /*
+ * convert hex addresses to binary
+ */
+ entry->rt_dest_type = INETADDRESSTYPE_IPV6;
+ entry->rt_dest_len = 16;
+ buf_len = sizeof(entry->rt_dest);
+ buf_offset = 0;
+ temp_uchar_ptr = entry->rt_dest;
+ netsnmp_hex_to_binary(&temp_uchar_ptr, &buf_len, &buf_offset, 0,
+ c_dest, NULL);
+
+ entry->rt_nexthop_type = INETADDRESSTYPE_IPV6;
+ entry->rt_nexthop_len = 16;
+ buf_len = sizeof(entry->rt_nexthop);
+ buf_offset = 0;
+ temp_uchar_ptr = entry->rt_nexthop;
+ netsnmp_hex_to_binary(&temp_uchar_ptr, &buf_len, &buf_offset, 0,
+ c_next, NULL);
+
+ entry->rt_pfx_len = dest_pfx;
+
+#ifdef USING_IP_FORWARD_MIB_INETCIDRROUTETABLE_INETCIDRROUTETABLE_MODULE
+ /*
+ inetCidrRoutePolicy OBJECT-TYPE
+ SYNTAX OBJECT IDENTIFIER
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "This object is an opaque object without any defined
+ semantics. Its purpose is to serve as an additional
+ index which may delineate between multiple entries to
+ the same destination. The value { 0 0 } shall be used
+ as the default value for this object."
+ */
+ /*
+ * on linux, default routes all look alike, and would have the same
+ * indexed based on dest and next hop. So we use our arbitrary index
+ * as the policy, to distinguise between them.
+ */
+ entry->rt_policy = &entry->ns_rt_index;
+ entry->rt_policy_len = 1;
+ entry->flags |= NETSNMP_ACCESS_ROUTE_POLICY_STATIC;
+#endif
+
+ /*
+ * get protocol and type from flags
+ */
+ entry->rt_type = _type_from_flags(flags);
+
+ entry->rt_proto = (flags & RTF_DYNAMIC)
+ ? IANAIPROUTEPROTOCOL_ICMP : IANAIPROUTEPROTOCOL_LOCAL;
+
+ /*
+ * insert into container
+ */
+ CONTAINER_INSERT(container, entry);
+ }
+
+ fclose(in);
+ return 0;
+}
+#endif
+
+/** arch specific load
+ * @internal
+ *
+ * @retval 0 success
+ * @retval -1 no container specified
+ * @retval -2 could not open data file
+ */
+int
+netsnmp_access_route_container_arch_load(netsnmp_container* container,
+ u_int load_flags)
+{
+ u_long count = 0;
+ int rc;
+
+ DEBUGMSGTL(("access:route:container",
+ "route_container_arch_load (flags %x)\n", load_flags));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "no container specified/found for access_route\n");
+ return -1;
+ }
+
+ rc = _load_ipv4(container, &count);
+
+#ifdef NETSNMP_ENABLE_IPV6
+ if((0 != rc) || (load_flags & NETSNMP_ACCESS_ROUTE_LOAD_IPV4_ONLY))
+ return rc;
+
+ /*
+ * load ipv6. ipv6 module might not be loaded,
+ * so ignore -2 err (file not found)
+ */
+ rc = _load_ipv6(container, &count);
+ if (-2 == rc)
+ rc = 0;
+#endif
+
+ return rc;
+}
+
+/*
+ * create a new entry
+ */
+int
+netsnmp_arch_route_create(netsnmp_route_entry *entry)
+{
+ if (NULL == entry)
+ return -1;
+
+ if (4 != entry->rt_dest_len) {
+ DEBUGMSGT(("access:route:create", "only ipv4 supported\n"));
+ return -2;
+ }
+
+ return _netsnmp_ioctl_route_set_v4(entry);
+}
+
+/*
+ * create a new entry
+ */
+int
+netsnmp_arch_route_delete(netsnmp_route_entry *entry)
+{
+ if (NULL == entry)
+ return -1;
+
+ if (4 != entry->rt_dest_len) {
+ DEBUGMSGT(("access:route:create", "only ipv4 supported\n"));
+ return -2;
+ }
+
+ return _netsnmp_ioctl_route_delete_v4(entry);
+}
+
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_linux.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_linux.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/data_access/route_linux.h
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable.h
new file mode 100644
index 0000000000..542d5168c2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable.h
@@ -0,0 +1,5 @@
+/*
+ * module to include the modules
+ */
+
+config_require(ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable.c
new file mode 100644
index 0000000000..408fb90942
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable.c
@@ -0,0 +1,2676 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: inetCidrRouteTable.c 15639 2006-12-06 15:01:27Z rstory $
+ */
+/** \page MFD helper for inetCidrRouteTable
+ *
+ * \section intro Introduction
+ * Introductory text.
+ *
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "inetCidrRouteTable.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "inetCidrRouteTable_interface.h"
+
+oid inetCidrRouteTable_oid[] = { INETCIDRROUTETABLE_OID };
+int inetCidrRouteTable_oid_size =
+OID_LENGTH(inetCidrRouteTable_oid);
+
+inetCidrRouteTable_registration inetCidrRouteTable_user_context;
+
+void initialize_table_inetCidrRouteTable(void);
+void shutdown_table_inetCidrRouteTable(void);
+
+int
+_route_number_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests);
+
+
+/**
+ * Initializes the inetCidrRouteTable module
+ */
+void
+init_inetCidrRouteTable(void)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:init_inetCidrRouteTable",
+ "called\n"));
+
+ /*
+ * TODO:300:o: Perform inetCidrRouteTable one-time module initialization.
+ */
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ if (should_init("inetCidrRouteTable"))
+ initialize_table_inetCidrRouteTable();
+
+} /* init_inetCidrRouteTable */
+
+/**
+ * Shut-down the inetCidrRouteTable module (agent is exiting)
+ */
+void
+shutdown_inetCidrRouteTable(void)
+{
+ if (should_init("inetCidrRouteTable"))
+ shutdown_table_inetCidrRouteTable();
+
+}
+
+/**
+ * Initialize the table inetCidrRouteTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_inetCidrRouteTable(void)
+{
+ inetCidrRouteTable_registration *user_context;
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:initialize_table_inetCidrRouteTable", "called\n"));
+
+ /*
+ * TODO:301:o: Perform inetCidrRouteTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize inetCidrRouteTable user context
+ * if you'd like to pass in a pointer to some data for this
+ * table, allocate or set it up here.
+ */
+ /*
+ * a netsnmp_data_list is a simple way to store void pointers. A simple
+ * string token is used to add, find or remove pointers.
+ */
+ user_context =
+ netsnmp_create_data_list("inetCidrRouteTable", NULL, NULL);
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _inetCidrRouteTable_initialize_interface(user_context, flags);
+
+ /*
+ * regester scalar for route number
+ */
+ {
+ oid reg_oid[] =
+ { INETCIDRROUTENUMBER_OID };
+ netsnmp_handler_registration *myreg;
+ netsnmp_mib_handler *handler;
+
+ myreg =
+ netsnmp_create_handler_registration("route number",
+ _route_number_handler,
+ reg_oid,
+ OID_LENGTH(reg_oid),
+ HANDLER_CAN_RONLY);
+ /*
+ * snarf cache to use w/cache handler to make sure the
+ * container is loaded w/up to date data.
+ */
+ netsnmp_assert(NULL != inetCidrRouteTable_get_cache());
+ handler =
+ netsnmp_cache_handler_get(inetCidrRouteTable_get_cache());
+ netsnmp_inject_handler(myreg, handler);
+
+ netsnmp_register_instance(myreg);
+ }
+} /* initialize_table_inetCidrRouteTable */
+
+/**
+ * Shutdown the table inetCidrRouteTable
+ */
+void
+shutdown_table_inetCidrRouteTable(void)
+{
+ /*
+ * call interface shutdown code
+ */
+ _inetCidrRouteTable_shutdown_interface
+ (&inetCidrRouteTable_user_context);
+}
+
+/**
+ * extra context initialization (eg default values)
+ *
+ * @param rowreq_ctx : row request context
+ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
+ *
+ * @retval MFD_SUCCESS : no errors
+ * @retval MFD_ERROR : error (context allocate will fail)
+ */
+int
+inetCidrRouteTable_rowreq_ctx_init(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, void *user_init_ctx)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_rowreq_ctx_init", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:210:o: |-> Perform extra inetCidrRouteTable rowreq initialization. (eg DEFVALS)
+ */
+ rowreq_ctx->data->rt_nexthop_type = 0;
+
+ rowreq_ctx->data->rt_metric1 = -1;
+
+ rowreq_ctx->data->rt_metric2 = -1;
+
+ rowreq_ctx->data->rt_metric3 = -1;
+
+ rowreq_ctx->data->rt_metric4 = -1;
+
+ rowreq_ctx->data->rt_metric5 = -1;
+
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteTable_rowreq_ctx_init */
+
+/**
+ * extra context cleanup
+ *
+ */
+void
+inetCidrRouteTable_rowreq_ctx_cleanup(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_rowreq_ctx_cleanup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:211:o: |-> Perform extra inetCidrRouteTable rowreq cleanup.
+ */
+ if (NULL != rowreq_ctx->data) {
+ inetCidrRouteTable_release_data(rowreq_ctx->data);
+ rowreq_ctx->data = NULL;
+ }
+} /* inetCidrRouteTable_rowreq_ctx_cleanup */
+
+/**
+ * pre-request callback
+ *
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+inetCidrRouteTable_pre_request(inetCidrRouteTable_registration *
+ user_context)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_pre_request", "called\n"));
+
+ /*
+ * TODO:510:o: Perform inetCidrRouteTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ * Note:
+ * New rows have been inserted into the container, and
+ * deleted rows have been removed from the container and
+ * released.
+ *
+ * @param user_context
+ * @param rc : MFD_SUCCESS if all requests succeeded
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+inetCidrRouteTable_post_request(inetCidrRouteTable_registration *
+ user_context, int rc)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_post_request", "called\n"));
+
+ /*
+ * TODO:511:o: Perform inetCidrRouteTable post-request actions.
+ */
+
+ /*
+ * check to set if any rows were changed.
+ */
+ if (inetCidrRouteTable_dirty_get()) {
+ /*
+ * check if request was successful. If so, this would be
+ * a good place to save data to its persistent store.
+ */
+ if (MFD_SUCCESS == rc) {
+ /*
+ * save changed rows, if you haven't already
+ */
+ }
+
+ inetCidrRouteTable_dirty_set(0); /* clear table dirty flag */
+ }
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteTable_post_request */
+
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table inetCidrRouteTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-FORWARD-MIB::inetCidrRouteTable is subid 7 of ipForward.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.24.7, length: 9
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement inetCidrRouteTable data context functions.
+ */
+/*
+ * inetCidrRouteTable_allocate_data
+ *
+ * Purpose: create new inetCidrRouteTable_data->
+ */
+inetCidrRouteTable_data *
+inetCidrRouteTable_allocate_data(void)
+{
+ /*
+ * TODO:201:r: |-> allocate memory for the inetCidrRouteTable data context.
+ */
+ inetCidrRouteTable_data *rtn = netsnmp_access_route_entry_create();
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_allocate_data", "called\n"));
+
+ if (NULL == rtn) {
+ snmp_log(LOG_ERR, "unable to malloc memory for new "
+ "inetCidrRouteTable_data->\n");
+ }
+
+ return rtn;
+} /* inetCidrRouteTable_allocate_data */
+
+/*
+ * inetCidrRouteTable_release_data
+ *
+ * Purpose: release inetCidrRouteTable data->
+ */
+void
+inetCidrRouteTable_release_data(inetCidrRouteTable_data * data)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_release_data", "called\n"));
+
+ /*
+ * TODO:202:r: |-> release memory for the inetCidrRouteTable data context.
+ */
+ netsnmp_access_route_entry_free(data);
+} /* inetCidrRouteTable_release_data */
+
+
+
+/**
+ * set mib index(es)
+ *
+ * @param tbl_idx mib index structure
+ * @param inetCidrRouteDestType_val
+ * @param inetCidrRouteDest_val_ptr
+ * @param inetCidrRouteDest_val_ptr_len
+ * @param inetCidrRoutePfxLen_val
+ * @param inetCidrRoutePolicy_val_ptr
+ * @param inetCidrRoutePolicy_val_ptr_len
+ * @param inetCidrRouteNextHopType_val
+ * @param inetCidrRouteNextHop_val_ptr
+ * @param inetCidrRouteNextHop_val_ptr_len
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This convenience function is useful for setting all the MIB index
+ * components with a single function call. It is assume that the C values
+ * have already been mapped from their native/rawformat to the MIB format.
+ */
+int
+inetCidrRouteTable_indexes_set_tbl_idx(inetCidrRouteTable_mib_index *
+ tbl_idx,
+ u_long inetCidrRouteDestType_val,
+ char *inetCidrRouteDest_val_ptr,
+ size_t
+ inetCidrRouteDest_val_ptr_len,
+ u_long inetCidrRoutePfxLen_val,
+ oid * inetCidrRoutePolicy_val_ptr,
+ size_t
+ inetCidrRoutePolicy_val_ptr_len,
+ u_long inetCidrRouteNextHopType_val,
+ char *inetCidrRouteNextHop_val_ptr,
+ size_t
+ inetCidrRouteNextHop_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_indexes_set_tbl_idx", "called\n"));
+
+ /*
+ * inetCidrRouteDestType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ /** WARNING: this code might not work for netsnmp_route_entry */
+ tbl_idx->inetCidrRouteDestType = inetCidrRouteDestType_val;
+
+ /*
+ * inetCidrRouteDest(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ tbl_idx->inetCidrRouteDest_len = sizeof(tbl_idx->inetCidrRouteDest) / sizeof(tbl_idx->inetCidrRouteDest[0]); /* max length */
+ /** WARNING: this code might not work for netsnmp_route_entry */
+ /*
+ * make sure there is enough space for inetCidrRouteDest data
+ */
+ if ((NULL == tbl_idx->inetCidrRouteDest) ||
+ (tbl_idx->inetCidrRouteDest_len <
+ (inetCidrRouteDest_val_ptr_len))) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->inetCidrRouteDest_len = inetCidrRouteDest_val_ptr_len;
+ memcpy(tbl_idx->inetCidrRouteDest, inetCidrRouteDest_val_ptr,
+ inetCidrRouteDest_val_ptr_len *
+ sizeof(inetCidrRouteDest_val_ptr[0]));
+
+ /*
+ * inetCidrRoutePfxLen(3)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ /** WARNING: this code might not work for netsnmp_route_entry */
+ tbl_idx->inetCidrRoutePfxLen = inetCidrRoutePfxLen_val;
+
+ /*
+ * inetCidrRoutePolicy(4)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
+ */
+ tbl_idx->inetCidrRoutePolicy_len = sizeof(tbl_idx->inetCidrRoutePolicy) / sizeof(tbl_idx->inetCidrRoutePolicy[0]); /* max length */
+ /** WARNING: this code might not work for netsnmp_route_entry */
+ /*
+ * make sure there is enough space for inetCidrRoutePolicy data
+ */
+ if ((NULL == tbl_idx->inetCidrRoutePolicy) ||
+ (tbl_idx->inetCidrRoutePolicy_len <
+ (inetCidrRoutePolicy_val_ptr_len))) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ if (0 == inetCidrRoutePolicy_val_ptr_len) {
+ inetCidrRoutePolicy_val_ptr_len = nullOidLen / sizeof(oid);
+ inetCidrRoutePolicy_val_ptr = nullOid;
+ }
+ tbl_idx->inetCidrRoutePolicy_len = inetCidrRoutePolicy_val_ptr_len;
+ memcpy(tbl_idx->inetCidrRoutePolicy, inetCidrRoutePolicy_val_ptr,
+ inetCidrRoutePolicy_val_ptr_len *
+ sizeof(inetCidrRoutePolicy_val_ptr[0]));
+
+ /*
+ * inetCidrRouteNextHopType(5)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ /** WARNING: this code might not work for netsnmp_route_entry */
+ tbl_idx->inetCidrRouteNextHopType = inetCidrRouteNextHopType_val;
+
+ /*
+ * inetCidrRouteNextHop(6)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ tbl_idx->inetCidrRouteNextHop_len = sizeof(tbl_idx->inetCidrRouteNextHop) / sizeof(tbl_idx->inetCidrRouteNextHop[0]); /* max length */
+ /** WARNING: this code might not work for netsnmp_route_entry */
+ /*
+ * make sure there is enough space for inetCidrRouteNextHop data
+ */
+ if ((NULL == tbl_idx->inetCidrRouteNextHop) ||
+ (tbl_idx->inetCidrRouteNextHop_len <
+ (inetCidrRouteNextHop_val_ptr_len))) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->inetCidrRouteNextHop_len = inetCidrRouteNextHop_val_ptr_len;
+ memcpy(tbl_idx->inetCidrRouteNextHop, inetCidrRouteNextHop_val_ptr,
+ inetCidrRouteNextHop_val_ptr_len *
+ sizeof(inetCidrRouteNextHop_val_ptr[0]));
+
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteTable_indexes_set_tbl_idx */
+
+/**
+ * @internal
+ * set row context indexes
+ *
+ * @param rowreq_ctx the row context that needs updated indexes
+ * @param inetCidrRouteDestType_val
+ * @param inetCidrRouteDest_val_ptr
+ * @param inetCidrRouteDest_val_ptr_len
+ * @param inetCidrRoutePfxLen_val
+ * @param inetCidrRoutePolicy_val_ptr
+ * @param inetCidrRoutePolicy_val_ptr_len
+ * @param inetCidrRouteNextHopType_val
+ * @param inetCidrRouteNextHop_val_ptr
+ * @param inetCidrRouteNextHop_val_ptr_len
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This function sets the mib indexs, then updates the oid indexs
+ * from the mib index.
+ */
+int
+inetCidrRouteTable_indexes_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long inetCidrRouteDestType_val,
+ char *inetCidrRouteDest_val_ptr,
+ size_t inetCidrRouteDest_val_ptr_len,
+ u_long inetCidrRoutePfxLen_val,
+ oid * inetCidrRoutePolicy_val_ptr,
+ size_t inetCidrRoutePolicy_val_ptr_len,
+ u_long inetCidrRouteNextHopType_val,
+ char *inetCidrRouteNextHop_val_ptr,
+ size_t inetCidrRouteNextHop_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_indexes_set", "called\n"));
+
+ if (MFD_SUCCESS !=
+ inetCidrRouteTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
+ inetCidrRouteDestType_val,
+ inetCidrRouteDest_val_ptr,
+ inetCidrRouteDest_val_ptr_len,
+ inetCidrRoutePfxLen_val,
+ inetCidrRoutePolicy_val_ptr,
+ inetCidrRoutePolicy_val_ptr_len,
+ inetCidrRouteNextHopType_val,
+ inetCidrRouteNextHop_val_ptr,
+ inetCidrRouteNextHop_val_ptr_len))
+ return MFD_ERROR;
+
+ /*
+ * convert mib index to oid index
+ */
+ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
+ if (0 != inetCidrRouteTable_index_to_oid(&rowreq_ctx->oid_idx,
+ &rowreq_ctx->tbl_idx)) {
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteTable_indexes_set */
+
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteIfIndex
+ * inetCidrRouteIfIndex is subid 7 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.7
+ * Description:
+The ifIndex value which identifies the local interface
+ through which the next hop of this route should be
+ reached. A value of 0 is valid and represents the
+ scenario where no interface is specified.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 1
+ * settable 1
+ * hint: d
+ *
+ * Ranges: 0 - 2147483647;
+ *
+ * Its syntax is InterfaceIndexOrZero (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the inetCidrRouteIfIndex data->
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteIfIndex_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+inetCidrRouteIfIndex_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long *inetCidrRouteIfIndex_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != inetCidrRouteIfIndex_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteIfIndex_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the inetCidrRouteIfIndex data->
+ * copy (* inetCidrRouteIfIndex_val_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteIfIndex data
+ */
+ (*inetCidrRouteIfIndex_val_ptr) = rowreq_ctx->data->if_index;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteIfIndex_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteType
+ * inetCidrRouteType is subid 8 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.8
+ * Description:
+The type of route. Note that local(3) refers to a
+ route for which the next hop is the final destination;
+ remote(4)refers to a route for which the next hop is
+ not the final destination.
+
+ Routes which do not result in traffic forwarding or
+ rejection should not be displayed even if the
+ implementation keeps them stored internally.
+
+ reject(2) refers to a route which, if matched, discards
+ the message as unreachable and returns a notification
+ (e.g. ICMP error) to the message sender. This is used
+ in some protocols as a means of correctly aggregating
+ routes.
+
+ blackhole(5) refers to a route which, if matched,
+ discards the message silently.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 3/8. Values: other(1), reject(2), local(3), remote(4), blackhole(5)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the inetCidrRouteType data->
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteType_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+inetCidrRouteType_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long * inetCidrRouteType_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != inetCidrRouteType_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteType_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the inetCidrRouteType data->
+ * copy (* inetCidrRouteType_val_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteType data
+ */
+ (*inetCidrRouteType_val_ptr) = rowreq_ctx->data->rt_type;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteType_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteProto
+ * inetCidrRouteProto is subid 9 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.24.7.1.9
+ * Description:
+The routing mechanism via which this route was learned.
+ Inclusion of values for gateway routing protocols is
+ not intended to imply that hosts should support those
+ protocols.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ * Enum range: 13/32. Values: other(1), local(2), netmgmt(3), icmp(4), egp(5), ggp(6), hello(7), rip(8), isIs(9), esIs(10), ciscoIgrp(11), bbnSpfIgp(12), ospf(13), bgp(14), idpr(15), ciscoEigrp(16), dvmrp(17)
+ *
+ * Its syntax is IANAipRouteProtocol (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the inetCidrRouteProto data->
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteProto_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+inetCidrRouteProto_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long * inetCidrRouteProto_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != inetCidrRouteProto_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteProto_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the inetCidrRouteProto data->
+ * copy (* inetCidrRouteProto_val_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteProto data
+ */
+ (*inetCidrRouteProto_val_ptr) = rowreq_ctx->data->rt_proto;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteProto_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteAge
+ * inetCidrRouteAge is subid 10 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.24.7.1.10
+ * Description:
+The number of seconds since this route was last updated
+ or otherwise determined to be correct. Note that no
+ semantics of 'too old' can be implied except through
+ knowledge of the routing protocol by which the route
+ was learned.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is GAUGE (based on perltype GAUGE)
+ * The net-snmp type is ASN_GAUGE. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the inetCidrRouteAge data->
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteAge_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+inetCidrRouteAge_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long * inetCidrRouteAge_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != inetCidrRouteAge_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteAge_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the inetCidrRouteAge data->
+ * copy (* inetCidrRouteAge_val_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteAge data
+ */
+ (*inetCidrRouteAge_val_ptr) = rowreq_ctx->data->rt_age;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteAge_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteNextHopAS
+ * inetCidrRouteNextHopAS is subid 11 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.11
+ * Description:
+The Autonomous System Number of the Next Hop. The
+ semantics of this object are determined by the routing-
+ protocol specified in the route's inetCidrRouteProto
+ value. When this object is unknown or not relevant its
+ value should be set to zero.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 1
+ * settable 1
+ * defval: 0
+ * hint: d
+ *
+ *
+ * Its syntax is InetAutonomousSystemNumber (based on perltype UNSIGNED32)
+ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the inetCidrRouteNextHopAS data->
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteNextHopAS_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+inetCidrRouteNextHopAS_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long * inetCidrRouteNextHopAS_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != inetCidrRouteNextHopAS_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteNextHopAS_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the inetCidrRouteNextHopAS data->
+ * copy (* inetCidrRouteNextHopAS_val_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteNextHopAS data
+ */
+ (*inetCidrRouteNextHopAS_val_ptr) = rowreq_ctx->data->rt_nexthop_as;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteNextHopAS_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric1
+ * inetCidrRouteMetric1 is subid 12 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.12
+ * Description:
+The primary routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's inetCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the inetCidrRouteMetric1 data->
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteMetric1_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+inetCidrRouteMetric1_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long *inetCidrRouteMetric1_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != inetCidrRouteMetric1_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric1_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the inetCidrRouteMetric1 data->
+ * copy (* inetCidrRouteMetric1_val_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteMetric1 data
+ */
+ (*inetCidrRouteMetric1_val_ptr) = rowreq_ctx->data->rt_metric1;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteMetric1_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric2
+ * inetCidrRouteMetric2 is subid 13 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.13
+ * Description:
+An alternate routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's inetCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the inetCidrRouteMetric2 data->
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteMetric2_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+inetCidrRouteMetric2_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long *inetCidrRouteMetric2_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != inetCidrRouteMetric2_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric2_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the inetCidrRouteMetric2 data->
+ * copy (* inetCidrRouteMetric2_val_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteMetric2 data
+ */
+ (*inetCidrRouteMetric2_val_ptr) = rowreq_ctx->data->rt_metric2;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteMetric2_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric3
+ * inetCidrRouteMetric3 is subid 14 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.14
+ * Description:
+An alternate routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's inetCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the inetCidrRouteMetric3 data->
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteMetric3_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+inetCidrRouteMetric3_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long *inetCidrRouteMetric3_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != inetCidrRouteMetric3_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric3_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the inetCidrRouteMetric3 data->
+ * copy (* inetCidrRouteMetric3_val_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteMetric3 data
+ */
+ (*inetCidrRouteMetric3_val_ptr) = rowreq_ctx->data->rt_metric3;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteMetric3_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric4
+ * inetCidrRouteMetric4 is subid 15 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.15
+ * Description:
+An alternate routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's inetCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the inetCidrRouteMetric4 data->
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteMetric4_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+inetCidrRouteMetric4_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long *inetCidrRouteMetric4_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != inetCidrRouteMetric4_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric4_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the inetCidrRouteMetric4 data->
+ * copy (* inetCidrRouteMetric4_val_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteMetric4 data
+ */
+ (*inetCidrRouteMetric4_val_ptr) = rowreq_ctx->data->rt_metric4;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteMetric4_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric5
+ * inetCidrRouteMetric5 is subid 16 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.16
+ * Description:
+An alternate routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's inetCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the inetCidrRouteMetric5 data->
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteMetric5_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+inetCidrRouteMetric5_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long *inetCidrRouteMetric5_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != inetCidrRouteMetric5_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric5_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the inetCidrRouteMetric5 data->
+ * copy (* inetCidrRouteMetric5_val_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * TODO:235:M: |-> Remove log message/SKIP once you've set inetCidrRouteMetric5 data
+ */
+ (*inetCidrRouteMetric5_val_ptr) = rowreq_ctx->data->rt_metric5;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteMetric5_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteStatus
+ * inetCidrRouteStatus is subid 17 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.17
+ * Description:
+The row status variable, used according to row
+ installation and removal conventions.
+
+ A row entry cannot be modified when the status is
+ marked as active(1).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
+ *
+ * Its syntax is RowStatus (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the inetCidrRouteStatus data->
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteStatus_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+inetCidrRouteStatus_get(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long * inetCidrRouteStatus_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != inetCidrRouteStatus_val_ptr);
+
+ /** WARNING: this code might not work for netsnmp_route_entry */
+ (*inetCidrRouteStatus_val_ptr) = rowreq_ctx->row_status;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteStatus_get */
+
+
+
+/** @} */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table inetCidrRouteTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-FORWARD-MIB::inetCidrRouteTable is subid 7 of ipForward.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.24.7, length: 9
+ */
+ /*
+ * NOTE: if you update this chart, please update the versions in
+ * local/mib2c-conf.d/parent-set.m2i
+ * agent/mibgroup/helpers/baby_steps.c
+ * while you're at it.
+ */
+ /*
+ ***********************************************************************
+ * Baby Steps Flow Chart (2004.06.05) *
+ * *
+ * +--------------+ +================+ U = unconditional path *
+ * |optional state| ||required state|| S = path for success *
+ * +--------------+ +================+ E = path for error *
+ ***********************************************************************
+ *
+ * +--------------+
+ * | pre |
+ * | request |
+ * +--------------+
+ * | U
+ * +-------------+ +==============+
+ * | row |f|<-------|| object ||
+ * | create |1| E || lookup ||
+ * +-------------+ +==============+
+ * E | | S | S
+ * | +------------------>|
+ * | +==============+
+ * | E || check ||
+ * |<---------------|| values ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | +<-------|| undo ||
+ * | | E || setup ||
+ * | | +==============+
+ * | | | S
+ * | | +==============+
+ * | | || set ||-------------------------->+
+ * | | || value || E |
+ * | | +==============+ |
+ * | | | S |
+ * | | +--------------+ |
+ * | | | check |-------------------------->|
+ * | | | consistency | E |
+ * | | +--------------+ |
+ * | | | S |
+ * | | +==============+ +==============+ |
+ * | | || commit ||-------->|| undo || |
+ * | | || || E || commit || |
+ * | | +==============+ +==============+ |
+ * | | | S U |<--------+
+ * | | +--------------+ +==============+
+ * | | | irreversible | || undo ||
+ * | | | commit | || set ||
+ * | | +--------------+ +==============+
+ * | | | U U |
+ * | +-------------->|<------------------------+
+ * | +==============+
+ * | || undo ||
+ * | || cleanup ||
+ * | +==============+
+ * +---------------------->| U
+ * |
+ * (err && f1)------------------->+
+ * | |
+ * +--------------+ +--------------+
+ * | post |<--------| row |
+ * | request | U | release |
+ * +--------------+ +--------------+
+ *
+ */
+
+/**
+ * Setup up context with information needed to undo a set request.
+ *
+ * This function will be called before the individual node undo setup
+ * functions are called. If you need to do any undo setup that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that the undo context has been allocated with
+ * inetCidrRouteTable_allocate_data(), but may need extra
+ * initialization similar to what you may have done in
+ * inetCidrRouteTable_rowreq_ctx_init().
+ * Note that an individual node's undo_setup function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in the node's undo_setup
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (inetCidrRouteTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+inetCidrRouteTable_undo_setup(inetCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_undo_setup",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> Setup inetCidrRouteTable undo.
+ * set up inetCidrRouteTable undo information, in preparation for a set.
+ * Undo storage is in (* inetCidrRouteStatus_val_ptr )*
+ */
+ rowreq_ctx->row_status_undo = rowreq_ctx->row_status;
+
+ rc = netsnmp_access_route_entry_copy(rowreq_ctx->undo,
+ rowreq_ctx->data);
+
+ return rc;
+} /* inetCidrRouteTable_undo_setup */
+
+/**
+ * Undo a set request.
+ *
+ * This function will be called before the individual node undo
+ * functions are called. If you need to do any undo that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that an individual node's undo function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is anything specific to a particular column (e.g. releasing
+ * memory for a string), you should do that setup in the node's undo
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (inetCidrRouteTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+inetCidrRouteTable_undo(inetCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_undo",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> inetCidrRouteTable undo.
+ * inetCidrRouteTable undo information, in response to a failed set.
+ * Undo storage is in (* inetCidrRouteStatus_val_ptr )*
+ */
+ rowreq_ctx->row_status = rowreq_ctx->row_status_undo;
+
+ rc = netsnmp_access_route_entry_copy(rowreq_ctx->data,
+ rowreq_ctx->undo);
+
+ return rc;
+} /* inetCidrRouteTable_undo_setup */
+
+/**
+ * Cleanup up context undo information.
+ *
+ * This function will be called after set/commit processing. If you
+ * allocated any resources in undo_setup, this is the place to release
+ * those resources.
+ *
+ * This function is called regardless of the success or failure of the set
+ * request. If you need to perform different steps for cleanup depending
+ * on success or failure, you can add a flag to the rowreq_ctx.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (inetCidrRouteTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+inetCidrRouteTable_undo_cleanup(inetCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_undo_cleanup", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:452:M: |-> Cleanup inetCidrRouteTable undo.
+ * Undo storage is in (* inetCidrRouteStatus_val_ptr )*
+ */
+
+ return rc;
+} /* inetCidrRouteTable_undo_cleanup */
+
+/**
+ * commit new values.
+ *
+ * At this point, you should have done everything you can to ensure that
+ * this commit will not fail.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * inetCidrRouteTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+inetCidrRouteTable_commit(inetCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+ int save_flags;
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_commit",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * save flags, then clear until we actually do something
+ */
+ save_flags = rowreq_ctx->column_set_flags;
+ rowreq_ctx->column_set_flags = 0;
+
+ /*
+ * commit inetCidrRouteTable data
+ * 1) check the column's flag in save_flags to see if it was set.
+ * 2) clear the flag when you handle that column
+ * 3) set the column's flag in column_set_flags if it needs undo
+ * processing in case of a failure.
+ */
+ /*
+ * did anything change?
+ */
+ if (0 == save_flags) {
+ DEBUGMSGTL(("ipAddressTable:ipAddressTable_commit",
+ "no change\n"));
+ return MFD_SUCCESS;
+ }
+
+ /*
+ * pass everything to data access
+ */
+ if (save_flags & COLUMN_INETCIDRROUTESTATUS_FLAG) {
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ if (ROWSTATUS_DESTROY == rowreq_ctx->row_status) {
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED;
+ return MFD_SUCCESS;
+ }
+ netsnmp_assert(ROWSTATUS_ACTIVE == rowreq_ctx->row_status);
+ rowreq_ctx->data->flags |= NETSNMP_ACCESS_ROUTE_CREATE;
+ } else if (ROWSTATUS_DESTROY == rowreq_ctx->row_status) {
+ rowreq_ctx->data->flags |= NETSNMP_ACCESS_ROUTE_DELETE;
+ } else
+ rowreq_ctx->data->flags |= NETSNMP_ACCESS_ROUTE_CHANGE;
+ } else
+ rowreq_ctx->data->flags |= NETSNMP_ACCESS_ROUTE_CHANGE;
+
+ /*
+ * do it
+ * let data access know what columns are set
+ */
+ rowreq_ctx->data->flags |=
+ (save_flags & NETSNMP_ACCESS_ROUTE_RESERVED_BITS);
+ rc = netsnmp_access_route_entry_set(rowreq_ctx->data);
+ if (rc) {
+ snmp_log(LOG_ERR,
+ "inetCidrRouteTable column inetCidrRouteStatus commit failed\n");
+ rc = MFD_ERROR;
+ } else {
+ /*
+ * set flag, in case we need to undo
+ */
+ rowreq_ctx->column_set_flags |= save_flags;
+ }
+
+ /*
+ * if we successfully commited this row, set the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY;
+ }
+
+ return rc;
+} /* inetCidrRouteTable_commit */
+
+/**
+ * undo commit new values.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * inetCidrRouteTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+inetCidrRouteTable_undo_commit(inetCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_undo_commit", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:485:M: |-> Undo inetCidrRouteTable commit.
+ * check the column's flag in rowreq_ctx->column_set_flags to see
+ * if it was set during commit, then undo it.
+ *
+ * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
+ */
+ if (rowreq_ctx->column_set_flags & COLUMN_INETCIDRROUTESTATUS_FLAG) {
+ /*
+ * if we created an addr, delete it. if we deleted it,
+ * re-create it. If we changed it, change it back.
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ rowreq_ctx->undo->flags |= NETSNMP_ACCESS_ROUTE_DELETE;
+ } else if (ROWSTATUS_DESTROY == rowreq_ctx->row_status) {
+ rowreq_ctx->undo->flags |= NETSNMP_ACCESS_ROUTE_CREATE;
+ } else
+ rowreq_ctx->undo->flags |= NETSNMP_ACCESS_ROUTE_CHANGE;
+ } else
+ rowreq_ctx->undo->flags |= NETSNMP_ACCESS_ROUTE_CHANGE;
+
+ /*
+ * do it
+ */
+ rc = netsnmp_access_route_entry_set(rowreq_ctx->undo);
+ if (rc) {
+ DEBUGMSGTL(("ipAddressTable",
+ "bad rc %d from IP address data access\n", rc));
+ rc = MFD_ERROR;
+ }
+
+ /*
+ * if we successfully un-commited this row, clear the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return rc;
+} /* inetCidrRouteTable_undo_commit */
+
+/*
+ * TODO:440:M: Implement inetCidrRouteTable node value checks.
+ * TODO:450:M: Implement inetCidrRouteTable undo functions.
+ * TODO:460:M: Implement inetCidrRouteTable set functions.
+ * TODO:480:M: Implement inetCidrRouteTable commit functions.
+ */
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteIfIndex
+ * inetCidrRouteIfIndex is subid 7 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.7
+ * Description:
+The ifIndex value which identifies the local interface
+ through which the next hop of this route should be
+ reached. A value of 0 is valid and represents the
+ scenario where no interface is specified.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 1
+ * settable 1
+ * hint: d
+ *
+ * Ranges: 0 - 2147483647;
+ *
+ * Its syntax is InterfaceIndexOrZero (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteIfIndex_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * inetCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is in (one of) the range set(s): 0 - 2147483647
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+inetCidrRouteIfIndex_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, long inetCidrRouteIfIndex_val)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteIfIndex_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid inetCidrRouteIfIndex value.
+ */
+
+ return MFD_SUCCESS; /* inetCidrRouteIfIndex value not illegal */
+} /* inetCidrRouteIfIndex_check_value */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param inetCidrRouteIfIndex_val
+ * A long containing the new value.
+ */
+int
+inetCidrRouteIfIndex_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long inetCidrRouteIfIndex_val)
+{
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteIfIndex_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set inetCidrRouteIfIndex value.
+ * set inetCidrRouteIfIndex value in rowreq_ctx->data
+ */
+ rowreq_ctx->data->if_index = inetCidrRouteIfIndex_val;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteIfIndex_set */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteType
+ * inetCidrRouteType is subid 8 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.8
+ * Description:
+The type of route. Note that local(3) refers to a
+ route for which the next hop is the final destination;
+ remote(4)refers to a route for which the next hop is
+ not the final destination.
+
+ Routes which do not result in traffic forwarding or
+ rejection should not be displayed even if the
+ implementation keeps them stored internally.
+
+ reject(2) refers to a route which, if matched, discards
+ the message as unreachable and returns a notification
+ (e.g. ICMP error) to the message sender. This is used
+ in some protocols as a means of correctly aggregating
+ routes.
+
+ blackhole(5) refers to a route which, if matched,
+ discards the message silently.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 3/8. Values: other(1), reject(2), local(3), remote(4), blackhole(5)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteType_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * inetCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of other(1), reject(2), local(3), remote(4), blackhole(5)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+inetCidrRouteType_check_value(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long inetCidrRouteType_val)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteType_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid inetCidrRouteType value.
+ */
+
+ return MFD_SUCCESS; /* inetCidrRouteType value not illegal */
+} /* inetCidrRouteType_check_value */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param inetCidrRouteType_val
+ * A long containing the new value.
+ */
+int
+inetCidrRouteType_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long inetCidrRouteType_val)
+{
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteType_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set inetCidrRouteType value.
+ * set inetCidrRouteType value in rowreq_ctx->data
+ */
+ rowreq_ctx->data->rt_type = inetCidrRouteType_val;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteType_set */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteNextHopAS
+ * inetCidrRouteNextHopAS is subid 11 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.11
+ * Description:
+The Autonomous System Number of the Next Hop. The
+ semantics of this object are determined by the routing-
+ protocol specified in the route's inetCidrRouteProto
+ value. When this object is unknown or not relevant its
+ value should be set to zero.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 1
+ * settable 1
+ * defval: 0
+ * hint: d
+ *
+ *
+ * Its syntax is InetAutonomousSystemNumber (based on perltype UNSIGNED32)
+ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteNextHopAS_val
+ * A u_long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * inetCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_UNSIGNED
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+inetCidrRouteNextHopAS_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long inetCidrRouteNextHopAS_val)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteNextHopAS_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid inetCidrRouteNextHopAS value.
+ */
+
+ return MFD_SUCCESS; /* inetCidrRouteNextHopAS value not illegal */
+} /* inetCidrRouteNextHopAS_check_value */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param inetCidrRouteNextHopAS_val
+ * A u_long containing the new value.
+ */
+int
+inetCidrRouteNextHopAS_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long inetCidrRouteNextHopAS_val)
+{
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteNextHopAS_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set inetCidrRouteNextHopAS value.
+ * set inetCidrRouteNextHopAS value in rowreq_ctx->data
+ */
+ rowreq_ctx->data->rt_nexthop_type = inetCidrRouteNextHopAS_val;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteNextHopAS_set */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric1
+ * inetCidrRouteMetric1 is subid 12 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.12
+ * Description:
+The primary routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's inetCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteMetric1_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * inetCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+inetCidrRouteMetric1_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, long inetCidrRouteMetric1_val)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric1_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid inetCidrRouteMetric1 value.
+ */
+
+ return MFD_SUCCESS; /* inetCidrRouteMetric1 value not illegal */
+} /* inetCidrRouteMetric1_check_value */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param inetCidrRouteMetric1_val
+ * A long containing the new value.
+ */
+int
+inetCidrRouteMetric1_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long inetCidrRouteMetric1_val)
+{
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric1_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set inetCidrRouteMetric1 value.
+ * set inetCidrRouteMetric1 value in rowreq_ctx->data
+ */
+ rowreq_ctx->data->rt_metric1 = inetCidrRouteMetric1_val;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteMetric1_set */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric2
+ * inetCidrRouteMetric2 is subid 13 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.13
+ * Description:
+An alternate routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's inetCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteMetric2_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * inetCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+inetCidrRouteMetric2_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, long inetCidrRouteMetric2_val)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric2_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid inetCidrRouteMetric2 value.
+ */
+ /*
+ * does any os use metrics 2-5? If so, update this to deal with it.
+ */
+
+ return MFD_NOT_VALID_EVER;
+} /* inetCidrRouteMetric2_check_value */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param inetCidrRouteMetric2_val
+ * A long containing the new value.
+ */
+int
+inetCidrRouteMetric2_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long inetCidrRouteMetric2_val)
+{
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric2_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set inetCidrRouteMetric2 value.
+ * set inetCidrRouteMetric2 value in rowreq_ctx->data
+ */
+ rowreq_ctx->data->rt_metric2 = inetCidrRouteMetric2_val;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteMetric2_set */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric3
+ * inetCidrRouteMetric3 is subid 14 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.14
+ * Description:
+An alternate routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's inetCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteMetric3_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * inetCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+inetCidrRouteMetric3_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, long inetCidrRouteMetric3_val)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric3_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid inetCidrRouteMetric3 value.
+ */
+ /*
+ * does any os use metrics 2-5? If so, update this to deal with it.
+ */
+
+ return MFD_NOT_VALID_NOW;
+} /* inetCidrRouteMetric3_check_value */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param inetCidrRouteMetric3_val
+ * A long containing the new value.
+ */
+int
+inetCidrRouteMetric3_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long inetCidrRouteMetric3_val)
+{
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric3_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set inetCidrRouteMetric3 value.
+ * set inetCidrRouteMetric3 value in rowreq_ctx->data
+ */
+ rowreq_ctx->data->rt_metric3 = inetCidrRouteMetric3_val;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteMetric3_set */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric4
+ * inetCidrRouteMetric4 is subid 15 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.15
+ * Description:
+An alternate routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's inetCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteMetric4_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * inetCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+inetCidrRouteMetric4_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, long inetCidrRouteMetric4_val)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric4_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid inetCidrRouteMetric4 value.
+ */
+ /*
+ * does any os use metrics 2-5? If so, update this to deal with it.
+ */
+
+ return MFD_NOT_VALID_NOW;
+} /* inetCidrRouteMetric4_check_value */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param inetCidrRouteMetric4_val
+ * A long containing the new value.
+ */
+int
+inetCidrRouteMetric4_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long inetCidrRouteMetric4_val)
+{
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric4_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set inetCidrRouteMetric4 value.
+ * set inetCidrRouteMetric4 value in rowreq_ctx->data
+ */
+ rowreq_ctx->data->rt_metric4 = inetCidrRouteMetric4_val;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteMetric4_set */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteMetric5
+ * inetCidrRouteMetric5 is subid 16 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.16
+ * Description:
+An alternate routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's inetCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteMetric5_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * inetCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+inetCidrRouteMetric5_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, long inetCidrRouteMetric5_val)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric5_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid inetCidrRouteMetric5 value.
+ */
+ /*
+ * does any os use metrics 2-5? If so, update this to deal with it.
+ */
+ return MFD_NOT_VALID_NOW;
+} /* inetCidrRouteMetric5_check_value */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param inetCidrRouteMetric5_val
+ * A long containing the new value.
+ */
+int
+inetCidrRouteMetric5_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long inetCidrRouteMetric5_val)
+{
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteMetric5_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set inetCidrRouteMetric5 value.
+ * set inetCidrRouteMetric5 value in rowreq_ctx->data
+ */
+ rowreq_ctx->data->rt_metric5 = inetCidrRouteMetric5_val;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteMetric5_set */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteStatus
+ * inetCidrRouteStatus is subid 17 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.7.1.17
+ * Description:
+The row status variable, used according to row
+ installation and removal conventions.
+
+ A row entry cannot be modified when the status is
+ marked as active(1).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
+ *
+ * Its syntax is RowStatus (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetCidrRouteStatus_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * inetCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+inetCidrRouteStatus_check_value(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long inetCidrRouteStatus_val)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteStatus_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid inetCidrRouteStatus value.
+ */
+
+ return MFD_SUCCESS; /* inetCidrRouteStatus value not illegal */
+} /* inetCidrRouteStatus_check_value */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param inetCidrRouteStatus_val
+ * A long containing the new value.
+ */
+int
+inetCidrRouteStatus_set(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long inetCidrRouteStatus_val)
+{
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteStatus_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set inetCidrRouteStatus value.
+ * set inetCidrRouteStatus value in rowreq_ctx->data
+ */
+ rowreq_ctx->row_status = inetCidrRouteStatus_val;
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteStatus_set */
+
+/**
+ * check dependencies
+ *
+ * This is useful for for tables which have dependencies between columns
+ * (or rows, or tables). For example, two columns allocating a percentage
+ * of something add up 100%.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * inetCidrRouteTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @retval MFD_SUCCESS all the changes to the row are legal
+ * @retval MFD_ERROR one or more changes are not legal
+ *
+ * (see README-table-inetCidrRouteTable if you don't have dependencies)
+ */
+int
+inetCidrRouteTable_check_dependencies(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:inetCidrRouteTable_check_dependencies", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:470:o: Check inetCidrRouteTable row dependencies.
+ * check that all new value are legal and consistent with each other
+ */
+ /*
+ * can't modify an active row
+ */
+ if ((ROWSTATUS_ACTIVE == rowreq_ctx->row_status) &&
+ (ROWSTATUS_ACTIVE == rowreq_ctx->row_status_undo)) {
+ DEBUGMSGTL(("inetCidrRouteTable",
+ "can't change active row (yet)\n"));
+ return MFD_ERROR;
+ }
+
+ /*
+ * check RowStatus dependencies
+ */
+ if (rowreq_ctx->column_set_flags & COLUMN_INETCIDRROUTESTATUS_FLAG) {
+ /*
+ * check for valid RowStatus transition (old, new)
+ * (Note: move transition check to
+ * to catch errors earlier)
+ */
+ rc = check_rowstatus_transition(rowreq_ctx->row_status_undo,
+ rowreq_ctx->row_status);
+ if (MFD_SUCCESS != rc)
+ return rc;
+
+ /*
+ * row creation requirements
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ if (ROWSTATUS_DESTROY == rowreq_ctx->row_status) {
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED;
+ } else if (ROWSTATUS_CREATEANDGO == rowreq_ctx->row_status) {
+ if ((rowreq_ctx->
+ column_set_flags & INETCIDRROUTETABLE_REQUIRED_COLS)
+ != INETCIDRROUTETABLE_REQUIRED_COLS) {
+ DEBUGMSGTL(("inetCidrRouteTable",
+ "required columns missing (0x%0x != 0x%0x)\n",
+ rowreq_ctx->column_set_flags,
+ INETCIDRROUTETABLE_REQUIRED_COLS));
+ return MFD_CANNOT_CREATE_NOW;
+ }
+ rowreq_ctx->row_status = ROWSTATUS_ACTIVE;
+ }
+ } /* row creation */
+ else {
+ /*
+ * row change requirements
+ */
+ /*
+ * don't allow a destroy if any other value was changed, since
+ * that might call data access routines with bad info.
+ *
+ * you may or may not require the row be notInService before it
+ * can be destroyed.
+ */
+ if (ROWSTATUS_DESTROY == rowreq_ctx->row_status) {
+ if (rowreq_ctx->
+ column_set_flags & ~COLUMN_INETCIDRROUTESTATUS_FLAG) {
+ DEBUGMSGTL(("inetCidrRouteTable",
+ "destroy must be only varbind for row\n"));
+ return MFD_NOT_VALID_NOW;
+ }
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED;
+
+ } /* row destroy */
+ } /* row change */
+ } else {
+ /*
+ * must have row status to create a row
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ DEBUGMSGTL(("inetCidrRouteTable",
+ "must use RowStatus to create rows\n"));
+ return MFD_CANNOT_CREATE_NOW;
+ }
+ } /* row status not set */
+
+ if (MFD_SUCCESS != rc)
+ return rc;
+
+ return rc;
+} /* inetCidrRouteTable_check_dependencies */
+
+
+int
+_route_number_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ if (MODE_GET == reqinfo->mode) {
+ int val = inetCidrRouteTable_container_size();
+ snmp_set_var_typed_value(requests->requestvb, ASN_UNSIGNED,
+ (u_char *) &val, sizeof(val));
+ } else
+ netsnmp_assert("bad mode in RO handler");
+
+ if (handler->next && handler->next->access_method)
+ return netsnmp_call_next_handler(handler, reginfo, reqinfo,
+ requests);
+
+ return SNMP_ERR_NOERROR;
+}
+
+/** @} */
+/** @{ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable.h
new file mode 100644
index 0000000000..d663c2d995
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable.h
@@ -0,0 +1,537 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: inetCidrRouteTable.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+#ifndef INETCIDRROUTETABLE_H
+#define INETCIDRROUTETABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @addtogroup misc misc: Miscellaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/data_access/route.h>
+
+ /*
+ * other required module components
+ */
+ /* *INDENT-OFF* */
+config_require(ip-forward-mib/data_access/route)
+config_require(ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_interface)
+config_require(ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_data_access)
+ /* *INDENT-ON* */
+
+ /*
+ * OID, column number and enum definions for inetCidrRouteTable
+ */
+#include "inetCidrRouteTable_constants.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_inetCidrRouteTable(void);
+ void shutdown_inetCidrRouteTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table inetCidrRouteTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-FORWARD-MIB::inetCidrRouteTable is subid 7 of ipForward.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.24.7, length: 9
+ */
+ /*
+ *********************************************************************
+ * When you register your mib, you get to provide a generic
+ * pointer that will be passed back to you for most of the
+ * functions calls.
+ *
+ * TODO:100:r: Review all context structures
+ */
+ /*
+ * TODO:101:o: |-> Review inetCidrRouteTable registration context.
+ */
+ typedef netsnmp_data_list inetCidrRouteTable_registration;
+
+/**********************************************************************/
+ /*
+ * TODO:110:r: |-> Review inetCidrRouteTable data context structure.
+ * This structure is used to represent the data for inetCidrRouteTable.
+ */
+ typedef netsnmp_route_entry inetCidrRouteTable_data;
+
+
+ /*
+ *********************************************************************
+ * TODO:115:o: |-> Review inetCidrRouteTable undo context.
+ * We're just going to use the same data structure for our
+ * undo_context. If you want to do something more efficent,
+ * define your typedef here.
+ */
+ typedef inetCidrRouteTable_data inetCidrRouteTable_undo_data;
+
+ /*
+ * TODO:120:r: |-> Review inetCidrRouteTable mib index.
+ * This structure is used to represent the index for inetCidrRouteTable.
+ */
+ typedef struct inetCidrRouteTable_mib_index_s {
+
+ /*
+ * inetCidrRouteDestType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ u_long inetCidrRouteDestType;
+
+ /*
+ * inetCidrRouteDest(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ char
+ inetCidrRouteDest[NETSNMP_ACCESS_ROUTE_ADDR_BUF_SIZE];
+ size_t inetCidrRouteDest_len;
+
+ /*
+ * inetCidrRoutePfxLen(3)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ u_long inetCidrRoutePfxLen;
+
+ /*
+ * inetCidrRoutePolicy(4)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
+ */
+ oid inetCidrRoutePolicy[NETSNMP_POLICY_OID_MAX_LEN];
+ size_t inetCidrRoutePolicy_len;
+
+ /*
+ * inetCidrRouteNextHopType(5)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ u_long inetCidrRouteNextHopType;
+
+ /*
+ * inetCidrRouteNextHop(6)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ char
+ inetCidrRouteNextHop[NETSNMP_ACCESS_ROUTE_ADDR_BUF_SIZE];
+ size_t inetCidrRouteNextHop_len;
+
+
+ } inetCidrRouteTable_mib_index;
+
+ /*
+ * TODO:121:r: | |-> Review inetCidrRouteTable max index length.
+ * If you KNOW that your indexes will never exceed a certain
+ * length, update this macro to that length.
+ *
+ * BE VERY CAREFUL TO TAKE INTO ACCOUNT THE MAXIMUM
+ * POSSIBLE LENGHT FOR EVERY VARIABLE LENGTH INDEX!
+ */
+#define MAX_inetCidrRouteTable_IDX_LEN (((NETSNMP_ACCESS_ROUTE_ADDR_BUF_SIZE+1)*2)+ 3 + (NETSNMP_POLICY_OID_MAX_LEN + 1))
+
+
+ /*
+ *********************************************************************
+ * TODO:130:o: |-> Review inetCidrRouteTable Row request (rowreq) context.
+ * When your functions are called, you will be passed a
+ * inetCidrRouteTable_rowreq_ctx pointer.
+ */
+ typedef struct inetCidrRouteTable_rowreq_ctx_s {
+
+ /** this must be first for container compare to work */
+ netsnmp_index oid_idx;
+ oid oid_tmp[MAX_inetCidrRouteTable_IDX_LEN];
+
+ inetCidrRouteTable_mib_index tbl_idx;
+
+ inetCidrRouteTable_data *data;
+ inetCidrRouteTable_undo_data *undo;
+ unsigned int column_set_flags; /* flags for set columns */
+
+
+ /*
+ * flags per row. Currently, the first (lower) 8 bits are reserved
+ * for the user. See mfd.h for other flags.
+ */
+ u_int rowreq_flags;
+
+ /*
+ * TODO:131:o: | |-> Add useful data to inetCidrRouteTable rowreq context.
+ */
+ u_char row_status;
+ u_char row_status_undo;
+
+ /*
+ * storage for future expansion
+ */
+ netsnmp_data_list *inetCidrRouteTable_data_list;
+
+ } inetCidrRouteTable_rowreq_ctx;
+
+ typedef struct inetCidrRouteTable_ref_rowreq_ctx_s {
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx;
+ } inetCidrRouteTable_ref_rowreq_ctx;
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int
+ inetCidrRouteTable_pre_request(inetCidrRouteTable_registration *
+ user_context);
+ int
+ inetCidrRouteTable_post_request(inetCidrRouteTable_registration *
+ user_context, int rc);
+
+ int
+ inetCidrRouteTable_rowreq_ctx_init(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ void *user_init_ctx);
+ void
+ inetCidrRouteTable_rowreq_ctx_cleanup(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx);
+
+ inetCidrRouteTable_data *inetCidrRouteTable_allocate_data(void);
+ void inetCidrRouteTable_release_data(inetCidrRouteTable_data
+ * data);
+
+ int
+ inetCidrRouteTable_check_dependencies(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx);
+ int inetCidrRouteTable_commit(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx);
+
+
+ inetCidrRouteTable_rowreq_ctx
+ * inetCidrRouteTable_row_find_by_mib_index
+ (inetCidrRouteTable_mib_index * mib_idx);
+
+ extern oid inetCidrRouteTable_oid[];
+ extern int inetCidrRouteTable_oid_size;
+
+
+#include "inetCidrRouteTable_interface.h"
+#include "inetCidrRouteTable_data_access.h"
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table inetCidrRouteTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-FORWARD-MIB::inetCidrRouteTable is subid 7 of ipForward.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.24.7, length: 9
+ */
+ /*
+ * indexes
+ */
+
+ int inetCidrRouteIfIndex_get(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx, long
+ *inetCidrRouteIfIndex_val_ptr);
+ int inetCidrRouteType_get(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ inetCidrRouteType_val_ptr);
+ int inetCidrRouteProto_get(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ inetCidrRouteProto_val_ptr);
+ int inetCidrRouteAge_get(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ inetCidrRouteAge_val_ptr);
+ int
+ inetCidrRouteNextHopAS_get(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ inetCidrRouteNextHopAS_val_ptr);
+ int inetCidrRouteMetric1_get(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx, long
+ *inetCidrRouteMetric1_val_ptr);
+ int inetCidrRouteMetric2_get(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx, long
+ *inetCidrRouteMetric2_val_ptr);
+ int inetCidrRouteMetric3_get(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx, long
+ *inetCidrRouteMetric3_val_ptr);
+ int inetCidrRouteMetric4_get(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx, long
+ *inetCidrRouteMetric4_val_ptr);
+ int inetCidrRouteMetric5_get(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx, long
+ *inetCidrRouteMetric5_val_ptr);
+ int inetCidrRouteStatus_get(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ inetCidrRouteStatus_val_ptr);
+
+
+ int
+ inetCidrRouteTable_indexes_set_tbl_idx(inetCidrRouteTable_mib_index
+ * tbl_idx,
+ u_long
+ inetCidrRouteDestType_val,
+ char
+ *inetCidrRouteDest_val_ptr,
+ size_t
+ inetCidrRouteDest_val_ptr_len,
+ u_long
+ inetCidrRoutePfxLen_val,
+ oid *
+ inetCidrRoutePolicy_val_ptr,
+ size_t
+ inetCidrRoutePolicy_val_ptr_len,
+ u_long
+ inetCidrRouteNextHopType_val,
+ char
+ *inetCidrRouteNextHop_val_ptr,
+ size_t
+ inetCidrRouteNextHop_val_ptr_len);
+ int
+ inetCidrRouteTable_indexes_set(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long inetCidrRouteDestType_val,
+ char *inetCidrRouteDest_val_ptr,
+ size_t
+ inetCidrRouteDest_val_ptr_len,
+ u_long inetCidrRoutePfxLen_val,
+ oid * inetCidrRoutePolicy_val_ptr,
+ size_t
+ inetCidrRoutePolicy_val_ptr_len,
+ u_long inetCidrRouteNextHopType_val,
+ char *inetCidrRouteNextHop_val_ptr,
+ size_t
+ inetCidrRouteNextHop_val_ptr_len);
+
+
+
+ /*
+ *********************************************************************
+ * SET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * SET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table inetCidrRouteTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-FORWARD-MIB::inetCidrRouteTable is subid 7 of ipForward.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.24.7, length: 9
+ */
+
+
+ int
+ inetCidrRouteTable_undo_setup(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+ inetCidrRouteTable_undo_cleanup(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetCidrRouteTable_undo(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetCidrRouteTable_commit(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx);
+ int
+ inetCidrRouteTable_undo_commit(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+ int
+ inetCidrRouteIfIndex_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long inetCidrRouteIfIndex_val);
+ int
+ inetCidrRouteIfIndex_undo_setup(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetCidrRouteIfIndex_set(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx, long
+ inetCidrRouteIfIndex_val);
+ int inetCidrRouteIfIndex_undo(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx);
+
+ int
+ inetCidrRouteType_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long inetCidrRouteType_val);
+ int
+ inetCidrRouteType_undo_setup(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetCidrRouteType_set(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long inetCidrRouteType_val);
+ int inetCidrRouteType_undo(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ inetCidrRouteProto_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long inetCidrRouteProto_val);
+ int
+ inetCidrRouteProto_undo_setup(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetCidrRouteProto_set(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long inetCidrRouteProto_val);
+ int inetCidrRouteProto_undo(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ inetCidrRouteAge_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long inetCidrRouteAge_val);
+ int
+ inetCidrRouteAge_undo_setup(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetCidrRouteAge_set(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long inetCidrRouteAge_val);
+ int inetCidrRouteAge_undo(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ inetCidrRouteNextHopAS_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ inetCidrRouteNextHopAS_val);
+ int
+ inetCidrRouteNextHopAS_undo_setup(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+ inetCidrRouteNextHopAS_set(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long inetCidrRouteNextHopAS_val);
+ int
+ inetCidrRouteNextHopAS_undo(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ inetCidrRouteMetric1_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long inetCidrRouteMetric1_val);
+ int
+ inetCidrRouteMetric1_undo_setup(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetCidrRouteMetric1_set(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx, long
+ inetCidrRouteMetric1_val);
+ int inetCidrRouteMetric1_undo(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx);
+
+ int
+ inetCidrRouteMetric2_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long inetCidrRouteMetric2_val);
+ int
+ inetCidrRouteMetric2_undo_setup(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetCidrRouteMetric2_set(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx, long
+ inetCidrRouteMetric2_val);
+ int inetCidrRouteMetric2_undo(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx);
+
+ int
+ inetCidrRouteMetric3_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long inetCidrRouteMetric3_val);
+ int
+ inetCidrRouteMetric3_undo_setup(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetCidrRouteMetric3_set(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx, long
+ inetCidrRouteMetric3_val);
+ int inetCidrRouteMetric3_undo(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx);
+
+ int
+ inetCidrRouteMetric4_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long inetCidrRouteMetric4_val);
+ int
+ inetCidrRouteMetric4_undo_setup(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetCidrRouteMetric4_set(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx, long
+ inetCidrRouteMetric4_val);
+ int inetCidrRouteMetric4_undo(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx);
+
+ int
+ inetCidrRouteMetric5_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long inetCidrRouteMetric5_val);
+ int
+ inetCidrRouteMetric5_undo_setup(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetCidrRouteMetric5_set(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx, long
+ inetCidrRouteMetric5_val);
+ int inetCidrRouteMetric5_undo(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx);
+
+ int
+ inetCidrRouteStatus_check_value(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long inetCidrRouteStatus_val);
+ int
+ inetCidrRouteStatus_undo_setup(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetCidrRouteStatus_set(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ inetCidrRouteStatus_val);
+ int inetCidrRouteStatus_undo(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx);
+
+
+ int
+ inetCidrRouteTable_check_dependencies(inetCidrRouteTable_rowreq_ctx
+ * ctx);
+
+
+ /*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* INETCIDRROUTETABLE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_constants.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_constants.h
new file mode 100644
index 0000000000..84e9fe6643
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_constants.h
@@ -0,0 +1,216 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $
+ *
+ * $Id: inetCidrRouteTable_constants.h 14049 2006-01-06 21:26:49Z rstory $
+ */
+#ifndef INETCIDRROUTETABLE_CONSTANTS_H
+#define INETCIDRROUTETABLE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ * column number definitions for table inetCidrRouteTable
+ */
+#define INETCIDRROUTENUMBER_OID 1,3,6,1,2,1,4,24,6,0
+#define INETCIDRROUTETABLE_OID 1,3,6,1,2,1,4,24,7
+
+#define COLUMN_INETCIDRROUTEDESTTYPE 1
+
+#define COLUMN_INETCIDRROUTEDEST 2
+
+#define COLUMN_INETCIDRROUTEPFXLEN 3
+
+#define COLUMN_INETCIDRROUTEPOLICY 4
+
+#define COLUMN_INETCIDRROUTENEXTHOPTYPE 5
+
+#define COLUMN_INETCIDRROUTENEXTHOP 6
+
+#define COLUMN_INETCIDRROUTEIFINDEX 7
+#define COLUMN_INETCIDRROUTEIFINDEX_FLAG (0x1 << 6)
+
+#define COLUMN_INETCIDRROUTETYPE 8
+#define COLUMN_INETCIDRROUTETYPE_FLAG (0x1 << 7)
+
+#define COLUMN_INETCIDRROUTEPROTO 9
+
+#define COLUMN_INETCIDRROUTEAGE 10
+
+#define COLUMN_INETCIDRROUTENEXTHOPAS 11
+#define COLUMN_INETCIDRROUTENEXTHOPAS_FLAG (0x1 << 10)
+
+#define COLUMN_INETCIDRROUTEMETRIC1 12
+#define COLUMN_INETCIDRROUTEMETRIC1_FLAG (0x1 << 11)
+
+#define COLUMN_INETCIDRROUTEMETRIC2 13
+#define COLUMN_INETCIDRROUTEMETRIC2_FLAG (0x1 << 12)
+
+#define COLUMN_INETCIDRROUTEMETRIC3 14
+#define COLUMN_INETCIDRROUTEMETRIC3_FLAG (0x1 << 13)
+
+#define COLUMN_INETCIDRROUTEMETRIC4 15
+#define COLUMN_INETCIDRROUTEMETRIC4_FLAG (0x1 << 14)
+
+#define COLUMN_INETCIDRROUTEMETRIC5 16
+#define COLUMN_INETCIDRROUTEMETRIC5_FLAG (0x1 << 15)
+
+#define COLUMN_INETCIDRROUTESTATUS 17
+#define COLUMN_INETCIDRROUTESTATUS_FLAG (0x1 << 16)
+
+
+#define INETCIDRROUTETABLE_MIN_COL COLUMN_INETCIDRROUTEIFINDEX
+#define INETCIDRROUTETABLE_MAX_COL COLUMN_INETCIDRROUTESTATUS
+
+
+ /*
+ * TODO:405:r: Review INETCIDRROUTETABLE_SETTABLE_COLS macro.
+ * OR together all the writable cols.
+ */
+#define INETCIDRROUTETABLE_SETTABLE_COLS (COLUMN_INETCIDRROUTEIFINDEX_FLAG | COLUMN_INETCIDRROUTETYPE_FLAG | COLUMN_INETCIDRROUTENEXTHOPAS_FLAG | COLUMN_INETCIDRROUTEMETRIC1_FLAG | COLUMN_INETCIDRROUTEMETRIC2_FLAG | COLUMN_INETCIDRROUTEMETRIC3_FLAG | COLUMN_INETCIDRROUTEMETRIC4_FLAG | COLUMN_INETCIDRROUTEMETRIC5_FLAG | COLUMN_INETCIDRROUTESTATUS_FLAG)
+ /*
+ * TODO:405:r: Review INETCIDRROUTETABLE_REQUIRED_COLS macro.
+ * OR together all the required rows for row creation.
+ * default is writable cols w/out defaults.
+ */
+#define INETCIDRROUTETABLE_REQUIRED_COLS (COLUMN_INETCIDRROUTEIFINDEX_FLAG | COLUMN_INETCIDRROUTETYPE_FLAG | COLUMN_INETCIDRROUTESTATUS_FLAG)
+
+ /*
+ * NOTES on enums
+ * ==============
+ *
+ * Value Mapping
+ * -------------
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them
+ * below. For example, a boolean flag (1/0) is usually represented
+ * as a TruthValue in a MIB, which maps to the values (1/2).
+ *
+ */
+/*************************************************************************
+ *************************************************************************
+ *
+ * enum definitions for table inetCidrRouteTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * inetCidrRouteDestType (InetAddressType / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef INETADDRESSTYPE_ENUMS
+#define INETADDRESSTYPE_ENUMS
+
+#define INETADDRESSTYPE_UNKNOWN 0
+#define INETADDRESSTYPE_IPV4 1
+#define INETADDRESSTYPE_IPV6 2
+#define INETADDRESSTYPE_IPV4Z 3
+#define INETADDRESSTYPE_IPV6Z 4
+#define INETADDRESSTYPE_DNS 16
+
+#endif /* INETADDRESSTYPE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * inetCidrRouteNextHopType (InetAddressType / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef INETADDRESSTYPE_ENUMS
+#define INETADDRESSTYPE_ENUMS
+
+#define INETADDRESSTYPE_UNKNOWN 0
+#define INETADDRESSTYPE_IPV4 1
+#define INETADDRESSTYPE_IPV6 2
+#define INETADDRESSTYPE_IPV4Z 3
+#define INETADDRESSTYPE_IPV6Z 4
+#define INETADDRESSTYPE_DNS 16
+
+#endif /* INETADDRESSTYPE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * inetCidrRouteType (INTEGER / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef INETCIDRROUTETYPE_ENUMS
+#define INETCIDRROUTETYPE_ENUMS
+
+#define INETCIDRROUTETYPE_OTHER 1
+#define INETCIDRROUTETYPE_REJECT 2
+#define INETCIDRROUTETYPE_LOCAL 3
+#define INETCIDRROUTETYPE_REMOTE 4
+#define INETCIDRROUTETYPE_BLACKHOLE 5
+
+#endif /* INETCIDRROUTETYPE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * inetCidrRouteProto (IANAipRouteProtocol / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef IANAIPROUTEPROTOCOL_ENUMS
+#define IANAIPROUTEPROTOCOL_ENUMS
+
+#define IANAIPROUTEPROTOCOL_OTHER 1
+#define IANAIPROUTEPROTOCOL_LOCAL 2
+#define IANAIPROUTEPROTOCOL_NETMGMT 3
+#define IANAIPROUTEPROTOCOL_ICMP 4
+#define IANAIPROUTEPROTOCOL_EGP 5
+#define IANAIPROUTEPROTOCOL_GGP 6
+#define IANAIPROUTEPROTOCOL_HELLO 7
+#define IANAIPROUTEPROTOCOL_RIP 8
+#define IANAIPROUTEPROTOCOL_ISIS 9
+#define IANAIPROUTEPROTOCOL_ESIS 10
+#define IANAIPROUTEPROTOCOL_CISCOIGRP 11
+#define IANAIPROUTEPROTOCOL_BBNSPFIGP 12
+#define IANAIPROUTEPROTOCOL_OSPF 13
+#define IANAIPROUTEPROTOCOL_BGP 14
+#define IANAIPROUTEPROTOCOL_IDPR 15
+#define IANAIPROUTEPROTOCOL_CISCOEIGRP 16
+#define IANAIPROUTEPROTOCOL_DVMRP 17
+
+#endif /* IANAIPROUTEPROTOCOL_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * inetCidrRouteStatus (RowStatus / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef ROWSTATUS_ENUMS
+#define ROWSTATUS_ENUMS
+
+#define ROWSTATUS_ACTIVE 1
+#define ROWSTATUS_NOTINSERVICE 2
+#define ROWSTATUS_NOTREADY 3
+#define ROWSTATUS_CREATEANDGO 4
+#define ROWSTATUS_CREATEANDWAIT 5
+#define ROWSTATUS_DESTROY 6
+
+#endif /* ROWSTATUS_ENUMS */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* INETCIDRROUTETABLE_OIDS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_data_access.c
new file mode 100644
index 0000000000..03c3f0877a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_data_access.c
@@ -0,0 +1,932 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: inetCidrRouteTable_data_access.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "inetCidrRouteTable.h"
+
+
+#include "inetCidrRouteTable_data_access.h"
+
+/** @ingroup interface
+ * @addtogroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table inetCidrRouteTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-FORWARD-MIB::inetCidrRouteTable is subid 7 of ipForward.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.24.7, length: 9
+ */
+
+/**
+ * initialization for inetCidrRouteTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param inetCidrRouteTable_reg
+ * Pointer to inetCidrRouteTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+inetCidrRouteTable_init_data(inetCidrRouteTable_registration *
+ inetCidrRouteTable_reg)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_init_data",
+ "called\n"));
+
+ /*
+ * TODO:303:o: Initialize inetCidrRouteTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteTable_init_data */
+
+/**
+ * container overview
+ *
+ */
+
+/**
+ * container initialization
+ *
+ * @param container_ptr_ptr A pointer to a container pointer. If you
+ * create a custom container, use this parameter to return it
+ * to the MFD helper. If set to NULL, the MFD helper will
+ * allocate a container for you.
+ * @param cache A pointer to a cache structure. You can set the timeout
+ * and other cache flags using this pointer.
+ *
+ * This function is called at startup to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases. If no custom
+ * container is allocated, the MFD code will create one for your.
+ *
+ * This is also the place to set up cache behavior. The default, to
+ * simply set the cache timeout, will work well with the default
+ * container. If you are using a custom container, you may want to
+ * look at the cache helper documentation to see if there are any
+ * flags you want to set.
+ *
+ * @remark
+ * This would also be a good place to do any initialization needed
+ * for you data source. For example, opening a connection to another
+ * process that will supply the data, opening a database, etc.
+ */
+void
+inetCidrRouteTable_container_init(netsnmp_container **container_ptr_ptr,
+ netsnmp_cache * cache)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_container_init", "called\n"));
+
+ if (NULL == container_ptr_ptr) {
+ snmp_log(LOG_ERR,
+ "bad container param to inetCidrRouteTable_container_init\n");
+ return;
+ }
+
+ /*
+ * For advanced users, you can use a custom container. If you
+ * do not create one, one will be created for you.
+ */
+ *container_ptr_ptr = NULL;
+
+ if (NULL == cache) {
+ snmp_log(LOG_ERR,
+ "bad cache param to inetCidrRouteTable_container_init\n");
+ return;
+ }
+
+ /*
+ * TODO:345:A: Set up inetCidrRouteTable cache properties.
+ *
+ * Also for advanced users, you can set parameters for the
+ * cache. Do not change the magic pointer, as it is used
+ * by the MFD helper. To completely disable caching, set
+ * cache->enabled to 0.
+ */
+ cache->timeout = INETCIDRROUTETABLE_CACHE_TIMEOUT; /* seconds */
+} /* inetCidrRouteTable_container_init */
+
+/**
+ * check entry for update
+ */
+static void
+_snarf_route_entry(netsnmp_route_entry *route_entry,
+ netsnmp_container *container)
+{
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx;
+
+ netsnmp_assert(NULL != route_entry);
+ netsnmp_assert(NULL != container);
+
+ /*
+ * per inetCidrRouteType:
+ *
+ * Routes which do not result in traffic forwarding or
+ * rejection should not be displayed even if the
+ * implementation keeps them stored internally.
+ */
+ if (route_entry->rt_type == 0) { /* set when route not up */
+ DEBUGMSGT(("verbose:inetCidrRouteTable:inetCidrRouteTable_cache_load", "skipping route\n"));
+ netsnmp_access_route_entry_free(route_entry);
+ return;
+ }
+
+ /*
+ * allocate an row context and set the index(es), then add it to
+ * the container
+ */
+ rowreq_ctx = inetCidrRouteTable_allocate_rowreq_ctx(route_entry, NULL);
+ if ((NULL != rowreq_ctx) &&
+ (MFD_SUCCESS == inetCidrRouteTable_indexes_set
+ (rowreq_ctx, route_entry->rt_dest_type,
+ route_entry->rt_dest, route_entry->rt_dest_len,
+ route_entry->rt_pfx_len,
+ route_entry->rt_policy, route_entry->rt_policy_len,
+ route_entry->rt_nexthop_type,
+ route_entry->rt_nexthop, route_entry->rt_nexthop_len))) {
+ CONTAINER_INSERT(container, rowreq_ctx);
+ rowreq_ctx->row_status = ROWSTATUS_ACTIVE;
+ } else {
+ if (rowreq_ctx) {
+ snmp_log(LOG_ERR, "error setting index while loading "
+ "inetCidrRoute cache.\n");
+ inetCidrRouteTable_release_rowreq_ctx(rowreq_ctx);
+ } else
+ netsnmp_access_route_entry_free(route_entry);
+ }
+}
+
+/**
+ * container shutdown
+ *
+ * @param container_ptr A pointer to the container.
+ *
+ * This function is called at shutdown to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases.
+ *
+ * This function is called before inetCidrRouteTable_container_free().
+ *
+ * @remark
+ * This would also be a good place to do any cleanup needed
+ * for you data source. For example, closing a connection to another
+ * process that supplied the data, closing a database, etc.
+ */
+void
+inetCidrRouteTable_container_shutdown(netsnmp_container *container_ptr)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_container_shutdown", "called\n"));
+
+ if (NULL == container_ptr) {
+ snmp_log(LOG_ERR,
+ "bad params to inetCidrRouteTable_container_shutdown\n");
+ return;
+ }
+
+} /* inetCidrRouteTable_container_shutdown */
+
+/**
+ * load initial data
+ *
+ * TODO:350:M: Implement inetCidrRouteTable data load
+ * This function will also be called by the cache helper to load
+ * the container again (after the container free function has been
+ * called to free the previous contents).
+ *
+ * @param container container to which items should be inserted
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
+ * @retval MFD_ERROR : other error.
+ *
+ * This function is called to load the index(es) (and data, optionally)
+ * for the every row in the data set.
+ *
+ * @remark
+ * While loading the data, the only important thing is the indexes.
+ * If access to your data is cheap/fast (e.g. you have a pointer to a
+ * structure in memory), it would make sense to update the data here.
+ * If, however, the accessing the data invovles more work (e.g. parsing
+ * some other existing data, or peforming calculations to derive the data),
+ * then you can limit yourself to setting the indexes and saving any
+ * information you will need later. Then use the saved information in
+ * inetCidrRouteTable_row_prep() for populating data.
+ *
+ * @note
+ * If you need consistency between rows (like you want statistics
+ * for each row to be from the same time frame), you should set all
+ * data here.
+ *
+ */
+int
+inetCidrRouteTable_container_load(netsnmp_container *container)
+{
+ netsnmp_container *route_container;
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_container_load", "called\n"));
+
+ /*
+ * TODO:351:M: |-> Load/update data in the inetCidrRouteTable container.
+ * loop over your inetCidrRouteTable data, allocate a rowreq context,
+ * set the index(es) [and data, optionally] and insert into
+ * the container.
+ *
+ * we use the netsnmp data access api to get the data
+ */
+ route_container =
+ netsnmp_access_route_container_load(NULL,
+ NETSNMP_ACCESS_ROUTE_LOAD_NOFLAGS);
+ DEBUGMSGT(("verbose:inetCidrRouteTable:inetCidrRouteTable_cache_load",
+ "%d records\n", CONTAINER_SIZE(route_container)));
+
+ if (NULL == route_container)
+ return MFD_RESOURCE_UNAVAILABLE; /* msg already logged */
+
+ /*
+ * we just got a fresh copy of route data. snarf data
+ */
+ CONTAINER_FOR_EACH(route_container,
+ (netsnmp_container_obj_func *) _snarf_route_entry,
+ container);
+
+ /*
+ * free the container. we've either claimed each ifentry, or released it,
+ * so the dal function doesn't need to clear the container.
+ */
+ netsnmp_access_route_container_free(route_container,
+ NETSNMP_ACCESS_ROUTE_FREE_DONT_CLEAR);
+
+ DEBUGMSGT(("verbose:inetCidrRouteTable:inetCidrRouteTable_cache_load",
+ "%d records\n", CONTAINER_SIZE(container)));
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteTable_container_load */
+
+/**
+ * container clean up
+ *
+ * @param container container with all current items
+ *
+ * This optional callback is called prior to all
+ * item's being removed from the container. If you
+ * need to do any processing before that, do it here.
+ *
+ * @note
+ * The MFD helper will take care of releasing all the row contexts.
+ *
+ */
+void
+inetCidrRouteTable_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_container_free", "called\n"));
+
+ /*
+ * TODO:380:M: Free inetCidrRouteTable container data.
+ */
+} /* inetCidrRouteTable_container_free */
+
+/**
+ * prepare row for processing.
+ *
+ * When the agent has located the row for a request, this function is
+ * called to prepare the row for processing. If you fully populated
+ * the data context during the index setup phase, you may not need to
+ * do anything.
+ *
+ * @param rowreq_ctx pointer to a context.
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ */
+int
+inetCidrRouteTable_row_prep(inetCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_row_prep",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+ if (MFD_ROW_CREATED & rowreq_ctx->rowreq_flags) {
+ memcpy(rowreq_ctx->data->rt_dest,
+ rowreq_ctx->tbl_idx.inetCidrRouteDest,
+ rowreq_ctx->tbl_idx.inetCidrRouteDest_len);
+ rowreq_ctx->data->rt_dest_len =
+ rowreq_ctx->tbl_idx.inetCidrRouteDest_len;
+ rowreq_ctx->data->rt_dest_type =
+ rowreq_ctx->tbl_idx.inetCidrRouteDestType;
+
+ memcpy(rowreq_ctx->data->rt_nexthop,
+ rowreq_ctx->tbl_idx.inetCidrRouteNextHop,
+ rowreq_ctx->tbl_idx.inetCidrRouteNextHop_len);
+ rowreq_ctx->data->rt_nexthop_len =
+ rowreq_ctx->tbl_idx.inetCidrRouteNextHop_len;
+ rowreq_ctx->data->rt_nexthop_type =
+ rowreq_ctx->tbl_idx.inetCidrRouteNextHopType;
+
+ rowreq_ctx->data->rt_pfx_len =
+ rowreq_ctx->tbl_idx.inetCidrRoutePfxLen;
+
+ rowreq_ctx->data->rt_policy_len =
+ rowreq_ctx->tbl_idx.inetCidrRoutePolicy_len;
+ rowreq_ctx->data->rt_policy =
+ rowreq_ctx->tbl_idx.inetCidrRoutePolicy;
+ /*
+ * policy pointing to rowreq array, set flag so
+ * it won't be freed
+ */
+ rowreq_ctx->data->flags |= NETSNMP_ACCESS_ROUTE_POLICY_STATIC;
+ }
+
+
+ return MFD_SUCCESS;
+} /* inetCidrRouteTable_row_prep */
+
+/*
+ * TODO:420:r: Implement inetCidrRouteTable index validation.
+ */
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteDestType
+ * inetCidrRouteDestType is subid 1 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is NoAccess.
+ * OID: .1.3.6.1.2.1.4.24.7.1.1
+ * Description:
+The type of the inetCidrRouteDest address, as defined
+ in the InetAddress MIB.
+
+ Only those address types that may appear in an actual
+ routing table are allowed as values of this object.
+ *
+ * Attributes:
+ * accessible 0 isscalar 0 enums 1 hasdefval 0
+ * readable 0 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ * Enum range: 5/8. Values: unknown(0), ipv4(1), ipv6(2), ipv4z(3), ipv6z(4), dns(16)
+ *
+ * Its syntax is InetAddressType (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ *
+ *
+ *
+ * NOTE: NODE inetCidrRouteDestType IS NOT ACCESSIBLE
+ *
+ *
+ */
+/**
+ * check validity of inetCidrRouteDestType index portion
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ *
+ * @note this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * inetCidrRouteTable_validate_index() function.
+ *
+ * @note Also keep in mind that if the index refers to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ * The following checks have already been done for you:
+ * The value is one of unknown(0), ipv4(1), ipv6(2), ipv4z(3), ipv6z(4), dns(16)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ */
+int
+inetCidrRouteDestType_check_index(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteDestType_check_index", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:426:M: |-> Check inetCidrRouteTable index inetCidrRouteDestType.
+ * check that index value in the table context is legal.
+ * (rowreq_ctx->tbl_index.inetCidrRouteDestType)
+ */
+ /*
+ * we don't support all types
+ */
+ switch (rowreq_ctx->tbl_idx.inetCidrRouteDestType) {
+
+ case INETADDRESSTYPE_IPV4:
+ case INETADDRESSTYPE_IPV6:
+ break;
+
+ case INETADDRESSTYPE_UNKNOWN:
+ case INETADDRESSTYPE_IPV4Z:
+ case INETADDRESSTYPE_IPV6Z:
+ case INETADDRESSTYPE_DNS:
+ /*
+ * fall through
+ */
+
+ default:
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS; /* inetCidrRouteDestType index ok */
+} /* inetCidrRouteDestType_check_index */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteDest
+ * inetCidrRouteDest is subid 2 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is NoAccess.
+ * OID: .1.3.6.1.2.1.4.24.7.1.2
+ * Description:
+The destination IP address of this route.
+
+ The type of this address is determined by the value of
+ the inetCidrRouteDestType object.
+
+ The values for the index objects inetCidrRouteDest and
+ inetCidrRoutePfxLen must be consistent. When the value
+ of inetCidrRouteDest (excluding the zone index, if one
+ is present) is x, then the bitwise logical-AND
+ of x with the value of the mask formed from the
+ corresponding index object inetCidrRoutePfxLen MUST be
+ equal to x. If not, then the index pair is not
+ consistent and an inconsistentName error must be
+ returned on SET or CREATE requests.
+ *
+ * Attributes:
+ * accessible 0 isscalar 0 enums 0 hasdefval 0
+ * readable 0 iscolumn 1 ranges 1 hashint 0
+ * settable 0
+ *
+ * Ranges: 0 - 255;
+ *
+ * Its syntax is InetAddress (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 255)
+ *
+ *
+ *
+ * NOTE: NODE inetCidrRouteDest IS NOT ACCESSIBLE
+ *
+ *
+ */
+/**
+ * check validity of inetCidrRouteDest index portion
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ *
+ * @note this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * inetCidrRouteTable_validate_index() function.
+ *
+ * @note Also keep in mind that if the index refers to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ * The following checks have already been done for you:
+ * The length is in (one of) the range set(s): 0 - 255
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ */
+int
+inetCidrRouteDest_check_index(inetCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteDest_check_index",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:426:M: |-> Check inetCidrRouteTable index inetCidrRouteDest.
+ * check that index value in the table context is legal.
+ * (rowreq_ctx->tbl_index.inetCidrRouteDest)
+ */
+
+ return MFD_SUCCESS; /* inetCidrRouteDest index ok */
+} /* inetCidrRouteDest_check_index */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRoutePfxLen
+ * inetCidrRoutePfxLen is subid 3 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is NoAccess.
+ * OID: .1.3.6.1.2.1.4.24.7.1.3
+ * Description:
+Indicates the number of leading one bits which form the
+ mask to be logical-ANDed with the destination address
+ before being compared to the value in the
+ inetCidrRouteDest field.
+
+ The values for the index objects inetCidrRouteDest and
+ inetCidrRoutePfxLen must be consistent. When the value
+ of inetCidrRouteDest (excluding the zone index, if one
+ is present) is x, then the bitwise logical-AND
+ of x with the value of the mask formed from the
+ corresponding index object inetCidrRoutePfxLen MUST be
+ equal to x. If not, then the index pair is not
+ consistent and an inconsistentName error must be
+ returned on SET or CREATE requests.
+ *
+ * Attributes:
+ * accessible 0 isscalar 0 enums 0 hasdefval 0
+ * readable 0 iscolumn 1 ranges 1 hashint 1
+ * settable 0
+ * hint: d
+ *
+ * Ranges: 0 - 2040;
+ *
+ * Its syntax is InetAddressPrefixLength (based on perltype UNSIGNED32)
+ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
+ *
+ *
+ *
+ * NOTE: NODE inetCidrRoutePfxLen IS NOT ACCESSIBLE
+ *
+ *
+ */
+/**
+ * check validity of inetCidrRoutePfxLen index portion
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ *
+ * @note this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * inetCidrRouteTable_validate_index() function.
+ *
+ * @note Also keep in mind that if the index refers to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ * The following checks have already been done for you:
+ * The value is in (one of) the range set(s): 0 - 2040
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ */
+int
+inetCidrRoutePfxLen_check_index(inetCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRoutePfxLen_check_index", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:426:M: |-> Check inetCidrRouteTable index inetCidrRoutePfxLen.
+ * check that index value in the table context is legal.
+ * (rowreq_ctx->tbl_index.inetCidrRoutePfxLen)
+ */
+
+ return MFD_SUCCESS; /* inetCidrRoutePfxLen index ok */
+} /* inetCidrRoutePfxLen_check_index */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRoutePolicy
+ * inetCidrRoutePolicy is subid 4 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is NoAccess.
+ * OID: .1.3.6.1.2.1.4.24.7.1.4
+ * Description:
+This object is an opaque object without any defined
+ semantics. Its purpose is to serve as an additional
+ index which may delineate between multiple entries to
+ the same destination. The value { 0 0 } shall be used
+ as the default value for this object.
+ *
+ * Attributes:
+ * accessible 0 isscalar 0 enums 0 hasdefval 0
+ * readable 0 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is OBJECTID (based on perltype OBJECTID)
+ * The net-snmp type is ASN_OBJECT_ID. The C type decl is oid (oid)
+ * This data type requires a length. (Max 2040)
+ *
+ *
+ *
+ * NOTE: NODE inetCidrRoutePolicy IS NOT ACCESSIBLE
+ *
+ *
+ */
+/**
+ * check validity of inetCidrRoutePolicy index portion
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ *
+ * @note this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * inetCidrRouteTable_validate_index() function.
+ *
+ * @note Also keep in mind that if the index refers to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ * The following checks have already been done for you:
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ */
+int
+inetCidrRoutePolicy_check_index(inetCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRoutePolicy_check_index", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:426:M: |-> Check inetCidrRouteTable index inetCidrRoutePolicy.
+ * check that index value in the table context is legal.
+ * (rowreq_ctx->tbl_index.inetCidrRoutePolicy)
+ */
+
+ return MFD_SUCCESS; /* inetCidrRoutePolicy index ok */
+} /* inetCidrRoutePolicy_check_index */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteNextHopType
+ * inetCidrRouteNextHopType is subid 5 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is NoAccess.
+ * OID: .1.3.6.1.2.1.4.24.7.1.5
+ * Description:
+The type of the inetCidrRouteNextHop address, as
+ defined in the InetAddress MIB.
+
+ Value should be set to unknown(0) for non-remote
+ routes.
+
+ Only those address types that may appear in an actual
+ routing table are allowed as values of this object.
+ *
+ * Attributes:
+ * accessible 0 isscalar 0 enums 1 hasdefval 0
+ * readable 0 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ * Enum range: 5/8. Values: unknown(0), ipv4(1), ipv6(2), ipv4z(3), ipv6z(4), dns(16)
+ *
+ * Its syntax is InetAddressType (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ *
+ *
+ *
+ * NOTE: NODE inetCidrRouteNextHopType IS NOT ACCESSIBLE
+ *
+ *
+ */
+/**
+ * check validity of inetCidrRouteNextHopType index portion
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ *
+ * @note this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * inetCidrRouteTable_validate_index() function.
+ *
+ * @note Also keep in mind that if the index refers to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ * The following checks have already been done for you:
+ * The value is one of unknown(0), ipv4(1), ipv6(2), ipv4z(3), ipv6z(4), dns(16)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ */
+int
+inetCidrRouteNextHopType_check_index(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteNextHopType_check_index", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:426:M: |-> Check inetCidrRouteTable index inetCidrRouteNextHopType.
+ * check that index value in the table context is legal.
+ * (rowreq_ctx->tbl_index.inetCidrRouteNextHopType)
+ */
+ /*
+ * we don't support all types
+ */
+ switch (rowreq_ctx->tbl_idx.inetCidrRouteDestType) {
+
+ case INETADDRESSTYPE_IPV4:
+ case INETADDRESSTYPE_IPV6:
+ break;
+
+ case INETADDRESSTYPE_UNKNOWN:
+ case INETADDRESSTYPE_IPV4Z:
+ case INETADDRESSTYPE_IPV6Z:
+ case INETADDRESSTYPE_DNS:
+ /*
+ * fall through
+ */
+
+ default:
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS; /* inetCidrRouteNextHopType index ok */
+} /* inetCidrRouteNextHopType_check_index */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::inetCidrRouteEntry.inetCidrRouteNextHop
+ * inetCidrRouteNextHop is subid 6 of inetCidrRouteEntry.
+ * Its status is Current, and its access level is NoAccess.
+ * OID: .1.3.6.1.2.1.4.24.7.1.6
+ * Description:
+On remote routes, the address of the next system en
+ route. For non-remote routes, a zero length string.
+
+ The type of this address is determined by the value of
+ the inetCidrRouteNextHopType object.
+ *
+ * Attributes:
+ * accessible 0 isscalar 0 enums 0 hasdefval 0
+ * readable 0 iscolumn 1 ranges 1 hashint 0
+ * settable 0
+ *
+ * Ranges: 0 - 255;
+ *
+ * Its syntax is InetAddress (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 255)
+ *
+ *
+ *
+ * NOTE: NODE inetCidrRouteNextHop IS NOT ACCESSIBLE
+ *
+ *
+ */
+/**
+ * check validity of inetCidrRouteNextHop index portion
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ *
+ * @note this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * inetCidrRouteTable_validate_index() function.
+ *
+ * @note Also keep in mind that if the index refers to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ * The following checks have already been done for you:
+ * The length is in (one of) the range set(s): 0 - 255
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ */
+int
+inetCidrRouteNextHop_check_index(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteNextHop_check_index", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:426:M: |-> Check inetCidrRouteTable index inetCidrRouteNextHop.
+ * check that index value in the table context is legal.
+ * (rowreq_ctx->tbl_index.inetCidrRouteNextHop)
+ */
+
+ return MFD_SUCCESS; /* inetCidrRouteNextHop index ok */
+} /* inetCidrRouteNextHop_check_index */
+
+/**
+ * verify specified index is valid.
+ *
+ * This check is independent of whether or not the values specified for
+ * the columns of the new row are valid. Column values and row consistency
+ * will be checked later. At this point, only the index values should be
+ * checked.
+ *
+ * All of the individual index validation functions have been called, so this
+ * is the place to make sure they are valid as a whole when combined. If
+ * you only have one index, then you probably don't need to do anything else
+ * here.
+ *
+ * @note Keep in mind that if the indexes refer to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ *
+ * @param inetCidrRouteTable_reg
+ * Pointer to the user registration data
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_CANNOT_CREATE_NOW : index not valid right now
+ * @retval MFD_CANNOT_CREATE_EVER : index never valid
+ */
+int
+inetCidrRouteTable_validate_index(inetCidrRouteTable_registration *
+ inetCidrRouteTable_reg,
+ inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_validate_index", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:430:M: |-> Validate potential inetCidrRouteTable index.
+ */
+ if (rowreq_ctx->tbl_idx.inetCidrRouteDestType !=
+ rowreq_ctx->tbl_idx.inetCidrRouteNextHopType) {
+ DEBUGMSGTL(("inetCidrRouteTable:validate_index",
+ "ipv4/v6 cross routing not supported\n"));
+ return MFD_CANNOT_CREATE_EVER;
+ }
+
+ /*
+ * InetAddress
+ */
+ if (((INETADDRESSTYPE_IPV4 ==
+ rowreq_ctx->tbl_idx.inetCidrRouteDestType)
+ && (4 != rowreq_ctx->tbl_idx.inetCidrRouteDest_len))
+ ||
+ ((INETADDRESSTYPE_IPV6 ==
+ rowreq_ctx->tbl_idx.inetCidrRouteDestType)
+ && (16 != rowreq_ctx->tbl_idx.inetCidrRouteDest_len))) {
+ DEBUGMSGTL(("inetCidrRouteTable:validate_index",
+ "dest addr type/size mismatch\n"));
+ return MFD_CANNOT_CREATE_EVER;
+ }
+ /*
+ * InetAddress
+ */
+ if (((INETADDRESSTYPE_IPV4 ==
+ rowreq_ctx->tbl_idx.inetCidrRouteNextHopType)
+ && (4 != rowreq_ctx->tbl_idx.inetCidrRouteNextHop_len))
+ ||
+ ((INETADDRESSTYPE_IPV6 ==
+ rowreq_ctx->tbl_idx.inetCidrRouteNextHopType)
+ && (16 != rowreq_ctx->tbl_idx.inetCidrRouteNextHop_len))) {
+ DEBUGMSGTL(("inetCidrRouteTable:validate_index",
+ "next hop addr type/size mismatch\n"));
+ return MFD_CANNOT_CREATE_EVER;
+ }
+
+ return rc;
+} /* inetCidrRouteTable_validate_index */
+
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_data_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_data_access.h
new file mode 100644
index 0000000000..89048e86b9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_data_access.h
@@ -0,0 +1,86 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: inetCidrRouteTable_data_access.h 13750 2005-11-30 21:07:05Z rstory $
+ */
+#ifndef INETCIDRROUTETABLE_DATA_ACCESS_H
+#define INETCIDRROUTETABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table inetCidrRouteTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-FORWARD-MIB::inetCidrRouteTable is subid 7 of ipForward.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.24.7, length: 9
+ */
+
+
+ int
+ inetCidrRouteTable_init_data(inetCidrRouteTable_registration *
+ inetCidrRouteTable_reg);
+
+
+ /*
+ * TODO:180:o: Review inetCidrRouteTable cache timeout.
+ * The number of seconds before the cache times out
+ */
+#define INETCIDRROUTETABLE_CACHE_TIMEOUT 60
+
+ void inetCidrRouteTable_container_init(netsnmp_container
+ **container_ptr_ptr,
+ netsnmp_cache *
+ cache);
+ void inetCidrRouteTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int inetCidrRouteTable_container_load(netsnmp_container
+ *container);
+ void inetCidrRouteTable_container_free(netsnmp_container
+ *container);
+
+ int inetCidrRouteTable_cache_load(netsnmp_container
+ *container);
+ void inetCidrRouteTable_cache_free(netsnmp_container
+ *container);
+
+ int
+ inetCidrRouteTable_row_prep(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ inetCidrRouteTable_validate_index(inetCidrRouteTable_registration *
+ inetCidrRouteTable_reg,
+ inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetCidrRouteDestType_check_index(inetCidrRouteTable_rowreq_ctx * rowreq_ctx); /* internal */
+ int inetCidrRouteDest_check_index(inetCidrRouteTable_rowreq_ctx * rowreq_ctx); /* internal */
+ int inetCidrRoutePfxLen_check_index(inetCidrRouteTable_rowreq_ctx * rowreq_ctx); /* internal */
+ int inetCidrRoutePolicy_check_index(inetCidrRouteTable_rowreq_ctx * rowreq_ctx); /* internal */
+ int inetCidrRouteNextHopType_check_index(inetCidrRouteTable_rowreq_ctx * rowreq_ctx); /* internal */
+ int inetCidrRouteNextHop_check_index(inetCidrRouteTable_rowreq_ctx * rowreq_ctx); /* internal */
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* INETCIDRROUTETABLE_DATA_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_interface.c
new file mode 100644
index 0000000000..8b6e1d9fce
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_interface.c
@@ -0,0 +1,2366 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: inetCidrRouteTable_interface.c 15781 2007-01-23 22:55:06Z rstory $
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "inetCidrRouteTable.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "inetCidrRouteTable_interface.h"
+
+#include <ctype.h>
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table inetCidrRouteTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-FORWARD-MIB::inetCidrRouteTable is subid 7 of ipForward.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.24.7, length: 9
+ */
+typedef struct inetCidrRouteTable_interface_ctx_s {
+
+ netsnmp_container *container;
+ netsnmp_cache *cache;
+
+ inetCidrRouteTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+ u_int table_dirty;
+
+} inetCidrRouteTable_interface_ctx;
+
+static inetCidrRouteTable_interface_ctx inetCidrRouteTable_if_ctx;
+
+static void
+ _inetCidrRouteTable_container_init(inetCidrRouteTable_interface_ctx *
+ if_ctx);
+static void
+ _inetCidrRouteTable_container_shutdown(inetCidrRouteTable_interface_ctx *
+ if_ctx);
+
+
+netsnmp_container *
+inetCidrRouteTable_container_get(void)
+{
+ return inetCidrRouteTable_if_ctx.container;
+}
+
+inetCidrRouteTable_registration *
+inetCidrRouteTable_registration_get(void)
+{
+ return inetCidrRouteTable_if_ctx.user_ctx;
+}
+
+inetCidrRouteTable_registration *
+inetCidrRouteTable_registration_set(inetCidrRouteTable_registration *
+ newreg)
+{
+ inetCidrRouteTable_registration *old =
+ inetCidrRouteTable_if_ctx.user_ctx;
+ inetCidrRouteTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+
+int
+inetCidrRouteTable_container_size(void)
+{
+ return CONTAINER_SIZE(inetCidrRouteTable_if_ctx.container);
+}
+
+u_int
+inetCidrRouteTable_dirty_get(void)
+{
+ return inetCidrRouteTable_if_ctx.table_dirty;
+}
+
+void
+inetCidrRouteTable_dirty_set(u_int status)
+{
+ DEBUGMSGTL(("inetCidrRouteTable:inetCidrRouteTable_dirty_set",
+ "called. was %d, now %d\n",
+ inetCidrRouteTable_if_ctx.table_dirty, status));
+ inetCidrRouteTable_if_ctx.table_dirty = status;
+}
+
+netsnmp_cache *
+inetCidrRouteTable_get_cache(void)
+{
+ return inetCidrRouteTable_if_ctx.cache;
+}
+
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_inetCidrRouteTable_pre_request;
+static Netsnmp_Node_Handler _mfd_inetCidrRouteTable_post_request;
+static Netsnmp_Node_Handler _mfd_inetCidrRouteTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_inetCidrRouteTable_get_values;
+static Netsnmp_Node_Handler _mfd_inetCidrRouteTable_check_objects;
+static Netsnmp_Node_Handler _mfd_inetCidrRouteTable_undo_setup;
+static Netsnmp_Node_Handler _mfd_inetCidrRouteTable_set_values;
+static Netsnmp_Node_Handler _mfd_inetCidrRouteTable_undo_cleanup;
+static Netsnmp_Node_Handler _mfd_inetCidrRouteTable_undo_values;
+static Netsnmp_Node_Handler _mfd_inetCidrRouteTable_commit;
+static Netsnmp_Node_Handler _mfd_inetCidrRouteTable_undo_commit;
+static Netsnmp_Node_Handler _mfd_inetCidrRouteTable_irreversible_commit;
+static Netsnmp_Node_Handler _mfd_inetCidrRouteTable_check_dependencies;
+
+NETSNMP_STATIC_INLINE int
+ _inetCidrRouteTable_check_indexes(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+/**
+ * @internal
+ * Initialize the table inetCidrRouteTable
+ * (Define its contents and how it's structured)
+ */
+void
+_inetCidrRouteTable_initialize_interface(inetCidrRouteTable_registration *
+ reg_ptr, u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &inetCidrRouteTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info =
+ &inetCidrRouteTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_inetCidrRouteTable_initialize_interface", "called\n"));
+
+
+ /*************************************************
+ *
+ * save interface context for inetCidrRouteTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
+ /** index: inetCidrRouteDestType */
+ ASN_OCTET_STR,
+ /** index: inetCidrRouteDest */
+ ASN_UNSIGNED,
+ /** index: inetCidrRoutePfxLen */
+ ASN_OBJECT_ID,
+ /** index: inetCidrRoutePolicy */
+ ASN_INTEGER,
+ /** index: inetCidrRouteNextHopType */
+ ASN_OCTET_STR,
+ /** index: inetCidrRouteNextHop */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrival.
+ */
+ tbl_info->min_column = INETCIDRROUTETABLE_MIN_COL;
+ tbl_info->max_column = INETCIDRROUTETABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ inetCidrRouteTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ inetCidrRouteTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _inetCidrRouteTable_container_init(&inetCidrRouteTable_if_ctx);
+ if (NULL == inetCidrRouteTable_if_ctx.container) {
+ snmp_log(LOG_ERR,
+ "could not initialize container for inetCidrRouteTable\n");
+ return;
+ }
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup =
+ _mfd_inetCidrRouteTable_object_lookup;
+ access_multiplexer->get_values = _mfd_inetCidrRouteTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request = _mfd_inetCidrRouteTable_pre_request;
+ access_multiplexer->post_request =
+ _mfd_inetCidrRouteTable_post_request;
+
+
+ /*
+ * REQUIRED wrappers for set request handling
+ */
+ access_multiplexer->object_syntax_checks =
+ _mfd_inetCidrRouteTable_check_objects;
+ access_multiplexer->undo_setup = _mfd_inetCidrRouteTable_undo_setup;
+ access_multiplexer->undo_cleanup =
+ _mfd_inetCidrRouteTable_undo_cleanup;
+ access_multiplexer->set_values = _mfd_inetCidrRouteTable_set_values;
+ access_multiplexer->undo_sets = _mfd_inetCidrRouteTable_undo_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->commit = _mfd_inetCidrRouteTable_commit;
+ access_multiplexer->undo_commit = _mfd_inetCidrRouteTable_undo_commit;
+ access_multiplexer->irreversible_commit =
+ _mfd_inetCidrRouteTable_irreversible_commit;
+
+ /*
+ * REQUIRED for tables with dependencies
+ */
+ access_multiplexer->consistency_checks =
+ _mfd_inetCidrRouteTable_check_dependencies;
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("inetCidrRouteTable:init_inetCidrRouteTable",
+ "Registering inetCidrRouteTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("inetCidrRouteTable", handler,
+ inetCidrRouteTable_oid,
+ inetCidrRouteTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RWRITE);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR, "error registering table inetCidrRouteTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &inetCidrRouteTable_if_ctx;
+
+ /*************************************************
+ *
+ * set up baby steps handler, create it and inject it
+ */
+ if (access_multiplexer->object_lookup)
+ mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
+ if (access_multiplexer->set_values)
+ mfd_modes |= BABY_STEP_SET_VALUES;
+ if (access_multiplexer->irreversible_commit)
+ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
+ if (access_multiplexer->object_syntax_checks)
+ mfd_modes |= BABY_STEP_CHECK_OBJECT;
+
+ if (access_multiplexer->pre_request)
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if (access_multiplexer->post_request)
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+ if (access_multiplexer->undo_setup)
+ mfd_modes |= BABY_STEP_UNDO_SETUP;
+ if (access_multiplexer->undo_cleanup)
+ mfd_modes |= BABY_STEP_UNDO_CLEANUP;
+ if (access_multiplexer->undo_sets)
+ mfd_modes |= BABY_STEP_UNDO_SETS;
+
+ if (access_multiplexer->row_creation)
+ mfd_modes |= BABY_STEP_ROW_CREATE;
+ if (access_multiplexer->consistency_checks)
+ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
+ if (access_multiplexer->commit)
+ mfd_modes |= BABY_STEP_COMMIT;
+ if (access_multiplexer->undo_commit)
+ mfd_modes |= BABY_STEP_UNDO_COMMIT;
+
+ handler = netsnmp_baby_steps_handler_get(mfd_modes);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
+ */
+ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler =
+ netsnmp_container_table_handler_get(tbl_info,
+ inetCidrRouteTable_if_ctx.
+ container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject cache helper
+ */
+ if (NULL != inetCidrRouteTable_if_ctx.cache) {
+ handler =
+ netsnmp_cache_handler_get(inetCidrRouteTable_if_ctx.cache);
+ netsnmp_inject_handler(reginfo, handler);
+ }
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+} /* _inetCidrRouteTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table inetCidrRouteTable
+ */
+void
+_inetCidrRouteTable_shutdown_interface(inetCidrRouteTable_registration *
+ reg_ptr)
+{
+ /*
+ * shutdown the container
+ */
+ _inetCidrRouteTable_container_shutdown(&inetCidrRouteTable_if_ctx);
+}
+
+void
+inetCidrRouteTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ inetCidrRouteTable_if_ctx.tbl_info.valid_columns = vc;
+} /* inetCidrRouteTable_valid_columns_set */
+
+/**
+ * @internal
+ * convert the index component stored in the context to an oid
+ */
+int
+inetCidrRouteTable_index_to_oid(netsnmp_index * oid_idx,
+ inetCidrRouteTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * inetCidrRouteDestType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_inetCidrRouteDestType;
+ /*
+ * inetCidrRouteDest(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_inetCidrRouteDest;
+ /*
+ * inetCidrRoutePfxLen(3)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_inetCidrRoutePfxLen;
+ /*
+ * inetCidrRoutePolicy(4)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
+ */
+ netsnmp_variable_list var_inetCidrRoutePolicy;
+ /*
+ * inetCidrRouteNextHopType(5)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_inetCidrRouteNextHopType;
+ /*
+ * inetCidrRouteNextHop(6)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_inetCidrRouteNextHop;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_inetCidrRouteDestType, 0x00,
+ sizeof(var_inetCidrRouteDestType));
+ var_inetCidrRouteDestType.type = ASN_INTEGER;
+ memset(&var_inetCidrRouteDest, 0x00, sizeof(var_inetCidrRouteDest));
+ var_inetCidrRouteDest.type = ASN_OCTET_STR;
+ memset(&var_inetCidrRoutePfxLen, 0x00,
+ sizeof(var_inetCidrRoutePfxLen));
+ var_inetCidrRoutePfxLen.type = ASN_UNSIGNED;
+ memset(&var_inetCidrRoutePolicy, 0x00,
+ sizeof(var_inetCidrRoutePolicy));
+ var_inetCidrRoutePolicy.type = ASN_OBJECT_ID;
+ memset(&var_inetCidrRouteNextHopType, 0x00,
+ sizeof(var_inetCidrRouteNextHopType));
+ var_inetCidrRouteNextHopType.type = ASN_INTEGER;
+ memset(&var_inetCidrRouteNextHop, 0x00,
+ sizeof(var_inetCidrRouteNextHop));
+ var_inetCidrRouteNextHop.type = ASN_OCTET_STR;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_inetCidrRouteDestType.next_variable = &var_inetCidrRouteDest;
+ var_inetCidrRouteDest.next_variable = &var_inetCidrRoutePfxLen;
+ var_inetCidrRoutePfxLen.next_variable = &var_inetCidrRoutePolicy;
+ var_inetCidrRoutePolicy.next_variable = &var_inetCidrRouteNextHopType;
+ var_inetCidrRouteNextHopType.next_variable = &var_inetCidrRouteNextHop;
+ var_inetCidrRouteNextHop.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_index_to_oid", "called\n"));
+
+ /*
+ * inetCidrRouteDestType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ snmp_set_var_value(&var_inetCidrRouteDestType,
+ (u_char *) & mib_idx->inetCidrRouteDestType,
+ sizeof(mib_idx->inetCidrRouteDestType));
+
+ /*
+ * inetCidrRouteDest(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_inetCidrRouteDest,
+ (u_char *) & mib_idx->inetCidrRouteDest,
+ mib_idx->inetCidrRouteDest_len *
+ sizeof(mib_idx->inetCidrRouteDest[0]));
+
+ /*
+ * inetCidrRoutePfxLen(3)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ snmp_set_var_value(&var_inetCidrRoutePfxLen,
+ (u_char *) & mib_idx->inetCidrRoutePfxLen,
+ sizeof(mib_idx->inetCidrRoutePfxLen));
+
+ /*
+ * inetCidrRoutePolicy(4)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
+ */
+ snmp_set_var_value(&var_inetCidrRoutePolicy,
+ (u_char *) & mib_idx->inetCidrRoutePolicy,
+ mib_idx->inetCidrRoutePolicy_len *
+ sizeof(mib_idx->inetCidrRoutePolicy[0]));
+
+ /*
+ * inetCidrRouteNextHopType(5)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ snmp_set_var_value(&var_inetCidrRouteNextHopType,
+ (u_char *) & mib_idx->inetCidrRouteNextHopType,
+ sizeof(mib_idx->inetCidrRouteNextHopType));
+
+ /*
+ * inetCidrRouteNextHop(6)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_inetCidrRouteNextHop,
+ (u_char *) & mib_idx->inetCidrRouteNextHop,
+ mib_idx->inetCidrRouteNextHop_len *
+ sizeof(mib_idx->inetCidrRouteNextHop[0]));
+
+
+ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
+ NULL, 0, &var_inetCidrRouteDestType);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_inetCidrRouteDestType);
+
+ return err;
+} /* inetCidrRouteTable_index_to_oid */
+
+/**
+ * extract inetCidrRouteTable indexes from a netsnmp_index
+ *
+ * @retval SNMP_ERR_NOERROR : no error
+ * @retval SNMP_ERR_GENERR : error
+ */
+int
+inetCidrRouteTable_index_from_oid(netsnmp_index * oid_idx,
+ inetCidrRouteTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * inetCidrRouteDestType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_inetCidrRouteDestType;
+ /*
+ * inetCidrRouteDest(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_inetCidrRouteDest;
+ /*
+ * inetCidrRoutePfxLen(3)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_inetCidrRoutePfxLen;
+ /*
+ * inetCidrRoutePolicy(4)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
+ */
+ netsnmp_variable_list var_inetCidrRoutePolicy;
+ /*
+ * inetCidrRouteNextHopType(5)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_inetCidrRouteNextHopType;
+ /*
+ * inetCidrRouteNextHop(6)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_inetCidrRouteNextHop;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_inetCidrRouteDestType, 0x00,
+ sizeof(var_inetCidrRouteDestType));
+ var_inetCidrRouteDestType.type = ASN_INTEGER;
+ memset(&var_inetCidrRouteDest, 0x00, sizeof(var_inetCidrRouteDest));
+ var_inetCidrRouteDest.type = ASN_OCTET_STR;
+ memset(&var_inetCidrRoutePfxLen, 0x00,
+ sizeof(var_inetCidrRoutePfxLen));
+ var_inetCidrRoutePfxLen.type = ASN_UNSIGNED;
+ memset(&var_inetCidrRoutePolicy, 0x00,
+ sizeof(var_inetCidrRoutePolicy));
+ var_inetCidrRoutePolicy.type = ASN_OBJECT_ID;
+ memset(&var_inetCidrRouteNextHopType, 0x00,
+ sizeof(var_inetCidrRouteNextHopType));
+ var_inetCidrRouteNextHopType.type = ASN_INTEGER;
+ memset(&var_inetCidrRouteNextHop, 0x00,
+ sizeof(var_inetCidrRouteNextHop));
+ var_inetCidrRouteNextHop.type = ASN_OCTET_STR;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_inetCidrRouteDestType.next_variable = &var_inetCidrRouteDest;
+ var_inetCidrRouteDest.next_variable = &var_inetCidrRoutePfxLen;
+ var_inetCidrRoutePfxLen.next_variable = &var_inetCidrRoutePolicy;
+ var_inetCidrRoutePolicy.next_variable = &var_inetCidrRouteNextHopType;
+ var_inetCidrRouteNextHopType.next_variable = &var_inetCidrRouteNextHop;
+ var_inetCidrRouteNextHop.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:inetCidrRouteTable:inetCidrRouteTable_index_from_oid", "called\n"));
+
+ /*
+ * parse the oid into the individual index components
+ */
+ err = parse_oid_indexes(oid_idx->oids, oid_idx->len,
+ &var_inetCidrRouteDestType);
+ if (err == SNMP_ERR_NOERROR) {
+ /*
+ * copy out values
+ */
+ mib_idx->inetCidrRouteDestType =
+ *((u_long *) var_inetCidrRouteDestType.val.string);
+ /*
+ * NOTE: val_len is in bytes, inetCidrRouteDest_len might not be
+ */
+ if (var_inetCidrRouteDest.val_len >
+ sizeof(mib_idx->inetCidrRouteDest))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->inetCidrRouteDest,
+ var_inetCidrRouteDest.val.string,
+ var_inetCidrRouteDest.val_len);
+ mib_idx->inetCidrRouteDest_len =
+ var_inetCidrRouteDest.val_len /
+ sizeof(mib_idx->inetCidrRouteDest[0]);
+ }
+ mib_idx->inetCidrRoutePfxLen =
+ *((u_long *) var_inetCidrRoutePfxLen.val.string);
+ /*
+ * NOTE: val_len is in bytes, inetCidrRoutePolicy_len might not be
+ */
+ if (var_inetCidrRoutePolicy.val_len >
+ sizeof(mib_idx->inetCidrRoutePolicy))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->inetCidrRoutePolicy,
+ var_inetCidrRoutePolicy.val.string,
+ var_inetCidrRoutePolicy.val_len);
+ mib_idx->inetCidrRoutePolicy_len =
+ var_inetCidrRoutePolicy.val_len /
+ sizeof(mib_idx->inetCidrRoutePolicy[0]);
+ }
+ mib_idx->inetCidrRouteNextHopType =
+ *((u_long *) var_inetCidrRouteNextHopType.val.string);
+ /*
+ * NOTE: val_len is in bytes, inetCidrRouteNextHop_len might not be
+ */
+ if (var_inetCidrRouteNextHop.val_len >
+ sizeof(mib_idx->inetCidrRouteNextHop))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->inetCidrRouteNextHop,
+ var_inetCidrRouteNextHop.val.string,
+ var_inetCidrRouteNextHop.val_len);
+ mib_idx->inetCidrRouteNextHop_len =
+ var_inetCidrRouteNextHop.val_len /
+ sizeof(mib_idx->inetCidrRouteNextHop[0]);
+ }
+
+
+ }
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_inetCidrRouteDestType);
+
+ return err;
+} /* inetCidrRouteTable_index_from_oid */
+
+
+/*
+ *********************************************************************
+ * @internal
+ * allocate resources for a inetCidrRouteTable_rowreq_ctx
+ */
+inetCidrRouteTable_rowreq_ctx *
+inetCidrRouteTable_allocate_rowreq_ctx(inetCidrRouteTable_data * data,
+ void *user_init_ctx)
+{
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ SNMP_MALLOC_TYPEDEF(inetCidrRouteTable_rowreq_ctx);
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:inetCidrRouteTable_allocate_rowreq_ctx", "called\n"));
+
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "Couldn't allocate memory for a "
+ "inetCidrRouteTable_rowreq_ctx.\n");
+ return NULL;
+ } else {
+ if (NULL != data) {
+ /*
+ * track if we got data from user
+ */
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DATA_FROM_USER;
+ rowreq_ctx->data = data;
+ } else if (NULL ==
+ (rowreq_ctx->data =
+ inetCidrRouteTable_allocate_data())) {
+ SNMP_FREE(rowreq_ctx);
+ return NULL;
+ }
+ }
+
+ /*
+ * undo context will be allocated when needed (in *_undo_setup)
+ */
+
+ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
+
+ rowreq_ctx->inetCidrRouteTable_data_list = NULL;
+
+ /*
+ * if we allocated data, call init routine
+ */
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) {
+ if (SNMPERR_SUCCESS !=
+ inetCidrRouteTable_rowreq_ctx_init(rowreq_ctx,
+ user_init_ctx)) {
+ inetCidrRouteTable_release_rowreq_ctx(rowreq_ctx);
+ rowreq_ctx = NULL;
+ }
+ }
+
+ return rowreq_ctx;
+} /* inetCidrRouteTable_allocate_rowreq_ctx */
+
+/*
+ * @internal
+ * release resources for a inetCidrRouteTable_rowreq_ctx
+ */
+void
+inetCidrRouteTable_release_rowreq_ctx(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("internal:inetCidrRouteTable:inetCidrRouteTable_release_rowreq_ctx", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ inetCidrRouteTable_rowreq_ctx_cleanup(rowreq_ctx);
+
+ /*
+ * for non-transient data, don't free data we got from the user
+ */
+ if ((rowreq_ctx->data) &&
+ !(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER))
+ inetCidrRouteTable_release_data(rowreq_ctx->data);
+
+ if (rowreq_ctx->undo)
+ inetCidrRouteTable_release_data(rowreq_ctx->undo);
+
+ /*
+ * free index oid pointer
+ */
+ if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp)
+ free(rowreq_ctx->oid_idx.oids);
+
+ SNMP_FREE(rowreq_ctx);
+} /* inetCidrRouteTable_release_rowreq_ctx */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_inetCidrRouteTable_pre_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_pre_request", "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:inetCidrRouteTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = inetCidrRouteTable_pre_request(inetCidrRouteTable_if_ctx.
+ user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("inetCidrRouteTable", "error %d from "
+ "inetCidrRouteTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetCidrRouteTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_inetCidrRouteTable_post_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_post_request", "called\n"));
+
+ /*
+ * release row context, if deleted
+ */
+ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
+ inetCidrRouteTable_release_rowreq_ctx(rowreq_ctx);
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:inetCidrRouteTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ if ((MFD_SUCCESS != packet_rc) && inetCidrRouteTable_dirty_get()) {
+ /*
+ * we shouldn't get here. the undo steps should also clear
+ * the dirty flags.
+ */
+ snmp_log(LOG_WARNING,
+ "inetCidrRouteTable dirty flag set in post_request "
+ "but status != SUCCESS.\n");
+ }
+
+ rc = inetCidrRouteTable_post_request(inetCidrRouteTable_if_ctx.
+ user_ctx, packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("inetCidrRouteTable", "error %d from "
+ "inetCidrRouteTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetCidrRouteTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static inetCidrRouteTable_rowreq_ctx *
+_mfd_inetCidrRouteTable_rowreq_from_index(netsnmp_index * oid_idx,
+ int *rc_ptr)
+{
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx;
+ inetCidrRouteTable_mib_index mib_idx;
+ int rc;
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_rowreq_from_index", "called\n"));
+
+ if (NULL == rc_ptr)
+ rc_ptr = &rc;
+ *rc_ptr = MFD_SUCCESS;
+
+ memset(&mib_idx, 0x0, sizeof(mib_idx));
+
+ /*
+ * try to parse oid
+ */
+ *rc_ptr = inetCidrRouteTable_index_from_oid(oid_idx, &mib_idx);
+ if (MFD_SUCCESS != *rc_ptr) {
+ DEBUGMSGT(("inetCidrRouteTable", "error parsing index\n"));
+ return NULL;
+ }
+
+ /*
+ * allocate new context
+ */
+ rowreq_ctx = inetCidrRouteTable_allocate_rowreq_ctx(NULL, NULL);
+ if (NULL == rowreq_ctx) {
+ *rc_ptr = MFD_ERROR;
+ return NULL; /* msg already logged */
+ }
+
+ memcpy(&rowreq_ctx->tbl_idx, &mib_idx, sizeof(mib_idx));
+
+ /*
+ * check indexes
+ */
+ *rc_ptr = _inetCidrRouteTable_check_indexes(rowreq_ctx);
+ if (MFD_SUCCESS != *rc_ptr) {
+ netsnmp_assert((*rc_ptr == SNMP_ERR_NOCREATION) ||
+ (*rc_ptr == SNMP_ERR_INCONSISTENTNAME));
+ inetCidrRouteTable_release_rowreq_ctx(rowreq_ctx);
+ return NULL;
+ }
+
+ /*
+ * copy indexes
+ */
+ rowreq_ctx->oid_idx.len = oid_idx->len;
+ memcpy(rowreq_ctx->oid_idx.oids, oid_idx->oids,
+ oid_idx->len * sizeof(oid));
+
+ return rowreq_ctx;
+} /* _mfd_inetCidrRouteTable_rowreq_from_index */
+
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_inetCidrRouteTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = SNMP_ERR_NOERROR;
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_object_lookup", "called\n"));
+
+ /*
+ * get our context from mfd
+ * inetCidrRouteTable_interface_ctx *if_ctx =
+ * (inetCidrRouteTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if (NULL == rowreq_ctx) {
+ netsnmp_table_request_info *tblreq_info;
+ netsnmp_index oid_idx;
+
+ tblreq_info = netsnmp_extract_table_info(requests);
+ if (NULL == tblreq_info) {
+ snmp_log(LOG_ERR, "request had no table info\n");
+ return MFD_ERROR;
+ }
+
+ /*
+ * try create rowreq
+ */
+ oid_idx.oids = tblreq_info->index_oid;
+ oid_idx.len = tblreq_info->index_oid_len;
+
+ rowreq_ctx =
+ _mfd_inetCidrRouteTable_rowreq_from_index(&oid_idx, &rc);
+ if (MFD_SUCCESS == rc) {
+ netsnmp_assert(NULL != rowreq_ctx);
+ rowreq_ctx->rowreq_flags |= MFD_ROW_CREATED;
+ /*
+ * add rowreq_ctx to request data lists
+ */
+ netsnmp_container_table_row_insert(requests, (netsnmp_index *)
+ rowreq_ctx);
+ }
+ }
+
+ if (MFD_SUCCESS != rc)
+ netsnmp_request_set_error_all(requests, rc);
+ else
+ inetCidrRouteTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_inetCidrRouteTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_inetCidrRouteTable_get_column(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_get_column", "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * inetCidrRouteIfIndex(7)/InterfaceIndexOrZero/ASN_INTEGER/long(long)//l/A/W/e/R/d/H
+ */
+ case COLUMN_INETCIDRROUTEIFINDEX:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = inetCidrRouteIfIndex_get(rowreq_ctx,
+ (long *) var->val.string);
+ break;
+
+ /*
+ * inetCidrRouteType(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_INETCIDRROUTETYPE:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = inetCidrRouteType_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * inetCidrRouteProto(9)/IANAipRouteProtocol/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_INETCIDRROUTEPROTO:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = inetCidrRouteProto_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * inetCidrRouteAge(10)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_INETCIDRROUTEAGE:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_GAUGE;
+ rc = inetCidrRouteAge_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * inetCidrRouteNextHopAS(11)/InetAutonomousSystemNumber/ASN_UNSIGNED/u_long(u_long)//l/A/W/e/r/D/H
+ */
+ case COLUMN_INETCIDRROUTENEXTHOPAS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_UNSIGNED;
+ rc = inetCidrRouteNextHopAS_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * inetCidrRouteMetric1(12)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC1:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = inetCidrRouteMetric1_get(rowreq_ctx,
+ (long *) var->val.string);
+ break;
+
+ /*
+ * inetCidrRouteMetric2(13)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC2:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = inetCidrRouteMetric2_get(rowreq_ctx,
+ (long *) var->val.string);
+ break;
+
+ /*
+ * inetCidrRouteMetric3(14)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC3:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = inetCidrRouteMetric3_get(rowreq_ctx,
+ (long *) var->val.string);
+ break;
+
+ /*
+ * inetCidrRouteMetric4(15)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC4:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = inetCidrRouteMetric4_get(rowreq_ctx,
+ (long *) var->val.string);
+ break;
+
+ /*
+ * inetCidrRouteMetric5(16)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC5:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = inetCidrRouteMetric5_get(rowreq_ctx,
+ (long *) var->val.string);
+ break;
+
+ /*
+ * inetCidrRouteStatus(17)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_INETCIDRROUTESTATUS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = inetCidrRouteStatus_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _inetCidrRouteTable_get_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _inetCidrRouteTable_get_column */
+
+int
+_mfd_inetCidrRouteTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ u_char *old_string;
+ void (*dataFreeHook) (void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_get_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+ /*
+ * save old pointer, so we can free it if replaced
+ */
+ old_string = requests->requestvb->val.string;
+ dataFreeHook = requests->requestvb->dataFreeHook;
+ if (NULL == requests->requestvb->val.string) {
+ requests->requestvb->val.string = requests->requestvb->buf;
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ } else if (requests->requestvb->buf ==
+ requests->requestvb->val.string) {
+ if (requests->requestvb->val_len !=
+ sizeof(requests->requestvb->buf))
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ }
+
+ /*
+ * get column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _inetCidrRouteTable_get_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ if (MFD_SKIP == rc) {
+ requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+ rc = SNMP_ERR_NOERROR;
+ }
+ } else if (NULL == requests->requestvb->val.string) {
+ snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
+ rc = SNMP_ERR_GENERR;
+ }
+ if (rc)
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+
+ /*
+ * if the buffer wasn't used previously for the old data (i.e. it
+ * was allcoated memory) and the get routine replaced the pointer,
+ * we need to free the previous pointer.
+ */
+ if (old_string && (old_string != requests->requestvb->buf) &&
+ (requests->requestvb->val.string != old_string)) {
+ if (dataFreeHook)
+ (*dataFreeHook) (old_string);
+ else
+ free(old_string);
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetCidrRouteTable_get_values */
+
+NETSNMP_STATIC_INLINE int
+_inetCidrRouteTable_check_indexes(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_inetCidrRouteTable_check_indexes", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+
+ /*
+ * (INDEX) inetCidrRouteDestType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (rowreq_ctx->tbl_idx.inetCidrRouteDestType !=
+ INETADDRESSTYPE_UNKNOWN)
+ && (rowreq_ctx->tbl_idx.inetCidrRouteDestType !=
+ INETADDRESSTYPE_IPV4)
+ && (rowreq_ctx->tbl_idx.inetCidrRouteDestType !=
+ INETADDRESSTYPE_IPV6)
+ && (rowreq_ctx->tbl_idx.inetCidrRouteDestType !=
+ INETADDRESSTYPE_IPV4Z)
+ && (rowreq_ctx->tbl_idx.inetCidrRouteDestType !=
+ INETADDRESSTYPE_IPV6Z)
+ && (rowreq_ctx->tbl_idx.inetCidrRouteDestType !=
+ INETADDRESSTYPE_DNS)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (MFD_SUCCESS != rc)
+ return rc;
+ rc = inetCidrRouteDestType_check_index(rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+ /*
+ * (INDEX) inetCidrRouteDest(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ /*
+ * check defined range(s).
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && ((rowreq_ctx->tbl_idx.inetCidrRouteDest_len < 0)
+ || (rowreq_ctx->tbl_idx.inetCidrRouteDest_len > 255))
+ ) {
+ rc = SNMP_ERR_WRONGLENGTH;
+ }
+ if (MFD_SUCCESS != rc)
+ return rc;
+ rc = inetCidrRouteDest_check_index(rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+ /*
+ * (INDEX) inetCidrRoutePfxLen(3)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ /*
+ * check defined range(s).
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && ((rowreq_ctx->tbl_idx.inetCidrRoutePfxLen < 0)
+ || (rowreq_ctx->tbl_idx.inetCidrRoutePfxLen > 2040))
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (MFD_SUCCESS != rc)
+ return rc;
+ rc = inetCidrRoutePfxLen_check_index(rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+ /*
+ * (INDEX) inetCidrRoutePolicy(4)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
+ */
+ if (MFD_SUCCESS != rc)
+ return rc;
+ rc = inetCidrRoutePolicy_check_index(rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+ /*
+ * (INDEX) inetCidrRouteNextHopType(5)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (rowreq_ctx->tbl_idx.inetCidrRouteNextHopType !=
+ INETADDRESSTYPE_UNKNOWN)
+ && (rowreq_ctx->tbl_idx.inetCidrRouteNextHopType !=
+ INETADDRESSTYPE_IPV4)
+ && (rowreq_ctx->tbl_idx.inetCidrRouteNextHopType !=
+ INETADDRESSTYPE_IPV6)
+ && (rowreq_ctx->tbl_idx.inetCidrRouteNextHopType !=
+ INETADDRESSTYPE_IPV4Z)
+ && (rowreq_ctx->tbl_idx.inetCidrRouteNextHopType !=
+ INETADDRESSTYPE_IPV6Z)
+ && (rowreq_ctx->tbl_idx.inetCidrRouteNextHopType !=
+ INETADDRESSTYPE_DNS)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (MFD_SUCCESS != rc)
+ return rc;
+ rc = inetCidrRouteNextHopType_check_index(rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+ /*
+ * (INDEX) inetCidrRouteNextHop(6)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ /*
+ * check defined range(s).
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && ((rowreq_ctx->tbl_idx.inetCidrRouteNextHop_len < 0)
+ || (rowreq_ctx->tbl_idx.inetCidrRouteNextHop_len > 255))
+ ) {
+ rc = SNMP_ERR_WRONGLENGTH;
+ }
+ if (MFD_SUCCESS != rc)
+ return rc;
+ rc = inetCidrRouteNextHop_check_index(rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+ /*
+ * if individual parts look ok, check them as a whole
+ */
+ return inetCidrRouteTable_validate_index(inetCidrRouteTable_if_ctx.
+ user_ctx, rowreq_ctx);
+} /* _inetCidrRouteTable_check_indexes */
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Syntax checks
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check the syntax for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_inetCidrRouteTable_check_column(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, netsnmp_variable_list * var,
+ int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_inetCidrRouteTable_check_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+ /*
+ * (INDEX) inetCidrRouteDestType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ case COLUMN_INETCIDRROUTEDESTTYPE:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+ /*
+ * (INDEX) inetCidrRouteDest(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ case COLUMN_INETCIDRROUTEDEST:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+ /*
+ * (INDEX) inetCidrRoutePfxLen(3)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ case COLUMN_INETCIDRROUTEPFXLEN:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+ /*
+ * (INDEX) inetCidrRoutePolicy(4)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
+ */
+ case COLUMN_INETCIDRROUTEPOLICY:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+ /*
+ * (INDEX) inetCidrRouteNextHopType(5)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ case COLUMN_INETCIDRROUTENEXTHOPTYPE:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+ /*
+ * (INDEX) inetCidrRouteNextHop(6)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ case COLUMN_INETCIDRROUTENEXTHOP:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+
+ /*
+ * inetCidrRouteIfIndex(7)/InterfaceIndexOrZero/ASN_INTEGER/long(long)//l/A/W/e/R/d/H
+ */
+ case COLUMN_INETCIDRROUTEIFINDEX:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ /*
+ * check defined range(s).
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && ((*var->val.integer < 0)
+ || (*var->val.integer > 2147483647))
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("inetCidrRouteTable:_inetCidrRouteTable_check_column:inetCidrRouteIfIndex", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = inetCidrRouteIfIndex_check_value(rowreq_ctx,
+ *((long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from inetCidrRouteIfIndex_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * inetCidrRouteType(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_INETCIDRROUTETYPE:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (*var->val.integer != INETCIDRROUTETYPE_OTHER)
+ && (*var->val.integer != INETCIDRROUTETYPE_REJECT)
+ && (*var->val.integer != INETCIDRROUTETYPE_LOCAL)
+ && (*var->val.integer != INETCIDRROUTETYPE_REMOTE)
+ && (*var->val.integer != INETCIDRROUTETYPE_BLACKHOLE)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("inetCidrRouteTable:_inetCidrRouteTable_check_column:inetCidrRouteType", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = inetCidrRouteType_check_value(rowreq_ctx,
+ *((u_long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from inetCidrRouteType_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * inetCidrRouteProto(9)/IANAipRouteProtocol/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_INETCIDRROUTEPROTO:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * inetCidrRouteAge(10)/GAUGE/ASN_GAUGE/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_INETCIDRROUTEAGE:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * inetCidrRouteNextHopAS(11)/InetAutonomousSystemNumber/ASN_UNSIGNED/u_long(u_long)//l/A/W/e/r/D/H
+ */
+ case COLUMN_INETCIDRROUTENEXTHOPAS:
+ rc = netsnmp_check_vb_type(var, ASN_UNSIGNED);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("inetCidrRouteTable:_inetCidrRouteTable_check_column:inetCidrRouteNextHopAS", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = inetCidrRouteNextHopAS_check_value(rowreq_ctx,
+ *((u_long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from inetCidrRouteNextHopAS_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * inetCidrRouteMetric1(12)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC1:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("inetCidrRouteTable:_inetCidrRouteTable_check_column:inetCidrRouteMetric1", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = inetCidrRouteMetric1_check_value(rowreq_ctx,
+ *((long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from inetCidrRouteMetric1_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * inetCidrRouteMetric2(13)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC2:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("inetCidrRouteTable:_inetCidrRouteTable_check_column:inetCidrRouteMetric2", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = inetCidrRouteMetric2_check_value(rowreq_ctx,
+ *((long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from inetCidrRouteMetric2_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * inetCidrRouteMetric3(14)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC3:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("inetCidrRouteTable:_inetCidrRouteTable_check_column:inetCidrRouteMetric3", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = inetCidrRouteMetric3_check_value(rowreq_ctx,
+ *((long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from inetCidrRouteMetric3_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * inetCidrRouteMetric4(15)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC4:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("inetCidrRouteTable:_inetCidrRouteTable_check_column:inetCidrRouteMetric4", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = inetCidrRouteMetric4_check_value(rowreq_ctx,
+ *((long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from inetCidrRouteMetric4_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * inetCidrRouteMetric5(16)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC5:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("inetCidrRouteTable:_inetCidrRouteTable_check_column:inetCidrRouteMetric5", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = inetCidrRouteMetric5_check_value(rowreq_ctx,
+ *((long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from inetCidrRouteMetric5_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * inetCidrRouteStatus(17)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_INETCIDRROUTESTATUS:
+ rc = netsnmp_check_vb_rowstatus_value(var);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("inetCidrRouteTable:_inetCidrRouteTable_check_column:inetCidrRouteStatus", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = inetCidrRouteStatus_check_value(rowreq_ctx,
+ *((u_long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from inetCidrRouteStatus_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ default: /** We shouldn't get here */
+ rc = SNMP_ERR_GENERR;
+ snmp_log(LOG_ERR,
+ "unknown column %d in _inetCidrRouteTable_check_column\n",
+ column);
+ }
+
+ return rc;
+} /* _inetCidrRouteTable_check_column */
+
+int
+_mfd_inetCidrRouteTable_check_objects(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc;
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_check_objects", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+
+ /*
+ * get column number from table request info, and check that column
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _inetCidrRouteTable_check_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+ break;
+ }
+
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetCidrRouteTable_check_objects */
+
+
+/*----------------------------------------------------------------------
+ *
+ * SET: check dependencies
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check dependencies wrapper
+ */
+static int
+_mfd_inetCidrRouteTable_check_dependencies(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_check_dependencies", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = inetCidrRouteTable_check_dependencies(rowreq_ctx);
+ if (rc) {
+ DEBUGMSGTL(("inetCidrRouteTable:mfd", "error %d from "
+ "inetCidrRouteTable_check_dependencies\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetCidrRouteTable_check_dependencies */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo setup
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_inetCidrRouteTable_undo_setup_column(inetCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_inetCidrRouteTable_undo_setup_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * inetCidrRouteIfIndex(7)/InterfaceIndexOrZero/ASN_INTEGER/long(long)//l/A/W/e/R/d/H
+ */
+ case COLUMN_INETCIDRROUTEIFINDEX:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTEIFINDEX_FLAG;
+ break;
+
+ /*
+ * inetCidrRouteType(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_INETCIDRROUTETYPE:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTETYPE_FLAG;
+ break;
+
+ /*
+ * inetCidrRouteNextHopAS(11)/InetAutonomousSystemNumber/ASN_UNSIGNED/u_long(u_long)//l/A/W/e/r/D/H
+ */
+ case COLUMN_INETCIDRROUTENEXTHOPAS:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTENEXTHOPAS_FLAG;
+ break;
+
+ /*
+ * inetCidrRouteMetric1(12)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC1:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTEMETRIC1_FLAG;
+ break;
+
+ /*
+ * inetCidrRouteMetric2(13)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC2:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTEMETRIC2_FLAG;
+ break;
+
+ /*
+ * inetCidrRouteMetric3(14)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC3:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTEMETRIC3_FLAG;
+ break;
+
+ /*
+ * inetCidrRouteMetric4(15)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC4:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTEMETRIC4_FLAG;
+ break;
+
+ /*
+ * inetCidrRouteMetric5(16)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC5:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTEMETRIC5_FLAG;
+ break;
+
+ /*
+ * inetCidrRouteStatus(17)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_INETCIDRROUTESTATUS:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTESTATUS_FLAG;
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _inetCidrRouteTable_undo_setup_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _inetCidrRouteTable_undo_setup_column */
+
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_inetCidrRouteTable_undo_setup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_undo_setup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * allocate undo context
+ */
+ rowreq_ctx->undo = inetCidrRouteTable_allocate_data();
+ if (NULL == rowreq_ctx->undo) {
+ /** msg already logged */
+ netsnmp_request_set_error_all(requests,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * row undo setup
+ */
+ rowreq_ctx->column_set_flags = 0;
+ rc = inetCidrRouteTable_undo_setup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("inetCidrRouteTable:mfd", "error %d from "
+ "inetCidrRouteTable_undo_setup\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ } else {
+ /*
+ * column undo setup
+ */
+ netsnmp_table_request_info *tri;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _inetCidrRouteTable_undo_setup_column(rowreq_ctx,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("inetCidrRouteTable:mfd", "error %d from "
+ "inetCidrRouteTable_undo_setup_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetCidrRouteTable_undo_setup */
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_inetCidrRouteTable_undo_cleanup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc;
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_undo_cleanup", "called\n"));
+
+ /*
+ * failed row create in early stages has no rowreq_ctx
+ */
+ if (NULL == rowreq_ctx)
+ return MFD_SUCCESS;
+
+ /*
+ * call user cleanup
+ */
+ rc = inetCidrRouteTable_undo_cleanup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("inetCidrRouteTable:mfd", "error %d from "
+ "inetCidrRouteTable_undo_cleanup\n", rc));
+ }
+
+ /*
+ * release undo context, if needed
+ */
+ if (rowreq_ctx->undo) {
+ inetCidrRouteTable_release_data(rowreq_ctx->undo);
+ rowreq_ctx->undo = NULL;
+ }
+
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetCidrRouteTable_undo_cleanup */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Set values
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_inetCidrRouteTable_set_column(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_inetCidrRouteTable_set_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * inetCidrRouteIfIndex(7)/InterfaceIndexOrZero/ASN_INTEGER/long(long)//l/A/W/e/R/d/H
+ */
+ case COLUMN_INETCIDRROUTEIFINDEX:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTEIFINDEX_FLAG;
+ rc = inetCidrRouteIfIndex_set(rowreq_ctx,
+ *((long *) var->val.string));
+ break;
+
+ /*
+ * inetCidrRouteType(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_INETCIDRROUTETYPE:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTETYPE_FLAG;
+ rc = inetCidrRouteType_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ /*
+ * inetCidrRouteNextHopAS(11)/InetAutonomousSystemNumber/ASN_UNSIGNED/u_long(u_long)//l/A/W/e/r/D/H
+ */
+ case COLUMN_INETCIDRROUTENEXTHOPAS:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTENEXTHOPAS_FLAG;
+ rc = inetCidrRouteNextHopAS_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ /*
+ * inetCidrRouteMetric1(12)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC1:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTEMETRIC1_FLAG;
+ rc = inetCidrRouteMetric1_set(rowreq_ctx,
+ *((long *) var->val.string));
+ break;
+
+ /*
+ * inetCidrRouteMetric2(13)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC2:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTEMETRIC2_FLAG;
+ rc = inetCidrRouteMetric2_set(rowreq_ctx,
+ *((long *) var->val.string));
+ break;
+
+ /*
+ * inetCidrRouteMetric3(14)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC3:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTEMETRIC3_FLAG;
+ rc = inetCidrRouteMetric3_set(rowreq_ctx,
+ *((long *) var->val.string));
+ break;
+
+ /*
+ * inetCidrRouteMetric4(15)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC4:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTEMETRIC4_FLAG;
+ rc = inetCidrRouteMetric4_set(rowreq_ctx,
+ *((long *) var->val.string));
+ break;
+
+ /*
+ * inetCidrRouteMetric5(16)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_INETCIDRROUTEMETRIC5:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTEMETRIC5_FLAG;
+ rc = inetCidrRouteMetric5_set(rowreq_ctx,
+ *((long *) var->val.string));
+ break;
+
+ /*
+ * inetCidrRouteStatus(17)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_INETCIDRROUTESTATUS:
+ rowreq_ctx->column_set_flags |= COLUMN_INETCIDRROUTESTATUS_FLAG;
+ rc = inetCidrRouteStatus_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _inetCidrRouteTable_set_column\n",
+ column);
+ rc = SNMP_ERR_GENERR;
+ break;
+ }
+
+ return rc;
+} /* _inetCidrRouteTable_set_column */
+
+int
+_mfd_inetCidrRouteTable_set_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc = SNMP_ERR_NOERROR;
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_set_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rowreq_ctx->column_set_flags = 0;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _inetCidrRouteTable_set_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("inetCidrRouteTable:mfd", "error %d from "
+ "inetCidrRouteTable_set_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetCidrRouteTable_set_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit the values
+ */
+int
+_mfd_inetCidrRouteTable_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = inetCidrRouteTable_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("inetCidrRouteTable:mfd", "error %d from "
+ "inetCidrRouteTable_commit\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ /*
+ * if we successfully commited this row, set the dirty flag. Use the
+ * current value + 1 (i.e. dirty = # rows changed).
+ * this is checked in post_request...
+ */
+ inetCidrRouteTable_dirty_set(inetCidrRouteTable_dirty_get() + 1); /* set table dirty flag */
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+_mfd_inetCidrRouteTable_undo_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_undo_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ u_int d = inetCidrRouteTable_dirty_get();
+
+ netsnmp_assert(d != 0);
+ if (d)
+ inetCidrRouteTable_dirty_set(d - 1);
+ }
+
+ rc = inetCidrRouteTable_undo_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("inetCidrRouteTable:mfd", "error %d from "
+ "inetCidrRouteTable_undo_commit\n", rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ snmp_log(LOG_WARNING,
+ "inetCidrRouteTable row dirty flag still set after undo_commit\n");
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetCidrRouteTable_commit */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo
+ *
+ *---------------------------------------------------------------------*/
+int
+_mfd_inetCidrRouteTable_undo_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_undo_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = inetCidrRouteTable_undo(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("inetCidrRouteTable:mfd", "error %d from "
+ "inetCidrRouteTable_undo\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetCidrRouteTable_undo_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: irreversible commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit irreversible actions
+ */
+int
+_mfd_inetCidrRouteTable_irreversible_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_mfd_inetCidrRouteTable_irreversible:commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * check for and handle row creation/deletion
+ * and update column exist flags...
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) {
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_CREATED))
+ CONTAINER_REMOVE(inetCidrRouteTable_if_ctx.container, rowreq_ctx);
+ } else {
+ if (rowreq_ctx->column_set_flags) {
+ rowreq_ctx->column_set_flags = 0;
+ }
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_CREATED;
+ CONTAINER_INSERT(inetCidrRouteTable_if_ctx.container,
+ rowreq_ctx);
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetCidrRouteTable_irreversible_commit */
+
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+static void _container_free(netsnmp_container *container);
+
+/**
+ * @internal
+ */
+static int
+_cache_load(netsnmp_cache * cache, void *vmagic)
+{
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_cache_load", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache for inetCidrRouteTable_cache_load\n");
+ return -1;
+ }
+
+ /** should only be called for an invalid or expired cache */
+ netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
+
+ /*
+ * call user code
+ */
+ return inetCidrRouteTable_container_load((netsnmp_container *) cache->
+ magic);
+} /* _cache_load */
+
+/**
+ * @internal
+ */
+static void
+_cache_free(netsnmp_cache * cache, void *magic)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_cache_free", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache in inetCidrRouteTable_cache_free\n");
+ return;
+ }
+
+ container = (netsnmp_container *) cache->magic;
+
+ _container_free(container);
+} /* _cache_free */
+
+/**
+ * @internal
+ */
+static void
+_container_item_free(inetCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ void *context)
+{
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_container_item_free",
+ "called\n"));
+
+ if (NULL == rowreq_ctx)
+ return;
+
+ inetCidrRouteTable_release_rowreq_ctx(rowreq_ctx);
+} /* _container_item_free */
+
+/**
+ * @internal
+ */
+static void
+_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_container_free",
+ "called\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container in inetCidrRouteTable_container_free\n");
+ return;
+ }
+
+ /*
+ * call user code
+ */
+ inetCidrRouteTable_container_free(container);
+
+ /*
+ * free all items. inefficient, but easy.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func *) _container_item_free,
+ NULL);
+} /* _container_free */
+
+/**
+ * @internal
+ * initialize the container with functions or wrappers
+ */
+void
+_inetCidrRouteTable_container_init(inetCidrRouteTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_inetCidrRouteTable_container_init", "called\n"));
+
+ /*
+ * cache init
+ */
+ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */
+ _cache_load, _cache_free,
+ inetCidrRouteTable_oid,
+ inetCidrRouteTable_oid_size);
+
+ if (NULL == if_ctx->cache) {
+ snmp_log(LOG_ERR, "error creating cache for ipCidrRouteTable\n");
+ return;
+ }
+
+ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
+
+ inetCidrRouteTable_container_init(&if_ctx->container, if_ctx->cache);
+ if (NULL == if_ctx->container)
+ if_ctx->container =
+ netsnmp_container_find("inetCidrRouteTable:table_container");
+ if (NULL == if_ctx->container) {
+ snmp_log(LOG_ERR, "error creating container in "
+ "inetCidrRouteTable_container_init\n");
+ return;
+ }
+
+ if (NULL != if_ctx->cache)
+ if_ctx->cache->magic = (void *) if_ctx->container;
+} /* _inetCidrRouteTable_container_init */
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+_inetCidrRouteTable_container_shutdown(inetCidrRouteTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:inetCidrRouteTable:_inetCidrRouteTable_container_shutdown", "called\n"));
+
+ inetCidrRouteTable_container_shutdown(if_ctx->container);
+
+ _container_free(if_ctx->container);
+
+} /* _inetCidrRouteTable_container_shutdown */
+
+
+inetCidrRouteTable_rowreq_ctx *
+inetCidrRouteTable_row_find_by_mib_index(inetCidrRouteTable_mib_index *
+ mib_idx)
+{
+ inetCidrRouteTable_rowreq_ctx *rowreq_ctx;
+ oid oid_tmp[MAX_OID_LEN];
+ netsnmp_index oid_idx;
+ int rc;
+
+ /*
+ * set up storage for OID
+ */
+ oid_idx.oids = oid_tmp;
+ oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
+
+ /*
+ * convert
+ */
+ rc = inetCidrRouteTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx =
+ CONTAINER_FIND(inetCidrRouteTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_interface.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_interface.h
new file mode 100644
index 0000000000..339756bf15
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable_interface.h
@@ -0,0 +1,102 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: inetCidrRouteTable_interface.h 14708 2006-06-12 20:03:59Z rstory $
+ */
+/** @ingroup interface Routines to interface to Net-SNMP
+ *
+ * \warning This code should not be modified, called directly,
+ * or used to interpret functionality. It is subject to
+ * change at any time.
+ *
+ * @{
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+#ifndef INETCIDRROUTETABLE_INTERFACE_H
+#define INETCIDRROUTETABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "inetCidrRouteTable.h"
+
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void
+ _inetCidrRouteTable_initialize_interface
+ (inetCidrRouteTable_registration * user_ctx, u_long flags);
+ void
+ _inetCidrRouteTable_shutdown_interface
+ (inetCidrRouteTable_registration * user_ctx);
+
+ inetCidrRouteTable_registration
+ * inetCidrRouteTable_registration_set
+ (inetCidrRouteTable_registration * newreg);
+
+ netsnmp_container *inetCidrRouteTable_container_get(void);
+ int inetCidrRouteTable_container_size(void);
+
+ u_int inetCidrRouteTable_dirty_get(void);
+ void inetCidrRouteTable_dirty_set(u_int status);
+
+ netsnmp_cache *inetCidrRouteTable_get_cache(void);
+
+ inetCidrRouteTable_rowreq_ctx
+ * inetCidrRouteTable_allocate_rowreq_ctx(inetCidrRouteTable_data *,
+ void *);
+ void
+ inetCidrRouteTable_release_rowreq_ctx(inetCidrRouteTable_rowreq_ctx
+ * rowreq_ctx);
+
+ int inetCidrRouteTable_index_to_oid(netsnmp_index *
+ oid_idx,
+ inetCidrRouteTable_mib_index
+ * mib_idx);
+ int inetCidrRouteTable_index_from_oid(netsnmp_index *
+ oid_idx,
+ inetCidrRouteTable_mib_index
+ * mib_idx);
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void
+ inetCidrRouteTable_valid_columns_set(netsnmp_column_info *vc);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* INETCIDRROUTETABLE_INTERFACE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable.h
new file mode 100644
index 0000000000..0214caf055
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable.h
@@ -0,0 +1,5 @@
+/*
+ * module to include the modules
+ */
+
+config_require(ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable.c
new file mode 100644
index 0000000000..fceb1a1f0b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable.c
@@ -0,0 +1,3358 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: ipCidrRouteTable.c 15639 2006-12-06 15:01:27Z rstory $
+ */
+/** \page MFD helper for ipCidrRouteTable
+ *
+ * \section intro Introduction
+ * Introductory text.
+ *
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipCidrRouteTable.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "ipCidrRouteTable_interface.h"
+
+oid ipCidrRouteTable_oid[] = { IPCIDRROUTETABLE_OID };
+int ipCidrRouteTable_oid_size =
+OID_LENGTH(ipCidrRouteTable_oid);
+
+ipCidrRouteTable_registration ipCidrRouteTable_user_context;
+
+void initialize_table_ipCidrRouteTable(void);
+void shutdown_table_ipCidrRouteTable(void);
+
+
+/**
+ * Initializes the ipCidrRouteTable module
+ */
+void
+init_ipCidrRouteTable(void)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:init_ipCidrRouteTable",
+ "called\n"));
+
+ /*
+ * TODO:300:o: Perform ipCidrRouteTable one-time module initialization.
+ */
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ if (should_init("ipCidrRouteTable"))
+ initialize_table_ipCidrRouteTable();
+
+} /* init_ipCidrRouteTable */
+
+/**
+ * Shut-down the ipCidrRouteTable module (agent is exiting)
+ */
+void
+shutdown_ipCidrRouteTable(void)
+{
+ if (should_init("ipCidrRouteTable"))
+ shutdown_table_ipCidrRouteTable();
+
+}
+
+/**
+ * Initialize the table ipCidrRouteTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_ipCidrRouteTable(void)
+{
+ ipCidrRouteTable_registration *user_context;
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:initialize_table_ipCidrRouteTable", "called\n"));
+
+ /*
+ * TODO:301:o: Perform ipCidrRouteTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize ipCidrRouteTable user context
+ * if you'd like to pass in a pointer to some data for this
+ * table, allocate or set it up here.
+ */
+ /*
+ * a netsnmp_data_list is a simple way to store void pointers. A simple
+ * string token is used to add, find or remove pointers.
+ */
+ user_context =
+ netsnmp_create_data_list("ipCidrRouteTable", NULL, NULL);
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _ipCidrRouteTable_initialize_interface(user_context, flags);
+} /* initialize_table_ipCidrRouteTable */
+
+/**
+ * Shutdown the table ipCidrRouteTable
+ */
+void
+shutdown_table_ipCidrRouteTable(void)
+{
+ /*
+ * call interface shutdown code
+ */
+ _ipCidrRouteTable_shutdown_interface(&ipCidrRouteTable_user_context);
+}
+
+/**
+ * extra context initialization (eg default values)
+ *
+ * @param rowreq_ctx : row request context
+ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
+ *
+ * @retval MFD_SUCCESS : no errors
+ * @retval MFD_ERROR : error (context allocate will fail)
+ */
+int
+ipCidrRouteTable_rowreq_ctx_init(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ void *user_init_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_rowreq_ctx_init", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:210:o: |-> Perform extra ipCidrRouteTable rowreq initialization. (eg DEFVALS)
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteTable_rowreq_ctx_init */
+
+/**
+ * extra context cleanup
+ *
+ */
+void
+ipCidrRouteTable_rowreq_ctx_cleanup(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_rowreq_ctx_cleanup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:211:o: |-> Perform extra ipCidrRouteTable rowreq cleanup.
+ */
+ if (NULL != rowreq_ctx->data) {
+ ipCidrRouteTable_release_data(rowreq_ctx->data);
+ rowreq_ctx->data = NULL;
+ }
+} /* ipCidrRouteTable_rowreq_ctx_cleanup */
+
+/**
+ * pre-request callback
+ *
+ * @param user_context
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+ipCidrRouteTable_pre_request(ipCidrRouteTable_registration * user_context)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_pre_request",
+ "called\n"));
+
+ /*
+ * TODO:510:o: Perform ipCidrRouteTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ * Note:
+ * New rows have been inserted into the container, and
+ * deleted rows have been removed from the container and
+ * released.
+ * @param user_context
+ * @param rc : MFD_SUCCESS if all requests succeeded
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+ipCidrRouteTable_post_request(ipCidrRouteTable_registration * user_context,
+ int rc)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_post_request",
+ "called\n"));
+
+ /*
+ * TODO:511:o: Perform ipCidrRouteTable post-request actions.
+ */
+
+ /*
+ * check to set if any rows were changed.
+ */
+ if (ipCidrRouteTable_dirty_get()) {
+ /*
+ * check if request was successful. If so, this would be
+ * a good place to save data to its persistent store.
+ */
+ if (MFD_SUCCESS == rc) {
+ /*
+ * save changed rows, if you haven't already
+ */
+ }
+
+ ipCidrRouteTable_dirty_set(0); /* clear table dirty flag */
+ }
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteTable_post_request */
+
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipCidrRouteTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-FORWARD-MIB::ipCidrRouteTable is subid 4 of ipForward.
+ * Its status is Deprecated.
+ * OID: .1.3.6.1.2.1.4.24.4, length: 9
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement ipCidrRouteTable data context functions.
+ */
+/*
+ * ipCidrRouteTable_allocate_data
+ *
+ * Purpose: create new ipCidrRouteTable_data.
+ */
+ipCidrRouteTable_data *
+ipCidrRouteTable_allocate_data(void)
+{
+ /*
+ * TODO:201:r: |-> allocate memory for the ipCidrRouteTable data context.
+ */
+ ipCidrRouteTable_data *rtn = netsnmp_access_route_entry_create();
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_allocate_data",
+ "called\n"));
+
+ if (NULL == rtn) {
+ snmp_log(LOG_ERR, "unable to malloc memory for new "
+ "ipCidrRouteTable_data.\n");
+ }
+
+ return rtn;
+} /* ipCidrRouteTable_allocate_data */
+
+/*
+ * ipCidrRouteTable_release_data
+ *
+ * Purpose: release ipCidrRouteTable data.
+ */
+void
+ipCidrRouteTable_release_data(ipCidrRouteTable_data * data)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_release_data",
+ "called\n"));
+
+ /*
+ * TODO:202:r: |-> release memory for the ipCidrRouteTable data context.
+ */
+ netsnmp_access_route_entry_free(data);
+} /* ipCidrRouteTable_release_data */
+
+
+
+/**
+ * set mib index(es)
+ *
+ * @param tbl_idx mib index structure
+ * @param ipCidrRouteDest_val
+ * @param ipCidrRouteMask_val
+ * @param ipCidrRouteTos_val
+ * @param ipCidrRouteNextHop_val
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This convenience function is useful for setting all the MIB index
+ * components with a single function call. It is assume that the C values
+ * have already been mapped from their native/rawformat to the MIB format.
+ */
+int
+ipCidrRouteTable_indexes_set_tbl_idx(ipCidrRouteTable_mib_index * tbl_idx,
+ u_long ipCidrRouteDest_val,
+ u_long ipCidrRouteMask_val,
+ long ipCidrRouteTos_val,
+ u_long ipCidrRouteNextHop_val)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_indexes_set_tbl_idx", "called\n"));
+
+ /*
+ * ipCidrRouteDest(1)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ tbl_idx->ipCidrRouteDest = ipCidrRouteDest_val;
+
+ /*
+ * ipCidrRouteMask(2)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ tbl_idx->ipCidrRouteMask = ipCidrRouteMask_val;
+
+ /*
+ * ipCidrRouteTos(3)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ */
+ tbl_idx->ipCidrRouteTos = ipCidrRouteTos_val;
+
+ /*
+ * ipCidrRouteNextHop(4)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ tbl_idx->ipCidrRouteNextHop = ipCidrRouteNextHop_val;
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteTable_indexes_set_tbl_idx */
+
+/**
+ * @internal
+ * set row context indexes
+ *
+ * @param reqreq_ctx the row context that needs updated indexes
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This function sets the mib indexs, then updates the oid indexs
+ * from the mib index.
+ */
+int
+ipCidrRouteTable_indexes_set(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long ipCidrRouteDest_val,
+ u_long ipCidrRouteMask_val,
+ long ipCidrRouteTos_val,
+ u_long ipCidrRouteNextHop_val)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_indexes_set",
+ "called\n"));
+
+ if (MFD_SUCCESS !=
+ ipCidrRouteTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
+ ipCidrRouteDest_val,
+ ipCidrRouteMask_val,
+ ipCidrRouteTos_val,
+ ipCidrRouteNextHop_val))
+ return MFD_ERROR;
+
+ /*
+ * convert mib index to oid index
+ */
+ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
+ if (0 != ipCidrRouteTable_index_to_oid(&rowreq_ctx->oid_idx,
+ &rowreq_ctx->tbl_idx)) {
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteTable_indexes_set */
+
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteIfIndex
+ * ipCidrRouteIfIndex is subid 5 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.5
+ * Description:
+The ifIndex value which identifies the local interface
+
+
+ through which the next hop of this route should be
+ reached.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: 0
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the ipCidrRouteIfIndex data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteIfIndex_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipCidrRouteIfIndex_get(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long *ipCidrRouteIfIndex_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipCidrRouteIfIndex_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteIfIndex_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipCidrRouteIfIndex data.
+ * copy (* ipCidrRouteIfIndex_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipCidrRouteIfIndex_val_ptr) = rowreq_ctx->data->if_index;
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteIfIndex_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteType
+ * ipCidrRouteType is subid 6 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.6
+ * Description:
+The type of route. Note that local(3) refers to a
+ route for which the next hop is the final destination;
+ remote(4) refers to a route for which the next hop is
+ not the final destination.
+
+ Routes which do not result in traffic forwarding or
+ rejection should not be displayed even if the
+ implementation keeps them stored internally.
+
+ reject (2) refers to a route which, if matched,
+ discards the message as unreachable. This is used in
+ some protocols as a means of correctly aggregating
+ routes.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 3/8. Values: other(1), reject(2), local(3), remote(4)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ipCidrRouteType data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteType_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipCidrRouteType_get(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipCidrRouteType_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipCidrRouteType_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteType_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipCidrRouteType data.
+ * copy (* ipCidrRouteType_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipCidrRouteType_val_ptr) = rowreq_ctx->data->rt_type;
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteType_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteProto
+ * ipCidrRouteProto is subid 7 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.24.4.1.7
+ * Description:
+The routing mechanism via which this route was learned.
+ Inclusion of values for gateway routing protocols is
+ not intended to imply that hosts should support those
+ protocols.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ * Enum range: 11/16. Values: other(1), local(2), netmgmt(3), icmp(4), egp(5), ggp(6), hello(7), rip(8), isIs(9), esIs(10), ciscoIgrp(11), bbnSpfIgp(12), ospf(13), bgp(14), idpr(15), ciscoEigrp(16)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ipCidrRouteProto data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteProto_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipCidrRouteProto_get(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipCidrRouteProto_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipCidrRouteProto_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteProto_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipCidrRouteProto data.
+ * copy (* ipCidrRouteProto_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipCidrRouteProto_val_ptr) = rowreq_ctx->data->rt_proto;
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteProto_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteAge
+ * ipCidrRouteAge is subid 8 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.24.4.1.8
+ * Description:
+The number of seconds since this route was last updated
+ or otherwise determined to be correct. Note that no
+ semantics of `too old' can be implied except through
+ knowledge of the routing protocol by which the route
+ was learned.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ * defval: 0
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the ipCidrRouteAge data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteAge_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipCidrRouteAge_get(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long *ipCidrRouteAge_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipCidrRouteAge_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteAge_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipCidrRouteAge data.
+ * copy (* ipCidrRouteAge_val_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * TODO:235:M: |-> Remove log message/SKIP once you've set ipCidrRouteAge data
+ */
+ return MFD_SKIP;
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteAge_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteInfo
+ * ipCidrRouteInfo is subid 9 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.9
+ * Description:
+A reference to MIB definitions specific to the
+ particular routing protocol which is responsible for
+ this route, as determined by the value specified in the
+ route's ipCidrRouteProto value. If this information is
+ not present, its value should be set to the OBJECT
+ IDENTIFIER { 0 0 }, which is a syntactically valid
+ object identifier, and any implementation conforming to
+ ASN.1 and the Basic Encoding Rules must be able to
+ generate and recognize this value.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ *
+ * Its syntax is OBJECTID (based on perltype OBJECTID)
+ * The net-snmp type is ASN_OBJECT_ID. The C type decl is oid (oid)
+ * This data type requires a length. (Max )
+ */
+/**
+ * Extract the current value of the ipCidrRouteInfo data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteInfo_val_ptr_ptr
+ * Pointer to storage for a oid variable
+ * @param ipCidrRouteInfo_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by ipCidrRouteInfo.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*ipCidrRouteInfo_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update ipCidrRouteInfo_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+ipCidrRouteInfo_get(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ oid ** ipCidrRouteInfo_val_ptr_ptr,
+ size_t * ipCidrRouteInfo_val_ptr_len_ptr)
+{
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert((NULL != ipCidrRouteInfo_val_ptr_ptr)
+ && (NULL != *ipCidrRouteInfo_val_ptr_ptr));
+ netsnmp_assert(NULL != ipCidrRouteInfo_val_ptr_len_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteInfo_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipCidrRouteInfo data.
+ * copy (* ipCidrRouteInfo_val_ptr_ptr ) data and (* ipCidrRouteInfo_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ /** nullOidLen is in bytes, so not sizeof(oid) needed */
+ if ((*ipCidrRouteInfo_val_ptr_len_ptr) < nullOidLen) {
+ (*ipCidrRouteInfo_val_ptr_ptr) = malloc(nullOidLen);
+ if (NULL == (*ipCidrRouteInfo_val_ptr_ptr))
+ return MFD_ERROR;
+ }
+ (*ipCidrRouteInfo_val_ptr_len_ptr) = nullOidLen;
+ memcpy((*ipCidrRouteInfo_val_ptr_ptr), nullOid, nullOidLen);
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteInfo_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteNextHopAS
+ * ipCidrRouteNextHopAS is subid 10 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.10
+ * Description:
+The Autonomous System Number of the Next Hop. The
+ semantics of this object are determined by the routing-
+ protocol specified in the route's ipCidrRouteProto
+ value. When this object is unknown or not relevant its
+ value should be set to zero.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: 0
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the ipCidrRouteNextHopAS data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteNextHopAS_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipCidrRouteNextHopAS_get(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long *ipCidrRouteNextHopAS_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipCidrRouteNextHopAS_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteNextHopAS_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipCidrRouteNextHopAS data.
+ * copy (* ipCidrRouteNextHopAS_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipCidrRouteNextHopAS_val_ptr) = rowreq_ctx->data->rt_nexthop_as;
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteNextHopAS_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteMetric1
+ * ipCidrRouteMetric1 is subid 11 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.11
+ * Description:
+The primary routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's ipCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the ipCidrRouteMetric1 data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteMetric1_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipCidrRouteMetric1_get(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long *ipCidrRouteMetric1_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipCidrRouteMetric1_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric1_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipCidrRouteMetric1 data.
+ * copy (* ipCidrRouteMetric1_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipCidrRouteMetric1_val_ptr) = rowreq_ctx->data->rt_metric1;
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric1_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteMetric2
+ * ipCidrRouteMetric2 is subid 12 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.12
+ * Description:
+An alternate routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's ipCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the ipCidrRouteMetric2 data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteMetric2_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipCidrRouteMetric2_get(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long *ipCidrRouteMetric2_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipCidrRouteMetric2_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric2_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipCidrRouteMetric2 data.
+ * copy (* ipCidrRouteMetric2_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipCidrRouteMetric2_val_ptr) = rowreq_ctx->data->rt_metric2;
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric2_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteMetric3
+ * ipCidrRouteMetric3 is subid 13 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.13
+ * Description:
+An alternate routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's ipCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the ipCidrRouteMetric3 data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteMetric3_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipCidrRouteMetric3_get(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long *ipCidrRouteMetric3_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipCidrRouteMetric3_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric3_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipCidrRouteMetric3 data.
+ * copy (* ipCidrRouteMetric3_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipCidrRouteMetric3_val_ptr) = rowreq_ctx->data->rt_metric3;
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric3_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteMetric4
+ * ipCidrRouteMetric4 is subid 14 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.14
+ * Description:
+An alternate routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's ipCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the ipCidrRouteMetric4 data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteMetric4_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipCidrRouteMetric4_get(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long *ipCidrRouteMetric4_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipCidrRouteMetric4_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric4_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipCidrRouteMetric4 data.
+ * copy (* ipCidrRouteMetric4_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipCidrRouteMetric4_val_ptr) = rowreq_ctx->data->rt_metric4;
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric4_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteMetric5
+ * ipCidrRouteMetric5 is subid 15 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.15
+ * Description:
+An alternate routing metric for this route. The
+ semantics of this metric are determined by the routing-
+
+
+ protocol specified in the route's ipCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the ipCidrRouteMetric5 data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteMetric5_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipCidrRouteMetric5_get(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long *ipCidrRouteMetric5_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipCidrRouteMetric5_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric5_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipCidrRouteMetric5 data.
+ * copy (* ipCidrRouteMetric5_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipCidrRouteMetric5_val_ptr) = rowreq_ctx->data->rt_metric5;
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric5_get */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteStatus
+ * ipCidrRouteStatus is subid 16 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.16
+ * Description:
+The row status variable, used according to row
+ installation and removal conventions.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
+ *
+ * Its syntax is RowStatus (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ipCidrRouteStatus data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteStatus_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipCidrRouteStatus_get(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipCidrRouteStatus_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipCidrRouteStatus_val_ptr);
+
+ (*ipCidrRouteStatus_val_ptr) = rowreq_ctx->ipCidrRouteStatus;
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteStatus_get */
+
+
+
+/** @} */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipCidrRouteTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-FORWARD-MIB::ipCidrRouteTable is subid 4 of ipForward.
+ * Its status is Deprecated.
+ * OID: .1.3.6.1.2.1.4.24.4, length: 9
+ */
+ /*
+ * NOTE: if you update this chart, please update the versions in
+ * local/mib2c-conf.d/parent-set.m2i
+ * agent/mibgroup/helpers/baby_steps.c
+ * while you're at it.
+ */
+ /*
+ ***********************************************************************
+ * Baby Steps Flow Chart (2004.06.05) *
+ * *
+ * +--------------+ +================+ U = unconditional path *
+ * |optional state| ||required state|| S = path for success *
+ * +--------------+ +================+ E = path for error *
+ ***********************************************************************
+ *
+ * +--------------+
+ * | pre |
+ * | request |
+ * +--------------+
+ * | U
+ * +-------------+ +==============+
+ * | row |f|<-------|| object ||
+ * | create |1| E || lookup ||
+ * +-------------+ +==============+
+ * E | | S | S
+ * | +------------------>|
+ * | +==============+
+ * | E || check ||
+ * |<---------------|| values ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | +<-------|| undo ||
+ * | | E || setup ||
+ * | | +==============+
+ * | | | S
+ * | | +==============+
+ * | | || set ||-------------------------->+
+ * | | || value || E |
+ * | | +==============+ |
+ * | | | S |
+ * | | +--------------+ |
+ * | | | check |-------------------------->|
+ * | | | consistency | E |
+ * | | +--------------+ |
+ * | | | S |
+ * | | +==============+ +==============+ |
+ * | | || commit ||-------->|| undo || |
+ * | | || || E || commit || |
+ * | | +==============+ +==============+ |
+ * | | | S U |<--------+
+ * | | +--------------+ +==============+
+ * | | | irreversible | || undo ||
+ * | | | commit | || set ||
+ * | | +--------------+ +==============+
+ * | | | U U |
+ * | +-------------->|<------------------------+
+ * | +==============+
+ * | || undo ||
+ * | || cleanup ||
+ * | +==============+
+ * +---------------------->| U
+ * |
+ * (err && f1)------------------->+
+ * | |
+ * +--------------+ +--------------+
+ * | post |<--------| row |
+ * | request | U | release |
+ * +--------------+ +--------------+
+ *
+ */
+
+/**
+ * Setup up context with information needed to undo a set request.
+ *
+ * This function will be called before the individual node undo setup
+ * functions are called. If you need to do any undo setup that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that the undo context has been allocated with
+ * ipCidrRouteTable_allocate_data(), but may need extra
+ * initialization similar to what you may have done in
+ * ipCidrRouteTable_rowreq_ctx_init().
+ * Note that an individual node's undo_setup function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in the node's undo_setup
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipCidrRouteTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+ipCidrRouteTable_undo_setup(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_undo_setup",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> Setup ipCidrRouteTable undo.
+ * set up ipCidrRouteTable undo information, in preparation for a set.
+ * Undo storage is in (* ipCidrRouteStatus_val_ptr )*
+ */
+
+ return rc;
+} /* ipCidrRouteTable_undo_setup */
+
+/**
+ * Undo a set request.
+ *
+ * This function will be called before the individual node undo
+ * functions are called. If you need to do any undo that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that an individual node's undo function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is anything specific to a particular column (e.g. releasing
+ * memory for a string), you should do that setup in the node's undo
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipCidrRouteTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+ipCidrRouteTable_undo(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_undo",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> ipCidrRouteTable undo.
+ * ipCidrRouteTable undo information, in response to a failed set.
+ * Undo storage is in (* ipCidrRouteStatus_val_ptr )*
+ */
+
+ return rc;
+} /* ipCidrRouteTable_undo_setup */
+
+/**
+ * Cleanup up context undo information.
+ *
+ * This function will be called after set/commit processing. If you
+ * allocated any resources in undo_setup, this is the place to release
+ * those resources.
+ *
+ * This function is called regardless of the success or failure of the set
+ * request. If you need to perform different steps for cleanup depending
+ * on success or failure, you can add a flag to the rowreq_ctx.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipCidrRouteTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ipCidrRouteTable_undo_cleanup(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_undo_cleanup",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:452:M: |-> Cleanup ipCidrRouteTable undo.
+ * Undo storage is in (* ipCidrRouteStatus_val_ptr )*
+ */
+
+ return rc;
+} /* ipCidrRouteTable_undo_cleanup */
+
+/**
+ * commit new values.
+ *
+ * At this point, you should have done everything you can to ensure that
+ * this commit will not fail.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * ipCidrRouteTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ipCidrRouteTable_commit(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+ int save_flags;
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_commit",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * save flags, then clear until we actually do something
+ */
+ save_flags = rowreq_ctx->column_set_flags;
+ rowreq_ctx->column_set_flags = 0;
+
+ /*
+ * commit ipCidrRouteTable data
+ * 1) check the column's flag in save_flags to see if it was set.
+ * 2) clear the flag when you handle that column
+ * 3) set the column's flag in column_set_flags if it needs undo
+ * processing in case of a failure.
+ */
+ if (save_flags & COLUMN_IPCIDRROUTEIFINDEX_FLAG) {
+ save_flags &= ~COLUMN_IPCIDRROUTEIFINDEX_FLAG; /* clear ipCidrRouteIfIndex */
+ /*
+ * TODO:482:o: |-> commit column ipCidrRouteIfIndex.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "ipCidrRouteTable column ipCidrRouteIfIndex commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo ipCidrRouteIfIndex
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEIFINDEX_FLAG;
+ }
+ }
+
+ if (save_flags & COLUMN_IPCIDRROUTETYPE_FLAG) {
+ save_flags &= ~COLUMN_IPCIDRROUTETYPE_FLAG; /* clear ipCidrRouteType */
+ /*
+ * TODO:482:o: |-> commit column ipCidrRouteType.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "ipCidrRouteTable column ipCidrRouteType commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo ipCidrRouteType
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTETYPE_FLAG;
+ }
+ }
+
+ if (save_flags & COLUMN_IPCIDRROUTEINFO_FLAG) {
+ save_flags &= ~COLUMN_IPCIDRROUTEINFO_FLAG; /* clear ipCidrRouteInfo */
+ /*
+ * TODO:482:o: |-> commit column ipCidrRouteInfo.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "ipCidrRouteTable column ipCidrRouteInfo commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo ipCidrRouteInfo
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEINFO_FLAG;
+ }
+ }
+
+ if (save_flags & COLUMN_IPCIDRROUTENEXTHOPAS_FLAG) {
+ save_flags &= ~COLUMN_IPCIDRROUTENEXTHOPAS_FLAG; /* clear ipCidrRouteNextHopAS */
+ /*
+ * TODO:482:o: |-> commit column ipCidrRouteNextHopAS.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "ipCidrRouteTable column ipCidrRouteNextHopAS commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo ipCidrRouteNextHopAS
+ */
+ rowreq_ctx->column_set_flags |=
+ COLUMN_IPCIDRROUTENEXTHOPAS_FLAG;
+ }
+ }
+
+ if (save_flags & COLUMN_IPCIDRROUTEMETRIC1_FLAG) {
+ save_flags &= ~COLUMN_IPCIDRROUTEMETRIC1_FLAG; /* clear ipCidrRouteMetric1 */
+ /*
+ * TODO:482:o: |-> commit column ipCidrRouteMetric1.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "ipCidrRouteTable column ipCidrRouteMetric1 commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo ipCidrRouteMetric1
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEMETRIC1_FLAG;
+ }
+ }
+
+ if (save_flags & COLUMN_IPCIDRROUTEMETRIC2_FLAG) {
+ save_flags &= ~COLUMN_IPCIDRROUTEMETRIC2_FLAG; /* clear ipCidrRouteMetric2 */
+ /*
+ * TODO:482:o: |-> commit column ipCidrRouteMetric2.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "ipCidrRouteTable column ipCidrRouteMetric2 commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo ipCidrRouteMetric2
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEMETRIC2_FLAG;
+ }
+ }
+
+ if (save_flags & COLUMN_IPCIDRROUTEMETRIC3_FLAG) {
+ save_flags &= ~COLUMN_IPCIDRROUTEMETRIC3_FLAG; /* clear ipCidrRouteMetric3 */
+ /*
+ * TODO:482:o: |-> commit column ipCidrRouteMetric3.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "ipCidrRouteTable column ipCidrRouteMetric3 commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo ipCidrRouteMetric3
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEMETRIC3_FLAG;
+ }
+ }
+
+ if (save_flags & COLUMN_IPCIDRROUTEMETRIC4_FLAG) {
+ save_flags &= ~COLUMN_IPCIDRROUTEMETRIC4_FLAG; /* clear ipCidrRouteMetric4 */
+ /*
+ * TODO:482:o: |-> commit column ipCidrRouteMetric4.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "ipCidrRouteTable column ipCidrRouteMetric4 commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo ipCidrRouteMetric4
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEMETRIC4_FLAG;
+ }
+ }
+
+ if (save_flags & COLUMN_IPCIDRROUTEMETRIC5_FLAG) {
+ save_flags &= ~COLUMN_IPCIDRROUTEMETRIC5_FLAG; /* clear ipCidrRouteMetric5 */
+ /*
+ * TODO:482:o: |-> commit column ipCidrRouteMetric5.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "ipCidrRouteTable column ipCidrRouteMetric5 commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo ipCidrRouteMetric5
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEMETRIC5_FLAG;
+ }
+ }
+
+ if (save_flags & COLUMN_IPCIDRROUTESTATUS_FLAG) {
+ save_flags &= ~COLUMN_IPCIDRROUTESTATUS_FLAG; /* clear ipCidrRouteStatus */
+ /*
+ * TODO:482:o: |-> commit column ipCidrRouteStatus.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "ipCidrRouteTable column ipCidrRouteStatus commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo ipCidrRouteStatus
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTESTATUS_FLAG;
+ }
+ }
+
+ /*
+ * if we successfully commited this row, set the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY;
+ }
+
+ if (save_flags) {
+ snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n",
+ save_flags);
+ return MFD_ERROR;
+ }
+
+ return rc;
+} /* ipCidrRouteTable_commit */
+
+/**
+ * undo commit new values.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * ipCidrRouteTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ipCidrRouteTable_undo_commit(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_undo_commit",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:485:M: |-> Undo ipCidrRouteTable commit.
+ * check the column's flag in rowreq_ctx->column_set_flags to see
+ * if it was set during commit, then undo it.
+ *
+ * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
+ */
+
+
+ /*
+ * if we successfully un-commited this row, clear the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return rc;
+} /* ipCidrRouteTable_undo_commit */
+
+/*
+ * TODO:440:M: Implement ipCidrRouteTable node value checks.
+ * TODO:450:M: Implement ipCidrRouteTable undo functions.
+ * TODO:460:M: Implement ipCidrRouteTable set functions.
+ * TODO:480:M: Implement ipCidrRouteTable commit functions.
+ */
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteIfIndex
+ * ipCidrRouteIfIndex is subid 5 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.5
+ * Description:
+The ifIndex value which identifies the local interface
+
+
+ through which the next hop of this route should be
+ reached.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: 0
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteIfIndex_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipCidrRouteIfIndex_check_value(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long ipCidrRouteIfIndex_val)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteIfIndex_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipCidrRouteIfIndex value.
+ */
+
+ return MFD_SUCCESS; /* ipCidrRouteIfIndex value not illegal */
+} /* ipCidrRouteIfIndex_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipCidrRouteTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipCidrRouteTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipCidrRouteIfIndex_undo_setup(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteIfIndex_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipCidrRouteIfIndex undo.
+ */
+ /*
+ * copy ipCidrRouteIfIndex data
+ * set rowreq_ctx->undo->ipCidrRouteIfIndex from rowreq_ctx->data->ipCidrRouteIfIndex
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteIfIndex_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipCidrRouteIfIndex_val
+ * A long containing the new value.
+ */
+int
+ipCidrRouteIfIndex_set(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long ipCidrRouteIfIndex_val)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteIfIndex_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipCidrRouteIfIndex value.
+ * set ipCidrRouteIfIndex value in rowreq_ctx->data
+ */
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteIfIndex_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipCidrRouteIfIndex_undo(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteIfIndex_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipCidrRouteIfIndex undo.
+ */
+ /*
+ * copy ipCidrRouteIfIndex data
+ * set rowreq_ctx->data->ipCidrRouteIfIndex from rowreq_ctx->undo->ipCidrRouteIfIndex
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteIfIndex_undo */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteType
+ * ipCidrRouteType is subid 6 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.6
+ * Description:
+The type of route. Note that local(3) refers to a
+ route for which the next hop is the final destination;
+ remote(4) refers to a route for which the next hop is
+ not the final destination.
+
+ Routes which do not result in traffic forwarding or
+ rejection should not be displayed even if the
+ implementation keeps them stored internally.
+
+ reject (2) refers to a route which, if matched,
+ discards the message as unreachable. This is used in
+ some protocols as a means of correctly aggregating
+ routes.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 3/8. Values: other(1), reject(2), local(3), remote(4)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteType_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of other(1), reject(2), local(3), remote(4)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipCidrRouteType_check_value(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long ipCidrRouteType_val)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteType_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipCidrRouteType value.
+ */
+
+ return MFD_SUCCESS; /* ipCidrRouteType value not illegal */
+} /* ipCidrRouteType_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipCidrRouteTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipCidrRouteTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipCidrRouteType_undo_setup(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteType_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipCidrRouteType undo.
+ */
+ /*
+ * copy ipCidrRouteType data
+ * set rowreq_ctx->undo->ipCidrRouteType from rowreq_ctx->data->ipCidrRouteType
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteType_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipCidrRouteType_val
+ * A long containing the new value.
+ */
+int
+ipCidrRouteType_set(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long ipCidrRouteType_val)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteType_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipCidrRouteType value.
+ * set ipCidrRouteType value in rowreq_ctx->data
+ */
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteType_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipCidrRouteType_undo(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteType_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipCidrRouteType undo.
+ */
+ /*
+ * copy ipCidrRouteType data
+ * set rowreq_ctx->data->ipCidrRouteType from rowreq_ctx->undo->ipCidrRouteType
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteType_undo */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteInfo
+ * ipCidrRouteInfo is subid 9 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.9
+ * Description:
+A reference to MIB definitions specific to the
+ particular routing protocol which is responsible for
+ this route, as determined by the value specified in the
+ route's ipCidrRouteProto value. If this information is
+ not present, its value should be set to the OBJECT
+ IDENTIFIER { 0 0 }, which is a syntactically valid
+ object identifier, and any implementation conforming to
+ ASN.1 and the Basic Encoding Rules must be able to
+ generate and recognize this value.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ *
+ * Its syntax is OBJECTID (based on perltype OBJECTID)
+ * The net-snmp type is ASN_OBJECT_ID. The C type decl is oid (oid)
+ * This data type requires a length. (Max )
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteInfo_val_ptr
+ * A oid containing the new value.
+ * @param ipCidrRouteInfo_val_ptr_len
+ * The size (in bytes) of the data pointed to by ipCidrRouteInfo_val_ptr
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * Since you aren't using a generated data context, you also need to
+ * check the length, to make sure you don't overflow your storage space.
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_OBJECT_ID
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipCidrRouteInfo_check_value(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ oid * ipCidrRouteInfo_val_ptr,
+ size_t ipCidrRouteInfo_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteInfo_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert(NULL != ipCidrRouteInfo_val_ptr);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipCidrRouteInfo value.
+ */
+
+ return MFD_SUCCESS; /* ipCidrRouteInfo value not illegal */
+} /* ipCidrRouteInfo_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipCidrRouteTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipCidrRouteTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipCidrRouteInfo_undo_setup(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteInfo_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipCidrRouteInfo undo.
+ */
+ /*
+ * copy ipCidrRouteInfo and ipCidrRouteInfo_len data
+ * set rowreq_ctx->undo->ipCidrRouteInfo from rowreq_ctx->data->ipCidrRouteInfo
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteInfo_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipCidrRouteInfo_val_ptr
+ * A oid containing the new value.
+ * @param ipCidrRouteInfo_val_ptr_len
+ * The size (in bytes) of the data pointed to by ipCidrRouteInfo_val_ptr
+ */
+int
+ipCidrRouteInfo_set(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ oid * ipCidrRouteInfo_val_ptr,
+ size_t ipCidrRouteInfo_val_ptr_len)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteInfo_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert(NULL != ipCidrRouteInfo_val_ptr);
+
+ /*
+ * TODO:461:M: |-> Set ipCidrRouteInfo value.
+ * set ipCidrRouteInfo value in rowreq_ctx->data
+ */
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteInfo_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipCidrRouteInfo_undo(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteInfo_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipCidrRouteInfo undo.
+ */
+ /*
+ * copy ipCidrRouteInfo and ipCidrRouteInfo_len data
+ * set rowreq_ctx->data->ipCidrRouteInfo from rowreq_ctx->undo->ipCidrRouteInfo
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteInfo_undo */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteNextHopAS
+ * ipCidrRouteNextHopAS is subid 10 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.10
+ * Description:
+The Autonomous System Number of the Next Hop. The
+ semantics of this object are determined by the routing-
+ protocol specified in the route's ipCidrRouteProto
+ value. When this object is unknown or not relevant its
+ value should be set to zero.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: 0
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteNextHopAS_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipCidrRouteNextHopAS_check_value(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long ipCidrRouteNextHopAS_val)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteNextHopAS_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipCidrRouteNextHopAS value.
+ */
+
+ return MFD_SUCCESS; /* ipCidrRouteNextHopAS value not illegal */
+} /* ipCidrRouteNextHopAS_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipCidrRouteTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipCidrRouteTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipCidrRouteNextHopAS_undo_setup(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteNextHopAS_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipCidrRouteNextHopAS undo.
+ */
+ /*
+ * copy ipCidrRouteNextHopAS data
+ * set rowreq_ctx->undo->ipCidrRouteNextHopAS from rowreq_ctx->data->ipCidrRouteNextHopAS
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteNextHopAS_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipCidrRouteNextHopAS_val
+ * A long containing the new value.
+ */
+int
+ipCidrRouteNextHopAS_set(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long ipCidrRouteNextHopAS_val)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteNextHopAS_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipCidrRouteNextHopAS value.
+ * set ipCidrRouteNextHopAS value in rowreq_ctx->data
+ */
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteNextHopAS_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipCidrRouteNextHopAS_undo(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteNextHopAS_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipCidrRouteNextHopAS undo.
+ */
+ /*
+ * copy ipCidrRouteNextHopAS data
+ * set rowreq_ctx->data->ipCidrRouteNextHopAS from rowreq_ctx->undo->ipCidrRouteNextHopAS
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteNextHopAS_undo */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteMetric1
+ * ipCidrRouteMetric1 is subid 11 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.11
+ * Description:
+The primary routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's ipCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteMetric1_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipCidrRouteMetric1_check_value(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long ipCidrRouteMetric1_val)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric1_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipCidrRouteMetric1 value.
+ */
+
+ return MFD_SUCCESS; /* ipCidrRouteMetric1 value not illegal */
+} /* ipCidrRouteMetric1_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipCidrRouteTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipCidrRouteTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipCidrRouteMetric1_undo_setup(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric1_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipCidrRouteMetric1 undo.
+ */
+ /*
+ * copy ipCidrRouteMetric1 data
+ * set rowreq_ctx->undo->ipCidrRouteMetric1 from rowreq_ctx->data->ipCidrRouteMetric1
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric1_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipCidrRouteMetric1_val
+ * A long containing the new value.
+ */
+int
+ipCidrRouteMetric1_set(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long ipCidrRouteMetric1_val)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric1_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipCidrRouteMetric1 value.
+ * set ipCidrRouteMetric1 value in rowreq_ctx->data
+ */
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric1_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipCidrRouteMetric1_undo(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric1_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipCidrRouteMetric1 undo.
+ */
+ /*
+ * copy ipCidrRouteMetric1 data
+ * set rowreq_ctx->data->ipCidrRouteMetric1 from rowreq_ctx->undo->ipCidrRouteMetric1
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric1_undo */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteMetric2
+ * ipCidrRouteMetric2 is subid 12 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.12
+ * Description:
+An alternate routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's ipCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteMetric2_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipCidrRouteMetric2_check_value(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long ipCidrRouteMetric2_val)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric2_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipCidrRouteMetric2 value.
+ */
+ /*
+ * does any os use metric 2-5? if so, update to deal with it.
+ * otherwise, only accept same value we have.
+ */
+ if (ipCidrRouteMetric2_val != rowreq_ctx->data->rt_metric2)
+ return MFD_NOT_VALID_EVER;
+
+ return MFD_SUCCESS; /* ipCidrRouteMetric2 value not illegal */
+} /* ipCidrRouteMetric2_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipCidrRouteTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipCidrRouteTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipCidrRouteMetric2_undo_setup(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric2_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipCidrRouteMetric2 undo.
+ */
+ /*
+ * copy ipCidrRouteMetric2 data
+ * set rowreq_ctx->undo->ipCidrRouteMetric2 from rowreq_ctx->data->ipCidrRouteMetric2
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric2_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipCidrRouteMetric2_val
+ * A long containing the new value.
+ */
+int
+ipCidrRouteMetric2_set(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long ipCidrRouteMetric2_val)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric2_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipCidrRouteMetric2 value.
+ * set ipCidrRouteMetric2 value in rowreq_ctx->data
+ */
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric2_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipCidrRouteMetric2_undo(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric2_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipCidrRouteMetric2 undo.
+ */
+ /*
+ * copy ipCidrRouteMetric2 data
+ * set rowreq_ctx->data->ipCidrRouteMetric2 from rowreq_ctx->undo->ipCidrRouteMetric2
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric2_undo */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteMetric3
+ * ipCidrRouteMetric3 is subid 13 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.13
+ * Description:
+An alternate routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's ipCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteMetric3_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipCidrRouteMetric3_check_value(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long ipCidrRouteMetric3_val)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric3_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipCidrRouteMetric3 value.
+ */
+ /*
+ * does any os use metric 2-5? if so, update to deal with it.
+ * otherwise, only accept same value we have.
+ */
+ if (ipCidrRouteMetric3_val != rowreq_ctx->data->rt_metric3)
+ return MFD_NOT_VALID_EVER;
+
+ return MFD_SUCCESS; /* ipCidrRouteMetric3 value not illegal */
+} /* ipCidrRouteMetric3_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipCidrRouteTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipCidrRouteTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipCidrRouteMetric3_undo_setup(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric3_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipCidrRouteMetric3 undo.
+ */
+ /*
+ * copy ipCidrRouteMetric3 data
+ * set rowreq_ctx->undo->ipCidrRouteMetric3 from rowreq_ctx->data->ipCidrRouteMetric3
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric3_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipCidrRouteMetric3_val
+ * A long containing the new value.
+ */
+int
+ipCidrRouteMetric3_set(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long ipCidrRouteMetric3_val)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric3_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipCidrRouteMetric3 value.
+ * set ipCidrRouteMetric3 value in rowreq_ctx->data
+ */
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric3_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipCidrRouteMetric3_undo(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric3_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipCidrRouteMetric3 undo.
+ */
+ /*
+ * copy ipCidrRouteMetric3 data
+ * set rowreq_ctx->data->ipCidrRouteMetric3 from rowreq_ctx->undo->ipCidrRouteMetric3
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric3_undo */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteMetric4
+ * ipCidrRouteMetric4 is subid 14 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.14
+ * Description:
+An alternate routing metric for this route. The
+ semantics of this metric are determined by the routing-
+ protocol specified in the route's ipCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteMetric4_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipCidrRouteMetric4_check_value(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long ipCidrRouteMetric4_val)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric4_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipCidrRouteMetric4 value.
+ */
+ /*
+ * does any os use metric 2-5? if so, update to deal with it.
+ * otherwise, only accept same value we have.
+ */
+ if (ipCidrRouteMetric4_val != rowreq_ctx->data->rt_metric4)
+ return MFD_NOT_VALID_EVER;
+
+ return MFD_SUCCESS; /* ipCidrRouteMetric4 value not illegal */
+} /* ipCidrRouteMetric4_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipCidrRouteTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipCidrRouteTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipCidrRouteMetric4_undo_setup(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric4_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipCidrRouteMetric4 undo.
+ */
+ /*
+ * copy ipCidrRouteMetric4 data
+ * set rowreq_ctx->undo->ipCidrRouteMetric4 from rowreq_ctx->data->ipCidrRouteMetric4
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric4_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipCidrRouteMetric4_val
+ * A long containing the new value.
+ */
+int
+ipCidrRouteMetric4_set(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long ipCidrRouteMetric4_val)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric4_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipCidrRouteMetric4 value.
+ * set ipCidrRouteMetric4 value in rowreq_ctx->data
+ */
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric4_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipCidrRouteMetric4_undo(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric4_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipCidrRouteMetric4 undo.
+ */
+ /*
+ * copy ipCidrRouteMetric4 data
+ * set rowreq_ctx->data->ipCidrRouteMetric4 from rowreq_ctx->undo->ipCidrRouteMetric4
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric4_undo */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteMetric5
+ * ipCidrRouteMetric5 is subid 15 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.15
+ * Description:
+An alternate routing metric for this route. The
+ semantics of this metric are determined by the routing-
+
+
+ protocol specified in the route's ipCidrRouteProto
+ value. If this metric is not used, its value should be
+ set to -1.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: -1
+ *
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteMetric5_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipCidrRouteMetric5_check_value(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long ipCidrRouteMetric5_val)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric5_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipCidrRouteMetric5 value.
+ */
+ /*
+ * does any os use metric 2-5? if so, update to deal with it.
+ * otherwise, only accept same value we have.
+ */
+ if (ipCidrRouteMetric5_val != rowreq_ctx->data->rt_metric5)
+ return MFD_NOT_VALID_EVER;
+
+ return MFD_SUCCESS; /* ipCidrRouteMetric5 value not illegal */
+} /* ipCidrRouteMetric5_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipCidrRouteTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipCidrRouteTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipCidrRouteMetric5_undo_setup(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric5_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipCidrRouteMetric5 undo.
+ */
+ /*
+ * copy ipCidrRouteMetric5 data
+ * set rowreq_ctx->undo->ipCidrRouteMetric5 from rowreq_ctx->data->ipCidrRouteMetric5
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric5_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipCidrRouteMetric5_val
+ * A long containing the new value.
+ */
+int
+ipCidrRouteMetric5_set(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ long ipCidrRouteMetric5_val)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric5_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipCidrRouteMetric5 value.
+ * set ipCidrRouteMetric5 value in rowreq_ctx->data
+ */
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric5_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipCidrRouteMetric5_undo(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMetric5_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipCidrRouteMetric5 undo.
+ */
+ /*
+ * copy ipCidrRouteMetric5 data
+ * set rowreq_ctx->data->ipCidrRouteMetric5 from rowreq_ctx->undo->ipCidrRouteMetric5
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteMetric5_undo */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteStatus
+ * ipCidrRouteStatus is subid 16 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.24.4.1.16
+ * Description:
+The row status variable, used according to row
+ installation and removal conventions.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
+ *
+ * Its syntax is RowStatus (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipCidrRouteStatus_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipCidrRouteTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipCidrRouteStatus_check_value(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long ipCidrRouteStatus_val)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteStatus_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipCidrRouteStatus value.
+ */
+
+ return MFD_SUCCESS; /* ipCidrRouteStatus value not illegal */
+} /* ipCidrRouteStatus_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipCidrRouteTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipCidrRouteTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipCidrRouteStatus_undo_setup(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteStatus_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipCidrRouteStatus undo.
+ */
+ /*
+ * copy ipCidrRouteStatus data
+ * set rowreq_ctx->undo->ipCidrRouteStatus from rowreq_ctx->data->ipCidrRouteStatus
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteStatus_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipCidrRouteStatus_val
+ * A long containing the new value.
+ */
+int
+ipCidrRouteStatus_set(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ u_long ipCidrRouteStatus_val)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteStatus_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipCidrRouteStatus value.
+ * set ipCidrRouteStatus value in rowreq_ctx->data
+ */
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteStatus_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipCidrRouteStatus_undo(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteStatus_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipCidrRouteStatus undo.
+ */
+ /*
+ * copy ipCidrRouteStatus data
+ * set rowreq_ctx->data->ipCidrRouteStatus from rowreq_ctx->undo->ipCidrRouteStatus
+ */
+
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteStatus_undo */
+
+/** @} */
+/** @{ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable.h
new file mode 100644
index 0000000000..18c82f3654
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable.h
@@ -0,0 +1,501 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: ipCidrRouteTable.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+#ifndef IPCIDRROUTETABLE_H
+#define IPCIDRROUTETABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @addtogroup misc misc: Miscellaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/data_access/route.h>
+
+#include "mibII/route_headers.h"
+
+ /*
+ * other required module components
+ */
+ /* *INDENT-OFF* */
+config_require(ip-forward-mib/data_access/route)
+config_require(ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_interface)
+config_require(ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_data_access)
+ /* *INDENT-ON* */
+
+ /*
+ * OID, column number and enum definions for ipCidrRouteTable
+ */
+#include "ipCidrRouteTable_constants.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_ipCidrRouteTable(void);
+ void shutdown_ipCidrRouteTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipCidrRouteTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-FORWARD-MIB::ipCidrRouteTable is subid 4 of ipForward.
+ * Its status is Deprecated.
+ * OID: .1.3.6.1.2.1.4.24.4, length: 9
+ */
+ /*
+ *********************************************************************
+ * When you register your mib, you get to provide a generic
+ * pointer that will be passed back to you for most of the
+ * functions calls.
+ *
+ * TODO:100:r: Review all context structures
+ */
+ /*
+ * TODO:101:o: |-> Review ipCidrRouteTable registration context.
+ */
+ typedef netsnmp_data_list ipCidrRouteTable_registration;
+
+/**********************************************************************/
+ /*
+ * TODO:110:r: |-> Review ipCidrRouteTable data context structure.
+ * This structure is used to represent the data for ipCidrRouteTable.
+ */
+ typedef netsnmp_route_entry ipCidrRouteTable_data;
+
+
+ /*
+ *********************************************************************
+ * TODO:115:o: |-> Review ipCidrRouteTable undo context.
+ * We're just going to use the same data structure for our
+ * undo_context. If you want to do something more efficent,
+ * define your typedef here.
+ */
+ typedef ipCidrRouteTable_data ipCidrRouteTable_undo_data;
+
+ /*
+ * TODO:120:r: |-> Review ipCidrRouteTable mib index.
+ * This structure is used to represent the index for ipCidrRouteTable.
+ */
+ typedef struct ipCidrRouteTable_mib_index_s {
+
+ /*
+ * ipCidrRouteDest(1)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ uint32_t ipCidrRouteDest;
+
+ /*
+ * ipCidrRouteMask(2)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ uint32_t ipCidrRouteMask;
+
+ /*
+ * ipCidrRouteTos(3)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ */
+ long ipCidrRouteTos;
+
+ /*
+ * ipCidrRouteNextHop(4)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ uint32_t ipCidrRouteNextHop;
+
+
+ } ipCidrRouteTable_mib_index;
+
+ /*
+ * TODO:121:r: | |-> Review ipCidrRouteTable max index length.
+ * If you KNOW that your indexes will never exceed a certain
+ * length, update this macro to that length.
+ */
+#define MAX_ipCidrRouteTable_IDX_LEN 13
+
+
+ /*
+ *********************************************************************
+ * TODO:130:o: |-> Review ipCidrRouteTable Row request (rowreq) context.
+ * When your functions are called, you will be passed a
+ * ipCidrRouteTable_rowreq_ctx pointer.
+ */
+ typedef struct ipCidrRouteTable_rowreq_ctx_s {
+
+ /** this must be first for container compare to work */
+ netsnmp_index oid_idx;
+ oid oid_tmp[MAX_ipCidrRouteTable_IDX_LEN];
+
+ ipCidrRouteTable_mib_index tbl_idx;
+
+ ipCidrRouteTable_data *data;
+ ipCidrRouteTable_undo_data *undo;
+ unsigned int column_set_flags; /* flags for set columns */
+
+
+ /*
+ * flags per row. Currently, the first (lower) 8 bits are reserved
+ * for the user. See mfd.h for other flags.
+ */
+ u_int rowreq_flags;
+
+ /*
+ * TODO:131:o: | |-> Add useful data to ipCidrRouteTable rowreq context.
+ */
+ u_char ipCidrRouteStatus;
+
+ /*
+ * storage for future expansion
+ */
+ netsnmp_data_list *ipCidrRouteTable_data_list;
+
+ } ipCidrRouteTable_rowreq_ctx;
+
+ typedef struct ipCidrRouteTable_ref_rowreq_ctx_s {
+ ipCidrRouteTable_rowreq_ctx *rowreq_ctx;
+ } ipCidrRouteTable_ref_rowreq_ctx;
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int
+ ipCidrRouteTable_pre_request(ipCidrRouteTable_registration *
+ user_context);
+ int
+ ipCidrRouteTable_post_request(ipCidrRouteTable_registration *
+ user_context, int rc);
+
+ int
+ ipCidrRouteTable_rowreq_ctx_init(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, void *user_init_ctx);
+ void
+ ipCidrRouteTable_rowreq_ctx_cleanup(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ ipCidrRouteTable_data *ipCidrRouteTable_allocate_data(void);
+ void ipCidrRouteTable_release_data(ipCidrRouteTable_data *
+ data);
+
+ int ipCidrRouteTable_commit(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ ipCidrRouteTable_rowreq_ctx
+ * ipCidrRouteTable_row_find_by_mib_index(ipCidrRouteTable_mib_index
+ * mib_idx);
+
+ extern oid ipCidrRouteTable_oid[];
+ extern int ipCidrRouteTable_oid_size;
+
+
+#include "ipCidrRouteTable_interface.h"
+#include "ipCidrRouteTable_data_access.h"
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipCidrRouteTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-FORWARD-MIB::ipCidrRouteTable is subid 4 of ipForward.
+ * Its status is Deprecated.
+ * OID: .1.3.6.1.2.1.4.24.4, length: 9
+ */
+ /*
+ * indexes
+ */
+
+ int ipCidrRouteIfIndex_get(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, long
+ *ipCidrRouteIfIndex_val_ptr);
+ int ipCidrRouteType_get(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long * ipCidrRouteType_val_ptr);
+ int ipCidrRouteProto_get(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipCidrRouteProto_val_ptr);
+ int ipCidrRouteAge_get(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long *ipCidrRouteAge_val_ptr);
+ int ipCidrRouteInfo_get(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ oid ** ipCidrRouteInfo_val_ptr_ptr,
+ size_t
+ * ipCidrRouteInfo_val_ptr_len_ptr);
+ int ipCidrRouteNextHopAS_get(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, long
+ *ipCidrRouteNextHopAS_val_ptr);
+ int ipCidrRouteMetric1_get(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, long
+ *ipCidrRouteMetric1_val_ptr);
+ int ipCidrRouteMetric2_get(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, long
+ *ipCidrRouteMetric2_val_ptr);
+ int ipCidrRouteMetric3_get(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, long
+ *ipCidrRouteMetric3_val_ptr);
+ int ipCidrRouteMetric4_get(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, long
+ *ipCidrRouteMetric4_val_ptr);
+ int ipCidrRouteMetric5_get(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, long
+ *ipCidrRouteMetric5_val_ptr);
+ int ipCidrRouteStatus_get(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipCidrRouteStatus_val_ptr);
+
+
+ int
+ ipCidrRouteTable_indexes_set_tbl_idx(ipCidrRouteTable_mib_index *
+ tbl_idx,
+ u_long ipCidrRouteDest_val,
+ u_long ipCidrRouteMask_val,
+ long ipCidrRouteTos_val,
+ u_long
+ ipCidrRouteNextHop_val);
+ int
+ ipCidrRouteTable_indexes_set(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipCidrRouteDest_val,
+ u_long ipCidrRouteMask_val,
+ long ipCidrRouteTos_val,
+ u_long ipCidrRouteNextHop_val);
+
+
+
+ /*
+ *********************************************************************
+ * SET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * SET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipCidrRouteTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-FORWARD-MIB::ipCidrRouteTable is subid 4 of ipForward.
+ * Its status is Deprecated.
+ * OID: .1.3.6.1.2.1.4.24.4, length: 9
+ */
+
+
+ int ipCidrRouteTable_undo_setup(ipCidrRouteTable_rowreq_ctx
+ * rowreq_ctx);
+ int
+ ipCidrRouteTable_undo_cleanup(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipCidrRouteTable_undo(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipCidrRouteTable_commit(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+ ipCidrRouteTable_undo_commit(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+ int
+ ipCidrRouteIfIndex_check_value(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipCidrRouteIfIndex_val);
+ int
+ ipCidrRouteIfIndex_undo_setup(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipCidrRouteIfIndex_set(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipCidrRouteIfIndex_val);
+ int ipCidrRouteIfIndex_undo(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ipCidrRouteType_check_value(ipCidrRouteTable_rowreq_ctx
+ * rowreq_ctx,
+ u_long
+ ipCidrRouteType_val);
+ int ipCidrRouteType_undo_setup(ipCidrRouteTable_rowreq_ctx
+ * rowreq_ctx);
+ int ipCidrRouteType_set(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipCidrRouteType_val);
+ int ipCidrRouteType_undo(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ ipCidrRouteProto_check_value(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipCidrRouteProto_val);
+ int ipCidrRouteProto_undo_setup(ipCidrRouteTable_rowreq_ctx
+ * rowreq_ctx);
+ int ipCidrRouteProto_set(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipCidrRouteProto_val);
+ int ipCidrRouteProto_undo(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ipCidrRouteAge_check_value(ipCidrRouteTable_rowreq_ctx
+ * rowreq_ctx,
+ long ipCidrRouteAge_val);
+ int ipCidrRouteAge_undo_setup(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipCidrRouteAge_set(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipCidrRouteAge_val);
+ int ipCidrRouteAge_undo(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ipCidrRouteInfo_check_value(ipCidrRouteTable_rowreq_ctx
+ * rowreq_ctx,
+ oid *
+ ipCidrRouteInfo_val_ptr,
+ size_t
+ ipCidrRouteInfo_val_ptr_len);
+ int ipCidrRouteInfo_undo_setup(ipCidrRouteTable_rowreq_ctx
+ * rowreq_ctx);
+ int ipCidrRouteInfo_set(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ oid * ipCidrRouteInfo_val_ptr,
+ size_t
+ ipCidrRouteInfo_val_ptr_len);
+ int ipCidrRouteInfo_undo(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ ipCidrRouteNextHopAS_check_value(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipCidrRouteNextHopAS_val);
+ int
+ ipCidrRouteNextHopAS_undo_setup(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipCidrRouteNextHopAS_set(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, long
+ ipCidrRouteNextHopAS_val);
+ int ipCidrRouteNextHopAS_undo(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ ipCidrRouteMetric1_check_value(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipCidrRouteMetric1_val);
+ int
+ ipCidrRouteMetric1_undo_setup(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipCidrRouteMetric1_set(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipCidrRouteMetric1_val);
+ int ipCidrRouteMetric1_undo(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ ipCidrRouteMetric2_check_value(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipCidrRouteMetric2_val);
+ int
+ ipCidrRouteMetric2_undo_setup(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipCidrRouteMetric2_set(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipCidrRouteMetric2_val);
+ int ipCidrRouteMetric2_undo(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ ipCidrRouteMetric3_check_value(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipCidrRouteMetric3_val);
+ int
+ ipCidrRouteMetric3_undo_setup(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipCidrRouteMetric3_set(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipCidrRouteMetric3_val);
+ int ipCidrRouteMetric3_undo(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ ipCidrRouteMetric4_check_value(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipCidrRouteMetric4_val);
+ int
+ ipCidrRouteMetric4_undo_setup(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipCidrRouteMetric4_set(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipCidrRouteMetric4_val);
+ int ipCidrRouteMetric4_undo(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ ipCidrRouteMetric5_check_value(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipCidrRouteMetric5_val);
+ int
+ ipCidrRouteMetric5_undo_setup(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipCidrRouteMetric5_set(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipCidrRouteMetric5_val);
+ int ipCidrRouteMetric5_undo(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ ipCidrRouteStatus_check_value(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipCidrRouteStatus_val);
+ int
+ ipCidrRouteStatus_undo_setup(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipCidrRouteStatus_set(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipCidrRouteStatus_val);
+ int ipCidrRouteStatus_undo(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+ int
+ ipCidrRouteTable_check_dependencies(ipCidrRouteTable_rowreq_ctx *
+ ctx);
+
+
+ /*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPCIDRROUTETABLE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_constants.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_constants.h
new file mode 100644
index 0000000000..7d99e000de
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_constants.h
@@ -0,0 +1,172 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $
+ *
+ * $Id: ipCidrRouteTable_constants.h 13754 2005-11-30 22:32:31Z rstory $
+ */
+#ifndef IPCIDRROUTETABLE_CONSTANTS_H
+#define IPCIDRROUTETABLE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ * column number definitions for table ipCidrRouteTable
+ */
+#define IPCIDRROUTETABLE_OID 1,3,6,1,2,1,4,24,4
+
+#define COLUMN_IPCIDRROUTEDEST 1
+
+#define COLUMN_IPCIDRROUTEMASK 2
+
+#define COLUMN_IPCIDRROUTETOS 3
+
+#define COLUMN_IPCIDRROUTENEXTHOP 4
+
+#define COLUMN_IPCIDRROUTEIFINDEX 5
+#define COLUMN_IPCIDRROUTEIFINDEX_FLAG (0x1 << 4)
+
+#define COLUMN_IPCIDRROUTETYPE 6
+#define COLUMN_IPCIDRROUTETYPE_FLAG (0x1 << 5)
+
+#define COLUMN_IPCIDRROUTEPROTO 7
+
+#define COLUMN_IPCIDRROUTEAGE 8
+
+#define COLUMN_IPCIDRROUTEINFO 9
+#define COLUMN_IPCIDRROUTEINFO_FLAG (0x1 << 8)
+
+#define COLUMN_IPCIDRROUTENEXTHOPAS 10
+#define COLUMN_IPCIDRROUTENEXTHOPAS_FLAG (0x1 << 9)
+
+#define COLUMN_IPCIDRROUTEMETRIC1 11
+#define COLUMN_IPCIDRROUTEMETRIC1_FLAG (0x1 << 10)
+
+#define COLUMN_IPCIDRROUTEMETRIC2 12
+#define COLUMN_IPCIDRROUTEMETRIC2_FLAG (0x1 << 11)
+
+#define COLUMN_IPCIDRROUTEMETRIC3 13
+#define COLUMN_IPCIDRROUTEMETRIC3_FLAG (0x1 << 12)
+
+#define COLUMN_IPCIDRROUTEMETRIC4 14
+#define COLUMN_IPCIDRROUTEMETRIC4_FLAG (0x1 << 13)
+
+#define COLUMN_IPCIDRROUTEMETRIC5 15
+#define COLUMN_IPCIDRROUTEMETRIC5_FLAG (0x1 << 14)
+
+#define COLUMN_IPCIDRROUTESTATUS 16
+#define COLUMN_IPCIDRROUTESTATUS_FLAG (0x1 << 15)
+
+
+#define IPCIDRROUTETABLE_MIN_COL COLUMN_IPCIDRROUTEDEST
+#define IPCIDRROUTETABLE_MAX_COL COLUMN_IPCIDRROUTESTATUS
+
+
+ /*
+ * TODO:405:r: Review IPCIDRROUTETABLE_SETTABLE_COLS macro.
+ * OR together all the writable cols.
+ */
+#define IPCIDRROUTETABLE_SETTABLE_COLS (COLUMN_IPCIDRROUTEIFINDEX_FLAG | COLUMN_IPCIDRROUTETYPE_FLAG | COLUMN_IPCIDRROUTEINFO_FLAG | COLUMN_IPCIDRROUTENEXTHOPAS_FLAG | COLUMN_IPCIDRROUTEMETRIC1_FLAG | COLUMN_IPCIDRROUTEMETRIC2_FLAG | COLUMN_IPCIDRROUTEMETRIC3_FLAG | COLUMN_IPCIDRROUTEMETRIC4_FLAG | COLUMN_IPCIDRROUTEMETRIC5_FLAG | COLUMN_IPCIDRROUTESTATUS_FLAG)
+ /*
+ * TODO:405:r: Review IPCIDRROUTETABLE_REQUIRED_COLS macro.
+ * OR together all the required rows for row creation.
+ * default is writable cols w/out defaults.
+ */
+#define IPCIDRROUTETABLE_REQUIRED_COLS (COLUMN_IPCIDRROUTETYPE_FLAG | COLUMN_IPCIDRROUTEINFO_FLAG | COLUMN_IPCIDRROUTESTATUS_FLAG)
+
+ /*
+ * NOTES on enums
+ * ==============
+ *
+ * Value Mapping
+ * -------------
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them
+ * below. For example, a boolean flag (1/0) is usually represented
+ * as a TruthValue in a MIB, which maps to the values (1/2).
+ *
+ */
+/*************************************************************************
+ *************************************************************************
+ *
+ * enum definitions for table ipCidrRouteTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipCidrRouteType (INTEGER / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef IPCIDRROUTETYPE_ENUMS
+#define IPCIDRROUTETYPE_ENUMS
+
+#define IPCIDRROUTETYPE_OTHER 1
+#define IPCIDRROUTETYPE_REJECT 2
+#define IPCIDRROUTETYPE_LOCAL 3
+#define IPCIDRROUTETYPE_REMOTE 4
+
+#endif /* IPCIDRROUTETYPE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipCidrRouteProto (INTEGER / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef IPCIDRROUTEPROTO_ENUMS
+#define IPCIDRROUTEPROTO_ENUMS
+
+#define IPCIDRROUTEPROTO_OTHER 1
+#define IPCIDRROUTEPROTO_LOCAL 2
+#define IPCIDRROUTEPROTO_NETMGMT 3
+#define IPCIDRROUTEPROTO_ICMP 4
+#define IPCIDRROUTEPROTO_EGP 5
+#define IPCIDRROUTEPROTO_GGP 6
+#define IPCIDRROUTEPROTO_HELLO 7
+#define IPCIDRROUTEPROTO_RIP 8
+#define IPCIDRROUTEPROTO_ISIS 9
+#define IPCIDRROUTEPROTO_ESIS 10
+#define IPCIDRROUTEPROTO_CISCOIGRP 11
+#define IPCIDRROUTEPROTO_BBNSPFIGP 12
+#define IPCIDRROUTEPROTO_OSPF 13
+#define IPCIDRROUTEPROTO_BGP 14
+#define IPCIDRROUTEPROTO_IDPR 15
+#define IPCIDRROUTEPROTO_CISCOEIGRP 16
+
+#endif /* IPCIDRROUTEPROTO_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipCidrRouteStatus (RowStatus / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef ROWSTATUS_ENUMS
+#define ROWSTATUS_ENUMS
+
+#define ROWSTATUS_ACTIVE 1
+#define ROWSTATUS_NOTINSERVICE 2
+#define ROWSTATUS_NOTREADY 3
+#define ROWSTATUS_CREATEANDGO 4
+#define ROWSTATUS_CREATEANDWAIT 5
+#define ROWSTATUS_DESTROY 6
+
+#endif /* ROWSTATUS_ENUMS */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPCIDRROUTETABLE_OIDS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_data_access.c
new file mode 100644
index 0000000000..b82ed63295
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_data_access.c
@@ -0,0 +1,671 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: ipCidrRouteTable_data_access.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipCidrRouteTable.h"
+
+
+#include "ipCidrRouteTable_data_access.h"
+
+
+/** @ingroup interface
+ * @addtogroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipCidrRouteTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-FORWARD-MIB::ipCidrRouteTable is subid 4 of ipForward.
+ * Its status is Deprecated.
+ * OID: .1.3.6.1.2.1.4.24.4, length: 9
+ */
+
+/**
+ * initialization for ipCidrRouteTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param ipCidrRouteTable_reg
+ * Pointer to ipCidrRouteTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+ipCidrRouteTable_init_data(ipCidrRouteTable_registration *
+ ipCidrRouteTable_reg)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_init_data",
+ "called\n"));
+
+ /*
+ * TODO:303:o: Initialize ipCidrRouteTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteTable_init_data */
+
+/**
+ * container overview
+ *
+ */
+
+/**
+ * container initialization
+ *
+ * @param container_ptr_ptr A pointer to a container pointer. If you
+ * create a custom container, use this parameter to return it
+ * to the MFD helper. If set to NULL, the MFD helper will
+ * allocate a container for you.
+ * @param cache A pointer to a cache structure. You can set the timeout
+ * and other cache flags using this pointer.
+ *
+ * This function is called at startup to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases. If no custom
+ * container is allocated, the MFD code will create one for your.
+ *
+ * This is also the place to set up cache behavior. The default, to
+ * simply set the cache timeout, will work well with the default
+ * container. If you are using a custom container, you may want to
+ * look at the cache helper documentation to see if there are any
+ * flags you want to set.
+ *
+ * @remark
+ * This would also be a good place to do any initialization needed
+ * for you data source. For example, opening a connection to another
+ * process that will supply the data, opening a database, etc.
+ */
+void
+ipCidrRouteTable_container_init(netsnmp_container **container_ptr_ptr,
+ netsnmp_cache * cache)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_container_init",
+ "called\n"));
+
+ if (NULL == container_ptr_ptr) {
+ snmp_log(LOG_ERR,
+ "bad container param to ipCidrRouteTable_container_init\n");
+ return;
+ }
+
+ /*
+ * For advanced users, you can use a custom container. If you
+ * do not create one, one will be created for you.
+ */
+ *container_ptr_ptr = NULL;
+
+ if (NULL == cache) {
+ snmp_log(LOG_ERR,
+ "bad cache param to ipCidrRouteTable_container_init\n");
+ return;
+ }
+
+ /*
+ * TODO:345:A: Set up ipCidrRouteTable cache properties.
+ *
+ * Also for advanced users, you can set parameters for the
+ * cache. Do not change the magic pointer, as it is used
+ * by the MFD helper. To completely disable caching, set
+ * cache->enabled to 0.
+ */
+ cache->timeout = IPCIDRROUTETABLE_CACHE_TIMEOUT; /* seconds */
+} /* ipCidrRouteTable_container_init */
+
+/**
+ * check entry for update
+ *
+ */
+static void
+_snarf_route_entry(netsnmp_route_entry *route_entry,
+ netsnmp_container *container)
+{
+ ipCidrRouteTable_rowreq_ctx *rowreq_ctx;
+
+ DEBUGTRACE;
+
+ netsnmp_assert(NULL != route_entry);
+ netsnmp_assert(NULL != container);
+
+ /*
+ * allocate an row context and set the index(es), then add it to
+ * the container
+ */
+ rowreq_ctx = ipCidrRouteTable_allocate_rowreq_ctx(route_entry, NULL);
+ if ((NULL != rowreq_ctx) &&
+ (MFD_SUCCESS == ipCidrRouteTable_indexes_set
+ (rowreq_ctx, *((u_long *) route_entry->rt_dest),
+ route_entry->rt_mask, route_entry->rt_tos,
+ *((u_long *) route_entry->rt_nexthop)))) {
+ CONTAINER_INSERT(container, rowreq_ctx);
+ rowreq_ctx->ipCidrRouteStatus = ROWSTATUS_ACTIVE;
+ } else {
+ if (rowreq_ctx) {
+ snmp_log(LOG_ERR, "error setting index while loading "
+ "ipCidrRoute cache.\n");
+ ipCidrRouteTable_release_rowreq_ctx(rowreq_ctx);
+ } else
+ netsnmp_access_route_entry_free(route_entry);
+ }
+}
+
+/**
+ * container shutdown
+ *
+ * @param container_ptr A pointer to the container.
+ *
+ * This function is called at shutdown to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases.
+ *
+ * This function is called before ipCidrRouteTable_container_free().
+ *
+ * @remark
+ * This would also be a good place to do any cleanup needed
+ * for you data source. For example, closing a connection to another
+ * process that supplied the data, closing a database, etc.
+ */
+void
+ipCidrRouteTable_container_shutdown(netsnmp_container *container_ptr)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_container_shutdown", "called\n"));
+
+ if (NULL == container_ptr) {
+ snmp_log(LOG_ERR,
+ "bad params to ipCidrRouteTable_container_shutdown\n");
+ return;
+ }
+
+} /* ipCidrRouteTable_container_shutdown */
+
+/**
+ * load initial data
+ *
+ * TODO:350:M: Implement ipCidrRouteTable data load
+ * This function will also be called by the cache helper to load
+ * the container again (after the container free function has been
+ * called to free the previous contents).
+ *
+ * @param container container to which items should be inserted
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
+ * @retval MFD_ERROR : other error.
+ *
+ * This function is called to load the index(es) (and data, optionally)
+ * for the every row in the data set.
+ *
+ * @remark
+ * While loading the data, the only important thing is the indexes.
+ * If access to your data is cheap/fast (e.g. you have a pointer to a
+ * structure in memory), it would make sense to update the data here.
+ * If, however, the accessing the data invovles more work (e.g. parsing
+ * some other existing data, or peforming calculations to derive the data),
+ * then you can limit yourself to setting the indexes and saving any
+ * information you will need later. Then use the saved information in
+ * ipCidrRouteTable_row_prep() for populating data.
+ *
+ * @note
+ * If you need consistency between rows (like you want statistics
+ * for each row to be from the same time frame), you should set all
+ * data here.
+ *
+ */
+int
+ipCidrRouteTable_container_load(netsnmp_container *container)
+{
+ netsnmp_container *route_container;
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_cache_load",
+ "called\n"));
+
+ /*
+ * TODO:351:M: |-> Load/update data in the ipCidrRouteTable container.
+ * loop over your ipCidrRouteTable data, allocate a rowreq context,
+ * set the index(es) [and data, optionally] and insert into
+ * the container.
+ */
+ route_container =
+ netsnmp_access_route_container_load(NULL,
+ NETSNMP_ACCESS_ROUTE_LOAD_IPV4_ONLY);
+
+ if (NULL == route_container)
+ return MFD_RESOURCE_UNAVAILABLE; /* msg already logged */
+
+ /*
+ * we just got a fresh copy of route data. snarf data
+ */
+ CONTAINER_FOR_EACH(route_container,
+ (netsnmp_container_obj_func *) _snarf_route_entry,
+ container);
+
+ /*
+ * free the container. we've either claimed each ifentry, or released it,
+ * so the dal function doesn't need to clear the container.
+ */
+ netsnmp_access_route_container_free(route_container,
+ NETSNMP_ACCESS_ROUTE_FREE_DONT_CLEAR);
+
+ DEBUGMSGT(("verbose:ipCidrRouteTable:ipCidrRouteTable_cache_load",
+ "%d records\n", CONTAINER_SIZE(container)));
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteTable_container_load */
+
+/**
+ * container clean up
+ *
+ * @param container container with all current items
+ *
+ * This optional callback is called prior to all
+ * item's being removed from the container. If you
+ * need to do any processing before that, do it here.
+ *
+ * @note
+ * The MFD helper will take care of releasing all the row contexts.
+ *
+ */
+void
+ipCidrRouteTable_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_container_free",
+ "called\n"));
+
+ /*
+ * TODO:380:M: Free ipCidrRouteTable container data.
+ */
+} /* ipCidrRouteTable_container_free */
+
+/**
+ * prepare row for processing.
+ *
+ * When the agent has located the row for a request, this function is
+ * called to prepare the row for processing. If you fully populated
+ * the data context during the index setup phase, you may not need to
+ * do anything.
+ *
+ * @param rowreq_ctx pointer to a context.
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ */
+int
+ipCidrRouteTable_row_prep(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_row_prep",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+
+ return MFD_SUCCESS;
+} /* ipCidrRouteTable_row_prep */
+
+/*
+ * TODO:420:r: Implement ipCidrRouteTable index validation.
+ */
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteDest
+ * ipCidrRouteDest is subid 1 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.24.4.1.1
+ * Description:
+The destination IP address of this route.
+
+ This object may not take a Multicast (Class D) address
+ value.
+
+ Any assignment (implicit or otherwise) of an instance
+ of this object to a value x must be rejected if the
+ bitwise logical-AND of x with the value of the
+ corresponding instance of the ipCidrRouteMask object is
+ not equal to x.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is IPADDR (based on perltype IPADDR)
+ * The net-snmp type is ASN_IPADDRESS. The C type decl is u_long (u_long)
+ */
+/**
+ * check validity of ipCidrRouteDest index portion
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ *
+ * @note this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * ipCidrRouteTable_validate_index() function.
+ *
+ * @note Also keep in mind that if the index refers to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ * The following checks have already been done for you:
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ */
+int
+ipCidrRouteDest_check_index(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteDest_check_index",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:426:M: |-> Check ipCidrRouteTable index ipCidrRouteDest.
+ * check that index value in the table context is legal.
+ * (rowreq_ctx->tbl_index.ipCidrRouteDest)
+ */
+
+ return MFD_SUCCESS; /* ipCidrRouteDest index ok */
+} /* ipCidrRouteDest_check_index */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteMask
+ * ipCidrRouteMask is subid 2 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.24.4.1.2
+ * Description:
+Indicate the mask to be logical-ANDed with the
+ destination address before being compared to the value
+ in the ipCidrRouteDest field. For those systems that
+ do not support arbitrary subnet masks, an agent
+ constructs the value of the ipCidrRouteMask by
+ reference to the IP Address Class.
+
+ Any assignment (implicit or otherwise) of an instance
+ of this object to a value x must be rejected if the
+ bitwise logical-AND of x with the value of the
+ corresponding instance of the ipCidrRouteDest object is
+
+
+ not equal to ipCidrRouteDest.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is IPADDR (based on perltype IPADDR)
+ * The net-snmp type is ASN_IPADDRESS. The C type decl is u_long (u_long)
+ */
+/**
+ * check validity of ipCidrRouteMask index portion
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ *
+ * @note this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * ipCidrRouteTable_validate_index() function.
+ *
+ * @note Also keep in mind that if the index refers to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ * The following checks have already been done for you:
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ */
+int
+ipCidrRouteMask_check_index(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteMask_check_index",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:426:M: |-> Check ipCidrRouteTable index ipCidrRouteMask.
+ * check that index value in the table context is legal.
+ * (rowreq_ctx->tbl_index.ipCidrRouteMask)
+ */
+
+ return MFD_SUCCESS; /* ipCidrRouteMask index ok */
+} /* ipCidrRouteMask_check_index */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteTos
+ * ipCidrRouteTos is subid 3 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.24.4.1.3
+ * Description:
+The policy specifier is the IP TOS Field. The encoding
+ of IP TOS is as specified by the following convention.
+ Zero indicates the default path if no more specific
+ policy applies.
+
+ +-----+-----+-----+-----+-----+-----+-----+-----+
+ | | | |
+ | PRECEDENCE | TYPE OF SERVICE | 0 |
+ | | | |
+ +-----+-----+-----+-----+-----+-----+-----+-----+
+
+ IP TOS IP TOS
+ Field Policy Field Policy
+ Contents Code Contents Code
+ 0 0 0 0 ==> 0 0 0 0 1 ==> 2
+ 0 0 1 0 ==> 4 0 0 1 1 ==> 6
+ 0 1 0 0 ==> 8 0 1 0 1 ==> 10
+ 0 1 1 0 ==> 12 0 1 1 1 ==> 14
+ 1 0 0 0 ==> 16 1 0 0 1 ==> 18
+ 1 0 1 0 ==> 20 1 0 1 1 ==> 22
+ 1 1 0 0 ==> 24 1 1 0 1 ==> 26
+ 1 1 1 0 ==> 28 1 1 1 1 ==> 30
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 0
+ * settable 0
+ *
+ * Ranges: 0 - 2147483647;
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * check validity of ipCidrRouteTos index portion
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ *
+ * @note this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * ipCidrRouteTable_validate_index() function.
+ *
+ * @note Also keep in mind that if the index refers to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ * The following checks have already been done for you:
+ * The value is in (one of) the range set(s): 0 - 2147483647
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ */
+int
+ipCidrRouteTos_check_index(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTos_check_index",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:426:M: |-> Check ipCidrRouteTable index ipCidrRouteTos.
+ * check that index value in the table context is legal.
+ * (rowreq_ctx->tbl_index.ipCidrRouteTos)
+ */
+
+ return MFD_SUCCESS; /* ipCidrRouteTos index ok */
+} /* ipCidrRouteTos_check_index */
+
+/*---------------------------------------------------------------------
+ * IP-FORWARD-MIB::ipCidrRouteEntry.ipCidrRouteNextHop
+ * ipCidrRouteNextHop is subid 4 of ipCidrRouteEntry.
+ * Its status is Deprecated, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.24.4.1.4
+ * Description:
+On remote routes, the address of the next system en
+ route; Otherwise, 0.0.0.0.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is IPADDR (based on perltype IPADDR)
+ * The net-snmp type is ASN_IPADDRESS. The C type decl is u_long (u_long)
+ */
+/**
+ * check validity of ipCidrRouteNextHop index portion
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ *
+ * @note this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * ipCidrRouteTable_validate_index() function.
+ *
+ * @note Also keep in mind that if the index refers to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ * The following checks have already been done for you:
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ */
+int
+ipCidrRouteNextHop_check_index(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteNextHop_check_index",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:426:M: |-> Check ipCidrRouteTable index ipCidrRouteNextHop.
+ * check that index value in the table context is legal.
+ * (rowreq_ctx->tbl_index.ipCidrRouteNextHop)
+ */
+
+ return MFD_SUCCESS; /* ipCidrRouteNextHop index ok */
+} /* ipCidrRouteNextHop_check_index */
+
+/**
+ * verify specified index is valid.
+ *
+ * This check is independent of whether or not the values specified for
+ * the columns of the new row are valid. Column values and row consistency
+ * will be checked later. At this point, only the index values should be
+ * checked.
+ *
+ * All of the individual index validation functions have been called, so this
+ * is the place to make sure they are valid as a whole when combined. If
+ * you only have one index, then you probably don't need to do anything else
+ * here.
+ *
+ * @note Keep in mind that if the indexes refer to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ *
+ * @param ipCidrRouteTable_reg
+ * Pointer to the user registration data
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_CANNOT_CREATE_NOW : index not valid right now
+ * @retval MFD_CANNOT_CREATE_EVER : index never valid
+ */
+int
+ipCidrRouteTable_validate_index(ipCidrRouteTable_registration *
+ ipCidrRouteTable_reg,
+ ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_validate_index",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:430:M: |-> Validate potential ipCidrRouteTable index.
+ */
+ if (1) {
+ snmp_log(LOG_WARNING, "invalid index for a new row in the "
+ "ipCidrRouteTable table.\n");
+ /*
+ * determine failure type.
+ *
+ * If the index could not ever be created, return MFD_NOT_EVER
+ * If the index can not be created under the present circumstances
+ * (even though it could be created under other circumstances),
+ * return MFD_NOT_NOW.
+ */
+ if (0) {
+ return MFD_CANNOT_CREATE_EVER;
+ } else {
+ return MFD_CANNOT_CREATE_NOW;
+ }
+ }
+
+ return rc;
+} /* ipCidrRouteTable_validate_index */
+
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_data_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_data_access.h
new file mode 100644
index 0000000000..331939fad7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_data_access.h
@@ -0,0 +1,82 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: ipCidrRouteTable_data_access.h 13754 2005-11-30 22:32:31Z rstory $
+ */
+#ifndef IPCIDRROUTETABLE_DATA_ACCESS_H
+#define IPCIDRROUTETABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipCidrRouteTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-FORWARD-MIB::ipCidrRouteTable is subid 4 of ipForward.
+ * Its status is Deprecated.
+ * OID: .1.3.6.1.2.1.4.24.4, length: 9
+ */
+
+
+ int
+ ipCidrRouteTable_init_data(ipCidrRouteTable_registration *
+ ipCidrRouteTable_reg);
+
+
+ /*
+ * TODO:180:o: Review ipCidrRouteTable cache timeout.
+ * The number of seconds before the cache times out
+ */
+#define IPCIDRROUTETABLE_CACHE_TIMEOUT 60
+
+ void ipCidrRouteTable_container_init(netsnmp_container
+ **container_ptr_ptr,
+ netsnmp_cache * cache);
+ void ipCidrRouteTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int ipCidrRouteTable_container_load(netsnmp_container
+ *container);
+ void ipCidrRouteTable_container_free(netsnmp_container
+ *container);
+
+ int ipCidrRouteTable_cache_load(netsnmp_container
+ *container);
+ void ipCidrRouteTable_cache_free(netsnmp_container
+ *container);
+
+ int ipCidrRouteTable_row_prep(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ ipCidrRouteTable_validate_index(ipCidrRouteTable_registration *
+ ipCidrRouteTable_reg,
+ ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipCidrRouteDest_check_index(ipCidrRouteTable_rowreq_ctx * rowreq_ctx); /* internal */
+ int ipCidrRouteMask_check_index(ipCidrRouteTable_rowreq_ctx * rowreq_ctx); /* internal */
+ int ipCidrRouteTos_check_index(ipCidrRouteTable_rowreq_ctx * rowreq_ctx); /* internal */
+ int ipCidrRouteNextHop_check_index(ipCidrRouteTable_rowreq_ctx * rowreq_ctx); /* internal */
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPCIDRROUTETABLE_DATA_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_interface.c
new file mode 100644
index 0000000000..f67626b47f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_interface.c
@@ -0,0 +1,2318 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: ipCidrRouteTable_interface.c 15781 2007-01-23 22:55:06Z rstory $
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipCidrRouteTable.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "ipCidrRouteTable_interface.h"
+
+#include <ctype.h>
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipCidrRouteTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-FORWARD-MIB::ipCidrRouteTable is subid 4 of ipForward.
+ * Its status is Deprecated.
+ * OID: .1.3.6.1.2.1.4.24.4, length: 9
+ */
+typedef struct ipCidrRouteTable_interface_ctx_s {
+
+ netsnmp_container *container;
+ netsnmp_cache *cache;
+
+ ipCidrRouteTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+ u_int table_dirty;
+
+} ipCidrRouteTable_interface_ctx;
+
+static ipCidrRouteTable_interface_ctx ipCidrRouteTable_if_ctx;
+
+static void
+ _ipCidrRouteTable_container_init(ipCidrRouteTable_interface_ctx * if_ctx);
+static void
+ _ipCidrRouteTable_container_shutdown(ipCidrRouteTable_interface_ctx *
+ if_ctx);
+
+
+netsnmp_container *
+ipCidrRouteTable_container_get(void)
+{
+ return ipCidrRouteTable_if_ctx.container;
+}
+
+ipCidrRouteTable_registration *
+ipCidrRouteTable_registration_get(void)
+{
+ return ipCidrRouteTable_if_ctx.user_ctx;
+}
+
+ipCidrRouteTable_registration *
+ipCidrRouteTable_registration_set(ipCidrRouteTable_registration * newreg)
+{
+ ipCidrRouteTable_registration *old = ipCidrRouteTable_if_ctx.user_ctx;
+ ipCidrRouteTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+
+int
+ipCidrRouteTable_container_size(void)
+{
+ return CONTAINER_SIZE(ipCidrRouteTable_if_ctx.container);
+}
+
+u_int
+ipCidrRouteTable_dirty_get(void)
+{
+ return ipCidrRouteTable_if_ctx.table_dirty;
+}
+
+void
+ipCidrRouteTable_dirty_set(u_int status)
+{
+ DEBUGMSGTL(("ipCidrRouteTable:ipCidrRouteTable_dirty_set",
+ "called. was %d, now %d\n",
+ ipCidrRouteTable_if_ctx.table_dirty, status));
+ ipCidrRouteTable_if_ctx.table_dirty = status;
+}
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_pre_request;
+static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_post_request;
+static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_get_values;
+static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_check_objects;
+static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_undo_setup;
+static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_set_values;
+static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_undo_cleanup;
+static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_undo_values;
+static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_commit;
+static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_undo_commit;
+static Netsnmp_Node_Handler _mfd_ipCidrRouteTable_irreversible_commit;
+
+NETSNMP_STATIC_INLINE int
+ _ipCidrRouteTable_undo_column(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var,
+ int column);
+
+NETSNMP_STATIC_INLINE int
+ _ipCidrRouteTable_check_indexes(ipCidrRouteTable_rowreq_ctx * rowreq_ctx);
+
+/**
+ * @internal
+ * Initialize the table ipCidrRouteTable
+ * (Define its contents and how it's structured)
+ */
+void
+_ipCidrRouteTable_initialize_interface(ipCidrRouteTable_registration *
+ reg_ptr, u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &ipCidrRouteTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info =
+ &ipCidrRouteTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_ipCidrRouteTable_initialize_interface", "called\n"));
+
+
+ /*************************************************
+ *
+ * save interface context for ipCidrRouteTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_IPADDRESS,
+ /** index: ipCidrRouteDest */
+ ASN_IPADDRESS,
+ /** index: ipCidrRouteMask */
+ ASN_INTEGER,
+ /** index: ipCidrRouteTos */
+ ASN_IPADDRESS,
+ /** index: ipCidrRouteNextHop */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrival.
+ */
+ tbl_info->min_column = IPCIDRROUTETABLE_MIN_COL;
+ tbl_info->max_column = IPCIDRROUTETABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ ipCidrRouteTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ ipCidrRouteTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _ipCidrRouteTable_container_init(&ipCidrRouteTable_if_ctx);
+ if (NULL == ipCidrRouteTable_if_ctx.container) {
+ snmp_log(LOG_ERR,
+ "could not initialize container for ipCidrRouteTable\n");
+ return;
+ }
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup =
+ _mfd_ipCidrRouteTable_object_lookup;
+ access_multiplexer->get_values = _mfd_ipCidrRouteTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request = _mfd_ipCidrRouteTable_pre_request;
+ access_multiplexer->post_request = _mfd_ipCidrRouteTable_post_request;
+
+
+ /*
+ * REQUIRED wrappers for set request handling
+ */
+ access_multiplexer->object_syntax_checks =
+ _mfd_ipCidrRouteTable_check_objects;
+ access_multiplexer->undo_setup = _mfd_ipCidrRouteTable_undo_setup;
+ access_multiplexer->undo_cleanup = _mfd_ipCidrRouteTable_undo_cleanup;
+ access_multiplexer->set_values = _mfd_ipCidrRouteTable_set_values;
+ access_multiplexer->undo_sets = _mfd_ipCidrRouteTable_undo_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->commit = _mfd_ipCidrRouteTable_commit;
+ access_multiplexer->undo_commit = _mfd_ipCidrRouteTable_undo_commit;
+ access_multiplexer->irreversible_commit =
+ _mfd_ipCidrRouteTable_irreversible_commit;
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("ipCidrRouteTable:init_ipCidrRouteTable",
+ "Registering ipCidrRouteTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("ipCidrRouteTable", handler,
+ ipCidrRouteTable_oid,
+ ipCidrRouteTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RONLY);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR, "error registering table ipCidrRouteTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &ipCidrRouteTable_if_ctx;
+
+ /*************************************************
+ *
+ * set up baby steps handler, create it and inject it
+ */
+ if (access_multiplexer->object_lookup)
+ mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
+ if (access_multiplexer->set_values)
+ mfd_modes |= BABY_STEP_SET_VALUES;
+ if (access_multiplexer->irreversible_commit)
+ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
+ if (access_multiplexer->object_syntax_checks)
+ mfd_modes |= BABY_STEP_CHECK_OBJECT;
+
+ if (access_multiplexer->pre_request)
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if (access_multiplexer->post_request)
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+ if (access_multiplexer->undo_setup)
+ mfd_modes |= BABY_STEP_UNDO_SETUP;
+ if (access_multiplexer->undo_cleanup)
+ mfd_modes |= BABY_STEP_UNDO_CLEANUP;
+ if (access_multiplexer->undo_sets)
+ mfd_modes |= BABY_STEP_UNDO_SETS;
+
+ if (access_multiplexer->row_creation)
+ mfd_modes |= BABY_STEP_ROW_CREATE;
+ if (access_multiplexer->consistency_checks)
+ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
+ if (access_multiplexer->commit)
+ mfd_modes |= BABY_STEP_COMMIT;
+ if (access_multiplexer->undo_commit)
+ mfd_modes |= BABY_STEP_UNDO_COMMIT;
+
+ handler = netsnmp_baby_steps_handler_get(mfd_modes);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
+ */
+ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler =
+ netsnmp_container_table_handler_get(tbl_info,
+ ipCidrRouteTable_if_ctx.
+ container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject cache helper
+ */
+ if (NULL != ipCidrRouteTable_if_ctx.cache) {
+ handler = netsnmp_cache_handler_get(ipCidrRouteTable_if_ctx.cache);
+ netsnmp_inject_handler(reginfo, handler);
+ }
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+} /* _ipCidrRouteTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table ipCidrRouteTable
+ */
+void
+_ipCidrRouteTable_shutdown_interface(ipCidrRouteTable_registration *
+ reg_ptr)
+{
+ /*
+ * shutdown the container
+ */
+ _ipCidrRouteTable_container_shutdown(&ipCidrRouteTable_if_ctx);
+}
+
+void
+ipCidrRouteTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ ipCidrRouteTable_if_ctx.tbl_info.valid_columns = vc;
+} /* ipCidrRouteTable_valid_columns_set */
+
+/**
+ * @internal
+ * convert the index component stored in the context to an oid
+ */
+int
+ipCidrRouteTable_index_to_oid(netsnmp_index * oid_idx,
+ ipCidrRouteTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * ipCidrRouteDest(1)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ netsnmp_variable_list var_ipCidrRouteDest;
+ /*
+ * ipCidrRouteMask(2)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ netsnmp_variable_list var_ipCidrRouteMask;
+ /*
+ * ipCidrRouteTos(3)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ */
+ netsnmp_variable_list var_ipCidrRouteTos;
+ /*
+ * ipCidrRouteNextHop(4)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ netsnmp_variable_list var_ipCidrRouteNextHop;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_ipCidrRouteDest, 0x00, sizeof(var_ipCidrRouteDest));
+ var_ipCidrRouteDest.type = ASN_PRIV_IMPLIED_OCTET_STR;
+ memset(&var_ipCidrRouteMask, 0x00, sizeof(var_ipCidrRouteMask));
+ var_ipCidrRouteMask.type = ASN_PRIV_IMPLIED_OCTET_STR;
+ memset(&var_ipCidrRouteTos, 0x00, sizeof(var_ipCidrRouteTos));
+ var_ipCidrRouteTos.type = ASN_INTEGER;
+ memset(&var_ipCidrRouteNextHop, 0x00, sizeof(var_ipCidrRouteNextHop));
+ var_ipCidrRouteNextHop.type = ASN_PRIV_IMPLIED_OCTET_STR;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_ipCidrRouteDest.next_variable = &var_ipCidrRouteMask;
+ var_ipCidrRouteMask.next_variable = &var_ipCidrRouteTos;
+ var_ipCidrRouteTos.next_variable = &var_ipCidrRouteNextHop;
+ var_ipCidrRouteNextHop.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_index_to_oid",
+ "called\n"));
+
+ /*
+ * ipCidrRouteDest(1)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ snmp_set_var_value(&var_ipCidrRouteDest,
+ (u_char *) & mib_idx->ipCidrRouteDest,
+ sizeof(mib_idx->ipCidrRouteDest));
+
+ /*
+ * ipCidrRouteMask(2)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ snmp_set_var_value(&var_ipCidrRouteMask,
+ (u_char *) & mib_idx->ipCidrRouteMask,
+ sizeof(mib_idx->ipCidrRouteMask));
+
+ /*
+ * ipCidrRouteTos(3)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_ipCidrRouteTos,
+ (u_char *) & mib_idx->ipCidrRouteTos,
+ sizeof(mib_idx->ipCidrRouteTos));
+
+ /*
+ * ipCidrRouteNextHop(4)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ snmp_set_var_value(&var_ipCidrRouteNextHop,
+ (u_char *) & mib_idx->ipCidrRouteNextHop,
+ sizeof(mib_idx->ipCidrRouteNextHop));
+
+
+ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
+ NULL, 0, &var_ipCidrRouteDest);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_ipCidrRouteDest);
+
+ return err;
+} /* ipCidrRouteTable_index_to_oid */
+
+/**
+ * extract ipCidrRouteTable indexes from a netsnmp_index
+ *
+ * @retval SNMP_ERR_NOERROR : no error
+ * @retval SNMP_ERR_GENERR : error
+ */
+int
+ipCidrRouteTable_index_from_oid(netsnmp_index * oid_idx,
+ ipCidrRouteTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * ipCidrRouteDest(1)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ netsnmp_variable_list var_ipCidrRouteDest;
+ /*
+ * ipCidrRouteMask(2)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ netsnmp_variable_list var_ipCidrRouteMask;
+ /*
+ * ipCidrRouteTos(3)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ */
+ netsnmp_variable_list var_ipCidrRouteTos;
+ /*
+ * ipCidrRouteNextHop(4)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ netsnmp_variable_list var_ipCidrRouteNextHop;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_ipCidrRouteDest, 0x00, sizeof(var_ipCidrRouteDest));
+ var_ipCidrRouteDest.type = ASN_IPADDRESS;
+ memset(&var_ipCidrRouteMask, 0x00, sizeof(var_ipCidrRouteMask));
+ var_ipCidrRouteMask.type = ASN_IPADDRESS;
+ memset(&var_ipCidrRouteTos, 0x00, sizeof(var_ipCidrRouteTos));
+ var_ipCidrRouteTos.type = ASN_INTEGER;
+ memset(&var_ipCidrRouteNextHop, 0x00, sizeof(var_ipCidrRouteNextHop));
+ var_ipCidrRouteNextHop.type = ASN_IPADDRESS;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_ipCidrRouteDest.next_variable = &var_ipCidrRouteMask;
+ var_ipCidrRouteMask.next_variable = &var_ipCidrRouteTos;
+ var_ipCidrRouteTos.next_variable = &var_ipCidrRouteNextHop;
+ var_ipCidrRouteNextHop.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:ipCidrRouteTable:ipCidrRouteTable_index_from_oid",
+ "called\n"));
+
+ /*
+ * parse the oid into the individual index components
+ */
+ err = parse_oid_indexes(oid_idx->oids, oid_idx->len,
+ &var_ipCidrRouteDest);
+ if (err == SNMP_ERR_NOERROR) {
+ /*
+ * copy out values
+ */
+ mib_idx->ipCidrRouteDest =
+ *((u_long *) var_ipCidrRouteDest.val.string);
+ mib_idx->ipCidrRouteMask =
+ *((u_long *) var_ipCidrRouteMask.val.string);
+ mib_idx->ipCidrRouteTos =
+ *((long *) var_ipCidrRouteTos.val.string);
+ mib_idx->ipCidrRouteNextHop =
+ *((u_long *) var_ipCidrRouteNextHop.val.string);
+
+
+ }
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_ipCidrRouteDest);
+
+ return err;
+} /* ipCidrRouteTable_index_from_oid */
+
+
+/*
+ *********************************************************************
+ * @internal
+ * allocate resources for a ipCidrRouteTable_rowreq_ctx
+ */
+ipCidrRouteTable_rowreq_ctx *
+ipCidrRouteTable_allocate_rowreq_ctx(ipCidrRouteTable_data * data,
+ void *user_init_ctx)
+{
+ ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ SNMP_MALLOC_TYPEDEF(ipCidrRouteTable_rowreq_ctx);
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:ipCidrRouteTable_allocate_rowreq_ctx", "called\n"));
+
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "Couldn't allocate memory for a "
+ "ipCidrRouteTable_rowreq_ctx.\n");
+ return NULL;
+ } else {
+ if (NULL != data) {
+ /*
+ * track if we got data from user
+ */
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DATA_FROM_USER;
+ rowreq_ctx->data = data;
+ } else if (NULL ==
+ (rowreq_ctx->data = ipCidrRouteTable_allocate_data())) {
+ SNMP_FREE(rowreq_ctx);
+ return NULL;
+ }
+ }
+
+ /*
+ * undo context will be allocated when needed (in *_undo_setup)
+ */
+
+ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
+
+ rowreq_ctx->ipCidrRouteTable_data_list = NULL;
+
+ /*
+ * if we allocated data, call init routine
+ */
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) {
+ if (SNMPERR_SUCCESS !=
+ ipCidrRouteTable_rowreq_ctx_init(rowreq_ctx, user_init_ctx)) {
+ ipCidrRouteTable_release_rowreq_ctx(rowreq_ctx);
+ rowreq_ctx = NULL;
+ }
+ }
+
+ return rowreq_ctx;
+} /* ipCidrRouteTable_allocate_rowreq_ctx */
+
+/*
+ * @internal
+ * release resources for a ipCidrRouteTable_rowreq_ctx
+ */
+void
+ipCidrRouteTable_release_rowreq_ctx(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("internal:ipCidrRouteTable:ipCidrRouteTable_release_rowreq_ctx", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ ipCidrRouteTable_rowreq_ctx_cleanup(rowreq_ctx);
+
+ /*
+ * for non-transient data, don't free data we got from the user
+ */
+ if ((rowreq_ctx->data) &&
+ !(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER))
+ ipCidrRouteTable_release_data(rowreq_ctx->data);
+
+ if (rowreq_ctx->undo)
+ ipCidrRouteTable_release_data(rowreq_ctx->undo);
+
+ /*
+ * free index oid pointer
+ */
+ if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp)
+ free(rowreq_ctx->oid_idx.oids);
+
+ SNMP_FREE(rowreq_ctx);
+} /* ipCidrRouteTable_release_rowreq_ctx */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipCidrRouteTable_pre_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_pre_request", "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ipCidrRouteTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = ipCidrRouteTable_pre_request(ipCidrRouteTable_if_ctx.user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipCidrRouteTable", "error %d from "
+ "ipCidrRouteTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipCidrRouteTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipCidrRouteTable_post_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_post_request", "called\n"));
+
+ /*
+ * release row context, if deleted
+ */
+ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
+ ipCidrRouteTable_release_rowreq_ctx(rowreq_ctx);
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ipCidrRouteTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ if ((MFD_SUCCESS != packet_rc) && ipCidrRouteTable_dirty_get()) {
+ /*
+ * we shouldn't get here. the undo steps should also clear
+ * the dirty flags.
+ */
+ snmp_log(LOG_WARNING,
+ "ipCidrRouteTable dirty flag set in post_request "
+ "but status != SUCCESS.\n");
+ }
+
+ rc = ipCidrRouteTable_post_request(ipCidrRouteTable_if_ctx.user_ctx,
+ packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipCidrRouteTable", "error %d from "
+ "ipCidrRouteTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipCidrRouteTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static ipCidrRouteTable_rowreq_ctx *
+_mfd_ipCidrRouteTable_rowreq_from_index(netsnmp_index * oid_idx,
+ int *rc_ptr)
+{
+ ipCidrRouteTable_rowreq_ctx *rowreq_ctx;
+ ipCidrRouteTable_mib_index mib_idx;
+ int rc;
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_rowreq_from_index", "called\n"));
+
+ if (NULL == rc_ptr)
+ rc_ptr = &rc;
+ *rc_ptr = MFD_SUCCESS;
+
+ memset(&mib_idx, 0x0, sizeof(mib_idx));
+
+ /*
+ * try to parse oid
+ */
+ *rc_ptr = ipCidrRouteTable_index_from_oid(oid_idx, &mib_idx);
+ if (MFD_SUCCESS != *rc_ptr) {
+ DEBUGMSGT(("ipCidrRouteTable", "error parsing index\n"));
+ return NULL;
+ }
+
+ /*
+ * allocate new context
+ */
+ rowreq_ctx = ipCidrRouteTable_allocate_rowreq_ctx(NULL, NULL);
+ if (NULL == rowreq_ctx) {
+ *rc_ptr = MFD_ERROR;
+ return NULL; /* msg already logged */
+ }
+
+ memcpy(&rowreq_ctx->tbl_idx, &mib_idx, sizeof(mib_idx));
+
+ /*
+ * check indexes
+ */
+ *rc_ptr = _ipCidrRouteTable_check_indexes(rowreq_ctx);
+ if (MFD_SUCCESS != *rc_ptr) {
+ netsnmp_assert((*rc_ptr == SNMP_ERR_NOCREATION) ||
+ (*rc_ptr == SNMP_ERR_INCONSISTENTNAME));
+ ipCidrRouteTable_release_rowreq_ctx(rowreq_ctx);
+ return NULL;
+ }
+
+ /*
+ * copy indexes
+ */
+ rowreq_ctx->oid_idx.len = oid_idx->len;
+ memcpy(rowreq_ctx->oid_idx.oids, oid_idx->oids,
+ oid_idx->len * sizeof(oid));
+
+ return rowreq_ctx;
+} /* _mfd_ipCidrRouteTable_rowreq_from_index */
+
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipCidrRouteTable_object_lookup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = SNMP_ERR_NOERROR;
+ ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_object_lookup", "called\n"));
+
+ /*
+ * get our context from mfd
+ * ipCidrRouteTable_interface_ctx *if_ctx =
+ * (ipCidrRouteTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if (NULL == rowreq_ctx) {
+ netsnmp_table_request_info *tblreq_info;
+ netsnmp_index oid_idx;
+
+ tblreq_info = netsnmp_extract_table_info(requests);
+ if (NULL == tblreq_info) {
+ snmp_log(LOG_ERR, "request had no table info\n");
+ return MFD_ERROR;
+ }
+
+ /*
+ * try create rowreq
+ */
+ oid_idx.oids = tblreq_info->index_oid;
+ oid_idx.len = tblreq_info->index_oid_len;
+
+ rowreq_ctx =
+ _mfd_ipCidrRouteTable_rowreq_from_index(&oid_idx, &rc);
+ if (MFD_SUCCESS == rc) {
+ netsnmp_assert(NULL != rowreq_ctx);
+ rowreq_ctx->rowreq_flags |= MFD_ROW_CREATED;
+ /*
+ * add rowreq_ctx to request data lists
+ */
+ netsnmp_container_table_row_insert(requests, (netsnmp_index *)
+ rowreq_ctx);
+ }
+ }
+
+ if (MFD_SUCCESS != rc)
+ netsnmp_request_set_error_all(requests, rc);
+ else
+ ipCidrRouteTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_ipCidrRouteTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipCidrRouteTable_get_column(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_get_column", "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * (INDEX) ipCidrRouteDest(1)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPCIDRROUTEDEST:
+ var->type = ASN_IPADDRESS;
+ var->val_len = sizeof(u_long);
+ (*var->val.integer) = rowreq_ctx->tbl_idx.ipCidrRouteDest;
+ break;
+
+ /*
+ * (INDEX) ipCidrRouteMask(2)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPCIDRROUTEMASK:
+ var->type = ASN_IPADDRESS;
+ var->val_len = sizeof(u_long);
+ (*var->val.integer) = rowreq_ctx->tbl_idx.ipCidrRouteMask;
+ break;
+
+ /*
+ * (INDEX) ipCidrRouteTos(3)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ */
+ case COLUMN_IPCIDRROUTETOS:
+ var->type = ASN_INTEGER;
+ var->val_len = sizeof(long);
+ (*var->val.integer) = rowreq_ctx->tbl_idx.ipCidrRouteTos;
+ break;
+
+ /*
+ * (INDEX) ipCidrRouteNextHop(4)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPCIDRROUTENEXTHOP:
+ var->type = ASN_IPADDRESS;
+ var->val_len = sizeof(u_long);
+ (*var->val.integer) = rowreq_ctx->tbl_idx.ipCidrRouteNextHop;
+ break;
+
+ /*
+ * ipCidrRouteIfIndex(5)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEIFINDEX:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = ipCidrRouteIfIndex_get(rowreq_ctx, (long *) var->val.string);
+ break;
+
+ /*
+ * ipCidrRouteType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPCIDRROUTETYPE:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipCidrRouteType_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipCidrRouteProto(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_IPCIDRROUTEPROTO:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipCidrRouteProto_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipCidrRouteAge(8)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEAGE:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = ipCidrRouteAge_get(rowreq_ctx, (long *) var->val.string);
+ break;
+
+ /*
+ * ipCidrRouteInfo(9)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/W/e/r/d/h
+ */
+ case COLUMN_IPCIDRROUTEINFO:
+ var->type = ASN_OBJECT_ID;
+ rc = ipCidrRouteInfo_get(rowreq_ctx, (oid **) & var->val.string,
+ &var->val_len);
+ break;
+
+ /*
+ * ipCidrRouteNextHopAS(10)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTENEXTHOPAS:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = ipCidrRouteNextHopAS_get(rowreq_ctx,
+ (long *) var->val.string);
+ break;
+
+ /*
+ * ipCidrRouteMetric1(11)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC1:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = ipCidrRouteMetric1_get(rowreq_ctx, (long *) var->val.string);
+ break;
+
+ /*
+ * ipCidrRouteMetric2(12)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC2:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = ipCidrRouteMetric2_get(rowreq_ctx, (long *) var->val.string);
+ break;
+
+ /*
+ * ipCidrRouteMetric3(13)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC3:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = ipCidrRouteMetric3_get(rowreq_ctx, (long *) var->val.string);
+ break;
+
+ /*
+ * ipCidrRouteMetric4(14)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC4:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = ipCidrRouteMetric4_get(rowreq_ctx, (long *) var->val.string);
+ break;
+
+ /*
+ * ipCidrRouteMetric5(15)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC5:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = ipCidrRouteMetric5_get(rowreq_ctx, (long *) var->val.string);
+ break;
+
+ /*
+ * ipCidrRouteStatus(16)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPCIDRROUTESTATUS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipCidrRouteStatus_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipCidrRouteTable_get_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ipCidrRouteTable_get_column */
+
+int
+_mfd_ipCidrRouteTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ u_char *old_string;
+ void (*dataFreeHook) (void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_get_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+ /*
+ * save old pointer, so we can free it if replaced
+ */
+ old_string = requests->requestvb->val.string;
+ dataFreeHook = requests->requestvb->dataFreeHook;
+ if (NULL == requests->requestvb->val.string) {
+ requests->requestvb->val.string = requests->requestvb->buf;
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ } else if (requests->requestvb->buf ==
+ requests->requestvb->val.string) {
+ if (requests->requestvb->val_len !=
+ sizeof(requests->requestvb->buf))
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ }
+
+ /*
+ * get column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipCidrRouteTable_get_column(rowreq_ctx, requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ if (MFD_SKIP == rc) {
+ requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+ rc = SNMP_ERR_NOERROR;
+ }
+ } else if (NULL == requests->requestvb->val.string) {
+ snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
+ rc = SNMP_ERR_GENERR;
+ }
+ if (rc)
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+
+ /*
+ * if the buffer wasn't used previously for the old data (i.e. it
+ * was allcoated memory) and the get routine replaced the pointer,
+ * we need to free the previous pointer.
+ */
+ if (old_string && (old_string != requests->requestvb->buf) &&
+ (requests->requestvb->val.string != old_string)) {
+ if (dataFreeHook)
+ (*dataFreeHook) (old_string);
+ else
+ free(old_string);
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipCidrRouteTable_get_values */
+
+NETSNMP_STATIC_INLINE int
+_ipCidrRouteTable_check_indexes(ipCidrRouteTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_ipCidrRouteTable_check_indexes", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+
+ /*
+ * (INDEX) ipCidrRouteDest(1)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ if (MFD_SUCCESS != rc)
+ return rc;
+ rc = ipCidrRouteDest_check_index(rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+ /*
+ * (INDEX) ipCidrRouteMask(2)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ if (MFD_SUCCESS != rc)
+ return rc;
+ rc = ipCidrRouteMask_check_index(rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+ /*
+ * (INDEX) ipCidrRouteTos(3)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ */
+ /*
+ * check defined range(s).
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && ((rowreq_ctx->tbl_idx.ipCidrRouteTos < 0)
+ || (rowreq_ctx->tbl_idx.ipCidrRouteTos > 2147483647))
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (MFD_SUCCESS != rc)
+ return rc;
+ rc = ipCidrRouteTos_check_index(rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+ /*
+ * (INDEX) ipCidrRouteNextHop(4)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ if (MFD_SUCCESS != rc)
+ return rc;
+ rc = ipCidrRouteNextHop_check_index(rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+ /*
+ * if individual parts look ok, check them as a whole
+ */
+ return ipCidrRouteTable_validate_index(ipCidrRouteTable_if_ctx.
+ user_ctx, rowreq_ctx);
+} /* _ipCidrRouteTable_check_indexes */
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Syntax checks
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check the syntax for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipCidrRouteTable_check_column(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_ipCidrRouteTable_check_column",
+ "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+ /*
+ * (INDEX) ipCidrRouteDest(1)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPCIDRROUTEDEST:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+ /*
+ * (INDEX) ipCidrRouteMask(2)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPCIDRROUTEMASK:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+ /*
+ * (INDEX) ipCidrRouteTos(3)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ */
+ case COLUMN_IPCIDRROUTETOS:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+ /*
+ * (INDEX) ipCidrRouteNextHop(4)/IPADDR/ASN_IPADDRESS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPCIDRROUTENEXTHOP:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+
+ /*
+ * ipCidrRouteIfIndex(5)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEIFINDEX:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteIfIndex", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipCidrRouteIfIndex_check_value(rowreq_ctx,
+ *((long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipCidrRouteIfIndex_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ipCidrRouteType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPCIDRROUTETYPE:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (*var->val.integer != IPCIDRROUTETYPE_OTHER)
+ && (*var->val.integer != IPCIDRROUTETYPE_REJECT)
+ && (*var->val.integer != IPCIDRROUTETYPE_LOCAL)
+ && (*var->val.integer != IPCIDRROUTETYPE_REMOTE)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteType", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipCidrRouteType_check_value(rowreq_ctx,
+ *((u_long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipCidrRouteType_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ipCidrRouteProto(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_IPCIDRROUTEPROTO:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ipCidrRouteAge(8)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEAGE:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ipCidrRouteInfo(9)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/W/e/r/d/h
+ */
+ case COLUMN_IPCIDRROUTEINFO:
+ rc = netsnmp_check_vb_type(var, ASN_OBJECT_ID);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteInfo", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipCidrRouteInfo_check_value(rowreq_ctx,
+ (oid *) var->val.string,
+ var->val_len);
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipCidrRouteInfo_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ipCidrRouteNextHopAS(10)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTENEXTHOPAS:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteNextHopAS", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipCidrRouteNextHopAS_check_value(rowreq_ctx,
+ *((long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipCidrRouteNextHopAS_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ipCidrRouteMetric1(11)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC1:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteMetric1", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipCidrRouteMetric1_check_value(rowreq_ctx,
+ *((long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipCidrRouteMetric1_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ipCidrRouteMetric2(12)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC2:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteMetric2", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipCidrRouteMetric2_check_value(rowreq_ctx,
+ *((long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipCidrRouteMetric2_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ipCidrRouteMetric3(13)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC3:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteMetric3", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipCidrRouteMetric3_check_value(rowreq_ctx,
+ *((long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipCidrRouteMetric3_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ipCidrRouteMetric4(14)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC4:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteMetric4", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipCidrRouteMetric4_check_value(rowreq_ctx,
+ *((long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipCidrRouteMetric4_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ipCidrRouteMetric5(15)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC5:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteMetric5", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipCidrRouteMetric5_check_value(rowreq_ctx,
+ *((long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipCidrRouteMetric5_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ipCidrRouteStatus(16)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPCIDRROUTESTATUS:
+ rc = netsnmp_check_vb_rowstatus_value(var);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipCidrRouteTable:_ipCidrRouteTable_check_column:ipCidrRouteStatus", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipCidrRouteStatus_check_value(rowreq_ctx,
+ *((u_long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipCidrRouteStatus_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ default: /** We shouldn't get here */
+ rc = SNMP_ERR_GENERR;
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipCidrRouteTable_check_column\n",
+ column);
+ }
+
+ return rc;
+} /* _ipCidrRouteTable_check_column */
+
+int
+_mfd_ipCidrRouteTable_check_objects(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc;
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_check_objects", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+
+ /*
+ * get column number from table request info, and check that column
+ */
+ netsnmp_table_request_info *tri;
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipCidrRouteTable_check_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+ break;
+ }
+
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipCidrRouteTable_check_objects */
+
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo setup
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipCidrRouteTable_undo_setup_column(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_ipCidrRouteTable_undo_setup_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipCidrRouteIfIndex(5)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEIFINDEX:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEIFINDEX_FLAG;
+ rc = ipCidrRouteIfIndex_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPCIDRROUTETYPE:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTETYPE_FLAG;
+ rc = ipCidrRouteType_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteInfo(9)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/W/e/r/d/h
+ */
+ case COLUMN_IPCIDRROUTEINFO:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEINFO_FLAG;
+ rc = ipCidrRouteInfo_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteNextHopAS(10)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTENEXTHOPAS:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTENEXTHOPAS_FLAG;
+ rc = ipCidrRouteNextHopAS_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteMetric1(11)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC1:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEMETRIC1_FLAG;
+ rc = ipCidrRouteMetric1_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteMetric2(12)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC2:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEMETRIC2_FLAG;
+ rc = ipCidrRouteMetric2_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteMetric3(13)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC3:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEMETRIC3_FLAG;
+ rc = ipCidrRouteMetric3_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteMetric4(14)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC4:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEMETRIC4_FLAG;
+ rc = ipCidrRouteMetric4_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteMetric5(15)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC5:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEMETRIC5_FLAG;
+ rc = ipCidrRouteMetric5_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteStatus(16)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPCIDRROUTESTATUS:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTESTATUS_FLAG;
+ rc = ipCidrRouteStatus_undo_setup(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipCidrRouteTable_undo_setup_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ipCidrRouteTable_undo_setup_column */
+
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_ipCidrRouteTable_undo_setup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_undo_setup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * allocate undo context
+ */
+ rowreq_ctx->undo = ipCidrRouteTable_allocate_data();
+ if (NULL == rowreq_ctx->undo) {
+ /** msg already logged */
+ netsnmp_request_set_error_all(requests,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * row undo setup
+ */
+ rowreq_ctx->column_set_flags = 0;
+ rc = ipCidrRouteTable_undo_setup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipCidrRouteTable:mfd", "error %d from "
+ "ipCidrRouteTable_undo_setup\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ } else {
+ /*
+ * column undo setup
+ */
+ netsnmp_table_request_info *tri;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipCidrRouteTable_undo_setup_column(rowreq_ctx,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipCidrRouteTable:mfd", "error %d from "
+ "ipCidrRouteTable_undo_setup_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipCidrRouteTable_undo_setup */
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_ipCidrRouteTable_undo_cleanup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc;
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_undo_cleanup", "called\n"));
+
+ /*
+ * failed row create in early stages has no rowreq_ctx
+ */
+ if (NULL == rowreq_ctx)
+ return MFD_SUCCESS;
+
+ /*
+ * call user cleanup
+ */
+ rc = ipCidrRouteTable_undo_cleanup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipCidrRouteTable:mfd", "error %d from "
+ "ipCidrRouteTable_undo_cleanup\n", rc));
+ }
+
+ /*
+ * release undo context, if needed
+ */
+ if (rowreq_ctx->undo) {
+ ipCidrRouteTable_release_data(rowreq_ctx->undo);
+ rowreq_ctx->undo = NULL;
+ }
+
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipCidrRouteTable_undo_cleanup */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Set values
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipCidrRouteTable_set_column(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_ipCidrRouteTable_set_column",
+ "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipCidrRouteIfIndex(5)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEIFINDEX:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEIFINDEX_FLAG;
+ rc = ipCidrRouteIfIndex_set(rowreq_ctx,
+ *((long *) var->val.string));
+ break;
+
+ /*
+ * ipCidrRouteType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPCIDRROUTETYPE:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTETYPE_FLAG;
+ rc = ipCidrRouteType_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ /*
+ * ipCidrRouteInfo(9)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/W/e/r/d/h
+ */
+ case COLUMN_IPCIDRROUTEINFO:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEINFO_FLAG;
+ rc = ipCidrRouteInfo_set(rowreq_ctx, (oid *) var->val.string,
+ var->val_len);
+ break;
+
+ /*
+ * ipCidrRouteNextHopAS(10)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTENEXTHOPAS:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTENEXTHOPAS_FLAG;
+ rc = ipCidrRouteNextHopAS_set(rowreq_ctx,
+ *((long *) var->val.string));
+ break;
+
+ /*
+ * ipCidrRouteMetric1(11)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC1:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEMETRIC1_FLAG;
+ rc = ipCidrRouteMetric1_set(rowreq_ctx,
+ *((long *) var->val.string));
+ break;
+
+ /*
+ * ipCidrRouteMetric2(12)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC2:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEMETRIC2_FLAG;
+ rc = ipCidrRouteMetric2_set(rowreq_ctx,
+ *((long *) var->val.string));
+ break;
+
+ /*
+ * ipCidrRouteMetric3(13)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC3:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEMETRIC3_FLAG;
+ rc = ipCidrRouteMetric3_set(rowreq_ctx,
+ *((long *) var->val.string));
+ break;
+
+ /*
+ * ipCidrRouteMetric4(14)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC4:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEMETRIC4_FLAG;
+ rc = ipCidrRouteMetric4_set(rowreq_ctx,
+ *((long *) var->val.string));
+ break;
+
+ /*
+ * ipCidrRouteMetric5(15)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC5:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTEMETRIC5_FLAG;
+ rc = ipCidrRouteMetric5_set(rowreq_ctx,
+ *((long *) var->val.string));
+ break;
+
+ /*
+ * ipCidrRouteStatus(16)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPCIDRROUTESTATUS:
+ rowreq_ctx->column_set_flags |= COLUMN_IPCIDRROUTESTATUS_FLAG;
+ rc = ipCidrRouteStatus_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipCidrRouteTable_set_column\n",
+ column);
+ rc = SNMP_ERR_GENERR;
+ break;
+ }
+
+ return rc;
+} /* _ipCidrRouteTable_set_column */
+
+int
+_mfd_ipCidrRouteTable_set_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc = SNMP_ERR_NOERROR;
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_set_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rowreq_ctx->column_set_flags = 0;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipCidrRouteTable_set_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipCidrRouteTable:mfd", "error %d from "
+ "ipCidrRouteTable_set_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipCidrRouteTable_set_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit the values
+ */
+int
+_mfd_ipCidrRouteTable_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_commit",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = ipCidrRouteTable_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipCidrRouteTable:mfd", "error %d from "
+ "ipCidrRouteTable_commit\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ /*
+ * if we successfully commited this row, set the dirty flag. Use the
+ * current value + 1 (i.e. dirty = # rows changed).
+ * this is checked in post_request...
+ */
+ ipCidrRouteTable_dirty_set(ipCidrRouteTable_dirty_get() + 1); /* set table dirty flag */
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+_mfd_ipCidrRouteTable_undo_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_undo_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ u_int d = ipCidrRouteTable_dirty_get();
+
+ netsnmp_assert(d != 0);
+ if (d)
+ ipCidrRouteTable_dirty_set(d - 1);
+ }
+
+ rc = ipCidrRouteTable_undo_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipCidrRouteTable:mfd", "error %d from "
+ "ipCidrRouteTable_undo_commit\n", rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ snmp_log(LOG_WARNING,
+ "ipCidrRouteTable row dirty flag still set after undo_commit\n");
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipCidrRouteTable_commit */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * undo the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipCidrRouteTable_undo_column(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_ipCidrRouteTable_undo_column",
+ "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipCidrRouteIfIndex(5)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEIFINDEX:
+ rc = ipCidrRouteIfIndex_undo(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPCIDRROUTETYPE:
+ rc = ipCidrRouteType_undo(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteInfo(9)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/A/W/e/r/d/h
+ */
+ case COLUMN_IPCIDRROUTEINFO:
+ rc = ipCidrRouteInfo_undo(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteNextHopAS(10)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTENEXTHOPAS:
+ rc = ipCidrRouteNextHopAS_undo(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteMetric1(11)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC1:
+ rc = ipCidrRouteMetric1_undo(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteMetric2(12)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC2:
+ rc = ipCidrRouteMetric2_undo(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteMetric3(13)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC3:
+ rc = ipCidrRouteMetric3_undo(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteMetric4(14)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC4:
+ rc = ipCidrRouteMetric4_undo(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteMetric5(15)/INTEGER32/ASN_INTEGER/long(long)//l/A/W/e/r/D/h
+ */
+ case COLUMN_IPCIDRROUTEMETRIC5:
+ rc = ipCidrRouteMetric5_undo(rowreq_ctx);
+ break;
+
+ /*
+ * ipCidrRouteStatus(16)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPCIDRROUTESTATUS:
+ rc = ipCidrRouteStatus_undo(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipCidrRouteTable_undo_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ipCidrRouteTable_undo_column */
+
+int
+_mfd_ipCidrRouteTable_undo_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_undo_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = ipCidrRouteTable_undo(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipCidrRouteTable:mfd", "error %d from "
+ "ipCidrRouteTable_undo\n", rc));
+ }
+
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipCidrRouteTable_undo_column(rowreq_ctx, requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipCidrRouteTable:mfd", "error %d from "
+ "ipCidrRouteTable_undo_column\n", rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipCidrRouteTable_undo_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: irreversible commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit irreversible actions
+ */
+int
+_mfd_ipCidrRouteTable_irreversible_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipCidrRouteTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_mfd_ipCidrRouteTable_irreversible:commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * check for and handle row creation/deletion
+ * and update column exist flags...
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) {
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_CREATED))
+ CONTAINER_REMOVE(ipCidrRouteTable_if_ctx.container, rowreq_ctx);
+ } else {
+ if (rowreq_ctx->column_set_flags) {
+ rowreq_ctx->column_set_flags = 0;
+ }
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_CREATED;
+ CONTAINER_INSERT(ipCidrRouteTable_if_ctx.container,
+ rowreq_ctx);
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipCidrRouteTable_irreversible_commit */
+
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+static void _container_free(netsnmp_container *container);
+
+/**
+ * @internal
+ */
+static int
+_cache_load(netsnmp_cache * cache, void *vmagic)
+{
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_cache_load", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache for ipCidrRouteTable_cache_load\n");
+ return -1;
+ }
+
+ /** should only be called for an invalid or expired cache */
+ netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
+
+ /*
+ * call user code
+ */
+ return ipCidrRouteTable_container_load((netsnmp_container *) cache->
+ magic);
+} /* _cache_load */
+
+/**
+ * @internal
+ */
+static void
+_cache_free(netsnmp_cache * cache, void *magic)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_cache_free", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache in ipCidrRouteTable_cache_free\n");
+ return;
+ }
+
+ container = (netsnmp_container *) cache->magic;
+
+ _container_free(container);
+} /* _cache_free */
+
+/**
+ * @internal
+ */
+static void
+_container_item_free(ipCidrRouteTable_rowreq_ctx * rowreq_ctx,
+ void *context)
+{
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_container_item_free",
+ "called\n"));
+
+ if (NULL == rowreq_ctx)
+ return;
+
+ ipCidrRouteTable_release_rowreq_ctx(rowreq_ctx);
+} /* _container_item_free */
+
+/**
+ * @internal
+ */
+static void
+_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_container_free", "called\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container in ipCidrRouteTable_container_free\n");
+ return;
+ }
+
+ /*
+ * call user code
+ */
+ ipCidrRouteTable_container_free(container);
+
+ /*
+ * free all items. inefficient, but easy.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func *) _container_item_free,
+ NULL);
+} /* _container_free */
+
+/**
+ * @internal
+ * initialize the container with functions or wrappers
+ */
+void
+_ipCidrRouteTable_container_init(ipCidrRouteTable_interface_ctx * if_ctx)
+{
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_ipCidrRouteTable_container_init", "called\n"));
+
+ /*
+ * cache init
+ */
+ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */
+ _cache_load, _cache_free,
+ ipCidrRouteTable_oid,
+ ipCidrRouteTable_oid_size);
+
+ if (NULL == if_ctx->cache) {
+ snmp_log(LOG_ERR, "error creating cache for ipCidrRouteTable\n");
+ return;
+ }
+
+ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
+
+ ipCidrRouteTable_container_init(&if_ctx->container, if_ctx->cache);
+ if (NULL == if_ctx->container)
+ if_ctx->container =
+ netsnmp_container_find("ipCidrRouteTable:table_container");
+ if (NULL == if_ctx->container) {
+ snmp_log(LOG_ERR, "error creating container in "
+ "ipCidrRouteTable_container_init\n");
+ return;
+ }
+
+ if (NULL != if_ctx->cache)
+ if_ctx->cache->magic = (void *) if_ctx->container;
+} /* _ipCidrRouteTable_container_init */
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+_ipCidrRouteTable_container_shutdown(ipCidrRouteTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:ipCidrRouteTable:_ipCidrRouteTable_container_shutdown", "called\n"));
+
+ ipCidrRouteTable_container_shutdown(if_ctx->container);
+
+ _container_free(if_ctx->container);
+
+} /* _ipCidrRouteTable_container_shutdown */
+
+
+ipCidrRouteTable_rowreq_ctx *
+ipCidrRouteTable_row_find_by_mib_index(ipCidrRouteTable_mib_index *
+ mib_idx)
+{
+ ipCidrRouteTable_rowreq_ctx *rowreq_ctx;
+ oid oid_tmp[MAX_OID_LEN];
+ netsnmp_index oid_idx;
+ int rc;
+
+ /*
+ * set up storage for OID
+ */
+ oid_idx.oids = oid_tmp;
+ oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
+
+ /*
+ * convert
+ */
+ rc = ipCidrRouteTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx =
+ CONTAINER_FIND(ipCidrRouteTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_interface.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_interface.h
new file mode 100644
index 0000000000..11afdacea3
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable_interface.h
@@ -0,0 +1,100 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: ipCidrRouteTable_interface.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** @ingroup interface Routines to interface to Net-SNMP
+ *
+ * \warning This code should not be modified, called directly,
+ * or used to interpret functionality. It is subject to
+ * change at any time.
+ *
+ * @{
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+#ifndef IPCIDRROUTETABLE_INTERFACE_H
+#define IPCIDRROUTETABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "ipCidrRouteTable.h"
+
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void
+ _ipCidrRouteTable_initialize_interface
+ (ipCidrRouteTable_registration * user_ctx, u_long flags);
+ void
+ _ipCidrRouteTable_shutdown_interface(ipCidrRouteTable_registration
+ * user_ctx);
+ ipCidrRouteTable_registration *ipCidrRouteTable_registration_get(void);
+
+ ipCidrRouteTable_registration
+ * ipCidrRouteTable_registration_set(ipCidrRouteTable_registration *
+ newreg);
+
+ netsnmp_container *ipCidrRouteTable_container_get(void);
+ int ipCidrRouteTable_container_size(void);
+
+ u_int ipCidrRouteTable_dirty_get(void);
+ void ipCidrRouteTable_dirty_set(u_int status);
+
+ ipCidrRouteTable_rowreq_ctx
+ * ipCidrRouteTable_allocate_rowreq_ctx(ipCidrRouteTable_data *,
+ void *);
+ void
+ ipCidrRouteTable_release_rowreq_ctx(ipCidrRouteTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ipCidrRouteTable_index_to_oid(netsnmp_index * oid_idx,
+ ipCidrRouteTable_mib_index
+ * mib_idx);
+ int ipCidrRouteTable_index_from_oid(netsnmp_index *
+ oid_idx,
+ ipCidrRouteTable_mib_index
+ * mib_idx);
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void ipCidrRouteTable_valid_columns_set(netsnmp_column_info
+ *vc);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPCIDRROUTETABLE_INTERFACE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib.h
new file mode 100644
index 0000000000..b45cbb4a01
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib.h
@@ -0,0 +1,9 @@
+/*
+ * module to include the modules
+ */
+
+config_require(ip-mib/ipAddressTable);
+config_require(ip-mib/inetNetToMediaTable);
+config_require(ip-mib/ipSystemStatsTable);
+config_require(ip-mib/ip_scalars);
+config_add_mib(IP-MIB)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/arp.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/arp.h
new file mode 100644
index 0000000000..1fcc67f4d9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/arp.h
@@ -0,0 +1,30 @@
+/*
+ * arp data access header
+ *
+ * $Id: arp.h 13310 2005-10-29 03:31:29Z rstory $
+ */
+/**---------------------------------------------------------------------*/
+/*
+ * configure required files
+ *
+ * Notes:
+ *
+ * 1) prefer functionality over platform, where possible. If a method
+ * is available for multiple platforms, test that first. That way
+ * when a new platform is ported, it won't need a new test here.
+ *
+ * 2) don't do detail requirements here. If, for example,
+ * HPUX11 had different reuirements than other HPUX, that should
+ * be handled in the *_hpux.h header file.
+ */
+config_require(ip-mib/data_access/arp_common)
+#if defined( linux )
+config_require(ip-mib/data_access/arp_linux)
+#else
+/*
+ * couldn't determine the correct file!
+ * require a bogus file to generate an error.
+ */
+config_require(ip-mib/data_access/arp-unknown-arch)
+#endif
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/arp_common.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/arp_common.c
new file mode 100644
index 0000000000..e8795f9904
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/arp_common.c
@@ -0,0 +1,142 @@
+/*
+ * Arp MIB architecture support
+ *
+ * $Id: arp_common.c 13920 2005-12-11 17:55:01Z rstory $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/arp.h>
+
+/**---------------------------------------------------------------------*/
+/*
+ * local static prototypes
+ */
+static void _access_arp_entry_release(netsnmp_arp_entry * entry,
+ void *unused);
+
+/**---------------------------------------------------------------------*/
+/*
+ * external per-architecture functions prototypes
+ *
+ * These shouldn't be called by the general public, so they aren't in
+ * the header file.
+ */
+extern int
+netsnmp_access_arp_container_arch_load(netsnmp_container* container,
+ u_int load_flags);
+
+
+/**---------------------------------------------------------------------*/
+/*
+ * container functions
+ */
+/**
+ */
+netsnmp_container *
+netsnmp_access_arp_container_init(u_int flags)
+{
+ netsnmp_container *container1;
+
+ DEBUGMSGTL(("access:arp:container", "init\n"));
+
+ /*
+ * create the containers. one indexed by ifIndex, the other
+ * indexed by ifName.
+ */
+ container1 = netsnmp_container_find("access_arp:table_container");
+ if (NULL == container1)
+ return NULL;
+ return container1;
+}
+
+/**
+ * @retval NULL error
+ * @retval !NULL pointer to container
+ */
+netsnmp_container*
+netsnmp_access_arp_container_load(netsnmp_container* container, u_int load_flags)
+{
+ int rc;
+
+ DEBUGMSGTL(("access:arp:container", "load\n"));
+
+ if (NULL == container)
+ container = netsnmp_container_find("access:arp:table_container");
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "no container specified/found for access_arp\n");
+ return NULL;
+ }
+
+ rc = netsnmp_access_arp_container_arch_load(container, load_flags);
+ if (0 != rc) {
+ netsnmp_access_arp_container_free(container,
+ NETSNMP_ACCESS_ARP_FREE_NOFLAGS);
+ container = NULL;
+ }
+
+ return container;
+}
+
+void
+netsnmp_access_arp_container_free(netsnmp_container *container, u_int free_flags)
+{
+ DEBUGMSGTL(("access:arp:container", "free\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "invalid container for netsnmp_access_arp_free\n");
+ return;
+ }
+
+ if(! (free_flags & NETSNMP_ACCESS_ARP_FREE_DONT_CLEAR)) {
+ /*
+ * free all items.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func*)_access_arp_entry_release,
+ NULL);
+ }
+
+ if(! (free_flags & NETSNMP_ACCESS_ARP_FREE_KEEP_CONTAINER))
+ CONTAINER_FREE(container);
+}
+
+/**---------------------------------------------------------------------*/
+/*
+ * arp_entry functions
+ */
+/**
+ */
+netsnmp_arp_entry *
+netsnmp_access_arp_entry_create(void)
+{
+ netsnmp_arp_entry *entry =
+ SNMP_MALLOC_TYPEDEF(netsnmp_arp_entry);
+
+ entry->oid_index.len = 1;
+ entry->oid_index.oids = &entry->ns_arp_index;
+
+ return entry;
+}
+
+/**
+ */
+void
+netsnmp_access_arp_entry_free(netsnmp_arp_entry * entry)
+{
+ free(entry);
+}
+
+/**---------------------------------------------------------------------*/
+/*
+ * Utility routines
+ */
+
+/**
+ */
+void
+_access_arp_entry_release(netsnmp_arp_entry * entry, void *context)
+{
+ netsnmp_access_arp_entry_free(entry);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/arp_linux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/arp_linux.c
new file mode 100644
index 0000000000..e1d20c1da9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/arp_linux.c
@@ -0,0 +1,194 @@
+/*
+ * Interface MIB architecture support
+ *
+ * $Id: arp_linux.c 16381 2007-05-17 21:53:28Z hardaker $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/arp.h>
+#include <net-snmp/data_access/interface.h>
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <net/if_arp.h>
+#include <arpa/inet.h>
+
+int _load_v4(netsnmp_container *container, int idx_offset);
+
+/**
+ */
+int
+netsnmp_access_arp_container_arch_load(netsnmp_container *container)
+{
+ int rc = 0, idx_offset = 0;
+
+ rc = _load_v4(container, idx_offset);
+ if(rc < 0) {
+ u_int flags = NETSNMP_ACCESS_ARP_FREE_KEEP_CONTAINER;
+ netsnmp_access_arp_container_free(container, flags);
+ return rc;
+ }
+
+#if defined (NETSNMP_ENABLE_IPV6) && 0 /* xx-rks: arp for v6? */
+ idx_offset = rc;
+
+ rc = _load_v6(container, idx_offset);
+ if(rc < 0) {
+ u_int flags = NETSNMP_ACCESS_ARP_FREE_KEEP_CONTAINER;
+ netsnmp_access_arp_container_free(container, flags);
+ }
+#endif
+
+ /*
+ * return no errors (0) if we found any interfaces
+ */
+ if(rc > 0)
+ rc = 0;
+
+ return rc;
+}
+
+/**
+ */
+int
+_load_v4(netsnmp_container *container, int idx_offset)
+{
+ FILE *in;
+ char line[128];
+ int rc = 0;
+ netsnmp_arp_entry *entry;
+
+ netsnmp_assert(NULL != container);
+
+#define PROCFILE "/proc/net/arp"
+ if (!(in = fopen(PROCFILE, "r"))) {
+ snmp_log(LOG_ERR,"could not open " PROCFILE "\n");
+ return -2;
+ }
+
+ /*
+ * Get rid of the header line
+ */
+ fgets(line, sizeof(line), in);
+
+ /*
+ * IP address | HW | Flag | HW address | Mask | Device
+ * 192.168.1.4 0x1 0x2 00:40:63:CC:1C:8C * eth0
+ */
+ while (fgets(line, sizeof(line), in)) {
+
+ int za, zb, zc, zd, ze, zf, zg, zh, zi, zj;
+ int tmp_flags;
+ char ifname[21];
+
+ rc = sscanf(line,
+ "%d.%d.%d.%d 0x%*x 0x%x %x:%x:%x:%x:%x:%x %*[^ ] %20s\n",
+ &za, &zb, &zc, &zd, &tmp_flags, &ze, &zf, &zg, &zh, &zi,
+ &zj, ifname);
+ if (12 != rc) {
+ snmp_log(LOG_ERR, PROCFILE " data format error (%d!=12)\n", rc);
+ snmp_log(LOG_ERR, " line ==|%s|\n", line);
+ continue;
+ }
+ DEBUGMSGTL(("access:arp:container",
+ "ip addr %d.%d.%d.%d, flags 0x%X, hw addr "
+ "%x:%x:%x:%x:%x:%x, name %s\n",
+ za,zb,zc,zd, tmp_flags, ze,zf,zg,zh,zi,zj, ifname ));
+
+ /*
+ */
+ entry = netsnmp_access_arp_entry_create();
+ if(NULL == entry) {
+ rc = -3;
+ break;
+ }
+
+ /*
+ * look up ifIndex
+ */
+ entry->if_index = netsnmp_access_interface_index_find(ifname);
+ if(0 == entry->if_index) {
+ snmp_log(LOG_ERR,"couldn't find ifIndex for '%s', skipping\n",
+ ifname);
+ netsnmp_access_arp_entry_free(entry);
+ continue;
+ }
+
+ /*
+ * now that we've passed all the possible 'continue', assign
+ * index offset.
+ */
+ entry->ns_arp_index = ++idx_offset;
+
+ /*
+ * parse ip addr
+ */
+ entry->arp_ipaddress[0] = za;
+ entry->arp_ipaddress[1] = zb;
+ entry->arp_ipaddress[2] = zc;
+ entry->arp_ipaddress[3] = zd;
+ entry->arp_ipaddress_len = 4;
+
+ /*
+ * parse hw addr
+ */
+ entry->arp_physaddress[0] = ze;
+ entry->arp_physaddress[1] = zf;
+ entry->arp_physaddress[2] = zg;
+ entry->arp_physaddress[3] = zh;
+ entry->arp_physaddress[4] = zi;
+ entry->arp_physaddress[5] = zj;
+ entry->arp_physaddress_len = 6;
+
+ /*
+ * what can we do with hw? from arp manpage:
+
+ default value of this parameter is ether (i.e. hardware code
+ 0x01 for IEEE 802.3 10Mbps Ethernet). Other values might
+ include network technologies such as ARCnet (arcnet) , PROnet
+ (pronet) , AX.25 (ax25) and NET/ROM (netrom).
+ */
+
+ /*
+ * parse mask
+ */
+ /* xxx-rks: what is mask? how to interpret '*'? */
+
+
+ /*
+ * process type
+ */
+ if(tmp_flags & ATF_PERM)
+ entry->arp_type = INETNETTOMEDIATYPE_STATIC;
+ else
+ entry->arp_type = INETNETTOMEDIATYPE_DYNAMIC;
+
+ /*
+ * process status
+ * if flags are 0, we can't tell the difference between
+ * stale or incomplete.
+ */
+ if(tmp_flags & ATF_COM)
+ entry->arp_state = INETNETTOMEDIASTATE_REACHABLE;
+ else
+ entry->arp_state = INETNETTOMEDIASTATE_UNKNOWN;
+
+ /*
+ * add entry to container
+ */
+ if (CONTAINER_INSERT(container, entry) < 0)
+ {
+ DEBUGMSGTL(("access:arp:container","error with arp_entry: insert into container failed.\n"));
+ netsnmp_access_arp_entry_free(entry);
+ continue;
+ }
+ }
+
+ fclose(in);
+ if( rc < 0 )
+ return rc;
+
+ return idx_offset;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress.h
new file mode 100644
index 0000000000..f1d471abb5
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress.h
@@ -0,0 +1,30 @@
+/*
+ * ipaddress data access header
+ *
+ * $Id: ipaddress.h 13271 2005-10-28 15:29:23Z rstory $
+ */
+/**---------------------------------------------------------------------*/
+/*
+ * configure required files
+ *
+ * Notes:
+ *
+ * 1) prefer functionality over platform, where possible. If a method
+ * is available for multiple platforms, test that first. That way
+ * when a new platform is ported, it won't need a new test here.
+ *
+ * 2) don't do detail requirements here. If, for example,
+ * HPUX11 had different reuirements than other HPUX, that should
+ * be handled in the *_hpux.h header file.
+ */
+config_require(ip-mib/data_access/ipaddress_common)
+#if defined( linux )
+config_require(ip-mib/data_access/ipaddress_linux)
+#else
+/*
+ * couldn't determine the correct file!
+ * require a bogus file to generate an error.
+ */
+config_require(ip-mib/data_access/ipaddress-unknown-arch)
+#endif
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_common.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_common.c
new file mode 100644
index 0000000000..396fc96454
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_common.c
@@ -0,0 +1,430 @@
+/*
+ * Ipaddress MIB architecture support
+ *
+ * $Id: ipaddress_common.c 16724 2007-10-14 22:10:09Z magfr $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/ipaddress.h>
+#include <net-snmp/data_access/interface.h>
+
+#include "ip-mib/ipAddressTable/ipAddressTable_constants.h"
+
+/**---------------------------------------------------------------------*/
+/*
+ * local static prototypes
+ */
+static int _access_ipaddress_entry_compare_addr(const void *lhs,
+ const void *rhs);
+static void _access_ipaddress_entry_release(netsnmp_ipaddress_entry * entry,
+ void *unused);
+
+/**---------------------------------------------------------------------*/
+/*
+ * external per-architecture functions prototypes
+ *
+ * These shouldn't be called by the general public, so they aren't in
+ * the header file.
+ */
+extern int
+netsnmp_arch_ipaddress_container_load(netsnmp_container* container,
+ u_int load_flags);
+extern int
+netsnmp_arch_ipaddress_entry_init(netsnmp_ipaddress_entry *entry);
+extern int
+netsnmp_arch_ipaddress_entry_copy(netsnmp_ipaddress_entry *lhs,
+ netsnmp_ipaddress_entry *rhs);
+extern void
+netsnmp_arch_ipaddress_entry_cleanup(netsnmp_ipaddress_entry *entry);
+extern int
+netsnmp_arch_ipaddress_create(netsnmp_ipaddress_entry *entry);
+extern int
+netsnmp_arch_ipaddress_delete(netsnmp_ipaddress_entry *entry);
+
+
+/**---------------------------------------------------------------------*/
+/*
+ * container functions
+ */
+/**
+ */
+netsnmp_container *
+netsnmp_access_ipaddress_container_init(u_int flags)
+{
+ netsnmp_container *container1;
+
+ DEBUGMSGTL(("access:ipaddress:container", "init\n"));
+
+ /*
+ * create the containers. one indexed by ifIndex, the other
+ * indexed by ifName.
+ */
+ container1 = netsnmp_container_find("access_ipaddress:table_container");
+ if (NULL == container1) {
+ snmp_log(LOG_ERR, "ipaddress primary container not found\n");
+ return NULL;
+ }
+ container1->container_name = strdup("ia_index");
+
+ if (flags & NETSNMP_ACCESS_IPADDRESS_INIT_ADDL_IDX_BY_ADDR) {
+ netsnmp_container *container2 =
+ netsnmp_container_find("ipaddress_addr:access_ipaddress:table_container");
+ if (NULL == container2) {
+ snmp_log(LOG_ERR, "ipaddress secondary container not found\n");
+ CONTAINER_FREE(container1);
+ return NULL;
+ }
+
+ container2->compare = _access_ipaddress_entry_compare_addr;
+ container2->container_name = strdup("ia_addr");
+
+ netsnmp_container_add_index(container1, container2);
+ }
+
+ return container1;
+}
+
+/**
+ * @retval NULL error
+ * @retval !NULL pointer to container
+ */
+netsnmp_container*
+netsnmp_access_ipaddress_container_load(netsnmp_container* container,
+ u_int load_flags)
+{
+ int rc;
+ u_int container_flags = 0;
+
+ DEBUGMSGTL(("access:ipaddress:container", "load\n"));
+
+ if (NULL == container) {
+ if (load_flags & NETSNMP_ACCESS_IPADDRESS_LOAD_ADDL_IDX_BY_ADDR)
+ container_flags |= NETSNMP_ACCESS_IPADDRESS_INIT_ADDL_IDX_BY_ADDR;
+ container = netsnmp_access_ipaddress_container_init(container_flags);
+ }
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "no container specified/found for access_ipaddress\n");
+ return NULL;
+ }
+
+ rc = netsnmp_arch_ipaddress_container_load(container, load_flags);
+ if (0 != rc) {
+ netsnmp_access_ipaddress_container_free(container,
+ NETSNMP_ACCESS_IPADDRESS_FREE_NOFLAGS);
+ container = NULL;
+ }
+
+ return container;
+}
+
+void
+netsnmp_access_ipaddress_container_free(netsnmp_container *container, u_int free_flags)
+{
+ DEBUGMSGTL(("access:ipaddress:container", "free\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "invalid container for netsnmp_access_ipaddress_free\n");
+ return;
+ }
+
+ if(! (free_flags & NETSNMP_ACCESS_IPADDRESS_FREE_DONT_CLEAR)) {
+ /*
+ * free all items.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func*)_access_ipaddress_entry_release,
+ NULL);
+ }
+
+ if(! (free_flags & NETSNMP_ACCESS_IPADDRESS_FREE_KEEP_CONTAINER))
+ CONTAINER_FREE(container);
+}
+
+/**---------------------------------------------------------------------*/
+/*
+ * ipaddress_entry functions
+ */
+/**
+ */
+/**
+ */
+netsnmp_ipaddress_entry *
+netsnmp_access_ipaddress_entry_create(void)
+{
+ netsnmp_ipaddress_entry *entry =
+ SNMP_MALLOC_TYPEDEF(netsnmp_ipaddress_entry);
+ int rc = 0;
+
+ entry->oid_index.len = 1;
+ entry->oid_index.oids = &entry->ns_ia_index;
+
+ /*
+ * set up defaults
+ */
+ entry->ia_type = IPADDRESSTYPE_UNICAST;
+ entry->ia_status = IPADDRESSSTATUSTC_PREFERRED;
+ entry->ia_storagetype = STORAGETYPE_VOLATILE;
+
+ rc = netsnmp_arch_ipaddress_entry_init(entry);
+ if (SNMP_ERR_NOERROR != rc) {
+ DEBUGMSGT(("access:ipaddress:create","error %d in arch init\n", rc));
+ netsnmp_access_ipaddress_entry_free(entry);
+ entry = NULL;
+ }
+
+ return entry;
+}
+
+/**
+ */
+void
+netsnmp_access_ipaddress_entry_free(netsnmp_ipaddress_entry * entry)
+{
+ if (NULL == entry)
+ return;
+
+ if (NULL != entry->arch_data)
+ netsnmp_arch_ipaddress_entry_cleanup(entry);
+
+ free(entry);
+}
+
+/**
+ * update underlying data store (kernel) for entry
+ *
+ * @retval 0 : success
+ * @retval -1 : error
+ */
+int
+netsnmp_access_ipaddress_entry_set(netsnmp_ipaddress_entry * entry)
+{
+ int rc = SNMP_ERR_NOERROR;
+
+ if (NULL == entry) {
+ netsnmp_assert(NULL != entry);
+ return -1;
+ }
+
+ /*
+ * make sure interface and ifIndex match up
+ */
+ if (NULL == netsnmp_access_interface_name_find(entry->if_index)) {
+ DEBUGMSGT(("access:ipaddress:set", "cant find name for index %d\n",
+ entry->if_index));
+ return -1;
+ }
+
+ /*
+ * don't support non-volatile yet
+ */
+ if (STORAGETYPE_VOLATILE != entry->ia_storagetype) {
+ DEBUGMSGT(("access:ipaddress:set",
+ "non-volatile storagetypes unsupported\n"));
+ return -1;
+ }
+
+ /*
+ *
+ */
+ rc = -1;
+ if (entry->flags & NETSNMP_ACCESS_IPADDRESS_CREATE) {
+ rc = netsnmp_arch_ipaddress_create(entry);
+ }
+ else if (entry->flags & NETSNMP_ACCESS_IPADDRESS_CHANGE) {
+ }
+ else if (entry->flags & NETSNMP_ACCESS_IPADDRESS_DELETE) {
+ rc = netsnmp_arch_ipaddress_delete(entry);
+ }
+ else {
+ snmp_log(LOG_ERR,"netsnmp_access_ipaddress_entry_set with no mode\n");
+ netsnmp_assert(!"ipaddress_entry_set == unknown mode"); /* always false */
+ rc = -1;
+ }
+
+ return rc;
+}
+
+/**
+ * update an old ipaddress_entry from a new one
+ *
+ * @note: only mib related items are compared. Internal objects
+ * such as oid_index, ns_ia_index and flags are not compared.
+ *
+ * @retval -1 : error
+ * @retval >=0 : number of fields updated
+ */
+int
+netsnmp_access_ipaddress_entry_update(netsnmp_ipaddress_entry *lhs,
+ netsnmp_ipaddress_entry *rhs)
+{
+ int rc, changed = 0;
+
+ /*
+ * copy arch stuff. we don't care if it changed
+ */
+ rc = netsnmp_arch_ipaddress_entry_copy(lhs,rhs);
+ if (0 != rc) {
+ snmp_log(LOG_ERR,"arch ipaddress copy failed\n");
+ return -1;
+ }
+
+ if (lhs->if_index != rhs->if_index) {
+ ++changed;
+ lhs->if_index = rhs->if_index;
+ }
+
+ if (lhs->ia_storagetype != rhs->ia_storagetype) {
+ ++changed;
+ lhs->ia_storagetype = rhs->ia_storagetype;
+ }
+
+ if (lhs->ia_address_len != rhs->ia_address_len) {
+ changed += 2;
+ lhs->ia_address_len = rhs->ia_address_len;
+ memcpy(lhs->ia_address, rhs->ia_address, rhs->ia_address_len);
+ }
+ else if (memcmp(lhs->ia_address, rhs->ia_address, rhs->ia_address_len) != 0) {
+ ++changed;
+ memcpy(lhs->ia_address, rhs->ia_address, rhs->ia_address_len);
+ }
+
+ if (lhs->ia_type != rhs->ia_type) {
+ ++changed;
+ lhs->ia_type = rhs->ia_type;
+ }
+
+ if (lhs->ia_status != rhs->ia_status) {
+ ++changed;
+ lhs->ia_status = rhs->ia_status;
+ }
+
+ if (lhs->ia_origin != rhs->ia_origin) {
+ ++changed;
+ lhs->ia_origin = rhs->ia_origin;
+ }
+
+ return changed;
+}
+
+/**
+ * copy an ipaddress_entry
+ *
+ * @retval -1 : error
+ * @retval 0 : no error
+ */
+int
+netsnmp_access_ipaddress_entry_copy(netsnmp_ipaddress_entry *lhs,
+ netsnmp_ipaddress_entry *rhs)
+{
+ int rc;
+
+ /*
+ * copy arch stuff. we don't care if it changed
+ */
+ rc = netsnmp_arch_ipaddress_entry_copy(lhs,rhs);
+ if (0 != rc) {
+ snmp_log(LOG_ERR,"arch ipaddress copy failed\n");
+ return -1;
+ }
+
+ lhs->if_index = rhs->if_index;
+ lhs->ia_storagetype = rhs->ia_storagetype;
+ lhs->ia_address_len = rhs->ia_address_len;
+ memcpy(lhs->ia_address, rhs->ia_address, rhs->ia_address_len);
+ lhs->ia_type = rhs->ia_type;
+ lhs->ia_status = rhs->ia_status;
+ lhs->ia_origin = rhs->ia_origin;
+
+ return 0;
+}
+
+/**---------------------------------------------------------------------*/
+/*
+ * Utility routines
+ */
+
+/**
+ * copy the prefix portion of an ip address
+ */
+int
+netsnmp_ipaddress_prefix_copy(u_char *dst, u_char *src, int addr_len, int pfx_len)
+{
+ int bytes = pfx_len / 8;
+ int bits = pfx_len % 8;
+
+ if ((NULL == dst) || (NULL == src) || (0 == pfx_len))
+ return 0;
+
+ memcpy(dst, src, bytes);
+
+ if (bytes < addr_len)
+ memset(&dst[bytes],0x0, addr_len - bytes);
+
+ if (bits) {
+ u_char mask = (0xff << (8-bits));
+
+ dst[bytes] = (src[bytes] & mask);
+ }
+
+ return pfx_len;
+}
+
+
+/**
+ * copy the prefix portion of an ip address
+ *
+ * @param mask network byte order make
+ *
+ * @returns number of prefix bits
+ */
+int
+netsnmp_ipaddress_ipv4_prefix_len(in_addr_t mask)
+{
+ int len = 0;
+
+ while((0xff000000 & mask) == 0xff000000) {
+ len += 8;
+ mask = mask << 8;
+ }
+
+ while(0x80000000 & mask) {
+ ++len;
+ mask = mask << 1;
+ }
+
+ return len;
+}
+
+
+/**
+ */
+void
+_access_ipaddress_entry_release(netsnmp_ipaddress_entry * entry, void *context)
+{
+ netsnmp_access_ipaddress_entry_free(entry);
+}
+
+static int _access_ipaddress_entry_compare_addr(const void *lhs,
+ const void *rhs)
+{
+ const netsnmp_ipaddress_entry *lh = (const netsnmp_ipaddress_entry *)lhs;
+ const netsnmp_ipaddress_entry *rh = (const netsnmp_ipaddress_entry *)rhs;
+
+ netsnmp_assert(NULL != lhs);
+ netsnmp_assert(NULL != rhs);
+
+ /*
+ * compare address length
+ */
+ if (lh->ia_address_len < rh->ia_address_len)
+ return -1;
+ else if (lh->ia_address_len > rh->ia_address_len)
+ return 1;
+
+ /*
+ * length equal, compare address
+ */
+ return memcmp(lh->ia_address, rh->ia_address, lh->ia_address_len);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c
new file mode 100644
index 0000000000..d5e78f06e1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.c
@@ -0,0 +1,596 @@
+/*
+ * Interface MIB architecture support
+ *
+ * $Id: ipaddress_ioctl.c 16778 2008-01-17 00:09:33Z magfr $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include "mibII/mibII_common.h"
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/ipaddress.h>
+#include <net-snmp/data_access/interface.h>
+
+#include "ip-mib/ipAddressTable/ipAddressTable_constants.h"
+#include "if-mib/data_access/interface_ioctl.h"
+
+#include <errno.h>
+#include <net/if.h>
+#include <sys/ioctl.h>
+
+#include "ipaddress_ioctl.h"
+
+static void _print_flags(short flags);
+
+#define LIST_TOKEN "ioctl_extras"
+
+/*
+ * get extra structure
+ *
+ * @returns the extras structure from the entry
+ */
+_ioctl_extras *
+netsnmp_ioctl_ipaddress_extras_get(netsnmp_ipaddress_entry *entry)
+{
+ if ((NULL == entry) || (NULL == entry->arch_data))
+ return NULL;
+
+ return netsnmp_get_list_data(entry->arch_data, LIST_TOKEN);
+}
+
+/**
+ * initialize ioctl extras
+ *
+ * @returns _ioctl_extras pointer, or NULL on error
+ */
+_ioctl_extras *
+netsnmp_ioctl_ipaddress_entry_init(netsnmp_ipaddress_entry *entry)
+{
+ netsnmp_data_list *node;
+ _ioctl_extras *extras;
+
+ if (NULL == entry)
+ return NULL;
+
+ extras = SNMP_MALLOC_TYPEDEF(_ioctl_extras);
+ if (NULL == extras)
+ return NULL;
+
+ node = netsnmp_create_data_list(LIST_TOKEN, extras, free);
+ if (NULL == node) {
+ free(extras);
+ return NULL;
+ }
+
+ netsnmp_data_list_add_node( &entry->arch_data, node );
+
+ return extras;
+}
+
+/**
+ * cleanup ioctl extras
+ */
+void
+netsnmp_ioctl_ipaddress_entry_cleanup(netsnmp_ipaddress_entry *entry)
+{
+ if (NULL == entry) {
+ netsnmp_assert(NULL != entry);
+ return;
+ }
+
+ if (NULL == entry->arch_data) {
+ netsnmp_assert(NULL != entry->arch_data);
+ return;
+ }
+
+ netsnmp_remove_list_node(&entry->arch_data, LIST_TOKEN);
+}
+
+/**
+ * copy ioctl extras
+ *
+ * @retval 0: success
+ * @retval <0: error
+ */
+int
+netsnmp_ioctl_ipaddress_entry_copy(netsnmp_ipaddress_entry *lhs,
+ netsnmp_ipaddress_entry *rhs)
+{
+ _ioctl_extras *lhs_extras, *rhs_extras;
+ int rc = SNMP_ERR_NOERROR;
+
+ if ((NULL == lhs) || (NULL == rhs)) {
+ netsnmp_assert((NULL != lhs) && (NULL != rhs));
+ return -1;
+ }
+
+ rhs_extras = netsnmp_ioctl_ipaddress_extras_get(rhs);
+ lhs_extras = netsnmp_ioctl_ipaddress_extras_get(lhs);
+ if (NULL == rhs_extras) {
+ if (NULL != lhs_extras)
+ netsnmp_ioctl_ipaddress_entry_cleanup(lhs);
+ }
+ else {
+ if (NULL == lhs_extras)
+ lhs_extras = netsnmp_ioctl_ipaddress_entry_init(lhs);
+
+ if (NULL != lhs_extras)
+ memcpy(lhs_extras, rhs_extras, sizeof(_ioctl_extras));
+ else
+ rc = -1;
+ }
+
+ return rc;
+}
+
+/**
+ * load ipv4 address via ioctl
+ */
+int
+_netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container,
+ int idx_offset)
+{
+ int i, sd, rc = 0, interfaces = 0;
+ struct ifconf ifc;
+ struct ifreq *ifrp;
+ struct sockaddr save_addr;
+ struct sockaddr_in * si;
+ netsnmp_ipaddress_entry *entry;
+ _ioctl_extras *extras;
+
+ if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ snmp_log(LOG_ERR, "could not create socket\n");
+ return -1;
+ }
+
+ interfaces =
+ netsnmp_access_ipaddress_ioctl_get_interface_count(sd, &ifc);
+ if(interfaces < 0) {
+ close(sd);
+ return -2;
+ }
+ netsnmp_assert(NULL != ifc.ifc_buf);
+ DEBUGMSGTL(("access:ipaddress:container", "processing %d interfaces\n", interfaces));
+
+ ifrp = ifc.ifc_req;
+ for(i=0; i < interfaces; ++i, ++ifrp) {
+
+ DEBUGMSGTL(("access:ipaddress:container",
+ " interface %d, %s\n", i, ifrp->ifr_name));
+ /*
+ */
+ entry = netsnmp_access_ipaddress_entry_create();
+ if(NULL == entry) {
+ rc = -3;
+ break;
+ }
+ entry->ns_ia_index = ++idx_offset;
+
+ /*
+ * save if name
+ */
+ extras = netsnmp_ioctl_ipaddress_extras_get(entry);
+ memcpy(extras->name, ifrp->ifr_name, sizeof(extras->name));
+
+ /*
+ * each time we make an ioctl, we need to specify the address, but
+ * it will be overwritten in the call. so we save address here.
+ */
+ save_addr = ifrp->ifr_addr;
+
+ /*
+ * set indexes
+ */
+ netsnmp_assert(AF_INET == ifrp->ifr_addr.sa_family);
+ si = (struct sockaddr_in *) &ifrp->ifr_addr;
+ entry->ia_address_len = sizeof(si->sin_addr.s_addr);
+ memcpy(entry->ia_address, &si->sin_addr.s_addr,
+ entry->ia_address_len);
+
+ /*
+ * get ifindex
+ */
+ {
+ /*
+ * I think that Linux and Solaris both use ':' in the
+ * interface name for aliases. When a new arch is added
+ * that uses some other indicator, a new function, maybe
+ * netsnmp_access_ipaddress_entry_name_alias_check(), will
+ * need to be written.
+ */
+ char *ptr = strchr(ifrp->ifr_name, ':');
+ if (NULL != ptr) {
+ entry->flags |= NETSNMP_ACCESS_IPADDRESS_ISALIAS;
+ *ptr = 0;
+ }
+ }
+ entry->if_index =
+ netsnmp_access_interface_ioctl_ifindex_get(sd, ifrp->ifr_name);
+ if (0 == entry->if_index) {
+ snmp_log(LOG_ERR,"no ifindex found for interface\n");
+ netsnmp_access_ipaddress_entry_free(entry);
+ continue;
+ }
+
+ /* restore the interface name if we modifed it due to unaliasing
+ * above
+ */
+ if (entry->flags | NETSNMP_ACCESS_IPADDRESS_ISALIAS) {
+ memcpy(ifrp->ifr_name, extras->name, sizeof(extras->name));
+ }
+
+ /*
+ * get netmask
+ */
+ ifrp->ifr_addr = save_addr;
+ if (ioctl(sd, SIOCGIFNETMASK, ifrp) < 0) {
+ snmp_log(LOG_ERR,
+ "error getting netmask for interface %d\n", i);
+ netsnmp_access_ipaddress_entry_free(entry);
+ continue;
+ }
+ netsnmp_assert(AF_INET == ifrp->ifr_addr.sa_family);
+ si = (struct sockaddr_in *) &ifrp->ifr_addr;
+ entry->ia_prefix_len =
+ netsnmp_ipaddress_ipv4_prefix_len(si->sin_addr.s_addr);
+
+ /*
+ * get flags
+ */
+ ifrp->ifr_addr = save_addr;
+ if (ioctl(sd, SIOCGIFFLAGS, ifrp) < 0) {
+ snmp_log(LOG_ERR,
+ "error getting if_flags for interface %d\n", i);
+ netsnmp_access_ipaddress_entry_free(entry);
+ continue;
+ }
+ extras->flags = ifrp->ifr_flags;
+
+ entry->ia_type = IPADDRESSTYPE_UNICAST; /* assume unicast? */
+
+ /** entry->ia_prefix_oid ? */
+
+ /*
+ * per the MIB:
+ * In the absence of other information, an IPv4 address is
+ * always preferred(1).
+ */
+ entry->ia_status = IPADDRESSSTATUSTC_PREFERRED;
+
+ /*
+ * can we figure out if an address is from DHCP?
+ * use manual until then...
+ */
+ entry->ia_origin = IPADDRESSORIGINTC_MANUAL;
+
+ DEBUGIF("access:ipaddress:container") {
+ DEBUGMSGT_NC(("access:ipaddress:container",
+ " if %d: addr len %d, index 0x%x\n",
+ i, entry->ia_address_len, entry->if_index));
+ if (4 == entry->ia_address_len)
+ DEBUGMSGT_NC(("access:ipaddress:container", " address %p\n",
+ *((void**)entry->ia_address)));
+ DEBUGMSGT_NC(("access:ipaddress:container", "flags 0x%x\n",
+ extras->flags));
+ _print_flags(extras->flags);
+
+ }
+
+ /*
+ * add entry to container
+ */
+ if (CONTAINER_INSERT(container, entry) < 0)
+ {
+ DEBUGMSGTL(("access:ipaddress:container","error with ipaddress_entry: insert into container failed.\n"));
+ netsnmp_access_ipaddress_entry_free(entry);
+ continue;
+ }
+ }
+
+ /*
+ * clean up
+ */
+ free(ifc.ifc_buf);
+ close(sd);
+
+ /*
+ * return number of interfaces seen
+ */
+ if(rc < 0)
+ return rc;
+
+ return idx_offset;
+}
+
+/**
+ * find unused alias number
+ */
+static int
+_next_alias(const char *if_name)
+{
+ int i, j, k, sd, interfaces = 0, len;
+ struct ifconf ifc;
+ struct ifreq *ifrp;
+ char *alias;
+ int *alias_list;
+
+ if (NULL == if_name)
+ return -1;
+ len = strlen(if_name);
+
+ if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ snmp_log(LOG_ERR, "could not create socket\n");
+ return -1;
+ }
+
+ interfaces =
+ netsnmp_access_ipaddress_ioctl_get_interface_count(sd, &ifc);
+ if(interfaces < 0) {
+ close(sd);
+ return -2;
+ }
+ netsnmp_assert(NULL != ifc.ifc_buf);
+ DEBUGMSGTL(("access:ipaddress:container", "processing %d interfaces\n", interfaces));
+
+ alias_list = malloc(interfaces * sizeof(int));
+ if (NULL == alias_list) {
+ close(sd);
+ return -2;
+ }
+
+ ifrp = ifc.ifc_req;
+ for(i=0,j=0; i < interfaces; ++i, ++ifrp) {
+
+ if (strncmp(ifrp->ifr_name, if_name, len) != 0)
+ continue;
+
+ DEBUGMSGTL(("access:ipaddress:container",
+ " interface %d, %s\n", i, ifrp->ifr_name));
+
+ alias = strchr(ifrp->ifr_name, ':');
+ if (NULL == alias)
+ continue;
+
+ ++alias; /* skip ':' */
+ alias_list[j++] = atoi(alias);
+ }
+
+ /*
+ * clean up
+ */
+ free(ifc.ifc_buf);
+ close(sd);
+
+ /*
+ * return first unused alias
+ */
+ for(i=1; i<=interfaces; ++i) {
+ for(k=0;k<j;++k)
+ if (alias_list[k] == i)
+ break;
+ if (k == j)
+ return i;
+ }
+
+ return interfaces + 1;
+}
+
+
+/**
+ *
+ * @retval 0 : no error
+ * @retval -1 : bad parameter
+ * @retval -2 : couldn't create socket
+ * @retval -3 : ioctl failed
+ */
+int
+_netsnmp_ioctl_ipaddress_set_v4(netsnmp_ipaddress_entry * entry)
+{
+ struct ifreq ifrq;
+ struct sockaddr_in *sin;
+ int rc, fd = -1;
+ _ioctl_extras *extras;
+
+ if (NULL == entry)
+ return -1;
+
+ netsnmp_assert(4 == entry->ia_address_len);
+
+ extras = netsnmp_ioctl_ipaddress_extras_get(entry);
+ if (NULL == extras)
+ return -1;
+
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if(fd < 0) {
+ snmp_log(LOG_ERR,"couldn't create socket\n");
+ return -2;
+ }
+ memset(&ifrq, 0, sizeof(ifrq));
+
+ if ('\0' == extras->name[0]) {
+ const char *name = netsnmp_access_interface_name_find(entry->if_index);
+ int alias_idx;
+
+ if (NULL == name) {
+ DEBUGMSGT(("access:ipaddress:set", "cant find name for index %d\n",
+ entry->if_index));
+ close(fd);
+ return -1;
+ }
+
+ /*
+ * search for unused alias
+ */
+ alias_idx = _next_alias(name);
+ snprintf(ifrq.ifr_name,sizeof(ifrq.ifr_name), "%s:%d",
+ name, alias_idx);
+ }
+ else
+ strncpy(ifrq.ifr_name, extras->name, sizeof(ifrq.ifr_name));
+
+ ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+
+ sin = (struct sockaddr_in*)&ifrq.ifr_addr;
+ sin->sin_family = AF_INET;
+ memcpy(&sin->sin_addr.s_addr, entry->ia_address,
+ entry->ia_address_len);
+
+ rc = ioctl(fd, SIOCSIFADDR, &ifrq);
+ close(fd);
+ if(rc < 0) {
+ snmp_log(LOG_ERR,"error setting address\n");
+ return -3;
+ }
+
+ return 0;
+}
+
+/**
+ *
+ * @retval 0 : no error
+ * @retval -1 : bad parameter
+ * @retval -2 : couldn't create socket
+ * @retval -3 : ioctl failed
+ */
+int
+_netsnmp_ioctl_ipaddress_delete_v4(netsnmp_ipaddress_entry * entry)
+{
+ struct ifreq ifrq;
+ int rc, fd = -1;
+ _ioctl_extras *extras;
+
+ if (NULL == entry)
+ return -1;
+
+ netsnmp_assert(4 == entry->ia_address_len);
+
+ extras = netsnmp_ioctl_ipaddress_extras_get(entry);
+ if (NULL == extras)
+ return -1;
+
+ fd = socket(AF_INET, SOCK_DGRAM, 0);
+ if(fd < 0) {
+ snmp_log(LOG_ERR,"couldn't create socket\n");
+ return -2;
+ }
+
+ memset(&ifrq, 0, sizeof(ifrq));
+
+ strncpy(ifrq.ifr_name, extras->name, sizeof(ifrq.ifr_name));
+ ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+
+ ifrq.ifr_flags = 0;
+
+ rc = ioctl(fd, SIOCSIFFLAGS, &ifrq);
+ close(fd);
+ if(rc < 0) {
+ snmp_log(LOG_ERR,"error deleting address\n");
+ return -3;
+ }
+
+ return 0;
+}
+
+/**
+ * get the interface count and populate the ifc_buf
+ *
+ * Note: the caller assumes responsbility for the ifc->ifc_buf
+ * memory, and should free() it when done.
+ *
+ * @retval -1 : malloc error
+ */
+int
+netsnmp_access_ipaddress_ioctl_get_interface_count(int sd, struct ifconf * ifc)
+{
+ int lastlen = 0, i;
+ struct ifconf ifc_tmp;
+
+ if (NULL == ifc) {
+ memset(&ifc_tmp, 0x0, sizeof(ifc_tmp));
+ ifc = &ifc_tmp;
+ }
+
+ /*
+ * Cope with lots of interfaces and brokenness of ioctl SIOCGIFCONF
+ * on some platforms; see W. R. Stevens, ``Unix Network Programming
+ * Volume I'', p.435.
+ */
+
+ for (i = 8;; i *= 2) {
+ ifc->ifc_buf = calloc(i, sizeof(struct ifreq));
+ if (NULL == ifc->ifc_buf) {
+ snmp_log(LOG_ERR, "could not allocate memory for %d interfaces\n",
+ i);
+ return -1;
+ }
+ ifc->ifc_len = i * sizeof(struct ifreq);
+
+ if (ioctl(sd, SIOCGIFCONF, (char *) ifc) < 0) {
+ if (errno != EINVAL || lastlen != 0) {
+ /*
+ * Something has gone genuinely wrong.
+ */
+ snmp_log(LOG_ERR, "bad rc from ioctl, errno %d", errno);
+ SNMP_FREE(ifc->ifc_buf);
+ break;
+ }
+ /*
+ * Otherwise, it could just be that the buffer is too small.
+ */
+ } else {
+ if (ifc->ifc_len == lastlen) {
+ /*
+ * The length is the same as the last time; we're done.
+ */
+ break;
+ }
+ lastlen = ifc->ifc_len;
+ }
+ free(ifc->ifc_buf); /* no SNMP_FREE, getting ready to reassign */
+ }
+
+ if (ifc == &ifc_tmp)
+ free(ifc_tmp.ifc_buf);
+
+ return ifc->ifc_len / sizeof(struct ifreq);
+}
+
+/**
+ */
+static void
+_print_flags(short flags)
+{
+/** Standard interface flags. */
+ struct {
+ short flag;
+ const char *name;
+ } map[] = {
+ { IFF_UP, "interface is up"},
+ { IFF_BROADCAST, "broadcast address valid"},
+ { IFF_DEBUG, "turn on debugging"},
+ { IFF_LOOPBACK, "is a loopback net"},
+ { IFF_POINTOPOINT, "interface is has p-p link"},
+ { IFF_NOTRAILERS, "avoid use of trailers"},
+ { IFF_RUNNING, "resources allocated"},
+ { IFF_NOARP, "no ARP protocol"},
+ { IFF_PROMISC, "receive all packets"},
+ { IFF_ALLMULTI, "receive all multicast packets"},
+ { IFF_MASTER, "master of a load balancer"},
+ { IFF_SLAVE, "slave of a load balancer"},
+ { IFF_MULTICAST, "Supports multicast"},
+ { IFF_PORTSEL, "can set media type"},
+ { IFF_AUTOMEDIA, "auto media select active"},
+ };
+ short unknown = flags;
+ int i;
+
+ for(i = 0; i < sizeof(map)/sizeof(map[0]); ++i)
+ if(flags & map[i].flag) {
+ DEBUGMSGT_NC(("access:ipaddress:container"," %s\n", map[i].name));
+ unknown &= ~map[i].flag;
+ }
+
+ if(unknown)
+ DEBUGMSGT_NC(("access:ipaddress:container"," unknown 0x%x\n", unknown));
+}
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.h
new file mode 100644
index 0000000000..a7a0ea2a39
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_ioctl.h
@@ -0,0 +1,44 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int
+_netsnmp_ioctl_ipaddress_container_load_v4(netsnmp_container *container,
+ int idx_offset);
+int
+_netsnmp_ioctl_ipaddress_set_v4(netsnmp_ipaddress_entry * entry);
+int
+_netsnmp_ioctl_ipaddress_remove_v4(netsnmp_ipaddress_entry * entry);
+
+int
+netsnmp_access_ipaddress_ioctl_get_interface_count(int sd, struct ifconf * ifc);
+
+
+/*
+ * struct ioctl for arch_data
+ */
+typedef struct _ioctl_extras {
+ u_int flags;
+ u_char name[IFNAMSIZ];
+} _ioctl_extras;
+
+
+
+_ioctl_extras *
+netsnmp_ioctl_ipaddress_entry_init(netsnmp_ipaddress_entry *entry);
+void
+netsnmp_ioctl_ipaddress_entry_cleanup(netsnmp_ipaddress_entry *entry);
+int
+netsnmp_ioctl_ipaddress_entry_copy(netsnmp_ipaddress_entry *lhs,
+ netsnmp_ipaddress_entry *rhs);
+
+_ioctl_extras *
+netsnmp_ioctl_ipaddress_extras_get(netsnmp_ipaddress_entry *entry);
+
+int
+_netsnmp_ioctl_ipaddress_delete_v4(netsnmp_ipaddress_entry * entry);
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c
new file mode 100644
index 0000000000..8cb06a250f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c
@@ -0,0 +1,338 @@
+/*
+ * Interface MIB architecture support
+ *
+ * $Id: ipaddress_linux.c 17155 2008-08-13 13:02:12Z jsafranek $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include "mibII/mibII_common.h"
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/ipaddress.h>
+#include <net-snmp/data_access/interface.h>
+
+#include "ip-mib/ipAddressTable/ipAddressTable_constants.h"
+
+#include <errno.h>
+#include <sys/ioctl.h>
+
+#if defined (NETSNMP_ENABLE_IPV6)
+#include <linux/types.h>
+#include <asm/types.h>
+#include <linux/rtnetlink.h>
+#endif
+
+#include "ipaddress_ioctl.h"
+
+int _load_v6(netsnmp_container *container, int idx_offset);
+
+/*
+ * initialize arch specific storage
+ *
+ * @retval 0: success
+ * @retval <0: error
+ */
+int
+netsnmp_arch_ipaddress_entry_init(netsnmp_ipaddress_entry *entry)
+{
+ /*
+ * init ipv4 stuff
+ */
+ if (NULL == netsnmp_ioctl_ipaddress_entry_init(entry))
+ return -1;
+
+ /*
+ * init ipv6 stuff
+ * so far, we can just share the ipv4 stuff, so nothing to do
+ */
+
+ return 0;
+}
+
+/*
+ * cleanup arch specific storage
+ */
+void
+netsnmp_arch_ipaddress_entry_cleanup(netsnmp_ipaddress_entry *entry)
+{
+ /*
+ * cleanup ipv4 stuff
+ */
+ netsnmp_ioctl_ipaddress_entry_cleanup(entry);
+
+ /*
+ * cleanup ipv6 stuff
+ * so far, we can just share the ipv4 stuff, so nothing to do
+ */
+}
+
+/*
+ * copy arch specific storage
+ */
+int
+netsnmp_arch_ipaddress_entry_copy(netsnmp_ipaddress_entry *lhs,
+ netsnmp_ipaddress_entry *rhs)
+{
+ int rc;
+
+ /*
+ * copy ipv4 stuff
+ */
+ rc = netsnmp_ioctl_ipaddress_entry_copy(lhs, rhs);
+ if (rc)
+ return rc;
+
+ /*
+ * copy ipv6 stuff
+ * so far, we can just share the ipv4 stuff, so nothing to do
+ */
+
+ return rc;
+}
+
+/*
+ * create a new entry
+ */
+int
+netsnmp_arch_ipaddress_create(netsnmp_ipaddress_entry *entry)
+{
+ if (NULL == entry)
+ return -1;
+
+ if (4 != entry->ia_address_len) {
+ DEBUGMSGT(("access:ipaddress:create", "only ipv4 supported\n"));
+ return -2;
+ }
+
+ return _netsnmp_ioctl_ipaddress_set_v4(entry);
+}
+
+/*
+ * create a new entry
+ */
+int
+netsnmp_arch_ipaddress_delete(netsnmp_ipaddress_entry *entry)
+{
+ if (NULL == entry)
+ return -1;
+
+ if (4 != entry->ia_address_len) {
+ DEBUGMSGT(("access:ipaddress:create", "only ipv4 supported\n"));
+ return -2;
+ }
+
+ return _netsnmp_ioctl_ipaddress_delete_v4(entry);
+}
+
+/**
+ *
+ * @retval 0 no errors
+ * @retval !0 errors
+ */
+int
+netsnmp_arch_ipaddress_container_load(netsnmp_container *container,
+ u_int load_flags)
+{
+ int rc = 0, idx_offset = 0;
+
+ if (0 == (load_flags & NETSNMP_ACCESS_IPADDRESS_LOAD_IPV6_ONLY)) {
+ rc = _netsnmp_ioctl_ipaddress_container_load_v4(container, idx_offset);
+ if(rc < 0) {
+ u_int flags = NETSNMP_ACCESS_IPADDRESS_FREE_KEEP_CONTAINER;
+ netsnmp_access_ipaddress_container_free(container, flags);
+ }
+ }
+
+#if defined (NETSNMP_ENABLE_IPV6)
+
+ if (0 == (load_flags & NETSNMP_ACCESS_IPADDRESS_LOAD_IPV4_ONLY)) {
+ if (rc < 0)
+ rc = 0;
+
+ idx_offset = rc;
+
+ /*
+ * load ipv6, ignoring errors if file not found
+ */
+ rc = _load_v6(container, idx_offset);
+ if (-2 == rc)
+ rc = 0;
+ else if(rc < 0) {
+ u_int flags = NETSNMP_ACCESS_IPADDRESS_FREE_KEEP_CONTAINER;
+ netsnmp_access_ipaddress_container_free(container, flags);
+ }
+ }
+#endif
+
+ /*
+ * return no errors (0) if we found any interfaces
+ */
+ if(rc > 0)
+ rc = 0;
+
+ return rc;
+}
+
+#if defined (NETSNMP_ENABLE_IPV6)
+/**
+ */
+int
+_load_v6(netsnmp_container *container, int idx_offset)
+{
+ FILE *in;
+ char line[80], addr[40];
+ char if_name[IFNAMSIZ+1];/* +1 for '\0' because of the ugly sscanf below */
+ u_char *buf;
+ int if_index, pfx_len, scope, flags, rc = 0;
+ size_t in_len, out_len;
+ netsnmp_ipaddress_entry *entry;
+ _ioctl_extras *extras;
+ static int log_open_err = 1;
+
+ netsnmp_assert(NULL != container);
+
+#define PROCFILE "/proc/net/if_inet6"
+ if (!(in = fopen(PROCFILE, "r"))) {
+ if (1 == log_open_err) {
+ snmp_log(LOG_ERR,"could not open " PROCFILE "\n");
+ log_open_err = 0;
+ }
+ return -2;
+ }
+ /*
+ * if we hadn't been able to open file and turned of err logging,
+ * turn it back on now that we opened the file.
+ */
+ if (0 == log_open_err)
+ log_open_err = 1;
+
+ /*
+ * address index prefix_len scope status if_name
+ */
+ while (fgets(line, sizeof(line), in)) {
+ /*
+ * fe800000000000000200e8fffe5b5c93 05 40 20 80 eth0
+ * A D P S F I
+ * A: address
+ * D: device number
+ * P: prefix len
+ * S: scope (see include/net/ipv6.h, net/ipv6/addrconf.c)
+ * F: flags (see include/linux/rtnetlink.h, net/ipv6/addrconf.c)
+ * I: interface
+ */
+ rc = sscanf(line, "%39s %04x %02x %02x %02x %" SNMP_MACRO_VAL_TO_STR(IFNAMSIZ) "s\n",
+ addr, &if_index, &pfx_len, &scope, &flags, if_name);
+ if( 6 != rc ) {
+ snmp_log(LOG_ERR, PROCFILE " data format error (%d!=6), line ==|%s|\n",
+ rc, line);
+ continue;
+ }
+ DEBUGMSGTL(("access:ipaddress:container",
+ "addr %s, index %d, pfx %d, scope %d, flags 0x%X, name %s\n",
+ addr, if_index, pfx_len, scope, flags, if_name));
+ /*
+ */
+ entry = netsnmp_access_ipaddress_entry_create();
+ if(NULL == entry) {
+ rc = -3;
+ break;
+ }
+
+ in_len = entry->ia_address_len = sizeof(entry->ia_address);
+ netsnmp_assert(16 == in_len);
+ out_len = 0;
+ buf = entry->ia_address;
+ if(1 != netsnmp_hex_to_binary(&buf, &in_len,
+ &out_len, 0, addr, ":")) {
+ snmp_log(LOG_ERR,"error parsing '%s', skipping\n",
+ entry->ia_address);
+ netsnmp_access_ipaddress_entry_free(entry);
+ continue;
+ }
+ netsnmp_assert(16 == out_len);
+ entry->ia_address_len = out_len;
+
+ entry->ns_ia_index = ++idx_offset;
+
+ /*
+ * save if name
+ */
+ extras = netsnmp_ioctl_ipaddress_extras_get(entry);
+ memcpy(extras->name, if_name, sizeof(extras->name));
+ extras->flags = flags;
+
+ /*
+ * yyy-rks: optimization: create a socket outside the loop and use
+ * netsnmp_access_interface_ioctl_ifindex_get() here, since
+ * netsnmp_access_interface_index_find will open/close a socket
+ * every time it is called.
+ */
+ entry->if_index = netsnmp_access_interface_index_find(if_name);
+
+ /*
+ #define IPADDRESSSTATUSTC_PREFERRED 1
+ #define IPADDRESSSTATUSTC_DEPRECATED 2
+ #define IPADDRESSSTATUSTC_INVALID 3
+ #define IPADDRESSSTATUSTC_INACCESSIBLE 4
+ #define IPADDRESSSTATUSTC_UNKNOWN 5
+ #define IPADDRESSSTATUSTC_TENTATIVE 6
+ #define IPADDRESSSTATUSTC_DUPLICATE 7
+ */
+ if(flags & IFA_F_PERMANENT)
+ entry->ia_status = IPADDRESSSTATUSTC_PREFERRED; /* ?? */
+ else if(flags & IFA_F_DEPRECATED)
+ entry->ia_status = IPADDRESSSTATUSTC_DEPRECATED;
+ else if(flags & IFA_F_TENTATIVE)
+ entry->ia_status = IPADDRESSSTATUSTC_TENTATIVE;
+ else {
+ entry->ia_status = IPADDRESSSTATUSTC_UNKNOWN;
+ DEBUGMSGTL(("access:ipaddress:ipv6",
+ "unknown flags 0x%x\n", flags));
+ }
+
+ /*
+ * if it's not multi, it must be uni.
+ * (an ipv6 address is never broadcast)
+ */
+ if (IN6_IS_ADDR_MULTICAST(entry->ia_address))
+ entry->ia_type = IPADDRESSTYPE_ANYCAST;
+ else
+ entry->ia_type = IPADDRESSTYPE_UNICAST;
+
+
+ entry->ia_prefix_len = pfx_len;
+
+ /*
+ * can we figure out if an address is from DHCP?
+ * use manual until then...
+ *
+ *#define IPADDRESSORIGINTC_OTHER 1
+ *#define IPADDRESSORIGINTC_MANUAL 2
+ *#define IPADDRESSORIGINTC_DHCP 4
+ *#define IPADDRESSORIGINTC_LINKLAYER 5
+ *#define IPADDRESSORIGINTC_RANDOM 6
+ *
+ * are 'local' address assigned by link layer??
+ */
+ if (IN6_IS_ADDR_LINKLOCAL(entry->ia_address) ||
+ IN6_IS_ADDR_SITELOCAL(entry->ia_address))
+ entry->ia_origin = IPADDRESSORIGINTC_LINKLAYER;
+ else
+ entry->ia_origin = IPADDRESSORIGINTC_MANUAL;
+
+ /* xxx-rks: what can we do with scope? */
+
+ /*
+ * add entry to container
+ */
+ CONTAINER_INSERT(container, entry);
+ }
+
+ fclose(in);
+
+ if(rc<0)
+ return rc;
+
+ return idx_offset;
+}
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_linux.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_linux.h
new file mode 100644
index 0000000000..ab46955cbf
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/ipaddress_linux.h
@@ -0,0 +1,22 @@
+/*
+ * ipaddress data access header
+ *
+ * $Id: ipaddress_linux.h 13371 2005-11-02 17:07:28Z rstory $
+ */
+/**---------------------------------------------------------------------*/
+/*
+ * configure required files
+ *
+ * Notes:
+ *
+ * 1) prefer functionality over platform, where possible. If a method
+ * is available for multiple platforms, test that first. That way
+ * when a new platform is ported, it won't need a new test here.
+ *
+ * 2) don't do detail requirements here. If, for example,
+ * HPUX11 had different reuirements than other HPUX, that should
+ * be handled in the *_hpux.h header file.
+ */
+config_require(ip-mib/data_access/ipaddress_linux)
+config_require(ip-mib/data_access/ipaddress_ioctl)
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/scalars_common.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/scalars_common.h
new file mode 100644
index 0000000000..0404bd5f3c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/scalars_common.h
@@ -0,0 +1,29 @@
+/*
+ * ip scalar data access header
+ *
+ * $Id: scalars_common.h 13271 2005-10-28 15:29:23Z rstory $
+ */
+/**---------------------------------------------------------------------*/
+/*
+ * configure required files
+ *
+ * Notes:
+ *
+ * 1) prefer functionality over platform, where possible. If a method
+ * is available for multiple platforms, test that first. That way
+ * when a new platform is ported, it won't need a new test here.
+ *
+ * 2) don't do detail requirements here. If, for example,
+ * HPUX11 had different reuirements than other HPUX, that should
+ * be handled in the *_hpux.h header file.
+ */
+#if defined( linux )
+config_require(ip-mib/data_access/scalars_linux)
+#else
+/*
+ * couldn't determine the correct file!
+ * require a bogus file to generate an error.
+ */
+config_require(ip-mib/data_access/scalars-unknown-arch)
+#endif
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/scalars_linux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/scalars_linux.c
new file mode 100644
index 0000000000..aedcd8b1f1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/scalars_linux.c
@@ -0,0 +1,79 @@
+/*
+ * Arp MIB architecture support
+ *
+ * $Id: scalars_linux.c 16965 2008-05-25 07:14:16Z magfr $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+#include <net-snmp/data_access/ip_scalars.h>
+
+static const char ipfw_name[] = "/proc/sys/net/ipv6/conf/all/forwarding";
+
+int
+netsnmp_arch_ip_scalars_ipv6IpForwarding_get(u_long *value)
+{
+ FILE *filep;
+ int rc;
+
+ if (NULL == value)
+ return -1;
+
+
+ filep = fopen(ipfw_name, "r");
+ if (NULL == filep) {
+ DEBUGMSGTL(("access:ipv6IpForwarding", "could not open %s\n",
+ ipfw_name));
+ return -2;
+ }
+
+ rc = fscanf(filep, "%ld", value);
+ fclose(filep);
+ if (1 != rc) {
+ DEBUGMSGTL(("access:ipv6IpForwarding", "could not read %s\n",
+ ipfw_name));
+ return -3;
+ }
+
+ if ((0 != *value) && (1 != *value)) {
+ DEBUGMSGTL(("access:ipv6IpForwarding", "unexpected value %ld in %s\n",
+ *value, ipfw_name));
+ return -4;
+ }
+
+ return 0;
+}
+
+int
+netsnmp_arch_ip_scalars_ipv6IpForwarding_set(u_long value)
+{
+ FILE *filep;
+ int rc;
+
+ if (1 == value)
+ ;
+ else if (2 == value)
+ value = 0;
+ else {
+ DEBUGMSGTL(("access:ipv6IpForwarding",
+ "bad value %ld for ipv6IpForwarding\n", value));
+ return SNMP_ERR_WRONGVALUE;
+ }
+
+ filep = fopen(ipfw_name, "w");
+ if (NULL == filep) {
+ DEBUGMSGTL(("access:ipv6IpForwarding", "could not open %s\n",
+ ipfw_name));
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+
+ rc = fprintf(filep, "%ld", value);
+ fclose(filep);
+ if (1 != rc) {
+ DEBUGMSGTL(("access:ipv6IpForwarding", "could not write %s\n",
+ ipfw_name));
+ return SNMP_ERR_GENERR;
+ }
+
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/systemstats.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/systemstats.h
new file mode 100644
index 0000000000..84ca0c89f8
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/systemstats.h
@@ -0,0 +1,30 @@
+/*
+ * systemstats data access header
+ *
+ * $Id: systemstats.h 13271 2005-10-28 15:29:23Z rstory $
+ */
+/**---------------------------------------------------------------------*/
+/*
+ * configure required files
+ *
+ * Notes:
+ *
+ * 1) prefer functionality over platform, where possible. If a method
+ * is available for multiple platforms, test that first. That way
+ * when a new platform is ported, it won't need a new test here.
+ *
+ * 2) don't do detail requirements here. If, for example,
+ * HPUX11 had different reuirements than other HPUX, that should
+ * be handled in the *_hpux.h header file.
+ */
+config_require(ip-mib/data_access/systemstats_common)
+#if defined( linux )
+config_require(ip-mib/data_access/systemstats_linux)
+#else
+/*
+ * couldn't determine the correct file!
+ * require a bogus file to generate an error.
+ */
+config_require(ip-mib/data_access/systemstats-unknown-arch);
+#endif
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/systemstats_common.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/systemstats_common.c
new file mode 100644
index 0000000000..83e1867442
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/systemstats_common.c
@@ -0,0 +1,389 @@
+/*
+ * Systemstats MIB architecture support
+ *
+ * $Id: systemstats_common.c 11913 2005-02-08 21:58:36Z nba $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include "ip-mib/ipSystemStatsTable/ipSystemStatsTable_constants.h"
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/ipstats.h>
+#include <net-snmp/data_access/systemstats.h>
+
+/**---------------------------------------------------------------------*/
+/*
+ * local static vars
+ */
+static int need_wrap_check = -1;
+
+/*
+ * local static prototypes
+ */
+static void _entry_release(netsnmp_systemstats_entry * entry, void *unused);
+
+/**---------------------------------------------------------------------*/
+/*
+ * external per-architecture functions prototypes
+ *
+ * These shouldn't be called by the general public, so they aren't in
+ * the header file.
+ */
+extern int
+netsnmp_access_systemstats_container_arch_load(netsnmp_container* container,
+ u_int load_flags);
+extern void
+netsnmp_access_systemstats_arch_init(void);
+
+/**---------------------------------------------------------------------*/
+/*
+ * initialization
+ */
+void
+netsnmp_access_systemstats_init(void)
+{
+ netsnmp_container * ifcontainer;
+
+ netsnmp_access_systemstats_arch_init();
+
+ /*
+ * load once to set up ifIndexes
+ */
+ ifcontainer = netsnmp_access_systemstats_container_load(NULL, 0);
+ if(NULL != ifcontainer)
+ netsnmp_access_systemstats_container_free(ifcontainer, 0);
+
+}
+
+/**---------------------------------------------------------------------*/
+/*
+ * container functions
+ */
+/**
+ * initialize systemstats container
+ */
+netsnmp_container *
+netsnmp_access_systemstats_container_init(u_int flags)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("access:systemstats:container", "init\n"));
+
+ /*
+ * create the containers. one indexed by ifIndex, the other
+ * indexed by ifName.
+ */
+ container = netsnmp_container_find("access_systemstats:table_container");
+ if (NULL == container)
+ return NULL;
+
+ return container;
+}
+
+/**
+ * load systemstats information in specified container
+ *
+ * @param container empty container, or NULL to have one created for you
+ * @param load_flags flags to modify behaviour.
+ *
+ * @retval NULL error
+ * @retval !NULL pointer to container
+ */
+netsnmp_container*
+netsnmp_access_systemstats_container_load(netsnmp_container* container, u_int load_flags)
+{
+ int rc;
+
+ DEBUGMSGTL(("access:systemstats:container", "load\n"));
+
+ if (NULL == container)
+ container = netsnmp_access_systemstats_container_init(load_flags);
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "no container specified/found for access_systemstats\n");
+ return NULL;
+ }
+
+ rc = netsnmp_access_systemstats_container_arch_load(container, load_flags);
+ if (0 != rc) {
+ netsnmp_access_systemstats_container_free(container,
+ NETSNMP_ACCESS_SYSTEMSTATS_FREE_NOFLAGS);
+ container = NULL;
+ }
+
+ return container;
+}
+
+void
+netsnmp_access_systemstats_container_free(netsnmp_container *container, u_int free_flags)
+{
+ DEBUGMSGTL(("access:systemstats:container", "free\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "invalid container for netsnmp_access_systemstats_free\n");
+ return;
+ }
+
+ if(! (free_flags & NETSNMP_ACCESS_SYSTEMSTATS_FREE_DONT_CLEAR)) {
+ /*
+ * free all items.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func*)_entry_release,
+ NULL);
+ }
+
+ CONTAINER_FREE(container);
+}
+
+/**---------------------------------------------------------------------*/
+/*
+ * entry functions
+ */
+/**
+ */
+netsnmp_systemstats_entry *
+netsnmp_access_systemstats_entry_get_by_index(netsnmp_container *container, oid index)
+{
+ netsnmp_index tmp;
+
+ DEBUGMSGTL(("access:systemstats:entry", "by_index\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container for netsnmp_access_systemstats_entry_get_by_index\n");
+ return NULL;
+ }
+
+ tmp.len = 1;
+ tmp.oids = &index;
+
+ return (netsnmp_systemstats_entry *) CONTAINER_FIND(container, &tmp);
+}
+
+/**
+ */
+netsnmp_systemstats_entry *
+netsnmp_access_systemstats_entry_create(int version)
+{
+ netsnmp_systemstats_entry *entry =
+ SNMP_MALLOC_TYPEDEF(netsnmp_systemstats_entry);
+
+ DEBUGMSGTL(("access:systemstats:entry", "create\n"));
+
+ if(NULL == entry)
+ return NULL;
+
+ entry->ns_ip_version = version;
+
+ entry->oid_index.len = 1;
+ entry->oid_index.oids = (oid *) & entry->ns_ip_version;
+
+ return entry;
+}
+
+/**
+ */
+void
+netsnmp_access_systemstats_entry_free(netsnmp_systemstats_entry * entry)
+{
+ DEBUGMSGTL(("access:systemstats:entry", "free\n"));
+
+ if (NULL == entry)
+ return;
+
+ /*
+ * SNMP_FREE not needed, for any of these,
+ * since the whole entry is about to be freed
+ */
+
+ if (NULL != entry->old_stats)
+ free(entry->old_stats);
+
+ free(entry);
+}
+
+
+/**---------------------------------------------------------------------*/
+/*
+ * Utility routines
+ */
+
+/**
+ * \internal
+ */
+static void
+_entry_release(netsnmp_systemstats_entry * entry, void *context)
+{
+ netsnmp_access_systemstats_entry_free(entry);
+}
+
+/**
+ * update entry stats (checking for counter wrap)
+ *
+ * @retval 0 : success
+ * @retval <0 : error
+ */
+int
+netsnmp_access_systemstats_entry_update_stats(netsnmp_systemstats_entry * prev_vals,
+ netsnmp_systemstats_entry * new_vals)
+{
+ DEBUGMSGTL(("access:systemstats", "check_wrap\n"));
+
+ /*
+ * sanity checks
+ */
+ if ((NULL == prev_vals) || (NULL == new_vals) ||
+ (prev_vals->ns_ip_version != new_vals->ns_ip_version))
+ return -1;
+
+ /*
+ * if we've determined that we have 64 bit counters, just copy them.
+ */
+ if (0 == need_wrap_check) {
+ memcpy(&prev_vals->stats, &new_vals->stats, sizeof(new_vals->stats));
+ return 0;
+ }
+
+ if (NULL == prev_vals->old_stats) {
+ /*
+ * if we don't have old stats, they can't have wrapped, so just copy
+ */
+ prev_vals->old_stats = SNMP_MALLOC_TYPEDEF(netsnmp_ipstats);
+ if (NULL == prev_vals->old_stats) {
+ return -2;
+ }
+ }
+ else {
+ /*
+ * update straight 32 bit counters
+ */
+ prev_vals->stats.InHdrErrors = new_vals->stats.InHdrErrors;
+ prev_vals->stats.InNoRoutes = new_vals->stats.InNoRoutes;
+ prev_vals->stats.InAddrErrors = new_vals->stats.InAddrErrors;
+ prev_vals->stats.InUnknownProtos = new_vals->stats.InUnknownProtos;
+ prev_vals->stats.InTruncatedPkts = new_vals->stats.InTruncatedPkts;
+ prev_vals->stats.ReasmReqds = new_vals->stats.InTruncatedPkts;
+ prev_vals->stats.ReasmOKs = new_vals->stats.ReasmOKs;
+ prev_vals->stats.ReasmFails = new_vals->stats.ReasmFails;
+ prev_vals->stats.InDiscards = new_vals->stats.InDiscards;
+ prev_vals->stats.OutNoRoutes = new_vals->stats.OutNoRoutes;
+ prev_vals->stats.OutDiscards = new_vals->stats.OutDiscards;
+ prev_vals->stats.OutFragReqds = new_vals->stats.OutFragReqds;
+ prev_vals->stats.OutFragOKs = new_vals->stats.OutFragOKs;
+ prev_vals->stats.OutFragFails = new_vals->stats.OutFragFails;
+ prev_vals->stats.OutFragCreates = new_vals->stats.OutFragCreates;
+
+ /*
+ * update 64bit counters
+ */
+ netsnmp_c64_check32_and_update(&prev_vals->stats.HCInReceives,
+ &new_vals->stats.HCInReceives,
+ &prev_vals->old_stats->HCInReceives,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.HCInOctets,
+ &new_vals->stats.HCInOctets,
+ &prev_vals->old_stats->HCInOctets,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.HCInForwDatagrams,
+ &new_vals->stats.HCInForwDatagrams,
+ &prev_vals->old_stats->HCInForwDatagrams,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.HCInDelivers,
+ &new_vals->stats.HCInDelivers,
+ &prev_vals->old_stats->HCInDelivers,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.HCOutRequests,
+ &new_vals->stats.HCOutRequests,
+ &prev_vals->old_stats->HCOutRequests,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.HCOutForwDatagrams,
+ &new_vals->stats.HCOutForwDatagrams,
+ &prev_vals->old_stats->HCOutForwDatagrams,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.HCOutTransmits,
+ &new_vals->stats.HCOutTransmits,
+ &prev_vals->old_stats->HCOutTransmits,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.HCOutOctets,
+ &new_vals->stats.HCOutOctets,
+ &prev_vals->old_stats->HCOutOctets,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.HCInMcastPkts,
+ &new_vals->stats.HCInMcastPkts,
+ &prev_vals->old_stats->HCInMcastPkts,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.HCInMcastOctets,
+ &new_vals->stats.HCInMcastOctets,
+ &prev_vals->old_stats->HCInMcastOctets,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.HCOutMcastPkts,
+ &new_vals->stats.HCOutMcastPkts,
+ &prev_vals->old_stats->HCOutMcastPkts,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.HCOutMcastOctets,
+ &new_vals->stats.HCOutMcastOctets,
+ &prev_vals->old_stats->HCOutMcastOctets,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.HCInBcastPkts,
+ &new_vals->stats.HCInBcastPkts,
+ &prev_vals->old_stats->HCInBcastPkts,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&prev_vals->stats.HCOutBcastPkts,
+ &new_vals->stats.HCOutBcastPkts,
+ &prev_vals->old_stats->HCOutBcastPkts,
+ &need_wrap_check);
+ }
+
+ /*
+ * if we've decided we no longer need to check wraps, free old stats
+ */
+ if (0 == need_wrap_check) {
+ SNMP_FREE(prev_vals->old_stats);
+ }
+
+ /*
+ * update old stats from new stats.
+ * careful - old_stats is a pointer to stats...
+ */
+ memcpy(prev_vals->old_stats, &new_vals->stats, sizeof(new_vals->stats));
+
+ return 0;
+}
+
+/**
+ * update systemstats entry data (checking for counter wraps)
+ *
+ * Given an existing entry, update it with the new values from another
+ * entry.
+ *
+ * @retval -2 : malloc failed
+ * @retval -1 : systemstatss not the same
+ * @retval 0 : no error
+ */
+int
+netsnmp_access_systemstats_entry_update(netsnmp_systemstats_entry * lhs,
+ netsnmp_systemstats_entry * rhs)
+{
+ DEBUGMSGTL(("access:systemstats", "copy\n"));
+
+ if ((NULL == lhs) || (NULL == rhs) ||
+ (lhs->ns_ip_version != rhs->ns_ip_version))
+ return -1;
+
+ /*
+ * update stats
+ */
+ netsnmp_access_systemstats_entry_update_stats(lhs, rhs);
+
+ /*
+ * update other data
+ */
+ lhs->flags = rhs->flags;
+
+ return 0;
+}
+
+/**---------------------------------------------------------------------*/
+/*
+ *
+ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/systemstats_linux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/systemstats_linux.c
new file mode 100644
index 0000000000..947afe805f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/data_access/systemstats_linux.c
@@ -0,0 +1,376 @@
+/*
+ * Interface MIB architecture support
+ *
+ * $Id: systemstats_linux.c 15220 2006-09-15 00:48:50Z tanders $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/ipstats.h>
+#include <net-snmp/data_access/systemstats.h>
+
+static int _systemstats_v4(netsnmp_container* container, u_int load_flags);
+#if defined (NETSNMP_ENABLE_IPV6)
+static int _systemstats_v6(netsnmp_container* container, u_int load_flags);
+#endif
+
+
+void
+netsnmp_access_systemstats_arch_init(void)
+{
+ /*
+ * nothing to do
+ */
+}
+
+/*
+ /proc/net/snmp
+
+ Ip: Forwarding DefaultTTL InReceives InHdrErrors InAddrErrors ForwDatagrams InUnknownProtos InDiscards InDelivers OutRequests OutDiscards OutNoRoutes ReasmTimeout ReasmReqds ReasmOKs ReasmFails FragOKs FragFails FragCreates
+ Ip: 2 64 7083534 0 0 0 0 0 6860233 6548963 0 0 1 286623 63322 1 259920 0 0
+
+ Icmp: InMsgs InErrors InDestUnreachs InTimeExcds InParmProbs InSrcQuenchs InRedirects InEchos InEchoReps InTimestamps InTimestampReps InAddrMasks InAddrMaskReps OutMsgs OutErrors OutDestUnreachs OutTimeExcds OutParmProbs OutSrcQuenchs OutRedirects OutEchos OutEchoReps OutTimestamps OutTimestampReps OutAddrMasks OutAddrMaskReps
+ Icmp: 335 36 254 72 0 0 0 0 9 0 0 0 0 257 0 257 0 0 0 0 0 0 0 0 0 0
+
+ Tcp: RtoAlgorithm RtoMin RtoMax MaxConn ActiveOpens PassiveOpens AttemptFails EstabResets CurrEstab InSegs OutSegs RetransSegs InErrs OutRsts
+ Tcp: 1 200 120000 -1 5985 55 27 434 10 5365077 5098096 10902 2 4413
+
+ Udp: InDatagrams NoPorts InErrors OutDatagrams
+ Udp: 1491094 122 0 1466178
+*/
+
+
+/*
+ *
+ * @retval 0 success
+ * @retval -1 no container specified
+ * @retval -2 could not open file
+ * @retval -3 could not create entry (probably malloc)
+ * @retval -4 file format error
+ */
+int
+netsnmp_access_systemstats_container_arch_load(netsnmp_container* container,
+ u_int load_flags)
+{
+ int rc1;
+#if defined (NETSNMP_ENABLE_IPV6)
+ int rc2;
+#endif
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "no container specified/found for access_systemstats_\n");
+ return -1;
+ }
+
+ /*
+ * load v4 and v6 stats. Even if one fails, try the other.
+ * If they have the same rc, return it. if the differ, return
+ * the smaller one. No log messages, since each individual function
+ * would have logged its own message.
+ */
+ rc1 = _systemstats_v4(container, load_flags);
+#if defined (NETSNMP_ENABLE_IPV6)
+ rc2 = _systemstats_v6(container, load_flags);
+ if ((rc1 == rc2) || (rc1 < rc2))
+ return rc1;
+
+ return rc2;
+#else
+ return rc1;
+#endif
+}
+
+static int
+_systemstats_v4(netsnmp_container* container, u_int load_flags)
+{
+ FILE *devin;
+ char line[1024];
+ netsnmp_systemstats_entry *entry = NULL;
+ int scan_count;
+ char *stats, *start = line;
+ int len;
+ uintmax_t scan_vals[19];
+
+ DEBUGMSGTL(("access:systemstats:container:arch", "load v4 (flags %p)\n",
+ load_flags));
+
+ netsnmp_assert(container != NULL); /* load function shoulda checked this */
+
+ if (!(devin = fopen("/proc/net/snmp", "r"))) {
+ DEBUGMSGTL(("access:systemstats",
+ "Failed to load Systemstats Table (linux1)\n"));
+ snmp_log(LOG_ERR, "cannot open /proc/net/snmp ...\n");
+ return -2;
+ }
+
+ /*
+ * skip header, but make sure it's the length we expect...
+ */
+ fgets(line, sizeof(line), devin);
+ len = strlen(line);
+ if (224 != len) {
+ fclose(devin);
+ snmp_log(LOG_ERR, "unexpected header length in /proc/net/snmp."
+ " %d != 224\n", len);
+ return -4;
+ }
+
+ /*
+ * This file provides the statistics for each systemstats.
+ * Read in each line in turn, isolate the systemstats name
+ * and retrieve (or create) the corresponding data structure.
+ */
+ start = fgets(line, sizeof(line), devin);
+ fclose(devin);
+ if (start) {
+
+ len = strlen(line);
+ if (line[len - 1] == '\n')
+ line[len - 1] = '\0';
+
+ while (*start && *start == ' ')
+ start++;
+
+ if ((!*start) || ((stats = strrchr(start, ':')) == NULL)) {
+ snmp_log(LOG_ERR,
+ "systemstats data format error 1, line ==|%s|\n", line);
+ return -4;
+ }
+
+ DEBUGMSGTL(("access:systemstats", "processing '%s'\n", start));
+
+ *stats++ = 0; /* null terminate name */
+ while (*stats == ' ') /* skip spaces before stats */
+ stats++;
+
+ entry = netsnmp_access_systemstats_entry_create(1);
+ if(NULL == entry) {
+ netsnmp_access_systemstats_container_free(container,
+ NETSNMP_ACCESS_SYSTEMSTATS_FREE_NOFLAGS);
+ return -3;
+ }
+
+ /*
+ * OK - we've now got (or created) the data structure for
+ * this systemstats, including any "static" information.
+ * Now parse the rest of the line (i.e. starting from 'stats')
+ * to extract the relevant statistics, and populate
+ * data structure accordingly.
+ */
+
+ memset(scan_vals, 0x0, sizeof(scan_vals));
+ scan_count = sscanf(stats,
+ "%llu %llu %llu %llu %llu %llu %llu %llu %llu %llu"
+ "%llu %llu %llu %llu %llu %llu %llu %llu %llu",
+ &scan_vals[0],&scan_vals[1],&scan_vals[2],
+ &scan_vals[3],&scan_vals[4],&scan_vals[5],
+ &scan_vals[6],&scan_vals[7],&scan_vals[8],
+ &scan_vals[9],&scan_vals[10],&scan_vals[11],
+ &scan_vals[12],&scan_vals[13],&scan_vals[14],
+ &scan_vals[15],&scan_vals[16],&scan_vals[17],
+ &scan_vals[18]);
+ DEBUGMSGTL(("access:systemstats", " read %d values\n", scan_count));
+
+ if(scan_count != 19) {
+ snmp_log(LOG_ERR,
+ "error scanning systemstats data (expected %d, got %d)\n",
+ 19, scan_count);
+ netsnmp_access_systemstats_entry_free(entry);
+ return -4;
+ }
+ /* entry->stats. = scan_vals[0]; / * Forwarding */
+ /* entry->stats. = scan_vals[1]; / * DefaultTTL */
+ entry->stats.HCInReceives.low = scan_vals[2] & 0xffffffff;
+ entry->stats.HCInReceives.high = scan_vals[2] >> 32;
+ entry->stats.InHdrErrors = scan_vals[3];
+ entry->stats.InAddrErrors = scan_vals[4];
+ entry->stats.HCInForwDatagrams.low = scan_vals[5] & 0xffffffff;
+ entry->stats.HCInForwDatagrams.high = scan_vals[5] >> 32;
+ entry->stats.InUnknownProtos = scan_vals[6];
+ entry->stats.InDiscards = scan_vals[7];
+ entry->stats.HCInDelivers.low = scan_vals[8] & 0xffffffff;
+ entry->stats.HCInDelivers.high = scan_vals[8] >> 32;
+ entry->stats.HCOutRequests.low = scan_vals[9] & 0xffffffff;
+ entry->stats.HCOutRequests.high = scan_vals[9] >> 32;
+ entry->stats.OutDiscards = scan_vals[10];
+ entry->stats.OutNoRoutes = scan_vals[11];
+ /* entry->stats. = scan_vals[12]; / * ReasmTimeout */
+ entry->stats.ReasmReqds = scan_vals[13];
+ entry->stats.ReasmOKs = scan_vals[14];
+ entry->stats.ReasmFails = scan_vals[15];
+ entry->stats.OutFragOKs = scan_vals[16];
+ entry->stats.OutFragFails = scan_vals[17];
+ entry->stats.OutFragCreates = scan_vals[18];
+
+ /*
+ * add to container
+ */
+ CONTAINER_INSERT(container, entry);
+ }
+ return 0;
+}
+
+#if defined (NETSNMP_ENABLE_IPV6)
+static int
+_systemstats_v6(netsnmp_container* container, u_int load_flags)
+{
+ FILE *devin;
+ char line[1024];
+ netsnmp_systemstats_entry *entry = NULL;
+ int scan_count = 0;
+ char *stats, *start = line;
+ int len, rc;
+ uintmax_t scan_val;
+ const char *filename = "/proc/net/snmp6";
+ static int warned_open = 0;
+
+ DEBUGMSGTL(("access:systemstats:container:arch", "load v6 (flags %p)\n",
+ load_flags));
+
+ netsnmp_assert(container != NULL); /* load function shoulda checked this */
+
+ entry = netsnmp_access_systemstats_entry_create(2);
+ if(NULL == entry)
+ return -3;
+
+ /*
+ * try to open file. If we can't, that's ok - maybe the module hasn't
+ * been loaded yet.
+ */
+ if (!(devin = fopen(filename, "r"))) {
+ DEBUGMSGTL(("access:systemstats",
+ "Failed to load Systemstats Table (linux1)\n"));
+ if(!warned_open) {
+ ++warned_open;
+ snmp_log(LOG_ERR, "cannot open %s ...\n", filename);
+ }
+ free(entry);
+ return 0;
+ }
+
+ /*
+ * This file provides the statistics for each systemstats.
+ * Read in each line in turn, isolate the systemstats name
+ * and retrieve (or create) the corresponding data structure.
+ */
+ while (1) {
+ start = fgets(line, sizeof(line), devin);
+ if (NULL == start)
+ break;
+
+ len = strlen(line);
+ if (line[len - 1] == '\n')
+ line[len - 1] = '\0';
+
+ if (('I' != line[0]) || ('6' != line[2]))
+ continue;
+
+ stats = strrchr(line, ' ');
+ if (NULL == stats) {
+ snmp_log(LOG_ERR,
+ "systemstats data format error 1, line ==|%s|\n", line);
+ continue;
+ }
+
+ DEBUGMSGTL(("access:systemstats", "processing '%s'\n", line));
+
+ /*
+ * OK - we've now got (or created) the data structure for
+ * this systemstats, including any "static" information.
+ * Now parse the rest of the line (i.e. starting from 'stats')
+ * to extract the relevant statistics, and populate
+ * data structure accordingly.
+ */
+ scan_val = atoll(stats);
+ if (0 == scan_val)
+ continue;
+
+ rc = 0;
+ if ('I' == line[3]) { /* In */
+ if ('A' == line[5]) {
+ entry->stats.InAddrErrors = scan_val;
+ } else if ('D' == line[5]) {
+ if ('e' == line[6]) {
+ entry->stats.HCInDelivers.low = scan_val & 0xffffffff;
+ entry->stats.HCInDelivers.high = scan_val >> 32;
+ } else if ('i' == line[6])
+ entry->stats.InDiscards = scan_val;
+ else
+ rc = 1;
+ } else if ('H' == line[5]) {
+ entry->stats.InHdrErrors = scan_val;
+ } else if ('M' == line[5]) {
+ entry->stats.HCInMcastPkts.low = scan_val & 0xffffffff;
+ entry->stats.HCInMcastPkts.high = scan_val >> 32;
+ } else if ('N' == line[5]) {
+ entry->stats.InNoRoutes = scan_val;
+ } else if ('R' == line[5]) {
+ entry->stats.HCInReceives.low = scan_val & 0xffffffff;
+ entry->stats.HCInReceives.high = scan_val >> 32;
+ } else if ('T' == line[5]) {
+ if ('r' == line[6]) {
+ entry->stats.InTruncatedPkts = scan_val & 0xffffffff;
+ } else if ('o' == line[6])
+ ; /* TooBig isn't in the MIB, so ignore it */
+ else
+ rc = 1;
+ } else if ('U' == line[5]) {
+ entry->stats.InUnknownProtos = scan_val;
+ } else
+ rc = 1;
+ } else if ('O' == line[3]) { /* Out */
+ if ('D' == line[6]) {
+ entry->stats.OutDiscards = scan_val;
+ } else if ('F' == line[6]) {
+ entry->stats.HCOutForwDatagrams.low = scan_val & 0xffffffff;
+ entry->stats.HCOutForwDatagrams.high = scan_val >> 32;
+ } else if ('M' == line[6]) {
+ entry->stats.HCOutMcastPkts.low = scan_val & 0xffffffff;
+ entry->stats.HCOutMcastPkts.high = scan_val >> 32;
+ } else if ('N' == line[6]) {
+ entry->stats.OutNoRoutes = scan_val;
+ } else if ('R' == line[6]) {
+ entry->stats.HCOutRequests.low = scan_val & 0xffffffff;
+ entry->stats.HCOutRequests.high = scan_val >> 32;
+ } else
+ rc = 1;
+ } else if ('R' == line[3]) { /* Reasm */
+ if ('F' == line[8]) {
+ entry->stats.ReasmFails = scan_val;
+ } else if ('O' == line[8]) {
+ entry->stats.ReasmOKs = scan_val;
+ } else if ('R' == line[8]) {
+ entry->stats.ReasmReqds = scan_val;
+ } else if ('T' == line[8]) {
+ ; /* no mib entry for reasm timeout */
+ } else
+ rc = 1;
+ } else if ('F' == line[3]) { /* Frag */
+ if ('C' == line[7])
+ entry->stats.OutFragCreates = scan_val;
+ else if ('O' == line[7])
+ entry->stats.OutFragOKs = scan_val;
+ else if ('F' == line[7])
+ entry->stats.OutFragFails = scan_val;
+ else
+ rc = 1;
+ } else
+ rc = 1;
+
+ if (rc)
+ DEBUGMSGTL(("access:systemstats", "unknown stat %s\n", line));
+ else
+ ++scan_count;
+ }
+
+ fclose(devin);
+
+ /*
+ * add to container
+ */
+ CONTAINER_INSERT(container, entry);
+
+ return rc;
+}
+#endif /* NETSNMP_ENABLE_IPV6 */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable.h
new file mode 100644
index 0000000000..c2faab8468
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable.h
@@ -0,0 +1,8 @@
+/*
+ * module to include the modules
+ */
+
+config_require(ip-mib/data_access/arp)
+config_require(ip-mib/inetNetToMediaTable/inetNetToMediaTable)
+config_require(ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface)
+config_require(ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable.c
new file mode 100644
index 0000000000..640c2e219a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable.c
@@ -0,0 +1,1818 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: inetNetToMediaTable.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** \page MFD helper for inetNetToMediaTable
+ *
+ * \section intro Introduction
+ * Introductory text.
+ *
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "inetNetToMediaTable.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "inetNetToMediaTable_interface.h"
+
+oid inetNetToMediaTable_oid[] = { INETNETTOMEDIATABLE_OID };
+int inetNetToMediaTable_oid_size =
+OID_LENGTH(inetNetToMediaTable_oid);
+
+inetNetToMediaTable_registration inetNetToMediaTable_user_context;
+
+void initialize_table_inetNetToMediaTable(void);
+void shutdown_table_inetNetToMediaTable(void);
+
+
+/**
+ * Initializes the inetNetToMediaTable module
+ */
+void
+init_inetNetToMediaTable(void)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:init_inetNetToMediaTable",
+ "called\n"));
+
+ /*
+ * TODO:300:o: Perform inetNetToMediaTable one-time module initialization.
+ */
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ if (should_init("inetNetToMediaTable"))
+ initialize_table_inetNetToMediaTable();
+
+} /* init_inetNetToMediaTable */
+
+/**
+ * Shut-down the inetNetToMediaTable module (agent is exiting)
+ */
+void
+shutdown_inetNetToMediaTable(void)
+{
+ if (should_init("inetNetToMediaTable"))
+ shutdown_table_inetNetToMediaTable();
+
+}
+
+/**
+ * Initialize the table inetNetToMediaTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_inetNetToMediaTable(void)
+{
+ inetNetToMediaTable_registration *user_context;
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:initialize_table_inetNetToMediaTable", "called\n"));
+
+ /*
+ * TODO:301:o: Perform inetNetToMediaTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize inetNetToMediaTable user context
+ * if you'd like to pass in a pointer to some data for this
+ * table, allocate or set it up here.
+ */
+ /*
+ * a netsnmp_data_list is a simple way to store void pointers. A simple
+ * string token is used to add, find or remove pointers.
+ */
+ user_context =
+ netsnmp_create_data_list("inetNetToMediaTable", NULL, NULL);
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _inetNetToMediaTable_initialize_interface(user_context, flags);
+} /* initialize_table_inetNetToMediaTable */
+
+/**
+ * Shutdown the table inetNetToMediaTable
+ */
+void
+shutdown_table_inetNetToMediaTable(void)
+{
+ /*
+ * call interface shutdown code
+ */
+ _inetNetToMediaTable_shutdown_interface
+ (&inetNetToMediaTable_user_context);
+}
+
+/**
+ * extra context initialization (eg default values)
+ *
+ * @param rowreq_ctx : row request context
+ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
+ *
+ * @retval MFD_SUCCESS : no errors
+ * @retval MFD_ERROR : error (context allocate will fail)
+ */
+int
+inetNetToMediaTable_rowreq_ctx_init(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx, void *user_init_ctx)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_rowreq_ctx_init", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:210:o: |-> Perform extra inetNetToMediaTable rowreq initialization. (eg DEFVALS)
+ */
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaTable_rowreq_ctx_init */
+
+/**
+ * extra context cleanup
+ *
+ */
+void
+inetNetToMediaTable_rowreq_ctx_cleanup(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_rowreq_ctx_cleanup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:211:o: |-> Perform extra inetNetToMediaTable rowreq cleanup.
+ */
+} /* inetNetToMediaTable_rowreq_ctx_cleanup */
+
+/**
+ * pre-request callback
+ *
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+inetNetToMediaTable_pre_request(inetNetToMediaTable_registration *
+ user_context)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_pre_request", "called\n"));
+
+ /*
+ * TODO:510:o: Perform inetNetToMediaTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ * Note:
+ * New rows have been inserted into the container, and
+ * deleted rows have been removed from the container and
+ * released.
+ *
+ * @param user_context
+ * @param rc : MFD_SUCCESS if all requests succeeded
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+inetNetToMediaTable_post_request(inetNetToMediaTable_registration *
+ user_context, int rc)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_post_request", "called\n"));
+
+ /*
+ * TODO:511:o: Perform inetNetToMediaTable post-request actions.
+ */
+
+ /*
+ * check to set if any rows were changed.
+ */
+ if (inetNetToMediaTable_dirty_get()) {
+ /*
+ * check if request was successful. If so, this would be
+ * a good place to save data to its persistent store.
+ */
+ if (MFD_SUCCESS == rc) {
+ /*
+ * save changed rows, if you haven't already
+ */
+ }
+
+ inetNetToMediaTable_dirty_set(0); /* clear table dirty flag */
+ }
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaTable_post_request */
+
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table inetNetToMediaTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::inetNetToMediaTable is subid 35 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.35, length: 8
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement inetNetToMediaTable data context functions.
+ */
+/*
+ * inetNetToMediaTable_allocate_data
+ *
+ * Purpose: create new inetNetToMediaTable_data.
+ */
+inetNetToMediaTable_data *
+inetNetToMediaTable_allocate_data(void)
+{
+ /*
+ * TODO:201:r: |-> allocate memory for the inetNetToMediaTable data context.
+ */
+ /** this might not be right for netsnmp_inetmedia_entry */
+ inetNetToMediaTable_data *rtn = netsnmp_access_arp_entry_create();
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_allocate_data", "called\n"));
+
+ if (NULL == rtn) {
+ snmp_log(LOG_ERR, "unable to malloc memory for new "
+ "inetNetToMediaTable_data.\n");
+ }
+
+ return rtn;
+} /* inetNetToMediaTable_allocate_data */
+
+/*
+ * inetNetToMediaTable_release_data
+ *
+ * Purpose: release inetNetToMediaTable data.
+ */
+void
+inetNetToMediaTable_release_data(inetNetToMediaTable_data * data)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_release_data", "called\n"));
+
+ /*
+ * TODO:202:r: |-> release memory for the inetNetToMediaTable data context.
+ */
+ netsnmp_access_arp_entry_free(data);
+} /* inetNetToMediaTable_release_data */
+
+
+
+/**
+ * set mib index(es)
+ *
+ * @param tbl_idx mib index structure
+ * @param inetNetToMediaIfIndex_val
+ * @param inetNetToMediaNetAddressType_val
+ * @param inetNetToMediaNetAddress_val_ptr
+ * @param inetNetToMediaNetAddress_val_ptr_len
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This convenience function is useful for setting all the MIB index
+ * components with a single function call. It is assume that the C values
+ * have already been mapped from their native/rawformat to the MIB format.
+ */
+int
+inetNetToMediaTable_indexes_set_tbl_idx(inetNetToMediaTable_mib_index *
+ tbl_idx,
+ long inetNetToMediaIfIndex_val,
+ u_long
+ inetNetToMediaNetAddressType_val,
+ char
+ *inetNetToMediaNetAddress_val_ptr,
+ size_t
+ inetNetToMediaNetAddress_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_indexes_set_tbl_idx", "called\n"));
+
+ /*
+ * inetNetToMediaIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ /** WARNING: this code might not work for netsnmp_arp_entry */
+ tbl_idx->inetNetToMediaIfIndex = inetNetToMediaIfIndex_val;
+
+ /*
+ * inetNetToMediaNetAddressType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ /** WARNING: this code might not work for netsnmp_arp_entry */
+ tbl_idx->inetNetToMediaNetAddressType =
+ inetNetToMediaNetAddressType_val;
+
+ /*
+ * inetNetToMediaNetAddress(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ tbl_idx->inetNetToMediaNetAddress_len = sizeof(tbl_idx->inetNetToMediaNetAddress) / sizeof(tbl_idx->inetNetToMediaNetAddress[0]); /* max length */
+ /** WARNING: this code might not work for netsnmp_arp_entry */
+ /*
+ * make sure there is enough space for inetNetToMediaNetAddress data
+ */
+ if (tbl_idx->inetNetToMediaNetAddress_len <
+ inetNetToMediaNetAddress_val_ptr_len) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->inetNetToMediaNetAddress_len =
+ inetNetToMediaNetAddress_val_ptr_len;
+ memcpy(tbl_idx->inetNetToMediaNetAddress,
+ inetNetToMediaNetAddress_val_ptr,
+ inetNetToMediaNetAddress_val_ptr_len *
+ sizeof(inetNetToMediaNetAddress_val_ptr[0]));
+
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaTable_indexes_set_tbl_idx */
+
+/**
+ * @internal
+ * set row context indexes
+ *
+ * @param reqreq_ctx the row context that needs updated indexes
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This function sets the mib indexs, then updates the oid indexs
+ * from the mib index.
+ */
+int
+inetNetToMediaTable_indexes_set(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx, long inetNetToMediaIfIndex_val,
+ u_long inetNetToMediaNetAddressType_val,
+ char *inetNetToMediaNetAddress_val_ptr,
+ size_t
+ inetNetToMediaNetAddress_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_indexes_set", "called\n"));
+
+ if (MFD_SUCCESS !=
+ inetNetToMediaTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
+ inetNetToMediaIfIndex_val,
+ inetNetToMediaNetAddressType_val,
+ inetNetToMediaNetAddress_val_ptr,
+ inetNetToMediaNetAddress_val_ptr_len))
+ return MFD_ERROR;
+
+ /*
+ * convert mib index to oid index
+ */
+ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
+ if (0 != inetNetToMediaTable_index_to_oid(&rowreq_ctx->oid_idx,
+ &rowreq_ctx->tbl_idx)) {
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaTable_indexes_set */
+
+
+/*---------------------------------------------------------------------
+ * IP-MIB::inetNetToMediaEntry.inetNetToMediaPhysAddress
+ * inetNetToMediaPhysAddress is subid 4 of inetNetToMediaEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.35.1.4
+ * Description:
+The media-dependent `physical' address.
+
+
+ As the entries in this table are typically not persistent
+ when this object is written the entity SHOULD NOT save the
+ change to non-volatile storage.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 1
+ * settable 1
+ * hint: 1x:
+ *
+ * Ranges: 0 - 65535;
+ *
+ * Its syntax is PhysAddress (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 65535)
+ */
+/**
+ * Extract the current value of the inetNetToMediaPhysAddress data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetNetToMediaPhysAddress_val_ptr_ptr
+ * Pointer to storage for a char variable
+ * @param inetNetToMediaPhysAddress_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by inetNetToMediaPhysAddress.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*inetNetToMediaPhysAddress_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update inetNetToMediaPhysAddress_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+inetNetToMediaPhysAddress_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx,
+ char **inetNetToMediaPhysAddress_val_ptr_ptr,
+ size_t
+ * inetNetToMediaPhysAddress_val_ptr_len_ptr)
+{
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert((NULL != inetNetToMediaPhysAddress_val_ptr_ptr)
+ && (NULL != *inetNetToMediaPhysAddress_val_ptr_ptr));
+ netsnmp_assert(NULL != inetNetToMediaPhysAddress_val_ptr_len_ptr);
+
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaPhysAddress_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the inetNetToMediaPhysAddress data.
+ * copy (* inetNetToMediaPhysAddress_val_ptr_ptr ) data and (* inetNetToMediaPhysAddress_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ if ((*inetNetToMediaPhysAddress_val_ptr_len_ptr) <
+ rowreq_ctx->data->arp_physaddress_len)
+ return MFD_SKIP;
+
+ memcpy((*inetNetToMediaPhysAddress_val_ptr_ptr),
+ rowreq_ctx->data->arp_physaddress,
+ rowreq_ctx->data->arp_physaddress_len);
+ (*inetNetToMediaPhysAddress_val_ptr_len_ptr) =
+ rowreq_ctx->data->arp_physaddress_len;
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaPhysAddress_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::inetNetToMediaEntry.inetNetToMediaLastUpdated
+ * inetNetToMediaLastUpdated is subid 5 of inetNetToMediaEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.35.1.5
+ * Description:
+The value of sysUpTime at the time this entry was last
+ updated. If this entry was updated prior to the last re-
+ initialization of the local network management subsystem,
+ then this object contains a zero value.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is TimeStamp (based on perltype TICKS)
+ * The net-snmp type is ASN_TIMETICKS. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the inetNetToMediaLastUpdated data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetNetToMediaLastUpdated_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+inetNetToMediaLastUpdated_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx,
+ u_long * inetNetToMediaLastUpdated_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != inetNetToMediaLastUpdated_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaLastUpdated_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the inetNetToMediaLastUpdated data.
+ * copy (* inetNetToMediaLastUpdated_val_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * xxx-rks: get this value?
+ */
+ return MFD_SKIP;
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaLastUpdated_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::inetNetToMediaEntry.inetNetToMediaType
+ * inetNetToMediaType is subid 6 of inetNetToMediaEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.35.1.6
+ * Description:
+The type of mapping.
+
+
+ Setting this object to the value invalid(2) has the effect
+ of invalidating the corresponding entry in the
+ inetNetToMediaTable. That is, it effectively dis-
+ associates the interface identified with said entry from the
+ mapping identified with said entry. It is an
+ implementation- specific matter as to whether the agent
+ removes an invalidated entry from the table. Accordingly,
+ management stations must be prepared to receive tabular
+ information from agents that corresponds to entries not
+ currently in use. Proper interpretation of such entries
+ requires examination of the relevant inetNetToMediaType
+ object.
+
+
+ The 'dynamic(3)' type indicates that the IP address to
+ physical addresses mapping has been dynamically resolved
+ using e.g. IPv4 ARP or the IPv6 Neighbor Discovery protocol.
+
+
+ The 'static(4)' type indicates that the mapping has been
+ statically configured. Both of these refer to entries that
+ provide mappings for other entities addresses.
+
+
+ The 'local(5)' type indicates that the mapping is provided
+ for an entity's own interface address.
+
+
+ As the entries in this table are typically not persistent
+ when this object is written the entity SHOULD NOT save the
+
+
+
+
+ change to non-volatile storage.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: static
+ *
+ * Enum range: 5/8. Values: other(1), invalid(2), dynamic(3), static(4), local(5)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the inetNetToMediaType data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetNetToMediaType_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+inetNetToMediaType_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx,
+ u_long * inetNetToMediaType_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != inetNetToMediaType_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the inetNetToMediaType data.
+ * copy (* inetNetToMediaType_val_ptr ) from rowreq_ctx->data
+ */
+ (*inetNetToMediaType_val_ptr) = rowreq_ctx->data->arp_type;
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaType_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::inetNetToMediaEntry.inetNetToMediaState
+ * inetNetToMediaState is subid 7 of inetNetToMediaEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.35.1.7
+ * Description:
+The Neighbor Unreachability Detection [4] state for the
+ interface when the address mapping in this entry is used.
+ If Neighbor Unreachability Detection is not in use (e.g. for
+ IPv4), this object is always unknown(6).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ * Enum range: 6/8. Values: reachable(1), stale(2), delay(3), probe(4), invalid(5), unknown(6), incomplete(7)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the inetNetToMediaState data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetNetToMediaState_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+inetNetToMediaState_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx,
+ u_long * inetNetToMediaState_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != inetNetToMediaState_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaState_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the inetNetToMediaState data.
+ * copy (* inetNetToMediaState_val_ptr ) from rowreq_ctx->data
+ */
+ (*inetNetToMediaState_val_ptr) = rowreq_ctx->data->arp_state;
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaState_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::inetNetToMediaEntry.inetNetToMediaRowStatus
+ * inetNetToMediaRowStatus is subid 8 of inetNetToMediaEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.35.1.8
+ * Description:
+The status of this conceptual row.
+
+
+ The RowStatus TC requires that this DESCRIPTION clause
+ states under which circumstances other objects in this row
+ can be modified. The value of this object has no effect on
+ whether other objects in this conceptual row can be
+ modified.
+
+
+ A conceptual row can not be made active until the
+ inetNetToMediaPhysAddress object has been set.
+
+
+
+
+ Note that if the inetNetToMediaType is set to 'invalid' the
+ managed node may delete the entry independent of the state
+ of this object.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
+ *
+ * Its syntax is RowStatus (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the inetNetToMediaRowStatus data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetNetToMediaRowStatus_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+inetNetToMediaRowStatus_get(inetNetToMediaTable_rowreq_ctx * rowreq_ctx,
+ u_long * inetNetToMediaRowStatus_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != inetNetToMediaRowStatus_val_ptr);
+
+ (*inetNetToMediaRowStatus_val_ptr) =
+ rowreq_ctx->inetNetToMediaRowStatus;
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaRowStatus_get */
+
+
+
+/** @} */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table inetNetToMediaTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::inetNetToMediaTable is subid 35 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.35, length: 8
+ */
+ /*
+ * NOTE: if you update this chart, please update the versions in
+ * local/mib2c-conf.d/parent-set.m2i
+ * agent/mibgroup/helpers/baby_steps.c
+ * while you're at it.
+ */
+ /*
+ ***********************************************************************
+ * Baby Steps Flow Chart (2004.06.05) *
+ * *
+ * +--------------+ +================+ U = unconditional path *
+ * |optional state| ||required state|| S = path for success *
+ * +--------------+ +================+ E = path for error *
+ ***********************************************************************
+ *
+ * +--------------+
+ * | pre |
+ * | request |
+ * +--------------+
+ * | U
+ * +-------------+ +==============+
+ * | row |f|<-------|| object ||
+ * | create |1| E || lookup ||
+ * +-------------+ +==============+
+ * E | | S | S
+ * | +------------------>|
+ * | +==============+
+ * | E || check ||
+ * |<---------------|| values ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | +<-------|| undo ||
+ * | | E || setup ||
+ * | | +==============+
+ * | | | S
+ * | | +==============+
+ * | | || set ||-------------------------->+
+ * | | || value || E |
+ * | | +==============+ |
+ * | | | S |
+ * | | +--------------+ |
+ * | | | check |-------------------------->|
+ * | | | consistency | E |
+ * | | +--------------+ |
+ * | | | S |
+ * | | +==============+ +==============+ |
+ * | | || commit ||-------->|| undo || |
+ * | | || || E || commit || |
+ * | | +==============+ +==============+ |
+ * | | | S U |<--------+
+ * | | +--------------+ +==============+
+ * | | | irreversible | || undo ||
+ * | | | commit | || set ||
+ * | | +--------------+ +==============+
+ * | | | U U |
+ * | +-------------->|<------------------------+
+ * | +==============+
+ * | || undo ||
+ * | || cleanup ||
+ * | +==============+
+ * +---------------------->| U
+ * |
+ * (err && f1)------------------->+
+ * | |
+ * +--------------+ +--------------+
+ * | post |<--------| row |
+ * | request | U | release |
+ * +--------------+ +--------------+
+ *
+ */
+
+/**
+ * Setup up context with information needed to undo a set request.
+ *
+ * This function will be called before the individual node undo setup
+ * functions are called. If you need to do any undo setup that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that the undo context has been allocated with
+ * inetNetToMediaTable_allocate_data(), but may need extra
+ * initialization similar to what you may have done in
+ * inetNetToMediaTable_rowreq_ctx_init().
+ * Note that an individual node's undo_setup function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in the node's undo_setup
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (inetNetToMediaTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+inetNetToMediaTable_undo_setup(inetNetToMediaTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_undo_setup", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> Setup inetNetToMediaTable undo.
+ * set up inetNetToMediaTable undo information, in preparation for a set.
+ * Undo storage is in (* inetNetToMediaRowStatus_val_ptr )*
+ */
+
+ return rc;
+} /* inetNetToMediaTable_undo_setup */
+
+/**
+ * Undo a set request.
+ *
+ * This function will be called before the individual node undo
+ * functions are called. If you need to do any undo that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that an individual node's undo function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is anything specific to a particular column (e.g. releasing
+ * memory for a string), you should do that setup in the node's undo
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (inetNetToMediaTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+inetNetToMediaTable_undo(inetNetToMediaTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_undo",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> inetNetToMediaTable undo.
+ * inetNetToMediaTable undo information, in response to a failed set.
+ * Undo storage is in (* inetNetToMediaRowStatus_val_ptr )*
+ */
+
+ return rc;
+} /* inetNetToMediaTable_undo_setup */
+
+/**
+ * Cleanup up context undo information.
+ *
+ * This function will be called after set/commit processing. If you
+ * allocated any resources in undo_setup, this is the place to release
+ * those resources.
+ *
+ * This function is called regardless of the success or failure of the set
+ * request. If you need to perform different steps for cleanup depending
+ * on success or failure, you can add a flag to the rowreq_ctx.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (inetNetToMediaTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+inetNetToMediaTable_undo_cleanup(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_undo_cleanup", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:452:M: |-> Cleanup inetNetToMediaTable undo.
+ * Undo storage is in (* inetNetToMediaRowStatus_val_ptr )*
+ */
+
+ return rc;
+} /* inetNetToMediaTable_undo_cleanup */
+
+/**
+ * commit new values.
+ *
+ * At this point, you should have done everything you can to ensure that
+ * this commit will not fail.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * inetNetToMediaTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+inetNetToMediaTable_commit(inetNetToMediaTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+ int save_flags;
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_commit",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * save flags, then clear until we actually do something
+ */
+ save_flags = rowreq_ctx->column_set_flags;
+ rowreq_ctx->column_set_flags = 0;
+
+ /*
+ * commit inetNetToMediaTable data
+ * 1) check the column's flag in save_flags to see if it was set.
+ * 2) clear the flag when you handle that column
+ * 3) set the column's flag in column_set_flags if it needs undo
+ * processing in case of a failure.
+ */
+#if 1
+ /** xxx-rks:9 nettomedia commit */
+#else
+ if (save_flags & COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG) {
+ save_flags &= ~COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG; /* clear inetNetToMediaPhysAddress */
+ /*
+ * TODO:482:o: |-> commit column inetNetToMediaPhysAddress.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "inetNetToMediaTable column inetNetToMediaPhysAddress commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo inetNetToMediaPhysAddress
+ */
+ rowreq_ctx->column_set_flags |=
+ COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG;
+ }
+ }
+
+ if (save_flags & COLUMN_INETNETTOMEDIATYPE_FLAG) {
+ save_flags &= ~COLUMN_INETNETTOMEDIATYPE_FLAG; /* clear inetNetToMediaType */
+ /*
+ * TODO:482:o: |-> commit column inetNetToMediaType.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "inetNetToMediaTable column inetNetToMediaType commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo inetNetToMediaType
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_INETNETTOMEDIATYPE_FLAG;
+ }
+ }
+
+ if (save_flags & COLUMN_INETNETTOMEDIAROWSTATUS_FLAG) {
+ save_flags &= ~COLUMN_INETNETTOMEDIAROWSTATUS_FLAG; /* clear inetNetToMediaRowStatus */
+ /*
+ * TODO:482:o: |-> commit column inetNetToMediaRowStatus.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "inetNetToMediaTable column inetNetToMediaRowStatus commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo inetNetToMediaRowStatus
+ */
+ rowreq_ctx->column_set_flags |=
+ COLUMN_INETNETTOMEDIAROWSTATUS_FLAG;
+ }
+ }
+
+ /*
+ * if we successfully commited this row, set the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY;
+ }
+#endif
+
+ if (save_flags) {
+ snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n",
+ save_flags);
+ return MFD_ERROR;
+ }
+
+ return rc;
+} /* inetNetToMediaTable_commit */
+
+/**
+ * undo commit new values.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * inetNetToMediaTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+inetNetToMediaTable_undo_commit(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_undo_commit", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:485:M: |-> Undo inetNetToMediaTable commit.
+ * check the column's flag in rowreq_ctx->column_set_flags to see
+ * if it was set during commit, then undo it.
+ *
+ * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
+ */
+
+
+ /*
+ * if we successfully un-commited this row, clear the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return rc;
+} /* inetNetToMediaTable_undo_commit */
+
+/*
+ * TODO:440:M: Implement inetNetToMediaTable node value checks.
+ * TODO:450:M: Implement inetNetToMediaTable undo functions.
+ * TODO:460:M: Implement inetNetToMediaTable set functions.
+ * TODO:480:M: Implement inetNetToMediaTable commit functions.
+ */
+/*---------------------------------------------------------------------
+ * IP-MIB::inetNetToMediaEntry.inetNetToMediaPhysAddress
+ * inetNetToMediaPhysAddress is subid 4 of inetNetToMediaEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.35.1.4
+ * Description:
+The media-dependent `physical' address.
+
+
+ As the entries in this table are typically not persistent
+ when this object is written the entity SHOULD NOT save the
+ change to non-volatile storage.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 1
+ * settable 1
+ * hint: 1x:
+ *
+ * Ranges: 0 - 65535;
+ *
+ * Its syntax is PhysAddress (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 65535)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetNetToMediaPhysAddress_val_ptr
+ * A char containing the new value.
+ * @param inetNetToMediaPhysAddress_val_ptr_len
+ * The size (in bytes) of the data pointed to by inetNetToMediaPhysAddress_val_ptr
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * Since you aren't using a generated data context, you also need to
+ * check the length, to make sure you don't overflow your storage space.
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * inetNetToMediaTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_OCTET_STR
+ * The length is in (one of) the range set(s): 0 - 65535
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+inetNetToMediaPhysAddress_check_value(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx, char
+ *inetNetToMediaPhysAddress_val_ptr,
+ size_t
+ inetNetToMediaPhysAddress_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaPhysAddress_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert(NULL != inetNetToMediaPhysAddress_val_ptr);
+
+ /*
+ * TODO:441:o: |-> Check for valid inetNetToMediaPhysAddress value.
+ */
+
+ return MFD_SUCCESS; /* inetNetToMediaPhysAddress value not illegal */
+} /* inetNetToMediaPhysAddress_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (inetNetToMediaTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * inetNetToMediaTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+inetNetToMediaPhysAddress_undo_setup(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaPhysAddress_undo_setup", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup inetNetToMediaPhysAddress undo.
+ */
+ /*
+ * copy inetNetToMediaPhysAddress and inetNetToMediaPhysAddress_len data
+ * set rowreq_ctx->undo->inetNetToMediaPhysAddress from rowreq_ctx->data->inetNetToMediaPhysAddress
+ */
+
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaPhysAddress_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param inetNetToMediaPhysAddress_val_ptr
+ * A char containing the new value.
+ * @param inetNetToMediaPhysAddress_val_ptr_len
+ * The size (in bytes) of the data pointed to by inetNetToMediaPhysAddress_val_ptr
+ */
+int
+inetNetToMediaPhysAddress_set(inetNetToMediaTable_rowreq_ctx * rowreq_ctx,
+ char *inetNetToMediaPhysAddress_val_ptr,
+ size_t inetNetToMediaPhysAddress_val_ptr_len)
+{
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaPhysAddress_set", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert(NULL != inetNetToMediaPhysAddress_val_ptr);
+
+ /*
+ * TODO:461:M: |-> Set inetNetToMediaPhysAddress value.
+ * set inetNetToMediaPhysAddress value in rowreq_ctx->data
+ */
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaPhysAddress_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+inetNetToMediaPhysAddress_undo(inetNetToMediaTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaPhysAddress_undo", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up inetNetToMediaPhysAddress undo.
+ */
+ /*
+ * copy inetNetToMediaPhysAddress and inetNetToMediaPhysAddress_len data
+ * set rowreq_ctx->data->inetNetToMediaPhysAddress from rowreq_ctx->undo->inetNetToMediaPhysAddress
+ */
+
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaPhysAddress_undo */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::inetNetToMediaEntry.inetNetToMediaType
+ * inetNetToMediaType is subid 6 of inetNetToMediaEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.35.1.6
+ * Description:
+The type of mapping.
+
+
+ Setting this object to the value invalid(2) has the effect
+ of invalidating the corresponding entry in the
+ inetNetToMediaTable. That is, it effectively dis-
+ associates the interface identified with said entry from the
+ mapping identified with said entry. It is an
+ implementation- specific matter as to whether the agent
+ removes an invalidated entry from the table. Accordingly,
+ management stations must be prepared to receive tabular
+ information from agents that corresponds to entries not
+ currently in use. Proper interpretation of such entries
+ requires examination of the relevant inetNetToMediaType
+ object.
+
+
+ The 'dynamic(3)' type indicates that the IP address to
+ physical addresses mapping has been dynamically resolved
+ using e.g. IPv4 ARP or the IPv6 Neighbor Discovery protocol.
+
+
+ The 'static(4)' type indicates that the mapping has been
+ statically configured. Both of these refer to entries that
+ provide mappings for other entities addresses.
+
+
+ The 'local(5)' type indicates that the mapping is provided
+ for an entity's own interface address.
+
+
+ As the entries in this table are typically not persistent
+ when this object is written the entity SHOULD NOT save the
+
+
+
+
+ change to non-volatile storage.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: static
+ *
+ * Enum range: 5/8. Values: other(1), invalid(2), dynamic(3), static(4), local(5)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetNetToMediaType_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * inetNetToMediaTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of other(1), invalid(2), dynamic(3), static(4), local(5)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+inetNetToMediaType_check_value(inetNetToMediaTable_rowreq_ctx * rowreq_ctx,
+ u_long inetNetToMediaType_val)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid inetNetToMediaType value.
+ */
+
+ return MFD_SUCCESS; /* inetNetToMediaType value not illegal */
+} /* inetNetToMediaType_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (inetNetToMediaTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * inetNetToMediaTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+inetNetToMediaType_undo_setup(inetNetToMediaTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_undo_setup", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup inetNetToMediaType undo.
+ */
+ /*
+ * copy inetNetToMediaType data
+ * set rowreq_ctx->undo->inetNetToMediaType from rowreq_ctx->data->inetNetToMediaType
+ */
+
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaType_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param inetNetToMediaType_val
+ * A long containing the new value.
+ */
+int
+inetNetToMediaType_set(inetNetToMediaTable_rowreq_ctx * rowreq_ctx,
+ u_long inetNetToMediaType_val)
+{
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set inetNetToMediaType value.
+ * set inetNetToMediaType value in rowreq_ctx->data
+ */
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaType_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+inetNetToMediaType_undo(inetNetToMediaTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaType_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up inetNetToMediaType undo.
+ */
+ /*
+ * copy inetNetToMediaType data
+ * set rowreq_ctx->data->inetNetToMediaType from rowreq_ctx->undo->inetNetToMediaType
+ */
+
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaType_undo */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::inetNetToMediaEntry.inetNetToMediaRowStatus
+ * inetNetToMediaRowStatus is subid 8 of inetNetToMediaEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.35.1.8
+ * Description:
+The status of this conceptual row.
+
+
+ The RowStatus TC requires that this DESCRIPTION clause
+ states under which circumstances other objects in this row
+ can be modified. The value of this object has no effect on
+ whether other objects in this conceptual row can be
+ modified.
+
+
+ A conceptual row can not be made active until the
+ inetNetToMediaPhysAddress object has been set.
+
+
+
+
+ Note that if the inetNetToMediaType is set to 'invalid' the
+ managed node may delete the entry independent of the state
+ of this object.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
+ *
+ * Its syntax is RowStatus (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param inetNetToMediaRowStatus_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * inetNetToMediaTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+inetNetToMediaRowStatus_check_value(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long inetNetToMediaRowStatus_val)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaRowStatus_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid inetNetToMediaRowStatus value.
+ */
+
+ return MFD_SUCCESS; /* inetNetToMediaRowStatus value not illegal */
+} /* inetNetToMediaRowStatus_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (inetNetToMediaTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * inetNetToMediaTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+inetNetToMediaRowStatus_undo_setup(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaRowStatus_undo_setup", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup inetNetToMediaRowStatus undo.
+ */
+ /*
+ * copy inetNetToMediaRowStatus data
+ * set rowreq_ctx->undo->inetNetToMediaRowStatus from rowreq_ctx->data->inetNetToMediaRowStatus
+ */
+ rowreq_ctx->inetNetToMediaRowStatus_undo =
+ rowreq_ctx->inetNetToMediaRowStatus;
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaRowStatus_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param inetNetToMediaRowStatus_val
+ * A long containing the new value.
+ */
+int
+inetNetToMediaRowStatus_set(inetNetToMediaTable_rowreq_ctx * rowreq_ctx,
+ u_long inetNetToMediaRowStatus_val)
+{
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaRowStatus_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set inetNetToMediaRowStatus value.
+ * set inetNetToMediaRowStatus value in rowreq_ctx->data
+ */
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaRowStatus_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+inetNetToMediaRowStatus_undo(inetNetToMediaTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaRowStatus_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up inetNetToMediaRowStatus undo.
+ */
+ /*
+ * copy inetNetToMediaRowStatus data
+ * set rowreq_ctx->data->inetNetToMediaRowStatus from rowreq_ctx->undo->inetNetToMediaRowStatus
+ */
+ rowreq_ctx->inetNetToMediaRowStatus =
+ rowreq_ctx->inetNetToMediaRowStatus_undo;
+
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaRowStatus_undo */
+
+/**
+ * check dependencies
+ *
+ * This is useful for for tables which have dependencies between columns
+ * (or rows, or tables). For example, two columns allocating a percentage
+ * of something add up 100%.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * inetNetToMediaTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ *
+ * @retval MFD_SUCCESS all the changes to the row are legal
+ * @retval MFD_ERROR one or more changes are not legal
+ *
+ * (see README-table-inetNetToMediaTable if you don't have dependencies)
+ */
+int
+inetNetToMediaTable_check_dependencies(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:inetNetToMediaTable_check_dependencies", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:470:o: Check inetNetToMediaTable row dependencies.
+ * check that all new value are legal and consistent with each other
+ */
+ /*
+ * check RowStatus dependencies
+ */
+ if (rowreq_ctx->column_set_flags & COLUMN_INETNETTOMEDIAROWSTATUS_FLAG) {
+ /*
+ * check for valid RowStatus transition (old, new)
+ * (Note: move transition check to
+ * to catch errors earlier)
+ */
+ rc = check_rowstatus_transition(rowreq_ctx->
+ inetNetToMediaRowStatus_undo,
+ rowreq_ctx->
+ inetNetToMediaRowStatus);
+ if (MFD_SUCCESS != rc)
+ return rc;
+
+ /*
+ * row creation requirements
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ if (ROWSTATUS_DESTROY == rowreq_ctx->inetNetToMediaRowStatus) {
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED;
+ } else if (ROWSTATUS_CREATEANDGO ==
+ rowreq_ctx->inetNetToMediaRowStatus) {
+ if ((rowreq_ctx->
+ column_set_flags & INETNETTOMEDIATABLE_REQUIRED_COLS)
+ != INETNETTOMEDIATABLE_REQUIRED_COLS) {
+ DEBUGMSGTL(("inetNetToMediaTable",
+ "required columns missing (0x%0x != 0x%0x)\n",
+ rowreq_ctx->column_set_flags,
+ INETNETTOMEDIATABLE_REQUIRED_COLS));
+ return MFD_CANNOT_CREATE_NOW;
+ }
+ rowreq_ctx->inetNetToMediaRowStatus = ROWSTATUS_ACTIVE;
+ }
+ } /* row creation */
+ else {
+ /*
+ * row change requirements
+ */
+ /*
+ * don't allow a destroy if any other value was changed, since
+ * that might call data access routines with bad info.
+ *
+ * you may or may not require the row be notInService before it
+ * can be destroyed.
+ */
+ if (ROWSTATUS_DESTROY == rowreq_ctx->inetNetToMediaRowStatus) {
+ if (rowreq_ctx->
+ column_set_flags &
+ ~COLUMN_INETNETTOMEDIAROWSTATUS_FLAG) {
+ DEBUGMSGTL(("inetNetToMediaTable",
+ "destroy must be only varbind for row\n"));
+ return MFD_NOT_VALID_NOW;
+ }
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED;
+
+ } /* row destroy */
+ } /* row change */
+ } else {
+ /*
+ * must have row status to create a row
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ DEBUGMSGTL(("inetNetToMediaTable",
+ "must use RowStatus to create rows\n"));
+ return MFD_CANNOT_CREATE_NOW;
+ }
+ } /* row status not set */
+
+ if (MFD_SUCCESS != rc)
+ return rc;
+
+ return rc;
+} /* inetNetToMediaTable_check_dependencies */
+
+/** @} */
+/** @{ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable.h
new file mode 100644
index 0000000000..aad8ad9a83
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable.h
@@ -0,0 +1,413 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: inetNetToMediaTable.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+#ifndef INETNETTOMEDIATABLE_H
+#define INETNETTOMEDIATABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @addtogroup misc misc: Miscellaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/data_access/arp.h>
+
+ /*
+ * other required module components
+ */
+ /* *INDENT-OFF* */
+config_require(ip-mib/data_access/arp)
+config_require(ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface)
+config_require(ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access)
+ /* *INDENT-ON* */
+
+ /*
+ * OID, column number and enum definions for inetNetToMediaTable
+ */
+#include "inetNetToMediaTable_constants.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_inetNetToMediaTable(void);
+ void shutdown_inetNetToMediaTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table inetNetToMediaTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::inetNetToMediaTable is subid 35 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.35, length: 8
+ */
+ /*
+ *********************************************************************
+ * When you register your mib, you get to provide a generic
+ * pointer that will be passed back to you for most of the
+ * functions calls.
+ *
+ * TODO:100:r: Review all context structures
+ */
+ /*
+ * TODO:101:o: |-> Review inetNetToMediaTable registration context.
+ */
+ typedef netsnmp_data_list inetNetToMediaTable_registration;
+
+/**********************************************************************/
+ /*
+ * TODO:110:r: |-> Review inetNetToMediaTable data context structure.
+ * This structure is used to represent the data for inetNetToMediaTable.
+ */
+ typedef netsnmp_arp_entry inetNetToMediaTable_data;
+
+
+ /*
+ *********************************************************************
+ * TODO:115:o: |-> Review inetNetToMediaTable undo context.
+ * We're just going to use the same data structure for our
+ * undo_context. If you want to do something more efficent,
+ * define your typedef here.
+ */
+ typedef inetNetToMediaTable_data inetNetToMediaTable_undo_data;
+
+ /*
+ * TODO:120:r: |-> Review inetNetToMediaTable mib index.
+ * This structure is used to represent the index for inetNetToMediaTable.
+ */
+ typedef struct inetNetToMediaTable_mib_index_s {
+
+ /*
+ * inetNetToMediaIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ long inetNetToMediaIfIndex;
+
+ /*
+ * inetNetToMediaNetAddressType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ u_long inetNetToMediaNetAddressType;
+
+ /*
+ * inetNetToMediaNetAddress(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ /** 128 - 2(other indexes) - oid length(10) = 115 */
+ char inetNetToMediaNetAddress[115];
+ size_t inetNetToMediaNetAddress_len;
+
+
+ } inetNetToMediaTable_mib_index;
+
+ /*
+ * TODO:121:r: | |-> Review inetNetToMediaTable max index length.
+ * If you KNOW that your indexes will never exceed a certain
+ * length, update this macro to that length.
+ *
+ * BE VERY CAREFUL TO TAKE INTO ACCOUNT THE MAXIMUM
+ * POSSIBLE LENGHT FOR EVERY VARIABLE LENGTH INDEX!
+ * Guessing 128 - col/entry(2) - oid len(8)
+ */
+#define MAX_inetNetToMediaTable_IDX_LEN 118
+
+
+ /*
+ *********************************************************************
+ * TODO:130:o: |-> Review inetNetToMediaTable Row request (rowreq) context.
+ * When your functions are called, you will be passed a
+ * inetNetToMediaTable_rowreq_ctx pointer.
+ */
+ typedef struct inetNetToMediaTable_rowreq_ctx_s {
+
+ /** this must be first for container compare to work */
+ netsnmp_index oid_idx;
+ oid oid_tmp[MAX_inetNetToMediaTable_IDX_LEN];
+
+ inetNetToMediaTable_mib_index tbl_idx;
+
+ inetNetToMediaTable_data *data;
+ inetNetToMediaTable_undo_data *undo;
+ unsigned int column_set_flags; /* flags for set columns */
+
+
+ /*
+ * flags per row. Currently, the first (lower) 8 bits are reserved
+ * for the user. See mfd.h for other flags.
+ */
+ u_int rowreq_flags;
+
+ /*
+ * TODO:131:o: | |-> Add useful data to inetNetToMediaTable rowreq context.
+ */
+ int inetNetToMediaRowStatus,
+ inetNetToMediaRowStatus_undo;
+
+ /*
+ * storage for future expansion
+ */
+ netsnmp_data_list *inetNetToMediaTable_data_list;
+
+ } inetNetToMediaTable_rowreq_ctx;
+
+ typedef struct inetNetToMediaTable_ref_rowreq_ctx_s {
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx;
+ } inetNetToMediaTable_ref_rowreq_ctx;
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int
+ inetNetToMediaTable_pre_request(inetNetToMediaTable_registration *
+ user_context);
+ int
+ inetNetToMediaTable_post_request(inetNetToMediaTable_registration *
+ user_context, int rc);
+
+ int
+ inetNetToMediaTable_rowreq_ctx_init(inetNetToMediaTable_rowreq_ctx
+ * rowreq_ctx,
+ void *user_init_ctx);
+ void
+ inetNetToMediaTable_rowreq_ctx_cleanup
+ (inetNetToMediaTable_rowreq_ctx * rowreq_ctx);
+
+ inetNetToMediaTable_data *inetNetToMediaTable_allocate_data(void);
+ void
+ inetNetToMediaTable_release_data(inetNetToMediaTable_data * data);
+
+ int
+ inetNetToMediaTable_check_dependencies
+ (inetNetToMediaTable_rowreq_ctx * rowreq_ctx);
+ int
+ inetNetToMediaTable_commit(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx);
+
+ inetNetToMediaTable_rowreq_ctx
+ * inetNetToMediaTable_row_find_by_mib_index
+ (inetNetToMediaTable_mib_index * mib_idx);
+
+ extern oid inetNetToMediaTable_oid[];
+ extern int inetNetToMediaTable_oid_size;
+
+
+#include "inetNetToMediaTable_interface.h"
+#include "inetNetToMediaTable_data_access.h"
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table inetNetToMediaTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::inetNetToMediaTable is subid 35 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.35, length: 8
+ */
+ /*
+ * indexes
+ */
+
+ int
+ inetNetToMediaPhysAddress_get(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx, char
+ **inetNetToMediaPhysAddress_val_ptr_ptr,
+ size_t *
+ inetNetToMediaPhysAddress_val_ptr_len_ptr);
+ int
+ inetNetToMediaLastUpdated_get(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ inetNetToMediaLastUpdated_val_ptr);
+ int inetNetToMediaType_get(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ inetNetToMediaType_val_ptr);
+ int inetNetToMediaState_get(inetNetToMediaTable_rowreq_ctx
+ * rowreq_ctx,
+ u_long *
+ inetNetToMediaState_val_ptr);
+ int
+ inetNetToMediaRowStatus_get(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ inetNetToMediaRowStatus_val_ptr);
+
+
+ int
+ inetNetToMediaTable_indexes_set_tbl_idx
+ (inetNetToMediaTable_mib_index * tbl_idx,
+ long inetNetToMediaIfIndex_val,
+ u_long inetNetToMediaNetAddressType_val,
+ char *inetNetToMediaNetAddress_val_ptr,
+ size_t inetNetToMediaNetAddress_val_ptr_len);
+ int
+ inetNetToMediaTable_indexes_set(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx,
+ long inetNetToMediaIfIndex_val,
+ u_long
+ inetNetToMediaNetAddressType_val,
+ char
+ *inetNetToMediaNetAddress_val_ptr,
+ size_t
+ inetNetToMediaNetAddress_val_ptr_len);
+
+
+
+ /*
+ *********************************************************************
+ * SET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * SET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table inetNetToMediaTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::inetNetToMediaTable is subid 35 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.35, length: 8
+ */
+
+
+ int
+ inetNetToMediaTable_undo_setup(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+ inetNetToMediaTable_undo_cleanup(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetNetToMediaTable_undo(inetNetToMediaTable_rowreq_ctx
+ * rowreq_ctx);
+ int
+ inetNetToMediaTable_commit(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+ inetNetToMediaTable_undo_commit(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+ int
+ inetNetToMediaPhysAddress_check_value
+ (inetNetToMediaTable_rowreq_ctx * rowreq_ctx,
+ char *inetNetToMediaPhysAddress_val_ptr,
+ size_t inetNetToMediaPhysAddress_val_ptr_len);
+ int
+ inetNetToMediaPhysAddress_undo_setup(inetNetToMediaTable_rowreq_ctx
+ * rowreq_ctx);
+ int
+ inetNetToMediaPhysAddress_set(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx, char
+ *inetNetToMediaPhysAddress_val_ptr,
+ size_t
+ inetNetToMediaPhysAddress_val_ptr_len);
+ int
+ inetNetToMediaPhysAddress_undo(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ inetNetToMediaLastUpdated_check_value
+ (inetNetToMediaTable_rowreq_ctx * rowreq_ctx,
+ u_long inetNetToMediaLastUpdated_val);
+ int
+ inetNetToMediaLastUpdated_undo_setup(inetNetToMediaTable_rowreq_ctx
+ * rowreq_ctx);
+ int
+ inetNetToMediaLastUpdated_set(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ inetNetToMediaLastUpdated_val);
+ int
+ inetNetToMediaLastUpdated_undo(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ inetNetToMediaType_check_value(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long inetNetToMediaType_val);
+ int
+ inetNetToMediaType_undo_setup(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetNetToMediaType_set(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long inetNetToMediaType_val);
+ int inetNetToMediaType_undo(inetNetToMediaTable_rowreq_ctx
+ * rowreq_ctx);
+
+ int
+ inetNetToMediaState_check_value(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long inetNetToMediaState_val);
+ int
+ inetNetToMediaState_undo_setup(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetNetToMediaState_set(inetNetToMediaTable_rowreq_ctx
+ * rowreq_ctx,
+ u_long
+ inetNetToMediaState_val);
+ int inetNetToMediaState_undo(inetNetToMediaTable_rowreq_ctx
+ * rowreq_ctx);
+
+ int
+ inetNetToMediaRowStatus_check_value(inetNetToMediaTable_rowreq_ctx
+ * rowreq_ctx,
+ u_long
+ inetNetToMediaRowStatus_val);
+ int
+ inetNetToMediaRowStatus_undo_setup(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+ inetNetToMediaRowStatus_undo(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+ int
+ inetNetToMediaTable_check_dependencies
+ (inetNetToMediaTable_rowreq_ctx * ctx);
+
+
+ /*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* INETNETTOMEDIATABLE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_constants.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_constants.h
new file mode 100644
index 0000000000..819739581e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_constants.h
@@ -0,0 +1,161 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $
+ *
+ * $Id: inetNetToMediaTable_constants.h 13759 2005-12-01 00:45:50Z rstory $
+ */
+#ifndef INETNETTOMEDIATABLE_CONSTANTS_H
+#define INETNETTOMEDIATABLE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ * column number definitions for table inetNetToMediaTable
+ */
+#define INETNETTOMEDIATABLE_OID 1,3,6,1,2,1,4,35
+
+#define COLUMN_INETNETTOMEDIAIFINDEX 1
+
+#define COLUMN_INETNETTOMEDIANETADDRESSTYPE 2
+
+#define COLUMN_INETNETTOMEDIANETADDRESS 3
+
+#define COLUMN_INETNETTOMEDIAPHYSADDRESS 4
+#define COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG (0x1 << 3)
+
+#define COLUMN_INETNETTOMEDIALASTUPDATED 5
+
+#define COLUMN_INETNETTOMEDIATYPE 6
+#define COLUMN_INETNETTOMEDIATYPE_FLAG (0x1 << 5)
+
+#define COLUMN_INETNETTOMEDIASTATE 7
+
+#define COLUMN_INETNETTOMEDIAROWSTATUS 8
+#define COLUMN_INETNETTOMEDIAROWSTATUS_FLAG (0x1 << 7)
+
+
+#define INETNETTOMEDIATABLE_MIN_COL COLUMN_INETNETTOMEDIAPHYSADDRESS
+#define INETNETTOMEDIATABLE_MAX_COL COLUMN_INETNETTOMEDIAROWSTATUS
+
+
+ /*
+ * TODO:405:r: Review INETNETTOMEDIATABLE_SETTABLE_COLS macro.
+ * OR together all the writable cols.
+ */
+#define INETNETTOMEDIATABLE_SETTABLE_COLS (COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG | COLUMN_INETNETTOMEDIATYPE_FLAG | COLUMN_INETNETTOMEDIAROWSTATUS_FLAG)
+ /*
+ * TODO:405:r: Review INETNETTOMEDIATABLE_REQUIRED_COLS macro.
+ * OR together all the required rows for row creation.
+ * default is writable cols w/out defaults.
+ */
+#define INETNETTOMEDIATABLE_REQUIRED_COLS (COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG | COLUMN_INETNETTOMEDIAROWSTATUS_FLAG)
+
+ /*
+ * NOTES on enums
+ * ==============
+ *
+ * Value Mapping
+ * -------------
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them
+ * below. For example, a boolean flag (1/0) is usually represented
+ * as a TruthValue in a MIB, which maps to the values (1/2).
+ *
+ */
+/*************************************************************************
+ *************************************************************************
+ *
+ * enum definitions for table inetNetToMediaTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * inetNetToMediaNetAddressType (InetAddressType / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef INETADDRESSTYPE_ENUMS
+#define INETADDRESSTYPE_ENUMS
+
+#define INETADDRESSTYPE_UNKNOWN 0
+#define INETADDRESSTYPE_IPV4 1
+#define INETADDRESSTYPE_IPV6 2
+#define INETADDRESSTYPE_IPV4Z 3
+#define INETADDRESSTYPE_IPV6Z 4
+#define INETADDRESSTYPE_DNS 16
+
+#endif /* INETADDRESSTYPE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * inetNetToMediaType (INTEGER / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef INETNETTOMEDIATYPE_ENUMS
+#define INETNETTOMEDIATYPE_ENUMS
+
+#define INETNETTOMEDIATYPE_OTHER 1
+#define INETNETTOMEDIATYPE_INVALID 2
+#define INETNETTOMEDIATYPE_DYNAMIC 3
+#define INETNETTOMEDIATYPE_STATIC 4
+#define INETNETTOMEDIATYPE_LOCAL 5
+
+#endif /* INETNETTOMEDIATYPE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * inetNetToMediaState (INTEGER / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef INETNETTOMEDIASTATE_ENUMS
+#define INETNETTOMEDIASTATE_ENUMS
+
+#define INETNETTOMEDIASTATE_REACHABLE 1
+#define INETNETTOMEDIASTATE_STALE 2
+#define INETNETTOMEDIASTATE_DELAY 3
+#define INETNETTOMEDIASTATE_PROBE 4
+#define INETNETTOMEDIASTATE_INVALID 5
+#define INETNETTOMEDIASTATE_UNKNOWN 6
+#define INETNETTOMEDIASTATE_INCOMPLETE 7
+
+#endif /* INETNETTOMEDIASTATE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * inetNetToMediaRowStatus (RowStatus / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef ROWSTATUS_ENUMS
+#define ROWSTATUS_ENUMS
+
+#define ROWSTATUS_ACTIVE 1
+#define ROWSTATUS_NOTINSERVICE 2
+#define ROWSTATUS_NOTREADY 3
+#define ROWSTATUS_CREATEANDGO 4
+#define ROWSTATUS_CREATEANDWAIT 5
+#define ROWSTATUS_DESTROY 6
+
+#endif /* ROWSTATUS_ENUMS */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* INETNETTOMEDIATABLE_OIDS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.c
new file mode 100644
index 0000000000..cad942c621
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.c
@@ -0,0 +1,619 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: inetNetToMediaTable_data_access.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "inetNetToMediaTable.h"
+
+
+#include "inetNetToMediaTable_data_access.h"
+
+/** @ingroup interface
+ * @addtogroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table inetNetToMediaTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::inetNetToMediaTable is subid 35 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.35, length: 8
+ */
+
+/**
+ * initialization for inetNetToMediaTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param inetNetToMediaTable_reg
+ * Pointer to inetNetToMediaTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+inetNetToMediaTable_init_data(inetNetToMediaTable_registration *
+ inetNetToMediaTable_reg)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_init_data", "called\n"));
+
+ /*
+ * TODO:303:o: Initialize inetNetToMediaTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaTable_init_data */
+
+/**
+ * container overview
+ *
+ */
+
+/**
+ * container initialization
+ *
+ * @param container_ptr_ptr A pointer to a container pointer. If you
+ * create a custom container, use this parameter to return it
+ * to the MFD helper. If set to NULL, the MFD helper will
+ * allocate a container for you.
+ * @param cache A pointer to a cache structure. You can set the timeout
+ * and other cache flags using this pointer.
+ *
+ * This function is called at startup to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases. If no custom
+ * container is allocated, the MFD code will create one for your.
+ *
+ * This is also the place to set up cache behavior. The default, to
+ * simply set the cache timeout, will work well with the default
+ * container. If you are using a custom container, you may want to
+ * look at the cache helper documentation to see if there are any
+ * flags you want to set.
+ *
+ * @remark
+ * This would also be a good place to do any initialization needed
+ * for you data source. For example, opening a connection to another
+ * process that will supply the data, opening a database, etc.
+ */
+void
+inetNetToMediaTable_container_init(netsnmp_container **container_ptr_ptr,
+ netsnmp_cache * cache)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_container_init", "called\n"));
+
+ if (NULL == container_ptr_ptr) {
+ snmp_log(LOG_ERR,
+ "bad container param to inetNetToMediaTable_container_init\n");
+ return;
+ }
+
+ /*
+ * For advanced users, you can use a custom container. If you
+ * do not create one, one will be created for you.
+ */
+ *container_ptr_ptr = NULL;
+
+ if (NULL == cache) {
+ snmp_log(LOG_ERR,
+ "bad cache param to inetNetToMediaTable_container_init\n");
+ return;
+ }
+
+ /*
+ * TODO:345:A: Set up inetNetToMediaTable cache properties.
+ *
+ * Also for advanced users, you can set parameters for the
+ * cache. Do not change the magic pointer, as it is used
+ * by the MFD helper. To completely disable caching, set
+ * cache->enabled to 0.
+ */
+ cache->timeout = INETNETTOMEDIATABLE_CACHE_TIMEOUT; /* seconds */
+} /* inetNetToMediaTable_container_init */
+
+/**
+ * check entry for update
+ *
+ */
+static void
+_snarf_arp_entry(netsnmp_arp_entry *arp_entry,
+ netsnmp_container *container)
+{
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx;
+ int inetAddressType;
+
+ DEBUGTRACE;
+
+ netsnmp_assert(NULL != arp_entry);
+ netsnmp_assert(NULL != container);
+
+ /*
+ * convert the addr len to an inetAddressType
+ */
+ switch (arp_entry->arp_ipaddress_len) {
+ case 4:
+ inetAddressType = INETADDRESSTYPE_IPV4;
+ break;
+
+ case 6:
+ inetAddressType = INETADDRESSTYPE_IPV6;
+ break;
+
+ default:
+ netsnmp_access_arp_entry_free(arp_entry);
+ snmp_log(LOG_ERR, "unsupported address type\n");
+ return;
+ }
+
+ /*
+ * allocate an row context and set the index(es), then add it to
+ * the container
+ */
+ rowreq_ctx = inetNetToMediaTable_allocate_rowreq_ctx(arp_entry, NULL);
+ if ((NULL != rowreq_ctx) &&
+ (MFD_SUCCESS == inetNetToMediaTable_indexes_set
+ (rowreq_ctx, rowreq_ctx->data->if_index, inetAddressType,
+ rowreq_ctx->data->arp_ipaddress,
+ rowreq_ctx->data->arp_ipaddress_len))) {
+ rowreq_ctx->inetNetToMediaRowStatus = ROWSTATUS_ACTIVE;
+ CONTAINER_INSERT(container, rowreq_ctx);
+ } else {
+ if (rowreq_ctx) {
+ snmp_log(LOG_ERR, "error setting index while loading "
+ "inetNetToMediaTable cache.\n");
+ inetNetToMediaTable_release_rowreq_ctx(rowreq_ctx);
+ } else
+ netsnmp_access_arp_entry_free(arp_entry);
+ }
+}
+
+/**
+ * container shutdown
+ *
+ * @param container_ptr A pointer to the container.
+ *
+ * This function is called at shutdown to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases.
+ *
+ * This function is called before inetNetToMediaTable_container_free().
+ *
+ * @remark
+ * This would also be a good place to do any cleanup needed
+ * for you data source. For example, closing a connection to another
+ * process that supplied the data, closing a database, etc.
+ */
+void
+inetNetToMediaTable_container_shutdown(netsnmp_container *container_ptr)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_container_shutdown", "called\n"));
+
+ if (NULL == container_ptr) {
+ snmp_log(LOG_ERR,
+ "bad params to inetNetToMediaTable_container_shutdown\n");
+ return;
+ }
+
+} /* inetNetToMediaTable_container_shutdown */
+
+/**
+ * load initial data
+ *
+ * TODO:350:M: Implement inetNetToMediaTable data load
+ * This function will also be called by the cache helper to load
+ * the container again (after the container free function has been
+ * called to free the previous contents).
+ *
+ * @param container container to which items should be inserted
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
+ * @retval MFD_ERROR : other error.
+ *
+ * This function is called to load the index(es) (and data, optionally)
+ * for the every row in the data set.
+ *
+ * @remark
+ * While loading the data, the only important thing is the indexes.
+ * If access to your data is cheap/fast (e.g. you have a pointer to a
+ * structure in memory), it would make sense to update the data here.
+ * If, however, the accessing the data invovles more work (e.g. parsing
+ * some other existing data, or peforming calculations to derive the data),
+ * then you can limit yourself to setting the indexes and saving any
+ * information you will need later. Then use the saved information in
+ * inetNetToMediaTable_row_prep() for populating data.
+ *
+ * @note
+ * If you need consistency between rows (like you want statistics
+ * for each row to be from the same time frame), you should set all
+ * data here.
+ *
+ */
+int
+inetNetToMediaTable_container_load(netsnmp_container *container)
+{
+ netsnmp_container *arp_container;
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_cache_load", "called\n"));
+
+ /*
+ * TODO:351:M: |-> Load/update data in the inetNetToMediaTable container.
+ * loop over your inetNetToMediaTable data, allocate a rowreq context,
+ * set the index(es) [and data, optionally] and insert into
+ * the container.
+ */
+ arp_container =
+ netsnmp_access_arp_container_load(NULL,
+ NETSNMP_ACCESS_ARP_LOAD_NOFLAGS);
+ if (NULL == arp_container)
+ return MFD_RESOURCE_UNAVAILABLE; /* msg already logged */
+
+ /*
+ * we just got a fresh copy of data. snarf data
+ */
+ CONTAINER_FOR_EACH(arp_container,
+ (netsnmp_container_obj_func *) _snarf_arp_entry,
+ container);
+
+ /*
+ * free the container. we've either claimed each entry, or released it,
+ * so the access function doesn't need to clear the container.
+ */
+ netsnmp_access_arp_container_free(arp_container,
+ NETSNMP_ACCESS_ARP_FREE_DONT_CLEAR);
+
+ DEBUGMSGT(("verbose:inetNetToMediaTable:inetNetToMediaTable_cache_load", "%d records\n", CONTAINER_SIZE(container)));
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaTable_container_load */
+
+/**
+ * container clean up
+ *
+ * @param container container with all current items
+ *
+ * This optional callback is called prior to all
+ * item's being removed from the container. If you
+ * need to do any processing before that, do it here.
+ *
+ * @note
+ * The MFD helper will take care of releasing all the row contexts.
+ *
+ */
+void
+inetNetToMediaTable_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_container_free", "called\n"));
+
+ /*
+ * TODO:380:M: Free inetNetToMediaTable container data.
+ */
+} /* inetNetToMediaTable_container_free */
+
+/**
+ * prepare row for processing.
+ *
+ * When the agent has located the row for a request, this function is
+ * called to prepare the row for processing. If you fully populated
+ * the data context during the index setup phase, you may not need to
+ * do anything.
+ *
+ * @param rowreq_ctx pointer to a context.
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ */
+int
+inetNetToMediaTable_row_prep(inetNetToMediaTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_row_prep",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+
+ return MFD_SUCCESS;
+} /* inetNetToMediaTable_row_prep */
+
+/*
+ * TODO:420:r: Implement inetNetToMediaTable index validation.
+ */
+/*---------------------------------------------------------------------
+ * IP-MIB::inetNetToMediaEntry.inetNetToMediaIfIndex
+ * inetNetToMediaIfIndex is subid 1 of inetNetToMediaEntry.
+ * Its status is Current, and its access level is NoAccess.
+ * OID: .1.3.6.1.2.1.4.35.1.1
+ * Description:
+The index value which uniquely identifies the interface to
+ which this entry is applicable. The interface identified by
+ a particular value of this index is the same interface as
+ identified by the same value of the IF-MIB's ifIndex.
+ *
+ * Attributes:
+ * accessible 0 isscalar 0 enums 0 hasdefval 0
+ * readable 0 iscolumn 1 ranges 1 hashint 1
+ * settable 0
+ * hint: d
+ *
+ * Ranges: 1 - 2147483647;
+ *
+ * Its syntax is InterfaceIndex (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ *
+ *
+ *
+ * NOTE: NODE inetNetToMediaIfIndex IS NOT ACCESSIBLE
+ *
+ *
+ */
+/**
+ * check validity of inetNetToMediaIfIndex index portion
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ *
+ * @note this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * inetNetToMediaTable_validate_index() function.
+ *
+ * @note Also keep in mind that if the index refers to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ * The following checks have already been done for you:
+ * The value is in (one of) the range set(s): 1 - 2147483647
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ */
+int
+inetNetToMediaIfIndex_check_index(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaIfIndex_check_index", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:426:M: |-> Check inetNetToMediaTable index inetNetToMediaIfIndex.
+ * check that index value in the table context is legal.
+ * (rowreq_ctx->tbl_index.inetNetToMediaIfIndex)
+ */
+
+ return MFD_SUCCESS; /* inetNetToMediaIfIndex index ok */
+} /* inetNetToMediaIfIndex_check_index */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::inetNetToMediaEntry.inetNetToMediaNetAddressType
+ * inetNetToMediaNetAddressType is subid 2 of inetNetToMediaEntry.
+ * Its status is Current, and its access level is NoAccess.
+ * OID: .1.3.6.1.2.1.4.35.1.2
+ * Description:
+The type of inetNetToMediaNetAddress.
+ *
+ * Attributes:
+ * accessible 0 isscalar 0 enums 1 hasdefval 0
+ * readable 0 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ * Enum range: 5/8. Values: unknown(0), ipv4(1), ipv6(2), ipv4z(3), ipv6z(4), dns(16)
+ *
+ * Its syntax is InetAddressType (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ *
+ *
+ *
+ * NOTE: NODE inetNetToMediaNetAddressType IS NOT ACCESSIBLE
+ *
+ *
+ */
+/**
+ * check validity of inetNetToMediaNetAddressType index portion
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ *
+ * @note this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * inetNetToMediaTable_validate_index() function.
+ *
+ * @note Also keep in mind that if the index refers to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ * The following checks have already been done for you:
+ * The value is one of unknown(0), ipv4(1), ipv6(2), ipv4z(3), ipv6z(4), dns(16)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ */
+int
+inetNetToMediaNetAddressType_check_index(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaNetAddressType_check_index", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:426:M: |-> Check inetNetToMediaTable index inetNetToMediaNetAddressType.
+ * check that index value in the table context is legal.
+ * (rowreq_ctx->tbl_index.inetNetToMediaNetAddressType)
+ */
+
+ return MFD_SUCCESS; /* inetNetToMediaNetAddressType index ok */
+} /* inetNetToMediaNetAddressType_check_index */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::inetNetToMediaEntry.inetNetToMediaNetAddress
+ * inetNetToMediaNetAddress is subid 3 of inetNetToMediaEntry.
+ * Its status is Current, and its access level is NoAccess.
+ * OID: .1.3.6.1.2.1.4.35.1.3
+ * Description:
+The IP Address corresponding to the media-dependent
+ `physical' address. The address type of this object is
+ specified in inetNetToMediaAddressType.
+
+
+ Implementors need to be aware that if the size of
+ inetNetToMediaNetAddress exceeds 115 octets then OIDS of
+ instances of columns in this row will have more than 128
+ sub-identifiers and cannot be accessed using SNMPv1, SNMPv2c
+ or SNMPv3.
+ *
+ * Attributes:
+ * accessible 0 isscalar 0 enums 0 hasdefval 0
+ * readable 0 iscolumn 1 ranges 1 hashint 0
+ * settable 0
+ *
+ * Ranges: 0 - 255;
+ *
+ * Its syntax is InetAddress (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 255)
+ *
+ *
+ *
+ * NOTE: NODE inetNetToMediaNetAddress IS NOT ACCESSIBLE
+ *
+ *
+ */
+/**
+ * check validity of inetNetToMediaNetAddress index portion
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ *
+ * @note this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * inetNetToMediaTable_validate_index() function.
+ *
+ * @note Also keep in mind that if the index refers to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ * The following checks have already been done for you:
+ * The length is in (one of) the range set(s): 0 - 255
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ */
+int
+inetNetToMediaNetAddress_check_index(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaNetAddress_check_index", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:426:M: |-> Check inetNetToMediaTable index inetNetToMediaNetAddress.
+ * check that index value in the table context is legal.
+ * (rowreq_ctx->tbl_index.inetNetToMediaNetAddress)
+ */
+
+ return MFD_SUCCESS; /* inetNetToMediaNetAddress index ok */
+} /* inetNetToMediaNetAddress_check_index */
+
+/**
+ * verify specified index is valid.
+ *
+ * This check is independent of whether or not the values specified for
+ * the columns of the new row are valid. Column values and row consistency
+ * will be checked later. At this point, only the index values should be
+ * checked.
+ *
+ * All of the individual index validation functions have been called, so this
+ * is the place to make sure they are valid as a whole when combined. If
+ * you only have one index, then you probably don't need to do anything else
+ * here.
+ *
+ * @note Keep in mind that if the indexes refer to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ *
+ * @param inetNetToMediaTable_reg
+ * Pointer to the user registration data
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_CANNOT_CREATE_NOW : index not valid right now
+ * @retval MFD_CANNOT_CREATE_EVER : index never valid
+ */
+int
+inetNetToMediaTable_validate_index(inetNetToMediaTable_registration *
+ inetNetToMediaTable_reg,
+ inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_validate_index", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:430:M: |-> Validate potential inetNetToMediaTable index.
+ */
+ if (1) {
+ snmp_log(LOG_WARNING, "invalid index for a new row in the "
+ "inetNetToMediaTable table.\n");
+ /*
+ * determine failure type.
+ *
+ * If the index could not ever be created, return MFD_NOT_EVER
+ * If the index can not be created under the present circumstances
+ * (even though it could be created under other circumstances),
+ * return MFD_NOT_NOW.
+ */
+ if (0) {
+ return MFD_CANNOT_CREATE_EVER;
+ } else {
+ return MFD_CANNOT_CREATE_NOW;
+ }
+ }
+
+ return rc;
+} /* inetNetToMediaTable_validate_index */
+
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.h
new file mode 100644
index 0000000000..d1638cf51f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_data_access.h
@@ -0,0 +1,84 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: inetNetToMediaTable_data_access.h 13759 2005-12-01 00:45:50Z rstory $
+ */
+#ifndef INETNETTOMEDIATABLE_DATA_ACCESS_H
+#define INETNETTOMEDIATABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table inetNetToMediaTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::inetNetToMediaTable is subid 35 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.35, length: 8
+ */
+
+
+ int
+ inetNetToMediaTable_init_data(inetNetToMediaTable_registration *
+ inetNetToMediaTable_reg);
+
+
+ /*
+ * TODO:180:o: Review inetNetToMediaTable cache timeout.
+ * The number of seconds before the cache times out
+ */
+#define INETNETTOMEDIATABLE_CACHE_TIMEOUT 60
+
+ void inetNetToMediaTable_container_init(netsnmp_container
+ **container_ptr_ptr,
+ netsnmp_cache *
+ cache);
+ void
+ inetNetToMediaTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int inetNetToMediaTable_container_load(netsnmp_container
+ *container);
+ void inetNetToMediaTable_container_free(netsnmp_container
+ *container);
+
+ int inetNetToMediaTable_cache_load(netsnmp_container
+ *container);
+ void inetNetToMediaTable_cache_free(netsnmp_container
+ *container);
+
+ int
+ inetNetToMediaTable_row_prep(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ inetNetToMediaTable_validate_index(inetNetToMediaTable_registration
+ * inetNetToMediaTable_reg,
+ inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx);
+ int inetNetToMediaIfIndex_check_index(inetNetToMediaTable_rowreq_ctx * rowreq_ctx); /* internal */
+ int inetNetToMediaNetAddressType_check_index(inetNetToMediaTable_rowreq_ctx * rowreq_ctx); /* internal */
+ int inetNetToMediaNetAddress_check_index(inetNetToMediaTable_rowreq_ctx * rowreq_ctx); /* internal */
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* INETNETTOMEDIATABLE_DATA_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface.c
new file mode 100644
index 0000000000..33393090b7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface.c
@@ -0,0 +1,1994 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: inetNetToMediaTable_interface.c 15781 2007-01-23 22:55:06Z rstory $
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "inetNetToMediaTable.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "inetNetToMediaTable_interface.h"
+
+#include <ctype.h>
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table inetNetToMediaTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::inetNetToMediaTable is subid 35 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.35, length: 8
+ */
+typedef struct inetNetToMediaTable_interface_ctx_s {
+
+ netsnmp_container *container;
+ netsnmp_cache *cache;
+
+ inetNetToMediaTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+ u_int table_dirty;
+
+} inetNetToMediaTable_interface_ctx;
+
+static inetNetToMediaTable_interface_ctx inetNetToMediaTable_if_ctx;
+
+static void
+ _inetNetToMediaTable_container_init(inetNetToMediaTable_interface_ctx *
+ if_ctx);
+static void
+ _inetNetToMediaTable_container_shutdown(inetNetToMediaTable_interface_ctx *
+ if_ctx);
+
+
+netsnmp_container *
+inetNetToMediaTable_container_get(void)
+{
+ return inetNetToMediaTable_if_ctx.container;
+}
+
+inetNetToMediaTable_registration *
+inetNetToMediaTable_registration_get(void)
+{
+ return inetNetToMediaTable_if_ctx.user_ctx;
+}
+
+inetNetToMediaTable_registration *
+inetNetToMediaTable_registration_set(inetNetToMediaTable_registration *
+ newreg)
+{
+ inetNetToMediaTable_registration *old =
+ inetNetToMediaTable_if_ctx.user_ctx;
+ inetNetToMediaTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+
+int
+inetNetToMediaTable_container_size(void)
+{
+ return CONTAINER_SIZE(inetNetToMediaTable_if_ctx.container);
+}
+
+u_int
+inetNetToMediaTable_dirty_get(void)
+{
+ return inetNetToMediaTable_if_ctx.table_dirty;
+}
+
+void
+inetNetToMediaTable_dirty_set(u_int status)
+{
+ DEBUGMSGTL(("inetNetToMediaTable:inetNetToMediaTable_dirty_set",
+ "called. was %d, now %d\n",
+ inetNetToMediaTable_if_ctx.table_dirty, status));
+ inetNetToMediaTable_if_ctx.table_dirty = status;
+}
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_pre_request;
+static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_post_request;
+static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_get_values;
+static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_check_objects;
+static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_undo_setup;
+static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_set_values;
+static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_undo_cleanup;
+static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_undo_values;
+static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_commit;
+static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_undo_commit;
+static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_irreversible_commit;
+static Netsnmp_Node_Handler _mfd_inetNetToMediaTable_check_dependencies;
+
+NETSNMP_STATIC_INLINE int
+ _inetNetToMediaTable_undo_column(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx,
+ netsnmp_variable_list *
+ var, int column);
+
+NETSNMP_STATIC_INLINE int
+ _inetNetToMediaTable_check_indexes(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx);
+
+/**
+ * @internal
+ * Initialize the table inetNetToMediaTable
+ * (Define its contents and how it's structured)
+ */
+void
+_inetNetToMediaTable_initialize_interface(inetNetToMediaTable_registration
+ * reg_ptr, u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &inetNetToMediaTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info =
+ &inetNetToMediaTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_initialize_interface", "called\n"));
+
+
+ /*************************************************
+ *
+ * save interface context for inetNetToMediaTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
+ /** index: inetNetToMediaIfIndex */
+ ASN_INTEGER,
+ /** index: inetNetToMediaNetAddressType */
+ ASN_OCTET_STR,
+ /** index: inetNetToMediaNetAddress */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrival.
+ */
+ tbl_info->min_column = INETNETTOMEDIATABLE_MIN_COL;
+ tbl_info->max_column = INETNETTOMEDIATABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ inetNetToMediaTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ inetNetToMediaTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _inetNetToMediaTable_container_init(&inetNetToMediaTable_if_ctx);
+ if (NULL == inetNetToMediaTable_if_ctx.container) {
+ snmp_log(LOG_ERR,
+ "could not initialize container for inetNetToMediaTable\n");
+ return;
+ }
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup =
+ _mfd_inetNetToMediaTable_object_lookup;
+ access_multiplexer->get_values = _mfd_inetNetToMediaTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request = _mfd_inetNetToMediaTable_pre_request;
+ access_multiplexer->post_request =
+ _mfd_inetNetToMediaTable_post_request;
+
+
+ /*
+ * REQUIRED wrappers for set request handling
+ */
+ access_multiplexer->object_syntax_checks =
+ _mfd_inetNetToMediaTable_check_objects;
+ access_multiplexer->undo_setup = _mfd_inetNetToMediaTable_undo_setup;
+ access_multiplexer->undo_cleanup =
+ _mfd_inetNetToMediaTable_undo_cleanup;
+ access_multiplexer->set_values = _mfd_inetNetToMediaTable_set_values;
+ access_multiplexer->undo_sets = _mfd_inetNetToMediaTable_undo_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->commit = _mfd_inetNetToMediaTable_commit;
+ access_multiplexer->undo_commit = _mfd_inetNetToMediaTable_undo_commit;
+ access_multiplexer->irreversible_commit =
+ _mfd_inetNetToMediaTable_irreversible_commit;
+
+ /*
+ * REQUIRED for tables with dependencies
+ */
+ access_multiplexer->consistency_checks =
+ _mfd_inetNetToMediaTable_check_dependencies;
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("inetNetToMediaTable:init_inetNetToMediaTable",
+ "Registering inetNetToMediaTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("inetNetToMediaTable", handler,
+ inetNetToMediaTable_oid,
+ inetNetToMediaTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RWRITE);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR, "error registering table inetNetToMediaTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &inetNetToMediaTable_if_ctx;
+
+ /*************************************************
+ *
+ * set up baby steps handler, create it and inject it
+ */
+ if (access_multiplexer->object_lookup)
+ mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
+ if (access_multiplexer->set_values)
+ mfd_modes |= BABY_STEP_SET_VALUES;
+ if (access_multiplexer->irreversible_commit)
+ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
+ if (access_multiplexer->object_syntax_checks)
+ mfd_modes |= BABY_STEP_CHECK_OBJECT;
+
+ if (access_multiplexer->pre_request)
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if (access_multiplexer->post_request)
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+ if (access_multiplexer->undo_setup)
+ mfd_modes |= BABY_STEP_UNDO_SETUP;
+ if (access_multiplexer->undo_cleanup)
+ mfd_modes |= BABY_STEP_UNDO_CLEANUP;
+ if (access_multiplexer->undo_sets)
+ mfd_modes |= BABY_STEP_UNDO_SETS;
+
+ if (access_multiplexer->row_creation)
+ mfd_modes |= BABY_STEP_ROW_CREATE;
+ if (access_multiplexer->consistency_checks)
+ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
+ if (access_multiplexer->commit)
+ mfd_modes |= BABY_STEP_COMMIT;
+ if (access_multiplexer->undo_commit)
+ mfd_modes |= BABY_STEP_UNDO_COMMIT;
+
+ handler = netsnmp_baby_steps_handler_get(mfd_modes);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
+ */
+ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler =
+ netsnmp_container_table_handler_get(tbl_info,
+ inetNetToMediaTable_if_ctx.
+ container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject cache helper
+ */
+ if (NULL != inetNetToMediaTable_if_ctx.cache) {
+ handler =
+ netsnmp_cache_handler_get(inetNetToMediaTable_if_ctx.cache);
+ netsnmp_inject_handler(reginfo, handler);
+ }
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+} /* _inetNetToMediaTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table inetNetToMediaTable
+ */
+void
+_inetNetToMediaTable_shutdown_interface(inetNetToMediaTable_registration *
+ reg_ptr)
+{
+ /*
+ * shutdown the container
+ */
+ _inetNetToMediaTable_container_shutdown(&inetNetToMediaTable_if_ctx);
+}
+
+void
+inetNetToMediaTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ inetNetToMediaTable_if_ctx.tbl_info.valid_columns = vc;
+} /* inetNetToMediaTable_valid_columns_set */
+
+/**
+ * @internal
+ * convert the index component stored in the context to an oid
+ */
+int
+inetNetToMediaTable_index_to_oid(netsnmp_index * oid_idx,
+ inetNetToMediaTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * inetNetToMediaIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_inetNetToMediaIfIndex;
+ /*
+ * inetNetToMediaNetAddressType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_inetNetToMediaNetAddressType;
+ /*
+ * inetNetToMediaNetAddress(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_inetNetToMediaNetAddress;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_inetNetToMediaIfIndex, 0x00,
+ sizeof(var_inetNetToMediaIfIndex));
+ var_inetNetToMediaIfIndex.type = ASN_INTEGER;
+ memset(&var_inetNetToMediaNetAddressType, 0x00,
+ sizeof(var_inetNetToMediaNetAddressType));
+ var_inetNetToMediaNetAddressType.type = ASN_INTEGER;
+ memset(&var_inetNetToMediaNetAddress, 0x00,
+ sizeof(var_inetNetToMediaNetAddress));
+ var_inetNetToMediaNetAddress.type = ASN_OCTET_STR;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_inetNetToMediaIfIndex.next_variable =
+ &var_inetNetToMediaNetAddressType;
+ var_inetNetToMediaNetAddressType.next_variable =
+ &var_inetNetToMediaNetAddress;
+ var_inetNetToMediaNetAddress.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_index_to_oid", "called\n"));
+
+ /*
+ * inetNetToMediaIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ snmp_set_var_value(&var_inetNetToMediaIfIndex,
+ (u_char *) & mib_idx->inetNetToMediaIfIndex,
+ sizeof(mib_idx->inetNetToMediaIfIndex));
+
+ /*
+ * inetNetToMediaNetAddressType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ snmp_set_var_value(&var_inetNetToMediaNetAddressType,
+ (u_char *) & mib_idx->inetNetToMediaNetAddressType,
+ sizeof(mib_idx->inetNetToMediaNetAddressType));
+
+ /*
+ * inetNetToMediaNetAddress(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_inetNetToMediaNetAddress,
+ (u_char *) & mib_idx->inetNetToMediaNetAddress,
+ mib_idx->inetNetToMediaNetAddress_len *
+ sizeof(mib_idx->inetNetToMediaNetAddress[0]));
+
+
+ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
+ NULL, 0, &var_inetNetToMediaIfIndex);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_inetNetToMediaIfIndex);
+
+ return err;
+} /* inetNetToMediaTable_index_to_oid */
+
+/**
+ * extract inetNetToMediaTable indexes from a netsnmp_index
+ *
+ * @retval SNMP_ERR_NOERROR : no error
+ * @retval SNMP_ERR_GENERR : error
+ */
+int
+inetNetToMediaTable_index_from_oid(netsnmp_index * oid_idx,
+ inetNetToMediaTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * inetNetToMediaIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_inetNetToMediaIfIndex;
+ /*
+ * inetNetToMediaNetAddressType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_inetNetToMediaNetAddressType;
+ /*
+ * inetNetToMediaNetAddress(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_inetNetToMediaNetAddress;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_inetNetToMediaIfIndex, 0x00,
+ sizeof(var_inetNetToMediaIfIndex));
+ var_inetNetToMediaIfIndex.type = ASN_INTEGER;
+ memset(&var_inetNetToMediaNetAddressType, 0x00,
+ sizeof(var_inetNetToMediaNetAddressType));
+ var_inetNetToMediaNetAddressType.type = ASN_INTEGER;
+ memset(&var_inetNetToMediaNetAddress, 0x00,
+ sizeof(var_inetNetToMediaNetAddress));
+ var_inetNetToMediaNetAddress.type = ASN_OCTET_STR;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_inetNetToMediaIfIndex.next_variable =
+ &var_inetNetToMediaNetAddressType;
+ var_inetNetToMediaNetAddressType.next_variable =
+ &var_inetNetToMediaNetAddress;
+ var_inetNetToMediaNetAddress.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:inetNetToMediaTable:inetNetToMediaTable_index_from_oid", "called\n"));
+
+ /*
+ * parse the oid into the individual index components
+ */
+ err = parse_oid_indexes(oid_idx->oids, oid_idx->len,
+ &var_inetNetToMediaIfIndex);
+ if (err == SNMP_ERR_NOERROR) {
+ /*
+ * copy out values
+ */
+ mib_idx->inetNetToMediaIfIndex =
+ *((long *) var_inetNetToMediaIfIndex.val.string);
+ mib_idx->inetNetToMediaNetAddressType =
+ *((u_long *) var_inetNetToMediaNetAddressType.val.string);
+ /*
+ * NOTE: val_len is in bytes, inetNetToMediaNetAddress_len might not be
+ */
+ if (var_inetNetToMediaNetAddress.val_len >
+ sizeof(mib_idx->inetNetToMediaNetAddress))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->inetNetToMediaNetAddress,
+ var_inetNetToMediaNetAddress.val.string,
+ var_inetNetToMediaNetAddress.val_len);
+ mib_idx->inetNetToMediaNetAddress_len =
+ var_inetNetToMediaNetAddress.val_len /
+ sizeof(mib_idx->inetNetToMediaNetAddress[0]);
+ }
+
+
+ }
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_inetNetToMediaIfIndex);
+
+ return err;
+} /* inetNetToMediaTable_index_from_oid */
+
+
+/*
+ *********************************************************************
+ * @internal
+ * allocate resources for a inetNetToMediaTable_rowreq_ctx
+ */
+inetNetToMediaTable_rowreq_ctx *
+inetNetToMediaTable_allocate_rowreq_ctx(inetNetToMediaTable_data * data,
+ void *user_init_ctx)
+{
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx =
+ SNMP_MALLOC_TYPEDEF(inetNetToMediaTable_rowreq_ctx);
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:inetNetToMediaTable_allocate_rowreq_ctx", "called\n"));
+
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "Couldn't allocate memory for a "
+ "inetNetToMediaTable_rowreq_ctx.\n");
+ return NULL;
+ } else {
+ if (NULL != data) {
+ /*
+ * track if we got data from user
+ */
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DATA_FROM_USER;
+ rowreq_ctx->data = data;
+ } else if (NULL ==
+ (rowreq_ctx->data =
+ inetNetToMediaTable_allocate_data())) {
+ SNMP_FREE(rowreq_ctx);
+ return NULL;
+ }
+ }
+
+ /*
+ * undo context will be allocated when needed (in *_undo_setup)
+ */
+
+ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
+
+ rowreq_ctx->inetNetToMediaTable_data_list = NULL;
+
+ /*
+ * if we allocated data, call init routine
+ */
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) {
+ if (SNMPERR_SUCCESS !=
+ inetNetToMediaTable_rowreq_ctx_init(rowreq_ctx,
+ user_init_ctx)) {
+ inetNetToMediaTable_release_rowreq_ctx(rowreq_ctx);
+ rowreq_ctx = NULL;
+ }
+ }
+
+ return rowreq_ctx;
+} /* inetNetToMediaTable_allocate_rowreq_ctx */
+
+/*
+ * @internal
+ * release resources for a inetNetToMediaTable_rowreq_ctx
+ */
+void
+inetNetToMediaTable_release_rowreq_ctx(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("internal:inetNetToMediaTable:inetNetToMediaTable_release_rowreq_ctx", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ inetNetToMediaTable_rowreq_ctx_cleanup(rowreq_ctx);
+
+ /*
+ * for non-transient data, don't free data we got from the user
+ */
+ if ((rowreq_ctx->data) &&
+ !(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER))
+ inetNetToMediaTable_release_data(rowreq_ctx->data);
+
+ if (rowreq_ctx->undo)
+ inetNetToMediaTable_release_data(rowreq_ctx->undo);
+
+ /*
+ * free index oid pointer
+ */
+ if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp)
+ free(rowreq_ctx->oid_idx.oids);
+
+ SNMP_FREE(rowreq_ctx);
+} /* inetNetToMediaTable_release_rowreq_ctx */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_inetNetToMediaTable_pre_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_pre_request", "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:inetNetToMediaTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = inetNetToMediaTable_pre_request(inetNetToMediaTable_if_ctx.
+ user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("inetNetToMediaTable", "error %d from "
+ "inetNetToMediaTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetNetToMediaTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_inetNetToMediaTable_post_request(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_post_request", "called\n"));
+
+ /*
+ * release row context, if deleted
+ */
+ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
+ inetNetToMediaTable_release_rowreq_ctx(rowreq_ctx);
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:inetNetToMediaTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ if ((MFD_SUCCESS != packet_rc) && inetNetToMediaTable_dirty_get()) {
+ /*
+ * we shouldn't get here. the undo steps should also clear
+ * the dirty flags.
+ */
+ snmp_log(LOG_WARNING,
+ "inetNetToMediaTable dirty flag set in post_request "
+ "but status != SUCCESS.\n");
+ }
+
+ rc = inetNetToMediaTable_post_request(inetNetToMediaTable_if_ctx.
+ user_ctx, packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("inetNetToMediaTable", "error %d from "
+ "inetNetToMediaTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetNetToMediaTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static inetNetToMediaTable_rowreq_ctx *
+_mfd_inetNetToMediaTable_rowreq_from_index(netsnmp_index * oid_idx,
+ int *rc_ptr)
+{
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx;
+ inetNetToMediaTable_mib_index mib_idx;
+ int rc;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_rowreq_from_index", "called\n"));
+
+ if (NULL == rc_ptr)
+ rc_ptr = &rc;
+ *rc_ptr = MFD_SUCCESS;
+
+ memset(&mib_idx, 0x0, sizeof(mib_idx));
+
+ /*
+ * try to parse oid
+ */
+ *rc_ptr = inetNetToMediaTable_index_from_oid(oid_idx, &mib_idx);
+ if (MFD_SUCCESS != *rc_ptr) {
+ DEBUGMSGT(("inetNetToMediaTable", "error parsing index\n"));
+ return NULL;
+ }
+
+ /*
+ * allocate new context
+ */
+ rowreq_ctx = inetNetToMediaTable_allocate_rowreq_ctx(NULL, NULL);
+ if (NULL == rowreq_ctx) {
+ *rc_ptr = MFD_ERROR;
+ return NULL; /* msg already logged */
+ }
+
+ memcpy(&rowreq_ctx->tbl_idx, &mib_idx, sizeof(mib_idx));
+
+ /*
+ * check indexes
+ */
+ *rc_ptr = _inetNetToMediaTable_check_indexes(rowreq_ctx);
+ if (MFD_SUCCESS != *rc_ptr) {
+ netsnmp_assert((*rc_ptr == SNMP_ERR_NOCREATION) ||
+ (*rc_ptr == SNMP_ERR_INCONSISTENTNAME));
+ inetNetToMediaTable_release_rowreq_ctx(rowreq_ctx);
+ return NULL;
+ }
+
+ /*
+ * copy indexes
+ */
+ rowreq_ctx->oid_idx.len = oid_idx->len;
+ memcpy(rowreq_ctx->oid_idx.oids, oid_idx->oids,
+ oid_idx->len * sizeof(oid));
+
+ return rowreq_ctx;
+} /* _mfd_inetNetToMediaTable_rowreq_from_index */
+
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_inetNetToMediaTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = SNMP_ERR_NOERROR;
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_object_lookup", "called\n"));
+
+ /*
+ * get our context from mfd
+ * inetNetToMediaTable_interface_ctx *if_ctx =
+ * (inetNetToMediaTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if (NULL == rowreq_ctx) {
+ netsnmp_table_request_info *tblreq_info;
+ netsnmp_index oid_idx;
+
+ tblreq_info = netsnmp_extract_table_info(requests);
+ if (NULL == tblreq_info) {
+ snmp_log(LOG_ERR, "request had no table info\n");
+ return MFD_ERROR;
+ }
+
+ /*
+ * try create rowreq
+ */
+ oid_idx.oids = tblreq_info->index_oid;
+ oid_idx.len = tblreq_info->index_oid_len;
+
+ rowreq_ctx =
+ _mfd_inetNetToMediaTable_rowreq_from_index(&oid_idx, &rc);
+ if (MFD_SUCCESS == rc) {
+ netsnmp_assert(NULL != rowreq_ctx);
+ rowreq_ctx->rowreq_flags |= MFD_ROW_CREATED;
+ /*
+ * add rowreq_ctx to request data lists
+ */
+ netsnmp_container_table_row_insert(requests, (netsnmp_index *)
+ rowreq_ctx);
+ }
+ }
+
+ if (MFD_SUCCESS != rc)
+ netsnmp_request_set_error_all(requests, rc);
+ else
+ inetNetToMediaTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_inetNetToMediaTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_inetNetToMediaTable_get_column(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx, netsnmp_variable_list * var,
+ int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_get_column", "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * inetNetToMediaPhysAddress(4)/PhysAddress/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ case COLUMN_INETNETTOMEDIAPHYSADDRESS:
+ var->type = ASN_OCTET_STR;
+ rc = inetNetToMediaPhysAddress_get(rowreq_ctx,
+ (char **) &var->val.string,
+ &var->val_len);
+ break;
+
+ /*
+ * inetNetToMediaLastUpdated(5)/TimeStamp/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_INETNETTOMEDIALASTUPDATED:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_TIMETICKS;
+ rc = inetNetToMediaLastUpdated_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * inetNetToMediaType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_INETNETTOMEDIATYPE:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = inetNetToMediaType_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * inetNetToMediaState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_INETNETTOMEDIASTATE:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = inetNetToMediaState_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * inetNetToMediaRowStatus(8)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_INETNETTOMEDIAROWSTATUS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = inetNetToMediaRowStatus_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _inetNetToMediaTable_get_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _inetNetToMediaTable_get_column */
+
+int
+_mfd_inetNetToMediaTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ u_char *old_string;
+ void (*dataFreeHook) (void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_get_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+ /*
+ * save old pointer, so we can free it if replaced
+ */
+ old_string = requests->requestvb->val.string;
+ dataFreeHook = requests->requestvb->dataFreeHook;
+ if (NULL == requests->requestvb->val.string) {
+ requests->requestvb->val.string = requests->requestvb->buf;
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ } else if (requests->requestvb->buf ==
+ requests->requestvb->val.string) {
+ if (requests->requestvb->val_len !=
+ sizeof(requests->requestvb->buf))
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ }
+
+ /*
+ * get column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _inetNetToMediaTable_get_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ if (MFD_SKIP == rc) {
+ requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+ rc = SNMP_ERR_NOERROR;
+ }
+ } else if (NULL == requests->requestvb->val.string) {
+ snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
+ rc = SNMP_ERR_GENERR;
+ }
+ if (rc)
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+
+ /*
+ * if the buffer wasn't used previously for the old data (i.e. it
+ * was allcoated memory) and the get routine replaced the pointer,
+ * we need to free the previous pointer.
+ */
+ if (old_string && (old_string != requests->requestvb->buf) &&
+ (requests->requestvb->val.string != old_string)) {
+ if (dataFreeHook)
+ (*dataFreeHook) (old_string);
+ else
+ free(old_string);
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetNetToMediaTable_get_values */
+
+NETSNMP_STATIC_INLINE int
+_inetNetToMediaTable_check_indexes(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_check_indexes", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+
+ /*
+ * (INDEX) inetNetToMediaIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ /*
+ * check defined range(s).
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && ((rowreq_ctx->tbl_idx.inetNetToMediaIfIndex < 1)
+ || (rowreq_ctx->tbl_idx.inetNetToMediaIfIndex > 2147483647))
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (MFD_SUCCESS != rc)
+ return rc;
+ rc = inetNetToMediaIfIndex_check_index(rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+ /*
+ * (INDEX) inetNetToMediaNetAddressType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (rowreq_ctx->tbl_idx.inetNetToMediaNetAddressType !=
+ INETADDRESSTYPE_UNKNOWN)
+ && (rowreq_ctx->tbl_idx.inetNetToMediaNetAddressType !=
+ INETADDRESSTYPE_IPV4)
+ && (rowreq_ctx->tbl_idx.inetNetToMediaNetAddressType !=
+ INETADDRESSTYPE_IPV6)
+ && (rowreq_ctx->tbl_idx.inetNetToMediaNetAddressType !=
+ INETADDRESSTYPE_IPV4Z)
+ && (rowreq_ctx->tbl_idx.inetNetToMediaNetAddressType !=
+ INETADDRESSTYPE_IPV6Z)
+ && (rowreq_ctx->tbl_idx.inetNetToMediaNetAddressType !=
+ INETADDRESSTYPE_DNS)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (MFD_SUCCESS != rc)
+ return rc;
+ rc = inetNetToMediaNetAddressType_check_index(rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+ /*
+ * (INDEX) inetNetToMediaNetAddress(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ /*
+ * check defined range(s).
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && ((rowreq_ctx->tbl_idx.inetNetToMediaNetAddress_len < 0)
+ || (rowreq_ctx->tbl_idx.inetNetToMediaNetAddress_len > 255))
+ ) {
+ rc = SNMP_ERR_WRONGLENGTH;
+ }
+ if (MFD_SUCCESS != rc)
+ return rc;
+ rc = inetNetToMediaNetAddress_check_index(rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+ /*
+ * if individual parts look ok, check them as a whole
+ */
+ return inetNetToMediaTable_validate_index(inetNetToMediaTable_if_ctx.
+ user_ctx, rowreq_ctx);
+} /* _inetNetToMediaTable_check_indexes */
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Syntax checks
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check the syntax for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_inetNetToMediaTable_check_column(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx, netsnmp_variable_list * var,
+ int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_check_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+ /*
+ * (INDEX) inetNetToMediaIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ case COLUMN_INETNETTOMEDIAIFINDEX:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+ /*
+ * (INDEX) inetNetToMediaNetAddressType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ case COLUMN_INETNETTOMEDIANETADDRESSTYPE:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+ /*
+ * (INDEX) inetNetToMediaNetAddress(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ case COLUMN_INETNETTOMEDIANETADDRESS:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+
+ /*
+ * inetNetToMediaPhysAddress(4)/PhysAddress/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ case COLUMN_INETNETTOMEDIAPHYSADDRESS:
+ rc = netsnmp_check_vb_type(var, ASN_OCTET_STR);
+ /*
+ * check defined range(s).
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && ((var->val_len < 0) || (var->val_len > 65535))
+ ) {
+ rc = SNMP_ERR_WRONGLENGTH;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("inetNetToMediaTable:_inetNetToMediaTable_check_column:inetNetToMediaPhysAddress", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = inetNetToMediaPhysAddress_check_value(rowreq_ctx,
+ (char *) var->val.
+ string,
+ var->val_len);
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from inetNetToMediaPhysAddress_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * inetNetToMediaLastUpdated(5)/TimeStamp/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_INETNETTOMEDIALASTUPDATED:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * inetNetToMediaType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_INETNETTOMEDIATYPE:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (*var->val.integer != INETNETTOMEDIATYPE_OTHER)
+ && (*var->val.integer != INETNETTOMEDIATYPE_INVALID)
+ && (*var->val.integer != INETNETTOMEDIATYPE_DYNAMIC)
+ && (*var->val.integer != INETNETTOMEDIATYPE_STATIC)
+ && (*var->val.integer != INETNETTOMEDIATYPE_LOCAL)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("inetNetToMediaTable:_inetNetToMediaTable_check_column:inetNetToMediaType", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = inetNetToMediaType_check_value(rowreq_ctx,
+ *((u_long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from inetNetToMediaType_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * inetNetToMediaState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_INETNETTOMEDIASTATE:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * inetNetToMediaRowStatus(8)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_INETNETTOMEDIAROWSTATUS:
+ rc = netsnmp_check_vb_rowstatus_value(var);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("inetNetToMediaTable:_inetNetToMediaTable_check_column:inetNetToMediaRowStatus", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = inetNetToMediaRowStatus_check_value(rowreq_ctx,
+ *((u_long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from inetNetToMediaRowStatus_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ default: /** We shouldn't get here */
+ rc = SNMP_ERR_GENERR;
+ snmp_log(LOG_ERR,
+ "unknown column %d in _inetNetToMediaTable_check_column\n",
+ column);
+ }
+
+ return rc;
+} /* _inetNetToMediaTable_check_column */
+
+int
+_mfd_inetNetToMediaTable_check_objects(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_check_objects", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+
+ /*
+ * get column number from table request info, and check that column
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _inetNetToMediaTable_check_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+ break;
+ }
+
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetNetToMediaTable_check_objects */
+
+
+/*----------------------------------------------------------------------
+ *
+ * SET: check dependencies
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check dependencies wrapper
+ */
+static int
+_mfd_inetNetToMediaTable_check_dependencies(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_check_dependencies", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = inetNetToMediaTable_check_dependencies(rowreq_ctx);
+ if (rc) {
+ DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from "
+ "inetNetToMediaTable_check_dependencies\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetNetToMediaTable_check_dependencies */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo setup
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_inetNetToMediaTable_undo_setup_column(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_undo_setup_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * inetNetToMediaPhysAddress(4)/PhysAddress/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ case COLUMN_INETNETTOMEDIAPHYSADDRESS:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG;
+ rc = inetNetToMediaPhysAddress_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * inetNetToMediaType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_INETNETTOMEDIATYPE:
+ rowreq_ctx->column_set_flags |= COLUMN_INETNETTOMEDIATYPE_FLAG;
+ rc = inetNetToMediaType_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * inetNetToMediaRowStatus(8)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_INETNETTOMEDIAROWSTATUS:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_INETNETTOMEDIAROWSTATUS_FLAG;
+ rc = inetNetToMediaRowStatus_undo_setup(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _inetNetToMediaTable_undo_setup_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _inetNetToMediaTable_undo_setup_column */
+
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_inetNetToMediaTable_undo_setup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_undo_setup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * allocate undo context
+ */
+ rowreq_ctx->undo = inetNetToMediaTable_allocate_data();
+ if (NULL == rowreq_ctx->undo) {
+ /** msg already logged */
+ netsnmp_request_set_error_all(requests,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * row undo setup
+ */
+ rowreq_ctx->column_set_flags = 0;
+ rc = inetNetToMediaTable_undo_setup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from "
+ "inetNetToMediaTable_undo_setup\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ } else {
+ /*
+ * column undo setup
+ */
+ netsnmp_table_request_info *tri;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _inetNetToMediaTable_undo_setup_column(rowreq_ctx,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from "
+ "inetNetToMediaTable_undo_setup_column\n",
+ rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetNetToMediaTable_undo_setup */
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_inetNetToMediaTable_undo_cleanup(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_undo_cleanup", "called\n"));
+
+ /*
+ * failed row create in early stages has no rowreq_ctx
+ */
+ if (NULL == rowreq_ctx)
+ return MFD_SUCCESS;
+
+ /*
+ * call user cleanup
+ */
+ rc = inetNetToMediaTable_undo_cleanup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from "
+ "inetNetToMediaTable_undo_cleanup\n", rc));
+ }
+
+ /*
+ * release undo context, if needed
+ */
+ if (rowreq_ctx->undo) {
+ inetNetToMediaTable_release_data(rowreq_ctx->undo);
+ rowreq_ctx->undo = NULL;
+ }
+
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetNetToMediaTable_undo_cleanup */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Set values
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_inetNetToMediaTable_set_column(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx, netsnmp_variable_list * var,
+ int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_set_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * inetNetToMediaPhysAddress(4)/PhysAddress/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ case COLUMN_INETNETTOMEDIAPHYSADDRESS:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_INETNETTOMEDIAPHYSADDRESS_FLAG;
+ rc = inetNetToMediaPhysAddress_set(rowreq_ctx,
+ (char *) var->val.string,
+ var->val_len);
+ break;
+
+ /*
+ * inetNetToMediaType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_INETNETTOMEDIATYPE:
+ rowreq_ctx->column_set_flags |= COLUMN_INETNETTOMEDIATYPE_FLAG;
+ rc = inetNetToMediaType_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ /*
+ * inetNetToMediaRowStatus(8)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_INETNETTOMEDIAROWSTATUS:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_INETNETTOMEDIAROWSTATUS_FLAG;
+ rc = inetNetToMediaRowStatus_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _inetNetToMediaTable_set_column\n",
+ column);
+ rc = SNMP_ERR_GENERR;
+ break;
+ }
+
+ return rc;
+} /* _inetNetToMediaTable_set_column */
+
+int
+_mfd_inetNetToMediaTable_set_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc = SNMP_ERR_NOERROR;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_set_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rowreq_ctx->column_set_flags = 0;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _inetNetToMediaTable_set_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from "
+ "inetNetToMediaTable_set_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetNetToMediaTable_set_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit the values
+ */
+int
+_mfd_inetNetToMediaTable_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = inetNetToMediaTable_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from "
+ "inetNetToMediaTable_commit\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ /*
+ * if we successfully commited this row, set the dirty flag. Use the
+ * current value + 1 (i.e. dirty = # rows changed).
+ * this is checked in post_request...
+ */
+ inetNetToMediaTable_dirty_set(inetNetToMediaTable_dirty_get() + 1); /* set table dirty flag */
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+_mfd_inetNetToMediaTable_undo_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_undo_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ u_int d = inetNetToMediaTable_dirty_get();
+
+ netsnmp_assert(d != 0);
+ if (d)
+ inetNetToMediaTable_dirty_set(d - 1);
+ }
+
+ rc = inetNetToMediaTable_undo_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from "
+ "inetNetToMediaTable_undo_commit\n", rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ snmp_log(LOG_WARNING,
+ "inetNetToMediaTable row dirty flag still set after undo_commit\n");
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetNetToMediaTable_commit */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * undo the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_inetNetToMediaTable_undo_column(inetNetToMediaTable_rowreq_ctx *
+ rowreq_ctx, netsnmp_variable_list * var,
+ int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_undo_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * inetNetToMediaPhysAddress(4)/PhysAddress/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ case COLUMN_INETNETTOMEDIAPHYSADDRESS:
+ rc = inetNetToMediaPhysAddress_undo(rowreq_ctx);
+ break;
+
+ /*
+ * inetNetToMediaType(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_INETNETTOMEDIATYPE:
+ rc = inetNetToMediaType_undo(rowreq_ctx);
+ break;
+
+ /*
+ * inetNetToMediaRowStatus(8)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_INETNETTOMEDIAROWSTATUS:
+ rc = inetNetToMediaRowStatus_undo(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _inetNetToMediaTable_undo_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _inetNetToMediaTable_undo_column */
+
+int
+_mfd_inetNetToMediaTable_undo_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_undo_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = inetNetToMediaTable_undo(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from "
+ "inetNetToMediaTable_undo\n", rc));
+ }
+
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _inetNetToMediaTable_undo_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("inetNetToMediaTable:mfd", "error %d from "
+ "inetNetToMediaTable_undo_column\n", rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetNetToMediaTable_undo_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: irreversible commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit irreversible actions
+ */
+int
+_mfd_inetNetToMediaTable_irreversible_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info, netsnmp_request_info
+ *requests)
+{
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_mfd_inetNetToMediaTable_irreversible:commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * check for and handle row creation/deletion
+ * and update column exist flags...
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) {
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_CREATED))
+ CONTAINER_REMOVE(inetNetToMediaTable_if_ctx.container, rowreq_ctx);
+ } else {
+ if (rowreq_ctx->column_set_flags) {
+ rowreq_ctx->column_set_flags = 0;
+ }
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_CREATED;
+ CONTAINER_INSERT(inetNetToMediaTable_if_ctx.container,
+ rowreq_ctx);
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_inetNetToMediaTable_irreversible_commit */
+
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+static void _container_free(netsnmp_container *container);
+
+/**
+ * @internal
+ */
+static int
+_cache_load(netsnmp_cache * cache, void *vmagic)
+{
+ DEBUGTRACE;
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache for inetNetToMediaTable_cache_load\n");
+ return -1;
+ }
+ DEBUGMSGTL(("inetNetToMediaTable/cache", "inetNetToMedia_load %p/%p\n",
+ cache, cache->magic));
+
+ netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
+
+ /*
+ * call user code
+ */
+ return inetNetToMediaTable_container_load((netsnmp_container *) cache->
+ magic);
+} /* _cache_load */
+
+/**
+ * @internal
+ */
+static void
+_cache_free(netsnmp_cache * cache, void *magic)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_cache_free", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache in inetNetToMediaTable_cache_free\n");
+ return;
+ }
+
+ container = (netsnmp_container *) cache->magic;
+
+ _container_free(container);
+} /* _cache_free */
+
+/**
+ * @internal
+ */
+static void
+_container_item_free(inetNetToMediaTable_rowreq_ctx * rowreq_ctx,
+ void *context)
+{
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_container_item_free",
+ "called\n"));
+
+ if (NULL == rowreq_ctx)
+ return;
+
+ inetNetToMediaTable_release_rowreq_ctx(rowreq_ctx);
+} /* _container_item_free */
+
+/**
+ * @internal
+ */
+static void
+_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_container_free",
+ "called\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container in inetNetToMediaTable_container_free\n");
+ return;
+ }
+
+ /*
+ * call user code
+ */
+ inetNetToMediaTable_container_free(container);
+
+ /*
+ * free all items. inefficient, but easy.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func *) _container_item_free,
+ NULL);
+} /* _container_free */
+
+/**
+ * @internal
+ * initialize the container with functions or wrappers
+ */
+void
+_inetNetToMediaTable_container_init(inetNetToMediaTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_container_init", "called\n"));
+
+ /*
+ * cache init
+ */
+ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */
+ _cache_load, _cache_free,
+ inetNetToMediaTable_oid,
+ inetNetToMediaTable_oid_size);
+
+ if (NULL == if_ctx->cache) {
+ snmp_log(LOG_ERR,
+ "error creating cache for inetNetToMediaTable\n");
+ return;
+ }
+
+ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
+
+ inetNetToMediaTable_container_init(&if_ctx->container, if_ctx->cache);
+ if (NULL == if_ctx->container)
+ if_ctx->container =
+ netsnmp_container_find("inetNetToMediaTable:table_container");
+ if (NULL == if_ctx->container) {
+ snmp_log(LOG_ERR, "error creating container in "
+ "inetNetToMediaTable_container_init\n");
+ return;
+ }
+
+ if (NULL != if_ctx->cache)
+ if_ctx->cache->magic = (void *) if_ctx->container;
+} /* _inetNetToMediaTable_container_init */
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+_inetNetToMediaTable_container_shutdown(inetNetToMediaTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:inetNetToMediaTable:_inetNetToMediaTable_container_shutdown", "called\n"));
+
+ inetNetToMediaTable_container_shutdown(if_ctx->container);
+
+ _container_free(if_ctx->container);
+
+} /* _inetNetToMediaTable_container_shutdown */
+
+
+inetNetToMediaTable_rowreq_ctx *
+inetNetToMediaTable_row_find_by_mib_index(inetNetToMediaTable_mib_index *
+ mib_idx)
+{
+ inetNetToMediaTable_rowreq_ctx *rowreq_ctx;
+ oid oid_tmp[MAX_OID_LEN];
+ netsnmp_index oid_idx;
+ int rc;
+
+ /*
+ * set up storage for OID
+ */
+ oid_idx.oids = oid_tmp;
+ oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
+
+ /*
+ * convert
+ */
+ rc = inetNetToMediaTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx =
+ CONTAINER_FIND(inetNetToMediaTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface.h
new file mode 100644
index 0000000000..a111a23abe
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/inetNetToMediaTable/inetNetToMediaTable_interface.h
@@ -0,0 +1,103 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: inetNetToMediaTable_interface.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** @ingroup interface Routines to interface to Net-SNMP
+ *
+ * \warning This code should not be modified, called directly,
+ * or used to interpret functionality. It is subject to
+ * change at any time.
+ *
+ * @{
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+#ifndef INETNETTOMEDIATABLE_INTERFACE_H
+#define INETNETTOMEDIATABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "inetNetToMediaTable.h"
+
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void
+ _inetNetToMediaTable_initialize_interface
+ (inetNetToMediaTable_registration * user_ctx, u_long flags);
+ void
+ _inetNetToMediaTable_shutdown_interface
+ (inetNetToMediaTable_registration * user_ctx);
+
+ inetNetToMediaTable_registration
+ * inetNetToMediaTable_registration_get(void);
+
+ inetNetToMediaTable_registration
+ * inetNetToMediaTable_registration_set
+ (inetNetToMediaTable_registration * newreg);
+
+ netsnmp_container *inetNetToMediaTable_container_get(void);
+ int inetNetToMediaTable_container_size(void);
+
+ u_int inetNetToMediaTable_dirty_get(void);
+ void inetNetToMediaTable_dirty_set(u_int status);
+
+ inetNetToMediaTable_rowreq_ctx
+ * inetNetToMediaTable_allocate_rowreq_ctx(inetNetToMediaTable_data
+ *, void *);
+ void
+ inetNetToMediaTable_release_rowreq_ctx
+ (inetNetToMediaTable_rowreq_ctx * rowreq_ctx);
+
+ int inetNetToMediaTable_index_to_oid(netsnmp_index *
+ oid_idx,
+ inetNetToMediaTable_mib_index
+ * mib_idx);
+ int inetNetToMediaTable_index_from_oid(netsnmp_index *
+ oid_idx,
+ inetNetToMediaTable_mib_index
+ * mib_idx);
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void
+ inetNetToMediaTable_valid_columns_set(netsnmp_column_info *vc);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* INETNETTOMEDIATABLE_INTERFACE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable.h
new file mode 100644
index 0000000000..abfa1000c1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable.h
@@ -0,0 +1,5 @@
+/*
+ * module to include the modules
+ */
+
+config_require(ip-mib/ipAddressPrefixTable/ipAddressPrefixTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.c
new file mode 100644
index 0000000000..ecd26a050e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.c
@@ -0,0 +1,673 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: ipAddressPrefixTable.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** \page MFD helper for ipAddressPrefixTable
+ *
+ * \section intro Introduction
+ * Introductory text.
+ *
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipAddressPrefixTable.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "ipAddressPrefixTable_interface.h"
+
+oid ipAddressPrefixTable_oid[] = { IPADDRESSPREFIXTABLE_OID };
+int ipAddressPrefixTable_oid_size =
+OID_LENGTH(ipAddressPrefixTable_oid);
+
+ipAddressPrefixTable_registration ipAddressPrefixTable_user_context;
+
+void initialize_table_ipAddressPrefixTable(void);
+void shutdown_table_ipAddressPrefixTable(void);
+
+
+/**
+ * Initializes the ipAddressPrefixTable module
+ */
+void
+init_ipAddressPrefixTable(void)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:init_ipAddressPrefixTable",
+ "called\n"));
+
+ /*
+ * TODO:300:o: Perform ipAddressPrefixTable one-time module initialization.
+ */
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ if (should_init("ipAddressPrefixTable"))
+ initialize_table_ipAddressPrefixTable();
+
+} /* init_ipAddressPrefixTable */
+
+/**
+ * Shut-down the ipAddressPrefixTable module (agent is exiting)
+ */
+void
+shutdown_ipAddressPrefixTable(void)
+{
+ if (should_init("ipAddressPrefixTable"))
+ shutdown_table_ipAddressPrefixTable();
+
+}
+
+/**
+ * Initialize the table ipAddressPrefixTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_ipAddressPrefixTable(void)
+{
+ ipAddressPrefixTable_registration *user_context;
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:initialize_table_ipAddressPrefixTable", "called\n"));
+
+ /*
+ * TODO:301:o: Perform ipAddressPrefixTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize ipAddressPrefixTable user context
+ * if you'd like to pass in a pointer to some data for this
+ * table, allocate or set it up here.
+ */
+ /*
+ * a netsnmp_data_list is a simple way to store void pointers. A simple
+ * string token is used to add, find or remove pointers.
+ */
+ user_context =
+ netsnmp_create_data_list("ipAddressPrefixTable", NULL, NULL);
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _ipAddressPrefixTable_initialize_interface(user_context, flags);
+} /* initialize_table_ipAddressPrefixTable */
+
+/**
+ * Shutdown the table ipAddressPrefixTable
+ */
+void
+shutdown_table_ipAddressPrefixTable(void)
+{
+ /*
+ * call interface shutdown code
+ */
+ _ipAddressPrefixTable_shutdown_interface
+ (&ipAddressPrefixTable_user_context);
+}
+
+/**
+ * extra context initialization (eg default values)
+ *
+ * @param rowreq_ctx : row request context
+ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
+ *
+ * @retval MFD_SUCCESS : no errors
+ * @retval MFD_ERROR : error (context allocate will fail)
+ */
+int
+ipAddressPrefixTable_rowreq_ctx_init(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx, void *user_init_ctx)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_rowreq_ctx_init", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:210:o: |-> Perform extra ipAddressPrefixTable rowreq initialization. (eg DEFVALS)
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixTable_rowreq_ctx_init */
+
+/**
+ * extra context cleanup
+ *
+ */
+void
+ipAddressPrefixTable_rowreq_ctx_cleanup(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_rowreq_ctx_cleanup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:211:o: |-> Perform extra ipAddressPrefixTable rowreq cleanup.
+ */
+} /* ipAddressPrefixTable_rowreq_ctx_cleanup */
+
+/**
+ * pre-request callback
+ *
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+ipAddressPrefixTable_pre_request(ipAddressPrefixTable_registration *
+ user_context)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_pre_request", "called\n"));
+
+ /*
+ * TODO:510:o: Perform ipAddressPrefixTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ * Note:
+ * New rows have been inserted into the container, and
+ * deleted rows have been removed from the container and
+ * released.
+ *
+ * @param user_context
+ * @param rc : MFD_SUCCESS if all requests succeeded
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+ipAddressPrefixTable_post_request(ipAddressPrefixTable_registration *
+ user_context, int rc)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_post_request", "called\n"));
+
+ /*
+ * TODO:511:o: Perform ipAddressPrefixTable post-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixTable_post_request */
+
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressPrefixTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipAddressPrefixTable is subid 32 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.32, length: 8
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement ipAddressPrefixTable data context functions.
+ */
+
+
+/**
+ * set mib index(es)
+ *
+ * @param tbl_idx mib index structure
+ * @param ipAddressPrefixIfIndex_val
+ * @param ipAddressPrefixType_val
+ * @param ipAddressPrefixPrefix_val_ptr
+ * @param ipAddressPrefixPrefix_val_ptr_len
+ * @param ipAddressPrefixLength_val
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This convenience function is useful for setting all the MIB index
+ * components with a single function call. It is assume that the C values
+ * have already been mapped from their native/rawformat to the MIB format.
+ */
+int
+ipAddressPrefixTable_indexes_set_tbl_idx(ipAddressPrefixTable_mib_index *
+ tbl_idx,
+ long ipAddressPrefixIfIndex_val,
+ u_long ipAddressPrefixType_val,
+ char
+ *ipAddressPrefixPrefix_val_ptr,
+ size_t
+ ipAddressPrefixPrefix_val_ptr_len,
+ u_long ipAddressPrefixLength_val)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_indexes_set_tbl_idx", "called\n"));
+
+ /*
+ * ipAddressPrefixIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ tbl_idx->ipAddressPrefixIfIndex = ipAddressPrefixIfIndex_val;
+
+ /*
+ * ipAddressPrefixType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ tbl_idx->ipAddressPrefixType = ipAddressPrefixType_val;
+
+ /*
+ * ipAddressPrefixPrefix(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ tbl_idx->ipAddressPrefixPrefix_len = sizeof(tbl_idx->ipAddressPrefixPrefix) / sizeof(tbl_idx->ipAddressPrefixPrefix[0]); /* max length */
+ /*
+ * make sure there is enough space for ipAddressPrefixPrefix data
+ */
+ if ((NULL == tbl_idx->ipAddressPrefixPrefix) ||
+ (tbl_idx->ipAddressPrefixPrefix_len <
+ (ipAddressPrefixPrefix_val_ptr_len))) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->ipAddressPrefixPrefix_len = ipAddressPrefixPrefix_val_ptr_len;
+ memcpy(tbl_idx->ipAddressPrefixPrefix, ipAddressPrefixPrefix_val_ptr,
+ ipAddressPrefixPrefix_val_ptr_len *
+ sizeof(ipAddressPrefixPrefix_val_ptr[0]));
+
+ /*
+ * ipAddressPrefixLength(4)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ tbl_idx->ipAddressPrefixLength = ipAddressPrefixLength_val;
+
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixTable_indexes_set_tbl_idx */
+
+/**
+ * @internal
+ * set row context indexes
+ *
+ * @param reqreq_ctx the row context that needs updated indexes
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This function sets the mib indexs, then updates the oid indexs
+ * from the mib index.
+ */
+int
+ipAddressPrefixTable_indexes_set(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipAddressPrefixIfIndex_val,
+ u_long ipAddressPrefixType_val,
+ char *ipAddressPrefixPrefix_val_ptr,
+ size_t ipAddressPrefixPrefix_val_ptr_len,
+ u_long ipAddressPrefixLength_val)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_indexes_set", "called\n"));
+
+ if (MFD_SUCCESS !=
+ ipAddressPrefixTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
+ ipAddressPrefixIfIndex_val,
+ ipAddressPrefixType_val,
+ ipAddressPrefixPrefix_val_ptr,
+ ipAddressPrefixPrefix_val_ptr_len,
+ ipAddressPrefixLength_val))
+ return MFD_ERROR;
+
+ /*
+ * convert mib index to oid index
+ */
+ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
+ if (0 != ipAddressPrefixTable_index_to_oid(&rowreq_ctx->oid_idx,
+ &rowreq_ctx->tbl_idx)) {
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixTable_indexes_set */
+
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressPrefixEntry.ipAddressPrefixOrigin
+ * ipAddressPrefixOrigin is subid 5 of ipAddressPrefixEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.32.1.5
+ * Description:
+The origin of this prefix.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ * Enum range: 4/8. Values: other(1), manual(2), wellknown(3), dhcp(4), routeradv(5)
+ *
+ * Its syntax is IpAddressPrefixOriginTC (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ipAddressPrefixOrigin data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressPrefixOrigin_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipAddressPrefixOrigin_get(ipAddressPrefixTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipAddressPrefixOrigin_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressPrefixOrigin_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixOrigin_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressPrefixOrigin data.
+ * copy (* ipAddressPrefixOrigin_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipAddressPrefixOrigin_val_ptr) =
+ rowreq_ctx->data.ipAddressPrefixOrigin;
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixOrigin_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressPrefixEntry.ipAddressPrefixOnLinkFlag
+ * ipAddressPrefixOnLinkFlag is subid 6 of ipAddressPrefixEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.32.1.6
+ * Description:
+This object has the value 'true(1)', if this prefix can be
+ used for on-link determination and the value 'false(2)'
+ otherwise.
+
+
+ The default for IPv4 prefixes is 'true(1)'.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ * Enum range: 2/8. Values: true(1), false(2)
+ *
+ * Its syntax is TruthValue (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ipAddressPrefixOnLinkFlag data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressPrefixOnLinkFlag_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipAddressPrefixOnLinkFlag_get(ipAddressPrefixTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipAddressPrefixOnLinkFlag_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressPrefixOnLinkFlag_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixOnLinkFlag_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressPrefixOnLinkFlag data.
+ * copy (* ipAddressPrefixOnLinkFlag_val_ptr ) from rowreq_ctx->data
+ */
+ if (INETADDRESSTYPE_IPV4 == rowreq_ctx->tbl_idx.ipAddressPrefixType) {
+ (*ipAddressPrefixOnLinkFlag_val_ptr) = 1; /* per MIB */
+ } else
+ (*ipAddressPrefixOnLinkFlag_val_ptr) =
+ rowreq_ctx->data.ipAddressPrefixOnLinkFlag;
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixOnLinkFlag_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressPrefixEntry.ipAddressPrefixAutonomousFlag
+ * ipAddressPrefixAutonomousFlag is subid 7 of ipAddressPrefixEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.32.1.7
+ * Description:
+Autonomous address configuration flag. When true(1),
+ indicates that this prefix can be used for autonomous
+ address configuration (i.e. can be used to form a local
+ interface address). If false(2), it is not used to auto-
+ configure a local interface address.
+
+
+ The default for IPv4 prefixes is 'false(2)'.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ * Enum range: 2/8. Values: true(1), false(2)
+ *
+ * Its syntax is TruthValue (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ipAddressPrefixAutonomousFlag data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressPrefixAutonomousFlag_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipAddressPrefixAutonomousFlag_get(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipAddressPrefixAutonomousFlag_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressPrefixAutonomousFlag_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixAutonomousFlag_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressPrefixAutonomousFlag data.
+ * copy (* ipAddressPrefixAutonomousFlag_val_ptr ) from rowreq_ctx->data
+ */
+ if (INETADDRESSTYPE_IPV4 == rowreq_ctx->tbl_idx.ipAddressPrefixType)
+ (*ipAddressPrefixAutonomousFlag_val_ptr) = 2; /* per MIB */
+ else
+ (*ipAddressPrefixAutonomousFlag_val_ptr) =
+ rowreq_ctx->data.ipAddressPrefixAutonomousFlag;
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixAutonomousFlag_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressPrefixEntry.ipAddressPrefixAdvPreferredLifetime
+ * ipAddressPrefixAdvPreferredLifetime is subid 8 of ipAddressPrefixEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.32.1.8
+ * Description:
+The remaining length of time in seconds that this prefix
+ will continue to be preferred, i.e. time until deprecation.
+
+
+
+
+ A value of 4,294,967,295 represents infinity.
+
+
+ The address generated from a deprecated prefix should no
+ longer be used as a source address in new communications,
+ but packets received on such an interface are processed as
+ expected.
+
+
+ The default for IPv4 prefixes is 4,294,967,295 (infinity).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32)
+ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipAddressPrefixAdvPreferredLifetime data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressPrefixAdvPreferredLifetime_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipAddressPrefixAdvPreferredLifetime_get(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipAddressPrefixAdvPreferredLifetime_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressPrefixAdvPreferredLifetime_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixAdvPreferredLifetime_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressPrefixAdvPreferredLifetime data.
+ * copy (* ipAddressPrefixAdvPreferredLifetime_val_ptr ) from rowreq_ctx->data
+ */
+ if (INETADDRESSTYPE_IPV4 == rowreq_ctx->tbl_idx.ipAddressPrefixType)
+ (*ipAddressPrefixAdvPreferredLifetime_val_ptr) = 4294967295; /* per MIB */
+ else
+ (*ipAddressPrefixAdvPreferredLifetime_val_ptr) =
+ rowreq_ctx->data.ipAddressPrefixAdvPreferredLifetime;
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixAdvPreferredLifetime_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressPrefixEntry.ipAddressPrefixAdvValidLifetime
+ * ipAddressPrefixAdvValidLifetime is subid 9 of ipAddressPrefixEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.32.1.9
+ * Description:
+The remaining length of time, in seconds, that this prefix
+ will continue to be valid, i.e. time until invalidation. A
+ value of 4,294,967,295 represents infinity.
+
+
+ The address generated from an invalidated prefix should not
+ appear as the destination or source address of a packet.
+
+
+ The default for IPv4 prefixes is 4,294,967,295 (infinity).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32)
+ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipAddressPrefixAdvValidLifetime data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressPrefixAdvValidLifetime_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipAddressPrefixAdvValidLifetime_get(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipAddressPrefixAdvValidLifetime_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressPrefixAdvValidLifetime_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixAdvValidLifetime_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressPrefixAdvValidLifetime data.
+ * copy (* ipAddressPrefixAdvValidLifetime_val_ptr ) from rowreq_ctx->data
+ */
+ if (INETADDRESSTYPE_IPV4 == rowreq_ctx->tbl_idx.ipAddressPrefixType)
+ (*ipAddressPrefixAdvValidLifetime_val_ptr) = 4294967295; /* per MIB */
+ else
+ (*ipAddressPrefixAdvValidLifetime_val_ptr) =
+ rowreq_ctx->data.ipAddressPrefixAdvValidLifetime;
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixAdvValidLifetime_get */
+
+
+
+/** @} */
+/** @} */
+/** @{ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.h
new file mode 100644
index 0000000000..5030f98fa2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable.h
@@ -0,0 +1,316 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: ipAddressPrefixTable.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+#ifndef IPADDRESSPREFIXTABLE_H
+#define IPADDRESSPREFIXTABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @addtogroup misc misc: Miscellaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+
+ /*
+ * other required module components
+ */
+ /* *INDENT-OFF* */
+config_require(ip-mib/ipAddressTable/ipAddressTable)
+config_require(ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface)
+config_require(ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access)
+ /* *INDENT-ON* */
+
+ /*
+ * OID, column number and enum definions for ipAddressPrefixTable
+ */
+#include "ipAddressPrefixTable_constants.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_ipAddressPrefixTable(void);
+ void shutdown_ipAddressPrefixTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressPrefixTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipAddressPrefixTable is subid 32 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.32, length: 8
+ */
+ /*
+ *********************************************************************
+ * When you register your mib, you get to provide a generic
+ * pointer that will be passed back to you for most of the
+ * functions calls.
+ *
+ * TODO:100:r: Review all context structures
+ */
+ /*
+ * TODO:101:o: |-> Review ipAddressPrefixTable registration context.
+ */
+ typedef netsnmp_data_list ipAddressPrefixTable_registration;
+
+/**********************************************************************/
+ /*
+ * TODO:110:r: |-> Review ipAddressPrefixTable data context structure.
+ * This structure is used to represent the data for ipAddressPrefixTable.
+ */
+ /*
+ * This structure contains storage for all the columns defined in the
+ * ipAddressPrefixTable.
+ */
+ typedef struct ipAddressPrefixTable_data_s {
+
+ /*
+ * ipAddressPrefixOrigin(5)/IpAddressPrefixOriginTC/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ u_long ipAddressPrefixOrigin;
+
+ /*
+ * ipAddressPrefixOnLinkFlag(6)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ u_long ipAddressPrefixOnLinkFlag;
+
+ /*
+ * ipAddressPrefixAutonomousFlag(7)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ u_long ipAddressPrefixAutonomousFlag;
+
+ /*
+ * ipAddressPrefixAdvPreferredLifetime(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ u_long ipAddressPrefixAdvPreferredLifetime;
+
+ /*
+ * ipAddressPrefixAdvValidLifetime(9)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ u_long ipAddressPrefixAdvValidLifetime;
+
+ } ipAddressPrefixTable_data;
+
+
+ /*
+ * TODO:120:r: |-> Review ipAddressPrefixTable mib index.
+ * This structure is used to represent the index for ipAddressPrefixTable.
+ */
+ typedef struct ipAddressPrefixTable_mib_index_s {
+
+ /*
+ * ipAddressPrefixIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ long ipAddressPrefixIfIndex;
+
+ /*
+ * ipAddressPrefixType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ u_long ipAddressPrefixType;
+
+ /*
+ * ipAddressPrefixPrefix(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ /** 128 - 3(other indexes) - oid length(10) = 114 */
+ char ipAddressPrefixPrefix[114];
+ size_t ipAddressPrefixPrefix_len;
+
+ /*
+ * ipAddressPrefixLength(4)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ u_long ipAddressPrefixLength;
+
+
+ } ipAddressPrefixTable_mib_index;
+
+ /*
+ * TODO:121:r: | |-> Review ipAddressPrefixTable max index length.
+ * If you KNOW that your indexes will never exceed a certain
+ * length, update this macro to that length.
+ *
+ * BE VERY CAREFUL TO TAKE INTO ACCOUNT THE MAXIMUM
+ * POSSIBLE LENGHT FOR EVERY VARIABLE LENGTH INDEX!
+ * Guessing 128 - col/entry(2) - oid len(8)
+ */
+#define MAX_ipAddressPrefixTable_IDX_LEN 118
+
+
+ /*
+ *********************************************************************
+ * TODO:130:o: |-> Review ipAddressPrefixTable Row request (rowreq) context.
+ * When your functions are called, you will be passed a
+ * ipAddressPrefixTable_rowreq_ctx pointer.
+ */
+ typedef struct ipAddressPrefixTable_rowreq_ctx_s {
+
+ /** this must be first for container compare to work */
+ netsnmp_index oid_idx;
+ oid oid_tmp[MAX_ipAddressPrefixTable_IDX_LEN];
+
+ ipAddressPrefixTable_mib_index tbl_idx;
+
+ ipAddressPrefixTable_data data;
+
+ /*
+ * flags per row. Currently, the first (lower) 8 bits are reserved
+ * for the user. See mfd.h for other flags.
+ */
+ u_int rowreq_flags;
+
+ /*
+ * TODO:131:o: | |-> Add useful data to ipAddressPrefixTable rowreq context.
+ */
+
+ /*
+ * storage for future expansion
+ */
+ netsnmp_data_list *ipAddressPrefixTable_data_list;
+
+ } ipAddressPrefixTable_rowreq_ctx;
+
+ typedef struct ipAddressPrefixTable_ref_rowreq_ctx_s {
+ ipAddressPrefixTable_rowreq_ctx *rowreq_ctx;
+ } ipAddressPrefixTable_ref_rowreq_ctx;
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int
+ ipAddressPrefixTable_pre_request(ipAddressPrefixTable_registration
+ * user_context);
+ int
+ ipAddressPrefixTable_post_request(ipAddressPrefixTable_registration
+ * user_context, int rc);
+
+ int
+ ipAddressPrefixTable_rowreq_ctx_init
+ (ipAddressPrefixTable_rowreq_ctx * rowreq_ctx,
+ void *user_init_ctx);
+ void
+ ipAddressPrefixTable_rowreq_ctx_cleanup
+ (ipAddressPrefixTable_rowreq_ctx * rowreq_ctx);
+
+
+ ipAddressPrefixTable_rowreq_ctx
+ * ipAddressPrefixTable_row_find_by_mib_index
+ (ipAddressPrefixTable_mib_index * mib_idx);
+
+ extern oid ipAddressPrefixTable_oid[];
+ extern int ipAddressPrefixTable_oid_size;
+
+
+#include "ipAddressPrefixTable_interface.h"
+#include "ipAddressPrefixTable_data_access.h"
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressPrefixTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipAddressPrefixTable is subid 32 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.32, length: 8
+ */
+ /*
+ * indexes
+ */
+
+ int
+ ipAddressPrefixOrigin_get(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long * ipAddressPrefixOrigin_val_ptr);
+ int
+ ipAddressPrefixOnLinkFlag_get(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipAddressPrefixOnLinkFlag_val_ptr);
+ int
+ ipAddressPrefixAutonomousFlag_get(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipAddressPrefixAutonomousFlag_val_ptr);
+ int
+ ipAddressPrefixAdvPreferredLifetime_get
+ (ipAddressPrefixTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipAddressPrefixAdvPreferredLifetime_val_ptr);
+ int
+ ipAddressPrefixAdvValidLifetime_get(ipAddressPrefixTable_rowreq_ctx
+ * rowreq_ctx,
+ u_long *
+ ipAddressPrefixAdvValidLifetime_val_ptr);
+
+
+ int
+ ipAddressPrefixTable_indexes_set_tbl_idx
+ (ipAddressPrefixTable_mib_index * tbl_idx,
+ long ipAddressPrefixIfIndex_val, u_long ipAddressPrefixType_val,
+ char *ipAddressPrefixPrefix_val_ptr,
+ size_t ipAddressPrefixPrefix_val_ptr_len,
+ u_long ipAddressPrefixLength_val);
+ int
+ ipAddressPrefixTable_indexes_set(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipAddressPrefixIfIndex_val,
+ u_long ipAddressPrefixType_val,
+ char
+ *ipAddressPrefixPrefix_val_ptr,
+ size_t
+ ipAddressPrefixPrefix_val_ptr_len,
+ u_long ipAddressPrefixLength_val);
+
+
+
+ /*
+ *********************************************************************
+ * SET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * SET Table declarations
+ */
+
+
+ /*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPADDRESSPREFIXTABLE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_constants.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_constants.h
new file mode 100644
index 0000000000..d9c0cb0e61
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_constants.h
@@ -0,0 +1,139 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $
+ *
+ * $Id: ipAddressPrefixTable_constants.h 13763 2005-12-01 15:49:39Z rstory $
+ */
+#ifndef IPADDRESSPREFIXTABLE_CONSTANTS_H
+#define IPADDRESSPREFIXTABLE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ * column number definitions for table ipAddressPrefixTable
+ */
+#define IPADDRESSPREFIXTABLE_OID 1,3,6,1,2,1,4,32
+
+#define COLUMN_IPADDRESSPREFIXIFINDEX 1
+
+#define COLUMN_IPADDRESSPREFIXTYPE 2
+
+#define COLUMN_IPADDRESSPREFIXPREFIX 3
+
+#define COLUMN_IPADDRESSPREFIXLENGTH 4
+
+#define COLUMN_IPADDRESSPREFIXORIGIN 5
+
+#define COLUMN_IPADDRESSPREFIXONLINKFLAG 6
+
+#define COLUMN_IPADDRESSPREFIXAUTONOMOUSFLAG 7
+
+#define COLUMN_IPADDRESSPREFIXADVPREFERREDLIFETIME 8
+
+#define COLUMN_IPADDRESSPREFIXADVVALIDLIFETIME 9
+
+
+#define IPADDRESSPREFIXTABLE_MIN_COL COLUMN_IPADDRESSPREFIXORIGIN
+#define IPADDRESSPREFIXTABLE_MAX_COL COLUMN_IPADDRESSPREFIXADVVALIDLIFETIME
+
+
+ /*
+ * NOTES on enums
+ * ==============
+ *
+ * Value Mapping
+ * -------------
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them
+ * below. For example, a boolean flag (1/0) is usually represented
+ * as a TruthValue in a MIB, which maps to the values (1/2).
+ *
+ */
+/*************************************************************************
+ *************************************************************************
+ *
+ * enum definitions for table ipAddressPrefixTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipAddressPrefixType (InetAddressType / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef INETADDRESSTYPE_ENUMS
+#define INETADDRESSTYPE_ENUMS
+
+#define INETADDRESSTYPE_UNKNOWN 0
+#define INETADDRESSTYPE_IPV4 1
+#define INETADDRESSTYPE_IPV6 2
+#define INETADDRESSTYPE_IPV4Z 3
+#define INETADDRESSTYPE_IPV6Z 4
+#define INETADDRESSTYPE_DNS 16
+
+#endif /* INETADDRESSTYPE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipAddressPrefixOrigin (IpAddressPrefixOriginTC / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef IPADDRESSPREFIXORIGINTC_ENUMS
+#define IPADDRESSPREFIXORIGINTC_ENUMS
+
+#define IPADDRESSPREFIXORIGINTC_OTHER 1
+#define IPADDRESSPREFIXORIGINTC_MANUAL 2
+#define IPADDRESSPREFIXORIGINTC_WELLKNOWN 3
+#define IPADDRESSPREFIXORIGINTC_DHCP 4
+#define IPADDRESSPREFIXORIGINTC_ROUTERADV 5
+
+#endif /* IPADDRESSPREFIXORIGINTC_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipAddressPrefixOnLinkFlag (TruthValue / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef TRUTHVALUE_ENUMS
+#define TRUTHVALUE_ENUMS
+
+#define TRUTHVALUE_TRUE 1
+#define TRUTHVALUE_FALSE 2
+
+#endif /* TRUTHVALUE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipAddressPrefixAutonomousFlag (TruthValue / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef TRUTHVALUE_ENUMS
+#define TRUTHVALUE_ENUMS
+
+#define TRUTHVALUE_TRUE 1
+#define TRUTHVALUE_FALSE 2
+
+#endif /* TRUTHVALUE_ENUMS */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPADDRESSPREFIXTABLE_OIDS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.c
new file mode 100644
index 0000000000..4cda4de3cd
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.c
@@ -0,0 +1,353 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: ipAddressPrefixTable_data_access.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipAddressPrefixTable.h"
+
+
+#include "ipAddressPrefixTable_data_access.h"
+
+#include "ip-mib/ipAddressTable/ipAddressTable.h"
+
+/** @ingroup interface
+ * @addtogroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressPrefixTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipAddressPrefixTable is subid 32 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.32, length: 8
+ */
+
+/**
+ * initialization for ipAddressPrefixTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param ipAddressPrefixTable_reg
+ * Pointer to ipAddressPrefixTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+ipAddressPrefixTable_init_data(ipAddressPrefixTable_registration *
+ ipAddressPrefixTable_reg)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_init_data", "called\n"));
+
+ /*
+ * TODO:303:o: Initialize ipAddressPrefixTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixTable_init_data */
+
+/**
+ * container overview
+ *
+ */
+
+/**
+ * container initialization
+ *
+ * @param container_ptr_ptr A pointer to a container pointer. If you
+ * create a custom container, use this parameter to return it
+ * to the MFD helper. If set to NULL, the MFD helper will
+ * allocate a container for you.
+ * @param cache A pointer to a cache structure. You can set the timeout
+ * and other cache flags using this pointer.
+ *
+ * This function is called at startup to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases. If no custom
+ * container is allocated, the MFD code will create one for your.
+ *
+ * This is also the place to set up cache behavior. The default, to
+ * simply set the cache timeout, will work well with the default
+ * container. If you are using a custom container, you may want to
+ * look at the cache helper documentation to see if there are any
+ * flags you want to set.
+ *
+ * @remark
+ * This would also be a good place to do any initialization needed
+ * for you data source. For example, opening a connection to another
+ * process that will supply the data, opening a database, etc.
+ */
+void
+ipAddressPrefixTable_container_init(netsnmp_container **container_ptr_ptr,
+ netsnmp_cache * cache)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_container_init", "called\n"));
+
+ if (NULL == container_ptr_ptr) {
+ snmp_log(LOG_ERR,
+ "bad container param to ipAddressPrefixTable_container_init\n");
+ return;
+ }
+
+ /*
+ * For advanced users, you can use a custom container. If you
+ * do not create one, one will be created for you.
+ */
+ *container_ptr_ptr = NULL;
+
+ if (NULL == cache) {
+ snmp_log(LOG_ERR,
+ "bad cache param to ipAddressPrefixTable_container_init\n");
+ return;
+ }
+
+ /*
+ * TODO:345:A: Set up ipAddressPrefixTable cache properties.
+ *
+ * Also for advanced users, you can set parameters for the
+ * cache. Do not change the magic pointer, as it is used
+ * by the MFD helper. To completely disable caching, set
+ * cache->enabled to 0.
+ */
+ cache->timeout = IPADDRESSPREFIXTABLE_CACHE_TIMEOUT; /* seconds */
+} /* ipAddressPrefixTable_container_init */
+
+/**
+ * container shutdown
+ *
+ * @param container_ptr A pointer to the container.
+ *
+ * This function is called at shutdown to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases.
+ *
+ * This function is called before ipAddressPrefixTable_container_free().
+ *
+ * @remark
+ * This would also be a good place to do any cleanup needed
+ * for you data source. For example, closing a connection to another
+ * process that supplied the data, closing a database, etc.
+ */
+void
+ipAddressPrefixTable_container_shutdown(netsnmp_container *container_ptr)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_container_shutdown", "called\n"));
+
+ if (NULL == container_ptr) {
+ snmp_log(LOG_ERR,
+ "bad params to ipAddressPrefixTable_container_shutdown\n");
+ return;
+ }
+
+} /* ipAddressPrefixTable_container_shutdown */
+
+/**
+ * load initial data
+ *
+ * TODO:350:M: Implement ipAddressPrefixTable data load
+ * This function will also be called by the cache helper to load
+ * the container again (after the container free function has been
+ * called to free the previous contents).
+ *
+ * @param container container to which items should be inserted
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
+ * @retval MFD_ERROR : other error.
+ *
+ * This function is called to load the index(es) (and data, optionally)
+ * for the every row in the data set.
+ *
+ * @remark
+ * While loading the data, the only important thing is the indexes.
+ * If access to your data is cheap/fast (e.g. you have a pointer to a
+ * structure in memory), it would make sense to update the data here.
+ * If, however, the accessing the data invovles more work (e.g. parsing
+ * some other existing data, or peforming calculations to derive the data),
+ * then you can limit yourself to setting the indexes and saving any
+ * information you will need later. Then use the saved information in
+ * ipAddressPrefixTable_row_prep() for populating data.
+ *
+ * @note
+ * If you need consistency between rows (like you want statistics
+ * for each row to be from the same time frame), you should set all
+ * data here.
+ *
+ */
+int
+ipAddressPrefixTable_container_load(netsnmp_container *container)
+{
+ ipAddressPrefixTable_rowreq_ctx *rowreq_ctx = NULL, *tmp_rowreq_ctx;
+ ipAddressTable_rowreq_ctx *addr_rowreq_ctx;
+ netsnmp_container *addr_container;
+ netsnmp_iterator *addr_it;
+ size_t count = 0;
+ u_char tmp_pfx[NETSNMP_ACCESS_IPADDRESS_BUF_SIZE];
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_container_load", "called\n"));
+
+ addr_container = ipAddressTable_container_get();
+ if (NULL == addr_container) {
+ DEBUGMSGTL(("ipAddressPrefixTable:container_load",
+ "couldn't get ipAddress container\n"));
+ return MFD_RESOURCE_UNAVAILABLE;
+ }
+
+ addr_it = CONTAINER_ITERATOR(addr_container);
+ if (NULL == addr_container) {
+ DEBUGMSGTL(("ipAddressPrefixTable:container_load",
+ "couldn't get ipAddress iterator\n"));
+ return MFD_RESOURCE_UNAVAILABLE;
+ }
+
+ /*
+ * TODO:351:M: |-> Load/update data in the ipAddressPrefixTable container.
+ * loop over your ipAddressPrefixTable data, allocate a rowreq context,
+ * set the index(es) [and data, optionally] and insert into
+ * the container.
+ */
+ for (addr_rowreq_ctx = ITERATOR_FIRST(addr_it);
+ addr_rowreq_ctx; addr_rowreq_ctx = ITERATOR_NEXT(addr_it)) {
+
+
+
+ /*
+ * TODO:352:M: | |-> set indexes in new ipAddressPrefixTable rowreq context.
+ * data context will be set from the param (unless NULL,
+ * in which case a new data context will be allocated)
+ */
+ if (NULL == rowreq_ctx) {
+ rowreq_ctx = ipAddressPrefixTable_allocate_rowreq_ctx(NULL);
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "memory allocation failed\n");
+ return MFD_RESOURCE_UNAVAILABLE;
+ }
+ }
+ netsnmp_ipaddress_prefix_copy(tmp_pfx,
+ addr_rowreq_ctx->tbl_idx.
+ ipAddressAddr,
+ addr_rowreq_ctx->data->
+ ia_address_len,
+ addr_rowreq_ctx->data->
+ ia_prefix_len);
+ if (MFD_SUCCESS !=
+ ipAddressPrefixTable_indexes_set(rowreq_ctx,
+ addr_rowreq_ctx->data->
+ if_index,
+ addr_rowreq_ctx->tbl_idx.
+ ipAddressAddrType, tmp_pfx,
+ addr_rowreq_ctx->data->
+ ia_address_len,
+ addr_rowreq_ctx->data->
+ ia_prefix_len)) {
+ snmp_log(LOG_ERR,
+ "error setting index while loading "
+ "ipAddressPrefixTable data.\n");
+ ipAddressPrefixTable_release_rowreq_ctx(rowreq_ctx);
+ continue;
+ }
+
+ /** do we already have this prefix? */
+ tmp_rowreq_ctx = CONTAINER_FIND(container, rowreq_ctx);
+ if (NULL != tmp_rowreq_ctx)
+ continue;
+
+ /*
+ * TODO:352:r: | |-> populate ipAddressPrefixTable data context.
+ * Populate data context here. (optionally, delay until row prep)
+ */
+ rowreq_ctx->data.ipAddressPrefixOrigin =
+ addr_rowreq_ctx->data->ia_origin;
+
+ /** defer the rest til row prep */
+
+ /*
+ * insert into table container, clear ptr so we reallocate
+ */
+ CONTAINER_INSERT(container, rowreq_ctx);
+ rowreq_ctx = NULL;
+ ++count;
+ }
+
+ DEBUGMSGT(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_container_load", "inserted %d records\n", count));
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixTable_container_load */
+
+/**
+ * container clean up
+ *
+ * @param container container with all current items
+ *
+ * This optional callback is called prior to all
+ * item's being removed from the container. If you
+ * need to do any processing before that, do it here.
+ *
+ * @note
+ * The MFD helper will take care of releasing all the row contexts.
+ *
+ */
+void
+ipAddressPrefixTable_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_container_free", "called\n"));
+
+ /*
+ * TODO:380:M: Free ipAddressPrefixTable container data.
+ */
+} /* ipAddressPrefixTable_container_free */
+
+/**
+ * prepare row for processing.
+ *
+ * When the agent has located the row for a request, this function is
+ * called to prepare the row for processing. If you fully populated
+ * the data context during the index setup phase, you may not need to
+ * do anything.
+ *
+ * @param rowreq_ctx pointer to a context.
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ */
+int
+ipAddressPrefixTable_row_prep(ipAddressPrefixTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_row_prep", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+ if (INETADDRESSTYPE_IPV6 == rowreq_ctx->tbl_idx.ipAddressPrefixType) {
+
+ }
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefixTable_row_prep */
+
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.h
new file mode 100644
index 0000000000..4f20577320
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_data_access.h
@@ -0,0 +1,76 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: ipAddressPrefixTable_data_access.h 13763 2005-12-01 15:49:39Z rstory $
+ */
+#ifndef IPADDRESSPREFIXTABLE_DATA_ACCESS_H
+#define IPADDRESSPREFIXTABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressPrefixTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipAddressPrefixTable is subid 32 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.32, length: 8
+ */
+
+
+ int
+ ipAddressPrefixTable_init_data(ipAddressPrefixTable_registration *
+ ipAddressPrefixTable_reg);
+
+
+ /*
+ * TODO:180:o: Review ipAddressPrefixTable cache timeout.
+ * The number of seconds before the cache times out
+ */
+#define IPADDRESSPREFIXTABLE_CACHE_TIMEOUT 60
+
+ void ipAddressPrefixTable_container_init(netsnmp_container
+ **container_ptr_ptr,
+ netsnmp_cache *
+ cache);
+ void
+ ipAddressPrefixTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int ipAddressPrefixTable_container_load(netsnmp_container
+ *container);
+ void ipAddressPrefixTable_container_free(netsnmp_container
+ *container);
+
+ int ipAddressPrefixTable_cache_load(netsnmp_container
+ *container);
+ void ipAddressPrefixTable_cache_free(netsnmp_container
+ *container);
+
+ int
+ ipAddressPrefixTable_row_prep(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPADDRESSPREFIXTABLE_DATA_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.c
new file mode 100644
index 0000000000..7159836ba4
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.c
@@ -0,0 +1,1038 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: ipAddressPrefixTable_interface.c 15015 2006-08-17 15:06:43Z rstory $
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipAddressPrefixTable.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "ipAddressPrefixTable_interface.h"
+
+#include <ctype.h>
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressPrefixTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipAddressPrefixTable is subid 32 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.32, length: 8
+ */
+typedef struct ipAddressPrefixTable_interface_ctx_s {
+
+ netsnmp_container *container;
+ netsnmp_cache *cache;
+
+ ipAddressPrefixTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+} ipAddressPrefixTable_interface_ctx;
+
+static ipAddressPrefixTable_interface_ctx ipAddressPrefixTable_if_ctx;
+
+static void
+ _ipAddressPrefixTable_container_init(ipAddressPrefixTable_interface_ctx *
+ if_ctx);
+static void
+ _ipAddressPrefixTable_container_shutdown(ipAddressPrefixTable_interface_ctx
+ * if_ctx);
+
+
+netsnmp_container *
+ipAddressPrefixTable_container_get(void)
+{
+ return ipAddressPrefixTable_if_ctx.container;
+}
+
+ipAddressPrefixTable_registration *
+ipAddressPrefixTable_registration_get(void)
+{
+ return ipAddressPrefixTable_if_ctx.user_ctx;
+}
+
+ipAddressPrefixTable_registration *
+ipAddressPrefixTable_registration_set(ipAddressPrefixTable_registration *
+ newreg)
+{
+ ipAddressPrefixTable_registration *old =
+ ipAddressPrefixTable_if_ctx.user_ctx;
+ ipAddressPrefixTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+
+int
+ipAddressPrefixTable_container_size(void)
+{
+ return CONTAINER_SIZE(ipAddressPrefixTable_if_ctx.container);
+}
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_ipAddressPrefixTable_pre_request;
+static Netsnmp_Node_Handler _mfd_ipAddressPrefixTable_post_request;
+static Netsnmp_Node_Handler _mfd_ipAddressPrefixTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_ipAddressPrefixTable_get_values;
+/**
+ * @internal
+ * Initialize the table ipAddressPrefixTable
+ * (Define its contents and how it's structured)
+ */
+void
+ _ipAddressPrefixTable_initialize_interface
+ (ipAddressPrefixTable_registration * reg_ptr, u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &ipAddressPrefixTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info =
+ &ipAddressPrefixTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_ipAddressPrefixTable_initialize_interface", "called\n"));
+
+
+ /*************************************************
+ *
+ * save interface context for ipAddressPrefixTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
+ /** index: ipAddressPrefixIfIndex */
+ ASN_INTEGER,
+ /** index: ipAddressPrefixType */
+ ASN_OCTET_STR,
+ /** index: ipAddressPrefixPrefix */
+ ASN_UNSIGNED,
+ /** index: ipAddressPrefixLength */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrival.
+ */
+ tbl_info->min_column = IPADDRESSPREFIXTABLE_MIN_COL;
+ tbl_info->max_column = IPADDRESSPREFIXTABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ ipAddressPrefixTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ ipAddressPrefixTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _ipAddressPrefixTable_container_init(&ipAddressPrefixTable_if_ctx);
+ if (NULL == ipAddressPrefixTable_if_ctx.container) {
+ snmp_log(LOG_ERR,
+ "could not initialize container for ipAddressPrefixTable\n");
+ return;
+ }
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup =
+ _mfd_ipAddressPrefixTable_object_lookup;
+ access_multiplexer->get_values = _mfd_ipAddressPrefixTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request =
+ _mfd_ipAddressPrefixTable_pre_request;
+ access_multiplexer->post_request =
+ _mfd_ipAddressPrefixTable_post_request;
+
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("ipAddressPrefixTable:init_ipAddressPrefixTable",
+ "Registering ipAddressPrefixTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("ipAddressPrefixTable",
+ handler,
+ ipAddressPrefixTable_oid,
+ ipAddressPrefixTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RONLY);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR,
+ "error registering table ipAddressPrefixTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &ipAddressPrefixTable_if_ctx;
+
+ /*************************************************
+ *
+ * set up baby steps handler, create it and inject it
+ */
+ if (access_multiplexer->object_lookup)
+ mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
+ if (access_multiplexer->set_values)
+ mfd_modes |= BABY_STEP_SET_VALUES;
+ if (access_multiplexer->irreversible_commit)
+ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
+ if (access_multiplexer->object_syntax_checks)
+ mfd_modes |= BABY_STEP_CHECK_OBJECT;
+
+ if (access_multiplexer->pre_request)
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if (access_multiplexer->post_request)
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+ if (access_multiplexer->undo_setup)
+ mfd_modes |= BABY_STEP_UNDO_SETUP;
+ if (access_multiplexer->undo_cleanup)
+ mfd_modes |= BABY_STEP_UNDO_CLEANUP;
+ if (access_multiplexer->undo_sets)
+ mfd_modes |= BABY_STEP_UNDO_SETS;
+
+ if (access_multiplexer->row_creation)
+ mfd_modes |= BABY_STEP_ROW_CREATE;
+ if (access_multiplexer->consistency_checks)
+ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
+ if (access_multiplexer->commit)
+ mfd_modes |= BABY_STEP_COMMIT;
+ if (access_multiplexer->undo_commit)
+ mfd_modes |= BABY_STEP_UNDO_COMMIT;
+
+ handler = netsnmp_baby_steps_handler_get(mfd_modes);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
+ */
+ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler =
+ netsnmp_container_table_handler_get(tbl_info,
+ ipAddressPrefixTable_if_ctx.
+ container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject cache helper
+ */
+ if (NULL != ipAddressPrefixTable_if_ctx.cache) {
+ handler =
+ netsnmp_cache_handler_get(ipAddressPrefixTable_if_ctx.cache);
+ netsnmp_inject_handler(reginfo, handler);
+ }
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+} /* _ipAddressPrefixTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table ipAddressPrefixTable
+ */
+void
+_ipAddressPrefixTable_shutdown_interface(ipAddressPrefixTable_registration
+ * reg_ptr)
+{
+ /*
+ * shutdown the container
+ */
+ _ipAddressPrefixTable_container_shutdown(&ipAddressPrefixTable_if_ctx);
+}
+
+void
+ipAddressPrefixTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ ipAddressPrefixTable_if_ctx.tbl_info.valid_columns = vc;
+} /* ipAddressPrefixTable_valid_columns_set */
+
+/**
+ * @internal
+ * convert the index component stored in the context to an oid
+ */
+int
+ipAddressPrefixTable_index_to_oid(netsnmp_index * oid_idx,
+ ipAddressPrefixTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * ipAddressPrefixIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_ipAddressPrefixIfIndex;
+ /*
+ * ipAddressPrefixType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_ipAddressPrefixType;
+ /*
+ * ipAddressPrefixPrefix(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_ipAddressPrefixPrefix;
+ /*
+ * ipAddressPrefixLength(4)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_ipAddressPrefixLength;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_ipAddressPrefixIfIndex, 0x00,
+ sizeof(var_ipAddressPrefixIfIndex));
+ var_ipAddressPrefixIfIndex.type = ASN_INTEGER;
+ memset(&var_ipAddressPrefixType, 0x00,
+ sizeof(var_ipAddressPrefixType));
+ var_ipAddressPrefixType.type = ASN_INTEGER;
+ memset(&var_ipAddressPrefixPrefix, 0x00,
+ sizeof(var_ipAddressPrefixPrefix));
+ var_ipAddressPrefixPrefix.type = ASN_OCTET_STR;
+ memset(&var_ipAddressPrefixLength, 0x00,
+ sizeof(var_ipAddressPrefixLength));
+ var_ipAddressPrefixLength.type = ASN_UNSIGNED;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_ipAddressPrefixIfIndex.next_variable = &var_ipAddressPrefixType;
+ var_ipAddressPrefixType.next_variable = &var_ipAddressPrefixPrefix;
+ var_ipAddressPrefixPrefix.next_variable = &var_ipAddressPrefixLength;
+ var_ipAddressPrefixLength.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_index_to_oid", "called\n"));
+
+ /*
+ * ipAddressPrefixIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ snmp_set_var_value(&var_ipAddressPrefixIfIndex,
+ (u_char *) & mib_idx->ipAddressPrefixIfIndex,
+ sizeof(mib_idx->ipAddressPrefixIfIndex));
+
+ /*
+ * ipAddressPrefixType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ snmp_set_var_value(&var_ipAddressPrefixType,
+ (u_char *) & mib_idx->ipAddressPrefixType,
+ sizeof(mib_idx->ipAddressPrefixType));
+
+ /*
+ * ipAddressPrefixPrefix(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_ipAddressPrefixPrefix,
+ (u_char *) & mib_idx->ipAddressPrefixPrefix,
+ mib_idx->ipAddressPrefixPrefix_len *
+ sizeof(mib_idx->ipAddressPrefixPrefix[0]));
+
+ /*
+ * ipAddressPrefixLength(4)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ snmp_set_var_value(&var_ipAddressPrefixLength,
+ (u_char *) & mib_idx->ipAddressPrefixLength,
+ sizeof(mib_idx->ipAddressPrefixLength));
+
+
+ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
+ NULL, 0, &var_ipAddressPrefixIfIndex);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_ipAddressPrefixIfIndex);
+
+ return err;
+} /* ipAddressPrefixTable_index_to_oid */
+
+/**
+ * extract ipAddressPrefixTable indexes from a netsnmp_index
+ *
+ * @retval SNMP_ERR_NOERROR : no error
+ * @retval SNMP_ERR_GENERR : error
+ */
+int
+ipAddressPrefixTable_index_from_oid(netsnmp_index * oid_idx,
+ ipAddressPrefixTable_mib_index *
+ mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * ipAddressPrefixIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_ipAddressPrefixIfIndex;
+ /*
+ * ipAddressPrefixType(2)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_ipAddressPrefixType;
+ /*
+ * ipAddressPrefixPrefix(3)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_ipAddressPrefixPrefix;
+ /*
+ * ipAddressPrefixLength(4)/InetAddressPrefixLength/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_ipAddressPrefixLength;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_ipAddressPrefixIfIndex, 0x00,
+ sizeof(var_ipAddressPrefixIfIndex));
+ var_ipAddressPrefixIfIndex.type = ASN_INTEGER;
+ memset(&var_ipAddressPrefixType, 0x00,
+ sizeof(var_ipAddressPrefixType));
+ var_ipAddressPrefixType.type = ASN_INTEGER;
+ memset(&var_ipAddressPrefixPrefix, 0x00,
+ sizeof(var_ipAddressPrefixPrefix));
+ var_ipAddressPrefixPrefix.type = ASN_OCTET_STR;
+ memset(&var_ipAddressPrefixLength, 0x00,
+ sizeof(var_ipAddressPrefixLength));
+ var_ipAddressPrefixLength.type = ASN_UNSIGNED;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_ipAddressPrefixIfIndex.next_variable = &var_ipAddressPrefixType;
+ var_ipAddressPrefixType.next_variable = &var_ipAddressPrefixPrefix;
+ var_ipAddressPrefixPrefix.next_variable = &var_ipAddressPrefixLength;
+ var_ipAddressPrefixLength.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:ipAddressPrefixTable:ipAddressPrefixTable_index_from_oid", "called\n"));
+
+ /*
+ * parse the oid into the individual index components
+ */
+ err = parse_oid_indexes(oid_idx->oids, oid_idx->len,
+ &var_ipAddressPrefixIfIndex);
+ if (err == SNMP_ERR_NOERROR) {
+ /*
+ * copy out values
+ */
+ mib_idx->ipAddressPrefixIfIndex =
+ *((long *) var_ipAddressPrefixIfIndex.val.string);
+ mib_idx->ipAddressPrefixType =
+ *((u_long *) var_ipAddressPrefixType.val.string);
+ /*
+ * NOTE: val_len is in bytes, ipAddressPrefixPrefix_len might not be
+ */
+ if (var_ipAddressPrefixPrefix.val_len >
+ sizeof(mib_idx->ipAddressPrefixPrefix))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->ipAddressPrefixPrefix,
+ var_ipAddressPrefixPrefix.val.string,
+ var_ipAddressPrefixPrefix.val_len);
+ mib_idx->ipAddressPrefixPrefix_len =
+ var_ipAddressPrefixPrefix.val_len /
+ sizeof(mib_idx->ipAddressPrefixPrefix[0]);
+ }
+ mib_idx->ipAddressPrefixLength =
+ *((u_long *) var_ipAddressPrefixLength.val.string);
+
+
+ }
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_ipAddressPrefixIfIndex);
+
+ return err;
+} /* ipAddressPrefixTable_index_from_oid */
+
+
+/*
+ *********************************************************************
+ * @internal
+ * allocate resources for a ipAddressPrefixTable_rowreq_ctx
+ */
+ipAddressPrefixTable_rowreq_ctx *
+ipAddressPrefixTable_allocate_rowreq_ctx(void *user_init_ctx)
+{
+ ipAddressPrefixTable_rowreq_ctx *rowreq_ctx =
+ SNMP_MALLOC_TYPEDEF(ipAddressPrefixTable_rowreq_ctx);
+
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:ipAddressPrefixTable_allocate_rowreq_ctx", "called\n"));
+
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "Couldn't allocate memory for a "
+ "ipAddressPrefixTable_rowreq_ctx.\n");
+ return NULL;
+ }
+
+ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
+
+ rowreq_ctx->ipAddressPrefixTable_data_list = NULL;
+
+ /*
+ * if we allocated data, call init routine
+ */
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) {
+ if (SNMPERR_SUCCESS !=
+ ipAddressPrefixTable_rowreq_ctx_init(rowreq_ctx,
+ user_init_ctx)) {
+ ipAddressPrefixTable_release_rowreq_ctx(rowreq_ctx);
+ rowreq_ctx = NULL;
+ }
+ }
+
+ return rowreq_ctx;
+} /* ipAddressPrefixTable_allocate_rowreq_ctx */
+
+/*
+ * @internal
+ * release resources for a ipAddressPrefixTable_rowreq_ctx
+ */
+void
+ipAddressPrefixTable_release_rowreq_ctx(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:ipAddressPrefixTable_release_rowreq_ctx", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ ipAddressPrefixTable_rowreq_ctx_cleanup(rowreq_ctx);
+
+ /*
+ * free index oid pointer
+ */
+ if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp)
+ free(rowreq_ctx->oid_idx.oids);
+
+ SNMP_FREE(rowreq_ctx);
+} /* ipAddressPrefixTable_release_rowreq_ctx */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipAddressPrefixTable_pre_request(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_mfd_ipAddressPrefixTable_pre_request", "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ipAddressPrefixTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = ipAddressPrefixTable_pre_request(ipAddressPrefixTable_if_ctx.
+ user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipAddressPrefixTable", "error %d from "
+ "ipAddressPrefixTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipAddressPrefixTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipAddressPrefixTable_post_request(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipAddressPrefixTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_mfd_ipAddressPrefixTable_post_request", "called\n"));
+
+ /*
+ * release row context, if deleted
+ */
+ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
+ ipAddressPrefixTable_release_rowreq_ctx(rowreq_ctx);
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ipAddressPrefixTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ rc = ipAddressPrefixTable_post_request(ipAddressPrefixTable_if_ctx.
+ user_ctx, packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipAddressPrefixTable", "error %d from "
+ "ipAddressPrefixTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipAddressPrefixTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipAddressPrefixTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = SNMP_ERR_NOERROR;
+ ipAddressPrefixTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_mfd_ipAddressPrefixTable_object_lookup", "called\n"));
+
+ /*
+ * get our context from mfd
+ * ipAddressPrefixTable_interface_ctx *if_ctx =
+ * (ipAddressPrefixTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if (NULL == rowreq_ctx) {
+ rc = SNMP_ERR_NOCREATION;
+ }
+
+ if (MFD_SUCCESS != rc)
+ netsnmp_request_set_error_all(requests, rc);
+ else
+ ipAddressPrefixTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_ipAddressPrefixTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipAddressPrefixTable_get_column(ipAddressPrefixTable_rowreq_ctx *
+ rowreq_ctx, netsnmp_variable_list * var,
+ int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_mfd_ipAddressPrefixTable_get_column", "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipAddressPrefixOrigin(5)/IpAddressPrefixOriginTC/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_IPADDRESSPREFIXORIGIN:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipAddressPrefixOrigin_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipAddressPrefixOnLinkFlag(6)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_IPADDRESSPREFIXONLINKFLAG:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipAddressPrefixOnLinkFlag_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipAddressPrefixAutonomousFlag(7)/TruthValue/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_IPADDRESSPREFIXAUTONOMOUSFLAG:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipAddressPrefixAutonomousFlag_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipAddressPrefixAdvPreferredLifetime(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPADDRESSPREFIXADVPREFERREDLIFETIME:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_UNSIGNED;
+ rc = ipAddressPrefixAdvPreferredLifetime_get(rowreq_ctx,
+ (u_long *) var->val.
+ string);
+ break;
+
+ /*
+ * ipAddressPrefixAdvValidLifetime(9)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPADDRESSPREFIXADVVALIDLIFETIME:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_UNSIGNED;
+ rc = ipAddressPrefixAdvValidLifetime_get(rowreq_ctx,
+ (u_long *) var->val.
+ string);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipAddressPrefixTable_get_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ipAddressPrefixTable_get_column */
+
+int
+_mfd_ipAddressPrefixTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipAddressPrefixTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ u_char *old_string;
+ void (*dataFreeHook) (void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_mfd_ipAddressPrefixTable_get_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+ /*
+ * save old pointer, so we can free it if replaced
+ */
+ old_string = requests->requestvb->val.string;
+ dataFreeHook = requests->requestvb->dataFreeHook;
+ if (NULL == requests->requestvb->val.string) {
+ requests->requestvb->val.string = requests->requestvb->buf;
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ } else if (requests->requestvb->buf ==
+ requests->requestvb->val.string) {
+ if (requests->requestvb->val_len !=
+ sizeof(requests->requestvb->buf))
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ }
+
+ /*
+ * get column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipAddressPrefixTable_get_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ if (MFD_SKIP == rc) {
+ requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+ rc = SNMP_ERR_NOERROR;
+ }
+ } else if (NULL == requests->requestvb->val.string) {
+ snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
+ rc = SNMP_ERR_GENERR;
+ }
+ if (rc)
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+
+ /*
+ * if the buffer wasn't used previously for the old data (i.e. it
+ * was allcoated memory) and the get routine replaced the pointer,
+ * we need to free the previous pointer.
+ */
+ if (old_string && (old_string != requests->requestvb->buf) &&
+ (requests->requestvb->val.string != old_string)) {
+ if (dataFreeHook)
+ (*dataFreeHook) (old_string);
+ else
+ free(old_string);
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipAddressPrefixTable_get_values */
+
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*
+ * SET PROCESSING NOT APPLICABLE (per MIB or user setting)
+ */
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+static void _container_free(netsnmp_container *container);
+
+/**
+ * @internal
+ */
+static int
+_cache_load(netsnmp_cache * cache, void *vmagic)
+{
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_cache_load", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache for ipAddressPrefixTable_cache_load\n");
+ return -1;
+ }
+
+ /** should only be called for an invalid or expired cache */
+ netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
+
+ /*
+ * call user code
+ */
+ return ipAddressPrefixTable_container_load((netsnmp_container *)
+ cache->magic);
+} /* _cache_load */
+
+/**
+ * @internal
+ */
+static void
+_cache_free(netsnmp_cache * cache, void *magic)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_cache_free", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache in ipAddressPrefixTable_cache_free\n");
+ return;
+ }
+
+ container = (netsnmp_container *) cache->magic;
+
+ _container_free(container);
+} /* _cache_free */
+
+/**
+ * @internal
+ */
+static void
+_container_item_free(ipAddressPrefixTable_rowreq_ctx * rowreq_ctx,
+ void *context)
+{
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_container_item_free",
+ "called\n"));
+
+ if (NULL == rowreq_ctx)
+ return;
+
+ ipAddressPrefixTable_release_rowreq_ctx(rowreq_ctx);
+} /* _container_item_free */
+
+/**
+ * @internal
+ */
+static void
+_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_container_free",
+ "called\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container in ipAddressPrefixTable_container_free\n");
+ return;
+ }
+
+ /*
+ * call user code
+ */
+ ipAddressPrefixTable_container_free(container);
+
+ /*
+ * free all items. inefficient, but easy.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func *) _container_item_free,
+ NULL);
+} /* _container_free */
+
+/**
+ * @internal
+ * initialize the container with functions or wrappers
+ */
+void
+_ipAddressPrefixTable_container_init(ipAddressPrefixTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_ipAddressPrefixTable_container_init", "called\n"));
+
+ /*
+ * cache init
+ */
+ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */
+ _cache_load, _cache_free,
+ ipAddressPrefixTable_oid,
+ ipAddressPrefixTable_oid_size);
+
+ if (NULL == if_ctx->cache) {
+ snmp_log(LOG_ERR,
+ "error creating cache for ipAddressPrefixTable\n");
+ return;
+ }
+
+ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
+
+ ipAddressPrefixTable_container_init(&if_ctx->container, if_ctx->cache);
+ if (NULL == if_ctx->container)
+ if_ctx->container =
+ netsnmp_container_find("ipAddressPrefixTable:table_container");
+ if (NULL == if_ctx->container) {
+ snmp_log(LOG_ERR, "error creating container in "
+ "ipAddressPrefixTable_container_init\n");
+ return;
+ }
+
+ if (NULL != if_ctx->cache)
+ if_ctx->cache->magic = (void *) if_ctx->container;
+} /* _ipAddressPrefixTable_container_init */
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+_ipAddressPrefixTable_container_shutdown(ipAddressPrefixTable_interface_ctx
+ * if_ctx)
+{
+ DEBUGMSGTL(("internal:ipAddressPrefixTable:_ipAddressPrefixTable_container_shutdown", "called\n"));
+
+ ipAddressPrefixTable_container_shutdown(if_ctx->container);
+
+ _container_free(if_ctx->container);
+
+} /* _ipAddressPrefixTable_container_shutdown */
+
+
+ipAddressPrefixTable_rowreq_ctx *
+ipAddressPrefixTable_row_find_by_mib_index(ipAddressPrefixTable_mib_index *
+ mib_idx)
+{
+ ipAddressPrefixTable_rowreq_ctx *rowreq_ctx;
+ oid oid_tmp[MAX_OID_LEN];
+ netsnmp_index oid_idx;
+ int rc;
+
+ /*
+ * set up storage for OID
+ */
+ oid_idx.oids = oid_tmp;
+ oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
+
+ /*
+ * convert
+ */
+ rc = ipAddressPrefixTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx =
+ CONTAINER_FIND(ipAddressPrefixTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.h
new file mode 100644
index 0000000000..ca829ac597
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressPrefixTable/ipAddressPrefixTable_interface.h
@@ -0,0 +1,98 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: ipAddressPrefixTable_interface.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** @ingroup interface Routines to interface to Net-SNMP
+ *
+ * \warning This code should not be modified, called directly,
+ * or used to interpret functionality. It is subject to
+ * change at any time.
+ *
+ * @{
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+#ifndef IPADDRESSPREFIXTABLE_INTERFACE_H
+#define IPADDRESSPREFIXTABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "ipAddressPrefixTable.h"
+
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void
+ _ipAddressPrefixTable_initialize_interface
+ (ipAddressPrefixTable_registration * user_ctx, u_long flags);
+ void
+ _ipAddressPrefixTable_shutdown_interface
+ (ipAddressPrefixTable_registration * user_ctx);
+
+ ipAddressPrefixTable_registration
+ * ipAddressPrefixTable_registration_get(void);
+
+ ipAddressPrefixTable_registration
+ * ipAddressPrefixTable_registration_set
+ (ipAddressPrefixTable_registration * newreg);
+
+ netsnmp_container *ipAddressPrefixTable_container_get(void);
+ int ipAddressPrefixTable_container_size(void);
+ ipAddressPrefixTable_rowreq_ctx
+ * ipAddressPrefixTable_allocate_rowreq_ctx(void *);
+ void
+ ipAddressPrefixTable_release_rowreq_ctx
+ (ipAddressPrefixTable_rowreq_ctx * rowreq_ctx);
+
+ int ipAddressPrefixTable_index_to_oid(netsnmp_index *
+ oid_idx,
+ ipAddressPrefixTable_mib_index
+ * mib_idx);
+ int ipAddressPrefixTable_index_from_oid(netsnmp_index *
+ oid_idx,
+ ipAddressPrefixTable_mib_index
+ * mib_idx);
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void
+ ipAddressPrefixTable_valid_columns_set(netsnmp_column_info *vc);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPADDRESSPREFIXTABLE_INTERFACE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable.h
new file mode 100644
index 0000000000..8d4d27443e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable.h
@@ -0,0 +1,5 @@
+/*
+ * module to include the modules
+ */
+
+config_require(ip-mib/ipAddressTable/ipAddressTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c
new file mode 100644
index 0000000000..e695ab3fc9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c
@@ -0,0 +1,2445 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: ipAddressTable.c 15640 2006-12-06 15:10:40Z rstory $
+ */
+/** \page MFD helper for ipAddressTable
+ *
+ * \section intro Introduction
+ * Introductory text.
+ *
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/data_access/interface.h>
+
+/*
+ * include our parent header
+ */
+#include "ipAddressTable.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "ipAddressTable_interface.h"
+
+oid ipAddressTable_oid[] = { IPADDRESSTABLE_OID };
+int ipAddressTable_oid_size = OID_LENGTH(ipAddressTable_oid);
+
+ipAddressTable_registration ipAddressTable_user_context;
+
+void initialize_table_ipAddressTable(void);
+void shutdown_table_ipAddressTable(void);
+
+
+/**
+ * Initializes the ipAddressTable module
+ */
+void
+init_ipAddressTable(void)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:init_ipAddressTable", "called\n"));
+
+ /*
+ * TODO:300:o: Perform ipAddressTable one-time module initialization.
+ */
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ if (should_init("ipAddressTable"))
+ initialize_table_ipAddressTable();
+
+} /* init_ipAddressTable */
+
+/**
+ * Shut-down the ipAddressTable module (agent is exiting)
+ */
+void
+shutdown_ipAddressTable(void)
+{
+ if (should_init("ipAddressTable"))
+ shutdown_table_ipAddressTable();
+
+}
+
+/**
+ * Initialize the table ipAddressTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_ipAddressTable(void)
+{
+ ipAddressTable_registration *user_context;
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:ipAddressTable:initialize_table_ipAddressTable",
+ "called\n"));
+
+ /*
+ * TODO:301:o: Perform ipAddressTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize ipAddressTable user context
+ * if you'd like to pass in a pointer to some data for this
+ * table, allocate or set it up here.
+ */
+ user_context = NULL;
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _ipAddressTable_initialize_interface(user_context, flags);
+} /* initialize_table_ipAddressTable */
+
+/**
+ * Shutdown the table ipAddressTable
+ */
+void
+shutdown_table_ipAddressTable(void)
+{
+ /*
+ * call interface shutdown code
+ */
+ _ipAddressTable_shutdown_interface(&ipAddressTable_user_context);
+}
+
+/**
+ * extra context initialization (eg default values)
+ *
+ * @param rowreq_ctx : row request context
+ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
+ *
+ * @retval MFD_SUCCESS : no errors
+ * @retval MFD_ERROR : error (context allocate will fail)
+ */
+int
+ipAddressTable_rowreq_ctx_init(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ void *user_init_ctx)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_rowreq_ctx_init",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:210:o: |-> Perform extra ipAddressTable rowreq initialization. (eg DEFVALS)
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressTable_rowreq_ctx_init */
+
+/**
+ * extra context cleanup
+ *
+ */
+void
+ipAddressTable_rowreq_ctx_cleanup(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_rowreq_ctx_cleanup",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:211:o: |-> Perform extra ipAddressTable rowreq cleanup.
+ */
+ if (NULL != rowreq_ctx->data) {
+ ipAddressTable_release_data(rowreq_ctx->data);
+ rowreq_ctx->data = NULL;
+ }
+} /* ipAddressTable_rowreq_ctx_cleanup */
+
+/**
+ * pre-request callback
+ *
+ * @param user_context
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+ipAddressTable_pre_request(ipAddressTable_registration * user_context)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_pre_request",
+ "called\n"));
+
+ /*
+ * TODO:510:o: Perform ipAddressTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ * Note:
+ * New rows have been inserted into the container, and
+ * deleted rows have been removed from the container and
+ * released.
+ *
+ * @param user_context
+ * @param rc : MFD_SUCCESS if all requests succeeded
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+ipAddressTable_post_request(ipAddressTable_registration * user_context,
+ int rc)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_post_request",
+ "called\n"));
+
+ /*
+ * TODO:511:o: Perform ipAddressTable post-request actions.
+ */
+
+ /*
+ * check to set if any rows were changed.
+ */
+ if (ipAddressTable_dirty_get()) {
+ /*
+ * check if request was successful. If so, this would be
+ * a good place to save data to its persistent store.
+ */
+ if (MFD_SUCCESS == rc) {
+ /*
+ * save changed rows, if you haven't already
+ */
+ }
+
+ ipAddressTable_dirty_set(0); /* clear table dirty flag */
+ }
+
+ return MFD_SUCCESS;
+} /* ipAddressTable_post_request */
+
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipAddressTable is subid 34 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.34, length: 8
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement ipAddressTable data context functions.
+ */
+/*
+ * ipAddressTable_allocate_data
+ *
+ * Purpose: create new ipAddressTable_data.
+ */
+ipAddressTable_data *
+ipAddressTable_allocate_data(void)
+{
+ /*
+ * TODO:201:r: |-> allocate memory for the ipAddressTable data context.
+ */
+ ipAddressTable_data *rtn = netsnmp_access_ipaddress_entry_create();
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_allocate_data",
+ "called\n"));
+
+ if (NULL == rtn) {
+ snmp_log(LOG_ERR, "unable to malloc memory for new "
+ "ipAddressTable_data.\n");
+ }
+
+ return rtn;
+} /* ipAddressTable_allocate_data */
+
+/*
+ * ipAddressTable_release_data
+ *
+ * Purpose: release ipAddressTable data.
+ */
+void
+ipAddressTable_release_data(ipAddressTable_data * data)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_release_data",
+ "called\n"));
+
+ /*
+ * TODO:202:r: |-> release memory for the ipAddressTable data context.
+ */
+ netsnmp_access_ipaddress_entry_free(data);
+} /* ipAddressTable_release_data */
+
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressAddrType
+ * ipAddressAddrType is subid 1 of ipAddressEntry.
+ * Its status is Current, and its access level is NoAccess.
+ * OID: .1.3.6.1.2.1.4.34.1.1
+ * Description:
+The address type of ipAddressAddr.
+ *
+ * Attributes:
+ * accessible 0 isscalar 0 enums 1 hasdefval 0
+ * readable 0 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ * Enum range: 5/8. Values: unknown(0), ipv4(1), ipv6(2), ipv4z(3), ipv6z(4), dns(16)
+ *
+ * Its syntax is InetAddressType (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ *
+ *
+ *
+ * NOTE: NODE ipAddressAddrType IS NOT ACCESSIBLE
+ *
+ *
+ */
+/**
+ * map a value from its original native format to the MIB format.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : Any other error
+ *
+ * @note parameters follow the memset convention (dest, src).
+ *
+ * @note generation and use of this function can be turned off by re-running
+ * mib2c after adding the following line to the file
+ * default-node-ipAddressAddrType.m2d :
+ * @verbatim $m2c_node_skip_mapping = 1@endverbatim
+ *
+ * @remark
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them here.
+ * Otherwise, just do a direct copy.
+ */
+int
+ipAddressAddrType_map(u_long * mib_ipAddressAddrType_val_ptr,
+ u_long raw_ipAddressAddrType_val)
+{
+ netsnmp_assert(NULL != mib_ipAddressAddrType_val_ptr);
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressAddrType_map",
+ "called\n"));
+
+ /*
+ * TODO:241:o: |-> Implement ipAddressAddrType enum mapping.
+ * uses INTERNAL_* macros defined in the header files
+ */
+ switch (raw_ipAddressAddrType_val) {
+ case INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV4:
+ *mib_ipAddressAddrType_val_ptr = INETADDRESSTYPE_IPV4;
+ break;
+
+ case INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV6:
+ *mib_ipAddressAddrType_val_ptr = INETADDRESSTYPE_IPV6;
+ break;
+
+ default:
+ snmp_log(LOG_ERR, "couldn't map value %ld for ipAddressAddrType\n",
+ raw_ipAddressAddrType_val);
+ *mib_ipAddressAddrType_val_ptr = INETADDRESSTYPE_UNKNOWN;
+ }
+
+ return MFD_SUCCESS;
+} /* ipAddressAddrType_map */
+
+
+/**
+ * set mib index(es)
+ *
+ * @param tbl_idx mib index structure
+ * @param ipAddressAddrType_val
+ * @param ipAddressAddr_val_ptr
+ * @param ipAddressAddr_val_ptr_len
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This convenience function is useful for setting all the MIB index
+ * components with a single function call. It is assume that the C values
+ * have already been mapped from their native/rawformat to the MIB format.
+ */
+int
+ipAddressTable_indexes_set_tbl_idx(ipAddressTable_mib_index * tbl_idx,
+ u_long ipAddressAddrType_val,
+ char *ipAddressAddr_val_ptr,
+ size_t ipAddressAddr_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_indexes_set_tbl_idx", "called\n"));
+
+ /*
+ * ipAddressAddrType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ /** WARNING: this code might not work for netsnmp_ipaddress_entry */
+ ipAddressAddrType_map(&tbl_idx->ipAddressAddrType,
+ ipAddressAddrType_val);
+
+ /*
+ * ipAddressAddr(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ tbl_idx->ipAddressAddr_len = sizeof(tbl_idx->ipAddressAddr) / sizeof(tbl_idx->ipAddressAddr[0]); /* max length */
+ /** WARNING: this code might not work for netsnmp_ipaddress_entry */
+ /*
+ * make sure there is enough space for ipAddressAddr data
+ */
+ if (tbl_idx->ipAddressAddr_len < ipAddressAddr_val_ptr_len) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->ipAddressAddr_len = ipAddressAddr_val_ptr_len;
+ memcpy(tbl_idx->ipAddressAddr, ipAddressAddr_val_ptr,
+ ipAddressAddr_val_ptr_len * sizeof(ipAddressAddr_val_ptr[0]));
+
+
+ return MFD_SUCCESS;
+} /* ipAddressTable_indexes_set_tbl_idx */
+
+/**
+ * @internal
+ * set row context indexes
+ *
+ * @param reqreq_ctx the row context that needs updated indexes
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This function sets the mib indexs, then updates the oid indexs
+ * from the mib index.
+ */
+int
+ipAddressTable_indexes_set(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ u_long ipAddressAddrType_val,
+ char *ipAddressAddr_val_ptr,
+ size_t ipAddressAddr_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_indexes_set",
+ "called\n"));
+
+ if (MFD_SUCCESS !=
+ ipAddressTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
+ ipAddressAddrType_val,
+ ipAddressAddr_val_ptr,
+ ipAddressAddr_val_ptr_len))
+ return MFD_ERROR;
+
+ /*
+ * convert mib index to oid index
+ */
+ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
+ if (0 != ipAddressTable_index_to_oid(&rowreq_ctx->oid_idx,
+ &rowreq_ctx->tbl_idx)) {
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS;
+} /* ipAddressTable_indexes_set */
+
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressIfIndex
+ * ipAddressIfIndex is subid 3 of ipAddressEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.34.1.3
+ * Description:
+The index value which uniquely identifies the interface to
+ which this entry is applicable. The interface identified by
+ a particular value of this index is the same interface as
+ identified by the same value of the IF-MIB's ifIndex.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 1
+ * settable 1
+ * hint: d
+ *
+ * Ranges: 1 - 2147483647;
+ *
+ * Its syntax is InterfaceIndex (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the ipAddressIfIndex data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressIfIndex_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipAddressIfIndex_get(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ long *ipAddressIfIndex_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressIfIndex_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressIfIndex_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressIfIndex data.
+ * copy (* ipAddressIfIndex_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipAddressIfIndex_val_ptr) = rowreq_ctx->data->if_index;
+
+ return MFD_SUCCESS;
+} /* ipAddressIfIndex_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressType
+ * ipAddressType is subid 4 of ipAddressEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.34.1.4
+ * Description:
+The type of address. broadcast(3) is not a valid value for
+ IPv6 addresses (RFC3513).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: unicast
+ *
+ * Enum range: 2/8. Values: unicast(1), anycast(2), broadcast(3)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ipAddressType data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressType_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipAddressType_get(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipAddressType_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressType_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressType_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressType data.
+ * copy (* ipAddressType_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipAddressType_val_ptr) = rowreq_ctx->data->ia_type;
+
+ return MFD_SUCCESS;
+} /* ipAddressType_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressPrefix
+ * ipAddressPrefix is subid 5 of ipAddressEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.34.1.5
+ * Description:
+A pointer to the row in the prefix table to which this
+ address belongs. May be { 0 0 } if there is no such row.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ * defval: zeroDotZero
+ *
+ *
+ * Its syntax is RowPointer (based on perltype OBJECTID)
+ * The net-snmp type is ASN_OBJECT_ID. The C type decl is oid (oid)
+ * This data type requires a length.
+ */
+/**
+ * Extract the current value of the ipAddressPrefix data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressPrefix_val_ptr_ptr
+ * Pointer to storage for a oid variable
+ * @param ipAddressPrefix_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by ipAddressPrefix.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*ipAddressPrefix_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update ipAddressPrefix_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+ipAddressPrefix_get(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ oid ** ipAddressPrefix_val_ptr_ptr,
+ size_t * ipAddressPrefix_val_ptr_len_ptr)
+{
+ oid *dst, tmp_oid[MAX_OID_LEN] =
+ { 1, 3, 6, 1, 2, 1, 4, 32, 1, 5 };
+ u_char tmp_buf[NETSNMP_ACCESS_IPADDRESS_BUF_SIZE];
+ int len;
+
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert((NULL != ipAddressPrefix_val_ptr_ptr)
+ && (NULL != *ipAddressPrefix_val_ptr_ptr));
+ netsnmp_assert(NULL != ipAddressPrefix_val_ptr_len_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressPrefix_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressPrefix data.
+ * copy (* ipAddressPrefix_val_ptr_ptr ) data and (* ipAddressPrefix_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ dst = &tmp_oid[10];
+ *(dst++) = rowreq_ctx->data->if_index;
+ *(dst++) = rowreq_ctx->tbl_idx.ipAddressAddrType;
+ *(dst++) = rowreq_ctx->data->ia_address_len;
+ netsnmp_ipaddress_prefix_copy(tmp_buf,
+ rowreq_ctx->tbl_idx.ipAddressAddr,
+ rowreq_ctx->data->ia_address_len,
+ rowreq_ctx->data->ia_prefix_len);
+ for (len = 0; len < rowreq_ctx->data->ia_address_len; ++len)
+ *(dst++) = tmp_buf[len];
+ *(dst++) = rowreq_ctx->data->ia_prefix_len;
+ len = dst - tmp_oid;
+
+ len *= sizeof((*ipAddressPrefix_val_ptr_ptr)[0]);
+ if ((*ipAddressPrefix_val_ptr_len_ptr) < len) {
+ (*ipAddressPrefix_val_ptr_ptr) = malloc(len);
+ if (NULL == (*ipAddressPrefix_val_ptr_ptr)) {
+ snmp_log(LOG_ERR, "could not allocate memory\n");
+ return MFD_ERROR;
+ }
+ }
+ (*ipAddressPrefix_val_ptr_len_ptr) = len;
+ memcpy((*ipAddressPrefix_val_ptr_ptr), tmp_oid, len);
+
+ return MFD_SUCCESS;
+} /* ipAddressPrefix_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressOrigin
+ * ipAddressOrigin is subid 6 of ipAddressEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.34.1.6
+ * Description:
+The origin of the address.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ * Enum range: 4/8. Values: other(1), manual(2), dhcp(4), linklayer(5), random(6)
+ *
+ * Its syntax is IpAddressOriginTC (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ipAddressOrigin data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressOrigin_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipAddressOrigin_get(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipAddressOrigin_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressOrigin_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressOrigin_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressOrigin data.
+ * copy (* ipAddressOrigin_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipAddressOrigin_val_ptr) = rowreq_ctx->data->ia_origin;
+
+ return MFD_SUCCESS;
+} /* ipAddressOrigin_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressStatus
+ * ipAddressStatus is subid 7 of ipAddressEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.34.1.7
+ * Description:
+The status of the address, describing if the address can be
+ used for communication.
+
+
+ In the absence of other information, an IPv4 address is
+ always preferred(1).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: preferred
+ *
+ * Enum range: 5/8. Values: preferred(1), invalid(3), inaccessible(4), unknown(5), tentative(6), duplicate(7)
+ *
+ * Its syntax is IpAddressStatusTC (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ipAddressStatus data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressStatus_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipAddressStatus_get(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipAddressStatus_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressStatus_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressStatus_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressStatus data.
+ * copy (* ipAddressStatus_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipAddressStatus_val_ptr) = rowreq_ctx->data->ia_status;
+
+ return MFD_SUCCESS;
+} /* ipAddressStatus_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressCreated
+ * ipAddressCreated is subid 8 of ipAddressEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.34.1.8
+ * Description:
+The value of sysUpTime at the time this entry was created.
+ If this entry was created prior to the last re-
+ initialization of the local network management subsystem,
+ then this object contains a zero value.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is TimeStamp (based on perltype TICKS)
+ * The net-snmp type is ASN_TIMETICKS. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipAddressCreated data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressCreated_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipAddressCreated_get(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipAddressCreated_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressCreated_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressCreated_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressCreated data.
+ * copy (* ipAddressCreated_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipAddressCreated_val_ptr) = rowreq_ctx->ipAddressCreated;
+
+ return MFD_SUCCESS;
+} /* ipAddressCreated_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressLastChanged
+ * ipAddressLastChanged is subid 9 of ipAddressEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.34.1.9
+ * Description:
+The value of sysUpTime at the time this entry was last
+ updated. If this entry was updated prior to the last re-
+ initialization of the local network management subsystem,
+ then this object contains a zero value.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is TimeStamp (based on perltype TICKS)
+ * The net-snmp type is ASN_TIMETICKS. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipAddressLastChanged data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressLastChanged_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipAddressLastChanged_get(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipAddressLastChanged_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressLastChanged_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressLastChanged_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressLastChanged data.
+ * copy (* ipAddressLastChanged_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipAddressLastChanged_val_ptr) = rowreq_ctx->ipAddressLastChanged;
+
+ return MFD_SUCCESS;
+} /* ipAddressLastChanged_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressRowStatus
+ * ipAddressRowStatus is subid 10 of ipAddressEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.34.1.10
+ * Description:
+The status of this conceptual row.
+
+
+ The RowStatus TC requires that this DESCRIPTION clause
+ states under which circumstances other objects in this row
+ can be modified. The value of this object has no effect on
+ whether other objects in this conceptual row can be
+ modified.
+
+
+ A conceptual row can not be made active until the
+ ipAddressIfIndex has been set to a valid index.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
+ *
+ * Its syntax is RowStatus (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ipAddressRowStatus data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressRowStatus_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipAddressRowStatus_get(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipAddressRowStatus_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressRowStatus_val_ptr);
+
+ /** WARNING: this code might not work for netsnmp_ipaddress_entry */
+ (*ipAddressRowStatus_val_ptr) = rowreq_ctx->ipAddressRowStatus;
+
+ return MFD_SUCCESS;
+} /* ipAddressRowStatus_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressStorageType
+ * ipAddressStorageType is subid 11 of ipAddressEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.34.1.11
+ * Description:
+The storage type for this conceptual row. If this object
+ has a value of 'permanent' then no other objects are
+ required to be able to be modified.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: volatile
+ *
+ * Enum range: 4/8. Values: other(1), volatile(2), nonVolatile(3), permanent(4), readOnly(5)
+ *
+ * Its syntax is StorageType (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ipAddressStorageType data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressStorageType_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipAddressStorageType_get(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipAddressStorageType_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipAddressStorageType_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressStorageType_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipAddressStorageType data.
+ * copy (* ipAddressStorageType_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipAddressStorageType_val_ptr) = rowreq_ctx->data->ia_storagetype;
+
+ return MFD_SUCCESS;
+} /* ipAddressStorageType_get */
+
+
+
+/** @} */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipAddressTable is subid 34 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.34, length: 8
+ */
+ /*
+ * NOTE: if you update this chart, please update the versions in
+ * local/mib2c-conf.d/parent-set.m2i
+ * agent/mibgroup/helpers/baby_steps.c
+ * while you're at it.
+ */
+ /*
+ ***********************************************************************
+ * Baby Steps Flow Chart (2004.06.05) *
+ * *
+ * +--------------+ +================+ U = unconditional path *
+ * |optional state| ||required state|| S = path for success *
+ * +--------------+ +================+ E = path for error *
+ ***********************************************************************
+ *
+ * +--------------+
+ * | pre |
+ * | request |
+ * +--------------+
+ * | U
+ * +-------------+ +==============+
+ * | row |f|<-------|| object ||
+ * | create |1| E || lookup ||
+ * +-------------+ +==============+
+ * E | | S | S
+ * | +------------------>|
+ * | +==============+
+ * | E || check ||
+ * |<---------------|| values ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | +<-------|| undo ||
+ * | | E || setup ||
+ * | | +==============+
+ * | | | S
+ * | | +==============+
+ * | | || set ||-------------------------->+
+ * | | || value || E |
+ * | | +==============+ |
+ * | | | S |
+ * | | +--------------+ |
+ * | | | check |-------------------------->|
+ * | | | consistency | E |
+ * | | +--------------+ |
+ * | | | S |
+ * | | +==============+ +==============+ |
+ * | | || commit ||-------->|| undo || |
+ * | | || || E || commit || |
+ * | | +==============+ +==============+ |
+ * | | | S U |<--------+
+ * | | +--------------+ +==============+
+ * | | | irreversible | || undo ||
+ * | | | commit | || set ||
+ * | | +--------------+ +==============+
+ * | | | U U |
+ * | +-------------->|<------------------------+
+ * | +==============+
+ * | || undo ||
+ * | || cleanup ||
+ * | +==============+
+ * +---------------------->| U
+ * |
+ * (err && f1)------------------->+
+ * | |
+ * +--------------+ +--------------+
+ * | post |<--------| row |
+ * | request | U | release |
+ * +--------------+ +--------------+
+ *
+ */
+
+/**
+ * Setup up context with information needed to undo a set request.
+ *
+ * This function will be called before the individual node undo setup
+ * functions are called. If you need to do any undo setup that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that the undo context has been allocated with
+ * ipAddressTable_allocate_data(), but may need extra
+ * initialization similar to what you may have done in
+ * ipAddressTable_rowreq_ctx_init().
+ * Note that an individual node's undo_setup function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in the node's undo_setup
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipAddressTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+ipAddressTable_undo_setup(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_undo_setup",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> Setup ipAddressTable undo.
+ * set up ipAddressTable undo information, in preparation for a set.
+ * Undo storage is in (* ipAddressStorageType_val_ptr )*
+ */
+ /*
+ * check for storage types that don't allow modification.
+ * probably should try and do this earlier (and we could, by
+ * adding code to the interface file), but this ought to suffice.
+ */
+ if (STORAGETYPE_READONLY == rowreq_ctx->data->ia_storagetype) {
+ DEBUGMSGTL(("ipAddressTable", "can't change readonly row\n"));
+ return MFD_NOT_VALID_EVER;
+ }
+
+ /*
+ * save last changed
+ */
+ rowreq_ctx->ipAddressLastChanged_undo =
+ rowreq_ctx->ipAddressLastChanged;
+
+
+ /*
+ * just copy everything
+ */
+ rc = netsnmp_access_ipaddress_entry_copy(rowreq_ctx->undo,
+ rowreq_ctx->data);
+
+ return rc;
+} /* ipAddressTable_undo_setup */
+
+/**
+ * Undo a set request.
+ *
+ * This function will be called before the individual node undo
+ * functions are called. If you need to do any undo that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that an individual node's undo function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is anything specific to a particular column (e.g. releasing
+ * memory for a string), you should do that setup in the node's undo
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipAddressTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+ipAddressTable_undo(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_undo", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> ipAddressTable undo.
+ * ipAddressTable undo information, in response to a failed set.
+ * Undo storage is in (* ipAddressStorageType_val_ptr )*
+ */
+
+ return rc;
+} /* ipAddressTable_undo_setup */
+
+/**
+ * Cleanup up context undo information.
+ *
+ * This function will be called after set/commit processing. If you
+ * allocated any resources in undo_setup, this is the place to release
+ * those resources.
+ *
+ * This function is called regardless of the success or failure of the set
+ * request. If you need to perform different steps for cleanup depending
+ * on success or failure, you can add a flag to the rowreq_ctx.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipAddressTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ipAddressTable_undo_cleanup(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_undo_cleanup",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:452:M: |-> Cleanup ipAddressTable undo.
+ * Undo storage is in (* ipAddressStorageType_val_ptr )*
+ */
+ rowreq_ctx->ipAddressLastChanged =
+ rowreq_ctx->ipAddressLastChanged_undo;
+
+ return rc;
+} /* ipAddressTable_undo_cleanup */
+
+/**
+ * commit new values.
+ *
+ * At this point, you should have done everything you can to ensure that
+ * this commit will not fail.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * ipAddressTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ipAddressTable_commit(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+ int save_flags;
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_commit",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * save flags, then clear until we actually do something
+ */
+ save_flags = rowreq_ctx->column_set_flags;
+ rowreq_ctx->column_set_flags = 0;
+
+ /*
+ * commit ipAddressTable data
+ * 1) check the column's flag in save_flags to see if it was set.
+ * 2) clear the flag when you handle that column
+ * 3) set the column's flag in column_set_flags if it needs undo
+ * processing in case of a failure.
+ */
+ /*
+ * did anything change?
+ */
+ if (0 == save_flags) {
+ DEBUGMSGTL(("ipAddressTable:ipAddressTable_commit",
+ "no change\n"));
+ return MFD_SUCCESS;
+ }
+
+ /*
+ * pass everything to data access
+ * let data access know what columns are set
+ */
+ rowreq_ctx->data->flags = save_flags;
+
+ if (save_flags & COLUMN_IPADDRESSROWSTATUS_FLAG) {
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ netsnmp_assert(ROWSTATUS_CREATEANDGO ==
+ rowreq_ctx->ipAddressRowStatus);
+ rowreq_ctx->data->flags |= NETSNMP_ACCESS_IPADDRESS_CREATE;
+ rowreq_ctx->ipAddressCreated = netsnmp_get_agent_uptime();
+ } else if (ROWSTATUS_DESTROY == rowreq_ctx->ipAddressRowStatus) {
+ rowreq_ctx->data->flags |= NETSNMP_ACCESS_IPADDRESS_DELETE;
+ } else
+ rowreq_ctx->data->flags |= NETSNMP_ACCESS_IPADDRESS_CHANGE;
+ } else
+ rowreq_ctx->data->flags |= NETSNMP_ACCESS_IPADDRESS_CHANGE;
+
+ /*
+ * do it
+ */
+ rc = netsnmp_access_ipaddress_entry_set(rowreq_ctx->data);
+ if (rc) {
+ DEBUGMSGTL(("ipAddressTable",
+ "bad rc %d from IP address data access\n", rc));
+ rc = MFD_ERROR;
+ } else {
+ rowreq_ctx->ipAddressLastChanged = netsnmp_get_agent_uptime();
+ /*
+ * set flag, in case we need to undo
+ */
+ rowreq_ctx->column_set_flags |= save_flags;
+ }
+
+ /*
+ * if we successfully commited this row, set the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY;
+ }
+
+ if (save_flags) {
+ snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n",
+ save_flags);
+ return MFD_ERROR;
+ }
+
+ return rc;
+} /* ipAddressTable_commit */
+
+/**
+ * undo commit new values.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * ipAddressTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ipAddressTable_undo_commit(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_undo_commit",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:485:M: |-> Undo ipAddressTable commit.
+ * check the column's flag in rowreq_ctx->column_set_flags to see
+ * if it was set during commit, then undo it.
+ *
+ * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
+ */
+ if (rowreq_ctx->column_set_flags & COLUMN_IPADDRESSROWSTATUS_FLAG) {
+ /*
+ * if we created an addr, delete it. if we deleted it,
+ * re-create it. If we changed it, change it back.
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ rowreq_ctx->undo->flags |= NETSNMP_ACCESS_IPADDRESS_DELETE;
+ } else if (ROWSTATUS_DESTROY == rowreq_ctx->ipAddressRowStatus) {
+ rowreq_ctx->undo->flags |= NETSNMP_ACCESS_IPADDRESS_CREATE;
+ } else
+ rowreq_ctx->undo->flags |= NETSNMP_ACCESS_IPADDRESS_CHANGE;
+ } else
+ rowreq_ctx->undo->flags |= NETSNMP_ACCESS_IPADDRESS_CHANGE;
+
+ /*
+ * do it
+ */
+ rc = netsnmp_access_ipaddress_entry_set(rowreq_ctx->undo);
+ if (rc) {
+ DEBUGMSGTL(("ipAddressTable",
+ "bad rc %d from IP address data access\n", rc));
+ rc = MFD_ERROR;
+ }
+
+ /*
+ * if we successfully un-commited this row, clear the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return rc;
+} /* ipAddressTable_undo_commit */
+
+/*
+ * TODO:440:M: Implement ipAddressTable node value checks.
+ * TODO:450:M: Implement ipAddressTable undo functions.
+ * TODO:460:M: Implement ipAddressTable set functions.
+ * TODO:480:M: Implement ipAddressTable commit functions.
+ */
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressIfIndex
+ * ipAddressIfIndex is subid 3 of ipAddressEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.34.1.3
+ * Description:
+The index value which uniquely identifies the interface to
+ which this entry is applicable. The interface identified by
+ a particular value of this index is the same interface as
+ identified by the same value of the IF-MIB's ifIndex.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 1
+ * settable 1
+ * hint: d
+ *
+ * Ranges: 1 - 2147483647;
+ *
+ * Its syntax is InterfaceIndex (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressIfIndex_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipAddressTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is in (one of) the range set(s): 1 - 2147483647
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipAddressIfIndex_check_value(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ long ipAddressIfIndex_val)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressIfIndex_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipAddressIfIndex value.
+ */
+ /*
+ * if the new value is the same as the old, accept it.
+ */
+ if (ipAddressIfIndex_val == rowreq_ctx->data->if_index)
+ return MFD_SUCCESS;
+
+ /*
+ * currently don't support moving addresses between interfaces, so
+ * if this isn't a new row, return error.
+ */
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_CREATED)) {
+ DEBUGMSGT(("ipAddressTable",
+ "changing ifIndex value not supported\n"));
+ return MFD_NOT_VALID_EVER;
+ }
+
+ /*
+ * find name for ifIndex
+ */
+ if (NULL == netsnmp_access_interface_name_find(ipAddressIfIndex_val)) {
+ DEBUGMSGT(("ipAddressTable", "cant find name for index %d\n",
+ ipAddressIfIndex_val));
+ return MFD_NOT_VALID_NOW;
+ }
+
+ return MFD_SUCCESS; /* ipAddressIfIndex value not illegal */
+} /* ipAddressIfIndex_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipAddressTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipAddressTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipAddressIfIndex_undo_setup(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressIfIndex_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipAddressIfIndex undo.
+ */
+ /*
+ * handled in ipAddressTable_undo_setup
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressIfIndex_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipAddressIfIndex_val
+ * A long containing the new value.
+ */
+int
+ipAddressIfIndex_set(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ long ipAddressIfIndex_val)
+{
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressIfIndex_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipAddressIfIndex value.
+ * set ipAddressIfIndex value in rowreq_ctx->data
+ */
+ if (rowreq_ctx->data->if_index != ipAddressIfIndex_val)
+ rowreq_ctx->data->if_index = ipAddressIfIndex_val;
+ else
+ rowreq_ctx->column_set_flags &= ~COLUMN_IPADDRESSIFINDEX_FLAG;
+
+ return MFD_SUCCESS;
+} /* ipAddressIfIndex_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipAddressIfIndex_undo(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressIfIndex_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipAddressIfIndex undo.
+ */
+ /*
+ * copy ipAddressIfIndex data
+ * set rowreq_ctx->data->ipAddressIfIndex from rowreq_ctx->undo->ipAddressIfIndex
+ */
+ rowreq_ctx->data->if_index = rowreq_ctx->undo->if_index;
+
+ return MFD_SUCCESS;
+} /* ipAddressIfIndex_undo */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressType
+ * ipAddressType is subid 4 of ipAddressEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.34.1.4
+ * Description:
+The type of address. broadcast(3) is not a valid value for
+ IPv6 addresses (RFC3513).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: unicast
+ *
+ * Enum range: 2/8. Values: unicast(1), anycast(2), broadcast(3)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressType_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipAddressTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of unicast(1), anycast(2), broadcast(3)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipAddressType_check_value(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ u_long ipAddressType_val)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressType_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipAddressType value.
+ *
+ * no support for anything but unicast yet
+ */
+ if (ipAddressType_val != IPADDRESSTYPE_UNICAST)
+ return MFD_NOT_VALID_EVER;
+
+ return MFD_SUCCESS; /* ipAddressType value not illegal */
+} /* ipAddressType_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipAddressTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipAddressTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipAddressType_undo_setup(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressType_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipAddressType undo.
+ */
+ /*
+ * handled in ipAddressTable_undo_setup
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressType_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipAddressType_val
+ * A long containing the new value.
+ */
+int
+ipAddressType_set(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ u_long ipAddressType_val)
+{
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressType_set", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipAddressType value.
+ * set ipAddressType value in rowreq_ctx->data
+ */
+ rowreq_ctx->data->ia_type = ipAddressType_val;
+
+ return MFD_SUCCESS;
+} /* ipAddressType_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipAddressType_undo(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressType_undo", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipAddressType undo.
+ */
+ /*
+ * copy ipAddressType data
+ * set rowreq_ctx->data->ipAddressType from rowreq_ctx->undo->ipAddressType
+ */
+ rowreq_ctx->data->ia_type = rowreq_ctx->undo->ia_type;
+
+ return MFD_SUCCESS;
+} /* ipAddressType_undo */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressStatus
+ * ipAddressStatus is subid 7 of ipAddressEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.34.1.7
+ * Description:
+The status of the address, describing if the address can be
+ used for communication.
+
+
+ In the absence of other information, an IPv4 address is
+ always preferred(1).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: preferred
+ *
+ * Enum range: 5/8. Values: preferred(1), invalid(3), inaccessible(4), unknown(5), tentative(6), duplicate(7)
+ *
+ * Its syntax is IpAddressStatusTC (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressStatus_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipAddressTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of preferred(1), invalid(3), inaccessible(4), unknown(5), tentative(6), duplicate(7)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipAddressStatus_check_value(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ u_long ipAddressStatus_val)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressStatus_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipAddressStatus value.
+ *
+ * nothing but preferred supported yet
+ */
+ if (IPADDRESSSTATUSTC_PREFERRED != ipAddressStatus_val)
+ return MFD_NOT_VALID_EVER;
+
+ return MFD_SUCCESS; /* ipAddressStatus value not illegal */
+} /* ipAddressStatus_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipAddressTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipAddressTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipAddressStatus_undo_setup(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressStatus_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipAddressStatus undo.
+ */
+ /*
+ * handled in ipAddressTable_undo_setup
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressStatus_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipAddressStatus_val
+ * A long containing the new value.
+ */
+int
+ipAddressStatus_set(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ u_long ipAddressStatus_val)
+{
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressStatus_set", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipAddressStatus value.
+ * set ipAddressStatus value in rowreq_ctx->data
+ */
+ rowreq_ctx->data->ia_status = ipAddressStatus_val;
+
+ return MFD_SUCCESS;
+} /* ipAddressStatus_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipAddressStatus_undo(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressStatus_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipAddressStatus undo.
+ */
+ /*
+ * copy ipAddressStatus data
+ * set rowreq_ctx->data->ipAddressStatus from rowreq_ctx->undo->ipAddressStatus
+ */
+ rowreq_ctx->data->ia_status = rowreq_ctx->undo->ia_status;
+
+ return MFD_SUCCESS;
+} /* ipAddressStatus_undo */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressRowStatus
+ * ipAddressRowStatus is subid 10 of ipAddressEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.34.1.10
+ * Description:
+The status of this conceptual row.
+
+
+ The RowStatus TC requires that this DESCRIPTION clause
+ states under which circumstances other objects in this row
+ can be modified. The value of this object has no effect on
+ whether other objects in this conceptual row can be
+ modified.
+
+
+ A conceptual row can not be made active until the
+ ipAddressIfIndex has been set to a valid index.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
+ *
+ * Its syntax is RowStatus (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressRowStatus_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipAddressTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipAddressRowStatus_check_value(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ u_long ipAddressRowStatus_val)
+{
+ int rc;
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressRowStatus_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipAddressRowStatus value.
+ *
+ * don't support createAndWait
+ * check for valid RowStatus transition (old, new)
+ */
+ if (ROWSTATUS_CREATEANDWAIT == ipAddressRowStatus_val) {
+ DEBUGMSGTL(("ipAddressTable", "createAndWait not supported\n"));
+ return MFD_NOT_VALID_EVER;
+ }
+
+ rc = check_rowstatus_transition(rowreq_ctx->ipAddressRowStatus,
+ ipAddressRowStatus_val);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipAddressTable",
+ "row status transition from %d to %d\n",
+ rowreq_ctx->ipAddressRowStatus,
+ ipAddressRowStatus_val));
+ return rc;
+ }
+
+ return MFD_SUCCESS; /* ipAddressRowStatus value not illegal */
+} /* ipAddressRowStatus_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipAddressTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipAddressTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipAddressRowStatus_undo_setup(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressRowStatus_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipAddressRowStatus undo.
+ */
+ /*
+ * handled in ipAddressTable_undo_setup
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressRowStatus_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipAddressRowStatus_val
+ * A long containing the new value.
+ */
+int
+ipAddressRowStatus_set(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ u_long ipAddressRowStatus_val)
+{
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressRowStatus_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipAddressRowStatus value.
+ * set ipAddressRowStatus value in rowreq_ctx->data
+ */
+ rowreq_ctx->ipAddressRowStatus = ipAddressRowStatus_val;
+
+ return MFD_SUCCESS;
+} /* ipAddressRowStatus_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipAddressRowStatus_undo(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressRowStatus_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipAddressRowStatus undo.
+ */
+ /*
+ * copy ipAddressRowStatus data
+ * set rowreq_ctx->data->ipAddressRowStatus from rowreq_ctx->undo->ipAddressRowStatus
+ */
+ rowreq_ctx->ipAddressRowStatus = rowreq_ctx->ipAddressRowStatus_undo;
+
+ return MFD_SUCCESS;
+} /* ipAddressRowStatus_undo */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressStorageType
+ * ipAddressStorageType is subid 11 of ipAddressEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.2.1.4.34.1.11
+ * Description:
+The storage type for this conceptual row. If this object
+ has a value of 'permanent' then no other objects are
+ required to be able to be modified.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: volatile
+ *
+ * Enum range: 4/8. Values: other(1), volatile(2), nonVolatile(3), permanent(4), readOnly(5)
+ *
+ * Its syntax is StorageType (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipAddressStorageType_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipAddressTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of other(1), volatile(2), nonVolatile(3), permanent(4), readOnly(5)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipAddressStorageType_check_value(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ u_long ipAddressStorageType_val)
+{
+ int rc;
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressStorageType_check_value",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipAddressStorageType value.
+ */
+ /*
+ * since I don't know how the various operating systems
+ * deal with ip addresses, and whether or not changes will
+ * be saved on reboot, so don't allow rows to be set to anything
+ * but volatile. I'd prefer other, but since the default for
+ * new rows, per the mib, is volatile...
+ *
+ * If some industrious soul would like
+ * non-volaltile support, the first would need to
+ * add it in the data access code for their os
+ * define a flag bit for volatile/permanent/readonly
+ * set the bit in data access
+ * copy the bit to a new var in the rowreq_ctx (see _add_new_entry)
+ * with a default of volatile (for os' w/out nonvolatile support)
+ * update this code to use new flag
+ */
+ if (STORAGETYPE_VOLATILE != ipAddressStorageType_val)
+ return MFD_NOT_VALID_EVER;
+
+ /*
+ * check for valid StorageType transition (old, new)
+ */
+ rc = check_storage_transition(rowreq_ctx->data->ia_storagetype,
+ ipAddressStorageType_val);
+ if (MFD_SUCCESS != rc)
+ return rc;
+
+ return MFD_SUCCESS; /* ipAddressStorageType value not illegal */
+} /* ipAddressStorageType_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipAddressTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipAddressTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipAddressStorageType_undo_setup(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressStorageType_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipAddressStorageType undo.
+ */
+ /*
+ * handled in ipAddressTable_undo_setup
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressStorageType_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipAddressStorageType_val
+ * A long containing the new value.
+ */
+int
+ipAddressStorageType_set(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ u_long ipAddressStorageType_val)
+{
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressStorageType_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipAddressStorageType value.
+ * set ipAddressStorageType value in rowreq_ctx->data
+ */
+ rowreq_ctx->data->ia_storagetype = ipAddressStorageType_val;
+
+ return MFD_SUCCESS;
+} /* ipAddressStorageType_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipAddressStorageType_undo(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressStorageType_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipAddressStorageType undo.
+ */
+ /*
+ * copy ipAddressStorageType data
+ * set rowreq_ctx->data->ipAddressStorageType from rowreq_ctx->undo->ipAddressStorageType
+ */
+ rowreq_ctx->data->ia_storagetype = rowreq_ctx->undo->ia_storagetype;
+
+ return MFD_SUCCESS;
+} /* ipAddressStorageType_undo */
+
+/**
+ * check dependencies
+ *
+ * This is useful for for tables which have dependencies between columns
+ * (or rows, or tables). For example, two columns allocating a percentage
+ * of something add up 100%.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * ipAddressTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @retval MFD_SUCCESS all the changes to the row are legal
+ * @retval MFD_ERROR one or more changes are not legal
+ *
+ * (see README-table-ipAddressTable if you don't have dependencies)
+ */
+int
+ipAddressTable_check_dependencies(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipAddressTable:ipAddressTable_check_dependencies", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:470:o: Check ipAddressTable row dependencies.
+ * check that all new value are legal and consistent with each other
+ */
+ /*
+ * check RowStatus dependencies
+ */
+ if (rowreq_ctx->column_set_flags & COLUMN_IPADDRESSROWSTATUS_FLAG) {
+ /*
+ * row creation requirements
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ if (ROWSTATUS_DESTROY == rowreq_ctx->ipAddressRowStatus) {
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED;
+ } else if (ROWSTATUS_CREATEANDGO ==
+ rowreq_ctx->ipAddressRowStatus) {
+ if ((rowreq_ctx->
+ column_set_flags & IPADDRESSTABLE_REQUIRED_COLS)
+ != IPADDRESSTABLE_REQUIRED_COLS) {
+ DEBUGMSGTL(("ipAddressTable",
+ "required columns missing (0x%0x != 0x%0x)\n",
+ rowreq_ctx->column_set_flags,
+ IPADDRESSTABLE_REQUIRED_COLS));
+ return MFD_CANNOT_CREATE_NOW;
+ }
+ rowreq_ctx->ipAddressRowStatus = ROWSTATUS_ACTIVE;
+ }
+ } /* row creation */
+ else {
+ /*
+ * row change requirements
+ */
+ /*
+ * don't allow a destroy if any other value was changed, since
+ * that might call data access routines with bad info.
+ *
+ * you may or may not require the row be notInService before it
+ * can be destroyed.
+ */
+ if (ROWSTATUS_DESTROY == rowreq_ctx->ipAddressRowStatus) {
+ if (rowreq_ctx->
+ column_set_flags & ~COLUMN_IPADDRESSROWSTATUS_FLAG) {
+ DEBUGMSGTL(("ipAddressTable",
+ "destroy must be only varbind for row\n"));
+ return MFD_NOT_VALID_NOW;
+ }
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED;
+
+ } /* row destroy */
+ } /* row change */
+ } else {
+ /*
+ * must have row status to create a row
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ DEBUGMSGTL(("ipAddressTable",
+ "must use RowStatus to create rows\n"));
+ return MFD_CANNOT_CREATE_NOW;
+ }
+ } /* row status not set */
+
+ return rc;
+} /* ipAddressTable_check_dependencies */
+
+/** @} */
+/** @{ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.h
new file mode 100644
index 0000000000..6f4cafe042
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.h
@@ -0,0 +1,457 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: ipAddressTable.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+#ifndef IPADDRESSTABLE_H
+#define IPADDRESSTABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @addtogroup misc misc: Miscellaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/data_access/ipaddress.h>
+
+ /*
+ * other required module components
+ */
+ /* *INDENT-OFF* */
+config_require(if-mib/data_access/interface)
+config_require(ip-mib/data_access/ipaddress)
+config_require(ip-mib/ipAddressTable/ipAddressTable_interface)
+config_require(ip-mib/ipAddressTable/ipAddressTable_data_access)
+ /* *INDENT-ON* */
+
+ /*
+ * OID, column number and enum definions for ipAddressTable
+ */
+#include "ipAddressTable_constants.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_ipAddressTable(void);
+ void shutdown_ipAddressTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipAddressTable is subid 34 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.34, length: 8
+ */
+ /*
+ *********************************************************************
+ * When you register your mib, you get to provide a generic
+ * pointer that will be passed back to you for most of the
+ * functions calls.
+ *
+ * TODO:100:r: Review all context structures
+ */
+ /*
+ * TODO:101:o: |-> Review ipAddressTable registration context.
+ */
+ typedef netsnmp_data_list ipAddressTable_registration;
+
+/**********************************************************************/
+ /*
+ * TODO:110:r: |-> Review ipAddressTable data context structure.
+ * This structure is used to represent the data for ipAddressTable.
+ */
+ typedef netsnmp_ipaddress_entry ipAddressTable_data;
+
+
+ /*
+ *********************************************************************
+ * TODO:115:o: |-> Review ipAddressTable undo context.
+ * We're just going to use the same data structure for our
+ * undo_context. If you want to do something more efficent,
+ * define your typedef here.
+ */
+ typedef ipAddressTable_data ipAddressTable_undo_data;
+
+ /*
+ * TODO:120:r: |-> Review ipAddressTable mib index.
+ * This structure is used to represent the index for ipAddressTable.
+ */
+ typedef struct ipAddressTable_mib_index_s {
+
+ /*
+ * ipAddressAddrType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ u_long ipAddressAddrType;
+
+ /*
+ * ipAddressAddr(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ /** 128 - 1(other indexes) - oid length(10) = 116 */
+ char ipAddressAddr[116];
+ size_t ipAddressAddr_len;
+
+
+ } ipAddressTable_mib_index;
+
+ /*
+ * TODO:121:r: | |-> Review ipAddressTable max index length.
+ * If you KNOW that your indexes will never exceed a certain
+ * length, update this macro to that length.
+ *
+ * BE VERY CAREFUL TO TAKE INTO ACCOUNT THE MAXIMUM
+ * POSSIBLE LENGHT FOR EVERY VARIABLE LENGTH INDEX!
+ * Guessing 128 - col/entry(2) - oid len(8)
+ */
+#define MAX_ipAddressTable_IDX_LEN 118
+
+
+ /*
+ *********************************************************************
+ * TODO:130:o: |-> Review ipAddressTable Row request (rowreq) context.
+ * When your functions are called, you will be passed a
+ * ipAddressTable_rowreq_ctx pointer.
+ */
+ typedef struct ipAddressTable_rowreq_ctx_s {
+
+ /** this must be first for container compare to work */
+ netsnmp_index oid_idx;
+ oid oid_tmp[MAX_ipAddressTable_IDX_LEN];
+
+ ipAddressTable_mib_index tbl_idx;
+
+ ipAddressTable_data *data;
+ ipAddressTable_undo_data *undo;
+ unsigned int column_set_flags; /* flags for set columns */
+
+
+ /*
+ * flags per row. Currently, the first (lower) 8 bits are reserved
+ * for the user. See mfd.h for other flags.
+ */
+ u_int rowreq_flags;
+
+ /*
+ * TODO:131:o: | |-> Add useful data to ipAddressTable rowreq context.
+ */
+
+ /*
+ * not available from net-snmp ipaddress data_access
+ */
+ uint32_t ipAddressCreated; /* sysUpTime */
+ uint32_t ipAddressLastChanged, ipAddressLastChanged_undo; /* sysUpTime */
+ int ipAddressRowStatus, ipAddressRowStatus_undo;
+
+ /*
+ * storage for future expansion
+ */
+ netsnmp_data_list *ipAddressTable_data_list;
+
+ } ipAddressTable_rowreq_ctx;
+
+ typedef struct ipAddressTable_ref_rowreq_ctx_s {
+ ipAddressTable_rowreq_ctx *rowreq_ctx;
+ } ipAddressTable_ref_rowreq_ctx;
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int ipAddressTable_pre_request(ipAddressTable_registration
+ * user_context);
+ int ipAddressTable_post_request(ipAddressTable_registration
+ * user_context, int rc);
+
+ int
+ ipAddressTable_rowreq_ctx_init(ipAddressTable_rowreq_ctx *
+ rowreq_ctx, void *user_init_ctx);
+ void
+ ipAddressTable_rowreq_ctx_cleanup(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+
+ ipAddressTable_data *ipAddressTable_allocate_data(void);
+ void ipAddressTable_release_data(ipAddressTable_data *
+ data);
+
+ int
+ ipAddressTable_check_dependencies(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipAddressTable_commit(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+
+ ipAddressTable_rowreq_ctx
+ * ipAddressTable_row_find_by_mib_index(ipAddressTable_mib_index *
+ mib_idx);
+
+ extern oid ipAddressTable_oid[];
+ extern int ipAddressTable_oid_size;
+
+
+#include "ipAddressTable_interface.h"
+#include "ipAddressTable_data_access.h"
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipAddressTable is subid 34 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.34, length: 8
+ */
+ /*
+ * indexes
+ */
+ int ipAddressAddrType_map(u_long *
+ mib_ipAddressAddrType_val_ptr,
+ u_long
+ raw_ipAddressAddrType_val);
+
+ int ipAddressIfIndex_get(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ long *ipAddressIfIndex_val_ptr);
+ int ipAddressType_get(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long * ipAddressType_val_ptr);
+ int ipAddressPrefix_get(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ oid ** ipAddressPrefix_val_ptr_ptr,
+ size_t
+ * ipAddressPrefix_val_ptr_len_ptr);
+ int ipAddressOrigin_get(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long * ipAddressOrigin_val_ptr);
+ int ipAddressStatus_get(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long * ipAddressStatus_val_ptr);
+ int ipAddressCreated_get(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipAddressCreated_val_ptr);
+ int ipAddressLastChanged_get(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipAddressLastChanged_val_ptr);
+ int ipAddressRowStatus_get(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipAddressRowStatus_val_ptr);
+ int ipAddressStorageType_get(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipAddressStorageType_val_ptr);
+
+
+ int
+ ipAddressTable_indexes_set_tbl_idx(ipAddressTable_mib_index *
+ tbl_idx,
+ u_long ipAddressAddrType_val,
+ char *ipAddressAddr_val_ptr,
+ size_t
+ ipAddressAddr_val_ptr_len);
+ int ipAddressTable_indexes_set(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ipAddressAddrType_val,
+ char *ipAddressAddr_val_ptr,
+ size_t
+ ipAddressAddr_val_ptr_len);
+
+
+
+ /*
+ *********************************************************************
+ * SET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * SET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipAddressTable is subid 34 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.34, length: 8
+ */
+
+
+ int ipAddressTable_undo_setup(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipAddressTable_undo_cleanup(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipAddressTable_undo(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipAddressTable_commit(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipAddressTable_undo_commit(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+ int ipAddressIfIndex_check_value(ipAddressTable_rowreq_ctx
+ * rowreq_ctx, long
+ ipAddressIfIndex_val);
+
+ int ipAddressIfIndex_undo_setup(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipAddressIfIndex_set(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipAddressIfIndex_val);
+ int ipAddressIfIndex_undo(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ipAddressType_check_value(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipAddressType_val);
+ int ipAddressType_undo_setup(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipAddressType_set(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipAddressType_val);
+ int ipAddressType_undo(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ipAddressPrefix_check_value(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ oid *
+ ipAddressPrefix_val_ptr,
+ size_t
+ ipAddressPrefix_val_ptr_len);
+ int ipAddressPrefix_undo_setup(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipAddressPrefix_set(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ oid * ipAddressPrefix_val_ptr,
+ size_t
+ ipAddressPrefix_val_ptr_len);
+ int ipAddressPrefix_undo(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ipAddressOrigin_check_value(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ipAddressOrigin_val);
+ int ipAddressOrigin_undo_setup(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipAddressOrigin_set(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipAddressOrigin_val);
+ int ipAddressOrigin_undo(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ipAddressStatus_check_value(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ipAddressStatus_val);
+ int ipAddressStatus_undo_setup(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipAddressStatus_set(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipAddressStatus_val);
+ int ipAddressStatus_undo(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ipAddressCreated_check_value(ipAddressTable_rowreq_ctx
+ * rowreq_ctx,
+ u_long
+ ipAddressCreated_val);
+ int ipAddressCreated_undo_setup(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipAddressCreated_set(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipAddressCreated_val);
+ int ipAddressCreated_undo(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ ipAddressLastChanged_check_value(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipAddressLastChanged_val);
+ int
+ ipAddressLastChanged_undo_setup(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipAddressLastChanged_set(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ipAddressLastChanged_val);
+ int ipAddressLastChanged_undo(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ ipAddressRowStatus_check_value(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipAddressRowStatus_val);
+ int ipAddressRowStatus_undo_setup(ipAddressTable_rowreq_ctx
+ * rowreq_ctx);
+ int ipAddressRowStatus_set(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipAddressRowStatus_val);
+ int ipAddressRowStatus_undo(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ ipAddressStorageType_check_value(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipAddressStorageType_val);
+ int
+ ipAddressStorageType_undo_setup(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipAddressStorageType_set(ipAddressTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ipAddressStorageType_val);
+ int ipAddressStorageType_undo(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+ int
+ ipAddressTable_check_dependencies(ipAddressTable_rowreq_ctx * ctx);
+
+
+ /*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPADDRESSTABLE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_constants.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_constants.h
new file mode 100644
index 0000000000..e7a7ae50a6
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_constants.h
@@ -0,0 +1,213 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $
+ *
+ * $Id: ipAddressTable_constants.h 13767 2005-12-01 17:00:57Z rstory $
+ */
+#ifndef IPADDRESSTABLE_CONSTANTS_H
+#define IPADDRESSTABLE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ * column number definitions for table ipAddressTable
+ */
+#define IPADDRESSTABLE_OID 1,3,6,1,2,1,4,34
+
+#define COLUMN_IPADDRESSADDRTYPE 1
+
+#define COLUMN_IPADDRESSADDR 2
+
+#define COLUMN_IPADDRESSIFINDEX 3
+#define COLUMN_IPADDRESSIFINDEX_FLAG (0x1 << 2)
+
+#define COLUMN_IPADDRESSTYPE 4
+#define COLUMN_IPADDRESSTYPE_FLAG (0x1 << 3)
+
+#define COLUMN_IPADDRESSPREFIX 5
+
+#define COLUMN_IPADDRESSORIGIN 6
+
+#define COLUMN_IPADDRESSSTATUS 7
+#define COLUMN_IPADDRESSSTATUS_FLAG (0x1 << 6)
+
+#define COLUMN_IPADDRESSCREATED 8
+
+#define COLUMN_IPADDRESSLASTCHANGED 9
+
+#define COLUMN_IPADDRESSROWSTATUS 10
+#define COLUMN_IPADDRESSROWSTATUS_FLAG (0x1 << 9)
+
+#define COLUMN_IPADDRESSSTORAGETYPE 11
+#define COLUMN_IPADDRESSSTORAGETYPE_FLAG (0x1 << 10)
+
+
+#define IPADDRESSTABLE_MIN_COL COLUMN_IPADDRESSIFINDEX
+#define IPADDRESSTABLE_MAX_COL COLUMN_IPADDRESSSTORAGETYPE
+
+ /*
+ * TODO:405:r: Review IPADDRESSTABLE_SETTABLE_COLS macro.
+ * OR together all the writable cols.
+ */
+#define IPADDRESSTABLE_SETTABLE_COLS (COLUMN_IPADDRESSIFINDEX_FLAG | COLUMN_IPADDRESSTYPE_FLAG | COLUMN_IPADDRESSSTATUS_FLAG | COLUMN_IPADDRESSROWSTATUS_FLAG | COLUMN_IPADDRESSSTORAGETYPE_FLAG)
+ /*
+ * TODO:405:r: Review IPADDRESSTABLE_REQUIRED_COLS macro.
+ * OR together all the required rows for row creation.
+ * default is writable cols w/out defaults.
+ */
+#define IPADDRESSTABLE_REQUIRED_COLS (COLUMN_IPADDRESSIFINDEX_FLAG | COLUMN_IPADDRESSROWSTATUS_FLAG)
+
+ /*
+ * NOTES on enums
+ * ==============
+ *
+ * Value Mapping
+ * -------------
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them
+ * below. For example, a boolean flag (1/0) is usually represented
+ * as a TruthValue in a MIB, which maps to the values (1/2).
+ *
+ */
+/*************************************************************************
+ *************************************************************************
+ *
+ * enum definitions for table ipAddressTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipAddressAddrType (InetAddressType / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef INETADDRESSTYPE_ENUMS
+#define INETADDRESSTYPE_ENUMS
+
+#define INETADDRESSTYPE_UNKNOWN 0
+#define INETADDRESSTYPE_IPV4 1
+#define INETADDRESSTYPE_IPV6 2
+#define INETADDRESSTYPE_IPV4Z 3
+#define INETADDRESSTYPE_IPV6Z 4
+#define INETADDRESSTYPE_DNS 16
+
+#endif /* INETADDRESSTYPE_ENUMS */
+
+ /*
+ * TODO:140:o: Define your interal representation of ipAddressAddrType enums.
+ * (used for value mapping; see notes at top of file)
+ *
+ * simplistic map of address length to type
+ */
+#define INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV4 4
+#define INTERNAL_IPADDRESSTABLE_IPADDRESSADDRTYPE_IPV6 16
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipAddressType (INTEGER / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef IPADDRESSTYPE_ENUMS
+#define IPADDRESSTYPE_ENUMS
+
+#define IPADDRESSTYPE_UNICAST 1
+#define IPADDRESSTYPE_ANYCAST 2
+#define IPADDRESSTYPE_BROADCAST 3
+
+#endif /* IPADDRESSTYPE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipAddressOrigin (IpAddressOriginTC / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef IPADDRESSORIGINTC_ENUMS
+#define IPADDRESSORIGINTC_ENUMS
+
+#define IPADDRESSORIGINTC_OTHER 1
+#define IPADDRESSORIGINTC_MANUAL 2
+#define IPADDRESSORIGINTC_DHCP 4
+#define IPADDRESSORIGINTC_LINKLAYER 5
+#define IPADDRESSORIGINTC_RANDOM 6
+
+#endif /* IPADDRESSORIGINTC_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipAddressStatus (IpAddressStatusTC / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef IPADDRESSSTATUSTC_ENUMS
+#define IPADDRESSSTATUSTC_ENUMS
+
+#define IPADDRESSSTATUSTC_PREFERRED 1
+#define IPADDRESSSTATUSTC_DEPRECATED 2
+#define IPADDRESSSTATUSTC_INVALID 3
+#define IPADDRESSSTATUSTC_INACCESSIBLE 4
+#define IPADDRESSSTATUSTC_UNKNOWN 5
+#define IPADDRESSSTATUSTC_TENTATIVE 6
+#define IPADDRESSSTATUSTC_DUPLICATE 7
+
+#endif /* IPADDRESSSTATUSTC_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipAddressRowStatus (RowStatus / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef ROWSTATUS_ENUMS
+#define ROWSTATUS_ENUMS
+
+#define ROWSTATUS_ACTIVE 1
+#define ROWSTATUS_NOTINSERVICE 2
+#define ROWSTATUS_NOTREADY 3
+#define ROWSTATUS_CREATEANDGO 4
+#define ROWSTATUS_CREATEANDWAIT 5
+#define ROWSTATUS_DESTROY 6
+
+#endif /* ROWSTATUS_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipAddressStorageType (StorageType / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef STORAGETYPE_ENUMS
+#define STORAGETYPE_ENUMS
+
+#define STORAGETYPE_OTHER 1
+#define STORAGETYPE_VOLATILE 2
+#define STORAGETYPE_NONVOLATILE 3
+#define STORAGETYPE_PERMANENT 4
+#define STORAGETYPE_READONLY 5
+
+#endif /* STORAGETYPE_ENUMS */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPADDRESSTABLE_OIDS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.c
new file mode 100644
index 0000000000..f7b0fa4d81
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.c
@@ -0,0 +1,708 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: ipAddressTable_data_access.c 16381 2007-05-17 21:53:28Z hardaker $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipAddressTable.h"
+
+
+#include "ipAddressTable_data_access.h"
+
+#include <sys/ioctl.h>
+#include <errno.h>
+
+
+/** @ingroup interface
+ * @addtogroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipAddressTable is subid 34 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.34, length: 8
+ */
+
+/**
+ * initialization for ipAddressTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param ipAddressTable_reg
+ * Pointer to ipAddressTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+ipAddressTable_init_data(ipAddressTable_registration * ipAddressTable_reg)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_init_data",
+ "called\n"));
+
+ /*
+ * TODO:303:o: Initialize ipAddressTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressTable_init_data */
+
+/**
+ * container overview
+ *
+ */
+/**
+ * check entry for update
+ */
+static void
+_clear_times(ipAddressTable_rowreq_ctx * rowreq_ctx, void *magic)
+{
+ rowreq_ctx->ipAddressLastChanged = rowreq_ctx->ipAddressCreated = 0;
+}
+
+/**
+ * container initialization
+ *
+ * @param container_ptr_ptr A pointer to a container pointer. If you
+ * create a custom container, use this parameter to return it
+ * to the MFD helper. If set to NULL, the MFD helper will
+ * allocate a container for you.
+ * @param cache A pointer to a cache structure. You can set the timeout
+ * and other cache flags using this pointer.
+ *
+ * This function is called at startup to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases. If no custom
+ * container is allocated, the MFD code will create one for your.
+ *
+ * This is also the place to set up cache behavior. The default, to
+ * simply set the cache timeout, will work well with the default
+ * container. If you are using a custom container, you may want to
+ * look at the cache helper documentation to see if there are any
+ * flags you want to set.
+ *
+ * @remark
+ * This would also be a good place to do any initialization needed
+ * for you data source. For example, opening a connection to another
+ * process that will supply the data, opening a database, etc.
+ */
+void
+ipAddressTable_container_init(netsnmp_container **container_ptr_ptr,
+ netsnmp_cache * cache)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_container_init",
+ "called\n"));
+
+ if (NULL == container_ptr_ptr) {
+ snmp_log(LOG_ERR,
+ "bad container param to ipAddressTable_container_init\n");
+ return;
+ }
+
+ /*
+ * For advanced users, you can use a custom container. If you
+ * do not create one, one will be created for you.
+ */
+ /*
+ * We create a custom container here so we can pre-load it, which
+ * will result in all new entries with last changed values. we need
+ * to clear those... We also need to make sure ifIndexes have been
+ * assigned...
+ */
+ *container_ptr_ptr =
+ netsnmp_container_find("ipAddressTable:table_container");
+ if (NULL != *container_ptr_ptr) {
+ ipAddressTable_container_load(*container_ptr_ptr);
+ CONTAINER_FOR_EACH(*container_ptr_ptr,
+ (netsnmp_container_obj_func *) _clear_times,
+ NULL);
+ }
+
+ if (NULL == cache) {
+ snmp_log(LOG_ERR,
+ "bad cache param to ipAddressTable_container_init\n");
+ return;
+ }
+
+ /*
+ * TODO:345:A: Set up ipAddressTable cache properties.
+ *
+ * Also for advanced users, you can set parameters for the
+ * cache. Do not change the magic pointer, as it is used
+ * by the MFD helper. To completely disable caching, set
+ * cache->enabled to 0.
+ */
+
+ /*
+ * basically, turn off all automatic cache handling except autoload.
+ */
+ cache->flags |=
+ (NETSNMP_CACHE_DONT_AUTO_RELEASE | NETSNMP_CACHE_DONT_FREE_EXPIRED
+ | NETSNMP_CACHE_DONT_FREE_BEFORE_LOAD | NETSNMP_CACHE_AUTO_RELOAD
+ | NETSNMP_CACHE_DONT_INVALIDATE_ON_SET);
+} /* ipAddressTable_container_init */
+
+/**
+ * container shutdown
+ *
+ * @param container_ptr A pointer to the container.
+ *
+ * This function is called at shutdown to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases.
+ *
+ * This function is called before ipAddressTable_container_free().
+ *
+ * @remark
+ * This would also be a good place to do any cleanup needed
+ * for you data source. For example, closing a connection to another
+ * process that supplied the data, closing a database, etc.
+ */
+void
+ipAddressTable_container_shutdown(netsnmp_container *container_ptr)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_container_shutdown",
+ "called\n"));
+
+ if (NULL == container_ptr) {
+ snmp_log(LOG_ERR,
+ "bad params to ipAddressTable_container_shutdown\n");
+ return;
+ }
+
+} /* ipAddressTable_container_shutdown */
+
+/**
+ * check entry for update
+ */
+static void
+_check_entry_for_updates(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ void **magic)
+{
+ netsnmp_container *ipaddress_container = magic[0];
+ netsnmp_container *to_delete = (netsnmp_container *) magic[1];
+
+ /*
+ * check for matching entry using secondary index.
+ */
+ netsnmp_ipaddress_entry *ipaddress_entry =
+ CONTAINER_FIND(ipaddress_container, rowreq_ctx->data);
+ if (NULL == ipaddress_entry) {
+ DEBUGMSGTL(("ipAddressTable:access", "removing missing entry\n"));
+
+ if (NULL == to_delete) {
+ magic[1] = to_delete = netsnmp_container_find("lifo");
+ if (NULL == to_delete)
+ snmp_log(LOG_ERR, "couldn't create delete container\n");
+ }
+ if (NULL != to_delete)
+ CONTAINER_INSERT(to_delete, rowreq_ctx);
+ } else {
+ DEBUGMSGTL(("ipAddressTable:access", "updating existing entry\n"));
+
+ /*
+ * Check for changes & update
+ */
+ if (netsnmp_access_ipaddress_entry_update(rowreq_ctx->data,
+ ipaddress_entry) > 0)
+ rowreq_ctx->ipAddressLastChanged = netsnmp_get_agent_uptime();
+
+ /*
+ * remove entry from ifcontainer
+ */
+ CONTAINER_REMOVE(ipaddress_container, ipaddress_entry);
+ netsnmp_access_ipaddress_entry_free(ipaddress_entry);
+ }
+}
+
+/**
+ * add new entry
+ */
+static void
+_add_new_entry(netsnmp_ipaddress_entry *ipaddress_entry,
+ netsnmp_container *container)
+{
+ ipAddressTable_rowreq_ctx *rowreq_ctx;
+
+ DEBUGMSGTL(("ipAddressTable:access", "creating new entry\n"));
+
+ netsnmp_assert(NULL != ipaddress_entry);
+ netsnmp_assert(NULL != container);
+
+ /*
+ * allocate an row context and set the index(es)
+ */
+ rowreq_ctx = ipAddressTable_allocate_rowreq_ctx(ipaddress_entry, NULL);
+ if ((NULL != rowreq_ctx) &&
+ (MFD_SUCCESS ==
+ ipAddressTable_indexes_set(rowreq_ctx,
+ ipaddress_entry->ia_address_len,
+ ipaddress_entry->ia_address,
+ ipaddress_entry->ia_address_len))) {
+ if (CONTAINER_INSERT(container, rowreq_ctx) < 0) {
+ DEBUGMSGTL (("ipAddressTable:access","container insert failed for new entry\n"));
+ ipAddressTable_release_rowreq_ctx(rowreq_ctx);
+ return;
+ }
+ rowreq_ctx->ipAddressLastChanged =
+ rowreq_ctx->ipAddressCreated = netsnmp_get_agent_uptime();
+ } else {
+ if (NULL != rowreq_ctx) {
+ snmp_log(LOG_ERR, "error setting index while loading "
+ "ipAddressTable cache.\n");
+ ipAddressTable_release_rowreq_ctx(rowreq_ctx);
+ } else {
+ snmp_log(LOG_ERR, "memory allocation failed while loading "
+ "ipAddressTable cache.\n");
+ netsnmp_access_ipaddress_entry_free(ipaddress_entry);
+ }
+
+ return;
+ }
+
+ /*-------------------------------------------------------------------
+ * handle data that isn't part of the data_access ipaddress structure
+ */
+ rowreq_ctx->ipAddressRowStatus = ROWSTATUS_ACTIVE;
+}
+
+/**
+ * load initial data
+ *
+ * TODO:350:M: Implement ipAddressTable data load
+ * This function will also be called by the cache helper to load
+ * the container again (after the container free function has been
+ * called to free the previous contents).
+ *
+ * @param container container to which items should be inserted
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
+ * @retval MFD_ERROR : other error.
+ *
+ * This function is called to load the index(es) (and data, optionally)
+ * for the every row in the data set.
+ *
+ * @remark
+ * While loading the data, the only important thing is the indexes.
+ * If access to your data is cheap/fast (e.g. you have a pointer to a
+ * structure in memory), it would make sense to update the data here.
+ * If, however, the accessing the data invovles more work (e.g. parsing
+ * some other existing data, or peforming calculations to derive the data),
+ * then you can limit yourself to setting the indexes and saving any
+ * information you will need later. Then use the saved information in
+ * ipAddressTable_row_prep() for populating data.
+ *
+ * @note
+ * If you need consistency between rows (like you want statistics
+ * for each row to be from the same time frame), you should set all
+ * data here.
+ *
+ */
+int
+ipAddressTable_container_load(netsnmp_container *container)
+{
+ netsnmp_container *ipaddress_container;
+ void *tmp_ptr[2];
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_cache_load",
+ "called\n"));
+
+ /*
+ * TODO:351:M: |-> Load/update data in the ipAddressTable container.
+ * loop over your ipAddressTable data, allocate a rowreq context,
+ * set the index(es) [and data, optionally] and insert into
+ * the container.
+ */
+ ipaddress_container =
+ netsnmp_access_ipaddress_container_load(NULL,
+ NETSNMP_ACCESS_IPADDRESS_LOAD_ADDL_IDX_BY_ADDR);
+ /*
+ * we just got a fresh copy of interface data. compare it to
+ * what we've already got, and make any adjustments, saving
+ * missing addresses to be deleted.
+ */
+ tmp_ptr[0] = ipaddress_container->next;
+ tmp_ptr[1] = NULL;
+ CONTAINER_FOR_EACH(container, (netsnmp_container_obj_func *)
+ _check_entry_for_updates, tmp_ptr);
+
+ /*
+ * now add any new interfaces
+ */
+ CONTAINER_FOR_EACH(ipaddress_container,
+ (netsnmp_container_obj_func *) _add_new_entry,
+ container);
+
+ /*
+ * free the container. we've either claimed each entry, or released it,
+ * so the access function doesn't need to clear the container.
+ */
+ netsnmp_access_ipaddress_container_free(ipaddress_container,
+ NETSNMP_ACCESS_IPADDRESS_FREE_DONT_CLEAR);
+
+ /*
+ * remove deleted addresses from table container
+ */
+ if (NULL != tmp_ptr[1]) {
+ netsnmp_container *tmp_container =
+ (netsnmp_container *) tmp_ptr[1];
+ ipAddressTable_rowreq_ctx *tmp_ctx;
+
+ /*
+ * this works because the tmp_container is a linked list,
+ * which can be used like a stack...
+ */
+ while (CONTAINER_SIZE(tmp_container)) {
+ /*
+ * get from delete list
+ */
+ tmp_ctx = CONTAINER_FIRST(tmp_container);
+
+ /*
+ * release context, delete from table container
+ */
+ CONTAINER_REMOVE(container, tmp_ctx);
+ ipAddressTable_release_rowreq_ctx(tmp_ctx);
+
+ /*
+ * pop off delete list
+ */
+ CONTAINER_REMOVE(tmp_container, NULL);
+ }
+ }
+
+ DEBUGMSGT(("verbose:ipAddressTable:ipAddressTable_cache_load",
+ "%d records\n", CONTAINER_SIZE(container)));
+
+ return MFD_SUCCESS;
+}
+
+/**
+ * container clean up
+ *
+ * @param container container with all current items
+ *
+ * This optional callback is called prior to all
+ * item's being removed from the container. If you
+ * need to do any processing before that, do it here.
+ *
+ * @note
+ * The MFD helper will take care of releasing all the row contexts.
+ *
+ */
+void
+ipAddressTable_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_container_free",
+ "called\n"));
+
+ /*
+ * TODO:380:M: Free ipAddressTable container data.
+ */
+} /* ipAddressTable_container_free */
+
+/**
+ * prepare row for processing.
+ *
+ * When the agent has located the row for a request, this function is
+ * called to prepare the row for processing. If you fully populated
+ * the data context during the index setup phase, you may not need to
+ * do anything.
+ *
+ * @param rowreq_ctx pointer to a context.
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ */
+int
+ipAddressTable_row_prep(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_row_prep",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+
+ return MFD_SUCCESS;
+} /* ipAddressTable_row_prep */
+
+/*
+ * TODO:420:r: Implement ipAddressTable index validation.
+ */
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressAddrType
+ * ipAddressAddrType is subid 1 of ipAddressEntry.
+ * Its status is Current, and its access level is NoAccess.
+ * OID: .1.3.6.1.2.1.4.34.1.1
+ * Description:
+The address type of ipAddressAddr.
+ *
+ * Attributes:
+ * accessible 0 isscalar 0 enums 1 hasdefval 0
+ * readable 0 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ * Enum range: 5/8. Values: unknown(0), ipv4(1), ipv6(2), ipv4z(3), ipv6z(4), dns(16)
+ *
+ * Its syntax is InetAddressType (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ *
+ *
+ *
+ * NOTE: NODE ipAddressAddrType IS NOT ACCESSIBLE
+ *
+ *
+ */
+/**
+ * check validity of ipAddressAddrType index portion
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ *
+ * @note this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * ipAddressTable_validate_index() function.
+ *
+ * @note Also keep in mind that if the index refers to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ * The following checks have already been done for you:
+ * The value is one of unknown(0), ipv4(1), ipv6(2), ipv4z(3), ipv6z(4), dns(16)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ */
+int
+ipAddressAddrType_check_index(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressAddrType_check_index",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:426:M: |-> Check ipAddressTable index ipAddressAddrType.
+ * check that index value in the table context is legal.
+ * (rowreq_ctx->tbl_index.ipAddressAddrType)
+ */
+ switch (rowreq_ctx->tbl_idx.ipAddressAddrType) {
+
+ case INETADDRESSTYPE_IPV4:
+ case INETADDRESSTYPE_IPV6:
+ break;
+
+ default:
+ DEBUGMSGT(("ipAddressTable", "illegal addr type\n"));
+ return MFD_ERROR;
+ }
+
+
+ return MFD_SUCCESS; /* ipAddressAddrType index ok */
+} /* ipAddressAddrType_check_index */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipAddressEntry.ipAddressAddr
+ * ipAddressAddr is subid 2 of ipAddressEntry.
+ * Its status is Current, and its access level is NoAccess.
+ * OID: .1.3.6.1.2.1.4.34.1.2
+ * Description:
+The IP address to which this entry's addressing information
+ pertains. The address type of this object is specified in
+ ipAddressAddrType.
+
+
+ Implementors need to be aware that if the size of
+ ipAddressAddr exceeds 116 octets then OIDS of instances of
+ columns in this row will have more than 128 sub-identifiers
+ and cannot be accessed using SNMPv1, SNMPv2c or SNMPv3.
+ *
+ * Attributes:
+ * accessible 0 isscalar 0 enums 0 hasdefval 0
+ * readable 0 iscolumn 1 ranges 1 hashint 0
+ * settable 0
+ *
+ * Ranges: 0 - 255;
+ *
+ * Its syntax is InetAddress (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 255)
+ *
+ *
+ *
+ * NOTE: NODE ipAddressAddr IS NOT ACCESSIBLE
+ *
+ *
+ */
+/**
+ * check validity of ipAddressAddr index portion
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ *
+ * @note this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * ipAddressTable_validate_index() function.
+ *
+ * @note Also keep in mind that if the index refers to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ * The following checks have already been done for you:
+ * The length is in (one of) the range set(s): 0 - 255
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ */
+int
+ipAddressAddr_check_index(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressAddr_check_index",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:426:M: |-> Check ipAddressTable index ipAddressAddr.
+ * check that index value in the table context is legal.
+ * (rowreq_ctx->tbl_index.ipAddressAddr)
+ */
+ switch (rowreq_ctx->tbl_idx.ipAddressAddrType) {
+
+ case INETADDRESSTYPE_IPV4:
+ if (4 != rowreq_ctx->tbl_idx.ipAddressAddr_len) {
+ DEBUGMSGT(("ipAddressTable", "bad addr len\n"));
+ return MFD_ERROR;
+ }
+ break;
+
+ case INETADDRESSTYPE_IPV6:
+ /** xxx-rks: allow 20? */
+ if (16 != rowreq_ctx->tbl_idx.ipAddressAddr_len) {
+ DEBUGMSGT(("ipAddressTable", "bad addr len\n"));
+ return MFD_ERROR;
+ }
+ break;
+
+ default:
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS; /* ipAddressAddr index ok */
+} /* ipAddressAddr_check_index */
+
+/**
+ * verify specified index is valid.
+ *
+ * This check is independent of whether or not the values specified for
+ * the columns of the new row are valid. Column values and row consistency
+ * will be checked later. At this point, only the index values should be
+ * checked.
+ *
+ * All of the individual index validation functions have been called, so this
+ * is the place to make sure they are valid as a whole when combined. If
+ * you only have one index, then you probably don't need to do anything else
+ * here.
+ *
+ * @note Keep in mind that if the indexes refer to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ *
+ * @param ipAddressTable_reg
+ * Pointer to the user registration data
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_CANNOT_CREATE_NOW : index not valid right now
+ * @retval MFD_CANNOT_CREATE_EVER : index never valid
+ */
+int
+ipAddressTable_validate_index(ipAddressTable_registration *
+ ipAddressTable_reg,
+ ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_validate_index",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:430:M: |-> Validate potential ipAddressTable index.
+ *
+ *
+ * xxx-rks: we only plan ipv4 support initially
+ */
+ if ((4 != rowreq_ctx->tbl_idx.ipAddressAddr_len)) {
+ snmp_log(LOG_WARNING, "invalid index for a new row in the "
+ "ipAddressTable table.\n");
+ /*
+ * determine failure type.
+ *
+ * If the index could not ever be created, return MFD_NOT_EVER
+ * If the index can not be created under the present circumstances
+ * (even though it could be created under other circumstances),
+ * return MFD_NOT_NOW.
+ */
+ if (0) {
+ return MFD_CANNOT_CREATE_EVER;
+ } else {
+ return MFD_CANNOT_CREATE_NOW;
+ }
+ } else {
+ rowreq_ctx->data->ia_address[0] =
+ rowreq_ctx->tbl_idx.ipAddressAddr[0];
+ rowreq_ctx->data->ia_address[1] =
+ rowreq_ctx->tbl_idx.ipAddressAddr[1];
+ rowreq_ctx->data->ia_address[2] =
+ rowreq_ctx->tbl_idx.ipAddressAddr[2];
+ rowreq_ctx->data->ia_address[3] =
+ rowreq_ctx->tbl_idx.ipAddressAddr[3];
+ rowreq_ctx->data->ia_address_len = 4;
+ }
+
+ return rc;
+} /* ipAddressTable_validate_index */
+
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.h
new file mode 100644
index 0000000000..8e8a985501
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_data_access.h
@@ -0,0 +1,79 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: ipAddressTable_data_access.h 13767 2005-12-01 17:00:57Z rstory $
+ */
+#ifndef IPADDRESSTABLE_DATA_ACCESS_H
+#define IPADDRESSTABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipAddressTable is subid 34 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.34, length: 8
+ */
+
+
+ int ipAddressTable_init_data(ipAddressTable_registration *
+ ipAddressTable_reg);
+
+
+ /*
+ * TODO:180:o: Review ipAddressTable cache timeout.
+ * The number of seconds before the cache times out
+ */
+#define IPADDRESSTABLE_CACHE_TIMEOUT 60
+
+ void ipAddressTable_container_init(netsnmp_container
+ **container_ptr_ptr,
+ netsnmp_cache * cache);
+ void ipAddressTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int ipAddressTable_container_load(netsnmp_container
+ *container);
+ void ipAddressTable_container_free(netsnmp_container
+ *container);
+
+ int ipAddressTable_cache_load(netsnmp_container
+ *container);
+ void ipAddressTable_cache_free(netsnmp_container
+ *container);
+
+ int ipAddressTable_row_prep(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ ipAddressTable_validate_index(ipAddressTable_registration *
+ ipAddressTable_reg,
+ ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipAddressAddrType_check_index(ipAddressTable_rowreq_ctx * rowreq_ctx); /* internal */
+ int ipAddressAddr_check_index(ipAddressTable_rowreq_ctx * rowreq_ctx); /* internal */
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPADDRESSTABLE_DATA_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_interface.c
new file mode 100644
index 0000000000..6019f60edb
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_interface.c
@@ -0,0 +1,2057 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: ipAddressTable_interface.c 15781 2007-01-23 22:55:06Z rstory $
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipAddressTable.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "ipAddressTable_interface.h"
+
+#include <ctype.h>
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipAddressTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipAddressTable is subid 34 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.34, length: 8
+ */
+typedef struct ipAddressTable_interface_ctx_s {
+
+ netsnmp_container *container;
+ netsnmp_cache *cache;
+
+ ipAddressTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+ u_int table_dirty;
+
+} ipAddressTable_interface_ctx;
+
+static ipAddressTable_interface_ctx ipAddressTable_if_ctx;
+
+static void _ipAddressTable_container_init(ipAddressTable_interface_ctx
+ * if_ctx);
+static void
+ _ipAddressTable_container_shutdown(ipAddressTable_interface_ctx * if_ctx);
+
+
+netsnmp_container *
+ipAddressTable_container_get(void)
+{
+ return ipAddressTable_if_ctx.container;
+}
+
+ipAddressTable_registration *
+ipAddressTable_registration_get(void)
+{
+ return ipAddressTable_if_ctx.user_ctx;
+}
+
+ipAddressTable_registration *
+ipAddressTable_registration_set(ipAddressTable_registration * newreg)
+{
+ ipAddressTable_registration *old = ipAddressTable_if_ctx.user_ctx;
+ ipAddressTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+
+int
+ipAddressTable_container_size(void)
+{
+ return CONTAINER_SIZE(ipAddressTable_if_ctx.container);
+}
+
+u_int
+ipAddressTable_dirty_get(void)
+{
+ return ipAddressTable_if_ctx.table_dirty;
+}
+
+void
+ipAddressTable_dirty_set(u_int status)
+{
+ DEBUGMSGTL(("ipAddressTable:ipAddressTable_dirty_set",
+ "called. was %d, now %d\n",
+ ipAddressTable_if_ctx.table_dirty, status));
+ ipAddressTable_if_ctx.table_dirty = status;
+}
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_ipAddressTable_pre_request;
+static Netsnmp_Node_Handler _mfd_ipAddressTable_post_request;
+static Netsnmp_Node_Handler _mfd_ipAddressTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_ipAddressTable_get_values;
+static Netsnmp_Node_Handler _mfd_ipAddressTable_check_objects;
+static Netsnmp_Node_Handler _mfd_ipAddressTable_undo_setup;
+static Netsnmp_Node_Handler _mfd_ipAddressTable_set_values;
+static Netsnmp_Node_Handler _mfd_ipAddressTable_undo_cleanup;
+static Netsnmp_Node_Handler _mfd_ipAddressTable_undo_values;
+static Netsnmp_Node_Handler _mfd_ipAddressTable_commit;
+static Netsnmp_Node_Handler _mfd_ipAddressTable_undo_commit;
+static Netsnmp_Node_Handler _mfd_ipAddressTable_irreversible_commit;
+static Netsnmp_Node_Handler _mfd_ipAddressTable_check_dependencies;
+
+NETSNMP_STATIC_INLINE int
+ _ipAddressTable_undo_column(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var,
+ int column);
+
+NETSNMP_STATIC_INLINE int
+ _ipAddressTable_check_indexes(ipAddressTable_rowreq_ctx * rowreq_ctx);
+
+/**
+ * @internal
+ * Initialize the table ipAddressTable
+ * (Define its contents and how it's structured)
+ */
+void
+_ipAddressTable_initialize_interface(ipAddressTable_registration * reg_ptr,
+ u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &ipAddressTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info =
+ &ipAddressTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:ipAddressTable:_ipAddressTable_initialize_interface", "called\n"));
+
+
+ /*************************************************
+ *
+ * save interface context for ipAddressTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
+ /** index: ipAddressAddrType */
+ ASN_OCTET_STR,
+ /** index: ipAddressAddr */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrival.
+ */
+ tbl_info->min_column = IPADDRESSTABLE_MIN_COL;
+ tbl_info->max_column = IPADDRESSTABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ ipAddressTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ ipAddressTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _ipAddressTable_container_init(&ipAddressTable_if_ctx);
+ if (NULL == ipAddressTable_if_ctx.container) {
+ snmp_log(LOG_ERR,
+ "could not initialize container for ipAddressTable\n");
+ return;
+ }
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup = _mfd_ipAddressTable_object_lookup;
+ access_multiplexer->get_values = _mfd_ipAddressTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request = _mfd_ipAddressTable_pre_request;
+ access_multiplexer->post_request = _mfd_ipAddressTable_post_request;
+
+
+ /*
+ * REQUIRED wrappers for set request handling
+ */
+ access_multiplexer->object_syntax_checks =
+ _mfd_ipAddressTable_check_objects;
+ access_multiplexer->undo_setup = _mfd_ipAddressTable_undo_setup;
+ access_multiplexer->undo_cleanup = _mfd_ipAddressTable_undo_cleanup;
+ access_multiplexer->set_values = _mfd_ipAddressTable_set_values;
+ access_multiplexer->undo_sets = _mfd_ipAddressTable_undo_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->commit = _mfd_ipAddressTable_commit;
+ access_multiplexer->undo_commit = _mfd_ipAddressTable_undo_commit;
+ access_multiplexer->irreversible_commit =
+ _mfd_ipAddressTable_irreversible_commit;
+
+ /*
+ * REQUIRED for tables with dependencies
+ */
+ access_multiplexer->consistency_checks =
+ _mfd_ipAddressTable_check_dependencies;
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("ipAddressTable:init_ipAddressTable",
+ "Registering ipAddressTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("ipAddressTable", handler,
+ ipAddressTable_oid,
+ ipAddressTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RWRITE);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR, "error registering table ipAddressTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &ipAddressTable_if_ctx;
+
+ /*************************************************
+ *
+ * set up baby steps handler, create it and inject it
+ */
+ if (access_multiplexer->object_lookup)
+ mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
+ if (access_multiplexer->set_values)
+ mfd_modes |= BABY_STEP_SET_VALUES;
+ if (access_multiplexer->irreversible_commit)
+ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
+ if (access_multiplexer->object_syntax_checks)
+ mfd_modes |= BABY_STEP_CHECK_OBJECT;
+
+ if (access_multiplexer->pre_request)
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if (access_multiplexer->post_request)
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+ if (access_multiplexer->undo_setup)
+ mfd_modes |= BABY_STEP_UNDO_SETUP;
+ if (access_multiplexer->undo_cleanup)
+ mfd_modes |= BABY_STEP_UNDO_CLEANUP;
+ if (access_multiplexer->undo_sets)
+ mfd_modes |= BABY_STEP_UNDO_SETS;
+
+ if (access_multiplexer->row_creation)
+ mfd_modes |= BABY_STEP_ROW_CREATE;
+ if (access_multiplexer->consistency_checks)
+ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
+ if (access_multiplexer->commit)
+ mfd_modes |= BABY_STEP_COMMIT;
+ if (access_multiplexer->undo_commit)
+ mfd_modes |= BABY_STEP_UNDO_COMMIT;
+
+ handler = netsnmp_baby_steps_handler_get(mfd_modes);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
+ */
+ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler =
+ netsnmp_container_table_handler_get(tbl_info,
+ ipAddressTable_if_ctx.
+ container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject cache helper
+ */
+ if (NULL != ipAddressTable_if_ctx.cache) {
+ handler = netsnmp_cache_handler_get(ipAddressTable_if_ctx.cache);
+ netsnmp_inject_handler(reginfo, handler);
+ }
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+} /* _ipAddressTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table ipAddressTable
+ */
+void
+_ipAddressTable_shutdown_interface(ipAddressTable_registration * reg_ptr)
+{
+ /*
+ * shutdown the container
+ */
+ _ipAddressTable_container_shutdown(&ipAddressTable_if_ctx);
+}
+
+void
+ipAddressTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ ipAddressTable_if_ctx.tbl_info.valid_columns = vc;
+} /* ipAddressTable_valid_columns_set */
+
+/**
+ * @internal
+ * convert the index component stored in the context to an oid
+ */
+int
+ipAddressTable_index_to_oid(netsnmp_index * oid_idx,
+ ipAddressTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * ipAddressAddrType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_ipAddressAddrType;
+ /*
+ * ipAddressAddr(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_ipAddressAddr;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_ipAddressAddrType, 0x00, sizeof(var_ipAddressAddrType));
+ var_ipAddressAddrType.type = ASN_INTEGER;
+ memset(&var_ipAddressAddr, 0x00, sizeof(var_ipAddressAddr));
+ var_ipAddressAddr.type = ASN_OCTET_STR;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_ipAddressAddrType.next_variable = &var_ipAddressAddr;
+ var_ipAddressAddr.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_index_to_oid",
+ "called\n"));
+
+ /*
+ * ipAddressAddrType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ snmp_set_var_value(&var_ipAddressAddrType,
+ (u_char *) & mib_idx->ipAddressAddrType,
+ sizeof(mib_idx->ipAddressAddrType));
+
+ /*
+ * ipAddressAddr(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_ipAddressAddr,
+ (u_char *) & mib_idx->ipAddressAddr,
+ mib_idx->ipAddressAddr_len *
+ sizeof(mib_idx->ipAddressAddr[0]));
+
+
+ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
+ NULL, 0, &var_ipAddressAddrType);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_ipAddressAddrType);
+
+ return err;
+} /* ipAddressTable_index_to_oid */
+
+/**
+ * extract ipAddressTable indexes from a netsnmp_index
+ *
+ * @retval SNMP_ERR_NOERROR : no error
+ * @retval SNMP_ERR_GENERR : error
+ */
+int
+ipAddressTable_index_from_oid(netsnmp_index * oid_idx,
+ ipAddressTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * ipAddressAddrType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_ipAddressAddrType;
+ /*
+ * ipAddressAddr(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_ipAddressAddr;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_ipAddressAddrType, 0x00, sizeof(var_ipAddressAddrType));
+ var_ipAddressAddrType.type = ASN_INTEGER;
+ memset(&var_ipAddressAddr, 0x00, sizeof(var_ipAddressAddr));
+ var_ipAddressAddr.type = ASN_OCTET_STR;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_ipAddressAddrType.next_variable = &var_ipAddressAddr;
+ var_ipAddressAddr.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:ipAddressTable:ipAddressTable_index_from_oid",
+ "called\n"));
+
+ /*
+ * parse the oid into the individual index components
+ */
+ err = parse_oid_indexes(oid_idx->oids, oid_idx->len,
+ &var_ipAddressAddrType);
+ if (err == SNMP_ERR_NOERROR) {
+ /*
+ * copy out values
+ */
+ mib_idx->ipAddressAddrType =
+ *((u_long *) var_ipAddressAddrType.val.string);
+ /*
+ * NOTE: val_len is in bytes, ipAddressAddr_len might not be
+ */
+ if (var_ipAddressAddr.val_len > sizeof(mib_idx->ipAddressAddr))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->ipAddressAddr, var_ipAddressAddr.val.string,
+ var_ipAddressAddr.val_len);
+ mib_idx->ipAddressAddr_len =
+ var_ipAddressAddr.val_len /
+ sizeof(mib_idx->ipAddressAddr[0]);
+ }
+
+
+ }
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_ipAddressAddrType);
+
+ return err;
+} /* ipAddressTable_index_from_oid */
+
+
+/*
+ *********************************************************************
+ * @internal
+ * allocate resources for a ipAddressTable_rowreq_ctx
+ */
+ipAddressTable_rowreq_ctx *
+ipAddressTable_allocate_rowreq_ctx(ipAddressTable_data * data,
+ void *user_init_ctx)
+{
+ ipAddressTable_rowreq_ctx *rowreq_ctx =
+ SNMP_MALLOC_TYPEDEF(ipAddressTable_rowreq_ctx);
+
+ DEBUGMSGTL(("internal:ipAddressTable:ipAddressTable_allocate_rowreq_ctx", "called\n"));
+
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "Couldn't allocate memory for a "
+ "ipAddressTable_rowreq_ctx.\n");
+ return NULL;
+ } else {
+ if (NULL != data) {
+ /*
+ * track if we got data from user
+ */
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DATA_FROM_USER;
+ rowreq_ctx->data = data;
+ } else if (NULL ==
+ (rowreq_ctx->data = ipAddressTable_allocate_data())) {
+ SNMP_FREE(rowreq_ctx);
+ return NULL;
+ }
+ }
+
+ /*
+ * undo context will be allocated when needed (in *_undo_setup)
+ */
+
+ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
+
+ rowreq_ctx->ipAddressTable_data_list = NULL;
+
+ /*
+ * if we allocated data, call init routine
+ */
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) {
+ if (SNMPERR_SUCCESS !=
+ ipAddressTable_rowreq_ctx_init(rowreq_ctx, user_init_ctx)) {
+ ipAddressTable_release_rowreq_ctx(rowreq_ctx);
+ rowreq_ctx = NULL;
+ }
+ }
+
+ return rowreq_ctx;
+} /* ipAddressTable_allocate_rowreq_ctx */
+
+/*
+ * @internal
+ * release resources for a ipAddressTable_rowreq_ctx
+ */
+void
+ipAddressTable_release_rowreq_ctx(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("internal:ipAddressTable:ipAddressTable_release_rowreq_ctx", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ ipAddressTable_rowreq_ctx_cleanup(rowreq_ctx);
+
+ /*
+ * for non-transient data, don't free data we got from the user
+ */
+ if ((rowreq_ctx->data) &&
+ !(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER))
+ ipAddressTable_release_data(rowreq_ctx->data);
+
+ if (rowreq_ctx->undo)
+ ipAddressTable_release_data(rowreq_ctx->undo);
+
+ /*
+ * free index oid pointer
+ */
+ if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp)
+ free(rowreq_ctx->oid_idx.oids);
+
+ SNMP_FREE(rowreq_ctx);
+} /* ipAddressTable_release_rowreq_ctx */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipAddressTable_pre_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:ipAddressTable:_mfd_ipAddressTable_pre_request",
+ "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ipAddressTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = ipAddressTable_pre_request(ipAddressTable_if_ctx.user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipAddressTable", "error %d from "
+ "ipAddressTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipAddressTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipAddressTable_post_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipAddressTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:ipAddressTable:_mfd_ipAddressTable_post_request",
+ "called\n"));
+
+ /*
+ * release row context, if deleted
+ */
+ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
+ ipAddressTable_release_rowreq_ctx(rowreq_ctx);
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ipAddressTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ if ((MFD_SUCCESS != packet_rc) && ipAddressTable_dirty_get()) {
+ /*
+ * we shouldn't get here. the undo steps should also clear
+ * the dirty flags.
+ */
+ snmp_log(LOG_WARNING,
+ "ipAddressTable dirty flag set in post_request "
+ "but status != SUCCESS.\n");
+ }
+
+ rc = ipAddressTable_post_request(ipAddressTable_if_ctx.user_ctx,
+ packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipAddressTable", "error %d from "
+ "ipAddressTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipAddressTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static ipAddressTable_rowreq_ctx *
+_mfd_ipAddressTable_rowreq_from_index(netsnmp_index * oid_idx, int *rc_ptr)
+{
+ ipAddressTable_rowreq_ctx *rowreq_ctx;
+ ipAddressTable_mib_index mib_idx;
+ int rc;
+
+ DEBUGMSGTL(("internal:ipAddressTable:_mfd_ipAddressTable_rowreq_from_index", "called\n"));
+
+ if (NULL == rc_ptr)
+ rc_ptr = &rc;
+ *rc_ptr = MFD_SUCCESS;
+
+ memset(&mib_idx, 0x0, sizeof(mib_idx));
+
+ /*
+ * try to parse oid
+ */
+ *rc_ptr = ipAddressTable_index_from_oid(oid_idx, &mib_idx);
+ if (MFD_SUCCESS != *rc_ptr) {
+ DEBUGMSGT(("ipAddressTable", "error parsing index\n"));
+ return NULL;
+ }
+
+ /*
+ * allocate new context
+ */
+ rowreq_ctx = ipAddressTable_allocate_rowreq_ctx(NULL, NULL);
+ if (NULL == rowreq_ctx) {
+ *rc_ptr = MFD_ERROR;
+ return NULL; /* msg already logged */
+ }
+
+ memcpy(&rowreq_ctx->tbl_idx, &mib_idx, sizeof(mib_idx));
+
+ /*
+ * check indexes
+ */
+ *rc_ptr = _ipAddressTable_check_indexes(rowreq_ctx);
+ if (MFD_SUCCESS != *rc_ptr) {
+ netsnmp_assert((*rc_ptr == SNMP_ERR_NOCREATION) ||
+ (*rc_ptr == SNMP_ERR_INCONSISTENTNAME));
+ ipAddressTable_release_rowreq_ctx(rowreq_ctx);
+ return NULL;
+ }
+
+ /*
+ * copy indexes
+ */
+ rowreq_ctx->oid_idx.len = oid_idx->len;
+ memcpy(rowreq_ctx->oid_idx.oids, oid_idx->oids,
+ oid_idx->len * sizeof(oid));
+
+ return rowreq_ctx;
+} /* _mfd_ipAddressTable_rowreq_from_index */
+
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipAddressTable_object_lookup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = SNMP_ERR_NOERROR;
+ ipAddressTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipAddressTable:_mfd_ipAddressTable_object_lookup", "called\n"));
+
+ /*
+ * get our context from mfd
+ * ipAddressTable_interface_ctx *if_ctx =
+ * (ipAddressTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if (NULL == rowreq_ctx) {
+#define NETSNMP_IPADDRESSTABLE_CREATE_SUPPORT 1
+#ifndef NETSNMP_IPADDRESSTABLE_CREATE_SUPPORT
+ rc = SNMP_ERR_NOCREATION;
+#else
+ netsnmp_table_request_info *tblreq_info;
+ netsnmp_index oid_idx;
+
+ tblreq_info = netsnmp_extract_table_info(requests);
+ if (NULL == tblreq_info) {
+ snmp_log(LOG_ERR, "request had no table info\n");
+ return MFD_ERROR;
+ }
+
+ /*
+ * try create rowreq
+ */
+ oid_idx.oids = tblreq_info->index_oid;
+ oid_idx.len = tblreq_info->index_oid_len;
+
+ rowreq_ctx = _mfd_ipAddressTable_rowreq_from_index(&oid_idx, &rc);
+ if (MFD_SUCCESS == rc) {
+ netsnmp_assert(NULL != rowreq_ctx);
+ rowreq_ctx->rowreq_flags |= MFD_ROW_CREATED;
+ /*
+ * add rowreq_ctx to request data lists
+ */
+ netsnmp_container_table_row_insert(requests, (netsnmp_index *)
+ rowreq_ctx);
+ }
+#endif
+ }
+
+ if (MFD_SUCCESS != rc)
+ netsnmp_request_set_error_all(requests, rc);
+ else
+ ipAddressTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_ipAddressTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipAddressTable_get_column(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipAddressTable:_mfd_ipAddressTable_get_column",
+ "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipAddressIfIndex(3)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/W/e/R/d/H
+ */
+ case COLUMN_IPADDRESSIFINDEX:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = ipAddressIfIndex_get(rowreq_ctx, (long *) var->val.string);
+ break;
+
+ /*
+ * ipAddressType(4)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_IPADDRESSTYPE:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipAddressType_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipAddressPrefix(5)/RowPointer/ASN_OBJECT_ID/oid(oid)//L/A/w/e/r/D/h
+ */
+ case COLUMN_IPADDRESSPREFIX:
+ var->type = ASN_OBJECT_ID;
+ rc = ipAddressPrefix_get(rowreq_ctx, (oid **) & var->val.string,
+ &var->val_len);
+ break;
+
+ /*
+ * ipAddressOrigin(6)/IpAddressOriginTC/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_IPADDRESSORIGIN:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipAddressOrigin_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipAddressStatus(7)/IpAddressStatusTC/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_IPADDRESSSTATUS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipAddressStatus_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipAddressCreated(8)/TimeStamp/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPADDRESSCREATED:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_TIMETICKS;
+ rc = ipAddressCreated_get(rowreq_ctx, (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipAddressLastChanged(9)/TimeStamp/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPADDRESSLASTCHANGED:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_TIMETICKS;
+ rc = ipAddressLastChanged_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipAddressRowStatus(10)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPADDRESSROWSTATUS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipAddressRowStatus_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipAddressStorageType(11)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_IPADDRESSSTORAGETYPE:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipAddressStorageType_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipAddressTable_get_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ipAddressTable_get_column */
+
+int
+_mfd_ipAddressTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipAddressTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ u_char *old_string;
+ void (*dataFreeHook) (void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:ipAddressTable:_mfd_ipAddressTable_get_values",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+ /*
+ * save old pointer, so we can free it if replaced
+ */
+ old_string = requests->requestvb->val.string;
+ dataFreeHook = requests->requestvb->dataFreeHook;
+ if (NULL == requests->requestvb->val.string) {
+ requests->requestvb->val.string = requests->requestvb->buf;
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ } else if (requests->requestvb->buf ==
+ requests->requestvb->val.string) {
+ if (requests->requestvb->val_len !=
+ sizeof(requests->requestvb->buf))
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ }
+
+ /*
+ * get column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipAddressTable_get_column(rowreq_ctx, requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ if (MFD_SKIP == rc) {
+ requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+ rc = SNMP_ERR_NOERROR;
+ }
+ } else if (NULL == requests->requestvb->val.string) {
+ snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
+ rc = SNMP_ERR_GENERR;
+ }
+ if (rc)
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+
+ /*
+ * if the buffer wasn't used previously for the old data (i.e. it
+ * was allcoated memory) and the get routine replaced the pointer,
+ * we need to free the previous pointer.
+ */
+ if (old_string && (old_string != requests->requestvb->buf) &&
+ (requests->requestvb->val.string != old_string)) {
+ if (dataFreeHook)
+ (*dataFreeHook) (old_string);
+ else
+ free(old_string);
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipAddressTable_get_values */
+
+NETSNMP_STATIC_INLINE int
+_ipAddressTable_check_indexes(ipAddressTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipAddressTable:_ipAddressTable_check_indexes",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+
+ /*
+ * (INDEX) ipAddressAddrType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (rowreq_ctx->tbl_idx.ipAddressAddrType !=
+ INETADDRESSTYPE_UNKNOWN)
+ && (rowreq_ctx->tbl_idx.ipAddressAddrType != INETADDRESSTYPE_IPV4)
+ && (rowreq_ctx->tbl_idx.ipAddressAddrType != INETADDRESSTYPE_IPV6)
+ && (rowreq_ctx->tbl_idx.ipAddressAddrType != INETADDRESSTYPE_IPV4Z)
+ && (rowreq_ctx->tbl_idx.ipAddressAddrType != INETADDRESSTYPE_IPV6Z)
+ && (rowreq_ctx->tbl_idx.ipAddressAddrType != INETADDRESSTYPE_DNS)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (MFD_SUCCESS != rc)
+ return rc;
+ rc = ipAddressAddrType_check_index(rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+ /*
+ * (INDEX) ipAddressAddr(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ /*
+ * check defined range(s).
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && ((rowreq_ctx->tbl_idx.ipAddressAddr_len < 0)
+ || (rowreq_ctx->tbl_idx.ipAddressAddr_len > 255))
+ ) {
+ rc = SNMP_ERR_WRONGLENGTH;
+ }
+ if (MFD_SUCCESS != rc)
+ return rc;
+ rc = ipAddressAddr_check_index(rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+ /*
+ * if individual parts look ok, check them as a whole
+ */
+ return ipAddressTable_validate_index(ipAddressTable_if_ctx.user_ctx,
+ rowreq_ctx);
+} /* _ipAddressTable_check_indexes */
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Syntax checks
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check the syntax for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipAddressTable_check_column(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipAddressTable:_ipAddressTable_check_column",
+ "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+ /*
+ * (INDEX) ipAddressAddrType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ case COLUMN_IPADDRESSADDRTYPE:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+ /*
+ * (INDEX) ipAddressAddr(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ case COLUMN_IPADDRESSADDR:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+
+ /*
+ * ipAddressIfIndex(3)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/W/e/R/d/H
+ */
+ case COLUMN_IPADDRESSIFINDEX:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ /*
+ * check defined range(s).
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && ((*var->val.integer < 1)
+ || (*var->val.integer > 2147483647))
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipAddressTable:_ipAddressTable_check_column:ipAddressIfIndex", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipAddressIfIndex_check_value(rowreq_ctx,
+ *((long *) var->val.string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipAddressIfIndex_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ipAddressType(4)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_IPADDRESSTYPE:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (*var->val.integer != IPADDRESSTYPE_UNICAST)
+ && (*var->val.integer != IPADDRESSTYPE_ANYCAST)
+ && (*var->val.integer != IPADDRESSTYPE_BROADCAST)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipAddressTable:_ipAddressTable_check_column:ipAddressType", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipAddressType_check_value(rowreq_ctx,
+ *((u_long *) var->val.string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipAddressType_check_value\n", rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ipAddressPrefix(5)/RowPointer/ASN_OBJECT_ID/oid(oid)//L/A/w/e/r/D/h
+ */
+ case COLUMN_IPADDRESSPREFIX:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ipAddressOrigin(6)/IpAddressOriginTC/ASN_INTEGER/long(u_long)//l/A/w/E/r/d/h
+ */
+ case COLUMN_IPADDRESSORIGIN:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ipAddressStatus(7)/IpAddressStatusTC/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_IPADDRESSSTATUS:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (*var->val.integer != IPADDRESSSTATUSTC_PREFERRED)
+ && (*var->val.integer != IPADDRESSSTATUSTC_INVALID)
+ && (*var->val.integer != IPADDRESSSTATUSTC_INACCESSIBLE)
+ && (*var->val.integer != IPADDRESSSTATUSTC_UNKNOWN)
+ && (*var->val.integer != IPADDRESSSTATUSTC_TENTATIVE)
+ && (*var->val.integer != IPADDRESSSTATUSTC_DUPLICATE)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipAddressTable:_ipAddressTable_check_column:ipAddressStatus", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipAddressStatus_check_value(rowreq_ctx,
+ *((u_long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipAddressStatus_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ipAddressCreated(8)/TimeStamp/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPADDRESSCREATED:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ipAddressLastChanged(9)/TimeStamp/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPADDRESSLASTCHANGED:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ipAddressRowStatus(10)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPADDRESSROWSTATUS:
+ rc = netsnmp_check_vb_rowstatus_value(var);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipAddressTable:_ipAddressTable_check_column:ipAddressRowStatus", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipAddressRowStatus_check_value(rowreq_ctx,
+ *((u_long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipAddressRowStatus_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ipAddressStorageType(11)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_IPADDRESSSTORAGETYPE:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (*var->val.integer != STORAGETYPE_OTHER)
+ && (*var->val.integer != STORAGETYPE_VOLATILE)
+ && (*var->val.integer != STORAGETYPE_NONVOLATILE)
+ && (*var->val.integer != STORAGETYPE_PERMANENT)
+ && (*var->val.integer != STORAGETYPE_READONLY)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipAddressTable:_ipAddressTable_check_column:ipAddressStorageType", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipAddressStorageType_check_value(rowreq_ctx,
+ *((u_long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipAddressStorageType_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ default: /** We shouldn't get here */
+ rc = SNMP_ERR_GENERR;
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipAddressTable_check_column\n",
+ column);
+ }
+
+ return rc;
+} /* _ipAddressTable_check_column */
+
+int
+_mfd_ipAddressTable_check_objects(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipAddressTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc;
+
+ DEBUGMSGTL(("internal:ipAddressTable:_mfd_ipAddressTable_check_objects", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+
+ /*
+ * get column number from table request info, and check that column
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipAddressTable_check_column(rowreq_ctx, requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+ break;
+ }
+
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipAddressTable_check_objects */
+
+
+/*----------------------------------------------------------------------
+ *
+ * SET: check dependencies
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check dependencies wrapper
+ */
+static int
+_mfd_ipAddressTable_check_dependencies(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipAddressTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ DEBUGMSGTL(("internal:ipAddressTable:_mfd_ipAddressTable_check_dependencies", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = ipAddressTable_check_dependencies(rowreq_ctx);
+ if (rc) {
+ DEBUGMSGTL(("ipAddressTable:mfd", "error %d from "
+ "ipAddressTable_check_dependencies\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipAddressTable_check_dependencies */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo setup
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipAddressTable_undo_setup_column(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipAddressTable:_ipAddressTable_undo_setup_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipAddressIfIndex(3)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/W/e/R/d/H
+ */
+ case COLUMN_IPADDRESSIFINDEX:
+ rowreq_ctx->column_set_flags |= COLUMN_IPADDRESSIFINDEX_FLAG;
+ rc = ipAddressIfIndex_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * ipAddressType(4)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_IPADDRESSTYPE:
+ rowreq_ctx->column_set_flags |= COLUMN_IPADDRESSTYPE_FLAG;
+ rc = ipAddressType_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * ipAddressStatus(7)/IpAddressStatusTC/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_IPADDRESSSTATUS:
+ rowreq_ctx->column_set_flags |= COLUMN_IPADDRESSSTATUS_FLAG;
+ rc = ipAddressStatus_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * ipAddressRowStatus(10)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPADDRESSROWSTATUS:
+ rowreq_ctx->column_set_flags |= COLUMN_IPADDRESSROWSTATUS_FLAG;
+ rc = ipAddressRowStatus_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * ipAddressStorageType(11)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_IPADDRESSSTORAGETYPE:
+ rowreq_ctx->column_set_flags |= COLUMN_IPADDRESSSTORAGETYPE_FLAG;
+ rc = ipAddressStorageType_undo_setup(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipAddressTable_undo_setup_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ipAddressTable_undo_setup_column */
+
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_ipAddressTable_undo_setup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipAddressTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipAddressTable:_mfd_ipAddressTable_undo_setup",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * allocate undo context
+ */
+ rowreq_ctx->undo = ipAddressTable_allocate_data();
+ if (NULL == rowreq_ctx->undo) {
+ /** msg already logged */
+ netsnmp_request_set_error_all(requests,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * row undo setup
+ */
+ rowreq_ctx->column_set_flags = 0;
+ rc = ipAddressTable_undo_setup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipAddressTable:mfd", "error %d from "
+ "ipAddressTable_undo_setup\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ } else {
+ /*
+ * column undo setup
+ */
+ netsnmp_table_request_info *tri;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipAddressTable_undo_setup_column(rowreq_ctx,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipAddressTable:mfd", "error %d from "
+ "ipAddressTable_undo_setup_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipAddressTable_undo_setup */
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_ipAddressTable_undo_cleanup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipAddressTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc;
+
+ DEBUGMSGTL(("internal:ipAddressTable:_mfd_ipAddressTable_undo_cleanup",
+ "called\n"));
+
+ /*
+ * failed row create in early stages has no rowreq_ctx
+ */
+ if (NULL == rowreq_ctx)
+ return MFD_SUCCESS;
+
+ /*
+ * call user cleanup
+ */
+ rc = ipAddressTable_undo_cleanup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipAddressTable:mfd", "error %d from "
+ "ipAddressTable_undo_cleanup\n", rc));
+ }
+
+ /*
+ * release undo context, if needed
+ */
+ if (rowreq_ctx->undo) {
+ ipAddressTable_release_data(rowreq_ctx->undo);
+ rowreq_ctx->undo = NULL;
+ }
+
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipAddressTable_undo_cleanup */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Set values
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipAddressTable_set_column(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipAddressTable:_ipAddressTable_set_column",
+ "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipAddressIfIndex(3)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/W/e/R/d/H
+ */
+ case COLUMN_IPADDRESSIFINDEX:
+ rowreq_ctx->column_set_flags |= COLUMN_IPADDRESSIFINDEX_FLAG;
+ rc = ipAddressIfIndex_set(rowreq_ctx, *((long *) var->val.string));
+ break;
+
+ /*
+ * ipAddressType(4)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_IPADDRESSTYPE:
+ rowreq_ctx->column_set_flags |= COLUMN_IPADDRESSTYPE_FLAG;
+ rc = ipAddressType_set(rowreq_ctx, *((u_long *) var->val.string));
+ break;
+
+ /*
+ * ipAddressStatus(7)/IpAddressStatusTC/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_IPADDRESSSTATUS:
+ rowreq_ctx->column_set_flags |= COLUMN_IPADDRESSSTATUS_FLAG;
+ rc = ipAddressStatus_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ /*
+ * ipAddressRowStatus(10)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPADDRESSROWSTATUS:
+ rowreq_ctx->column_set_flags |= COLUMN_IPADDRESSROWSTATUS_FLAG;
+ rc = ipAddressRowStatus_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ /*
+ * ipAddressStorageType(11)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_IPADDRESSSTORAGETYPE:
+ rowreq_ctx->column_set_flags |= COLUMN_IPADDRESSSTORAGETYPE_FLAG;
+ rc = ipAddressStorageType_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipAddressTable_set_column\n",
+ column);
+ rc = SNMP_ERR_GENERR;
+ break;
+ }
+
+ return rc;
+} /* _ipAddressTable_set_column */
+
+int
+_mfd_ipAddressTable_set_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipAddressTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc = SNMP_ERR_NOERROR;
+
+ DEBUGMSGTL(("internal:ipAddressTable:_mfd_ipAddressTable_set_values",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rowreq_ctx->column_set_flags = 0;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipAddressTable_set_column(rowreq_ctx,
+ requests->requestvb, tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipAddressTable:mfd", "error %d from "
+ "ipAddressTable_set_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipAddressTable_set_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit the values
+ */
+int
+_mfd_ipAddressTable_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipAddressTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipAddressTable:_mfd_ipAddressTable_commit",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = ipAddressTable_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipAddressTable:mfd", "error %d from "
+ "ipAddressTable_commit\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ /*
+ * if we successfully commited this row, set the dirty flag. Use the
+ * current value + 1 (i.e. dirty = # rows changed).
+ * this is checked in post_request...
+ */
+ ipAddressTable_dirty_set(ipAddressTable_dirty_get() + 1); /* set table dirty flag */
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+_mfd_ipAddressTable_undo_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipAddressTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipAddressTable:_mfd_ipAddressTable_undo_commit",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ u_int d = ipAddressTable_dirty_get();
+
+ netsnmp_assert(d != 0);
+ if (d)
+ ipAddressTable_dirty_set(d - 1);
+ }
+
+ rc = ipAddressTable_undo_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipAddressTable:mfd", "error %d from "
+ "ipAddressTable_undo_commit\n", rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ snmp_log(LOG_WARNING,
+ "ipAddressTable row dirty flag still set after undo_commit\n");
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipAddressTable_commit */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * undo the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipAddressTable_undo_column(ipAddressTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipAddressTable:_ipAddressTable_undo_column",
+ "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipAddressIfIndex(3)/InterfaceIndex/ASN_INTEGER/long(long)//l/A/W/e/R/d/H
+ */
+ case COLUMN_IPADDRESSIFINDEX:
+ rc = ipAddressIfIndex_undo(rowreq_ctx);
+ break;
+
+ /*
+ * ipAddressType(4)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_IPADDRESSTYPE:
+ rc = ipAddressType_undo(rowreq_ctx);
+ break;
+
+ /*
+ * ipAddressStatus(7)/IpAddressStatusTC/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_IPADDRESSSTATUS:
+ rc = ipAddressStatus_undo(rowreq_ctx);
+ break;
+
+ /*
+ * ipAddressRowStatus(10)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPADDRESSROWSTATUS:
+ rc = ipAddressRowStatus_undo(rowreq_ctx);
+ break;
+
+ /*
+ * ipAddressStorageType(11)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_IPADDRESSSTORAGETYPE:
+ rc = ipAddressStorageType_undo(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipAddressTable_undo_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ipAddressTable_undo_column */
+
+int
+_mfd_ipAddressTable_undo_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipAddressTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+
+ DEBUGMSGTL(("internal:ipAddressTable:_mfd_ipAddressTable_undo_values",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = ipAddressTable_undo(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipAddressTable:mfd", "error %d from "
+ "ipAddressTable_undo\n", rc));
+ }
+
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipAddressTable_undo_column(rowreq_ctx, requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipAddressTable:mfd", "error %d from "
+ "ipAddressTable_undo_column\n", rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipAddressTable_undo_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: irreversible commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit irreversible actions
+ */
+int
+_mfd_ipAddressTable_irreversible_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipAddressTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipAddressTable:_mfd_ipAddressTable_irreversible:commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * check for and handle row creation/deletion
+ * and update column exist flags...
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) {
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_CREATED))
+ CONTAINER_REMOVE(ipAddressTable_if_ctx.container, rowreq_ctx);
+ } else {
+ if (rowreq_ctx->column_set_flags) {
+ rowreq_ctx->column_set_flags = 0;
+ }
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_CREATED;
+ CONTAINER_INSERT(ipAddressTable_if_ctx.container, rowreq_ctx);
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipAddressTable_irreversible_commit */
+
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+static void _container_free(netsnmp_container *container);
+
+/**
+ * @internal
+ */
+static int
+_cache_load(netsnmp_cache * cache, void *vmagic)
+{
+ DEBUGMSGTL(("internal:ipAddressTable:_cache_load", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR, "invalid cache for ipAddressTable_cache_load\n");
+ return -1;
+ }
+
+ /** should only be called for an invalid or expired cache */
+ netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
+
+ /*
+ * call user code
+ */
+ return ipAddressTable_container_load((netsnmp_container *) cache->
+ magic);
+} /* _cache_load */
+
+/**
+ * @internal
+ */
+static void
+_cache_free(netsnmp_cache * cache, void *magic)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("internal:ipAddressTable:_cache_free", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR, "invalid cache in ipAddressTable_cache_free\n");
+ return;
+ }
+
+ container = (netsnmp_container *) cache->magic;
+
+ _container_free(container);
+} /* _cache_free */
+
+/**
+ * @internal
+ */
+static void
+_container_item_free(ipAddressTable_rowreq_ctx * rowreq_ctx, void *context)
+{
+ DEBUGMSGTL(("internal:ipAddressTable:_container_item_free",
+ "called\n"));
+
+ if (NULL == rowreq_ctx)
+ return;
+
+ ipAddressTable_release_rowreq_ctx(rowreq_ctx);
+} /* _container_item_free */
+
+/**
+ * @internal
+ */
+static void
+_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("internal:ipAddressTable:_container_free", "called\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container in ipAddressTable_container_free\n");
+ return;
+ }
+
+ /*
+ * call user code
+ */
+ ipAddressTable_container_free(container);
+
+ /*
+ * free all items. inefficient, but easy.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func *) _container_item_free,
+ NULL);
+} /* _container_free */
+
+/**
+ * @internal
+ * initialize the container with functions or wrappers
+ */
+void
+_ipAddressTable_container_init(ipAddressTable_interface_ctx * if_ctx)
+{
+ DEBUGMSGTL(("internal:ipAddressTable:_ipAddressTable_container_init",
+ "called\n"));
+
+ /*
+ * cache init
+ */
+ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */
+ _cache_load, _cache_free,
+ ipAddressTable_oid,
+ ipAddressTable_oid_size);
+
+ if (NULL == if_ctx->cache) {
+ snmp_log(LOG_ERR, "error creating cache for ipAddressTable\n");
+ return;
+ }
+
+ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
+
+ ipAddressTable_container_init(&if_ctx->container, if_ctx->cache);
+ if (NULL == if_ctx->container)
+ if_ctx->container =
+ netsnmp_container_find("ipAddressTable:table_container");
+ if (NULL == if_ctx->container) {
+ snmp_log(LOG_ERR, "error creating container in "
+ "ipAddressTable_container_init\n");
+ return;
+ }
+
+ if (NULL != if_ctx->cache)
+ if_ctx->cache->magic = (void *) if_ctx->container;
+} /* _ipAddressTable_container_init */
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+_ipAddressTable_container_shutdown(ipAddressTable_interface_ctx * if_ctx)
+{
+ DEBUGMSGTL(("internal:ipAddressTable:_ipAddressTable_container_shutdown", "called\n"));
+
+ ipAddressTable_container_shutdown(if_ctx->container);
+
+ _container_free(if_ctx->container);
+
+} /* _ipAddressTable_container_shutdown */
+
+
+ipAddressTable_rowreq_ctx *
+ipAddressTable_row_find_by_mib_index(ipAddressTable_mib_index * mib_idx)
+{
+ ipAddressTable_rowreq_ctx *rowreq_ctx;
+ oid oid_tmp[MAX_OID_LEN];
+ netsnmp_index oid_idx;
+ int rc;
+
+ /*
+ * set up storage for OID
+ */
+ oid_idx.oids = oid_tmp;
+ oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
+
+ /*
+ * convert
+ */
+ rc = ipAddressTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx = CONTAINER_FIND(ipAddressTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_interface.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_interface.h
new file mode 100644
index 0000000000..74adfe0256
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable_interface.h
@@ -0,0 +1,100 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: ipAddressTable_interface.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** @ingroup interface Routines to interface to Net-SNMP
+ *
+ * \warning This code should not be modified, called directly,
+ * or used to interpret functionality. It is subject to
+ * change at any time.
+ *
+ * @{
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+#ifndef IPADDRESSTABLE_INTERFACE_H
+#define IPADDRESSTABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "ipAddressTable.h"
+
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void
+ _ipAddressTable_initialize_interface(ipAddressTable_registration *
+ user_ctx, u_long flags);
+ void
+ _ipAddressTable_shutdown_interface(ipAddressTable_registration *
+ user_ctx);
+
+ ipAddressTable_registration *ipAddressTable_registration_get(void);
+
+ ipAddressTable_registration
+ * ipAddressTable_registration_set(ipAddressTable_registration *
+ newreg);
+
+ netsnmp_container *ipAddressTable_container_get(void);
+ int ipAddressTable_container_size(void);
+
+ u_int ipAddressTable_dirty_get(void);
+ void ipAddressTable_dirty_set(u_int status);
+
+ ipAddressTable_rowreq_ctx
+ * ipAddressTable_allocate_rowreq_ctx(ipAddressTable_data *,
+ void *);
+ void
+ ipAddressTable_release_rowreq_ctx(ipAddressTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int ipAddressTable_index_to_oid(netsnmp_index * oid_idx,
+ ipAddressTable_mib_index *
+ mib_idx);
+ int ipAddressTable_index_from_oid(netsnmp_index * oid_idx,
+ ipAddressTable_mib_index
+ * mib_idx);
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void ipAddressTable_valid_columns_set(netsnmp_column_info
+ *vc);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPADDRESSTABLE_INTERFACE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable.h
new file mode 100644
index 0000000000..047db745e4
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable.h
@@ -0,0 +1,8 @@
+/*
+ * module to include the modules
+ */
+
+config_require(ip-mib/data_access/systemstats)
+config_require(ip-mib/ipSystemStatsTable/ipSystemStatsTable)
+config_require(ip-mib/ipSystemStatsTable/ipSystemStatsTable_interface)
+config_require(ip-mib/ipSystemStatsTable/ipSystemStatsTable_data_access)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.c
new file mode 100644
index 0000000000..4b1acb1f6f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.c
@@ -0,0 +1,3182 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: ipSystemStatsTable.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** \page MFD helper for ipSystemStatsTable
+ *
+ * \section intro Introduction
+ * Introductory text.
+ *
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipSystemStatsTable.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "ipSystemStatsTable_interface.h"
+
+oid ipSystemStatsTable_oid[] = { IPSYSTEMSTATSTABLE_OID };
+int ipSystemStatsTable_oid_size =
+OID_LENGTH(ipSystemStatsTable_oid);
+
+ipSystemStatsTable_registration ipSystemStatsTable_user_context;
+
+void initialize_table_ipSystemStatsTable(void);
+void shutdown_table_ipSystemStatsTable(void);
+
+
+/**
+ * Initializes the ipSystemStatsTable module
+ */
+void
+init_ipSystemStatsTable(void)
+{
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:init_ipSystemStatsTable",
+ "called\n"));
+
+ /*
+ * TODO:300:o: Perform ipSystemStatsTable one-time module initialization.
+ */
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ if (should_init("ipSystemStatsTable"))
+ initialize_table_ipSystemStatsTable();
+
+} /* init_ipSystemStatsTable */
+
+/**
+ * Shut-down the ipSystemStatsTable module (agent is exiting)
+ */
+void
+shutdown_ipSystemStatsTable(void)
+{
+ if (should_init("ipSystemStatsTable"))
+ shutdown_table_ipSystemStatsTable();
+
+}
+
+/**
+ * Initialize the table ipSystemStatsTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_ipSystemStatsTable(void)
+{
+ ipSystemStatsTable_registration *user_context;
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:initialize_table_ipSystemStatsTable", "called\n"));
+
+ /*
+ * TODO:301:o: Perform ipSystemStatsTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize ipSystemStatsTable user context
+ * if you'd like to pass in a pointer to some data for this
+ * table, allocate or set it up here.
+ */
+ /*
+ * a netsnmp_data_list is a simple way to store void pointers. A simple
+ * string token is used to add, find or remove pointers.
+ */
+ user_context =
+ netsnmp_create_data_list("ipSystemStatsTable", NULL, NULL);
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _ipSystemStatsTable_initialize_interface(user_context, flags);
+} /* initialize_table_ipSystemStatsTable */
+
+/**
+ * Shutdown the table ipSystemStatsTable
+ */
+void
+shutdown_table_ipSystemStatsTable(void)
+{
+ /*
+ * call interface shutdown code
+ */
+ _ipSystemStatsTable_shutdown_interface
+ (&ipSystemStatsTable_user_context);
+}
+
+/**
+ * extra context initialization (eg default values)
+ *
+ * @param rowreq_ctx : row request context
+ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
+ *
+ * @retval MFD_SUCCESS : no errors
+ * @retval MFD_ERROR : error (context allocate will fail)
+ */
+int
+ipSystemStatsTable_rowreq_ctx_init(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx, void *user_init_ctx)
+{
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_rowreq_ctx_init", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:210:o: |-> Perform extra ipSystemStatsTable rowreq initialization. (eg DEFVALS)
+ */
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsTable_rowreq_ctx_init */
+
+/**
+ * extra context cleanup
+ *
+ */
+void
+ipSystemStatsTable_rowreq_ctx_cleanup(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_rowreq_ctx_cleanup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:211:o: |-> Perform extra ipSystemStatsTable rowreq cleanup.
+ */
+} /* ipSystemStatsTable_rowreq_ctx_cleanup */
+
+/**
+ * pre-request callback
+ *
+ * @param user_context
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+ipSystemStatsTable_pre_request(ipSystemStatsTable_registration *
+ user_context)
+{
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_pre_request", "called\n"));
+
+ /*
+ * TODO:510:o: Perform ipSystemStatsTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ * Note:
+ * New rows have been inserted into the container, and
+ * deleted rows have been removed from the container and
+ * released.
+ * @param user_context
+ * @param rc : MFD_SUCCESS if all requests succeeded
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+ipSystemStatsTable_post_request(ipSystemStatsTable_registration *
+ user_context, int rc)
+{
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_post_request", "called\n"));
+
+ /*
+ * TODO:511:o: Perform ipSystemStatsTable post-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsTable_post_request */
+
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipSystemStatsTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipSystemStatsTable is subid 1 of ipTrafficStats.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.31.1, length: 9
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement ipSystemStatsTable data context functions.
+ */
+/*
+ * ipSystemStatsTable_allocate_data
+ *
+ * Purpose: create new ipSystemStatsTable_data.
+ */
+ipSystemStatsTable_data *
+ipSystemStatsTable_allocate_data(void)
+{
+ /*
+ * TODO:201:r: |-> allocate memory for the ipSystemStatsTable data context.
+ */
+ ipSystemStatsTable_data *rtn =
+ SNMP_MALLOC_TYPEDEF(ipSystemStatsTable_data);
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_allocate_data", "called\n"));
+
+ if (NULL == rtn) {
+ snmp_log(LOG_ERR, "unable to malloc memory for new "
+ "ipSystemStatsTable_data.\n");
+ }
+
+ return rtn;
+} /* ipSystemStatsTable_allocate_data */
+
+/*
+ * ipSystemStatsTable_release_data
+ *
+ * Purpose: release ipSystemStatsTable data.
+ */
+void
+ipSystemStatsTable_release_data(ipSystemStatsTable_data * data)
+{
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_release_data", "called\n"));
+
+ /*
+ * TODO:202:r: |-> release memory for the ipSystemStatsTable data context.
+ */
+ free(data);
+} /* ipSystemStatsTable_release_data */
+
+
+
+/**
+ * set mib index(es)
+ *
+ * @param tbl_idx mib index structure
+ * @param ipSystemStatsIPVersion_val
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This convenience function is useful for setting all the MIB index
+ * components with a single function call. It is assume that the C values
+ * have already been mapped from their native/rawformat to the MIB format.
+ */
+int
+ipSystemStatsTable_indexes_set_tbl_idx(ipSystemStatsTable_mib_index *
+ tbl_idx,
+ u_long ipSystemStatsIPVersion_val)
+{
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_indexes_set_tbl_idx", "called\n"));
+
+ /*
+ * ipSystemStatsIPVersion(1)/InetVersion/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ /** WARNING: this code might not work for netsnmp_systemstats_entry */
+ tbl_idx->ipSystemStatsIPVersion = ipSystemStatsIPVersion_val;
+
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsTable_indexes_set_tbl_idx */
+
+/**
+ * @internal
+ * set row context indexes
+ *
+ * @param reqreq_ctx the row context that needs updated indexes
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This function sets the mib indexs, then updates the oid indexs
+ * from the mib index.
+ */
+int
+ipSystemStatsTable_indexes_set(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long ipSystemStatsIPVersion_val)
+{
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_indexes_set", "called\n"));
+
+ if (MFD_SUCCESS !=
+ ipSystemStatsTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
+ ipSystemStatsIPVersion_val))
+ return MFD_ERROR;
+
+ /*
+ * convert mib index to oid index
+ */
+ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
+ if (0 != ipSystemStatsTable_index_to_oid(&rowreq_ctx->oid_idx,
+ &rowreq_ctx->tbl_idx)) {
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsTable_indexes_set */
+
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsInReceives
+ * ipSystemStatsInReceives is subid 3 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.3
+ * Description:
+The total number of input IP datagrams received, including
+ those received in error.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsInReceives data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsInReceives_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsInReceives_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsInReceives_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsInReceives_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsInReceives_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsInReceives data.
+ * copy (* ipSystemStatsInReceives_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsInReceives_val_ptr) =
+ rowreq_ctx->data->stats.HCInReceives.low;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsInReceives_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsHCInReceives
+ * ipSystemStatsHCInReceives is subid 4 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.4
+ * Description:
+The total number of input IP datagrams received, including
+ those received in error. This object counts the same
+ datagrams as ipSystemStatsInReceives but allows for larger
+
+
+
+
+ values.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ipSystemStatsHCInReceives data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsHCInReceives_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsHCInReceives_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ U64 * ipSystemStatsHCInReceives_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCInReceives_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ipSystemStatsHCInReceives data.
+ * get (* ipSystemStatsHCInReceives_val_ptr ).low and (* ipSystemStatsHCInReceives_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ipSystemStatsHCInReceives_val_ptr).low =
+ rowreq_ctx->data->stats.HCInReceives.low;
+ (*ipSystemStatsHCInReceives_val_ptr).high =
+ rowreq_ctx->data->stats.HCInReceives.high;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsHCInReceives_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsInOctets
+ * ipSystemStatsInOctets is subid 5 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.5
+ * Description:
+The total number of octets received in input IP datagrams,
+ including those received in error. Octets from datagrams
+ counted in ipSystemStatsInReceives MUST be counted here.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsInOctets data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsInOctets_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsInOctets_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsInOctets_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsInOctets_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsInOctets_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsInOctets data.
+ * copy (* ipSystemStatsInOctets_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsInOctets_val_ptr) =
+ rowreq_ctx->data->stats.HCInOctets.low;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsInOctets_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsHCInOctets
+ * ipSystemStatsHCInOctets is subid 6 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.6
+ * Description:
+The total number of octets received in input IP datagrams,
+ including those received in error. This object counts the
+ same octets as ipSystemStatsInOctets but allows for larger
+ values.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ipSystemStatsHCInOctets data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsHCInOctets_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsHCInOctets_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ U64 * ipSystemStatsHCInOctets_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCInOctets_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ipSystemStatsHCInOctets data.
+ * get (* ipSystemStatsHCInOctets_val_ptr ).low and (* ipSystemStatsHCInOctets_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ipSystemStatsHCInOctets_val_ptr).low =
+ rowreq_ctx->data->stats.HCInOctets.low;
+ (*ipSystemStatsHCInOctets_val_ptr).high =
+ rowreq_ctx->data->stats.HCInOctets.high;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsHCInOctets_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsInHdrErrors
+ * ipSystemStatsInHdrErrors is subid 7 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.7
+ * Description:
+The number of input IP datagrams discarded due to errors in
+ their IP headers, including version number mismatch, other
+ format errors, hop count exceeded, errors discovered in
+ processing their IP options, etc.
+
+
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsInHdrErrors data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsInHdrErrors_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsInHdrErrors_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsInHdrErrors_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsInHdrErrors_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsInHdrErrors_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsInHdrErrors data.
+ * copy (* ipSystemStatsInHdrErrors_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsInHdrErrors_val_ptr) =
+ rowreq_ctx->data->stats.InHdrErrors;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsInHdrErrors_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsInNoRoutes
+ * ipSystemStatsInNoRoutes is subid 8 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.8
+ * Description:
+The number of input IP datagrams discarded because no route
+ could be found to transmit them to their destination.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsInNoRoutes data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsInNoRoutes_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsInNoRoutes_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsInNoRoutes_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsInNoRoutes_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsInNoRoutes_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsInNoRoutes data.
+ * copy (* ipSystemStatsInNoRoutes_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsInNoRoutes_val_ptr) =
+ rowreq_ctx->data->stats.InNoRoutes;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsInNoRoutes_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsInAddrErrors
+ * ipSystemStatsInAddrErrors is subid 9 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.9
+ * Description:
+The number of input IP datagrams discarded because the IP
+ address in their IP header's destination field was not a
+ valid address to be received at this entity. This count
+ includes invalid addresses (e.g., ::0) and unsupported
+ addresses (e.g., addresses with unallocated prefixes). For
+ entities which are not IP routers and therefore do not
+ forward datagrams, this counter includes datagrams discarded
+ because the destination address was not a local address.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsInAddrErrors data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsInAddrErrors_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsInAddrErrors_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsInAddrErrors_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsInAddrErrors_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsInAddrErrors_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsInAddrErrors data.
+ * copy (* ipSystemStatsInAddrErrors_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsInAddrErrors_val_ptr) =
+ rowreq_ctx->data->stats.InAddrErrors;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsInAddrErrors_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsInUnknownProtos
+ * ipSystemStatsInUnknownProtos is subid 10 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.10
+ * Description:
+The number of locally-addressed IP datagrams received
+ successfully but discarded because of an unknown or
+ unsupported protocol.
+
+
+
+
+ When tracking interface statistics the counter of the
+ interface to which these datagrams were addressed is
+ incremented. This interface might not be the same as the
+ input interface for some of the datagrams.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsInUnknownProtos data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsInUnknownProtos_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsInUnknownProtos_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInUnknownProtos_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsInUnknownProtos_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsInUnknownProtos_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsInUnknownProtos data.
+ * copy (* ipSystemStatsInUnknownProtos_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsInUnknownProtos_val_ptr) =
+ rowreq_ctx->data->stats.InUnknownProtos;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsInUnknownProtos_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsInTruncatedPkts
+ * ipSystemStatsInTruncatedPkts is subid 11 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.11
+ * Description:
+The number of input IP datagrams discarded because the
+ datagram frame didn't carry enough data.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsInTruncatedPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsInTruncatedPkts_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsInTruncatedPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInTruncatedPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsInTruncatedPkts_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsInTruncatedPkts_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsInTruncatedPkts data.
+ * copy (* ipSystemStatsInTruncatedPkts_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsInTruncatedPkts_val_ptr) =
+ rowreq_ctx->data->stats.InTruncatedPkts;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsInTruncatedPkts_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsInForwDatagrams
+ * ipSystemStatsInForwDatagrams is subid 12 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.12
+ * Description:
+The number of input datagrams for which this entity was not
+ their final IP destination and for which this entity
+ attempted to find a route to forward them to that final
+ destination. In entities which do not act as IP routers,
+ this counter will include only those datagrams which were
+ Source-Routed via this entity, and the Source-Route
+ processing was successful.
+
+
+ When tracking interface statistics the counter of the
+ incoming interface is incremented for each datagram.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsInForwDatagrams data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsInForwDatagrams_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsInForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInForwDatagrams_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsInForwDatagrams_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsInForwDatagrams_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsInForwDatagrams data.
+ * copy (* ipSystemStatsInForwDatagrams_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsInForwDatagrams_val_ptr) =
+ rowreq_ctx->data->stats.HCInForwDatagrams.low;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsInForwDatagrams_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsHCInForwDatagrams
+ * ipSystemStatsHCInForwDatagrams is subid 13 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.13
+ * Description:
+The number of input datagrams for which this entity was not
+ their final IP destination and for which this entity
+ attempted to find a route to forward them to that final
+ destination. This object counts the same packets as
+ ipSystemStatsInForwDatagrams but allows for larger values.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ipSystemStatsHCInForwDatagrams data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsHCInForwDatagrams_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsHCInForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCInForwDatagrams_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCInForwDatagrams_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ipSystemStatsHCInForwDatagrams data.
+ * get (* ipSystemStatsHCInForwDatagrams_val_ptr ).low and (* ipSystemStatsHCInForwDatagrams_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ipSystemStatsHCInForwDatagrams_val_ptr).low =
+ rowreq_ctx->data->stats.HCInForwDatagrams.low;
+ (*ipSystemStatsHCInForwDatagrams_val_ptr).high =
+ rowreq_ctx->data->stats.HCInForwDatagrams.high;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsHCInForwDatagrams_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsReasmReqds
+ * ipSystemStatsReasmReqds is subid 14 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.14
+ * Description:
+The number of IP fragments received which needed to be
+ reassembled at this interface.
+
+
+ When tracking interface statistics the counter of the
+ interface to which these fragments were addressed is
+ incremented. This interface might not be the same as the
+ input interface for some of the fragments.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsReasmReqds data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsReasmReqds_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsReasmReqds_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsReasmReqds_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsReasmReqds_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsReasmReqds_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsReasmReqds data.
+ * copy (* ipSystemStatsReasmReqds_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsReasmReqds_val_ptr) =
+ rowreq_ctx->data->stats.ReasmReqds;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsReasmReqds_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsReasmOKs
+ * ipSystemStatsReasmOKs is subid 15 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.15
+ * Description:
+The number of IP datagrams successfully reassembled.
+
+
+ When tracking interface statistics the counter of the
+ interface to which these datagrams were addressed is
+ incremented. This interface might not be the same as the
+ input interface for some of the datagrams.
+
+
+ Discontinuities in the value of this counter can occur at
+
+
+
+
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsReasmOKs data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsReasmOKs_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsReasmOKs_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsReasmOKs_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsReasmOKs_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsReasmOKs_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsReasmOKs data.
+ * copy (* ipSystemStatsReasmOKs_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsReasmOKs_val_ptr) = rowreq_ctx->data->stats.ReasmOKs;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsReasmOKs_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsReasmFails
+ * ipSystemStatsReasmFails is subid 16 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.16
+ * Description:
+The number of failures detected by the IP re-assembly
+ algorithm (for whatever reason: timed out, errors, etc.).
+ Note that this is not necessarily a count of discarded IP
+ fragments since some algorithms (notably the algorithm in
+ RFC 815) can lose track of the number of fragments by
+ combining them as they are received.
+
+
+ When tracking interface statistics the counter of the
+ interface to which these fragments were addressed is
+ incremented. This interface might not be the same as the
+ input interface for some of the fragments.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsReasmFails data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsReasmFails_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsReasmFails_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsReasmFails_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsReasmFails_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsReasmFails_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsReasmFails data.
+ * copy (* ipSystemStatsReasmFails_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsReasmFails_val_ptr) =
+ rowreq_ctx->data->stats.ReasmFails;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsReasmFails_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsInDiscards
+ * ipSystemStatsInDiscards is subid 17 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.17
+ * Description:
+The number of input IP datagrams for which no problems were
+ encountered to prevent their continued processing, but which
+ were discarded (e.g., for lack of buffer space). Note that
+ this counter does not include any datagrams discarded while
+ awaiting re-assembly.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsInDiscards data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsInDiscards_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsInDiscards_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsInDiscards_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsInDiscards_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsInDiscards_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsInDiscards data.
+ * copy (* ipSystemStatsInDiscards_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsInDiscards_val_ptr) =
+ rowreq_ctx->data->stats.InDiscards;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsInDiscards_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsInDelivers
+ * ipSystemStatsInDelivers is subid 18 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.18
+ * Description:
+The total number of datagrams successfully delivered to IP
+ user-protocols (including ICMP).
+
+
+ When tracking interface statistics the counter of the
+ interface to which these datagrams were addressed is
+ incremented. This interface might not be the same as the
+ input interface for some of the datagrams.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsInDelivers data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsInDelivers_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsInDelivers_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsInDelivers_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsInDelivers_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsInDelivers_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsInDelivers data.
+ * copy (* ipSystemStatsInDelivers_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsInDelivers_val_ptr) =
+ rowreq_ctx->data->stats.HCInDelivers.low;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsInDelivers_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsHCInDelivers
+ * ipSystemStatsHCInDelivers is subid 19 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.19
+ * Description:
+The total number of datagrams successfully delivered to IP
+ user-protocols (including ICMP). This object counts the
+ same packets as ipSystemStatsInDelivers but allows for
+ larger values.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ipSystemStatsHCInDelivers data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsHCInDelivers_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsHCInDelivers_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ U64 * ipSystemStatsHCInDelivers_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCInDelivers_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ipSystemStatsHCInDelivers data.
+ * get (* ipSystemStatsHCInDelivers_val_ptr ).low and (* ipSystemStatsHCInDelivers_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ipSystemStatsHCInDelivers_val_ptr).low =
+ rowreq_ctx->data->stats.HCInDelivers.low;
+ (*ipSystemStatsHCInDelivers_val_ptr).high =
+ rowreq_ctx->data->stats.HCInDelivers.high;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsHCInDelivers_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsOutRequests
+ * ipSystemStatsOutRequests is subid 20 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.20
+ * Description:
+The total number of IP datagrams which local IP user-
+ protocols (including ICMP) supplied to IP in requests for
+ transmission. Note that this counter does not include any
+ datagrams counted in ipSystemStatsOutForwDatagrams.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsOutRequests data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsOutRequests_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsOutRequests_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsOutRequests_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsOutRequests_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsOutRequests_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutRequests data.
+ * copy (* ipSystemStatsOutRequests_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsOutRequests_val_ptr) =
+ rowreq_ctx->data->stats.HCOutRequests.low;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsOutRequests_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsHCOutRequests
+ * ipSystemStatsHCOutRequests is subid 21 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.21
+ * Description:
+The total number of IP datagrams which local IP user-
+ protocols (including ICMP) supplied to IP in requests for
+ transmission. This object counts the same packets as
+ ipSystemStatsHCOutRequests but allows for larger values.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ipSystemStatsHCOutRequests data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsHCOutRequests_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsHCOutRequests_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ U64 * ipSystemStatsHCOutRequests_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCOutRequests_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ipSystemStatsHCOutRequests data.
+ * get (* ipSystemStatsHCOutRequests_val_ptr ).low and (* ipSystemStatsHCOutRequests_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ipSystemStatsHCOutRequests_val_ptr).low =
+ rowreq_ctx->data->stats.HCOutRequests.low;
+ (*ipSystemStatsHCOutRequests_val_ptr).high =
+ rowreq_ctx->data->stats.HCOutRequests.high;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsHCOutRequests_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsOutNoRoutes
+ * ipSystemStatsOutNoRoutes is subid 22 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.22
+ * Description:
+The number of locally generated IP datagrams discarded
+ because no route could be found to transmit them to their
+ destination.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsOutNoRoutes data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsOutNoRoutes_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsOutNoRoutes_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsOutNoRoutes_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsOutNoRoutes_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsOutNoRoutes_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutNoRoutes data.
+ * copy (* ipSystemStatsOutNoRoutes_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsOutNoRoutes_val_ptr) =
+ rowreq_ctx->data->stats.OutNoRoutes;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsOutNoRoutes_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsOutForwDatagrams
+ * ipSystemStatsOutForwDatagrams is subid 23 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.23
+ * Description:
+The number of datagrams for which this entity was not their
+ final IP destination and for which it was successful in
+ finding a path to their final destination. In entities
+ which do not act as IP routers, this counter will include
+ only those datagrams which were Source-Routed via this
+ entity, and the Source-Route processing was successful.
+
+
+ When tracking interface statistics the counter of the
+ outgoing interface is incremented for a successfully
+ forwarded datagram.
+
+
+ Discontinuities in the value of this counter can occur at
+
+
+
+
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsOutForwDatagrams data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsOutForwDatagrams_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsOutForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutForwDatagrams_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsOutForwDatagrams_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsOutForwDatagrams_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutForwDatagrams data.
+ * copy (* ipSystemStatsOutForwDatagrams_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsOutForwDatagrams_val_ptr) =
+ rowreq_ctx->data->stats.HCOutForwDatagrams.low;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsOutForwDatagrams_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsHCOutForwDatagrams
+ * ipSystemStatsHCOutForwDatagrams is subid 24 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.24
+ * Description:
+The number of datagrams for which this entity was not their
+ final IP destination and for which it was successful in
+ finding a path to their final destination. This object
+ counts the same packets as ipSystemStatsOutForwDatagrams but
+ allows for larger values.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ipSystemStatsHCOutForwDatagrams data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsHCOutForwDatagrams_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsHCOutForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCOutForwDatagrams_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCOutForwDatagrams_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ipSystemStatsHCOutForwDatagrams data.
+ * get (* ipSystemStatsHCOutForwDatagrams_val_ptr ).low and (* ipSystemStatsHCOutForwDatagrams_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ipSystemStatsHCOutForwDatagrams_val_ptr).low =
+ rowreq_ctx->data->stats.HCOutForwDatagrams.low;
+ (*ipSystemStatsHCOutForwDatagrams_val_ptr).high =
+ rowreq_ctx->data->stats.HCOutForwDatagrams.high;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsHCOutForwDatagrams_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsOutDiscards
+ * ipSystemStatsOutDiscards is subid 25 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.25
+ * Description:
+The number of output IP datagrams for which no problem was
+ encountered to prevent their transmission to their
+ destination, but which were discarded (e.g., for lack of
+ buffer space). Note that this counter would include
+ datagrams counted in ipSystemStatsOutForwDatagrams if any
+ such datagrams met this (discretionary) discard criterion.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsOutDiscards data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsOutDiscards_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsOutDiscards_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsOutDiscards_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsOutDiscards_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsOutDiscards_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutDiscards data.
+ * copy (* ipSystemStatsOutDiscards_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsOutDiscards_val_ptr) =
+ rowreq_ctx->data->stats.OutDiscards;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsOutDiscards_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsOutFragReqds
+ * ipSystemStatsOutFragReqds is subid 26 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.26
+ * Description:
+The number of IP datagrams that would require fragmentation
+ in order to be transmitted.
+
+
+
+
+
+ When tracking interface statistics the counter of the
+ outgoing interface is incremented for a successfully
+ fragmented datagram.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsOutFragReqds data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsOutFragReqds_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsOutFragReqds_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsOutFragReqds_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsOutFragReqds_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsOutFragReqds_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutFragReqds data.
+ * copy (* ipSystemStatsOutFragReqds_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsOutFragReqds_val_ptr) =
+ rowreq_ctx->data->stats.OutFragReqds;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsOutFragReqds_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsOutFragOKs
+ * ipSystemStatsOutFragOKs is subid 27 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.27
+ * Description:
+The number of IP datagrams that have been successfully
+ fragmented.
+
+
+ When tracking interface statistics the counter of the
+ outgoing interface is incremented for a successfully
+ fragmented datagram.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsOutFragOKs data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsOutFragOKs_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsOutFragOKs_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsOutFragOKs_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsOutFragOKs_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsOutFragOKs_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutFragOKs data.
+ * copy (* ipSystemStatsOutFragOKs_val_ptr ) from rowreq_ctx->data
+ */
+ snmp_log(LOG_ERR,
+ "ipSystemStatsTable node ipSystemStatsOutFragOKs not implemented: skipping\n");
+ return MFD_SKIP;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsOutFragOKs_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsOutFragFails
+ * ipSystemStatsOutFragFails is subid 28 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.28
+ * Description:
+The number of IP datagrams that have been discarded because
+ they needed to be fragmented but could not be. This
+ includes IPv4 packets that have the DF bit set and IPv6
+ packets that are being forwarded and exceed the outgoing
+ link MTU.
+
+
+ When tracking interface statistics the counter of the
+ outgoing interface is incremented for an unsuccessfully
+ fragmented datagram.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsOutFragFails data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsOutFragFails_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsOutFragFails_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsOutFragFails_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsOutFragFails_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsOutFragFails_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutFragFails data.
+ * copy (* ipSystemStatsOutFragFails_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsOutFragFails_val_ptr) =
+ rowreq_ctx->data->stats.OutFragFails;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsOutFragFails_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsOutFragCreates
+ * ipSystemStatsOutFragCreates is subid 29 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.29
+ * Description:
+The number of output datagram fragments that have been
+ generated as a result of IP fragmentation.
+
+
+ When tracking interface statistics the counter of the
+ outgoing interface is incremented for a successfully
+ fragmented datagram.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsOutFragCreates data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsOutFragCreates_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsOutFragCreates_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long *
+ ipSystemStatsOutFragCreates_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsOutFragCreates_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsOutFragCreates_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutFragCreates data.
+ * copy (* ipSystemStatsOutFragCreates_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsOutFragCreates_val_ptr) =
+ rowreq_ctx->data->stats.OutFragCreates;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsOutFragCreates_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsOutTransmits
+ * ipSystemStatsOutTransmits is subid 30 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.30
+ * Description:
+The total number of IP datagrams that this entity supplied
+ to the lower layers for transmission. This includes
+ datagrams generated local and those forwarded by this
+ entity.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsOutTransmits data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsOutTransmits_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsOutTransmits_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsOutTransmits_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsOutTransmits_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsOutTransmits_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutTransmits data.
+ * copy (* ipSystemStatsOutTransmits_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsOutTransmits_val_ptr) =
+ rowreq_ctx->data->stats.HCOutTransmits.low;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsOutTransmits_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsHCOutTransmits
+ * ipSystemStatsHCOutTransmits is subid 31 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.31
+ * Description:
+The total number of IP datagrams that this entity supplied
+ to the lower layers for transmission. This object counts
+ the same datagrams as ipSystemStatsOutTransmits but allows
+ for larger values.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ipSystemStatsHCOutTransmits data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsHCOutTransmits_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsHCOutTransmits_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ U64 * ipSystemStatsHCOutTransmits_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCOutTransmits_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ipSystemStatsHCOutTransmits data.
+ * get (* ipSystemStatsHCOutTransmits_val_ptr ).low and (* ipSystemStatsHCOutTransmits_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ipSystemStatsHCOutTransmits_val_ptr).low =
+ rowreq_ctx->data->stats.HCOutTransmits.low;
+ (*ipSystemStatsHCOutTransmits_val_ptr).high =
+ rowreq_ctx->data->stats.HCOutTransmits.high;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsHCOutTransmits_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsOutOctets
+ * ipSystemStatsOutOctets is subid 32 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.32
+ * Description:
+The total number of octets in IP datagrams delivered to the
+ lower layers for transmission. Octets from datagrams
+ counted in ipSystemStatsOutTransmits MUST be counted here.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsOutOctets data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsOutOctets_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsOutOctets_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsOutOctets_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsOutOctets_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsOutOctets_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutOctets data.
+ * copy (* ipSystemStatsOutOctets_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsOutOctets_val_ptr) =
+ rowreq_ctx->data->stats.HCOutOctets.low;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsOutOctets_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsHCOutOctets
+ * ipSystemStatsHCOutOctets is subid 33 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.33
+ * Description:
+The total number of octets in IP datagrams delivered to the
+ lower layers for transmission. This objects counts the same
+ octets as ipSystemStatsOutOctets but allows for larger
+ values.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ipSystemStatsHCOutOctets data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsHCOutOctets_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsHCOutOctets_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ U64 * ipSystemStatsHCOutOctets_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCOutOctets_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ipSystemStatsHCOutOctets data.
+ * get (* ipSystemStatsHCOutOctets_val_ptr ).low and (* ipSystemStatsHCOutOctets_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ipSystemStatsHCOutOctets_val_ptr).low =
+ rowreq_ctx->data->stats.HCOutOctets.low;
+ (*ipSystemStatsHCOutOctets_val_ptr).high =
+ rowreq_ctx->data->stats.HCOutOctets.high;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsHCOutOctets_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsInMcastPkts
+ * ipSystemStatsInMcastPkts is subid 34 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.34
+ * Description:
+The number of IP multicast datagrams received.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsInMcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsInMcastPkts_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsInMcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsInMcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsInMcastPkts_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsInMcastPkts_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsInMcastPkts data.
+ * copy (* ipSystemStatsInMcastPkts_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsInMcastPkts_val_ptr) =
+ rowreq_ctx->data->stats.HCInMcastPkts.low;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsInMcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsHCInMcastPkts
+ * ipSystemStatsHCInMcastPkts is subid 35 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.35
+ * Description:
+The number of IP multicast datagrams received. This object
+ counts the same datagrams as ipSystemStatsInMcastPkts but
+ allows for larger values.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ipSystemStatsHCInMcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsHCInMcastPkts_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsHCInMcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ U64 * ipSystemStatsHCInMcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCInMcastPkts_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ipSystemStatsHCInMcastPkts data.
+ * get (* ipSystemStatsHCInMcastPkts_val_ptr ).low and (* ipSystemStatsHCInMcastPkts_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ipSystemStatsHCInMcastPkts_val_ptr).low =
+ rowreq_ctx->data->stats.HCInMcastPkts.low;
+ (*ipSystemStatsHCInMcastPkts_val_ptr).high =
+ rowreq_ctx->data->stats.HCInMcastPkts.high;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsHCInMcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsInMcastOctets
+ * ipSystemStatsInMcastOctets is subid 36 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.36
+ * Description:
+The total number of octets received in IP multicast
+ datagrams. Octets from datagrams counted in
+ ipSystemStatsOutMcastPkts MUST be counted here.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsInMcastOctets data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsInMcastOctets_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsInMcastOctets_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsInMcastOctets_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsInMcastOctets_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsInMcastOctets_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsInMcastOctets data.
+ * copy (* ipSystemStatsInMcastOctets_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsInMcastOctets_val_ptr) =
+ rowreq_ctx->data->stats.HCInMcastOctets.low;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsInMcastOctets_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsHCInMcastOctets
+ * ipSystemStatsHCInMcastOctets is subid 37 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.37
+ * Description:
+The total number of octets received in IP multicast
+ datagrams. This object counts the same octets as
+ ipSystemStatsInMcastOctets but allows for larger values.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ipSystemStatsHCInMcastOctets data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsHCInMcastOctets_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsHCInMcastOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCInMcastOctets_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCInMcastOctets_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ipSystemStatsHCInMcastOctets data.
+ * get (* ipSystemStatsHCInMcastOctets_val_ptr ).low and (* ipSystemStatsHCInMcastOctets_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ipSystemStatsHCInMcastOctets_val_ptr).low =
+ rowreq_ctx->data->stats.HCInMcastOctets.low;
+ (*ipSystemStatsHCInMcastOctets_val_ptr).high =
+ rowreq_ctx->data->stats.HCInMcastOctets.high;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsHCInMcastOctets_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsOutMcastPkts
+ * ipSystemStatsOutMcastPkts is subid 38 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.38
+ * Description:
+The number of IP multicast datagrams transmitted.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsOutMcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsOutMcastPkts_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsOutMcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsOutMcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsOutMcastPkts_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsOutMcastPkts_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutMcastPkts data.
+ * copy (* ipSystemStatsOutMcastPkts_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsOutMcastPkts_val_ptr) =
+ rowreq_ctx->data->stats.HCOutMcastPkts.low;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsOutMcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsHCOutMcastPkts
+ * ipSystemStatsHCOutMcastPkts is subid 39 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.39
+ * Description:
+The number of IP multicast datagrams transmitted. This
+ object counts the same datagrams as
+ ipSystemStatsOutMcastPkts but allows for larger values.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ipSystemStatsHCOutMcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsHCOutMcastPkts_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsHCOutMcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ U64 * ipSystemStatsHCOutMcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCOutMcastPkts_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ipSystemStatsHCOutMcastPkts data.
+ * get (* ipSystemStatsHCOutMcastPkts_val_ptr ).low and (* ipSystemStatsHCOutMcastPkts_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ipSystemStatsHCOutMcastPkts_val_ptr).low =
+ rowreq_ctx->data->stats.HCOutMcastPkts.low;
+ (*ipSystemStatsHCOutMcastPkts_val_ptr).high =
+ rowreq_ctx->data->stats.HCOutMcastPkts.high;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsHCOutMcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsOutMcastOctets
+ * ipSystemStatsOutMcastOctets is subid 40 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.40
+ * Description:
+The total number of octets transmitted in IP multicast
+ datagrams. Octets from datagrams counted in
+ ipSystemStatsInMcastPkts MUST be counted here.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsOutMcastOctets data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsOutMcastOctets_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsOutMcastOctets_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long *
+ ipSystemStatsOutMcastOctets_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsOutMcastOctets_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsOutMcastOctets_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutMcastOctets data.
+ * copy (* ipSystemStatsOutMcastOctets_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsOutMcastOctets_val_ptr) =
+ rowreq_ctx->data->stats.HCOutMcastOctets.low;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsOutMcastOctets_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsHCOutMcastOctets
+ * ipSystemStatsHCOutMcastOctets is subid 41 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.41
+ * Description:
+The total number of octets transmitted in IP multicast
+ datagrams. This object counts the same octets as
+ ipSystemStatsOutMcastOctets but allows for larger values.
+
+
+ Discontinuities in the value of this counter can occur at
+
+
+
+
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ipSystemStatsHCOutMcastOctets data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsHCOutMcastOctets_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsHCOutMcastOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCOutMcastOctets_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCOutMcastOctets_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ipSystemStatsHCOutMcastOctets data.
+ * get (* ipSystemStatsHCOutMcastOctets_val_ptr ).low and (* ipSystemStatsHCOutMcastOctets_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ipSystemStatsHCOutMcastOctets_val_ptr).low =
+ rowreq_ctx->data->stats.HCOutMcastOctets.low;
+ (*ipSystemStatsHCOutMcastOctets_val_ptr).high =
+ rowreq_ctx->data->stats.HCOutMcastOctets.high;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsHCOutMcastOctets_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsInBcastPkts
+ * ipSystemStatsInBcastPkts is subid 42 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.42
+ * Description:
+The number of IP broadcast datagrams received.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsInBcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsInBcastPkts_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsInBcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsInBcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsInBcastPkts_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsInBcastPkts_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsInBcastPkts data.
+ * copy (* ipSystemStatsInBcastPkts_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsInBcastPkts_val_ptr) =
+ rowreq_ctx->data->stats.HCInBcastPkts.low;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsInBcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsHCInBcastPkts
+ * ipSystemStatsHCInBcastPkts is subid 43 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.43
+ * Description:
+The number of IP broadcast datagrams received. This object
+ counts the same datagrams as ipSystemStatsInBcastPkts but
+ allows for larger values.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ipSystemStatsHCInBcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsHCInBcastPkts_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsHCInBcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ U64 * ipSystemStatsHCInBcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCInBcastPkts_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ipSystemStatsHCInBcastPkts data.
+ * get (* ipSystemStatsHCInBcastPkts_val_ptr ).low and (* ipSystemStatsHCInBcastPkts_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ipSystemStatsHCInBcastPkts_val_ptr).low =
+ rowreq_ctx->data->stats.HCInBcastPkts.low;
+ (*ipSystemStatsHCInBcastPkts_val_ptr).high =
+ rowreq_ctx->data->stats.HCInBcastPkts.high;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsHCInBcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsOutBcastPkts
+ * ipSystemStatsOutBcastPkts is subid 44 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.44
+ * Description:
+The number of IP broadcast datagrams transmitted.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER (based on perltype COUNTER)
+ * The net-snmp type is ASN_COUNTER. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsOutBcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsOutBcastPkts_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsOutBcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsOutBcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsOutBcastPkts_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsOutBcastPkts_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsOutBcastPkts data.
+ * copy (* ipSystemStatsOutBcastPkts_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsOutBcastPkts_val_ptr) =
+ rowreq_ctx->data->stats.HCOutBcastPkts.low;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsOutBcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsHCOutBcastPkts
+ * ipSystemStatsHCOutBcastPkts is subid 45 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.45
+ * Description:
+The number of IP broadcast datagrams transmitted. This
+ object counts the same datagrams as
+ ipSystemStatsOutBcastPkts but allows for larger values.
+
+
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ipSystemStatsDiscontinuityTime.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is COUNTER64 (based on perltype COUNTER64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ */
+/**
+ * Extract the current value of the ipSystemStatsHCOutBcastPkts data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsHCOutBcastPkts_val_ptr
+ * Pointer to storage for a U64 variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsHCOutBcastPkts_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ U64 * ipSystemStatsHCOutBcastPkts_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsHCOutBcastPkts_val_ptr);
+
+ /*
+ * TODO:231:o: |-> copy ipSystemStatsHCOutBcastPkts data.
+ * get (* ipSystemStatsHCOutBcastPkts_val_ptr ).low and (* ipSystemStatsHCOutBcastPkts_val_ptr ).high from rowreq_ctx->data
+ */
+ (*ipSystemStatsHCOutBcastPkts_val_ptr).low =
+ rowreq_ctx->data->stats.HCOutBcastPkts.low;
+ (*ipSystemStatsHCOutBcastPkts_val_ptr).high =
+ rowreq_ctx->data->stats.HCOutBcastPkts.high;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsHCOutBcastPkts_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsDiscontinuityTime
+ * ipSystemStatsDiscontinuityTime is subid 46 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.46
+ * Description:
+The value of sysUpTime on the most recent occasion at which
+ any one or more of this entry's counters suffered a
+ discontinuity.
+
+
+ If no such discontinuities have occurred since the last re-
+ initialization of the local management subsystem, then this
+ object contains a zero value.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is TimeStamp (based on perltype TICKS)
+ * The net-snmp type is ASN_TIMETICKS. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsDiscontinuityTime data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsDiscontinuityTime_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsDiscontinuityTime_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsDiscontinuityTime_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsDiscontinuityTime_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsDiscontinuityTime_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsDiscontinuityTime data.
+ * copy (* ipSystemStatsDiscontinuityTime_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsDiscontinuityTime_val_ptr) =
+ rowreq_ctx->ipSystemStatsDiscontinuityTime;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsDiscontinuityTime_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipSystemStatsEntry.ipSystemStatsRefreshRate
+ * ipSystemStatsRefreshRate is subid 47 of ipSystemStatsEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.31.1.1.47
+ * Description:
+The minimum reasonable polling interval for this entry.
+ This object provides an indication of the minimum amount of
+ time required to update the counters in this entry.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32)
+ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipSystemStatsRefreshRate data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipSystemStatsRefreshRate_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipSystemStatsRefreshRate_get(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipSystemStatsRefreshRate_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipSystemStatsRefreshRate_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsRefreshRate_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipSystemStatsRefreshRate data.
+ * copy (* ipSystemStatsRefreshRate_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipSystemStatsRefreshRate_val_ptr) =
+ rowreq_ctx->ipSystemStatsRefreshRate;
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsRefreshRate_get */
+
+
+
+/** @} */
+/** @} */
+/** @{ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.h
new file mode 100644
index 0000000000..51590d293f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable.h
@@ -0,0 +1,1205 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: ipSystemStatsTable.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+#ifndef IPSYSTEMSTATSTABLE_H
+#define IPSYSTEMSTATSTABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @addtogroup misc misc: Miscellaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/data_access/ipstats.h>
+#include <net-snmp/data_access/systemstats.h>
+
+ /*
+ * other required module components
+ */
+ /* *INDENT-OFF* */
+config_require(ip-mib/data_access/systemstats)
+config_require(ip-mib/ipSystemStatsTable/ipSystemStatsTable_interface)
+config_require(ip-mib/ipSystemStatsTable/ipSystemStatsTable_data_access)
+ /* *INDENT-ON* */
+
+ /*
+ * OID, column number and enum definions for ipSystemStatsTable
+ */
+#include "ipSystemStatsTable_constants.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_ipSystemStatsTable(void);
+ void shutdown_ipSystemStatsTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipSystemStatsTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipSystemStatsTable is subid 1 of ipTrafficStats.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.31.1, length: 9
+ */
+ /*
+ *********************************************************************
+ * When you register your mib, you get to provide a generic
+ * pointer that will be passed back to you for most of the
+ * functions calls.
+ *
+ * TODO:100:r: Review all context structures
+ */
+ /*
+ * TODO:101:o: |-> Review ipSystemStatsTable registration context.
+ */
+ typedef netsnmp_data_list ipSystemStatsTable_registration;
+
+/**********************************************************************/
+ /*
+ * TODO:110:r: |-> Review ipSystemStatsTable data context structure.
+ * This structure is used to represent the data for ipSystemStatsTable.
+ */
+ typedef netsnmp_systemstats_entry ipSystemStatsTable_data;
+
+
+ /*
+ * TODO:120:r: |-> Review ipSystemStatsTable mib index.
+ * This structure is used to represent the index for ipSystemStatsTable.
+ */
+ typedef struct ipSystemStatsTable_mib_index_s {
+
+ /*
+ * ipSystemStatsIPVersion(1)/InetVersion/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ u_long ipSystemStatsIPVersion;
+
+
+ } ipSystemStatsTable_mib_index;
+
+ /*
+ * TODO:121:r: | |-> Review ipSystemStatsTable max index length.
+ * If you KNOW that your indexes will never exceed a certain
+ * length, update this macro to that length.
+ */
+#define MAX_ipSystemStatsTable_IDX_LEN 1
+
+
+ /*
+ *********************************************************************
+ * TODO:130:o: |-> Review ipSystemStatsTable Row request (rowreq) context.
+ * When your functions are called, you will be passed a
+ * ipSystemStatsTable_rowreq_ctx pointer.
+ */
+ typedef struct ipSystemStatsTable_rowreq_ctx_s {
+
+ /** this must be first for container compare to work */
+ netsnmp_index oid_idx;
+ oid oid_tmp[MAX_ipSystemStatsTable_IDX_LEN];
+
+ ipSystemStatsTable_mib_index tbl_idx;
+
+ ipSystemStatsTable_data *data;
+
+ /*
+ * flags per row. Currently, the first (lower) 8 bits are reserved
+ * for the user. See mfd.h for other flags.
+ */
+ u_int rowreq_flags;
+
+ /*
+ * TODO:131:o: | |-> Add useful data to ipSystemStatsTable rowreq context.
+ */
+ char known_missing;
+ uint32_t ipSystemStatsDiscontinuityTime;
+ uint32_t ipSystemStatsRefreshRate;
+
+ /*
+ * storage for future expansion
+ */
+ netsnmp_data_list *ipSystemStatsTable_data_list;
+
+ } ipSystemStatsTable_rowreq_ctx;
+
+ typedef struct ipSystemStatsTable_ref_rowreq_ctx_s {
+ ipSystemStatsTable_rowreq_ctx *rowreq_ctx;
+ } ipSystemStatsTable_ref_rowreq_ctx;
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsTable_pre_request(ipSystemStatsTable_registration *
+ user_context);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsTable_post_request(ipSystemStatsTable_registration *
+ user_context, int rc);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsTable_rowreq_ctx_init(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ void *user_init_ctx);
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsTable_rowreq_ctx_cleanup(ipSystemStatsTable_rowreq_ctx
+ * rowreq_ctx);
+
+ ipSystemStatsTable_data *ipSystemStatsTable_allocate_data(void);
+ void ipSystemStatsTable_release_data(ipSystemStatsTable_data
+ * data);
+
+
+
+
+
+
+
+
+ ipSystemStatsTable_rowreq_ctx
+ * ipSystemStatsTable_row_find_by_mib_index
+ (ipSystemStatsTable_mib_index * mib_idx);
+
+ extern oid ipSystemStatsTable_oid[];
+ extern int ipSystemStatsTable_oid_size;
+
+
+#include "ipSystemStatsTable_interface.h"
+#include "ipSystemStatsTable_data_access.h"
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipSystemStatsTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipSystemStatsTable is subid 1 of ipTrafficStats.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.31.1, length: 9
+ */
+ /*
+ * indexes
+ */
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsInReceives_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInReceives_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsHCInReceives_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCInReceives_val_ptr);
+ int ipSystemStatsInOctets_get(ipSystemStatsTable_rowreq_ctx
+ * rowreq_ctx,
+ u_long *
+ ipSystemStatsInOctets_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsHCInOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 * ipSystemStatsHCInOctets_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsInHdrErrors_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInHdrErrors_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsInNoRoutes_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInNoRoutes_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsInAddrErrors_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInAddrErrors_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsInUnknownProtos_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInUnknownProtos_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsInTruncatedPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInTruncatedPkts_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsInForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInForwDatagrams_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsHCInForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCInForwDatagrams_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsReasmReqds_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsReasmReqds_val_ptr);
+ int ipSystemStatsReasmOKs_get(ipSystemStatsTable_rowreq_ctx
+ * rowreq_ctx,
+ u_long *
+ ipSystemStatsReasmOKs_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsReasmFails_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsReasmFails_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsInDiscards_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInDiscards_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsInDelivers_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInDelivers_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsHCInDelivers_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCInDelivers_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsOutRequests_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutRequests_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsHCOutRequests_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCOutRequests_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsOutNoRoutes_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutNoRoutes_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsOutForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutForwDatagrams_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsHCOutForwDatagrams_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCOutForwDatagrams_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsOutDiscards_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutDiscards_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsOutFragReqds_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutFragReqds_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsOutFragOKs_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutFragOKs_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsOutFragFails_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutFragFails_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsOutFragCreates_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutFragCreates_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsOutTransmits_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutTransmits_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsHCOutTransmits_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCOutTransmits_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsOutOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutOctets_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsHCOutOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCOutOctets_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsInMcastPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInMcastPkts_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsHCInMcastPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCInMcastPkts_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsInMcastOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInMcastOctets_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsHCInMcastOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCInMcastOctets_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsOutMcastPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutMcastPkts_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsHCOutMcastPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCOutMcastPkts_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsOutMcastOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutMcastOctets_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsHCOutMcastOctets_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCOutMcastOctets_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsInBcastPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsInBcastPkts_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsHCInBcastPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCInBcastPkts_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsOutBcastPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsOutBcastPkts_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsHCOutBcastPkts_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ U64 *
+ ipSystemStatsHCOutBcastPkts_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsDiscontinuityTime_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsDiscontinuityTime_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsRefreshRate_get(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipSystemStatsRefreshRate_val_ptr);
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsTable_indexes_set_tbl_idx(ipSystemStatsTable_mib_index
+ * tbl_idx,
+ u_long
+ ipSystemStatsIPVersion_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsTable_indexes_set(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipSystemStatsIPVersion_val);
+
+
+
+ /*
+ *********************************************************************
+ * SET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * SET Table declarations
+ */
+
+
+ /*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPSYSTEMSTATSTABLE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_constants.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_constants.h
new file mode 100644
index 0000000000..0fa6104c7a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_constants.h
@@ -0,0 +1,159 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $
+ *
+ * $Id: ipSystemStatsTable_constants.h 13768 2005-12-01 20:12:20Z rstory $
+ */
+#ifndef IPSYSTEMSTATSTABLE_CONSTANTS_H
+#define IPSYSTEMSTATSTABLE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ * column number definitions for table ipSystemStatsTable
+ */
+#define IPSYSTEMSTATSTABLE_OID 1,3,6,1,2,1,4,31,1
+
+#define COLUMN_IPSYSTEMSTATSIPVERSION 1
+
+#define COLUMN_IPSYSTEMSTATSINRECEIVES 3
+
+#define COLUMN_IPSYSTEMSTATSHCINRECEIVES 4
+
+#define COLUMN_IPSYSTEMSTATSINOCTETS 5
+
+#define COLUMN_IPSYSTEMSTATSHCINOCTETS 6
+
+#define COLUMN_IPSYSTEMSTATSINHDRERRORS 7
+
+#define COLUMN_IPSYSTEMSTATSINNOROUTES 8
+
+#define COLUMN_IPSYSTEMSTATSINADDRERRORS 9
+
+#define COLUMN_IPSYSTEMSTATSINUNKNOWNPROTOS 10
+
+#define COLUMN_IPSYSTEMSTATSINTRUNCATEDPKTS 11
+
+#define COLUMN_IPSYSTEMSTATSINFORWDATAGRAMS 12
+
+#define COLUMN_IPSYSTEMSTATSHCINFORWDATAGRAMS 13
+
+#define COLUMN_IPSYSTEMSTATSREASMREQDS 14
+
+#define COLUMN_IPSYSTEMSTATSREASMOKS 15
+
+#define COLUMN_IPSYSTEMSTATSREASMFAILS 16
+
+#define COLUMN_IPSYSTEMSTATSINDISCARDS 17
+
+#define COLUMN_IPSYSTEMSTATSINDELIVERS 18
+
+#define COLUMN_IPSYSTEMSTATSHCINDELIVERS 19
+
+#define COLUMN_IPSYSTEMSTATSOUTREQUESTS 20
+
+#define COLUMN_IPSYSTEMSTATSHCOUTREQUESTS 21
+
+#define COLUMN_IPSYSTEMSTATSOUTNOROUTES 22
+
+#define COLUMN_IPSYSTEMSTATSOUTFORWDATAGRAMS 23
+
+#define COLUMN_IPSYSTEMSTATSHCOUTFORWDATAGRAMS 24
+
+#define COLUMN_IPSYSTEMSTATSOUTDISCARDS 25
+
+#define COLUMN_IPSYSTEMSTATSOUTFRAGREQDS 26
+
+#define COLUMN_IPSYSTEMSTATSOUTFRAGOKS 27
+
+#define COLUMN_IPSYSTEMSTATSOUTFRAGFAILS 28
+
+#define COLUMN_IPSYSTEMSTATSOUTFRAGCREATES 29
+
+#define COLUMN_IPSYSTEMSTATSOUTTRANSMITS 30
+
+#define COLUMN_IPSYSTEMSTATSHCOUTTRANSMITS 31
+
+#define COLUMN_IPSYSTEMSTATSOUTOCTETS 32
+
+#define COLUMN_IPSYSTEMSTATSHCOUTOCTETS 33
+
+#define COLUMN_IPSYSTEMSTATSINMCASTPKTS 34
+
+#define COLUMN_IPSYSTEMSTATSHCINMCASTPKTS 35
+
+#define COLUMN_IPSYSTEMSTATSINMCASTOCTETS 36
+
+#define COLUMN_IPSYSTEMSTATSHCINMCASTOCTETS 37
+
+#define COLUMN_IPSYSTEMSTATSOUTMCASTPKTS 38
+
+#define COLUMN_IPSYSTEMSTATSHCOUTMCASTPKTS 39
+
+#define COLUMN_IPSYSTEMSTATSOUTMCASTOCTETS 40
+
+#define COLUMN_IPSYSTEMSTATSHCOUTMCASTOCTETS 41
+
+#define COLUMN_IPSYSTEMSTATSINBCASTPKTS 42
+
+#define COLUMN_IPSYSTEMSTATSHCINBCASTPKTS 43
+
+#define COLUMN_IPSYSTEMSTATSOUTBCASTPKTS 44
+
+#define COLUMN_IPSYSTEMSTATSHCOUTBCASTPKTS 45
+
+#define COLUMN_IPSYSTEMSTATSDISCONTINUITYTIME 46
+
+#define COLUMN_IPSYSTEMSTATSREFRESHRATE 47
+
+
+#define IPSYSTEMSTATSTABLE_MIN_COL COLUMN_IPSYSTEMSTATSINRECEIVES
+#define IPSYSTEMSTATSTABLE_MAX_COL COLUMN_IPSYSTEMSTATSREFRESHRATE
+
+
+ /*
+ * NOTES on enums
+ * ==============
+ *
+ * Value Mapping
+ * -------------
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them
+ * below. For example, a boolean flag (1/0) is usually represented
+ * as a TruthValue in a MIB, which maps to the values (1/2).
+ *
+ */
+/*************************************************************************
+ *************************************************************************
+ *
+ * enum definitions for table ipSystemStatsTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipSystemStatsIPVersion (InetVersion / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef INETVERSION_ENUMS
+#define INETVERSION_ENUMS
+
+#define INETVERSION_UNKNOWN 0
+#define INETVERSION_IPV4 1
+#define INETVERSION_IPV6 2
+
+#endif /* INETVERSION_ENUMS */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPSYSTEMSTATSTABLE_OIDS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_data_access.c
new file mode 100644
index 0000000000..c1d257d6e0
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_data_access.c
@@ -0,0 +1,446 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: ipSystemStatsTable_data_access.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipSystemStatsTable.h"
+
+
+#include "ipSystemStatsTable_data_access.h"
+
+static int ipss_cache_refresh = 30;
+
+/** @ingroup interface
+ * @addtogroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipSystemStatsTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipSystemStatsTable is subid 1 of ipTrafficStats.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.31.1, length: 9
+ */
+
+/**
+ * initialization for ipSystemStatsTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param ipSystemStatsTable_reg
+ * Pointer to ipSystemStatsTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+ipSystemStatsTable_init_data(ipSystemStatsTable_registration *
+ ipSystemStatsTable_reg)
+{
+ static unsigned int my_columns[] = {
+ COLUMN_IPSYSTEMSTATSINRECEIVES, COLUMN_IPSYSTEMSTATSHCINRECEIVES,
+ /** COLUMN_IPSYSTEMSTATSINOCTETS, */
+ COLUMN_IPSYSTEMSTATSHCINOCTETS,
+ COLUMN_IPSYSTEMSTATSINHDRERRORS,
+ /** COLUMN_IPSYSTEMSTATSINNOROUTES, */
+ COLUMN_IPSYSTEMSTATSINADDRERRORS,
+ COLUMN_IPSYSTEMSTATSINUNKNOWNPROTOS,
+ /** COLUMN_IPSYSTEMSTATSINTRUNCATEDPKTS, */
+ COLUMN_IPSYSTEMSTATSINFORWDATAGRAMS,
+ COLUMN_IPSYSTEMSTATSHCINFORWDATAGRAMS,
+ COLUMN_IPSYSTEMSTATSREASMREQDS,
+ COLUMN_IPSYSTEMSTATSREASMOKS, COLUMN_IPSYSTEMSTATSREASMFAILS,
+ COLUMN_IPSYSTEMSTATSINDISCARDS, COLUMN_IPSYSTEMSTATSINDELIVERS,
+ COLUMN_IPSYSTEMSTATSHCINDELIVERS, COLUMN_IPSYSTEMSTATSOUTREQUESTS,
+ COLUMN_IPSYSTEMSTATSHCOUTREQUESTS, COLUMN_IPSYSTEMSTATSOUTNOROUTES,
+ /** COLUMN_IPSYSTEMSTATSOUTFORWDATAGRAMS, */
+ COLUMN_IPSYSTEMSTATSHCOUTFORWDATAGRAMS,
+ COLUMN_IPSYSTEMSTATSOUTDISCARDS,
+ /** COLUMN_IPSYSTEMSTATSOUTFRAGREQDS, */
+ COLUMN_IPSYSTEMSTATSOUTFRAGOKS, COLUMN_IPSYSTEMSTATSOUTFRAGFAILS,
+ COLUMN_IPSYSTEMSTATSOUTFRAGCREATES,
+ /** COLUMN_IPSYSTEMSTATSOUTTRANSMITS, */
+ /** COLUMN_IPSYSTEMSTATSHCOUTTRANSMITS, */
+ /** COLUMN_IPSYSTEMSTATSOUTOCTETS, */
+ /** COLUMN_IPSYSTEMSTATSHCOUTOCTETS, */
+ /** COLUMN_IPSYSTEMSTATSINMCASTPKTS, */
+ /** COLUMN_IPSYSTEMSTATSHCINMCASTPKTS, */
+ /** COLUMN_IPSYSTEMSTATSINMCASTOCTETS, */
+ /** COLUMN_IPSYSTEMSTATSHCINMCASTOCTETS, */
+ /** COLUMN_IPSYSTEMSTATSOUTMCASTPKTS, */
+ /** COLUMN_IPSYSTEMSTATSHCOUTMCASTPKTS, */
+ /** COLUMN_IPSYSTEMSTATSOUTMCASTOCTETS, */
+ /** COLUMN_IPSYSTEMSTATSHCOUTMCASTOCTETS, */
+ /** COLUMN_IPSYSTEMSTATSINBCASTPKTS, */
+ /** COLUMN_IPSYSTEMSTATSHCINBCASTPKTS, */
+ /** COLUMN_IPSYSTEMSTATSOUTBCASTPKTS, */
+ /** COLUMN_IPSYSTEMSTATSHCOUTBCASTPKTS, */
+ COLUMN_IPSYSTEMSTATSDISCONTINUITYTIME,
+ COLUMN_IPSYSTEMSTATSREFRESHRATE
+ };
+ static netsnmp_column_info valid_columns;
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_init_data",
+ "called\n"));
+
+ /*
+ * we only want to process certain columns, and ignore
+ * anything else.
+ */
+ valid_columns.isRange = 0;
+ valid_columns.details.list = my_columns;
+ valid_columns.list_count = sizeof(my_columns) / sizeof(unsigned int);
+ ipSystemStatsTable_valid_columns_set(&valid_columns);
+ /*
+ * TODO:303:o: Initialize ipSystemStatsTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsTable_init_data */
+
+/**
+ * container overview
+ *
+ */
+
+/**
+ * container initialization
+ *
+ * @param container_ptr_ptr A pointer to a container pointer. If you
+ * create a custom container, use this parameter to return it
+ * to the MFD helper. If set to NULL, the MFD helper will
+ * allocate a container for you.
+ * @param cache A pointer to a cache structure. You can set the timeout
+ * and other cache flags using this pointer.
+ *
+ * This function is called at startup to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases. If no custom
+ * container is allocated, the MFD code will create one for your.
+ *
+ * This is also the place to set up cache behavior. The default, to
+ * simply set the cache timeout, will work well with the default
+ * container. If you are using a custom container, you may want to
+ * look at the cache helper documentation to see if there are any
+ * flags you want to set.
+ *
+ * @remark
+ * This would also be a good place to do any initialization needed
+ * for you data source. For example, opening a connection to another
+ * process that will supply the data, opening a database, etc.
+ */
+void
+ipSystemStatsTable_container_init(netsnmp_container **container_ptr_ptr,
+ netsnmp_cache * cache)
+{
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_container_init", "called\n"));
+
+ if (NULL == container_ptr_ptr) {
+ snmp_log(LOG_ERR,
+ "bad container param to ipSystemStatsTable_container_init\n");
+ return;
+ }
+
+ /*
+ * For advanced users, you can use a custom container. If you
+ * do not create one, one will be created for you.
+ */
+ *container_ptr_ptr = NULL;
+
+ if (NULL == cache) {
+ snmp_log(LOG_ERR,
+ "bad cache param to ipSystemStatsTable_container_init\n");
+ return;
+ }
+
+ /*
+ * TODO:345:A: Set up ipSystemStatsTable cache properties.
+ *
+ * Also for advanced users, you can set parameters for the
+ * cache. Do not change the magic pointer, as it is used
+ * by the MFD helper. To completely disable caching, set
+ * cache->enabled to 0.
+ */
+ cache->timeout = IPSYSTEMSTATSTABLE_CACHE_TIMEOUT; /* seconds */
+
+ /*
+ * don't release resources
+ */
+ cache->flags |=
+ (NETSNMP_CACHE_DONT_AUTO_RELEASE | NETSNMP_CACHE_DONT_FREE_EXPIRED
+ | NETSNMP_CACHE_DONT_FREE_BEFORE_LOAD |
+ NETSNMP_CACHE_AUTO_RELOAD);
+} /* ipSystemStatsTable_container_init */
+
+/**
+ * check entry for update
+ */
+static void
+_check_for_updates(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_container *stats)
+{
+ /*
+ * check for matching entry. works because indexes are the same.
+ */
+ netsnmp_systemstats_entry *systemstats_entry =
+ CONTAINER_FIND(stats, rowreq_ctx->data);
+ if (NULL == systemstats_entry) {
+ DEBUGMSGTL(("ipSystemStatsTable:access",
+ "updating missing entry\n"));
+
+ /*
+ * mark row as missing, so we can set discontinuity
+ * when it comes back.
+ *
+ * what else should we do? set refresh to 0? that's not quite right...
+ */
+ rowreq_ctx->known_missing = 1;
+ } else {
+ DEBUGMSGTL(("ipSystemStatsTable:access",
+ "updating existing entry\n"));
+
+ /*
+ * Check for changes & update
+ */
+ netsnmp_access_systemstats_entry_update(rowreq_ctx->data,
+ systemstats_entry);
+
+ /*
+ * set discontinuity if previously missing.
+ */
+ if (1 == rowreq_ctx->known_missing) {
+ rowreq_ctx->known_missing = 0;
+ rowreq_ctx->ipSystemStatsDiscontinuityTime =
+ netsnmp_get_agent_uptime();
+ }
+
+ /*
+ * remove entry from container
+ */
+ CONTAINER_REMOVE(stats, systemstats_entry);
+ netsnmp_access_systemstats_entry_free(systemstats_entry);
+ }
+}
+
+/**
+ * add new entry
+ */
+static void
+_add_new(netsnmp_systemstats_entry *systemstats_entry,
+ netsnmp_container *container)
+{
+ ipSystemStatsTable_rowreq_ctx *rowreq_ctx;
+
+ DEBUGMSGTL(("ipSystemStatsTable:access", "creating new entry\n"));
+
+ netsnmp_assert(NULL != systemstats_entry);
+ netsnmp_assert(NULL != container);
+
+ /*
+ * allocate an row context and set the index(es)
+ */
+ rowreq_ctx =
+ ipSystemStatsTable_allocate_rowreq_ctx(systemstats_entry, NULL);
+ if ((NULL != rowreq_ctx)
+ && (MFD_SUCCESS ==
+ ipSystemStatsTable_indexes_set(rowreq_ctx,
+ systemstats_entry->
+ ns_ip_version))) {
+ rowreq_ctx->ipSystemStatsRefreshRate = ipss_cache_refresh * 1000; /* milli-seconds */
+ CONTAINER_INSERT(container, rowreq_ctx);
+ } else {
+ if (NULL != rowreq_ctx) {
+ snmp_log(LOG_ERR, "error setting index while loading "
+ "ipSystemStatsTable cache.\n");
+ ipSystemStatsTable_release_rowreq_ctx(rowreq_ctx);
+ } else {
+ snmp_log(LOG_ERR, "memory allocation failed while loading "
+ "ipSystemStatsTable cache.\n");
+ netsnmp_access_systemstats_entry_free(systemstats_entry);
+ }
+ }
+}
+
+/**
+ * container shutdown
+ *
+ * @param container_ptr A pointer to the container.
+ *
+ * This function is called at shutdown to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases.
+ *
+ * This function is called before ipSystemStatsTable_container_free().
+ *
+ * @remark
+ * This would also be a good place to do any cleanup needed
+ * for you data source. For example, closing a connection to another
+ * process that supplied the data, closing a database, etc.
+ */
+void
+ipSystemStatsTable_container_shutdown(netsnmp_container *container_ptr)
+{
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_container_shutdown", "called\n"));
+
+ if (NULL == container_ptr) {
+ snmp_log(LOG_ERR,
+ "bad params to ipSystemStatsTable_container_shutdown\n");
+ return;
+ }
+
+} /* ipSystemStatsTable_container_shutdown */
+
+/**
+ * load initial data
+ *
+ * TODO:350:M: Implement ipSystemStatsTable data load
+ * This function will also be called by the cache helper to load
+ * the container again (after the container free function has been
+ * called to free the previous contents).
+ *
+ * @param container container to which items should be inserted
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
+ * @retval MFD_ERROR : other error.
+ *
+ * This function is called to load the index(es) (and data, optionally)
+ * for the every row in the data set.
+ *
+ * @remark
+ * While loading the data, the only important thing is the indexes.
+ * If access to your data is cheap/fast (e.g. you have a pointer to a
+ * structure in memory), it would make sense to update the data here.
+ * If, however, the accessing the data invovles more work (e.g. parsing
+ * some other existing data, or peforming calculations to derive the data),
+ * then you can limit yourself to setting the indexes and saving any
+ * information you will need later. Then use the saved information in
+ * ipSystemStatsTable_row_prep() for populating data.
+ *
+ * @note
+ * If you need consistency between rows (like you want statistics
+ * for each row to be from the same time frame), you should set all
+ * data here.
+ *
+ */
+int
+ipSystemStatsTable_container_load(netsnmp_container *container)
+{
+ netsnmp_container *stats =
+ netsnmp_access_systemstats_container_load(NULL, 0);
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_cache_load",
+ "called\n"));
+
+ netsnmp_assert(NULL != container);
+
+ if (NULL == stats)
+ return MFD_RESOURCE_UNAVAILABLE; /* msg already logged */
+ /*
+ * TODO:351:M: |-> Load/update data in the ipSystemStatsTable container.
+ * loop over your ipSystemStatsTable data, allocate a rowreq context,
+ * set the index(es) [and data, optionally] and insert into
+ * the container.
+ */
+ /*
+ * we just got a fresh copy of data. compare it to
+ * what we've already got, and make any adjustements...
+ */
+ CONTAINER_FOR_EACH(container, (netsnmp_container_obj_func *)
+ _check_for_updates, stats);
+
+ /*
+ * now add any new entries
+ */
+ CONTAINER_FOR_EACH(stats, (netsnmp_container_obj_func *)
+ _add_new, container);
+
+ /*
+ * free the container. we've either claimed each ifentry, or released it,
+ * so the dal function doesn't need to clear the container.
+ */
+ netsnmp_access_systemstats_container_free(stats,
+ NETSNMP_ACCESS_SYSTEMSTATS_FREE_DONT_CLEAR);
+
+ DEBUGMSGT(("verbose:ipSystemStatsTable:ipSystemStatsTable_cache_load",
+ "%d records\n", CONTAINER_SIZE(container)));
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsTable_container_load */
+
+/**
+ * container clean up
+ *
+ * @param container container with all current items
+ *
+ * This optional callback is called prior to all
+ * item's being removed from the container. If you
+ * need to do any processing before that, do it here.
+ *
+ * @note
+ * The MFD helper will take care of releasing all the row contexts.
+ *
+ */
+void
+ipSystemStatsTable_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_container_free", "called\n"));
+
+ /*
+ * TODO:380:M: Free ipSystemStatsTable container data.
+ */
+} /* ipSystemStatsTable_container_free */
+
+/**
+ * prepare row for processing.
+ *
+ * When the agent has located the row for a request, this function is
+ * called to prepare the row for processing. If you fully populated
+ * the data context during the index setup phase, you may not need to
+ * do anything.
+ *
+ * @param rowreq_ctx pointer to a context.
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ */
+int
+ipSystemStatsTable_row_prep(ipSystemStatsTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_row_prep",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+
+ return MFD_SUCCESS;
+} /* ipSystemStatsTable_row_prep */
+
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_data_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_data_access.h
new file mode 100644
index 0000000000..fadd3bcb96
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_data_access.h
@@ -0,0 +1,105 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: ipSystemStatsTable_data_access.h 13768 2005-12-01 20:12:20Z rstory $
+ */
+#ifndef IPSYSTEMSTATSTABLE_DATA_ACCESS_H
+#define IPSYSTEMSTATSTABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipSystemStatsTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipSystemStatsTable is subid 1 of ipTrafficStats.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.31.1, length: 9
+ */
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsTable_init_data(ipSystemStatsTable_registration *
+ ipSystemStatsTable_reg);
+
+
+ /*
+ * TODO:180:o: Review ipSystemStatsTable cache timeout.
+ * The number of seconds before the cache times out
+ */
+#define IPSYSTEMSTATSTABLE_CACHE_TIMEOUT 60
+
+ void ipSystemStatsTable_container_init(netsnmp_container
+ **container_ptr_ptr,
+ netsnmp_cache *
+ cache);
+ void ipSystemStatsTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int ipSystemStatsTable_container_load(netsnmp_container
+ *container);
+ void ipSystemStatsTable_container_free(netsnmp_container
+ *container);
+
+ int ipSystemStatsTable_cache_load(netsnmp_container
+ *container);
+ void ipSystemStatsTable_cache_free(netsnmp_container
+ *container);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsTable_row_prep(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPSYSTEMSTATSTABLE_DATA_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_interface.c
new file mode 100644
index 0000000000..614afa0a99
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_interface.c
@@ -0,0 +1,1363 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: ipSystemStatsTable_interface.c 15015 2006-08-17 15:06:43Z rstory $
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipSystemStatsTable.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "ipSystemStatsTable_interface.h"
+
+#include <ctype.h>
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipSystemStatsTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipSystemStatsTable is subid 1 of ipTrafficStats.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.31.1, length: 9
+ */
+typedef struct ipSystemStatsTable_interface_ctx_s {
+
+ netsnmp_container *container;
+ netsnmp_cache *cache;
+
+ ipSystemStatsTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+} ipSystemStatsTable_interface_ctx;
+
+static ipSystemStatsTable_interface_ctx ipSystemStatsTable_if_ctx;
+
+static void
+ _ipSystemStatsTable_container_init(ipSystemStatsTable_interface_ctx *
+ if_ctx);
+static void
+ _ipSystemStatsTable_container_shutdown(ipSystemStatsTable_interface_ctx *
+ if_ctx);
+
+
+netsnmp_container *
+ipSystemStatsTable_container_get(void)
+{
+ return ipSystemStatsTable_if_ctx.container;
+}
+
+ipSystemStatsTable_registration *
+ipSystemStatsTable_registration_get(void)
+{
+ return ipSystemStatsTable_if_ctx.user_ctx;
+}
+
+ipSystemStatsTable_registration *
+ipSystemStatsTable_registration_set(ipSystemStatsTable_registration *
+ newreg)
+{
+ ipSystemStatsTable_registration *old =
+ ipSystemStatsTable_if_ctx.user_ctx;
+ ipSystemStatsTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+
+int
+ipSystemStatsTable_container_size(void)
+{
+ return CONTAINER_SIZE(ipSystemStatsTable_if_ctx.container);
+}
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_ipSystemStatsTable_pre_request;
+static Netsnmp_Node_Handler _mfd_ipSystemStatsTable_post_request;
+static Netsnmp_Node_Handler _mfd_ipSystemStatsTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_ipSystemStatsTable_get_values;
+/**
+ * @internal
+ * Initialize the table ipSystemStatsTable
+ * (Define its contents and how it's structured)
+ */
+void
+_ipSystemStatsTable_initialize_interface(ipSystemStatsTable_registration *
+ reg_ptr, u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &ipSystemStatsTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info =
+ &ipSystemStatsTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:ipSystemStatsTable:_ipSystemStatsTable_initialize_interface", "called\n"));
+
+
+ /*************************************************
+ *
+ * save interface context for ipSystemStatsTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
+ /** index: ipSystemStatsIPVersion */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrival.
+ */
+ tbl_info->min_column = IPSYSTEMSTATSTABLE_MIN_COL;
+ tbl_info->max_column = IPSYSTEMSTATSTABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ ipSystemStatsTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ ipSystemStatsTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _ipSystemStatsTable_container_init(&ipSystemStatsTable_if_ctx);
+ if (NULL == ipSystemStatsTable_if_ctx.container) {
+ snmp_log(LOG_ERR,
+ "could not initialize container for ipSystemStatsTable\n");
+ return;
+ }
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup =
+ _mfd_ipSystemStatsTable_object_lookup;
+ access_multiplexer->get_values = _mfd_ipSystemStatsTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request = _mfd_ipSystemStatsTable_pre_request;
+ access_multiplexer->post_request =
+ _mfd_ipSystemStatsTable_post_request;
+
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("ipSystemStatsTable:init_ipSystemStatsTable",
+ "Registering ipSystemStatsTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("ipSystemStatsTable", handler,
+ ipSystemStatsTable_oid,
+ ipSystemStatsTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RONLY);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR, "error registering table ipSystemStatsTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &ipSystemStatsTable_if_ctx;
+
+ /*************************************************
+ *
+ * set up baby steps handler, create it and inject it
+ */
+ if (access_multiplexer->object_lookup)
+ mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
+ if (access_multiplexer->set_values)
+ mfd_modes |= BABY_STEP_SET_VALUES;
+ if (access_multiplexer->irreversible_commit)
+ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
+ if (access_multiplexer->object_syntax_checks)
+ mfd_modes |= BABY_STEP_CHECK_OBJECT;
+
+ if (access_multiplexer->pre_request)
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if (access_multiplexer->post_request)
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+ if (access_multiplexer->undo_setup)
+ mfd_modes |= BABY_STEP_UNDO_SETUP;
+ if (access_multiplexer->undo_cleanup)
+ mfd_modes |= BABY_STEP_UNDO_CLEANUP;
+ if (access_multiplexer->undo_sets)
+ mfd_modes |= BABY_STEP_UNDO_SETS;
+
+ if (access_multiplexer->row_creation)
+ mfd_modes |= BABY_STEP_ROW_CREATE;
+ if (access_multiplexer->consistency_checks)
+ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
+ if (access_multiplexer->commit)
+ mfd_modes |= BABY_STEP_COMMIT;
+ if (access_multiplexer->undo_commit)
+ mfd_modes |= BABY_STEP_UNDO_COMMIT;
+
+ handler = netsnmp_baby_steps_handler_get(mfd_modes);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
+ */
+ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler =
+ netsnmp_container_table_handler_get(tbl_info,
+ ipSystemStatsTable_if_ctx.
+ container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject cache helper
+ */
+ if (NULL != ipSystemStatsTable_if_ctx.cache) {
+ handler =
+ netsnmp_cache_handler_get(ipSystemStatsTable_if_ctx.cache);
+ netsnmp_inject_handler(reginfo, handler);
+ }
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+} /* _ipSystemStatsTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table ipSystemStatsTable
+ */
+void
+_ipSystemStatsTable_shutdown_interface(ipSystemStatsTable_registration *
+ reg_ptr)
+{
+ /*
+ * shutdown the container
+ */
+ _ipSystemStatsTable_container_shutdown(&ipSystemStatsTable_if_ctx);
+}
+
+void
+ipSystemStatsTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ ipSystemStatsTable_if_ctx.tbl_info.valid_columns = vc;
+} /* ipSystemStatsTable_valid_columns_set */
+
+/**
+ * @internal
+ * convert the index component stored in the context to an oid
+ */
+int
+ipSystemStatsTable_index_to_oid(netsnmp_index * oid_idx,
+ ipSystemStatsTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * ipSystemStatsIPVersion(1)/InetVersion/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_ipSystemStatsIPVersion;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_ipSystemStatsIPVersion, 0x00,
+ sizeof(var_ipSystemStatsIPVersion));
+ var_ipSystemStatsIPVersion.type = ASN_INTEGER;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_ipSystemStatsIPVersion.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_index_to_oid", "called\n"));
+
+ /*
+ * ipSystemStatsIPVersion(1)/InetVersion/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ snmp_set_var_value(&var_ipSystemStatsIPVersion,
+ (u_char *) & mib_idx->ipSystemStatsIPVersion,
+ sizeof(mib_idx->ipSystemStatsIPVersion));
+
+
+ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
+ NULL, 0, &var_ipSystemStatsIPVersion);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_ipSystemStatsIPVersion);
+
+ return err;
+} /* ipSystemStatsTable_index_to_oid */
+
+/**
+ * extract ipSystemStatsTable indexes from a netsnmp_index
+ *
+ * @retval SNMP_ERR_NOERROR : no error
+ * @retval SNMP_ERR_GENERR : error
+ */
+int
+ipSystemStatsTable_index_from_oid(netsnmp_index * oid_idx,
+ ipSystemStatsTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * ipSystemStatsIPVersion(1)/InetVersion/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_ipSystemStatsIPVersion;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_ipSystemStatsIPVersion, 0x00,
+ sizeof(var_ipSystemStatsIPVersion));
+ var_ipSystemStatsIPVersion.type = ASN_INTEGER;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_ipSystemStatsIPVersion.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:ipSystemStatsTable:ipSystemStatsTable_index_from_oid", "called\n"));
+
+ /*
+ * parse the oid into the individual index components
+ */
+ err = parse_oid_indexes(oid_idx->oids, oid_idx->len,
+ &var_ipSystemStatsIPVersion);
+ if (err == SNMP_ERR_NOERROR) {
+ /*
+ * copy out values
+ */
+ mib_idx->ipSystemStatsIPVersion =
+ *((u_long *) var_ipSystemStatsIPVersion.val.string);
+
+
+ }
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_ipSystemStatsIPVersion);
+
+ return err;
+} /* ipSystemStatsTable_index_from_oid */
+
+
+/*
+ *********************************************************************
+ * @internal
+ * allocate resources for a ipSystemStatsTable_rowreq_ctx
+ */
+ipSystemStatsTable_rowreq_ctx *
+ipSystemStatsTable_allocate_rowreq_ctx(ipSystemStatsTable_data * data,
+ void *user_init_ctx)
+{
+ ipSystemStatsTable_rowreq_ctx *rowreq_ctx =
+ SNMP_MALLOC_TYPEDEF(ipSystemStatsTable_rowreq_ctx);
+
+ DEBUGMSGTL(("internal:ipSystemStatsTable:ipSystemStatsTable_allocate_rowreq_ctx", "called\n"));
+
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "Couldn't allocate memory for a "
+ "ipSystemStatsTable_rowreq_ctx.\n");
+ return NULL;
+ } else {
+ if (NULL != data) {
+ /*
+ * track if we got data from user
+ */
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DATA_FROM_USER;
+ rowreq_ctx->data = data;
+ } else if (NULL ==
+ (rowreq_ctx->data =
+ ipSystemStatsTable_allocate_data())) {
+ SNMP_FREE(rowreq_ctx);
+ return NULL;
+ }
+ }
+
+ /*
+ * undo context will be allocated when needed (in *_undo_setup)
+ */
+
+ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
+
+ rowreq_ctx->ipSystemStatsTable_data_list = NULL;
+
+ /*
+ * if we allocated data, call init routine
+ */
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) {
+ if (SNMPERR_SUCCESS !=
+ ipSystemStatsTable_rowreq_ctx_init(rowreq_ctx,
+ user_init_ctx)) {
+ ipSystemStatsTable_release_rowreq_ctx(rowreq_ctx);
+ rowreq_ctx = NULL;
+ }
+ }
+
+ return rowreq_ctx;
+} /* ipSystemStatsTable_allocate_rowreq_ctx */
+
+/*
+ * @internal
+ * release resources for a ipSystemStatsTable_rowreq_ctx
+ */
+void
+ipSystemStatsTable_release_rowreq_ctx(ipSystemStatsTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("internal:ipSystemStatsTable:ipSystemStatsTable_release_rowreq_ctx", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ ipSystemStatsTable_rowreq_ctx_cleanup(rowreq_ctx);
+
+ /*
+ * for non-transient data, don't free data we got from the user
+ */
+ if ((rowreq_ctx->data) &&
+ !(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER))
+ ipSystemStatsTable_release_data(rowreq_ctx->data);
+
+ /*
+ * free index oid pointer
+ */
+ if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp)
+ free(rowreq_ctx->oid_idx.oids);
+
+ SNMP_FREE(rowreq_ctx);
+} /* ipSystemStatsTable_release_rowreq_ctx */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipSystemStatsTable_pre_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:ipSystemStatsTable:_mfd_ipSystemStatsTable_pre_request", "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ipSystemStatsTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = ipSystemStatsTable_pre_request(ipSystemStatsTable_if_ctx.
+ user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipSystemStatsTable", "error %d from "
+ "ipSystemStatsTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipSystemStatsTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipSystemStatsTable_post_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipSystemStatsTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:ipSystemStatsTable:_mfd_ipSystemStatsTable_post_request", "called\n"));
+
+ /*
+ * release row context, if deleted
+ */
+ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
+ ipSystemStatsTable_release_rowreq_ctx(rowreq_ctx);
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ipSystemStatsTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ rc = ipSystemStatsTable_post_request(ipSystemStatsTable_if_ctx.
+ user_ctx, packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipSystemStatsTable", "error %d from "
+ "ipSystemStatsTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipSystemStatsTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipSystemStatsTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = SNMP_ERR_NOERROR;
+ ipSystemStatsTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipSystemStatsTable:_mfd_ipSystemStatsTable_object_lookup", "called\n"));
+
+ /*
+ * get our context from mfd
+ * ipSystemStatsTable_interface_ctx *if_ctx =
+ * (ipSystemStatsTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if (NULL == rowreq_ctx) {
+ rc = SNMP_ERR_NOCREATION;
+ }
+
+ if (MFD_SUCCESS != rc)
+ netsnmp_request_set_error_all(requests, rc);
+ else
+ ipSystemStatsTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_ipSystemStatsTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipSystemStatsTable_get_column(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipSystemStatsTable:_mfd_ipSystemStatsTable_get_column", "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipSystemStatsInReceives(3)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSINRECEIVES:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsInReceives_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsHCInReceives(4)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCINRECEIVES:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCInReceives_get(rowreq_ctx,
+ (U64 *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsInOctets(5)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSINOCTETS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsInOctets_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsHCInOctets(6)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCINOCTETS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCInOctets_get(rowreq_ctx,
+ (U64 *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsInHdrErrors(7)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSINHDRERRORS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsInHdrErrors_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsInNoRoutes(8)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSINNOROUTES:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsInNoRoutes_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsInAddrErrors(9)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSINADDRERRORS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsInAddrErrors_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsInUnknownProtos(10)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSINUNKNOWNPROTOS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsInUnknownProtos_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsInTruncatedPkts(11)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSINTRUNCATEDPKTS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsInTruncatedPkts_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsInForwDatagrams(12)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSINFORWDATAGRAMS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsInForwDatagrams_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsHCInForwDatagrams(13)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCINFORWDATAGRAMS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCInForwDatagrams_get(rowreq_ctx,
+ (U64 *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsReasmReqds(14)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSREASMREQDS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsReasmReqds_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsReasmOKs(15)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSREASMOKS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsReasmOKs_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsReasmFails(16)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSREASMFAILS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsReasmFails_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsInDiscards(17)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSINDISCARDS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsInDiscards_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsInDelivers(18)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSINDELIVERS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsInDelivers_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsHCInDelivers(19)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCINDELIVERS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCInDelivers_get(rowreq_ctx,
+ (U64 *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsOutRequests(20)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSOUTREQUESTS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsOutRequests_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsHCOutRequests(21)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCOUTREQUESTS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCOutRequests_get(rowreq_ctx,
+ (U64 *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsOutNoRoutes(22)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSOUTNOROUTES:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsOutNoRoutes_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsOutForwDatagrams(23)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSOUTFORWDATAGRAMS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsOutForwDatagrams_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsHCOutForwDatagrams(24)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCOUTFORWDATAGRAMS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCOutForwDatagrams_get(rowreq_ctx,
+ (U64 *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsOutDiscards(25)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSOUTDISCARDS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsOutDiscards_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsOutFragReqds(26)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSOUTFRAGREQDS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsOutFragReqds_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsOutFragOKs(27)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSOUTFRAGOKS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsOutFragOKs_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsOutFragFails(28)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSOUTFRAGFAILS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsOutFragFails_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsOutFragCreates(29)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSOUTFRAGCREATES:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsOutFragCreates_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsOutTransmits(30)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSOUTTRANSMITS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsOutTransmits_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsHCOutTransmits(31)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCOUTTRANSMITS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCOutTransmits_get(rowreq_ctx,
+ (U64 *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsOutOctets(32)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSOUTOCTETS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsOutOctets_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsHCOutOctets(33)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCOUTOCTETS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCOutOctets_get(rowreq_ctx,
+ (U64 *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsInMcastPkts(34)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSINMCASTPKTS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsInMcastPkts_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsHCInMcastPkts(35)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCINMCASTPKTS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCInMcastPkts_get(rowreq_ctx,
+ (U64 *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsInMcastOctets(36)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSINMCASTOCTETS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsInMcastOctets_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsHCInMcastOctets(37)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCINMCASTOCTETS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCInMcastOctets_get(rowreq_ctx,
+ (U64 *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsOutMcastPkts(38)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSOUTMCASTPKTS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsOutMcastPkts_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsHCOutMcastPkts(39)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCOUTMCASTPKTS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCOutMcastPkts_get(rowreq_ctx,
+ (U64 *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsOutMcastOctets(40)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSOUTMCASTOCTETS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsOutMcastOctets_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsHCOutMcastOctets(41)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCOUTMCASTOCTETS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCOutMcastOctets_get(rowreq_ctx,
+ (U64 *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsInBcastPkts(42)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSINBCASTPKTS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsInBcastPkts_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsHCInBcastPkts(43)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCINBCASTPKTS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCInBcastPkts_get(rowreq_ctx,
+ (U64 *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsOutBcastPkts(44)/COUNTER/ASN_COUNTER/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSOUTBCASTPKTS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_COUNTER;
+ rc = ipSystemStatsOutBcastPkts_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsHCOutBcastPkts(45)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSHCOUTBCASTPKTS:
+ var->val_len = sizeof(U64);
+ var->type = ASN_COUNTER64;
+ rc = ipSystemStatsHCOutBcastPkts_get(rowreq_ctx,
+ (U64 *) var->val.string);
+ break;
+
+ /*
+ * ipSystemStatsDiscontinuityTime(46)/TimeStamp/ASN_TIMETICKS/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSDISCONTINUITYTIME:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_TIMETICKS;
+ rc = ipSystemStatsDiscontinuityTime_get(rowreq_ctx,
+ (u_long *) var->val.
+ string);
+ break;
+
+ /*
+ * ipSystemStatsRefreshRate(47)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPSYSTEMSTATSREFRESHRATE:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_UNSIGNED;
+ rc = ipSystemStatsRefreshRate_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipSystemStatsTable_get_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ipSystemStatsTable_get_column */
+
+int
+_mfd_ipSystemStatsTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipSystemStatsTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ u_char *old_string;
+ void (*dataFreeHook) (void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:ipSystemStatsTable:_mfd_ipSystemStatsTable_get_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+ /*
+ * save old pointer, so we can free it if replaced
+ */
+ old_string = requests->requestvb->val.string;
+ dataFreeHook = requests->requestvb->dataFreeHook;
+ if (NULL == requests->requestvb->val.string) {
+ requests->requestvb->val.string = requests->requestvb->buf;
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ } else if (requests->requestvb->buf ==
+ requests->requestvb->val.string) {
+ if (requests->requestvb->val_len !=
+ sizeof(requests->requestvb->buf))
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ }
+
+ /*
+ * get column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipSystemStatsTable_get_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ if (MFD_SKIP == rc) {
+ requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+ rc = SNMP_ERR_NOERROR;
+ }
+ } else if (NULL == requests->requestvb->val.string) {
+ snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
+ rc = SNMP_ERR_GENERR;
+ }
+ if (rc)
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+
+ /*
+ * if the buffer wasn't used previously for the old data (i.e. it
+ * was allcoated memory) and the get routine replaced the pointer,
+ * we need to free the previous pointer.
+ */
+ if (old_string && (old_string != requests->requestvb->buf) &&
+ (requests->requestvb->val.string != old_string)) {
+ if (dataFreeHook)
+ (*dataFreeHook) (old_string);
+ else
+ free(old_string);
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipSystemStatsTable_get_values */
+
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*
+ * SET PROCESSING NOT APPLICABLE (per MIB or user setting)
+ */
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+static void _container_free(netsnmp_container *container);
+
+/**
+ * @internal
+ */
+static int
+_cache_load(netsnmp_cache * cache, void *vmagic)
+{
+ DEBUGMSGTL(("internal:ipSystemStatsTable:_cache_load", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache for ipSystemStatsTable_cache_load\n");
+ return -1;
+ }
+
+ /** should only be called for an invalid or expired cache */
+ netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
+
+ /*
+ * call user code
+ */
+ return ipSystemStatsTable_container_load((netsnmp_container *) cache->
+ magic);
+} /* _cache_load */
+
+/**
+ * @internal
+ */
+static void
+_cache_free(netsnmp_cache * cache, void *magic)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("internal:ipSystemStatsTable:_cache_free", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache in ipSystemStatsTable_cache_free\n");
+ return;
+ }
+
+ container = (netsnmp_container *) cache->magic;
+
+ _container_free(container);
+} /* _cache_free */
+
+/**
+ * @internal
+ */
+static void
+_container_item_free(ipSystemStatsTable_rowreq_ctx * rowreq_ctx,
+ void *context)
+{
+ DEBUGMSGTL(("internal:ipSystemStatsTable:_container_item_free",
+ "called\n"));
+
+ if (NULL == rowreq_ctx)
+ return;
+
+ ipSystemStatsTable_release_rowreq_ctx(rowreq_ctx);
+} /* _container_item_free */
+
+/**
+ * @internal
+ */
+static void
+_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("internal:ipSystemStatsTable:_container_free",
+ "called\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container in ipSystemStatsTable_container_free\n");
+ return;
+ }
+
+ /*
+ * call user code
+ */
+ ipSystemStatsTable_container_free(container);
+
+ /*
+ * free all items. inefficient, but easy.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func *) _container_item_free,
+ NULL);
+} /* _container_free */
+
+/**
+ * @internal
+ * initialize the container with functions or wrappers
+ */
+void
+_ipSystemStatsTable_container_init(ipSystemStatsTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:ipSystemStatsTable:_ipSystemStatsTable_container_init", "called\n"));
+
+ /*
+ * cache init
+ */
+ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */
+ _cache_load, _cache_free,
+ ipSystemStatsTable_oid,
+ ipSystemStatsTable_oid_size);
+
+ if (NULL == if_ctx->cache) {
+ snmp_log(LOG_ERR, "error creating cache for ipSystemStatsTable\n");
+ return;
+ }
+
+ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
+
+ ipSystemStatsTable_container_init(&if_ctx->container, if_ctx->cache);
+ if (NULL == if_ctx->container)
+ if_ctx->container =
+ netsnmp_container_find("ipSystemStatsTable:table_container");
+ if (NULL == if_ctx->container) {
+ snmp_log(LOG_ERR, "error creating container in "
+ "ipSystemStatsTable_container_init\n");
+ return;
+ }
+
+ if (NULL != if_ctx->cache)
+ if_ctx->cache->magic = (void *) if_ctx->container;
+} /* _ipSystemStatsTable_container_init */
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+_ipSystemStatsTable_container_shutdown(ipSystemStatsTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:ipSystemStatsTable:_ipSystemStatsTable_container_shutdown", "called\n"));
+
+ ipSystemStatsTable_container_shutdown(if_ctx->container);
+
+ _container_free(if_ctx->container);
+
+} /* _ipSystemStatsTable_container_shutdown */
+
+
+ipSystemStatsTable_rowreq_ctx *
+ipSystemStatsTable_row_find_by_mib_index(ipSystemStatsTable_mib_index *
+ mib_idx)
+{
+ ipSystemStatsTable_rowreq_ctx *rowreq_ctx;
+ oid oid_tmp[MAX_OID_LEN];
+ netsnmp_index oid_idx;
+ int rc;
+
+ /*
+ * set up storage for OID
+ */
+ oid_idx.oids = oid_tmp;
+ oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
+
+ /*
+ * convert
+ */
+ rc = ipSystemStatsTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx =
+ CONTAINER_FIND(ipSystemStatsTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_interface.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_interface.h
new file mode 100644
index 0000000000..37cf765c35
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipSystemStatsTable/ipSystemStatsTable_interface.h
@@ -0,0 +1,173 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: ipSystemStatsTable_interface.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** @ingroup interface Routines to interface to Net-SNMP
+ *
+ * \warning This code should not be modified, called directly,
+ * or used to interpret functionality. It is subject to
+ * change at any time.
+ *
+ * @{
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+#ifndef IPSYSTEMSTATSTABLE_INTERFACE_H
+#define IPSYSTEMSTATSTABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "ipSystemStatsTable.h"
+
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _ipSystemStatsTable_initialize_interface
+ (ipSystemStatsTable_registration * user_ctx, u_long flags);
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _ipSystemStatsTable_shutdown_interface
+ (ipSystemStatsTable_registration * user_ctx);
+
+
+
+
+
+
+
+ ipSystemStatsTable_registration
+ * ipSystemStatsTable_registration_get(void);
+
+
+
+
+
+
+
+ ipSystemStatsTable_registration
+ * ipSystemStatsTable_registration_set
+ (ipSystemStatsTable_registration * newreg);
+
+ netsnmp_container *ipSystemStatsTable_container_get(void);
+ int ipSystemStatsTable_container_size(void);
+
+
+
+
+
+
+
+ ipSystemStatsTable_rowreq_ctx
+ * ipSystemStatsTable_allocate_rowreq_ctx(ipSystemStatsTable_data *,
+ void *);
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsTable_release_rowreq_ctx(ipSystemStatsTable_rowreq_ctx
+ * rowreq_ctx);
+
+ int ipSystemStatsTable_index_to_oid(netsnmp_index *
+ oid_idx,
+ ipSystemStatsTable_mib_index
+ * mib_idx);
+ int ipSystemStatsTable_index_from_oid(netsnmp_index *
+ oid_idx,
+ ipSystemStatsTable_mib_index
+ * mib_idx);
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void
+
+
+
+
+
+
+
+
+
+
+ ipSystemStatsTable_valid_columns_set(netsnmp_column_info *vc);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPSYSTEMSTATSTABLE_INTERFACE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ip_scalars.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ip_scalars.c
new file mode 100644
index 0000000000..2543491afd
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ip_scalars.c
@@ -0,0 +1,153 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.8 2004/10/14 12:57:34 dts12 Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/data_access/ip_scalars.h>
+
+#include "ip_scalars.h"
+
+int
+handle_ipv6IpForwarding(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests);
+
+/** Initializes the ip module */
+void
+init_ip_scalars(void)
+{
+ static oid ipReasmTimeout_oid[] = { 1, 3, 6, 1, 2, 1, 4, 13, 0 };
+ static oid ipv6IpForwarding_oid[] = { 1, 3, 6, 1, 2, 1, 4, 25 };
+ static oid ipv6IpDefaultHopLimit_oid[] =
+ { 1, 3, 6, 1, 2, 1, 4, 26, 0 };
+
+ DEBUGMSGTL(("ip_scalar", "Initializing\n"));
+
+ netsnmp_register_num_file_instance
+ ("ipReasmTimeout",
+ ipReasmTimeout_oid, OID_LENGTH(ipReasmTimeout_oid),
+ "/proc/sys/net/ipv4/ipfrag_time", ASN_INTEGER,
+ HANDLER_CAN_RONLY, NULL, NULL);
+
+ netsnmp_register_scalar(netsnmp_create_handler_registration
+ ("ipv6IpForwarding", handle_ipv6IpForwarding,
+ ipv6IpForwarding_oid,
+ OID_LENGTH(ipv6IpForwarding_oid),
+ HANDLER_CAN_RWRITE));
+
+ netsnmp_register_num_file_instance
+ ("ipv6IpDefaultHopLimit",
+ ipv6IpDefaultHopLimit_oid, OID_LENGTH(ipv6IpDefaultHopLimit_oid),
+ "/proc/sys/net/ipv6/conf/default/hop_limit", ASN_INTEGER,
+ HANDLER_CAN_RWRITE, NULL, NULL);
+
+}
+
+int
+handle_ipv6IpForwarding(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ u_long value;
+
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ rc = netsnmp_arch_ip_scalars_ipv6IpForwarding_get(&value);
+ if (rc != 0) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_NOSUCHINSTANCE);
+ }
+ else {
+ value = value ? 1 : 2;
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
+ (u_char *)&value, sizeof(value));
+ }
+ break;
+
+ /*
+ * SET REQUEST
+ *
+ * multiple states in the transaction. See:
+ * http://www.net-snmp.org/tutorial-5/toolkit/mib_module/set-actions.jpg
+ */
+ case MODE_SET_RESERVE1:
+ break;
+
+ case MODE_SET_RESERVE2:
+ /*
+ * store old info for undo later
+ */
+ rc = netsnmp_arch_ip_scalars_ipv6IpForwarding_get(&value);
+ if (rc < 0) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_NOCREATION);
+ }
+ else {
+ u_long *value_save;
+ memdup((u_char **) & value_save, (u_char *) &value,
+ sizeof(value));
+ if ( NULL == value_save ) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ }
+ else {
+ netsnmp_request_add_list_data(requests,
+ netsnmp_create_data_list
+ ("ipfw", value_save,
+ free));
+ }
+ }
+ break;
+
+ case MODE_SET_FREE:
+ break;
+
+ case MODE_SET_ACTION:
+ value = *(requests->requestvb->val.integer);
+ rc = netsnmp_arch_ip_scalars_ipv6IpForwarding_set(value);
+ if ( 0 != rc ) {
+ netsnmp_set_request_error(reqinfo, requests, rc );
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ break;
+
+ case MODE_SET_UNDO:
+ value =
+ *((u_long *) netsnmp_request_get_list_data(requests,
+ "ipfw"));
+ rc = netsnmp_arch_ip_scalars_ipv6IpForwarding_set(value);
+ if ( 0 != rc ) {
+ netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_UNDOFAILED);
+ }
+ break;
+
+ default:
+ /*
+ * we should never get here, so this is a really bad error
+ */
+ snmp_log(LOG_ERR, "unknown mode (%d) in handle_ipv6IpForwarding\n",
+ reqinfo->mode);
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ip_scalars.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ip_scalars.h
new file mode 100644
index 0000000000..7670a49803
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ip_scalars.h
@@ -0,0 +1,7 @@
+/*
+ * module to include the modules
+ */
+
+void init_ip_scalars(void);
+
+config_require(ip-mib/data_access/scalars_common)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable.h
new file mode 100644
index 0000000000..2ebd7680f0
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable.h
@@ -0,0 +1,5 @@
+/*
+ * module to include the modules
+ */
+
+config_require(ip-mib/ipv4InterfaceTable/ipv4InterfaceTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable.c
new file mode 100644
index 0000000000..b79811c88c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable.c
@@ -0,0 +1,956 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: ipv4InterfaceTable.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** \page MFD helper for ipv4InterfaceTable
+ *
+ * \section intro Introduction
+ * Introductory text.
+ *
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipv4InterfaceTable.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "ipv4InterfaceTable_interface.h"
+
+oid ipv4InterfaceTable_oid[] = { IPV4INTERFACETABLE_OID };
+int ipv4InterfaceTable_oid_size =
+OID_LENGTH(ipv4InterfaceTable_oid);
+
+ipv4InterfaceTable_registration ipv4InterfaceTable_user_context;
+
+void initialize_table_ipv4InterfaceTable(void);
+void shutdown_table_ipv4InterfaceTable(void);
+
+
+/**
+ * Initializes the ipv4InterfaceTable module
+ */
+void
+init_ipv4InterfaceTable(void)
+{
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:init_ipv4InterfaceTable",
+ "called\n"));
+
+ /*
+ * TODO:300:o: Perform ipv4InterfaceTable one-time module initialization.
+ */
+
+ /*
+ * we depend on the ifTable, so we put our init in with it
+ * to guarantee order of execution.
+ */
+ init_ifTable();
+
+ /*
+ * last changed should be 0 at startup
+ */
+ ipv4InterfaceTable_lastChange_set(0);
+
+} /* init_ipv4InterfaceTable */
+
+/**
+ * Shut-down the ipv4InterfaceTable module (agent is exiting)
+ */
+void
+shutdown_ipv4InterfaceTable(void)
+{
+ if (should_init("ipv4InterfaceTable"))
+ shutdown_table_ipv4InterfaceTable();
+
+}
+
+/**
+ * Initialize the table ipv4InterfaceTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_ipv4InterfaceTable(void)
+{
+ ipv4InterfaceTable_registration *user_context;
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:initialize_table_ipv4InterfaceTable", "called\n"));
+
+ /*
+ * TODO:301:o: Perform ipv4InterfaceTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize ipv4InterfaceTable user context
+ * if you'd like to pass in a pointer to some data for this
+ * table, allocate or set it up here.
+ */
+ /*
+ * a netsnmp_data_list is a simple way to store void pointers. A simple
+ * string token is used to add, find or remove pointers.
+ */
+ user_context =
+ netsnmp_create_data_list("ipv4InterfaceTable", NULL, NULL);
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _ipv4InterfaceTable_initialize_interface(user_context, flags);
+} /* initialize_table_ipv4InterfaceTable */
+
+/**
+ * Shutdown the table ipv4InterfaceTable
+ */
+void
+shutdown_table_ipv4InterfaceTable(void)
+{
+ /*
+ * call interface shutdown code
+ */
+ _ipv4InterfaceTable_shutdown_interface
+ (&ipv4InterfaceTable_user_context);
+}
+
+/**
+ * extra context initialization (eg default values)
+ *
+ * @param rowreq_ctx : row request context
+ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
+ *
+ * @retval MFD_SUCCESS : no errors
+ * @retval MFD_ERROR : error (context allocate will fail)
+ */
+int
+ipv4InterfaceTable_rowreq_ctx_init(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx, void *user_init_ctx)
+{
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_rowreq_ctx_init", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:210:o: |-> Perform extra ipv4InterfaceTable rowreq initialization. (eg DEFVALS)
+ */
+ rowreq_ctx->data.ipv4InterfaceRetransmitTime = 1000;
+
+
+ return MFD_SUCCESS;
+} /* ipv4InterfaceTable_rowreq_ctx_init */
+
+/**
+ * extra context cleanup
+ * @param rowreq_ctx
+ *
+ */
+void
+ipv4InterfaceTable_rowreq_ctx_cleanup(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_rowreq_ctx_cleanup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:211:o: |-> Perform extra ipv4InterfaceTable rowreq cleanup.
+ */
+} /* ipv4InterfaceTable_rowreq_ctx_cleanup */
+
+/**
+ * pre-request callback
+ *
+ * @param user_context
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+ipv4InterfaceTable_pre_request(ipv4InterfaceTable_registration *
+ user_context)
+{
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_pre_request", "called\n"));
+
+ /*
+ * TODO:510:o: Perform ipv4InterfaceTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* ipv4InterfaceTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ * Note:
+ * New rows have been inserted into the container, and
+ * deleted rows have been removed from the container and
+ * released.
+ *
+ * @param user_context
+ * @param rc : MFD_SUCCESS if all requests succeeded
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+ipv4InterfaceTable_post_request(ipv4InterfaceTable_registration *
+ user_context, int rc)
+{
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_post_request", "called\n"));
+
+ /*
+ * TODO:511:o: Perform ipv4InterfaceTable post-request actions.
+ */
+
+ /*
+ * check to set if any rows were changed.
+ */
+ if (ipv4InterfaceTable_dirty_get()) {
+ /*
+ * check if request was successful. If so, this would be
+ * a good place to save data to its persistent store.
+ */
+ if (MFD_SUCCESS == rc) {
+ /*
+ * save changed rows, if you haven't already
+ */
+ }
+
+ ipv4InterfaceTable_dirty_set(0); /* clear table dirty flag */
+ }
+
+ return MFD_SUCCESS;
+} /* ipv4InterfaceTable_post_request */
+
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipv4InterfaceTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipv4InterfaceTable is subid 28 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.28, length: 8
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement ipv4InterfaceTable data context functions.
+ */
+
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipv4InterfaceEntry.ipv4InterfaceReasmMaxSize
+ * ipv4InterfaceReasmMaxSize is subid 2 of ipv4InterfaceEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.28.1.2
+ * Description:
+The size of the largest IPv4 datagram which this entity can
+ re-assemble from incoming IPv4 fragmented datagrams received
+ on this interface.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 0
+ * settable 0
+ *
+ * Ranges: 0 - 65535;
+ *
+ * Its syntax is INTEGER32 (based on perltype INTEGER32)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (long)
+ */
+/**
+ * Extract the current value of the ipv4InterfaceReasmMaxSize data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipv4InterfaceReasmMaxSize_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipv4InterfaceReasmMaxSize_get(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
+ long *ipv4InterfaceReasmMaxSize_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipv4InterfaceReasmMaxSize_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceReasmMaxSize_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (!
+ (rowreq_ctx->data.ifentry->
+ ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V4_REASMMAX))
+ return MFD_SKIP;
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipv4InterfaceReasmMaxSize data.
+ * copy (* ipv4InterfaceReasmMaxSize_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipv4InterfaceReasmMaxSize_val_ptr) =
+ rowreq_ctx->data.ipv4InterfaceReasmMaxSize;
+
+ return MFD_SUCCESS;
+} /* ipv4InterfaceReasmMaxSize_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipv4InterfaceEntry.ipv4InterfaceEnableStatus
+ * ipv4InterfaceEnableStatus is subid 3 of ipv4InterfaceEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.4.28.1.3
+ * Description:
+The indication of whether IPv4 is enabled (up) or disabled
+ (down) on this interface. This object does not affect the
+ state of the interface itself, only its connection to an
+ IPv4 stack. The IF-MIB should be used to control the state
+ of the interface.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 1/8. Values: up(1), down(2)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ipv4InterfaceEnableStatus data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipv4InterfaceEnableStatus_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipv4InterfaceEnableStatus_get(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipv4InterfaceEnableStatus_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipv4InterfaceEnableStatus_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceEnableStatus_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipv4InterfaceEnableStatus data.
+ * copy (* ipv4InterfaceEnableStatus_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipv4InterfaceEnableStatus_val_ptr) =
+ rowreq_ctx->data.ipv4InterfaceEnableStatus;
+
+ return MFD_SUCCESS;
+} /* ipv4InterfaceEnableStatus_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipv4InterfaceEntry.ipv4InterfaceRetransmitTime
+ * ipv4InterfaceRetransmitTime is subid 4 of ipv4InterfaceEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.28.1.4
+ * Description:
+The time between retransmissions of ARP requests to a
+ neighbor when resolving the address or when probing the
+ reachability of a neighbor.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ * defval: 1000
+ *
+ *
+ * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32)
+ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipv4InterfaceRetransmitTime data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipv4InterfaceRetransmitTime_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipv4InterfaceRetransmitTime_get(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
+ u_long *
+ ipv4InterfaceRetransmitTime_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipv4InterfaceRetransmitTime_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceRetransmitTime_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (!
+ (rowreq_ctx->data.ifentry->
+ ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V4_RETRANSMIT))
+ return MFD_SKIP;
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipv4InterfaceRetransmitTime data.
+ * copy (* ipv4InterfaceRetransmitTime_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipv4InterfaceRetransmitTime_val_ptr) =
+ rowreq_ctx->data.ipv4InterfaceRetransmitTime;
+
+ return MFD_SUCCESS;
+} /* ipv4InterfaceRetransmitTime_get */
+
+
+
+/** @} */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipv4InterfaceTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipv4InterfaceTable is subid 28 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.28, length: 8
+ */
+ /*
+ * NOTE: if you update this chart, please update the versions in
+ * local/mib2c-conf.d/parent-set.m2i
+ * agent/mibgroup/helpers/baby_steps.c
+ * while you're at it.
+ */
+ /*
+ ***********************************************************************
+ * Baby Steps Flow Chart (2004.06.05) *
+ * *
+ * +--------------+ +================+ U = unconditional path *
+ * |optional state| ||required state|| S = path for success *
+ * +--------------+ +================+ E = path for error *
+ ***********************************************************************
+ *
+ * +--------------+
+ * | pre |
+ * | request |
+ * +--------------+
+ * | U
+ * +==============+
+ * +----------------|| object ||
+ * | E || lookup ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | E || check ||
+ * |<---------------|| values ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | +<-------|| undo ||
+ * | | E || setup ||
+ * | | +==============+
+ * | | | S
+ * | | +==============+
+ * | | || set ||-------------------------->+
+ * | | || value || E |
+ * | | +==============+ |
+ * | | | S |
+ * | | +--------------+ |
+ * | | | check |-------------------------->|
+ * | | | consistency | E |
+ * | | +--------------+ |
+ * | | | S |
+ * | | +==============+ +==============+ |
+ * | | || commit ||-------->|| undo || |
+ * | | || || E || commit || |
+ * | | +==============+ +==============+ |
+ * | | | S U |<--------+
+ * | | +--------------+ +==============+
+ * | | | irreversible | || undo ||
+ * | | | commit | || set ||
+ * | | +--------------+ +==============+
+ * | | | U U |
+ * | +-------------->|<------------------------+
+ * | +==============+
+ * | || undo ||
+ * | || cleanup ||
+ * | +==============+
+ * +---------------------->| U
+ * +--------------+
+ * | post |
+ * | request |
+ * +--------------+
+ *
+ */
+
+/**
+ * Setup up context with information needed to undo a set request.
+ *
+ * This function will be called before the individual node undo setup
+ * functions are called. If you need to do any undo setup that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that the undo context has been allocated with
+ * ipv4InterfaceTable_allocate_data(), but may need extra
+ * initialization similar to what you may have done in
+ * ipv4InterfaceTable_rowreq_ctx_init().
+ * Note that an individual node's undo_setup function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in the node's undo_setup
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipv4InterfaceTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+ipv4InterfaceTable_undo_setup(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_undo_setup",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> Setup ipv4InterfaceTable undo.
+ * set up ipv4InterfaceTable undo information, in preparation for a set.
+ * Undo storage is in (* ipv4InterfaceRetransmitTime_val_ptr )*
+ */
+
+ return rc;
+} /* ipv4InterfaceTable_undo_setup */
+
+/**
+ * Undo a set request.
+ *
+ * This function will be called before the individual node undo
+ * functions are called. If you need to do any undo that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that an individual node's undo function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is anything specific to a particular column (e.g. releasing
+ * memory for a string), you should do that setup in the node's undo
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipv4InterfaceTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+ipv4InterfaceTable_undo(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_undo",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> ipv4InterfaceTable undo.
+ * ipv4InterfaceTable undo information, in response to a failed set.
+ * Undo storage is in (* ipv4InterfaceRetransmitTime_val_ptr )*
+ */
+
+ return rc;
+} /* ipv4InterfaceTable_undo_setup */
+
+/**
+ * Cleanup up context undo information.
+ *
+ * This function will be called after set/commit processing. If you
+ * allocated any resources in undo_setup, this is the place to release
+ * those resources.
+ *
+ * This function is called regardless of the success or failure of the set
+ * request. If you need to perform different steps for cleanup depending
+ * on success or failure, you can add a flag to the rowreq_ctx.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipv4InterfaceTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ipv4InterfaceTable_undo_cleanup(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_undo_cleanup", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:452:M: |-> Cleanup ipv4InterfaceTable undo.
+ * Undo storage is in (* ipv4InterfaceRetransmitTime_val_ptr )*
+ */
+
+ return rc;
+} /* ipv4InterfaceTable_undo_cleanup */
+
+/**
+ * commit new values.
+ *
+ * At this point, you should have done everything you can to ensure that
+ * this commit will not fail.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * ipv4InterfaceTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ipv4InterfaceTable_commit(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+ int save_flags;
+
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_commit",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * save flags, then clear until we actually do something
+ */
+ save_flags = rowreq_ctx->column_set_flags;
+ rowreq_ctx->column_set_flags = 0;
+
+ /*
+ * commit ipv4InterfaceTable data
+ * 1) check the column's flag in save_flags to see if it was set.
+ * 2) clear the flag when you handle that column
+ * 3) set the column's flag in column_set_flags if it needs undo
+ * processing in case of a failure.
+ */
+ if (save_flags & COLUMN_IPV4INTERFACEENABLESTATUS_FLAG) {
+ save_flags &= ~COLUMN_IPV4INTERFACEENABLESTATUS_FLAG; /* clear ipv4InterfaceEnableStatus */
+ /*
+ * TODO:482:o: |-> commit column ipv4InterfaceEnableStatus.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "ipv4InterfaceTable column ipv4InterfaceEnableStatus commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo ipv4InterfaceEnableStatus
+ */
+ rowreq_ctx->column_set_flags |=
+ COLUMN_IPV4INTERFACEENABLESTATUS_FLAG;
+ }
+ }
+
+ /*
+ * if we successfully commited this row, set the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY;
+ }
+
+ if (save_flags) {
+ snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n",
+ save_flags);
+ return MFD_ERROR;
+ }
+
+ return rc;
+} /* ipv4InterfaceTable_commit */
+
+/**
+ * undo commit new values.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * ipv4InterfaceTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ipv4InterfaceTable_undo_commit(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_undo_commit", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:485:M: |-> Undo ipv4InterfaceTable commit.
+ * check the column's flag in rowreq_ctx->column_set_flags to see
+ * if it was set during commit, then undo it.
+ *
+ * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
+ */
+
+
+ /*
+ * if we successfully un-commited this row, clear the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return rc;
+} /* ipv4InterfaceTable_undo_commit */
+
+/*
+ * TODO:440:M: Implement ipv4InterfaceTable node value checks.
+ * TODO:450:M: Implement ipv4InterfaceTable undo functions.
+ * TODO:460:M: Implement ipv4InterfaceTable set functions.
+ * TODO:480:M: Implement ipv4InterfaceTable commit functions.
+ */
+/*---------------------------------------------------------------------
+ * IP-MIB::ipv4InterfaceEntry.ipv4InterfaceEnableStatus
+ * ipv4InterfaceEnableStatus is subid 3 of ipv4InterfaceEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.4.28.1.3
+ * Description:
+The indication of whether IPv4 is enabled (up) or disabled
+ (down) on this interface. This object does not affect the
+ state of the interface itself, only its connection to an
+ IPv4 stack. The IF-MIB should be used to control the state
+ of the interface.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 1/8. Values: up(1), down(2)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipv4InterfaceEnableStatus_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipv4InterfaceTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of up(1), down(2)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipv4InterfaceEnableStatus_check_value(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipv4InterfaceEnableStatus_val)
+{
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceEnableStatus_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipv4InterfaceEnableStatus value.
+ */
+ /*
+ * did the access code set the flag indicating that we can control
+ * individual protocols on this interface?
+ */
+ if (rowreq_ctx->data.ifentry->ns_flags &
+ NETSNMP_INTERFACE_FLAGS_CAN_DOWN_PROTOCOL);
+ else
+ return MFD_NOT_VALID_EVER;
+
+ return MFD_SUCCESS; /* ipv4InterfaceEnableStatus value not illegal */
+} /* ipv4InterfaceEnableStatus_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipv4InterfaceTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipv4InterfaceTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipv4InterfaceEnableStatus_undo_setup(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceEnableStatus_undo_setup", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipv4InterfaceEnableStatus undo.
+ */
+ /*
+ * copy ipv4InterfaceEnableStatus data
+ * set rowreq_ctx->undo->ipv4InterfaceEnableStatus from rowreq_ctx->data.ipv4InterfaceEnableStatus
+ */
+ rowreq_ctx->undo->ipv4InterfaceEnableStatus =
+ rowreq_ctx->data.ipv4InterfaceEnableStatus;
+
+
+ return MFD_SUCCESS;
+} /* ipv4InterfaceEnableStatus_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipv4InterfaceEnableStatus_val
+ * A long containing the new value.
+ */
+int
+ipv4InterfaceEnableStatus_set(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
+ u_long ipv4InterfaceEnableStatus_val)
+{
+
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceEnableStatus_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipv4InterfaceEnableStatus value.
+ * set ipv4InterfaceEnableStatus value in rowreq_ctx->data
+ */
+ rowreq_ctx->data.ipv4InterfaceEnableStatus =
+ ipv4InterfaceEnableStatus_val;
+
+ return MFD_SUCCESS;
+} /* ipv4InterfaceEnableStatus_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipv4InterfaceEnableStatus_undo(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceEnableStatus_undo", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipv4InterfaceEnableStatus undo.
+ */
+ /*
+ * copy ipv4InterfaceEnableStatus data
+ * set rowreq_ctx->data.ipv4InterfaceEnableStatus from rowreq_ctx->undo->ipv4InterfaceEnableStatus
+ */
+ rowreq_ctx->data.ipv4InterfaceEnableStatus =
+ rowreq_ctx->undo->ipv4InterfaceEnableStatus;
+
+
+ return MFD_SUCCESS;
+} /* ipv4InterfaceEnableStatus_undo */
+
+/** @} */
+/** @{ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable.h
new file mode 100644
index 0000000000..84dfcedeae
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable.h
@@ -0,0 +1,275 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: ipv4InterfaceTable.h 15205 2006-09-14 17:15:32Z rstory $
+ */
+#ifndef IPV4INTERFACETABLE_H
+#define IPV4INTERFACETABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @addtogroup misc misc: Miscellaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/data_access/interface.h>
+
+#include "if-mib/ifTable/ifTable.h"
+
+ /*
+ * other required module components
+ */
+ /* *INDENT-OFF* */
+config_require(if-mib/ifTable/ifTable)
+config_require(ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface)
+config_require(ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_data_access)
+ /* *INDENT-ON* */
+
+ /*
+ * OID, column number and enum definions for ipv4InterfaceTable
+ */
+#include "ipv4InterfaceTable_constants.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_ipv4InterfaceTable(void);
+ void shutdown_ipv4InterfaceTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipv4InterfaceTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipv4InterfaceTable is subid 28 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.28, length: 8
+ *
+ * we share data structures (data too, in fact) with ifTable
+ */
+ typedef ifTable_registration ipv4InterfaceTable_registration;
+ typedef ifTable_data ipv4InterfaceTable_data;
+ typedef ifTable_undo_data ipv4InterfaceTable_undo_data;
+ typedef ifTable_mib_index ipv4InterfaceTable_mib_index;
+ typedef ifTable_rowreq_ctx ipv4InterfaceTable_rowreq_ctx;
+
+ /*
+ * ipv4InterfaceReasmMaxSize(2)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ */
+#define ipv4InterfaceReasmMaxSize ifentry->reasm_max_v4
+
+ /*
+ * ipv4InterfaceEnableStatus(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+#define ipv4InterfaceEnableStatus ifentry->admin_status
+
+ /*
+ * ipv4InterfaceRetransmitTime(4)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/D/h
+ */
+#define ipv4InterfaceRetransmitTime ifentry->retransmit_v4
+
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int
+ ipv4InterfaceTable_pre_request(ipv4InterfaceTable_registration *
+ user_context);
+ int
+ ipv4InterfaceTable_post_request(ipv4InterfaceTable_registration *
+ user_context, int rc);
+
+ int
+ ipv4InterfaceTable_rowreq_ctx_init(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ void *user_init_ctx);
+ void
+ ipv4InterfaceTable_rowreq_ctx_cleanup(ipv4InterfaceTable_rowreq_ctx
+ * rowreq_ctx);
+
+ int ipv4InterfaceTable_commit(ipv4InterfaceTable_rowreq_ctx
+ * rowreq_ctx);
+ ipv4InterfaceTable_rowreq_ctx
+ * ipv4InterfaceTable_row_find_by_mib_index
+ (ipv4InterfaceTable_mib_index * mib_idx);
+
+ extern oid ipv4InterfaceTable_oid[];
+ extern int ipv4InterfaceTable_oid_size;
+
+
+#include "ipv4InterfaceTable_interface.h"
+#include "ipv4InterfaceTable_data_access.h"
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipv4InterfaceTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipv4InterfaceTable is subid 28 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.28, length: 8
+ */
+ /*
+ * indexes
+ */
+
+ int
+ ipv4InterfaceReasmMaxSize_get(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx, long
+ *ipv4InterfaceReasmMaxSize_val_ptr);
+ int
+ ipv4InterfaceEnableStatus_get(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipv4InterfaceEnableStatus_val_ptr);
+ int
+ ipv4InterfaceRetransmitTime_get(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipv4InterfaceRetransmitTime_val_ptr);
+
+
+ int
+ ipv4InterfaceTable_indexes_set_tbl_idx(ipv4InterfaceTable_mib_index
+ * tbl_idx, long
+ ipv4InterfaceIfIndex_val);
+ int
+ ipv4InterfaceTable_indexes_set(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipv4InterfaceIfIndex_val);
+
+
+
+ /*
+ *********************************************************************
+ * SET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * SET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipv4InterfaceTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipv4InterfaceTable is subid 28 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.28, length: 8
+ */
+
+
+ int
+ ipv4InterfaceTable_undo_setup(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+ ipv4InterfaceTable_undo_cleanup(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipv4InterfaceTable_undo(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipv4InterfaceTable_commit(ipv4InterfaceTable_rowreq_ctx
+ * rowreq_ctx);
+ int
+ ipv4InterfaceTable_undo_commit(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+ int
+ ipv4InterfaceReasmMaxSize_check_value(ipv4InterfaceTable_rowreq_ctx
+ * rowreq_ctx, long
+ ipv4InterfaceReasmMaxSize_val);
+ int
+ ipv4InterfaceReasmMaxSize_undo_setup(ipv4InterfaceTable_rowreq_ctx
+ * rowreq_ctx);
+ int
+ ipv4InterfaceReasmMaxSize_set(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipv4InterfaceReasmMaxSize_val);
+ int
+ ipv4InterfaceReasmMaxSize_undo(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ ipv4InterfaceEnableStatus_check_value(ipv4InterfaceTable_rowreq_ctx
+ * rowreq_ctx,
+ u_long
+ ipv4InterfaceEnableStatus_val);
+ int
+ ipv4InterfaceEnableStatus_undo_setup(ipv4InterfaceTable_rowreq_ctx
+ * rowreq_ctx);
+ int
+ ipv4InterfaceEnableStatus_set(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ipv4InterfaceEnableStatus_val);
+ int
+ ipv4InterfaceEnableStatus_undo(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ ipv4InterfaceRetransmitTime_check_value
+ (ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
+ u_long ipv4InterfaceRetransmitTime_val);
+ int
+ ipv4InterfaceRetransmitTime_undo_setup
+ (ipv4InterfaceTable_rowreq_ctx * rowreq_ctx);
+ int
+ ipv4InterfaceRetransmitTime_set(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ipv4InterfaceRetransmitTime_val);
+ int
+ ipv4InterfaceRetransmitTime_undo(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+ int
+ ipv4InterfaceTable_check_dependencies(ipv4InterfaceTable_rowreq_ctx
+ * ctx);
+
+
+ /*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPV4INTERFACETABLE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_constants.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_constants.h
new file mode 100644
index 0000000000..29095cd6ee
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_constants.h
@@ -0,0 +1,81 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $
+ *
+ * $Id: ipv4InterfaceTable_constants.h 13897 2005-12-10 01:56:01Z rstory $
+ */
+#ifndef IPV4INTERFACETABLE_CONSTANTS_H
+#define IPV4INTERFACETABLE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ * column number definitions for table ipv4InterfaceTable
+ */
+#define IPV4INTERFACETABLE_OID 1,3,6,1,2,1,4,28
+#define IPV4INTERFACETABLELASTCHANGE_OID 1,3,6,1,2,1,4,27
+
+#define COLUMN_IPV4INTERFACEIFINDEX 1
+
+#define COLUMN_IPV4INTERFACEREASMMAXSIZE 2
+
+#define COLUMN_IPV4INTERFACEENABLESTATUS 3
+#define COLUMN_IPV4INTERFACEENABLESTATUS_FLAG (0x1 << 2)
+
+#define COLUMN_IPV4INTERFACERETRANSMITTIME 4
+
+
+#define IPV4INTERFACETABLE_MIN_COL COLUMN_IPV4INTERFACEREASMMAXSIZE
+#define IPV4INTERFACETABLE_MAX_COL COLUMN_IPV4INTERFACERETRANSMITTIME
+
+
+ /*
+ * TODO:405:r: Review IPV4INTERFACETABLE_SETTABLE_COLS macro.
+ * OR together all the writable cols.
+ */
+#define IPV4INTERFACETABLE_SETTABLE_COLS (COLUMN_IPV4INTERFACEENABLESTATUS_FLAG)
+ /*
+ * NOTES on enums
+ * ==============
+ *
+ * Value Mapping
+ * -------------
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them
+ * below. For example, a boolean flag (1/0) is usually represented
+ * as a TruthValue in a MIB, which maps to the values (1/2).
+ *
+ */
+/*************************************************************************
+ *************************************************************************
+ *
+ * enum definitions for table ipv4InterfaceTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipv4InterfaceEnableStatus (INTEGER / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef IPV4INTERFACEENABLESTATUS_ENUMS
+#define IPV4INTERFACEENABLESTATUS_ENUMS
+
+#define IPV4INTERFACEENABLESTATUS_UP 1
+#define IPV4INTERFACEENABLESTATUS_DOWN 2
+
+#endif /* IPV4INTERFACEENABLESTATUS_ENUMS */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPV4INTERFACETABLE_OIDS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_data_access.c
new file mode 100644
index 0000000000..72bb5ba463
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_data_access.c
@@ -0,0 +1,302 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: ipv4InterfaceTable_data_access.c 15205 2006-09-14 17:15:32Z rstory $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipv4InterfaceTable.h"
+
+
+#include "ipv4InterfaceTable_data_access.h"
+
+
+/** @ingroup interface
+ * @addtogroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipv4InterfaceTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipv4InterfaceTable is subid 28 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.28, length: 8
+ */
+
+/**
+ * initialization for ipv4InterfaceTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param ipv4InterfaceTable_reg
+ * Pointer to ipv4InterfaceTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+ipv4InterfaceTable_init_data(ipv4InterfaceTable_registration *
+ ipv4InterfaceTable_reg)
+{
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_init_data",
+ "called\n"));
+
+ /*
+ * TODO:303:o: Initialize ipv4InterfaceTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* ipv4InterfaceTable_init_data */
+
+/**
+ * container overview
+ *
+ */
+
+/**
+ * container initialization
+ *
+ * @param container_ptr_ptr A pointer to a container pointer. If you
+ * create a custom container, use this parameter to return it
+ * to the MFD helper. If set to NULL, the MFD helper will
+ * allocate a container for you.
+ *
+ * This function is called at startup to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases. If no custom
+ * container is allocated, the MFD code will create one for your.
+ *
+ * @remark
+ * This would also be a good place to do any initialization needed
+ * for you data source. For example, opening a connection to another
+ * process that will supply the data, opening a database, etc.
+ */
+void
+ipv4InterfaceTable_container_init(netsnmp_container **container_ptr_ptr)
+{
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_container_init", "called\n"));
+
+ if (NULL == container_ptr_ptr) {
+ snmp_log(LOG_ERR,
+ "bad container param to ipv4InterfaceTable_container_init\n");
+ return;
+ }
+
+ /*
+ * For advanced users, you can use a custom container. If you
+ * do not create one, one will be created for you.
+ */
+} /* ipv4InterfaceTable_container_init */
+
+
+/**
+ * @internal
+ * determine if we want a ifTable row in our container
+ */
+void
+ipv4InterfaceTable_check_entry_for_updates(const ifTable_rowreq_ctx *
+ ift_rrc,
+ netsnmp_interface_entry *entry)
+{
+ netsnmp_container *c = ipv4InterfaceTable_container_get();
+ ifTable_rowreq_ctx *ip4if_rrc;
+ int changed = 0;
+
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:check_entry_for_updates",
+ "called\n"));
+
+ /*
+ * do we have a corresponding row?
+ */
+ ip4if_rrc = CONTAINER_FIND(c, ift_rrc);
+ if (NULL == ip4if_rrc) {
+ /*
+ * no corresponding row. should we have one?
+ */
+ if ((NULL != entry) &&
+ (entry->ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_IPV4)) {
+ /*
+ * yes.
+ */
+ DEBUGMSGTL(("ipv4InterfaceTable:check_entry_for_updates",
+ "inserted row for %d\n", entry->index));
+ CONTAINER_INSERT(c, ift_rrc);
+ changed = 1;
+ }
+ } else {
+ /*
+ * found corresponding row. is it still applicable?
+ */
+ if ((NULL == entry) ||
+ (0 == (entry->ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_IPV4))) {
+ /*
+ * no
+ */
+ DEBUGMSGTL(("ipv4InterfaceTable:check_entry_for_updates",
+ "removed row for %d\n",
+ ift_rrc->data.ifentry->index));
+ CONTAINER_REMOVE(c, ift_rrc);
+ changed = 1;
+ } else {
+ /*
+ * still applicable. anything changed?
+ */
+ if ((entry->retransmit_v4 !=
+ ift_rrc->data.ifentry->retransmit_v4) ||
+ (entry->reasm_max_v4 != ift_rrc->data.ifentry->reasm_max_v4)) {
+ DEBUGMSGTL(("ipv4InterfaceTable:check_entry_for_updates",
+ "row changed for %d\n",
+ ift_rrc->data.ifentry->index));
+ changed = 1;
+ }
+ }
+ }
+
+ /*
+ * if something changed, update table last changed
+ */
+ if (changed)
+ ipv4InterfaceTable_lastChange_set(netsnmp_get_agent_uptime());
+}
+
+
+/**
+ * container shutdown
+ *
+ * @param container_ptr A pointer to the container.
+ *
+ * This function is called at shutdown to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases.
+ *
+ * This function is called before ipv4InterfaceTable_container_free().
+ *
+ * @remark
+ * This would also be a good place to do any cleanup needed
+ * for you data source. For example, closing a connection to another
+ * process that supplied the data, closing a database, etc.
+ */
+void
+ipv4InterfaceTable_container_shutdown(netsnmp_container *container_ptr)
+{
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_container_shutdown", "called\n"));
+
+ if (NULL == container_ptr) {
+ snmp_log(LOG_ERR,
+ "bad params to ipv4InterfaceTable_container_shutdown\n");
+ return;
+ }
+
+} /* ipv4InterfaceTable_container_shutdown */
+
+/**
+ * load initial data
+ *
+ * TODO:350:M: Implement ipv4InterfaceTable data load
+ *
+ * @param container container to which items should be inserted
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
+ * @retval MFD_ERROR : other error.
+ *
+ * This function is called to load the index(es) (and data, optionally)
+ * for the every row in the data set.
+ *
+ * @remark
+ * While loading the data, the only important thing is the indexes.
+ * If access to your data is cheap/fast (e.g. you have a pointer to a
+ * structure in memory), it would make sense to update the data here.
+ * If, however, the accessing the data invovles more work (e.g. parsing
+ * some other existing data, or peforming calculations to derive the data),
+ * then you can limit yourself to setting the indexes and saving any
+ * information you will need later. Then use the saved information in
+ * ipv4InterfaceTable_row_prep() for populating data.
+ *
+ * @note
+ * If you need consistency between rows (like you want statistics
+ * for each row to be from the same time frame), you should set all
+ * data here.
+ *
+ */
+int
+ipv4InterfaceTable_container_load(netsnmp_container *container)
+{
+ DEBUGMSGT(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_container_load", "illegal call!\n"));
+
+ return MFD_ERROR;
+} /* ipv4InterfaceTable_container_load */
+
+/**
+ * container clean up
+ *
+ * @param container container with all current items
+ *
+ * This optional callback is called prior to all
+ * item's being removed from the container. If you
+ * need to do any processing before that, do it here.
+ *
+ * @note
+ * The MFD helper will take care of releasing all the row contexts.
+ *
+ */
+void
+ipv4InterfaceTable_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_container_free", "called\n"));
+
+ /*
+ * TODO:380:M: Free ipv4InterfaceTable container data.
+ */
+} /* ipv4InterfaceTable_container_free */
+
+/**
+ * prepare row for processing.
+ *
+ * When the agent has located the row for a request, this function is
+ * called to prepare the row for processing. If you fully populated
+ * the data context during the index setup phase, you may not need to
+ * do anything.
+ *
+ * @param rowreq_ctx pointer to a context.
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ */
+int
+ipv4InterfaceTable_row_prep(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_row_prep",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+
+ return MFD_SUCCESS;
+} /* ipv4InterfaceTable_row_prep */
+
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_data_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_data_access.h
new file mode 100644
index 0000000000..821e37e392
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_data_access.h
@@ -0,0 +1,71 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: ipv4InterfaceTable_data_access.h 13899 2005-12-10 01:58:09Z rstory $
+ */
+#ifndef IPV4INTERFACETABLE_DATA_ACCESS_H
+#define IPV4INTERFACETABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipv4InterfaceTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipv4InterfaceTable is subid 28 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.28, length: 8
+ */
+
+
+ int
+ ipv4InterfaceTable_init_data(ipv4InterfaceTable_registration *
+ ipv4InterfaceTable_reg);
+
+
+ void
+ ipv4InterfaceTable_container_init(netsnmp_container
+ **container_ptr_ptr);
+ void ipv4InterfaceTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int
+ ipv4InterfaceTable_container_load(netsnmp_container
+ *container);
+ void
+ ipv4InterfaceTable_container_free(netsnmp_container
+ *container);
+
+ int
+ ipv4InterfaceTable_row_prep(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+
+ void
+ ipv4InterfaceTable_check_entry_for_updates(const
+ ifTable_rowreq_ctx
+ * ift_rrc,
+ netsnmp_interface_entry
+ *entry);
+
+
+#ifdef __cplusplus
+ }
+#endif
+#endif /* IPV4INTERFACETABLE_DATA_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface.c
new file mode 100644
index 0000000000..d8b8dc4d0d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface.c
@@ -0,0 +1,1308 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: ipv4InterfaceTable_interface.c 14142 2006-01-15 19:55:17Z rstory $
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipv4InterfaceTable.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "ipv4InterfaceTable_interface.h"
+
+#include <ctype.h>
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipv4InterfaceTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipv4InterfaceTable is subid 28 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.28, length: 8
+ */
+typedef struct ipv4InterfaceTable_interface_ctx_s {
+
+ netsnmp_container *container;
+
+ ipv4InterfaceTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+ u_long last_changed;
+
+} ipv4InterfaceTable_interface_ctx;
+
+static ipv4InterfaceTable_interface_ctx ipv4InterfaceTable_if_ctx;
+
+static void
+ _ipv4InterfaceTable_container_init(ipv4InterfaceTable_interface_ctx *
+ if_ctx);
+static void
+ _ipv4InterfaceTable_container_shutdown(ipv4InterfaceTable_interface_ctx *
+ if_ctx);
+
+
+netsnmp_container *
+ipv4InterfaceTable_container_get(void)
+{
+ return ipv4InterfaceTable_if_ctx.container;
+}
+
+ipv4InterfaceTable_registration *
+ipv4InterfaceTable_registration_get(void)
+{
+ return ipv4InterfaceTable_if_ctx.user_ctx;
+}
+
+ipv4InterfaceTable_registration *
+ipv4InterfaceTable_registration_set(ipv4InterfaceTable_registration *
+ newreg)
+{
+ ipv4InterfaceTable_registration *old =
+ ipv4InterfaceTable_if_ctx.user_ctx;
+ ipv4InterfaceTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+
+int
+ipv4InterfaceTable_container_size(void)
+{
+ return CONTAINER_SIZE(ipv4InterfaceTable_if_ctx.container);
+}
+
+u_int
+ipv4InterfaceTable_dirty_get(void)
+{
+ return ifTable_dirty_get();
+}
+
+void
+ipv4InterfaceTable_dirty_set(u_int status)
+{
+ ifTable_dirty_set(status);
+}
+
+/*
+ * ipv4InterfaceTableLastChanged, which is the last time that a row in
+ * the table was changed or the last time a row was added/deleted from the
+ * table.
+ */
+void
+ipv4InterfaceTable_lastChange_set(u_long table_changed)
+{
+ DEBUGMSGTL(("ipv4InterfaceTable:lastChanged_set",
+ "called. was %ld, now %ld\n",
+ ipv4InterfaceTable_if_ctx.last_changed, table_changed));
+ ipv4InterfaceTable_if_ctx.last_changed = table_changed;
+}
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_pre_request;
+static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_post_request;
+static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_get_values;
+static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_check_objects;
+static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_undo_setup;
+static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_set_values;
+static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_undo_cleanup;
+static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_undo_values;
+static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_commit;
+static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_undo_commit;
+static Netsnmp_Node_Handler _mfd_ipv4InterfaceTable_irreversible_commit;
+
+NETSNMP_STATIC_INLINE int
+ _ipv4InterfaceTable_undo_column(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list *
+ var, int column);
+
+ipv4InterfaceTable_data *ipv4InterfaceTable_allocate_data(void);
+
+/**
+ * @internal
+ * Initialize the table ipv4InterfaceTable
+ * (Define its contents and how it's structured)
+ */
+void
+_ipv4InterfaceTable_initialize_interface(ipv4InterfaceTable_registration *
+ reg_ptr, u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &ipv4InterfaceTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info =
+ &ipv4InterfaceTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_ipv4InterfaceTable_initialize_interface", "called\n"));
+
+
+ /*************************************************
+ *
+ * save interface context for ipv4InterfaceTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
+ /** index: ipv4InterfaceIfIndex */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrival.
+ */
+ tbl_info->min_column = IPV4INTERFACETABLE_MIN_COL;
+ tbl_info->max_column = IPV4INTERFACETABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ ipv4InterfaceTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ ipv4InterfaceTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _ipv4InterfaceTable_container_init(&ipv4InterfaceTable_if_ctx);
+ if (NULL == ipv4InterfaceTable_if_ctx.container) {
+ snmp_log(LOG_ERR,
+ "could not initialize container for ipv4InterfaceTable\n");
+ return;
+ }
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup =
+ _mfd_ipv4InterfaceTable_object_lookup;
+ access_multiplexer->get_values = _mfd_ipv4InterfaceTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request = _mfd_ipv4InterfaceTable_pre_request;
+ access_multiplexer->post_request =
+ _mfd_ipv4InterfaceTable_post_request;
+
+
+ /*
+ * REQUIRED wrappers for set request handling
+ */
+ access_multiplexer->object_syntax_checks =
+ _mfd_ipv4InterfaceTable_check_objects;
+ access_multiplexer->undo_setup = _mfd_ipv4InterfaceTable_undo_setup;
+ access_multiplexer->undo_cleanup =
+ _mfd_ipv4InterfaceTable_undo_cleanup;
+ access_multiplexer->set_values = _mfd_ipv4InterfaceTable_set_values;
+ access_multiplexer->undo_sets = _mfd_ipv4InterfaceTable_undo_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->commit = _mfd_ipv4InterfaceTable_commit;
+ access_multiplexer->undo_commit = _mfd_ipv4InterfaceTable_undo_commit;
+ access_multiplexer->irreversible_commit =
+ _mfd_ipv4InterfaceTable_irreversible_commit;
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("ipv4InterfaceTable:init_ipv4InterfaceTable",
+ "Registering ipv4InterfaceTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("ipv4InterfaceTable", handler,
+ ipv4InterfaceTable_oid,
+ ipv4InterfaceTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RWRITE);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR, "error registering table ipv4InterfaceTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &ipv4InterfaceTable_if_ctx;
+
+ /*************************************************
+ *
+ * set up baby steps handler, create it and inject it
+ */
+ if (access_multiplexer->object_lookup)
+ mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
+ if (access_multiplexer->set_values)
+ mfd_modes |= BABY_STEP_SET_VALUES;
+ if (access_multiplexer->irreversible_commit)
+ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
+ if (access_multiplexer->object_syntax_checks)
+ mfd_modes |= BABY_STEP_CHECK_OBJECT;
+
+ if (access_multiplexer->pre_request)
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if (access_multiplexer->post_request)
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+ if (access_multiplexer->undo_setup)
+ mfd_modes |= BABY_STEP_UNDO_SETUP;
+ if (access_multiplexer->undo_cleanup)
+ mfd_modes |= BABY_STEP_UNDO_CLEANUP;
+ if (access_multiplexer->undo_sets)
+ mfd_modes |= BABY_STEP_UNDO_SETS;
+
+ if (access_multiplexer->row_creation)
+ mfd_modes |= BABY_STEP_ROW_CREATE;
+ if (access_multiplexer->consistency_checks)
+ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
+ if (access_multiplexer->commit)
+ mfd_modes |= BABY_STEP_COMMIT;
+ if (access_multiplexer->undo_commit)
+ mfd_modes |= BABY_STEP_UNDO_COMMIT;
+
+ handler = netsnmp_baby_steps_handler_get(mfd_modes);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
+ */
+ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler =
+ netsnmp_container_table_handler_get(tbl_info,
+ ipv4InterfaceTable_if_ctx.
+ container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+ /*
+ * register LastChanged
+ */
+ {
+ oid lc_oid[] = { IPV4INTERFACETABLELASTCHANGE_OID };
+ netsnmp_register_watched_scalar(netsnmp_create_handler_registration
+ ("ipv4TableLastChanged", NULL,
+ lc_oid, OID_LENGTH(lc_oid),
+ HANDLER_CAN_RONLY),
+ netsnmp_create_watcher_info((void
+ *)
+ &ipv4InterfaceTable_if_ctx.
+ last_changed,
+ sizeof
+ (u_long),
+ ASN_TIMETICKS,
+ WATCHER_FIXED_SIZE));
+ }
+} /* _ipv4InterfaceTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table ipv4InterfaceTable
+ */
+void
+_ipv4InterfaceTable_shutdown_interface(ipv4InterfaceTable_registration *
+ reg_ptr)
+{
+ /*
+ * shutdown the container
+ */
+ _ipv4InterfaceTable_container_shutdown(&ipv4InterfaceTable_if_ctx);
+}
+
+void
+ipv4InterfaceTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ ipv4InterfaceTable_if_ctx.tbl_info.valid_columns = vc;
+} /* ipv4InterfaceTable_valid_columns_set */
+
+/*
+ * ipv4InterfaceTable_allocate_data
+ *
+ * Purpose: create new ipv4InterfaceTable_data.
+ */
+ipv4InterfaceTable_data *
+ipv4InterfaceTable_allocate_data(void)
+{
+ ipv4InterfaceTable_data *rtn =
+ SNMP_MALLOC_TYPEDEF(ipv4InterfaceTable_data);
+
+ DEBUGMSGTL(("verbose:ipv4InterfaceTable:ipv4InterfaceTable_allocate_data", "called\n"));
+
+ if (NULL == rtn) {
+ snmp_log(LOG_ERR, "unable to malloc memory for new "
+ "ipv4InterfaceTable_data.\n");
+ }
+
+ return rtn;
+} /* ipv4InterfaceTable_allocate_data */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipv4InterfaceTable_pre_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_pre_request", "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ipv4InterfaceTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = ipv4InterfaceTable_pre_request(ipv4InterfaceTable_if_ctx.
+ user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipv4InterfaceTable", "error %d from "
+ "ipv4InterfaceTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv4InterfaceTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipv4InterfaceTable_post_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_post_request", "called\n"));
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ipv4InterfaceTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ if ((MFD_SUCCESS != packet_rc) && ipv4InterfaceTable_dirty_get()) {
+ /*
+ * we shouldn't get here. the undo steps should also clear
+ * the dirty flags.
+ */
+ snmp_log(LOG_WARNING,
+ "ipv4InterfaceTable dirty flag set in post_request "
+ "but status != SUCCESS.\n");
+ }
+
+ rc = ipv4InterfaceTable_post_request(ipv4InterfaceTable_if_ctx.
+ user_ctx, packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipv4InterfaceTable", "error %d from "
+ "ipv4InterfaceTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv4InterfaceTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipv4InterfaceTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = SNMP_ERR_NOERROR;
+ ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_object_lookup", "called\n"));
+
+ /*
+ * get our context from mfd
+ * ipv4InterfaceTable_interface_ctx *if_ctx =
+ * (ipv4InterfaceTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if (NULL == rowreq_ctx) {
+ rc = SNMP_ERR_NOCREATION;
+ }
+
+ if (MFD_SUCCESS != rc)
+ netsnmp_request_set_error_all(requests, rc);
+ else
+ ipv4InterfaceTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_ipv4InterfaceTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipv4InterfaceTable_get_column(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_get_column", "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipv4InterfaceReasmMaxSize(2)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ */
+ case COLUMN_IPV4INTERFACEREASMMAXSIZE:
+ var->val_len = sizeof(long);
+ var->type = ASN_INTEGER;
+ rc = ipv4InterfaceReasmMaxSize_get(rowreq_ctx,
+ (long *) var->val.string);
+ break;
+
+ /*
+ * ipv4InterfaceEnableStatus(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPV4INTERFACEENABLESTATUS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipv4InterfaceEnableStatus_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipv4InterfaceRetransmitTime(4)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/D/h
+ */
+ case COLUMN_IPV4INTERFACERETRANSMITTIME:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_UNSIGNED;
+ rc = ipv4InterfaceRetransmitTime_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipv4InterfaceTable_get_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ipv4InterfaceTable_get_column */
+
+int
+_mfd_ipv4InterfaceTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ u_char *old_string;
+ void (*dataFreeHook) (void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_get_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+ /*
+ * save old pointer, so we can free it if replaced
+ */
+ old_string = requests->requestvb->val.string;
+ dataFreeHook = requests->requestvb->dataFreeHook;
+ if (NULL == requests->requestvb->val.string) {
+ requests->requestvb->val.string = requests->requestvb->buf;
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ } else if (requests->requestvb->buf ==
+ requests->requestvb->val.string) {
+ if (requests->requestvb->val_len !=
+ sizeof(requests->requestvb->buf))
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ }
+
+ /*
+ * get column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipv4InterfaceTable_get_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ if (MFD_SKIP == rc) {
+ requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+ rc = SNMP_ERR_NOERROR;
+ }
+ } else if (NULL == requests->requestvb->val.string) {
+ snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
+ rc = SNMP_ERR_GENERR;
+ }
+ if (rc)
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+
+ /*
+ * if the buffer wasn't used previously for the old data (i.e. it
+ * was allcoated memory) and the get routine replaced the pointer,
+ * we need to free the previous pointer.
+ */
+ if (old_string && (old_string != requests->requestvb->buf) &&
+ (requests->requestvb->val.string != old_string)) {
+ if (dataFreeHook)
+ (*dataFreeHook) (old_string);
+ else
+ free(old_string);
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv4InterfaceTable_get_values */
+
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Syntax checks
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check the syntax for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipv4InterfaceTable_check_column(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx, netsnmp_variable_list * var,
+ int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_ipv4InterfaceTable_check_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+ /*
+ * (INDEX) ipv4InterfaceIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ case COLUMN_IPV4INTERFACEIFINDEX:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+
+ /*
+ * ipv4InterfaceReasmMaxSize(2)/INTEGER32/ASN_INTEGER/long(long)//l/A/w/e/R/d/h
+ */
+ case COLUMN_IPV4INTERFACEREASMMAXSIZE:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ipv4InterfaceEnableStatus(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPV4INTERFACEENABLESTATUS:
+ rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
+ sizeof(rowreq_ctx->data.
+ ipv4InterfaceEnableStatus));
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (*var->val.integer != IPV4INTERFACEENABLESTATUS_UP)
+ && (*var->val.integer != IPV4INTERFACEENABLESTATUS_DOWN)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipv4InterfaceTable:_ipv4InterfaceTable_check_column:ipv4InterfaceEnableStatus", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipv4InterfaceEnableStatus_check_value(rowreq_ctx,
+ *((u_long *) var->
+ val.string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipv4InterfaceEnableStatus_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ipv4InterfaceRetransmitTime(4)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/D/h
+ */
+ case COLUMN_IPV4INTERFACERETRANSMITTIME:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ default: /** We shouldn't get here */
+ rc = SNMP_ERR_GENERR;
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipv4InterfaceTable_check_column\n",
+ column);
+ }
+
+ return rc;
+} /* _ipv4InterfaceTable_check_column */
+
+int
+_mfd_ipv4InterfaceTable_check_objects(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc;
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_check_objects", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+
+ /*
+ * get column number from table request info, and check that column
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipv4InterfaceTable_check_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+ break;
+ }
+
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv4InterfaceTable_check_objects */
+
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo setup
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipv4InterfaceTable_undo_setup_column(ipv4InterfaceTable_rowreq_ctx *
+ rowreq_ctx, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_ipv4InterfaceTable_undo_setup_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipv4InterfaceEnableStatus(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPV4INTERFACEENABLESTATUS:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_IPV4INTERFACEENABLESTATUS_FLAG;
+ rc = ipv4InterfaceEnableStatus_undo_setup(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipv4InterfaceTable_undo_setup_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ipv4InterfaceTable_undo_setup_column */
+
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_ipv4InterfaceTable_undo_setup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_undo_setup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * allocate undo context
+ */
+ rc = _mfd_ifTable_undo_setup_allocate(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ netsnmp_request_set_error_all(requests, rc);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * row undo setup
+ */
+ rc = ipv4InterfaceTable_undo_setup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from "
+ "ipv4InterfaceTable_undo_setup\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ } else {
+ /*
+ * column undo setup
+ */
+ netsnmp_table_request_info *tri;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipv4InterfaceTable_undo_setup_column(rowreq_ctx,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from "
+ "ipv4InterfaceTable_undo_setup_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv4InterfaceTable_undo_setup */
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_ipv4InterfaceTable_undo_cleanup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc;
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_undo_cleanup", "called\n"));
+
+ /*
+ * failed row create in early stages has no rowreq_ctx
+ */
+ if (NULL == rowreq_ctx)
+ return MFD_SUCCESS;
+
+ /*
+ * call user cleanup
+ */
+ rc = ipv4InterfaceTable_undo_cleanup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from "
+ "ipv4InterfaceTable_undo_cleanup\n", rc));
+ }
+
+ /*
+ * release undo context, if needed
+ */
+ _mfd_ifTable_undo_setup_release(rowreq_ctx);
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv4InterfaceTable_undo_cleanup */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Set values
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipv4InterfaceTable_set_column(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_ipv4InterfaceTable_set_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipv4InterfaceEnableStatus(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPV4INTERFACEENABLESTATUS:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_IPV4INTERFACEENABLESTATUS_FLAG;
+ rc = ipv4InterfaceEnableStatus_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipv4InterfaceTable_set_column\n",
+ column);
+ rc = SNMP_ERR_GENERR;
+ break;
+ }
+
+ return rc;
+} /* _ipv4InterfaceTable_set_column */
+
+int
+_mfd_ipv4InterfaceTable_set_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc = SNMP_ERR_NOERROR;
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_set_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rowreq_ctx->column_set_flags = 0;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipv4InterfaceTable_set_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from "
+ "ipv4InterfaceTable_set_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv4InterfaceTable_set_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit the values
+ */
+int
+_mfd_ipv4InterfaceTable_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = ipv4InterfaceTable_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from "
+ "ipv4InterfaceTable_commit\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ /*
+ * if we successfully commited this row, set the dirty flag. Use the
+ * current value + 1 (i.e. dirty = # rows changed).
+ * this is checked in post_request...
+ */
+ ipv4InterfaceTable_dirty_set(ipv4InterfaceTable_dirty_get() + 1); /* set table dirty flag */
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+_mfd_ipv4InterfaceTable_undo_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_undo_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ u_int d = ipv4InterfaceTable_dirty_get();
+
+ netsnmp_assert(d != 0);
+ if (d)
+ ipv4InterfaceTable_dirty_set(d - 1);
+ }
+
+ rc = ipv4InterfaceTable_undo_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from "
+ "ipv4InterfaceTable_undo_commit\n", rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ snmp_log(LOG_WARNING,
+ "ipv4InterfaceTable row dirty flag still set after undo_commit\n");
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv4InterfaceTable_commit */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * undo the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipv4InterfaceTable_undo_column(ipv4InterfaceTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_ipv4InterfaceTable_undo_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipv4InterfaceEnableStatus(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPV4INTERFACEENABLESTATUS:
+ rc = ipv4InterfaceEnableStatus_undo(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipv4InterfaceTable_undo_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ipv4InterfaceTable_undo_column */
+
+int
+_mfd_ipv4InterfaceTable_undo_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_undo_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = ipv4InterfaceTable_undo(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from "
+ "ipv4InterfaceTable_undo\n", rc));
+ }
+
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipv4InterfaceTable_undo_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipv4InterfaceTable:mfd", "error %d from "
+ "ipv4InterfaceTable_undo_column\n", rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv4InterfaceTable_undo_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: irreversible commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit irreversible actions
+ */
+int
+_mfd_ipv4InterfaceTable_irreversible_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipv4InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_mfd_ipv4InterfaceTable_irreversible:commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * check for and handle row creation/deletion
+ * and update column exist flags...
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) {
+ CONTAINER_REMOVE(ipv4InterfaceTable_if_ctx.container, rowreq_ctx);
+ } else {
+ if (rowreq_ctx->column_set_flags) {
+ rowreq_ctx->column_set_flags = 0;
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv4InterfaceTable_irreversible_commit */
+
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+/**
+ * @internal
+ */
+/**
+ * @internal
+ */
+static void
+_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_container_free",
+ "called\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container in ipv4InterfaceTable_container_free\n");
+ return;
+ }
+
+ /*
+ * call user code
+ */
+ ipv4InterfaceTable_container_free(container);
+} /* _container_free */
+
+/**
+ * @internal
+ * initialize the container with functions or wrappers
+ */
+void
+_ipv4InterfaceTable_container_init(ipv4InterfaceTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_ipv4InterfaceTable_container_init", "called\n"));
+
+ /*
+ * container init
+ */
+ ipv4InterfaceTable_container_init(&if_ctx->container);
+ if (NULL == if_ctx->container)
+ if_ctx->container =
+ netsnmp_container_find("ipv4InterfaceTable:table_container");
+ if (NULL == if_ctx->container) {
+ snmp_log(LOG_ERR, "error creating container in "
+ "ipv4InterfaceTable_container_init\n");
+ return;
+ }
+
+} /* _ipv4InterfaceTable_container_init */
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+_ipv4InterfaceTable_container_shutdown(ipv4InterfaceTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:ipv4InterfaceTable:_ipv4InterfaceTable_container_shutdown", "called\n"));
+
+ ipv4InterfaceTable_container_shutdown(if_ctx->container);
+
+ _container_free(if_ctx->container);
+
+} /* _ipv4InterfaceTable_container_shutdown */
+
+
+ipv4InterfaceTable_rowreq_ctx *
+ipv4InterfaceTable_row_find_by_mib_index(ipv4InterfaceTable_mib_index *
+ mib_idx)
+{
+ ipv4InterfaceTable_rowreq_ctx *rowreq_ctx;
+ oid oid_tmp[MAX_OID_LEN];
+ netsnmp_index oid_idx;
+ int rc;
+
+ /*
+ * set up storage for OID
+ */
+ oid_idx.oids = oid_tmp;
+ oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
+
+ /*
+ * convert
+ */
+ rc = ifTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx =
+ CONTAINER_FIND(ipv4InterfaceTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface.h
new file mode 100644
index 0000000000..cdded1a4d4
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_interface.h
@@ -0,0 +1,106 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: ipv4InterfaceTable_interface.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** @ingroup interface Routines to interface to Net-SNMP
+ *
+ * \warning This code should not be modified, called directly,
+ * or used to interpret functionality. It is subject to
+ * change at any time.
+ *
+ * @{
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+#ifndef IPV4INTERFACETABLE_INTERFACE_H
+#define IPV4INTERFACETABLE_INTERFACE_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
+#include "ipv4InterfaceTable.h"
+
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void
+ _ipv4InterfaceTable_initialize_interface
+ (ipv4InterfaceTable_registration * user_ctx, u_long flags);
+ void
+ _ipv4InterfaceTable_shutdown_interface
+ (ipv4InterfaceTable_registration * user_ctx);
+
+ ipv4InterfaceTable_registration
+ * ipv4InterfaceTable_registration_get(void);
+
+ ipv4InterfaceTable_registration
+ * ipv4InterfaceTable_registration_set
+ (ipv4InterfaceTable_registration * newreg);
+
+ netsnmp_container *ipv4InterfaceTable_container_get(void);
+ int ipv4InterfaceTable_container_size(void);
+
+ u_int ipv4InterfaceTable_dirty_get(void);
+ void ipv4InterfaceTable_dirty_set(u_int status);
+
+ ipv4InterfaceTable_rowreq_ctx
+ * ipv4InterfaceTable_allocate_rowreq_ctx(void *);
+ void
+ ipv4InterfaceTable_release_rowreq_ctx
+ (ipv4InterfaceTable_rowreq_ctx * rowreq_ctx);
+
+ int ipv4InterfaceTable_index_to_oid(netsnmp_index *
+ oid_idx,
+ ipv4InterfaceTable_mib_index
+ * mib_idx);
+ int ipv4InterfaceTable_index_from_oid(netsnmp_index *
+ oid_idx,
+ ipv4InterfaceTable_mib_index
+ * mib_idx);
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void
+ ipv4InterfaceTable_valid_columns_set(netsnmp_column_info *vc);
+
+ /*
+ */
+ void ipv4InterfaceTable_lastChange_set(u_long uptime);
+
+
+#ifdef __cplusplus
+ }
+#endif
+#endif /* IPV4INTERFACETABLE_INTERFACE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_subagent.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_subagent.c
new file mode 100644
index 0000000000..3c85a548a8
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv4InterfaceTable/ipv4InterfaceTable_subagent.c
@@ -0,0 +1,202 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.7 $ of : subagent.m2c,v $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipv4InterfaceTable.h"
+
+#include <signal.h>
+
+static int keep_running;
+
+static RETSIGTYPE
+stop_server(int a)
+{
+ keep_running = 0;
+}
+
+static void
+usage(void)
+{
+ printf
+ ("usage: ipv4InterfaceTable [-D<tokens>] [-f] [-L] [-M] [-H] [LISTENING ADDRESSES]\n"
+ "\t-f Do not fork() from the calling shell.\n"
+ "\t-DTOKEN[,TOKEN,...]\n"
+ "\t\tTurn on debugging output for the given TOKEN(s).\n"
+ "\t\tWithout any tokens specified, it defaults to printing\n"
+ "\t\tall the tokens (which is equivalent to the keyword 'ALL').\n"
+ "\t\tYou might want to try ALL for extremely verbose output.\n"
+ "\t\tNote: You can't put a space between the -D and the TOKENs.\n"
+ "\t-H\tDisplay a list of configuration file directives\n"
+ "\t\tunderstood by the agent and then exit.\n"
+ "\t-M\tRun as a normal SNMP Agent instead of an AgentX sub-agent.\n"
+ "\t-x ADDRESS\tconnect to master agent at ADDRESS (default NETSNMP_AGENTX_SOCKET).\n"
+ "\t-L\tDo not open a log file; print all messages to stderr.\n");
+ exit(0);
+}
+
+int
+main(int argc, char **argv)
+{
+ int agentx_subagent = 1; /* change this if you want to be a SNMP master agent */
+ /*
+ * Defs for arg-handling code: handles setting of policy-related variables
+ */
+ int ch;
+ extern char *optarg;
+ int dont_fork = 0, use_syslog = 0;
+ char *agentx_socket = NULL;
+
+ while ((ch = getopt(argc, argv, "D:fHLMx:")) != EOF)
+ switch (ch) {
+ case 'D':
+ debug_register_tokens(optarg);
+ snmp_set_do_debugging(1);
+ break;
+ case 'f':
+ dont_fork = 1;
+ break;
+ case 'H':
+ netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_NO_ROOT_ACCESS, 1);
+ init_agent("ipv4InterfaceTable"); /* register our .conf handlers */
+ init_ipv4InterfaceTable();
+ init_snmp("ipv4InterfaceTable");
+ fprintf(stderr, "Configuration directives understood:\n");
+ read_config_print_usage(" ");
+ exit(0);
+ case 'M':
+ agentx_subagent = 0;
+ break;
+ case 'L':
+ use_syslog = 0; /* use stderr */
+ break;
+ case 'x':
+ agentx_socket = optarg;
+ break;
+ default:
+ fprintf(stderr, "unknown option %c\n", ch);
+ usage();
+ }
+
+ if (optind < argc) {
+ int i;
+ /*
+ * There are optional transport addresses on the command line.
+ */
+ DEBUGMSGTL(("snmpd/main", "optind %d, argc %d\n", optind, argc));
+ for (i = optind; i < argc; i++) {
+ char *c, *astring;
+ if ((c = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_PORTS))) {
+ astring = malloc(strlen(c) + 2 + strlen(argv[i]));
+ if (astring == NULL) {
+ fprintf(stderr, "malloc failure processing argv[%d]\n",
+ i);
+ exit(1);
+ }
+ sprintf(astring, "%s,%s", c, argv[i]);
+ netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_PORTS, astring);
+ SNMP_FREE(astring);
+ } else {
+ netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_PORTS, argv[i]);
+ }
+ }
+ DEBUGMSGTL(("snmpd/main", "port spec: %s\n",
+ netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_PORTS)));
+ }
+
+ /*
+ * we're an agentx subagent?
+ */
+ if (agentx_subagent) {
+ /*
+ * make us a agentx client.
+ */
+ netsnmp_enable_subagent();
+ if (NULL != agentx_socket)
+ netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_X_SOCKET,
+ agentx_socket);
+ }
+
+ snmp_disable_log();
+ if (use_syslog)
+ snmp_enable_calllog();
+ else
+ snmp_enable_stderrlog();
+
+ /*
+ * daemonize
+ */
+ if (!dont_fork) {
+ int rc = netsnmp_daemonize(1, !use_syslog);
+ if (rc)
+ exit(-1);
+ }
+
+ /*
+ * initialize tcp/ip if necessary
+ */
+ SOCK_STARTUP;
+
+ /*
+ * initialize the agent library
+ */
+ init_agent("ipv4InterfaceTable");
+
+ /*
+ * init ipv4InterfaceTable mib code
+ */
+ init_ipv4InterfaceTable();
+
+ /*
+ * read ipv4InterfaceTable.conf files.
+ */
+ init_snmp("ipv4InterfaceTable");
+
+ /*
+ * If we're going to be a snmp master agent, initial the ports
+ */
+ if (!agentx_subagent)
+ init_master_agent(); /* open the port to listen on (defaults to udp:161) */
+
+ /*
+ * In case we recevie a request to stop (kill -TERM or kill -INT)
+ */
+ keep_running = 1;
+ signal(SIGTERM, stop_server);
+ signal(SIGINT, stop_server);
+
+ /*
+ * you're main loop here...
+ */
+ while (keep_running) {
+ /*
+ * if you use select(), see snmp_select_info() in snmp_api(3)
+ */
+ /*
+ * --- OR ---
+ */
+ agent_check_and_process(1); /* 0 == don't block */
+ }
+
+ /*
+ * at shutdown time
+ */
+ snmp_shutdown("ipv4InterfaceTable");
+ SOCK_CLEANUP;
+ exit(0);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable.h
new file mode 100644
index 0000000000..471eaa0f40
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable.h
@@ -0,0 +1,5 @@
+/*
+ * module to include the modules
+ */
+
+config_require(ip-mib/ipv6InterfaceTable/ipv6InterfaceTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable.c
new file mode 100644
index 0000000000..abc08ada37
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable.c
@@ -0,0 +1,1418 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: ipv6InterfaceTable.c 15946 2007-03-12 21:28:23Z dts12 $
+ */
+/** \page MFD helper for ipv6InterfaceTable
+ *
+ * \section intro Introduction
+ * Introductory text.
+ *
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipv6InterfaceTable.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "ipv6InterfaceTable_interface.h"
+
+oid ipv6InterfaceTable_oid[] = { IPV6INTERFACETABLE_OID };
+int ipv6InterfaceTable_oid_size =
+OID_LENGTH(ipv6InterfaceTable_oid);
+
+ipv6InterfaceTable_registration ipv6InterfaceTable_user_context;
+
+void initialize_table_ipv6InterfaceTable(void);
+void shutdown_table_ipv6InterfaceTable(void);
+
+
+/**
+ * Initializes the ipv6InterfaceTable module
+ */
+void
+init_ipv6InterfaceTable(void)
+{
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:init_ipv6InterfaceTable",
+ "called\n"));
+
+ /*
+ * TODO:300:o: Perform ipv6InterfaceTable one-time module initialization.
+ */
+
+ /*
+ * we depend on the ifTable, so we put our init in with it
+ * to guarantee order of execution.
+ */
+ init_ifTable();
+
+ /*
+ * last changed should be 0 at startup
+ */
+ ipv6InterfaceTable_lastChange_set(0);
+
+} /* init_ipv6InterfaceTable */
+
+/**
+ * Shut-down the ipv6InterfaceTable module (agent is exiting)
+ */
+void
+shutdown_ipv6InterfaceTable(void)
+{
+ if (should_init("ipv6InterfaceTable"))
+ shutdown_table_ipv6InterfaceTable();
+
+}
+
+/**
+ * Initialize the table ipv6InterfaceTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_ipv6InterfaceTable(void)
+{
+ ipv6InterfaceTable_registration *user_context;
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:initialize_table_ipv6InterfaceTable", "called\n"));
+
+ /*
+ * TODO:301:o: Perform ipv6InterfaceTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize ipv6InterfaceTable user context
+ * if you'd like to pass in a pointer to some data for this
+ * table, allocate or set it up here.
+ */
+ /*
+ * a netsnmp_data_list is a simple way to store void pointers. A simple
+ * string token is used to add, find or remove pointers.
+ */
+ user_context =
+ netsnmp_create_data_list("ipv6InterfaceTable", NULL, NULL);
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _ipv6InterfaceTable_initialize_interface(user_context, flags);
+} /* initialize_table_ipv6InterfaceTable */
+
+/**
+ * Shutdown the table ipv6InterfaceTable
+ */
+void
+shutdown_table_ipv6InterfaceTable(void)
+{
+ /*
+ * call interface shutdown code
+ */
+ _ipv6InterfaceTable_shutdown_interface
+ (&ipv6InterfaceTable_user_context);
+}
+
+/**
+ * extra context initialization (eg default values)
+ *
+ * @param rowreq_ctx : row request context
+ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
+ *
+ * @retval MFD_SUCCESS : no errors
+ * @retval MFD_ERROR : error (context allocate will fail)
+ */
+int
+ipv6InterfaceTable_rowreq_ctx_init(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx, void *user_init_ctx)
+{
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_rowreq_ctx_init", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:210:o: |-> Perform extra ipv6InterfaceTable rowreq initialization. (eg DEFVALS)
+ */
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceTable_rowreq_ctx_init */
+
+/**
+ * extra context cleanup
+ * @param rowreq_ctx
+ */
+void
+ipv6InterfaceTable_rowreq_ctx_cleanup(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_rowreq_ctx_cleanup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:211:o: |-> Perform extra ipv6InterfaceTable rowreq cleanup.
+ */
+} /* ipv6InterfaceTable_rowreq_ctx_cleanup */
+
+/**
+ * pre-request callback
+ *
+ * @param user_context
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+ipv6InterfaceTable_pre_request(ipv6InterfaceTable_registration *
+ user_context)
+{
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_pre_request", "called\n"));
+
+ /*
+ * TODO:510:o: Perform ipv6InterfaceTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ * Note:
+ * New rows have been inserted into the container, and
+ * deleted rows have been removed from the container and
+ * released.
+ * @param user_context
+ * @param rc : MFD_SUCCESS if all requests succeeded
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+ipv6InterfaceTable_post_request(ipv6InterfaceTable_registration *
+ user_context, int rc)
+{
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_post_request", "called\n"));
+
+ /*
+ * TODO:511:o: Perform ipv6InterfaceTable post-request actions.
+ */
+
+ /*
+ * check to set if any rows were changed.
+ */
+ if (ipv6InterfaceTable_dirty_get()) {
+ /*
+ * check if request was successful. If so, this would be
+ * a good place to save data to its persistent store.
+ */
+ if (MFD_SUCCESS == rc) {
+ /*
+ * save changed rows, if you haven't already
+ */
+ }
+
+ ipv6InterfaceTable_dirty_set(0); /* clear table dirty flag */
+ }
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceTable_post_request */
+
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipv6InterfaceTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipv6InterfaceTable is subid 30 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.30, length: 8
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement ipv6InterfaceTable data context functions.
+ */
+
+
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceReasmMaxSize
+ * ipv6InterfaceReasmMaxSize is subid 2 of ipv6InterfaceEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.30.1.2
+ * Description:
+The size of the largest IPv6 datagram which this entity can
+ re-assemble from incoming IPv6 fragmented datagrams received
+ on this interface.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 0
+ * settable 0
+ *
+ * Ranges: 1500 - 65535;
+ *
+ * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32)
+ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipv6InterfaceReasmMaxSize data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipv6InterfaceReasmMaxSize_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipv6InterfaceReasmMaxSize_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipv6InterfaceReasmMaxSize_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipv6InterfaceReasmMaxSize_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceReasmMaxSize_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (!
+ (rowreq_ctx->data.ifentry->
+ ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_REASMMAX))
+ return MFD_SKIP;
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipv6InterfaceReasmMaxSize data.
+ * copy (* ipv6InterfaceReasmMaxSize_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipv6InterfaceReasmMaxSize_val_ptr) =
+ rowreq_ctx->data.ipv6InterfaceReasmMaxSize;
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceReasmMaxSize_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceIdentifier
+ * ipv6InterfaceIdentifier is subid 3 of ipv6InterfaceEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.30.1.3
+ * Description:
+The Interface Identifier for this interface. The Interface
+ Identifier is combined with an address prefix to form an
+ interface address.
+
+
+ By default, the Interface Identifier is auto-configured
+ according to the rules of the link type this interface is
+ attached to.
+
+
+ A zero length identifier may be used where appropriate. One
+ possible example is a loopback interface.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 1
+ * settable 0
+ * hint: 2x:
+ *
+ * Ranges: 0 - 8;
+ *
+ * Its syntax is Ipv6AddressIfIdentifierTC (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 8)
+ */
+/**
+ * Extract the current value of the ipv6InterfaceIdentifier data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipv6InterfaceIdentifier_val_ptr_ptr
+ * Pointer to storage for a char variable
+ * @param ipv6InterfaceIdentifier_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by ipv6InterfaceIdentifier.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*ipv6InterfaceIdentifier_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update ipv6InterfaceIdentifier_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+ipv6InterfaceIdentifier_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx,
+ char **ipv6InterfaceIdentifier_val_ptr_ptr,
+ size_t
+ * ipv6InterfaceIdentifier_val_ptr_len_ptr)
+{
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert((NULL != ipv6InterfaceIdentifier_val_ptr_ptr)
+ && (NULL != *ipv6InterfaceIdentifier_val_ptr_ptr));
+ netsnmp_assert(NULL != ipv6InterfaceIdentifier_val_ptr_len_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceIdentifier_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (!
+ (rowreq_ctx->data.ifentry->
+ ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_IFID))
+ return MFD_SKIP;
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipv6InterfaceIdentifier data.
+ * copy (* ipv6InterfaceIdentifier_val_ptr_ptr ) data and (* ipv6InterfaceIdentifier_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * make sure there is enough space for ipv6InterfaceIdentifier data
+ */
+ if ((NULL == (*ipv6InterfaceIdentifier_val_ptr_ptr)) ||
+ ((*ipv6InterfaceIdentifier_val_ptr_len_ptr) <
+ (rowreq_ctx->data.ipv6InterfaceIdentifier_len *
+ sizeof(rowreq_ctx->data.ipv6InterfaceIdentifier[0])))) {
+ /*
+ * allocate space for ipv6InterfaceIdentifier data
+ */
+ (*ipv6InterfaceIdentifier_val_ptr_ptr) =
+ malloc(rowreq_ctx->data.ipv6InterfaceIdentifier_len *
+ sizeof(rowreq_ctx->data.ipv6InterfaceIdentifier[0]));
+ if (NULL == (*ipv6InterfaceIdentifier_val_ptr_ptr)) {
+ snmp_log(LOG_ERR, "could not allocate memory\n");
+ return MFD_ERROR;
+ }
+ }
+ (*ipv6InterfaceIdentifier_val_ptr_len_ptr) =
+ rowreq_ctx->data.ipv6InterfaceIdentifier_len *
+ sizeof(rowreq_ctx->data.ipv6InterfaceIdentifier[0]);
+ memcpy((*ipv6InterfaceIdentifier_val_ptr_ptr),
+ rowreq_ctx->data.ipv6InterfaceIdentifier,
+ rowreq_ctx->data.ipv6InterfaceIdentifier_len *
+ sizeof(rowreq_ctx->data.ipv6InterfaceIdentifier[0]));
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceIdentifier_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceEnableStatus
+ * ipv6InterfaceEnableStatus is subid 5 of ipv6InterfaceEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.4.30.1.5
+ * Description:
+The indication of whether IPv6 is enabled (up) or disabled
+ (down) on this interface. This object does not affect the
+ state of the interface itself, only its connection to an
+ IPv6 stack. The IF-MIB should be used to control the state
+ of the interface.
+
+
+ When this object is written the entity SHOULD save the
+ change to non-volatile storage and restore the object from
+ non-volatile storage upon re-initialization of the system.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 1/8. Values: up(1), down(2)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ipv6InterfaceEnableStatus data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipv6InterfaceEnableStatus_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipv6InterfaceEnableStatus_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipv6InterfaceEnableStatus_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipv6InterfaceEnableStatus_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceEnableStatus_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipv6InterfaceEnableStatus data.
+ * copy (* ipv6InterfaceEnableStatus_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipv6InterfaceEnableStatus_val_ptr) =
+ rowreq_ctx->data.ipv6InterfaceEnableStatus;
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceEnableStatus_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceReachableTime
+ * ipv6InterfaceReachableTime is subid 6 of ipv6InterfaceEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.30.1.6
+ * Description:
+The time a neighbor is considered reachable after receiving
+ a reachability confirmation.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32)
+ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipv6InterfaceReachableTime data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipv6InterfaceReachableTime_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipv6InterfaceReachableTime_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipv6InterfaceReachableTime_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipv6InterfaceReachableTime_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceReachableTime_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (!
+ (rowreq_ctx->data.ifentry->
+ ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_REACHABLE))
+ return MFD_SKIP;
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipv6InterfaceReachableTime data.
+ * copy (* ipv6InterfaceReachableTime_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipv6InterfaceReachableTime_val_ptr) =
+ rowreq_ctx->data.ipv6InterfaceReachableTime;
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceReachableTime_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceRetransmitTime
+ * ipv6InterfaceRetransmitTime is subid 7 of ipv6InterfaceEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.4.30.1.7
+ * Description:
+The time between retransmissions of Neighbor Solicitation
+ messages to a neighbor when resolving the address or when
+ probing the reachability of a neighbor.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32)
+ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the ipv6InterfaceRetransmitTime data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipv6InterfaceRetransmitTime_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipv6InterfaceRetransmitTime_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx,
+ u_long *
+ ipv6InterfaceRetransmitTime_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipv6InterfaceRetransmitTime_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceRetransmitTime_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (!
+ (rowreq_ctx->data.ifentry->
+ ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_RETRANSMIT))
+ return MFD_SKIP;
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipv6InterfaceRetransmitTime data.
+ * copy (* ipv6InterfaceRetransmitTime_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipv6InterfaceRetransmitTime_val_ptr) =
+ rowreq_ctx->data.ipv6InterfaceRetransmitTime;
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceRetransmitTime_get */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceForwarding
+ * ipv6InterfaceForwarding is subid 8 of ipv6InterfaceEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.4.30.1.8
+ * Description:
+The indication of whether this entity is acting as an IPv6
+ router on this interface with respect to the forwarding of
+ datagrams received by, but not addressed to, this entity.
+ IPv6 routers forward datagrams. IPv6 hosts do not (except
+ those source-routed via the host).
+
+
+
+
+
+ This object is constrained by ipv6IpForwarding and is
+ ignored if ipv6IpForwarding is set to notForwarding. Those
+ systems that do not provide per-interface control of the
+ forwarding function should set this object to forwarding for
+ all interfaces and allow the ipv6IpForwarding object to
+ control the forwarding capability.
+
+
+ When this object is written the entity SHOULD save the
+ change to non-volatile storage and restore the object from
+ non-volatile storage upon re-initialization of the system.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 2/8. Values: forwarding(1), notForwarding(2)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the ipv6InterfaceForwarding data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipv6InterfaceForwarding_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+ipv6InterfaceForwarding_get(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx,
+ u_long * ipv6InterfaceForwarding_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != ipv6InterfaceForwarding_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceForwarding_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (!
+ (rowreq_ctx->data.ifentry->
+ ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_FORWARDING))
+ return MFD_SKIP;
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the ipv6InterfaceForwarding data.
+ * copy (* ipv6InterfaceForwarding_val_ptr ) from rowreq_ctx->data
+ */
+ (*ipv6InterfaceForwarding_val_ptr) =
+ rowreq_ctx->data.ipv6InterfaceForwarding;
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceForwarding_get */
+
+
+
+/** @} */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipv6InterfaceTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipv6InterfaceTable is subid 30 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.30, length: 8
+ */
+ /*
+ * NOTE: if you update this chart, please update the versions in
+ * local/mib2c-conf.d/parent-set.m2i
+ * agent/mibgroup/helpers/baby_steps.c
+ * while you're at it.
+ */
+ /*
+ ***********************************************************************
+ * Baby Steps Flow Chart (2004.06.05) *
+ * *
+ * +--------------+ +================+ U = unconditional path *
+ * |optional state| ||required state|| S = path for success *
+ * +--------------+ +================+ E = path for error *
+ ***********************************************************************
+ *
+ * +--------------+
+ * | pre |
+ * | request |
+ * +--------------+
+ * | U
+ * +==============+
+ * +----------------|| object ||
+ * | E || lookup ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | E || check ||
+ * |<---------------|| values ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | +<-------|| undo ||
+ * | | E || setup ||
+ * | | +==============+
+ * | | | S
+ * | | +==============+
+ * | | || set ||-------------------------->+
+ * | | || value || E |
+ * | | +==============+ |
+ * | | | S |
+ * | | +--------------+ |
+ * | | | check |-------------------------->|
+ * | | | consistency | E |
+ * | | +--------------+ |
+ * | | | S |
+ * | | +==============+ +==============+ |
+ * | | || commit ||-------->|| undo || |
+ * | | || || E || commit || |
+ * | | +==============+ +==============+ |
+ * | | | S U |<--------+
+ * | | +--------------+ +==============+
+ * | | | irreversible | || undo ||
+ * | | | commit | || set ||
+ * | | +--------------+ +==============+
+ * | | | U U |
+ * | +-------------->|<------------------------+
+ * | +==============+
+ * | || undo ||
+ * | || cleanup ||
+ * | +==============+
+ * +---------------------->| U
+ * +--------------+
+ * | post |
+ * | request |
+ * +--------------+
+ *
+ */
+
+/**
+ * Setup up context with information needed to undo a set request.
+ *
+ * This function will be called before the individual node undo setup
+ * functions are called. If you need to do any undo setup that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that the undo context has been allocated with
+ * ipv6InterfaceTable_allocate_data(), but may need extra
+ * initialization similar to what you may have done in
+ * ipv6InterfaceTable_rowreq_ctx_init().
+ * Note that an individual node's undo_setup function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in the node's undo_setup
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipv6InterfaceTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+ipv6InterfaceTable_undo_setup(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_undo_setup",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> Setup ipv6InterfaceTable undo.
+ * set up ipv6InterfaceTable undo information, in preparation for a set.
+ * Undo storage is in (* ipv6InterfaceForwarding_val_ptr )*
+ */
+
+ return rc;
+} /* ipv6InterfaceTable_undo_setup */
+
+/**
+ * Undo a set request.
+ *
+ * This function will be called before the individual node undo
+ * functions are called. If you need to do any undo that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that an individual node's undo function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is anything specific to a particular column (e.g. releasing
+ * memory for a string), you should do that setup in the node's undo
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipv6InterfaceTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+ipv6InterfaceTable_undo(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_undo",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> ipv6InterfaceTable undo.
+ * ipv6InterfaceTable undo information, in response to a failed set.
+ * Undo storage is in (* ipv6InterfaceForwarding_val_ptr )*
+ */
+
+ return rc;
+} /* ipv6InterfaceTable_undo_setup */
+
+/**
+ * Cleanup up context undo information.
+ *
+ * This function will be called after set/commit processing. If you
+ * allocated any resources in undo_setup, this is the place to release
+ * those resources.
+ *
+ * This function is called regardless of the success or failure of the set
+ * request. If you need to perform different steps for cleanup depending
+ * on success or failure, you can add a flag to the rowreq_ctx.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipv6InterfaceTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ipv6InterfaceTable_undo_cleanup(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_undo_cleanup", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:452:M: |-> Cleanup ipv6InterfaceTable undo.
+ * Undo storage is in (* ipv6InterfaceForwarding_val_ptr )*
+ */
+
+ return rc;
+} /* ipv6InterfaceTable_undo_cleanup */
+
+/**
+ * commit new values.
+ *
+ * At this point, you should have done everything you can to ensure that
+ * this commit will not fail.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * ipv6InterfaceTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ipv6InterfaceTable_commit(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+ int save_flags;
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_commit",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * save flags, then clear until we actually do something
+ */
+ save_flags = rowreq_ctx->column_set_flags;
+ rowreq_ctx->column_set_flags = 0;
+
+ /*
+ * commit ipv6InterfaceTable data
+ * 1) check the column's flag in save_flags to see if it was set.
+ * 2) clear the flag when you handle that column
+ * 3) set the column's flag in column_set_flags if it needs undo
+ * processing in case of a failure.
+ */
+ if (save_flags & COLUMN_IPV6INTERFACEENABLESTATUS_FLAG) {
+ save_flags &= ~COLUMN_IPV6INTERFACEENABLESTATUS_FLAG; /* clear ipv6InterfaceEnableStatus */
+ /*
+ * TODO:482:o: |-> commit column ipv6InterfaceEnableStatus.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "ipv6InterfaceTable column ipv6InterfaceEnableStatus commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo ipv6InterfaceEnableStatus
+ */
+ rowreq_ctx->column_set_flags |=
+ COLUMN_IPV6INTERFACEENABLESTATUS_FLAG;
+ }
+ }
+
+ if (save_flags & COLUMN_IPV6INTERFACEFORWARDING_FLAG) {
+ save_flags &= ~COLUMN_IPV6INTERFACEFORWARDING_FLAG; /* clear ipv6InterfaceForwarding */
+ /*
+ * TODO:482:o: |-> commit column ipv6InterfaceForwarding.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "ipv6InterfaceTable column ipv6InterfaceForwarding commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo ipv6InterfaceForwarding
+ */
+ rowreq_ctx->column_set_flags |=
+ COLUMN_IPV6INTERFACEFORWARDING_FLAG;
+ }
+ }
+
+ /*
+ * if we successfully commited this row, set the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY;
+ }
+
+ if (save_flags) {
+ snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n",
+ save_flags);
+ return MFD_ERROR;
+ }
+
+ return rc;
+} /* ipv6InterfaceTable_commit */
+
+/**
+ * undo commit new values.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * ipv6InterfaceTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+ipv6InterfaceTable_undo_commit(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_undo_commit", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:485:M: |-> Undo ipv6InterfaceTable commit.
+ * check the column's flag in rowreq_ctx->column_set_flags to see
+ * if it was set during commit, then undo it.
+ *
+ * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
+ */
+
+
+ /*
+ * if we successfully un-commited this row, clear the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return rc;
+} /* ipv6InterfaceTable_undo_commit */
+
+/*
+ * TODO:440:M: Implement ipv6InterfaceTable node value checks.
+ * TODO:450:M: Implement ipv6InterfaceTable undo functions.
+ * TODO:460:M: Implement ipv6InterfaceTable set functions.
+ * TODO:480:M: Implement ipv6InterfaceTable commit functions.
+ */
+/*---------------------------------------------------------------------
+ * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceEnableStatus
+ * ipv6InterfaceEnableStatus is subid 5 of ipv6InterfaceEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.4.30.1.5
+ * Description:
+The indication of whether IPv6 is enabled (up) or disabled
+ (down) on this interface. This object does not affect the
+ state of the interface itself, only its connection to an
+ IPv6 stack. The IF-MIB should be used to control the state
+ of the interface.
+
+
+ When this object is written the entity SHOULD save the
+ change to non-volatile storage and restore the object from
+ non-volatile storage upon re-initialization of the system.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 1/8. Values: up(1), down(2)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipv6InterfaceEnableStatus_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipv6InterfaceTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of up(1), down(2)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipv6InterfaceEnableStatus_check_value(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipv6InterfaceEnableStatus_val)
+{
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceEnableStatus_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipv6InterfaceEnableStatus value.
+ */
+
+ return MFD_SUCCESS; /* ipv6InterfaceEnableStatus value not illegal */
+} /* ipv6InterfaceEnableStatus_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipv6InterfaceTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipv6InterfaceTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipv6InterfaceEnableStatus_undo_setup(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceEnableStatus_undo_setup", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipv6InterfaceEnableStatus undo.
+ */
+ /*
+ * copy ipv6InterfaceEnableStatus data
+ * set rowreq_ctx->undo->ipv6InterfaceEnableStatus from rowreq_ctx->data.ipv6InterfaceEnableStatus
+ */
+ rowreq_ctx->undo->ipv6InterfaceEnableStatus =
+ rowreq_ctx->data.ipv6InterfaceEnableStatus;
+
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceEnableStatus_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipv6InterfaceEnableStatus_val
+ * A long containing the new value.
+ */
+int
+ipv6InterfaceEnableStatus_set(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx,
+ u_long ipv6InterfaceEnableStatus_val)
+{
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceEnableStatus_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipv6InterfaceEnableStatus value.
+ * set ipv6InterfaceEnableStatus value in rowreq_ctx->data
+ */
+ rowreq_ctx->data.ipv6InterfaceEnableStatus =
+ ipv6InterfaceEnableStatus_val;
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceEnableStatus_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipv6InterfaceEnableStatus_undo(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceEnableStatus_undo", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipv6InterfaceEnableStatus undo.
+ */
+ /*
+ * copy ipv6InterfaceEnableStatus data
+ * set rowreq_ctx->data.ipv6InterfaceEnableStatus from rowreq_ctx->undo->ipv6InterfaceEnableStatus
+ */
+ rowreq_ctx->data.ipv6InterfaceEnableStatus =
+ rowreq_ctx->undo->ipv6InterfaceEnableStatus;
+
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceEnableStatus_undo */
+
+/*---------------------------------------------------------------------
+ * IP-MIB::ipv6InterfaceEntry.ipv6InterfaceForwarding
+ * ipv6InterfaceForwarding is subid 8 of ipv6InterfaceEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.4.30.1.8
+ * Description:
+The indication of whether this entity is acting as an IPv6
+ router on this interface with respect to the forwarding of
+ datagrams received by, but not addressed to, this entity.
+ IPv6 routers forward datagrams. IPv6 hosts do not (except
+ those source-routed via the host).
+
+
+
+
+
+ This object is constrained by ipv6IpForwarding and is
+ ignored if ipv6IpForwarding is set to notForwarding. Those
+ systems that do not provide per-interface control of the
+ forwarding function should set this object to forwarding for
+ all interfaces and allow the ipv6IpForwarding object to
+ control the forwarding capability.
+
+
+ When this object is written the entity SHOULD save the
+ change to non-volatile storage and restore the object from
+ non-volatile storage upon re-initialization of the system.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 2/8. Values: forwarding(1), notForwarding(2)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param ipv6InterfaceForwarding_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * ipv6InterfaceTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of forwarding(1), notForwarding(2)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+ipv6InterfaceForwarding_check_value(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipv6InterfaceForwarding_val)
+{
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceForwarding_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid ipv6InterfaceForwarding value.
+ */
+
+ return MFD_SUCCESS; /* ipv6InterfaceForwarding value not illegal */
+} /* ipv6InterfaceForwarding_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (ipv6InterfaceTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * ipv6InterfaceTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+ipv6InterfaceForwarding_undo_setup(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceForwarding_undo_setup", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup ipv6InterfaceForwarding undo.
+ */
+ /*
+ * copy ipv6InterfaceForwarding data
+ * set rowreq_ctx->undo->ipv6InterfaceForwarding from rowreq_ctx->data.ipv6InterfaceForwarding
+ */
+ rowreq_ctx->undo->ipv6InterfaceForwarding =
+ rowreq_ctx->data.ipv6InterfaceForwarding;
+
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceForwarding_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param ipv6InterfaceForwarding_val
+ * A long containing the new value.
+ */
+int
+ipv6InterfaceForwarding_set(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx,
+ u_long ipv6InterfaceForwarding_val)
+{
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceForwarding_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set ipv6InterfaceForwarding value.
+ * set ipv6InterfaceForwarding value in rowreq_ctx->data
+ */
+ rowreq_ctx->data.ipv6InterfaceForwarding = ipv6InterfaceForwarding_val;
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceForwarding_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+ipv6InterfaceForwarding_undo(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceForwarding_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up ipv6InterfaceForwarding undo.
+ */
+ /*
+ * copy ipv6InterfaceForwarding data
+ * set rowreq_ctx->data.ipv6InterfaceForwarding from rowreq_ctx->undo->ipv6InterfaceForwarding
+ */
+ rowreq_ctx->data.ipv6InterfaceForwarding =
+ rowreq_ctx->undo->ipv6InterfaceForwarding;
+
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceForwarding_undo */
+
+/** @} */
+/** @{ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable.h
new file mode 100644
index 0000000000..3b2ef5cc17
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable.h
@@ -0,0 +1,970 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: ipv6InterfaceTable.h 15205 2006-09-14 17:15:32Z rstory $
+ */
+#ifndef IPV6INTERFACETABLE_H
+#define IPV6INTERFACETABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @addtogroup misc misc: Miscellaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/data_access/interface.h>
+
+#include "if-mib/ifTable/ifTable.h"
+
+ /*
+ * other required module components
+ */
+ /* *INDENT-OFF* */
+config_require(if-mib/ifTable/ifTable)
+config_require(ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface)
+config_require(ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access)
+ /* *INDENT-ON* */
+
+ /*
+ * OID, column number and enum definions for ipv6InterfaceTable
+ */
+#include "ipv6InterfaceTable_constants.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_ipv6InterfaceTable(void);
+ void shutdown_ipv6InterfaceTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipv6InterfaceTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipv6InterfaceTable is subid 30 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.30, length: 8
+ *
+ * we share data structures (data too, in fact) with ifTable
+ */
+ typedef ifTable_registration ipv6InterfaceTable_registration;
+ typedef ifTable_data ipv6InterfaceTable_data;
+ typedef ifTable_undo_data ipv6InterfaceTable_undo_data;
+ typedef ifTable_mib_index ipv6InterfaceTable_mib_index;
+ typedef ifTable_rowreq_ctx ipv6InterfaceTable_rowreq_ctx;
+
+ /*
+ * ipv6InterfaceReasmMaxSize(2)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/R/d/h
+ */
+#define ipv6InterfaceReasmMaxSize ifentry->reasm_max_v6
+
+ /*
+ * ipv6InterfaceIdentifier(3)/Ipv6AddressIfIdentifierTC/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H
+ */
+
+#define ipv6InterfaceIdentifier ifentry->v6_if_id
+#define ipv6InterfaceIdentifier_len ifentry->v6_if_id_len
+
+ /*
+ * ipv6InterfaceEnableStatus(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+#define ipv6InterfaceEnableStatus ifentry->admin_status
+
+ /*
+ * ipv6InterfaceReachableTime(6)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+#define ipv6InterfaceReachableTime ifentry->reachable_time
+
+ /*
+ * ipv6InterfaceRetransmitTime(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+#define ipv6InterfaceRetransmitTime ifentry->retransmit_v6
+
+ /*
+ * ipv6InterfaceForwarding(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+#define ipv6InterfaceForwarding ifentry->forwarding_v6
+
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceTable_pre_request(ipv6InterfaceTable_registration *
+ user_context);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceTable_post_request(ipv6InterfaceTable_registration *
+ user_context, int rc);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceTable_rowreq_ctx_init(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ void *user_init_ctx);
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceTable_rowreq_ctx_cleanup(ipv6InterfaceTable_rowreq_ctx
+ * rowreq_ctx);
+
+ int ipv6InterfaceTable_commit(ipv6InterfaceTable_rowreq_ctx
+ * rowreq_ctx);
+
+
+
+
+
+
+
+ ipv6InterfaceTable_rowreq_ctx
+ * ipv6InterfaceTable_row_find_by_mib_index
+ (ipv6InterfaceTable_mib_index * mib_idx);
+
+ extern oid ipv6InterfaceTable_oid[];
+ extern int ipv6InterfaceTable_oid_size;
+
+
+#include "ipv6InterfaceTable_interface.h"
+#include "ipv6InterfaceTable_data_access.h"
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipv6InterfaceTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipv6InterfaceTable is subid 30 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.30, length: 8
+ */
+ /*
+ * indexes
+ */
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceReasmMaxSize_get(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipv6InterfaceReasmMaxSize_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceIdentifier_get(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx, char
+ **ipv6InterfaceIdentifier_val_ptr_ptr,
+ size_t
+ *
+ ipv6InterfaceIdentifier_val_ptr_len_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceEnableStatus_get(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipv6InterfaceEnableStatus_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceReachableTime_get(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipv6InterfaceReachableTime_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceRetransmitTime_get(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipv6InterfaceRetransmitTime_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceForwarding_get(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ ipv6InterfaceForwarding_val_ptr);
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceTable_indexes_set_tbl_idx(ipv6InterfaceTable_mib_index
+ * tbl_idx, long
+ ipv6InterfaceIfIndex_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceTable_indexes_set(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ long ipv6InterfaceIfIndex_val);
+
+
+
+ /*
+ *********************************************************************
+ * SET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * SET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipv6InterfaceTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipv6InterfaceTable is subid 30 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.30, length: 8
+ */
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceTable_undo_setup(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceTable_undo_cleanup(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipv6InterfaceTable_undo(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+ int ipv6InterfaceTable_commit(ipv6InterfaceTable_rowreq_ctx
+ * rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceTable_undo_commit(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceReasmMaxSize_check_value(ipv6InterfaceTable_rowreq_ctx
+ * rowreq_ctx,
+ u_long
+ ipv6InterfaceReasmMaxSize_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceReasmMaxSize_undo_setup(ipv6InterfaceTable_rowreq_ctx
+ * rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceReasmMaxSize_set(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ipv6InterfaceReasmMaxSize_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceReasmMaxSize_undo(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceIdentifier_check_value(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx, char
+ *ipv6InterfaceIdentifier_val_ptr,
+ size_t
+ ipv6InterfaceIdentifier_val_ptr_len);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceIdentifier_undo_setup(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceIdentifier_set(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ char *ipv6InterfaceIdentifier_val_ptr,
+ size_t
+ ipv6InterfaceIdentifier_val_ptr_len);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceIdentifier_undo(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceEnableStatus_check_value(ipv6InterfaceTable_rowreq_ctx
+ * rowreq_ctx,
+ u_long
+ ipv6InterfaceEnableStatus_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceEnableStatus_undo_setup(ipv6InterfaceTable_rowreq_ctx
+ * rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceEnableStatus_set(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ipv6InterfaceEnableStatus_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceEnableStatus_undo(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceReachableTime_check_value
+ (ipv6InterfaceTable_rowreq_ctx * rowreq_ctx,
+ u_long ipv6InterfaceReachableTime_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceReachableTime_undo_setup(ipv6InterfaceTable_rowreq_ctx
+ * rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceReachableTime_set(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ipv6InterfaceReachableTime_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceReachableTime_undo(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceRetransmitTime_check_value
+ (ipv6InterfaceTable_rowreq_ctx * rowreq_ctx,
+ u_long ipv6InterfaceRetransmitTime_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceRetransmitTime_undo_setup
+ (ipv6InterfaceTable_rowreq_ctx * rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceRetransmitTime_set(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ipv6InterfaceRetransmitTime_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceRetransmitTime_undo(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceForwarding_check_value(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ ipv6InterfaceForwarding_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceForwarding_undo_setup(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceForwarding_set(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long ipv6InterfaceForwarding_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceForwarding_undo(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceTable_check_dependencies(ipv6InterfaceTable_rowreq_ctx
+ * ctx);
+
+
+ /*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPV6INTERFACETABLE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_constants.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_constants.h
new file mode 100644
index 0000000000..bee70bdbad
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_constants.h
@@ -0,0 +1,104 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $
+ *
+ * $Id: ipv6InterfaceTable_constants.h 13897 2005-12-10 01:56:01Z rstory $
+ */
+#ifndef IPV6INTERFACETABLE_CONSTANTS_H
+#define IPV6INTERFACETABLE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ * column number definitions for table ipv6InterfaceTable
+ */
+#define IPV6INTERFACETABLELASTCHANGE_OID 1,3,6,1,2,1,4,29
+#define IPV6INTERFACETABLE_OID 1,3,6,1,2,1,4,30
+
+#define COLUMN_IPV6INTERFACEIFINDEX 1
+
+#define COLUMN_IPV6INTERFACEREASMMAXSIZE 2
+
+#define COLUMN_IPV6INTERFACEIDENTIFIER 3
+
+#define COLUMN_IPV6INTERFACEENABLESTATUS 5
+#define COLUMN_IPV6INTERFACEENABLESTATUS_FLAG (0x1 << 4)
+
+#define COLUMN_IPV6INTERFACEREACHABLETIME 6
+
+#define COLUMN_IPV6INTERFACERETRANSMITTIME 7
+
+#define COLUMN_IPV6INTERFACEFORWARDING 8
+#define COLUMN_IPV6INTERFACEFORWARDING_FLAG (0x1 << 7)
+
+
+#define IPV6INTERFACETABLE_MIN_COL COLUMN_IPV6INTERFACEREASMMAXSIZE
+#define IPV6INTERFACETABLE_MAX_COL COLUMN_IPV6INTERFACEFORWARDING
+
+
+ /*
+ * TODO:405:r: Review IPV6INTERFACETABLE_SETTABLE_COLS macro.
+ * OR together all the writable cols.
+ */
+#define IPV6INTERFACETABLE_SETTABLE_COLS (COLUMN_IPV6INTERFACEENABLESTATUS_FLAG | COLUMN_IPV6INTERFACEFORWARDING_FLAG)
+ /*
+ * NOTES on enums
+ * ==============
+ *
+ * Value Mapping
+ * -------------
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them
+ * below. For example, a boolean flag (1/0) is usually represented
+ * as a TruthValue in a MIB, which maps to the values (1/2).
+ *
+ */
+/*************************************************************************
+ *************************************************************************
+ *
+ * enum definitions for table ipv6InterfaceTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipv6InterfaceEnableStatus (INTEGER / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef IPV6INTERFACEENABLESTATUS_ENUMS
+#define IPV6INTERFACEENABLESTATUS_ENUMS
+
+#define IPV6INTERFACEENABLESTATUS_UP 1
+#define IPV6INTERFACEENABLESTATUS_DOWN 2
+
+#endif /* IPV6INTERFACEENABLESTATUS_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * ipv6InterfaceForwarding (INTEGER / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef IPV6INTERFACEFORWARDING_ENUMS
+#define IPV6INTERFACEFORWARDING_ENUMS
+
+#define IPV6INTERFACEFORWARDING_FORWARDING 1
+#define IPV6INTERFACEFORWARDING_NOTFORWARDING 2
+
+#endif /* IPV6INTERFACEFORWARDING_ENUMS */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPV6INTERFACETABLE_OIDS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access.c
new file mode 100644
index 0000000000..cf4568e94d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access.c
@@ -0,0 +1,390 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: ipv6InterfaceTable_data_access.c 15205 2006-09-14 17:15:32Z rstory $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipv6InterfaceTable.h"
+
+
+#include "ipv6InterfaceTable_data_access.h"
+
+/** @ingroup interface
+ * @addtogroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipv6InterfaceTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipv6InterfaceTable is subid 30 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.30, length: 8
+ */
+
+/**
+ * initialization for ipv6InterfaceTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param ipv6InterfaceTable_reg
+ * Pointer to ipv6InterfaceTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+ipv6InterfaceTable_init_data(ipv6InterfaceTable_registration *
+ ipv6InterfaceTable_reg)
+{
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_init_data",
+ "called\n"));
+
+ /*
+ * TODO:303:o: Initialize ipv6InterfaceTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceTable_init_data */
+
+/**
+ * container overview
+ *
+ */
+
+/**
+ * container initialization
+ *
+ * @param container_ptr_ptr A pointer to a container pointer. If you
+ * create a custom container, use this parameter to return it
+ * to the MFD helper. If set to NULL, the MFD helper will
+ * allocate a container for you.
+ *
+ * This function is called at startup to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases. If no custom
+ * container is allocated, the MFD code will create one for your.
+ *
+ * @remark
+ * This would also be a good place to do any initialization needed
+ * for you data source. For example, opening a connection to another
+ * process that will supply the data, opening a database, etc.
+ */
+void
+ipv6InterfaceTable_container_init(netsnmp_container **container_ptr_ptr)
+{
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_container_init", "called\n"));
+
+ if (NULL == container_ptr_ptr) {
+ snmp_log(LOG_ERR,
+ "bad container param to ipv6InterfaceTable_container_init\n");
+ return;
+ }
+
+ /*
+ * For advanced users, you can use a custom container. If you
+ * do not create one, one will be created for you.
+ */
+ *container_ptr_ptr = NULL;
+
+} /* ipv6InterfaceTable_container_init */
+
+/**
+ * @internal
+ * determine if we want a ifTable row in our container
+ */
+void
+ipv6InterfaceTable_check_entry_for_updates(const ifTable_rowreq_ctx *
+ ift_rrc,
+ netsnmp_interface_entry *entry)
+{
+ netsnmp_container *c = ipv6InterfaceTable_container_get();
+ ifTable_rowreq_ctx *ip6if_rrc;
+ int changed = 0;
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:check_entry_for_updates",
+ "called\n"));
+
+ /*
+ * do we have a corresponding row?
+ */
+ ip6if_rrc = CONTAINER_FIND(c, ift_rrc);
+ if (NULL == ip6if_rrc) {
+ /*
+ * no corresponding row. should we have one?
+ */
+ if ((NULL != entry) &&
+ (entry->ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_IPV6)) {
+ /*
+ * yes.
+ */
+ DEBUGMSGTL(("ipv6InterfaceTable:check_entry_for_updates",
+ "inserted row for index %d\n", entry->index));
+ CONTAINER_INSERT(c, ift_rrc);
+ changed = 1;
+ }
+ } else {
+ /*
+ * found corresponding row. is it still applicable?
+ */
+ if ((NULL == entry) ||
+ (0 == (entry->ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_IPV6))) {
+ /*
+ * no
+ */
+ DEBUGMSGTL(("ipv6InterfaceTable:check_entry_for_updates",
+ "removed row for index %d\n",
+ ift_rrc->data.ifentry->index));
+ CONTAINER_REMOVE(c, ift_rrc);
+ changed = 1;
+ } else {
+ /*
+ * still applicable. anything changed?
+ */
+ if (/** retransmit */
+ ((entry->
+ ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_RETRANSMIT)
+ && (entry->retransmit_v6 !=
+ ift_rrc->data.ifentry->retransmit_v6)) ||
+ /** reasm */
+ ((entry->
+ ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_REASMMAX)
+ && (entry->reasm_max_v6 !=
+ ift_rrc->data.ifentry->reasm_max_v6)) ||
+ /** reachable time */
+ ((entry->
+ ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_REACHABLE)
+ && (entry->reachable_time !=
+ ift_rrc->data.ifentry->reachable_time)) ||
+ /** if id */
+ ((entry->ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_IFID)
+ &&
+ ((entry->v6_if_id_len !=
+ ift_rrc->data.ifentry->v6_if_id_len)
+ || (0 !=
+ memcmp(entry->v6_if_id,
+ ift_rrc->data.ifentry->v6_if_id,
+ entry->v6_if_id_len)))) ||
+ /** forwarding */
+ ((entry->
+ ns_flags & NETSNMP_INTERFACE_FLAGS_HAS_V6_FORWARDING)
+ && (entry->forwarding_v6 !=
+ ift_rrc->data.ifentry->forwarding_v6))) {
+ DEBUGMSGTL(("ipv6InterfaceTable:check_entry_for_updates",
+ "row changed for index %d\n",
+ ift_rrc->data.ifentry->index));
+ changed = 1;
+ }
+ }
+ }
+
+ /*
+ * if something changed, update table last changed
+ */
+ if (changed)
+ ipv6InterfaceTable_lastChange_set(netsnmp_get_agent_uptime());
+}
+
+
+/**
+ * container shutdown
+ *
+ * @param container_ptr A pointer to the container.
+ *
+ * This function is called at shutdown to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases.
+ *
+ * This function is called before ipv6InterfaceTable_container_free().
+ *
+ * @remark
+ * This would also be a good place to do any cleanup needed
+ * for you data source. For example, closing a connection to another
+ * process that supplied the data, closing a database, etc.
+ */
+void
+ipv6InterfaceTable_container_shutdown(netsnmp_container *container_ptr)
+{
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_container_shutdown", "called\n"));
+
+ if (NULL == container_ptr) {
+ snmp_log(LOG_ERR,
+ "bad params to ipv6InterfaceTable_container_shutdown\n");
+ return;
+ }
+
+} /* ipv6InterfaceTable_container_shutdown */
+
+/**
+ * load initial data
+ *
+ * TODO:350:M: Implement ipv6InterfaceTable data load
+ *
+ * @param container container to which items should be inserted
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
+ * @retval MFD_ERROR : other error.
+ *
+ * This function is called to load the index(es) (and data, optionally)
+ * for the every row in the data set.
+ *
+ * @remark
+ * While loading the data, the only important thing is the indexes.
+ * If access to your data is cheap/fast (e.g. you have a pointer to a
+ * structure in memory), it would make sense to update the data here.
+ * If, however, the accessing the data invovles more work (e.g. parsing
+ * some other existing data, or peforming calculations to derive the data),
+ * then you can limit yourself to setting the indexes and saving any
+ * information you will need later. Then use the saved information in
+ * ipv6InterfaceTable_row_prep() for populating data.
+ *
+ * @note
+ * If you need consistency between rows (like you want statistics
+ * for each row to be from the same time frame), you should set all
+ * data here.
+ *
+ */
+int
+ipv6InterfaceTable_container_load(netsnmp_container *container)
+{
+ ipv6InterfaceTable_rowreq_ctx *rowreq_ctx;
+ size_t count = 0;
+
+ /*
+ * temporary storage for index values
+ */
+ /*
+ * ipv6InterfaceIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ long ipv6InterfaceIfIndex;
+
+
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_container_load", "called\n"));
+
+ /*
+ * TODO:351:M: |-> Load/update data in the ipv6InterfaceTable container.
+ * loop over your ipv6InterfaceTable data, allocate a rowreq context,
+ * set the index(es) [and data, optionally] and insert into
+ * the container.
+ */
+ while (1) {
+ /*
+ * check for end of data; bail out if there is no more data
+ */
+ if (1)
+ break;
+
+ /*
+ * TODO:352:M: | |-> set indexes in new ipv6InterfaceTable rowreq context.
+ * data context will be set from the param (unless NULL,
+ * in which case a new data context will be allocated)
+ */
+ rowreq_ctx = ipv6InterfaceTable_allocate_rowreq_ctx(NULL);
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "memory allocation failed\n");
+ return MFD_RESOURCE_UNAVAILABLE;
+ }
+ if (MFD_SUCCESS !=
+ ipv6InterfaceTable_indexes_set(rowreq_ctx,
+ ipv6InterfaceIfIndex)) {
+ snmp_log(LOG_ERR,
+ "error setting index while loading "
+ "ipv6InterfaceTable data.\n");
+ ipv6InterfaceTable_release_rowreq_ctx(rowreq_ctx);
+ continue;
+ }
+
+ /*
+ * TODO:352:r: | |-> populate ipv6InterfaceTable data context.
+ * Populate data context here. (optionally, delay until row prep)
+ */
+ /*
+ * non-TRANSIENT data: no need to copy. set pointer to data
+ */
+
+ /*
+ * insert into table container
+ */
+ CONTAINER_INSERT(container, rowreq_ctx);
+ ++count;
+ }
+
+ DEBUGMSGT(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_container_load", "inserted %d records\n", count));
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceTable_container_load */
+
+/**
+ * container clean up
+ *
+ * @param container container with all current items
+ *
+ * This optional callback is called prior to all
+ * item's being removed from the container. If you
+ * need to do any processing before that, do it here.
+ *
+ * @note
+ * The MFD helper will take care of releasing all the row contexts.
+ *
+ */
+void
+ipv6InterfaceTable_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_container_free", "called\n"));
+
+ /*
+ * TODO:380:M: Free ipv6InterfaceTable container data.
+ */
+} /* ipv6InterfaceTable_container_free */
+
+/**
+ * prepare row for processing.
+ *
+ * When the agent has located the row for a request, this function is
+ * called to prepare the row for processing. If you fully populated
+ * the data context during the index setup phase, you may not need to
+ * do anything.
+ *
+ * @param rowreq_ctx pointer to a context.
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ */
+int
+ipv6InterfaceTable_row_prep(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:ipv6InterfaceTable:ipv6InterfaceTable_row_prep",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+
+ return MFD_SUCCESS;
+} /* ipv6InterfaceTable_row_prep */
+
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access.h
new file mode 100644
index 0000000000..4ff94dc18b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_data_access.h
@@ -0,0 +1,92 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: ipv6InterfaceTable_data_access.h 13770 2005-12-01 20:54:19Z rstory $
+ */
+#ifndef IPV6INTERFACETABLE_DATA_ACCESS_H
+#define IPV6INTERFACETABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipv6InterfaceTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * IP-MIB::ipv6InterfaceTable is subid 30 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.30, length: 8
+ */
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceTable_init_data(ipv6InterfaceTable_registration *
+ ipv6InterfaceTable_reg);
+
+
+ void ipv6InterfaceTable_container_init(netsnmp_container
+ **container_ptr_ptr);
+ void ipv6InterfaceTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int ipv6InterfaceTable_container_load(netsnmp_container
+ *container);
+ void ipv6InterfaceTable_container_free(netsnmp_container
+ *container);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceTable_row_prep(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPV6INTERFACETABLE_DATA_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface.c
new file mode 100644
index 0000000000..41a95f80df
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface.c
@@ -0,0 +1,1390 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: ipv6InterfaceTable_interface.c 15902 2007-02-27 13:36:15Z rstory $
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "ipv6InterfaceTable.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "ipv6InterfaceTable_interface.h"
+
+#include "if-mib/ifTable/ifTable.h"
+
+#include <ctype.h>
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table ipv6InterfaceTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * IP-MIB::ipv6InterfaceTable is subid 30 of ip.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.4.30, length: 8
+ */
+typedef struct ipv6InterfaceTable_interface_ctx_s {
+
+ netsnmp_container *container;
+
+ ipv6InterfaceTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+ u_long last_changed;
+
+} ipv6InterfaceTable_interface_ctx;
+
+static ipv6InterfaceTable_interface_ctx ipv6InterfaceTable_if_ctx;
+
+static void
+ _ipv6InterfaceTable_container_init(ipv6InterfaceTable_interface_ctx *
+ if_ctx);
+static void
+ _ipv6InterfaceTable_container_shutdown(ipv6InterfaceTable_interface_ctx *
+ if_ctx);
+
+
+netsnmp_container *
+ipv6InterfaceTable_container_get(void)
+{
+ return ipv6InterfaceTable_if_ctx.container;
+}
+
+ipv6InterfaceTable_registration *
+ipv6InterfaceTable_registration_get(void)
+{
+ return ipv6InterfaceTable_if_ctx.user_ctx;
+}
+
+ipv6InterfaceTable_registration *
+ipv6InterfaceTable_registration_set(ipv6InterfaceTable_registration *
+ newreg)
+{
+ ipv6InterfaceTable_registration *old =
+ ipv6InterfaceTable_if_ctx.user_ctx;
+ ipv6InterfaceTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+
+int
+ipv6InterfaceTable_container_size(void)
+{
+ return CONTAINER_SIZE(ipv6InterfaceTable_if_ctx.container);
+}
+
+u_int
+ipv6InterfaceTable_dirty_get(void)
+{
+ return ifTable_dirty_get();
+}
+
+void
+ipv6InterfaceTable_dirty_set(u_int status)
+{
+ ifTable_dirty_set(status);
+}
+
+/*
+ * ipv6InterfaceTableLastChanged, which is the last time that a row in
+ * the table was changed or the last time a row was added/deleted from the
+ * table.
+ */
+void
+ipv6InterfaceTable_lastChange_set(u_long table_changed)
+{
+ DEBUGMSGTL(("ipv6InterfaceTable:lastChanged_set",
+ "called. was %ld, now %ld\n",
+ ipv6InterfaceTable_if_ctx.last_changed, table_changed));
+ ipv6InterfaceTable_if_ctx.last_changed = table_changed;
+}
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_pre_request;
+static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_post_request;
+static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_get_values;
+static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_check_objects;
+static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_undo_setup;
+static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_set_values;
+static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_undo_cleanup;
+static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_undo_values;
+static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_commit;
+static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_undo_commit;
+static Netsnmp_Node_Handler _mfd_ipv6InterfaceTable_irreversible_commit;
+
+NETSNMP_STATIC_INLINE int
+ _ipv6InterfaceTable_undo_column(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list *
+ var, int column);
+
+/**
+ * @internal
+ * Initialize the table ipv6InterfaceTable
+ * (Define its contents and how it's structured)
+ */
+void
+_ipv6InterfaceTable_initialize_interface(ipv6InterfaceTable_registration *
+ reg_ptr, u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &ipv6InterfaceTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info =
+ &ipv6InterfaceTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_initialize_interface", "called\n"));
+
+
+ /*************************************************
+ *
+ * save interface context for ipv6InterfaceTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
+ /** index: ipv6InterfaceIfIndex */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrival.
+ */
+ tbl_info->min_column = IPV6INTERFACETABLE_MIN_COL;
+ tbl_info->max_column = IPV6INTERFACETABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ ipv6InterfaceTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ ipv6InterfaceTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _ipv6InterfaceTable_container_init(&ipv6InterfaceTable_if_ctx);
+ if (NULL == ipv6InterfaceTable_if_ctx.container) {
+ snmp_log(LOG_ERR,
+ "could not initialize container for ipv6InterfaceTable\n");
+ return;
+ }
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup =
+ _mfd_ipv6InterfaceTable_object_lookup;
+ access_multiplexer->get_values = _mfd_ipv6InterfaceTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request = _mfd_ipv6InterfaceTable_pre_request;
+ access_multiplexer->post_request =
+ _mfd_ipv6InterfaceTable_post_request;
+
+
+ /*
+ * REQUIRED wrappers for set request handling
+ */
+ access_multiplexer->object_syntax_checks =
+ _mfd_ipv6InterfaceTable_check_objects;
+ access_multiplexer->undo_setup = _mfd_ipv6InterfaceTable_undo_setup;
+ access_multiplexer->undo_cleanup =
+ _mfd_ipv6InterfaceTable_undo_cleanup;
+ access_multiplexer->set_values = _mfd_ipv6InterfaceTable_set_values;
+ access_multiplexer->undo_sets = _mfd_ipv6InterfaceTable_undo_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->commit = _mfd_ipv6InterfaceTable_commit;
+ access_multiplexer->undo_commit = _mfd_ipv6InterfaceTable_undo_commit;
+ access_multiplexer->irreversible_commit =
+ _mfd_ipv6InterfaceTable_irreversible_commit;
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("ipv6InterfaceTable:init_ipv6InterfaceTable",
+ "Registering ipv6InterfaceTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("ipv6InterfaceTable", handler,
+ ipv6InterfaceTable_oid,
+ ipv6InterfaceTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RWRITE);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR, "error registering table ipv6InterfaceTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &ipv6InterfaceTable_if_ctx;
+
+ /*************************************************
+ *
+ * set up baby steps handler, create it and inject it
+ */
+ if (access_multiplexer->object_lookup)
+ mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
+ if (access_multiplexer->set_values)
+ mfd_modes |= BABY_STEP_SET_VALUES;
+ if (access_multiplexer->irreversible_commit)
+ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
+ if (access_multiplexer->object_syntax_checks)
+ mfd_modes |= BABY_STEP_CHECK_OBJECT;
+
+ if (access_multiplexer->pre_request)
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if (access_multiplexer->post_request)
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+ if (access_multiplexer->undo_setup)
+ mfd_modes |= BABY_STEP_UNDO_SETUP;
+ if (access_multiplexer->undo_cleanup)
+ mfd_modes |= BABY_STEP_UNDO_CLEANUP;
+ if (access_multiplexer->undo_sets)
+ mfd_modes |= BABY_STEP_UNDO_SETS;
+
+ if (access_multiplexer->row_creation)
+ mfd_modes |= BABY_STEP_ROW_CREATE;
+ if (access_multiplexer->consistency_checks)
+ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
+ if (access_multiplexer->commit)
+ mfd_modes |= BABY_STEP_COMMIT;
+ if (access_multiplexer->undo_commit)
+ mfd_modes |= BABY_STEP_UNDO_COMMIT;
+
+ handler = netsnmp_baby_steps_handler_get(mfd_modes);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
+ */
+ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler =
+ netsnmp_container_table_handler_get(tbl_info,
+ ipv6InterfaceTable_if_ctx.
+ container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+ /*
+ * register LastChanged
+ */
+ {
+ oid lc_oid[] = { IPV6INTERFACETABLELASTCHANGE_OID };
+ netsnmp_register_watched_scalar(netsnmp_create_handler_registration
+ ("ipv6TableLastChanged", NULL,
+ lc_oid, OID_LENGTH(lc_oid),
+ HANDLER_CAN_RONLY),
+ netsnmp_create_watcher_info((void
+ *)
+ &ipv6InterfaceTable_if_ctx.
+ last_changed,
+ sizeof
+ (u_long),
+ ASN_TIMETICKS,
+ WATCHER_FIXED_SIZE));
+ }
+} /* _ipv6InterfaceTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table ipv6InterfaceTable
+ */
+void
+_ipv6InterfaceTable_shutdown_interface(ipv6InterfaceTable_registration *
+ reg_ptr)
+{
+ /*
+ * shutdown the container
+ */
+ _ipv6InterfaceTable_container_shutdown(&ipv6InterfaceTable_if_ctx);
+}
+
+void
+ipv6InterfaceTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ ipv6InterfaceTable_if_ctx.tbl_info.valid_columns = vc;
+} /* ipv6InterfaceTable_valid_columns_set */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipv6InterfaceTable_pre_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_pre_request", "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ipv6InterfaceTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = ipv6InterfaceTable_pre_request(ipv6InterfaceTable_if_ctx.
+ user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipv6InterfaceTable", "error %d from "
+ "ipv6InterfaceTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv6InterfaceTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipv6InterfaceTable_post_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_post_request", "called\n"));
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:ipv6InterfaceTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ if ((MFD_SUCCESS != packet_rc) && ipv6InterfaceTable_dirty_get()) {
+ /*
+ * we shouldn't get here. the undo steps should also clear
+ * the dirty flags.
+ */
+ snmp_log(LOG_WARNING,
+ "ipv6InterfaceTable dirty flag set in post_request "
+ "but status != SUCCESS.\n");
+ }
+
+ rc = ipv6InterfaceTable_post_request(ipv6InterfaceTable_if_ctx.
+ user_ctx, packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipv6InterfaceTable", "error %d from "
+ "ipv6InterfaceTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv6InterfaceTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_ipv6InterfaceTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = SNMP_ERR_NOERROR;
+ ipv6InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_object_lookup", "called\n"));
+
+ /*
+ * get our context from mfd
+ * ipv6InterfaceTable_interface_ctx *if_ctx =
+ * (ipv6InterfaceTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if (NULL == rowreq_ctx) {
+ rc = SNMP_ERR_NOCREATION;
+ }
+
+ if (MFD_SUCCESS != rc)
+ netsnmp_request_set_error_all(requests, rc);
+ else
+ ipv6InterfaceTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_ipv6InterfaceTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipv6InterfaceTable_get_column(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_get_column", "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipv6InterfaceReasmMaxSize(2)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/R/d/h
+ */
+ case COLUMN_IPV6INTERFACEREASMMAXSIZE:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_UNSIGNED;
+ rc = ipv6InterfaceReasmMaxSize_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipv6InterfaceIdentifier(3)/Ipv6AddressIfIdentifierTC/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H
+ */
+ case COLUMN_IPV6INTERFACEIDENTIFIER:
+ var->type = ASN_OCTET_STR;
+ rc = ipv6InterfaceIdentifier_get(rowreq_ctx,
+ (char **) &var->val.string,
+ &var->val_len);
+ break;
+
+ /*
+ * ipv6InterfaceEnableStatus(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPV6INTERFACEENABLESTATUS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipv6InterfaceEnableStatus_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipv6InterfaceReachableTime(6)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPV6INTERFACEREACHABLETIME:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_UNSIGNED;
+ rc = ipv6InterfaceReachableTime_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipv6InterfaceRetransmitTime(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPV6INTERFACERETRANSMITTIME:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_UNSIGNED;
+ rc = ipv6InterfaceRetransmitTime_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * ipv6InterfaceForwarding(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPV6INTERFACEFORWARDING:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = ipv6InterfaceForwarding_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ default:
+ if (COLUMN_IPV6INTERFACEREASMMAXSIZE <= column && column <= COLUMN_IPV6INTERFACEFORWARDING) {
+ DEBUGMSGTL(("internal:${context}:_ipv6InterfaceTable_get_column",
+ "assume column %d is reserved\n", column));
+ rc = MFD_SKIP;
+ } else {
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipv6InterfaceTable_get_column\n",
+ column);
+ }
+ break;
+ }
+
+ return rc;
+} /* _ipv6InterfaceTable_get_column */
+
+int
+_mfd_ipv6InterfaceTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipv6InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ u_char *old_string;
+ void (*dataFreeHook) (void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_get_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+ /*
+ * save old pointer, so we can free it if replaced
+ */
+ old_string = requests->requestvb->val.string;
+ dataFreeHook = requests->requestvb->dataFreeHook;
+ if (NULL == requests->requestvb->val.string) {
+ requests->requestvb->val.string = requests->requestvb->buf;
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ } else if (requests->requestvb->buf ==
+ requests->requestvb->val.string) {
+ if (requests->requestvb->val_len !=
+ sizeof(requests->requestvb->buf))
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ }
+
+ /*
+ * get column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipv6InterfaceTable_get_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ if (MFD_SKIP == rc) {
+ requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+ rc = SNMP_ERR_NOERROR;
+ }
+ } else if (NULL == requests->requestvb->val.string) {
+ snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
+ rc = SNMP_ERR_GENERR;
+ }
+ if (rc)
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+
+ /*
+ * if the buffer wasn't used previously for the old data (i.e. it
+ * was allcoated memory) and the get routine replaced the pointer,
+ * we need to free the previous pointer.
+ */
+ if (old_string && (old_string != requests->requestvb->buf) &&
+ (requests->requestvb->val.string != old_string)) {
+ if (dataFreeHook)
+ (*dataFreeHook) (old_string);
+ else
+ free(old_string);
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv6InterfaceTable_get_values */
+
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Syntax checks
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check the syntax for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipv6InterfaceTable_check_column(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx, netsnmp_variable_list * var,
+ int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_check_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+ /*
+ * (INDEX) ipv6InterfaceIfIndex(1)/InterfaceIndex/ASN_INTEGER/long(long)//l/a/w/e/R/d/H
+ */
+ case COLUMN_IPV6INTERFACEIFINDEX:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+
+ /*
+ * ipv6InterfaceReasmMaxSize(2)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/R/d/h
+ */
+ case COLUMN_IPV6INTERFACEREASMMAXSIZE:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ipv6InterfaceIdentifier(3)/Ipv6AddressIfIdentifierTC/ASN_OCTET_STR/char(char)//L/A/w/e/R/d/H
+ */
+ case COLUMN_IPV6INTERFACEIDENTIFIER:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ipv6InterfaceEnableStatus(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPV6INTERFACEENABLESTATUS:
+ rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
+ sizeof(rowreq_ctx->data.
+ ipv6InterfaceEnableStatus));
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (*var->val.integer != IPV6INTERFACEENABLESTATUS_UP)
+ && (*var->val.integer != IPV6INTERFACEENABLESTATUS_DOWN)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipv6InterfaceTable:_ipv6InterfaceTable_check_column:ipv6InterfaceEnableStatus", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipv6InterfaceEnableStatus_check_value(rowreq_ctx,
+ *((u_long *) var->
+ val.string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipv6InterfaceEnableStatus_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * ipv6InterfaceReachableTime(6)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPV6INTERFACEREACHABLETIME:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ipv6InterfaceRetransmitTime(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_IPV6INTERFACERETRANSMITTIME:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ /*
+ * ipv6InterfaceForwarding(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPV6INTERFACEFORWARDING:
+ rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
+ sizeof(rowreq_ctx->data.
+ ipv6InterfaceForwarding));
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (*var->val.integer != IPV6INTERFACEFORWARDING_FORWARDING)
+ && (*var->val.integer != IPV6INTERFACEFORWARDING_NOTFORWARDING)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("ipv6InterfaceTable:_ipv6InterfaceTable_check_column:ipv6InterfaceForwarding", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = ipv6InterfaceForwarding_check_value(rowreq_ctx,
+ *((u_long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from ipv6InterfaceForwarding_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ default: /** We shouldn't get here */
+ rc = SNMP_ERR_GENERR;
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipv6InterfaceTable_check_column\n",
+ column);
+ }
+
+ return rc;
+} /* _ipv6InterfaceTable_check_column */
+
+int
+_mfd_ipv6InterfaceTable_check_objects(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipv6InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc;
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_check_objects", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+
+ /*
+ * get column number from table request info, and check that column
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipv6InterfaceTable_check_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+ break;
+ }
+
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv6InterfaceTable_check_objects */
+
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo setup
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipv6InterfaceTable_undo_setup_column(ipv6InterfaceTable_rowreq_ctx *
+ rowreq_ctx, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_undo_setup_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipv6InterfaceEnableStatus(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPV6INTERFACEENABLESTATUS:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_IPV6INTERFACEENABLESTATUS_FLAG;
+ rc = ipv6InterfaceEnableStatus_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * ipv6InterfaceForwarding(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPV6INTERFACEFORWARDING:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_IPV6INTERFACEFORWARDING_FLAG;
+ rc = ipv6InterfaceForwarding_undo_setup(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipv6InterfaceTable_undo_setup_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ipv6InterfaceTable_undo_setup_column */
+
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_ipv6InterfaceTable_undo_setup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipv6InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_undo_setup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * allocate undo context
+ */
+ rc = _mfd_ifTable_undo_setup_allocate(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ netsnmp_request_set_error_all(requests,rc);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * row undo setup
+ */
+ rc = ipv6InterfaceTable_undo_setup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from "
+ "ipv6InterfaceTable_undo_setup\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ } else {
+ /*
+ * column undo setup
+ */
+ netsnmp_table_request_info *tri;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipv6InterfaceTable_undo_setup_column(rowreq_ctx,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from "
+ "ipv6InterfaceTable_undo_setup_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv6InterfaceTable_undo_setup */
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_ipv6InterfaceTable_undo_cleanup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipv6InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc;
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_undo_cleanup", "called\n"));
+
+ /*
+ * failed row create in early stages has no rowreq_ctx
+ */
+ if (NULL == rowreq_ctx)
+ return MFD_SUCCESS;
+
+ /*
+ * call user cleanup
+ */
+ rc = ipv6InterfaceTable_undo_cleanup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from "
+ "ipv6InterfaceTable_undo_cleanup\n", rc));
+ }
+
+ /*
+ * release undo context, if needed
+ */
+ _mfd_ifTable_undo_setup_release(rowreq_ctx);
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv6InterfaceTable_undo_cleanup */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Set values
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipv6InterfaceTable_set_column(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_set_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipv6InterfaceEnableStatus(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPV6INTERFACEENABLESTATUS:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_IPV6INTERFACEENABLESTATUS_FLAG;
+ rc = ipv6InterfaceEnableStatus_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ /*
+ * ipv6InterfaceForwarding(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPV6INTERFACEFORWARDING:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_IPV6INTERFACEFORWARDING_FLAG;
+ rc = ipv6InterfaceForwarding_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipv6InterfaceTable_set_column\n",
+ column);
+ rc = SNMP_ERR_GENERR;
+ break;
+ }
+
+ return rc;
+} /* _ipv6InterfaceTable_set_column */
+
+int
+_mfd_ipv6InterfaceTable_set_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipv6InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc = SNMP_ERR_NOERROR;
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_set_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rowreq_ctx->column_set_flags = 0;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipv6InterfaceTable_set_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from "
+ "ipv6InterfaceTable_set_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv6InterfaceTable_set_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit the values
+ */
+int
+_mfd_ipv6InterfaceTable_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipv6InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = ipv6InterfaceTable_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from "
+ "ipv6InterfaceTable_commit\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ /*
+ * if we successfully commited this row, set the dirty flag. Use the
+ * current value + 1 (i.e. dirty = # rows changed).
+ * this is checked in post_request...
+ */
+ ipv6InterfaceTable_dirty_set(ipv6InterfaceTable_dirty_get() + 1); /* set table dirty flag */
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+_mfd_ipv6InterfaceTable_undo_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipv6InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_undo_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ u_int d = ipv6InterfaceTable_dirty_get();
+
+ netsnmp_assert(d != 0);
+ if (d)
+ ipv6InterfaceTable_dirty_set(d - 1);
+ }
+
+ rc = ipv6InterfaceTable_undo_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from "
+ "ipv6InterfaceTable_undo_commit\n", rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ snmp_log(LOG_WARNING,
+ "ipv6InterfaceTable row dirty flag still set after undo_commit\n");
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv6InterfaceTable_commit */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * undo the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_ipv6InterfaceTable_undo_column(ipv6InterfaceTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_undo_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * ipv6InterfaceEnableStatus(5)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPV6INTERFACEENABLESTATUS:
+ rc = ipv6InterfaceEnableStatus_undo(rowreq_ctx);
+ break;
+
+ /*
+ * ipv6InterfaceForwarding(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_IPV6INTERFACEFORWARDING:
+ rc = ipv6InterfaceForwarding_undo(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _ipv6InterfaceTable_undo_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _ipv6InterfaceTable_undo_column */
+
+int
+_mfd_ipv6InterfaceTable_undo_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ ipv6InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_undo_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = ipv6InterfaceTable_undo(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from "
+ "ipv6InterfaceTable_undo\n", rc));
+ }
+
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _ipv6InterfaceTable_undo_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("ipv6InterfaceTable:mfd", "error %d from "
+ "ipv6InterfaceTable_undo_column\n", rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv6InterfaceTable_undo_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: irreversible commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit irreversible actions
+ */
+int
+_mfd_ipv6InterfaceTable_irreversible_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ ipv6InterfaceTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_mfd_ipv6InterfaceTable_irreversible:commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * check for and handle row creation/deletion
+ * and update column exist flags...
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) {
+ CONTAINER_REMOVE(ipv6InterfaceTable_if_ctx.container, rowreq_ctx);
+ } else {
+ if (rowreq_ctx->column_set_flags) {
+ rowreq_ctx->column_set_flags = 0;
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_ipv6InterfaceTable_irreversible_commit */
+
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+/**
+ * @internal
+ */
+static void
+_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_container_free",
+ "called\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container in ipv6InterfaceTable_container_free\n");
+ return;
+ }
+
+ /*
+ * call user code
+ */
+ ipv6InterfaceTable_container_free(container);
+} /* _container_free */
+
+/**
+ * @internal
+ * initialize the container with functions or wrappers
+ */
+void
+_ipv6InterfaceTable_container_init(ipv6InterfaceTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_container_init", "called\n"));
+
+ /*
+ * container init
+ */
+ ipv6InterfaceTable_container_init(&if_ctx->container);
+ if (NULL == if_ctx->container)
+ if_ctx->container =
+ netsnmp_container_find("ipv6InterfaceTable:table_container");
+ if (NULL == if_ctx->container) {
+ snmp_log(LOG_ERR, "error creating container in "
+ "ipv6InterfaceTable_container_init\n");
+ return;
+ }
+
+} /* _ipv6InterfaceTable_container_init */
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+_ipv6InterfaceTable_container_shutdown(ipv6InterfaceTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:ipv6InterfaceTable:_ipv6InterfaceTable_container_shutdown", "called\n"));
+
+ ipv6InterfaceTable_container_shutdown(if_ctx->container);
+
+ _container_free(if_ctx->container);
+
+} /* _ipv6InterfaceTable_container_shutdown */
+
+
+ipv6InterfaceTable_rowreq_ctx *
+ipv6InterfaceTable_row_find_by_mib_index(ipv6InterfaceTable_mib_index *
+ mib_idx)
+{
+ ipv6InterfaceTable_rowreq_ctx *rowreq_ctx;
+ oid oid_tmp[MAX_OID_LEN];
+ netsnmp_index oid_idx;
+ int rc;
+
+ /*
+ * set up storage for OID
+ */
+ oid_idx.oids = oid_tmp;
+ oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
+
+ /*
+ * convert
+ */
+ rc = ifTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx =
+ CONTAINER_FIND(ipv6InterfaceTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface.h
new file mode 100644
index 0000000000..1e91466363
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ip-mib/ipv6InterfaceTable/ipv6InterfaceTable_interface.h
@@ -0,0 +1,178 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: ipv6InterfaceTable_interface.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** @ingroup interface Routines to interface to Net-SNMP
+ *
+ * \warning This code should not be modified, called directly,
+ * or used to interpret functionality. It is subject to
+ * change at any time.
+ *
+ * @{
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+#ifndef IPV6INTERFACETABLE_INTERFACE_H
+#define IPV6INTERFACETABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "ipv6InterfaceTable.h"
+
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _ipv6InterfaceTable_initialize_interface
+ (ipv6InterfaceTable_registration * user_ctx, u_long flags);
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _ipv6InterfaceTable_shutdown_interface
+ (ipv6InterfaceTable_registration * user_ctx);
+
+
+
+
+
+
+
+ ipv6InterfaceTable_registration
+ * ipv6InterfaceTable_registration_get(void);
+
+
+
+
+
+
+
+ ipv6InterfaceTable_registration
+ * ipv6InterfaceTable_registration_set
+ (ipv6InterfaceTable_registration * newreg);
+
+ netsnmp_container *ipv6InterfaceTable_container_get(void);
+ int ipv6InterfaceTable_container_size(void);
+
+ u_int ipv6InterfaceTable_dirty_get(void);
+ void ipv6InterfaceTable_dirty_set(u_int status);
+
+
+
+
+
+
+
+ ipv6InterfaceTable_rowreq_ctx
+ * ipv6InterfaceTable_allocate_rowreq_ctx(void *);
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceTable_release_rowreq_ctx(ipv6InterfaceTable_rowreq_ctx
+ * rowreq_ctx);
+
+ int ipv6InterfaceTable_index_to_oid(netsnmp_index *
+ oid_idx,
+ ipv6InterfaceTable_mib_index
+ * mib_idx);
+ int ipv6InterfaceTable_index_from_oid(netsnmp_index *
+ oid_idx,
+ ipv6InterfaceTable_mib_index
+ * mib_idx);
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void
+
+
+
+
+
+
+
+
+
+
+ ipv6InterfaceTable_valid_columns_set(netsnmp_column_info *vc);
+
+ /*
+ */
+ void ipv6InterfaceTable_lastChange_set(u_long uptime);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* IPV6INTERFACETABLE_INTERFACE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ipfwchains/README b/cleopatre/application/spidnetsnmp/agent/mibgroup/ipfwchains/README
new file mode 100644
index 0000000000..34088c119c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ipfwchains/README
@@ -0,0 +1,4 @@
+Due to GPL restrictions in the most current version of the mib module,
+the ipfchains package is now distributed separately. You can get it
+from ftp://ftp.freesnmp.com/mirrors/ucd-snmp/contrib/ucd-ipchains.tar.gz
+instead.
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/kernel_sunos5.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/kernel_sunos5.c
new file mode 100644
index 0000000000..9bb515997f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/kernel_sunos5.c
@@ -0,0 +1,2031 @@
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+/*- This is a -*- C -*- compatible code file
+ *
+ * Code for SUNOS5_INSTRUMENTATION
+ *
+ * This file contains includes of standard and local system header files,
+ * includes of other application header files, global variable definitions,
+ * static variable definitions, static function prototypes, and function
+ * definitions.
+ *
+ * This file contains function to obtain statistics from SunOS 5.x kernel
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#ifdef solaris2
+/*-
+ * Includes of standard ANSI C header files
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+
+/*-
+ * Includes of system header files (wrapped in duplicate include prevention)
+ */
+
+#include <fcntl.h>
+#include <stropts.h>
+#include <sys/types.h>
+#include <kvm.h>
+#include <sys/fcntl.h>
+#include <kstat.h>
+#include <errno.h>
+#include <time.h>
+
+#include <sys/sockio.h>
+#include <sys/socket.h>
+#include <sys/stream.h>
+#include <sys/stropts.h>
+#include <sys/tihdr.h>
+#include <sys/tiuser.h>
+#include <sys/dlpi.h>
+#include <inet/common.h>
+#include <inet/mib2.h>
+#include <inet/ip.h>
+#include <net/if.h>
+#include <netinet/in.h>
+
+/*-
+ * Includes of local application header files
+ */
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "kernel_sunos5.h"
+
+kstat_ctl_t *kstat_fd = 0;
+
+/*-
+ * Global variable definitions (with initialization)
+ */
+
+/*-
+ * Static variable definitions (with initialization)
+ */
+
+static
+mibcache Mibcache[MIBCACHE_SIZE+1] = {
+ {MIB_SYSTEM, 0, (void *) -1, 0, 0, 0, 0},
+ {MIB_INTERFACES, 10 * sizeof(mib2_ifEntry_t), (void *) -1, 0, 30, 0,
+ 0},
+ {MIB_AT, 0, (void *) -1, 0, 0, 0, 0},
+ {MIB_IP, sizeof(mib2_ip_t), (void *) -1, 0, 60, 0, 0},
+ {MIB_IP_ADDR, 20 * sizeof(mib2_ipAddrEntry_t), (void *) -1, 0, 60, 0,
+ 0},
+ {MIB_IP_ROUTE, 200 * sizeof(mib2_ipRouteEntry_t), (void *) -1, 0, 30,
+ 0, 0},
+ {MIB_IP_NET, 100 * sizeof(mib2_ipNetToMediaEntry_t), (void *) -1, 0,
+ 300, 0, 0},
+ {MIB_ICMP, sizeof(mib2_icmp_t), (void *) -1, 0, 60, 0, 0},
+ {MIB_TCP, sizeof(mib2_tcp_t), (void *) -1, 0, 60, 0, 0},
+ {MIB_TCP_CONN, 1000 * sizeof(mib2_tcpConnEntry_t), (void *) -1, 0, 30,
+ 0, 0},
+ {MIB_UDP, sizeof(mib2_udp_t), (void *) -1, 0, 30, 0, 0},
+ {MIB_UDP_LISTEN, 1000 * sizeof(mib2_udpEntry_t), (void *) -1, 0, 30, 0,
+ 0},
+ {MIB_EGP, 0, (void *) -1, 0, 0, 0, 0},
+ {MIB_CMOT, 0, (void *) -1, 0, 0, 0, 0},
+ {MIB_TRANSMISSION, 0, (void *) -1, 0, 0, 0, 0},
+ {MIB_SNMP, 0, (void *) -1, 0, 0, 0, 0},
+#ifdef SOLARIS_HAVE_IPV6_MIB_SUPPORT
+ {MIB_IP6_ADDR, 20 * sizeof(mib2_ipv6AddrEntry_t), (void *)-1, 0, 30, 0, 0},
+ {MIB_TCP6_CONN, 1000 * sizeof(mib2_tcp6ConnEntry_t), (void *) -1, 0, 30,
+ 0, 0},
+ {MIB_UDP6_ENDPOINT, 1000 * sizeof(mib2_udp6Entry_t), (void *) -1, 0, 30,
+ 0, 0},
+#endif
+ {0},
+};
+
+static
+mibmap Mibmap[MIBCACHE_SIZE+1] = {
+ {MIB2_SYSTEM, 0,},
+ {MIB2_INTERFACES, 0,},
+ {MIB2_AT, 0,},
+ {MIB2_IP, 0,},
+ {MIB2_IP, MIB2_IP_20,},
+ {MIB2_IP, MIB2_IP_21,},
+ {MIB2_IP, MIB2_IP_22,},
+ {MIB2_ICMP, 0,},
+ {MIB2_TCP, 0,},
+ {MIB2_TCP, MIB2_TCP_13,},
+ {MIB2_UDP, 0,},
+ {MIB2_UDP, MIB2_UDP_5},
+ {MIB2_EGP, 0,},
+ {MIB2_CMOT, 0,},
+ {MIB2_TRANSMISSION, 0,},
+ {MIB2_SNMP, 0,},
+#ifdef SOLARIS_HAVE_IPV6_MIB_SUPPORT
+ {MIB2_IP6, MIB2_IP6_ADDR},
+ {MIB2_TCP6, MIB2_TCP6_CONN},
+ {MIB2_UDP6, MIB2_UDP6_ENTRY},
+#endif
+ {0},
+};
+
+static int sd = -2; /* /dev/arp stream descriptor. */
+
+/*-
+ * Static function prototypes (use void as argument type if there are none)
+ */
+
+static found_e
+getentry(req_e req_type, void *bufaddr, size_t len, size_t entrysize,
+ void *resp, int (*comp)(void *, void *), void *arg);
+
+static int
+getmib(int groupname, int subgroupname, void *statbuf, size_t size,
+ size_t entrysize, req_e req_type, void *resp, size_t *length,
+ int (*comp)(void *, void *), void *arg);
+
+static int
+getif(mib2_ifEntry_t *ifbuf, size_t size, req_e req_type, mib2_ifEntry_t *resp,
+ size_t *length, int (*comp)(void *, void *), void *arg);
+static void
+set_if_info(mib2_ifEntry_t *ifp, unsigned index, char *name, uint64_t flags,
+ int mtu);
+static int get_if_stats(mib2_ifEntry_t *ifp);
+
+#if defined(HAVE_IF_NAMEINDEX) && defined(NETSNMP_INCLUDE_IFTABLE_REWRITES)
+static int _dlpi_open(const char *devname);
+static int _dlpi_get_phys_address(int fd, char *paddr, int maxlen,
+ int *paddrlen);
+static int _dlpi_get_iftype(int fd, unsigned int *iftype);
+static int _dlpi_attach(int fd, int ppa);
+static int _dlpi_parse_devname(char *devname, int *ppap);
+#endif
+
+
+
+static int
+Name_cmp(void *, void *);
+
+static void
+init_mibcache_element(mibcache * cp);
+
+#define STREAM_DEV "/dev/arp"
+#define BUFSIZE 40960 /* Buffer for messages (should be modulo(pagesize) */
+
+/*-
+ * Function definitions
+ */
+
+#ifdef _STDC_COMPAT
+#ifdef __cplusplus
+extern "C" {
+#endif
+#endif
+
+/*
+ * I profiled snmpd using Quantify on a Solaris 7 box, and it turned out that
+ * the calls to time() in getMibstat() were taking 18% of the total execution
+ * time of snmpd when doing simple walks over the whole tree. I guess it must
+ * be difficult for Sun hardware to tell the time or something ;-). Anyway,
+ * this seemed like it was negating the point of having the cache, so I have
+ * changed the code so that it runs a periodic alarm to age the cache entries
+ * instead. The meaning of the cache_ttl and cache_time members has changed to
+ * support this. cache_ttl is now the value that cache_time gets reset to when
+ * we fetch a value from the kernel; cache_time then ticks down to zero in
+ * steps of period (see below). When it reaches zero, the cache entry is no
+ * longer valid and we fetch a new one. The effect of this is the same as the
+ * previous code, but more efficient (because it's not calling time() for every
+ * variable fetched) when you are walking the tables. jbpn, 20020226.
+ */
+
+static void
+kernel_sunos5_cache_age(unsigned int regnumber, void *data)
+{
+ int i = 0, period = (int)data;
+
+ for (i = 0; i < MIBCACHE_SIZE; i++) {
+ DEBUGMSGTL(("kernel_sunos5", "cache[%d] time %ld ttl %d\n", i,
+ Mibcache[i].cache_time, Mibcache[i].cache_ttl));
+ if (Mibcache[i].cache_time < period) {
+ Mibcache[i].cache_time = 0;
+ } else {
+ Mibcache[i].cache_time -= period;
+ }
+ }
+}
+
+void
+init_kernel_sunos5(void)
+{
+ static int creg = 0;
+ const int period = 30;
+ int alarm_id = 0;
+
+ if (creg == 0) {
+ alarm_id = snmp_alarm_register(5, NULL, kernel_sunos5_cache_age,
+ NULL);
+ DEBUGMSGTL(("kernel_sunos5", "registered alarm %d with period 5s\n",
+ alarm_id));
+ alarm_id = snmp_alarm_register(period, SA_REPEAT,
+ kernel_sunos5_cache_age,
+ (void *)period);
+ DEBUGMSGTL(("kernel_sunos5", "registered alarm %d with period %ds\n",
+ alarm_id, period));
+ ++creg;
+ }
+}
+
+/*
+ * Get various kernel statistics using undocumented Solaris kstat interface.
+ * We need it mainly for getting network interface statistics, although it is
+ * generic enough to be used for any purpose. It knows about kstat_headers
+ * module names and by the name of the statistics it tries to figure out the
+ * rest of necessary information. Returns 0 in case of success and < 0 if
+ * there were any errors.
+
+ *
+ * NOTE: To use this function correctly you have to know the actual type of the
+ * value to be returned, so you may build the test program, figure out the type
+ * and use it. Exposing kstat data types to upper layers doesn't seem to be
+ * reasonable. In any case I'd expect more reasonable kstat interface. :-(
+ */
+
+
+int
+getKstatInt(const char *classname, const char *statname,
+ const char *varname, int *value)
+{
+ kstat_ctl_t *ksc;
+ kstat_t *ks;
+ kid_t kid;
+ kstat_named_t *named;
+ int ret = -1; /* fail unless ... */
+
+ if (kstat_fd == 0) {
+ kstat_fd = kstat_open();
+ if (kstat_fd == 0) {
+ snmp_log_perror("kstat_open");
+ }
+ }
+ if ((ksc = kstat_fd) == NULL) {
+ goto Return;
+ }
+ ks = kstat_lookup(ksc, classname, -1, statname);
+ if (ks == NULL) {
+ DEBUGMSGTL(("kernel_sunos5", "class %s, stat %s not found\n",
+ classname ? classname : "NULL",
+ statname ? statname : "NULL"));
+ goto Return;
+ }
+ kid = kstat_read(ksc, ks, NULL);
+ if (kid == -1) {
+ DEBUGMSGTL(("kernel_sunos5", "cannot read class %s stats %s\n",
+ classname ? classname : "NULL", statname ? statname : "NULL"));
+ goto Return;
+ }
+ named = kstat_data_lookup(ks, varname);
+ if (named == NULL) {
+ DEBUGMSGTL(("kernel_sunos5", "no var %s for class %s stat %s\n",
+ varname, classname ? classname : "NULL",
+ statname ? statname : "NULL"));
+ goto Return;
+ }
+
+ ret = 0; /* maybe successful */
+ switch (named->data_type) {
+#ifdef KSTAT_DATA_INT32 /* Solaris 2.6 and up */
+ case KSTAT_DATA_INT32:
+ *value = named->value.i32;
+ break;
+ case KSTAT_DATA_UINT32:
+ *value = named->value.ui32;
+ break;
+ case KSTAT_DATA_INT64:
+ *value = named->value.i64;
+ break;
+ case KSTAT_DATA_UINT64:
+ *value = named->value.ui64;
+ break;
+#else
+ case KSTAT_DATA_LONG:
+ *value = named->value.l;
+ break;
+ case KSTAT_DATA_ULONG:
+ *value = named->value.ul;
+ break;
+ case KSTAT_DATA_LONGLONG:
+ *value = named->value.ll;
+ break;
+ case KSTAT_DATA_ULONGLONG:
+ *value = named->value.ull;
+ break;
+#endif
+ default:
+ snmp_log(LOG_ERR,
+ "non-int type in kstat data: \"%s\" \"%s\" \"%s\" %d\n",
+ classname ? classname : "NULL",
+ statname ? statname : "NULL",
+ varname ? varname : "NULL", named->data_type);
+ ret = -1; /* fail */
+ break;
+ }
+ Return:
+ return ret;
+}
+
+int
+getKstat(const char *statname, const char *varname, void *value)
+{
+ kstat_ctl_t *ksc;
+ kstat_t *ks, *kstat_data;
+ kstat_named_t *d;
+ size_t i, instance;
+ char module_name[64];
+ int ret;
+ u_longlong_t val; /* The largest value */
+ void *v;
+ static char buf[128];
+
+ if (value == NULL) { /* Pretty useless but ... */
+ v = (void *) &val;
+ } else {
+ v = value;
+ }
+
+ if (kstat_fd == 0) {
+ kstat_fd = kstat_open();
+ if (kstat_fd == 0) {
+ snmp_log_perror("kstat_open");
+ }
+ }
+ if ((ksc = kstat_fd) == NULL) {
+ ret = -10;
+ goto Return; /* kstat errors */
+ }
+ if (statname == NULL || varname == NULL) {
+ ret = -20;
+ goto Return;
+ }
+
+ /*
+ * First, get "kstat_headers" statistics. It should
+ * contain all available modules.
+ */
+
+ if ((ks = kstat_lookup(ksc, "unix", 0, "kstat_headers")) == NULL) {
+ ret = -10;
+ goto Return; /* kstat errors */
+ }
+ if (kstat_read(ksc, ks, NULL) <= 0) {
+ ret = -10;
+ goto Return; /* kstat errors */
+ }
+ kstat_data = ks->ks_data;
+
+ /*
+ * Now, look for the name of our stat in the headers buf
+ */
+ for (i = 0; i < ks->ks_ndata; i++) {
+ DEBUGMSGTL(("kernel_sunos5",
+ "module: %s instance: %d name: %s class: %s type: %d flags: %x\n",
+ kstat_data[i].ks_module, kstat_data[i].ks_instance,
+ kstat_data[i].ks_name, kstat_data[i].ks_class,
+ kstat_data[i].ks_type, kstat_data[i].ks_flags));
+ if (strcmp(statname, kstat_data[i].ks_name) == 0) {
+ strcpy(module_name, kstat_data[i].ks_module);
+ instance = kstat_data[i].ks_instance;
+ break;
+ }
+ }
+
+ if (i == ks->ks_ndata) {
+ ret = -1;
+ goto Return; /* Not found */
+ }
+
+ /*
+ * Get the named statistics
+ */
+ if ((ks = kstat_lookup(ksc, module_name, instance, statname)) == NULL) {
+ ret = -10;
+ goto Return; /* kstat errors */
+ }
+
+ if (kstat_read(ksc, ks, NULL) <= 0) {
+ ret = -10;
+ goto Return; /* kstat errors */
+ }
+ /*
+ * This function expects only name/value type of statistics, so if it is
+ * not the case return an error
+ */
+ if (ks->ks_type != KSTAT_TYPE_NAMED) {
+ ret = -2;
+ goto Return; /* Invalid stat type */
+ }
+
+ for (i = 0, d = KSTAT_NAMED_PTR(ks); i < ks->ks_ndata; i++, d++) {
+ DEBUGMSGTL(("kernel_sunos5", "variable: \"%s\" (type %d)\n",
+ d->name, d->data_type));
+
+ if (strcmp(d->name, varname) == 0) {
+ switch (d->data_type) {
+ case KSTAT_DATA_CHAR:
+ DEBUGMSGTL(("kernel_sunos5", "value: %s\n", d->value.c));
+ *(char **)v = buf;
+ buf[sizeof(buf)-1] = 0;
+ strncpy(buf, d->value.c, sizeof(buf)-1);
+ break;
+#ifdef KSTAT_DATA_INT32 /* Solaris 2.6 and up */
+ case KSTAT_DATA_INT32:
+ *(Counter *)v = d->value.i32;
+ DEBUGMSGTL(("kernel_sunos5", "value: %d\n", d->value.i32));
+ break;
+ case KSTAT_DATA_UINT32:
+ *(Counter *)v = d->value.ui32;
+ DEBUGMSGTL(("kernel_sunos5", "value: %u\n", d->value.ui32));
+ break;
+ case KSTAT_DATA_INT64:
+ *(int64_t *)v = d->value.i64;
+ DEBUGMSGTL(("kernel_sunos5", "value: %ld\n", d->value.i64));
+ break;
+ case KSTAT_DATA_UINT64:
+ *(uint64_t *)v = d->value.ui64;
+ DEBUGMSGTL(("kernel_sunos5", "value: %lu\n", d->value.ui64));
+ break;
+#else
+ case KSTAT_DATA_LONG:
+ *(Counter *)v = d->value.l;
+ DEBUGMSGTL(("kernel_sunos5", "value: %ld\n", d->value.l));
+ break;
+ case KSTAT_DATA_ULONG:
+ *(Counter *)v = d->value.ul;
+ DEBUGMSGTL(("kernel_sunos5", "value: %lu\n", d->value.ul));
+ break;
+ case KSTAT_DATA_LONGLONG:
+ *(Counter *)v = d->value.ll;
+ DEBUGMSGTL(("kernel_sunos5", "value: %lld\n",
+ (long)d->value.ll));
+ break;
+ case KSTAT_DATA_ULONGLONG:
+ *(Counter *)v = d->value.ull;
+ DEBUGMSGTL(("kernel_sunos5", "value: %llu\n",
+ (unsigned long)d->value.ull));
+ break;
+#endif
+ case KSTAT_DATA_FLOAT:
+ *(float *)v = d->value.f;
+ DEBUGMSGTL(("kernel_sunos5", "value: %f\n", d->value.f));
+ break;
+ case KSTAT_DATA_DOUBLE:
+ *(double *)v = d->value.d;
+ DEBUGMSGTL(("kernel_sunos5", "value: %f\n", d->value.d));
+ break;
+ default:
+ DEBUGMSGTL(("kernel_sunos5",
+ "UNKNOWN TYPE %d (stat \"%s\" var \"%s\")\n",
+ d->data_type, statname, varname));
+ ret = -3;
+ goto Return; /* Invalid data type */
+ }
+ ret = 0; /* Success */
+ goto Return;
+ }
+ }
+ ret = -4; /* Name not found */
+ Return:
+ return ret;
+}
+
+int
+getKstatString(const char *statname, const char *varname,
+ char *value, size_t value_len)
+{
+ kstat_ctl_t *ksc;
+ kstat_t *ks, *kstat_data;
+ kstat_named_t *d;
+ size_t i, instance;
+ char module_name[64];
+ int ret;
+
+ if (kstat_fd == 0) {
+ kstat_fd = kstat_open();
+ if (kstat_fd == 0) {
+ snmp_log_perror("kstat_open");
+ }
+ }
+ if ((ksc = kstat_fd) == NULL) {
+ ret = -10;
+ goto Return; /* kstat errors */
+ }
+ if (statname == NULL || varname == NULL) {
+ ret = -20;
+ goto Return;
+ }
+
+ /*
+ * First, get "kstat_headers" statistics. It should
+ * contain all available modules.
+ */
+
+ if ((ks = kstat_lookup(ksc, "unix", 0, "kstat_headers")) == NULL) {
+ ret = -10;
+ goto Return; /* kstat errors */
+ }
+ if (kstat_read(ksc, ks, NULL) <= 0) {
+ ret = -10;
+ goto Return; /* kstat errors */
+ }
+ kstat_data = ks->ks_data;
+
+ /*
+ * Now, look for the name of our stat in the headers buf
+ */
+ for (i = 0; i < ks->ks_ndata; i++) {
+ DEBUGMSGTL(("kernel_sunos5",
+ "module: %s instance: %d name: %s class: %s type: %d flags: %x\n",
+ kstat_data[i].ks_module, kstat_data[i].ks_instance,
+ kstat_data[i].ks_name, kstat_data[i].ks_class,
+ kstat_data[i].ks_type, kstat_data[i].ks_flags));
+ if (strcmp(statname, kstat_data[i].ks_name) == 0) {
+ strcpy(module_name, kstat_data[i].ks_module);
+ instance = kstat_data[i].ks_instance;
+ break;
+ }
+ }
+
+ if (i == ks->ks_ndata) {
+ ret = -1;
+ goto Return; /* Not found */
+ }
+
+ /*
+ * Get the named statistics
+ */
+ if ((ks = kstat_lookup(ksc, module_name, instance, statname)) == NULL) {
+ ret = -10;
+ goto Return; /* kstat errors */
+ }
+
+ if (kstat_read(ksc, ks, NULL) <= 0) {
+ ret = -10;
+ goto Return; /* kstat errors */
+ }
+ /*
+ * This function expects only name/value type of statistics, so if it is
+ * not the case return an error
+ */
+ if (ks->ks_type != KSTAT_TYPE_NAMED) {
+ ret = -2;
+ goto Return; /* Invalid stat type */
+ }
+
+ for (i = 0, d = KSTAT_NAMED_PTR(ks); i < ks->ks_ndata; i++, d++) {
+ DEBUGMSGTL(("kernel_sunos5", "variable: \"%s\" (type %d)\n",
+ d->name, d->data_type));
+
+ if (strcmp(d->name, varname) == 0) {
+ switch (d->data_type) {
+ case KSTAT_DATA_CHAR:
+ value[value_len-1] = '\0';
+ strncpy(value, d->value.c, value_len-1);
+ DEBUGMSGTL(("kernel_sunos5", "value: %s\n", d->value.c));
+ break;
+ default:
+ DEBUGMSGTL(("kernel_sunos5",
+ "NONSTRING TYPE %d (stat \"%s\" var \"%s\")\n",
+ d->data_type, statname, varname));
+ ret = -3;
+ goto Return; /* Invalid data type */
+ }
+ ret = 0; /* Success */
+ goto Return;
+ }
+ }
+ ret = -4; /* Name not found */
+ Return:
+ return ret;
+}
+
+/*
+ * get MIB-II statistics. It maintaines a simple cache which buffers the last
+ * read block of MIB statistics (which may contain the whole table). It calls
+ * *comp to compare every entry with an entry pointed by arg. *comp should
+ * return 0 if comparison is successful. Req_type may be GET_FIRST, GET_EXACT,
+ * GET_NEXT. If search is successful getMibstat returns 0, otherwise 1.
+ */
+int
+getMibstat(mibgroup_e grid, void *resp, size_t entrysize,
+ req_e req_type, int (*comp) (void *, void *), void *arg)
+{
+ int ret, rc = -1, mibgr, mibtb, cache_valid;
+ size_t length;
+ mibcache *cachep;
+ found_e result = NOT_FOUND;
+ void *ep;
+
+ /*
+ * We assume that Mibcache is initialized in mibgroup_e enum order so we
+ * don't check the validity of index here.
+ */
+
+ DEBUGMSGTL(("kernel_sunos5", "getMibstat (%d, *, %d, %d, *, *)\n",
+ grid, entrysize, req_type));
+ cachep = &Mibcache[grid];
+ mibgr = Mibmap[grid].group;
+ mibtb = Mibmap[grid].table;
+
+ if (cachep->cache_addr == (void *) -1) /* Hasn't been initialized yet */
+ init_mibcache_element(cachep);
+ if (cachep->cache_size == 0) { /* Memory allocation problems */
+ cachep->cache_addr = resp; /* So use caller supplied address instead of cache */
+ cachep->cache_size = entrysize;
+ cachep->cache_last_found = 0;
+ }
+ if (req_type != GET_NEXT)
+ cachep->cache_last_found = 0;
+
+ cache_valid = (cachep->cache_time > 0);
+
+ DEBUGMSGTL(("kernel_sunos5","... cache_valid %d time %ld ttl %d now %ld\n",
+ cache_valid, cachep->cache_time, cachep->cache_ttl,
+ time(NULL)));
+ if (cache_valid) {
+ /*
+ * Is it really?
+ */
+ if (cachep->cache_comp != (void *)comp || cachep->cache_arg != arg) {
+ cache_valid = 0; /* Nope. */
+ }
+ }
+
+ if (cache_valid) {
+ /*
+ * Entry is valid, let's try to find a match
+ */
+
+ if (req_type == GET_NEXT) {
+ result = getentry(req_type,
+ (void *)((char *)cachep->cache_addr +
+ (cachep->cache_last_found * entrysize)),
+ cachep->cache_length -
+ (cachep->cache_last_found * entrysize),
+ entrysize, &ep, comp, arg);
+ } else {
+ result = getentry(req_type, cachep->cache_addr,
+ cachep->cache_length, entrysize, &ep, comp,
+ arg);
+ }
+ }
+
+ if ((cache_valid == 0) || (result == NOT_FOUND) ||
+ (result == NEED_NEXT && cachep->cache_flags & CACHE_MOREDATA)) {
+ /*
+ * Either the cache is old, or we haven't found anything, or need the
+ * next item which hasn't been read yet. In any case, fill the cache
+ * up and try to find our entry.
+ */
+
+ if (grid == MIB_INTERFACES) {
+ rc = getif((mib2_ifEntry_t *) cachep->cache_addr,
+ cachep->cache_size, req_type,
+ (mib2_ifEntry_t *) & ep, &length, comp, arg);
+ } else {
+ rc = getmib(mibgr, mibtb, cachep->cache_addr,
+ cachep->cache_size, entrysize, req_type, &ep,
+ &length, comp, arg);
+ }
+
+ if (rc >= 0) { /* Cache has been filled up */
+ cachep->cache_time = cachep->cache_ttl;
+ cachep->cache_length = length;
+ if (rc == 1) /* Found but there are more unread data */
+ cachep->cache_flags |= CACHE_MOREDATA;
+ else {
+ cachep->cache_flags &= ~CACHE_MOREDATA;
+ if (rc > 1) {
+ cachep->cache_time = 0;
+ }
+ }
+ cachep->cache_comp = (void *) comp;
+ cachep->cache_arg = arg;
+ } else {
+ cachep->cache_comp = NULL;
+ cachep->cache_arg = NULL;
+ }
+ }
+ DEBUGMSGTL(("kernel_sunos5", "... result %d rc %d\n", result, rc));
+
+ if (result == FOUND || rc == 0 || rc == 1) {
+ /*
+ * Entry has been found, deliver it
+ */
+ if (resp != NULL) {
+ memcpy(resp, ep, entrysize);
+ }
+ ret = 0;
+ cachep->cache_last_found =
+ ((char *)ep - (char *)cachep->cache_addr) / entrysize;
+ } else {
+ ret = 1; /* Not found */
+ }
+ DEBUGMSGTL(("kernel_sunos5", "... getMibstat returns %d\n", ret));
+ return ret;
+}
+
+/*
+ * Get a MIB-II entry from the buffer buffaddr, which satisfies the criterion,
+ * computed by (*comp), which gets arg as the first argument and pointer to the
+ * current position in the buffer as the second. If found entry is pointed by
+ * resp.
+ */
+
+static found_e
+getentry(req_e req_type, void *bufaddr, size_t len,
+ size_t entrysize, void *resp, int (*comp)(void *, void *),
+ void *arg)
+{
+ void *bp = bufaddr, **rp = resp;
+ int previous_found = 0;
+
+ if ((len > 0) && (len % entrysize != 0)) {
+ /*
+ * The data in the cache does not make sense, the size must be a
+ * multiple of the entry. Could be caused by alignment issues etc.
+ */
+ DEBUGMSGTL(("kernel_sunos5",
+ "bad cache length %d - not multiple of entry size %d\n",
+ len, entrysize));
+ return NOT_FOUND;
+ }
+
+ /*
+ * Here we have to perform address arithmetic with pointer to void. Ugly...
+ */
+
+ for (; len > 0; len -= entrysize, bp = (char *) bp + entrysize) {
+ if (rp != (void *) NULL) {
+ *rp = bp;
+ }
+
+ if (req_type == GET_FIRST || (req_type == GET_NEXT && previous_found)){
+ return FOUND;
+ }
+
+ if ((*comp)(arg, bp) == 0) {
+ if (req_type == GET_EXACT) {
+ return FOUND;
+ } else { /* GET_NEXT */
+ previous_found++;
+ continue;
+ }
+ }
+ }
+
+ if (previous_found) {
+ return NEED_NEXT;
+ } else {
+ return NOT_FOUND;
+ }
+}
+
+/*
+ * Initialize a cache element. It allocates the memory and sets the time stamp
+ * to invalidate the element.
+ */
+static void
+init_mibcache_element(mibcache * cp)
+{
+ if (cp == (mibcache *)NULL) {
+ return;
+ }
+ if (cp->cache_size) {
+ cp->cache_addr = malloc(cp->cache_size);
+ }
+ cp->cache_time = 0;
+ cp->cache_comp = NULL;
+ cp->cache_arg = NULL;
+}
+
+/*
+ * Get MIB-II statistics from the Solaris kernel. It uses undocumented
+ * interface to TCP/IP streams modules, which provides extended MIB-II for the
+ * following groups: ip, icmp, tcp, udp, egp.
+
+ *
+ * Usage: groupname, subgroupname are from <inet/mib2.h>,
+ * size%sizeof(statbuf) == 0,
+ * entrysize should be exact size of MIB-II entry,
+ * req_type:
+ * GET_FIRST - get the first entry in the buffer
+ * GET_EXACT - get exact match
+ * GET_NEXT - get next entry after the exact match
+ *
+ * (*comp) is a compare function, provided by the caller, which gets arg as the
+ * first argument and pointer to the current entry as th second. If compared,
+ * should return 0 and found entry will be pointed by resp.
+ *
+ * If search is successful and no more data to read, it returns 0,
+ * if successful and there is more data -- 1,
+ * if not found and end of data -- 2, any other errors -- < 0
+ * (negative error numbers are pretty random).
+ *
+ * NOTE: needs to be protected by a mutex in reentrant environment
+ */
+
+static int
+getmib(int groupname, int subgroupname, void *statbuf, size_t size,
+ size_t entrysize, req_e req_type, void *resp,
+ size_t *length, int (*comp)(void *, void *), void *arg)
+{
+ int rc, ret = 0, flags;
+ char buf[BUFSIZE];
+ struct strbuf strbuf;
+ struct T_optmgmt_req *tor = (struct T_optmgmt_req *) buf;
+ struct T_optmgmt_ack *toa = (struct T_optmgmt_ack *) buf;
+ struct T_error_ack *tea = (struct T_error_ack *) buf;
+ struct opthdr *req;
+ found_e result = FOUND;
+
+ DEBUGMSGTL(("kernel_sunos5", "...... getmib (%d, %d, ...)\n",
+ groupname, subgroupname));
+
+ /*
+ * Open the stream driver and push all MIB-related modules
+ */
+
+ if (sd == -2) { /* First time */
+ if ((sd = open(STREAM_DEV, O_RDWR)) == -1) {
+ snmp_log_perror(STREAM_DEV);
+ ret = -1;
+ goto Return;
+ }
+ if (ioctl(sd, I_PUSH, "tcp") == -1) {
+ snmp_log_perror("I_PUSH tcp");
+ ret = -1;
+ goto Return;
+ }
+ if (ioctl(sd, I_PUSH, "udp") == -1) {
+ snmp_log_perror("I_PUSH udp");
+ ret = -1;
+ goto Return;
+ }
+ DEBUGMSGTL(("kernel_sunos5", "...... modules pushed OK\n"));
+ }
+ if (sd == -1) {
+ ret = -1;
+ goto Return;
+ }
+
+ /*
+ * First, use bigger buffer, to accelerate skipping unwanted messages
+ */
+
+ strbuf.buf = buf;
+ strbuf.maxlen = BUFSIZE;
+
+ tor->PRIM_type = T_OPTMGMT_REQ;
+ tor->OPT_offset = sizeof(struct T_optmgmt_req);
+ tor->OPT_length = sizeof(struct opthdr);
+#ifdef MI_T_CURRENT
+ tor->MGMT_flags = MI_T_CURRENT; /* Solaris < 2.6 */
+#else
+ tor->MGMT_flags = T_CURRENT; /* Solaris 2.6 */
+#endif
+ req = (struct opthdr *)(tor + 1);
+ req->level = groupname;
+ req->name = subgroupname;
+ req->len = 0;
+ strbuf.len = tor->OPT_length + tor->OPT_offset;
+ flags = 0;
+ if ((rc = putmsg(sd, &strbuf, NULL, flags))) {
+ ret = -2;
+ goto Return;
+ }
+
+ req = (struct opthdr *) (toa + 1);
+ for (;;) {
+ flags = 0;
+ if ((rc = getmsg(sd, &strbuf, NULL, &flags)) == -1) {
+ ret = -EIO;
+ break;
+ }
+ if (rc == 0 && strbuf.len >= sizeof(struct T_optmgmt_ack) &&
+ toa->PRIM_type == T_OPTMGMT_ACK &&
+ toa->MGMT_flags == T_SUCCESS && req->len == 0) {
+ ret = 2;
+ break;
+ }
+ if (strbuf.len >= sizeof(struct T_error_ack) &&
+ tea->PRIM_type == T_ERROR_ACK) {
+ /* Protocol error */
+ ret = -((tea->TLI_error == TSYSERR) ? tea->UNIX_error : EPROTO);
+ break;
+ }
+ if (rc != MOREDATA || strbuf.len < sizeof(struct T_optmgmt_ack) ||
+ toa->PRIM_type != T_OPTMGMT_ACK ||
+ toa->MGMT_flags != T_SUCCESS) {
+ ret = -ENOMSG; /* No more messages */
+ break;
+ }
+
+ /*
+ * The order in which we get the statistics is determined by the kernel
+ * and not by the group name, so we have to loop until we get the
+ * required statistics.
+ */
+
+ if (req->level != groupname || req->name != subgroupname) {
+ strbuf.maxlen = BUFSIZE;
+ strbuf.buf = buf;
+ do {
+ rc = getmsg(sd, NULL, &strbuf, &flags);
+ } while (rc == MOREDATA);
+ continue;
+ }
+
+ /*
+ * Now when we found our stat, switch buffer to a caller-provided
+ * one. Manipulating the size of it one can control performance,
+ * reducing the number of getmsg calls
+ */
+
+ strbuf.buf = statbuf;
+ strbuf.maxlen = size;
+ strbuf.len = 0;
+ flags = 0;
+ do {
+ rc = getmsg(sd, NULL, &strbuf, &flags);
+ switch (rc) {
+ case -1:
+ rc = -ENOSR;
+ goto Return;
+
+ default:
+ rc = -ENODATA;
+ goto Return;
+
+ case MOREDATA:
+ case 0:
+ if (req_type == GET_NEXT && result == NEED_NEXT)
+ /*
+ * End of buffer, so "next" is the first item in the next
+ * buffer
+ */
+ req_type = GET_FIRST;
+ result = getentry(req_type, (void *) strbuf.buf, strbuf.len,
+ entrysize, resp, comp, arg);
+ *length = strbuf.len; /* To use in caller for cacheing */
+ break;
+ }
+ } while (rc == MOREDATA && result != FOUND);
+
+ if (result == FOUND) { /* Search is successful */
+ if (rc != MOREDATA) {
+ ret = 0; /* Found and no more data */
+ } else {
+ ret = 1; /* Found and there is another unread data block */
+ }
+ break;
+ } else { /* Restore buffers, continue search */
+ strbuf.buf = buf;
+ strbuf.maxlen = BUFSIZE;
+ }
+ }
+ Return:
+ if (sd >= 0) ioctl(sd, I_FLUSH, FLUSHRW);
+ DEBUGMSGTL(("kernel_sunos5", "...... getmib returns %d\n", ret));
+ return ret;
+}
+
+/*
+ * Get info for interfaces group. Mimics getmib interface as much as possible
+ * to be substituted later if SunSoft decides to extend its mib2 interface.
+ */
+
+#if defined(HAVE_IF_NAMEINDEX) && defined(NETSNMP_INCLUDE_IFTABLE_REWRITES)
+
+/*
+ * If IFTABLE_REWRITES is enabled, then we will also rely on DLPI to obtain
+ * information from the NIC.
+ */
+
+/*
+ * Open a DLPI device.
+ *
+ * On success the file descriptor is returned.
+ * On error -1 is returned.
+ */
+static int
+_dlpi_open(const char *devname)
+{
+ char *devstr;
+ int fd = -1;
+ int ppa = -1;
+
+ DEBUGMSGTL(("kernel_sunos5", "_dlpi_open called\n"));
+
+ if (devname == NULL)
+ return (-1);
+
+ if ((devstr = malloc(5 + strlen(devname) + 1)) == NULL)
+ return (-1);
+ (void) sprintf(devstr, "/dev/%s", devname);
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "devstr(%s)\n", devstr));
+ /*
+ * First try opening the device using style 1, if the device does not
+ * exist we try style 2. Modules will not be pushed, so something like
+ * ip tunnels will not work.
+ */
+
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "style1 open(%s)\n", devstr));
+ if ((fd = open(devstr, O_RDWR | O_NONBLOCK)) < 0) {
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "style1 open failed\n"));
+ if (_dlpi_parse_devname(devstr, &ppa) == 0) {
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "style2 parse: %s, %d\n",
+ devstr, ppa));
+ /* try style 2 */
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "style2 open(%s)\n", devstr));
+
+ if ((fd = open(devstr, O_RDWR | O_NONBLOCK)) != -1) {
+ if (_dlpi_attach(fd, ppa) == 0) {
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "attached\n"));
+ } else {
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "attached failed\n"));
+ close(fd);
+ fd = -1;
+ }
+ } else {
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "style2 open failed\n"));
+ }
+ }
+ } else {
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "style1 open succeeded\n"));
+ }
+
+ /* clean up */
+ free(devstr);
+
+ return (fd);
+}
+
+/*
+ * Obtain the physical address of the interface using DLPI
+ */
+static int
+_dlpi_get_phys_address(int fd, char *addr, int maxlen, int *addrlen)
+{
+ dl_phys_addr_req_t paddr_req;
+ union DL_primitives *dlp;
+ struct strbuf ctlbuf;
+ char buf[MAX(DL_PHYS_ADDR_ACK_SIZE+64, DL_ERROR_ACK_SIZE)];
+ int flag = 0;
+
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "_dlpi_get_phys_address\n"));
+
+ paddr_req.dl_primitive = DL_PHYS_ADDR_REQ;
+ paddr_req.dl_addr_type = DL_CURR_PHYS_ADDR;
+ ctlbuf.buf = (char *)&paddr_req;
+ ctlbuf.len = DL_PHYS_ADDR_REQ_SIZE;
+ if (putmsg(fd, &ctlbuf, NULL, 0) < 0)
+ return (-1);
+
+ ctlbuf.maxlen = sizeof(buf);
+ ctlbuf.len = 0;
+ ctlbuf.buf = buf;
+ if (getmsg(fd, &ctlbuf, NULL, &flag) < 0)
+ return (-1);
+
+ if (ctlbuf.len < sizeof(uint32_t))
+ return (-1);
+ dlp = (union DL_primitives *)buf;
+ switch (dlp->dl_primitive) {
+ case DL_PHYS_ADDR_ACK: {
+ dl_phys_addr_ack_t *phyp = (dl_phys_addr_ack_t *)buf;
+
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "got ACK\n"));
+ if (ctlbuf.len < DL_PHYS_ADDR_ACK_SIZE || phyp->dl_addr_length > maxlen)
+ return (-1);
+ (void) memcpy(addr, buf+phyp->dl_addr_offset, phyp->dl_addr_length);
+ *addrlen = phyp->dl_addr_length;
+ return (0);
+ }
+ case DL_ERROR_ACK: {
+ dl_error_ack_t *errp = (dl_error_ack_t *)buf;
+
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "got ERROR ACK\n"));
+ if (ctlbuf.len < DL_ERROR_ACK_SIZE)
+ return (-1);
+ return (errp->dl_errno);
+ }
+ default:
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "got type: %x\n", dlp->dl_primitive));
+ return (-1);
+ }
+}
+
+/*
+ * Query the interface about it's type.
+ */
+static int
+_dlpi_get_iftype(int fd, unsigned int *iftype)
+{
+ dl_info_req_t info_req;
+ union DL_primitives *dlp;
+ struct strbuf ctlbuf;
+ char buf[MAX(DL_INFO_ACK_SIZE, DL_ERROR_ACK_SIZE)];
+ int flag = 0;
+
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "_dlpi_get_iftype\n"));
+
+ info_req.dl_primitive = DL_INFO_REQ;
+ ctlbuf.buf = (char *)&info_req;
+ ctlbuf.len = DL_INFO_REQ_SIZE;
+ if (putmsg(fd, &ctlbuf, NULL, 0) < 0) {
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "putmsg failed: %d\nn", errno));
+ return (-1);
+ }
+
+ ctlbuf.maxlen = sizeof(buf);
+ ctlbuf.len = 0;
+ ctlbuf.buf = buf;
+ if (getmsg(fd, &ctlbuf, NULL, &flag) < 0) {
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "getmsg failed: %d\n", errno));
+ return (-1);
+ }
+
+ if (ctlbuf.len < sizeof(uint32_t))
+ return (-1);
+ dlp = (union DL_primitives *)buf;
+ switch (dlp->dl_primitive) {
+ case DL_INFO_ACK: {
+ dl_info_ack_t *info = (dl_info_ack_t *)buf;
+
+ if (ctlbuf.len < DL_INFO_ACK_SIZE)
+ return (-1);
+
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "dl_mac_type: %x\n",
+ info->dl_mac_type));
+ switch (info->dl_mac_type) {
+ case DL_CSMACD:
+ case DL_ETHER:
+ case DL_ETH_CSMA:
+ *iftype = 6;
+ break;
+ case DL_TPB: /* Token Passing Bus */
+ *iftype = 8;
+ break;
+ case DL_TPR: /* Token Passing Ring */
+ *iftype = 9;
+ break;
+ case DL_HDLC:
+ *iftype = 118;
+ break;
+ case DL_FDDI:
+ *iftype = 15;
+ break;
+ case DL_FC: /* Fibre channel */
+ *iftype = 56;
+ break;
+ case DL_ATM:
+ *iftype = 37;
+ break;
+ case DL_X25:
+ case DL_ISDN:
+ *iftype = 63;
+ break;
+ case DL_HIPPI:
+ *iftype = 47;
+ break;
+#ifdef DL_IB
+ case DL_IB:
+ *iftype = 199;
+ break;
+#endif
+ case DL_FRAME: /* Frame Relay */
+ *iftype = 32;
+ break;
+ case DL_LOOP:
+ *iftype = 24;
+ break;
+#ifdef DL_WIFI
+ case DL_WIFI:
+ *iftype = 71;
+ break;
+#endif
+#ifdef DL_IPV4 /* then IPv6 is also defined */
+ case DL_IPV4: /* IPv4 Tunnel */
+ case DL_IPV6: /* IPv6 Tunnel */
+ *iftype = 131;
+ break;
+#endif
+ default:
+ *iftype = 1; /* Other */
+ break;
+ }
+
+ return (0);
+ }
+ case DL_ERROR_ACK: {
+ dl_error_ack_t *errp = (dl_error_ack_t *)buf;
+
+ DEBUGMSGTL(("kernel_sunos5:dlpi",
+ "got DL_ERROR_ACK: dlpi %d, error %d\n", errp->dl_errno,
+ errp->dl_unix_errno));
+
+ if (ctlbuf.len < DL_ERROR_ACK_SIZE)
+ return (-1);
+ return (errp->dl_errno);
+ }
+ default:
+ DEBUGMSGTL(("kernel_sunos5:dlpi", "got type %x\n", dlp->dl_primitive));
+ return (-1);
+ }
+}
+
+static int
+_dlpi_attach(int fd, int ppa)
+{
+ dl_attach_req_t attach_req;
+ struct strbuf ctlbuf;
+ union DL_primitives *dlp;
+ char buf[MAX(DL_OK_ACK_SIZE, DL_ERROR_ACK_SIZE)];
+ int flag = 0;
+
+ attach_req.dl_primitive = DL_ATTACH_REQ;
+ attach_req.dl_ppa = ppa;
+ ctlbuf.buf = (char *)&attach_req;
+ ctlbuf.len = DL_ATTACH_REQ_SIZE;
+ if (putmsg(fd, &ctlbuf, NULL, 0) != 0)
+ return (-1);
+
+ ctlbuf.buf = buf;
+ ctlbuf.len = 0;
+ ctlbuf.maxlen = sizeof(buf);
+ if (getmsg(fd, &ctlbuf, NULL, &flag) != 0)
+ return (-1);
+
+ if (ctlbuf.len < sizeof(uint32_t))
+ return (-1);
+
+ dlp = (union DL_primitives *)buf;
+ if (dlp->dl_primitive == DL_OK_ACK && ctlbuf.len >= DL_OK_ACK_SIZE)
+ return (0);
+ return (-1);
+}
+
+static int
+_dlpi_parse_devname(char *devname, int *ppap)
+{
+ int ppa = 0;
+ int m = 1;
+ int i = strlen(devname) - 1;
+
+ while (i >= 0 && isdigit(devname[i])) {
+ ppa += m * (devname[i] - '0');
+ m *= 10;
+ i--;
+ }
+
+ if (m == 1) {
+ return (-1);
+ }
+ *ppap = ppa;
+ devname[i + 1] = '\0';
+
+ return (0);
+}
+static int
+getif(mib2_ifEntry_t *ifbuf, size_t size, req_e req_type,
+ mib2_ifEntry_t *resp, size_t *length, int (*comp)(void *, void *),
+ void *arg)
+{
+ int fd, i, ret;
+ int ifsd, ifsd6 = -1;
+ struct lifreq lifreq, *lifrp;
+ mib2_ifEntry_t *ifp;
+ int nentries = size / sizeof(mib2_ifEntry_t);
+ found_e result = NOT_FOUND;
+ boolean_t if_isv6;
+ uint64_t if_flags;
+ struct if_nameindex *ifname, *ifnp;
+
+ lifrp = &lifreq;
+
+ if ((ifsd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ return -1;
+ }
+
+ DEBUGMSGTL(("kernel_sunos5", "...... using if_nameindex\n"));
+ if ((ifname = if_nameindex()) == NULL) {
+ ret = -1;
+ goto Return;
+ }
+
+ /*
+ * Gather information about each interface found. We try to handle errors
+ * gracefully: if an error occurs while processing an interface we simply
+ * move along to the next one. Previously, the function returned with an
+ * error right away.
+ *
+ * if_nameindex() already eliminates duplicate interfaces, so no extra
+ * checks are needed for interfaces that have both IPv4 and IPv6 plumbed
+ */
+ Again:
+ for (i = 0, ifnp = ifname, ifp = (mib2_ifEntry_t *) ifbuf;
+ ifnp->if_index != 0 && (i < nentries); ifnp++) {
+
+ DEBUGMSGTL(("kernel_sunos5", "...... getif %s\n", ifnp->if_name));
+ memcpy(lifrp->lifr_name, ifnp->if_name, LIFNAMSIZ);
+ if_isv6 = B_FALSE;
+
+ if (ioctl(ifsd, SIOCGLIFFLAGS, lifrp) < 0) {
+ if (ifsd6 == -1) {
+ if ((ifsd6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
+ ret = -1;
+ goto Return;
+ }
+ }
+ if (ioctl(ifsd6, SIOCGLIFFLAGS, lifrp) < 0) {
+ snmp_log(LOG_ERR, "SIOCGLIFFLAGS %s: %s\n",
+ lifrp->lifr_name, strerror(errno));
+ continue;
+ }
+ if_isv6 = B_TRUE;
+ }
+ if_flags = lifrp->lifr_flags;
+
+ if (ioctl(if_isv6?ifsd6:ifsd, SIOCGLIFMTU, lifrp) < 0) {
+ DEBUGMSGTL(("kernel_sunos5", "...... SIOCGLIFMTU failed\n"));
+ continue;
+ }
+
+ memset(ifp, 0, sizeof(mib2_ifEntry_t));
+
+ if ((fd = _dlpi_open(ifnp->if_name)) != -1) {
+ /* Could open DLPI... now try to grab some info */
+ (void) _dlpi_get_phys_address(fd, ifp->ifPhysAddress.o_bytes,
+ sizeof(ifp->ifPhysAddress.o_bytes),
+ &ifp->ifPhysAddress.o_length);
+ (void) _dlpi_get_iftype(fd, &ifp->ifType);
+ close(fd);
+ }
+
+ set_if_info(ifp, ifnp->if_index, ifnp->if_name, if_flags,
+ lifrp->lifr_metric);
+
+ if (get_if_stats(ifp) < 0) {
+ DEBUGMSGTL(("kernel_sunos5", "...... get_if_stats failed\n"));
+ continue;
+ }
+
+ /*
+ * Once we reach here we know that all went well, so move to
+ * the next ifEntry.
+ */
+ i++;
+ ifp++;
+ }
+
+ if ((req_type == GET_NEXT) && (result == NEED_NEXT)) {
+ /*
+ * End of buffer, so "next" is the first item in the next buffer
+ */
+ req_type = GET_FIRST;
+ }
+
+ result = getentry(req_type, (void *) ifbuf, size, sizeof(mib2_ifEntry_t),
+ (void *)resp, comp, arg);
+
+ if ((result != FOUND) && (i == nentries) && ifnp->if_index != 0) {
+ /*
+ * We reached the end of supplied buffer, but there is
+ * some more stuff to read, so continue.
+ */
+ goto Again;
+ }
+
+ if (result != FOUND) {
+ ret = 2;
+ } else {
+ if (ifnp->if_index != 0) {
+ ret = 1; /* Found and more data to fetch */
+ } else {
+ ret = 0; /* Found and no more data */
+ }
+ *length = i * sizeof(mib2_ifEntry_t); /* Actual cache length */
+ }
+
+ Return:
+ if (ifname)
+ if_freenameindex(ifname);
+ close(ifsd);
+ if (ifsd6 != -1)
+ close(ifsd6);
+ return ret;
+}
+#else /* only rely on SIOCGIFCONF to get interface information */
+
+static int
+getif(mib2_ifEntry_t *ifbuf, size_t size, req_e req_type,
+ mib2_ifEntry_t *resp, size_t *length, int (*comp)(void *, void *),
+ void *arg)
+{
+ int i, ret, idx = 1;
+ int ifsd;
+ static char *buf = NULL;
+ static int bufsize = 0;
+ struct ifconf ifconf;
+ struct ifreq *ifrp;
+ mib2_ifEntry_t *ifp;
+ mib2_ipNetToMediaEntry_t Media;
+ int nentries = size / sizeof(mib2_ifEntry_t);
+ int if_flags = 0;
+ found_e result = NOT_FOUND;
+
+ if ((ifsd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ return -1;
+ }
+
+ if (!buf) {
+ bufsize = 10240;
+ buf = malloc(bufsize);
+ if (!buf) {
+ ret = -1;
+ goto Return;
+ }
+ }
+
+ ifconf.ifc_buf = buf;
+ ifconf.ifc_len = bufsize;
+ while (ioctl(ifsd, SIOCGIFCONF, &ifconf) == -1) {
+ bufsize += 10240;
+ free(buf);
+ buf = malloc(bufsize);
+ if (!buf) {
+ ret = -1;
+ goto Return;
+ }
+ ifconf.ifc_buf = buf;
+ ifconf.ifc_len = bufsize;
+ }
+
+ Again:
+ for (i = 0, ifp = (mib2_ifEntry_t *) ifbuf, ifrp = ifconf.ifc_req;
+ ((char *) ifrp < ((char *) ifconf.ifc_buf + ifconf.ifc_len))
+ && (i < nentries); i++, ifp++, ifrp++, idx++) {
+
+ DEBUGMSGTL(("kernel_sunos5", "...... getif %s\n", ifrp->ifr_name));
+
+ if (ioctl(ifsd, SIOCGIFFLAGS, ifrp) < 0) {
+ ret = -1;
+ snmp_log(LOG_ERR, "SIOCGIFFLAGS %s: %s\n", ifrp->ifr_name,
+ strerror(errno));
+ goto Return;
+ }
+ if_flags = ifrp->ifr_flags;
+
+ if (ioctl(ifsd, SIOCGIFMTU, ifrp) < 0) {
+ ret = -1;
+ DEBUGMSGTL(("kernel_sunos5", "...... SIOCGIFMTU failed\n"));
+ goto Return;
+ }
+
+ memset(ifp, 0, sizeof(mib2_ifEntry_t));
+ set_if_info(ifp, idx, ifrp->ifr_name, if_flags, ifrp->ifr_metric);
+
+ if (get_if_stats(ifp) < 0) {
+ ret = -1;
+ goto Return;
+ }
+ /*
+ * An attempt to determine the physical address of the interface.
+ * There should be a more elegant solution using DLPI, but "the margin
+ * is too small to put it here ..."
+ */
+
+ if (ioctl(ifsd, SIOCGIFADDR, ifrp) < 0) {
+ ret = -1;
+ goto Return;
+ }
+
+ if (getMibstat(MIB_IP_NET, &Media, sizeof(mib2_ipNetToMediaEntry_t),
+ GET_EXACT, &Name_cmp, ifrp) == 0) {
+ ifp->ifPhysAddress = Media.ipNetToMediaPhysAddress;
+ }
+ }
+
+ if ((req_type == GET_NEXT) && (result == NEED_NEXT)) {
+ /*
+ * End of buffer, so "next" is the first item in the next buffer
+ */
+ req_type = GET_FIRST;
+ }
+
+ result = getentry(req_type, (void *) ifbuf, size, sizeof(mib2_ifEntry_t),
+ (void *)resp, comp, arg);
+
+ if ((result != FOUND) && (i == nentries) &&
+ ((char *)ifrp < (char *)ifconf.ifc_buf + ifconf.ifc_len)) {
+ /*
+ * We reached the end of supplied buffer, but there is
+ * some more stuff to read, so continue.
+ */
+ ifconf.ifc_len -= i * sizeof(struct ifreq);
+ ifconf.ifc_req = ifrp;
+ goto Again;
+ }
+
+ if (result != FOUND) {
+ ret = 2;
+ } else {
+ if ((char *)ifrp < (char *)ifconf.ifc_buf + ifconf.ifc_len) {
+ ret = 1; /* Found and more data to fetch */
+ } else {
+ ret = 0; /* Found and no more data */
+ }
+ *length = i * sizeof(mib2_ifEntry_t); /* Actual cache length */
+ }
+
+ Return:
+ close(ifsd);
+ return ret;
+}
+#endif /*defined(HAVE_IF_NAMEINDEX)&&defined(NETSNMP_INCLUDE_IFTABLE_REWRITES)*/
+
+static void
+set_if_info(mib2_ifEntry_t *ifp, unsigned index, char *name, uint64_t flags,
+ int mtu)
+{
+ boolean_t havespeed = B_FALSE;
+
+ /*
+ * Set basic information
+ */
+ ifp->ifIndex = index;
+ ifp->ifDescr.o_length = strlen(name);
+ strcpy(ifp->ifDescr.o_bytes, name);
+ ifp->ifAdminStatus = (flags & IFF_UP) ? 1 : 2;
+ ifp->ifOperStatus = ((flags & IFF_UP) && (flags & IFF_RUNNING)) ? 1 : 2;
+ ifp->ifLastChange = 0; /* Who knows ... */
+ ifp->flags = flags;
+ ifp->ifMtu = mtu;
+ ifp->ifSpeed = 0;
+
+ /*
+ * Get link speed
+ */
+ if ((getKstatInt(NULL, name, "ifspeed", &ifp->ifSpeed) == 0)) {
+ /*
+ * check for SunOS patch with half implemented ifSpeed
+ */
+ if (ifp->ifSpeed > 0 && ifp->ifSpeed < 10000) {
+ ifp->ifSpeed *= 1000000;
+ }
+ havespeed = B_TRUE;
+ } else if (getKstatInt(NULL, name, "ifSpeed", &ifp->ifSpeed) == 0) {
+ /*
+ * this is good
+ */
+ havespeed = B_TRUE;
+ }
+
+ /* make ifOperStatus depend on link status if available */
+ if (ifp->ifAdminStatus == 1) {
+ int i_tmp;
+ /* only UPed interfaces get correct link status - if any */
+ if (getKstatInt(NULL, name,"link_up",&i_tmp) == 0) {
+ ifp->ifOperStatus = i_tmp ? 1 : 2;
+#ifdef IFF_FAILED
+ } else if (flags & IFF_FAILED) {
+ /*
+ * If IPMP is used, and if the daemon marks the interface
+ * as 'failed', then we know for sure something is amiss.
+ */
+ ifp->ifOperStatus = 2;
+#endif
+ } else if (havespeed == B_TRUE && ifp->ifSpeed == 0) {
+ /* Heuristic */
+ ifp->ifOperStatus = 2;
+ }
+ }
+
+ /*
+ * Set link Type and Speed (if it could not be determined from kstat)
+ */
+ if (ifp->ifType == 24) {
+ ifp->ifSpeed = 127000000;
+ } else if (ifp->ifType == 1 || ifp->ifType == 0) {
+ /*
+ * Could not get the type from DLPI, so lets fall back to the hardcoded
+ * values.
+ */
+ switch (name[0]) {
+ case 'a': /* ath (802.11) */
+ if (name[1] == 't' && name[2] == 'h')
+ ifp->ifType = 71;
+ break;
+ case 'l': /* le / lo / lane (ATM LAN Emulation) */
+ if (name[1] == 'o') {
+ if (!ifp->ifSpeed)
+ ifp->ifSpeed = 127000000;
+ ifp->ifType = 24;
+ } else if (name[1] == 'e') {
+ if (!ifp->ifSpeed)
+ ifp->ifSpeed = 10000000;
+ ifp->ifType = 6;
+ } else if (name[1] == 'a') {
+ if (!ifp->ifSpeed)
+ ifp->ifSpeed = 155000000;
+ ifp->ifType = 37;
+ }
+ break;
+
+ case 'g': /* ge (gigabit ethernet card) */
+ case 'c': /* ce (Cassini Gigabit-Ethernet (PCI) */
+ if (!ifp->ifSpeed)
+ ifp->ifSpeed = 1000000000;
+ ifp->ifType = 6;
+ break;
+
+ case 'h': /* hme (SBus card) */
+ case 'e': /* eri (PCI card) */
+ case 'b': /* be */
+ case 'd': /* dmfe -- found on netra X1 */
+ if (!ifp->ifSpeed)
+ ifp->ifSpeed = 100000000;
+ ifp->ifType = 6;
+ break;
+
+ case 'f': /* fa (Fore ATM) */
+ if (!ifp->ifSpeed)
+ ifp->ifSpeed = 155000000;
+ ifp->ifType = 37;
+ break;
+
+ case 'q': /* qe (QuadEther)/qa (Fore ATM)/qfe (QuadFastEther) */
+ if (name[1] == 'a') {
+ if (!ifp->ifSpeed)
+ ifp->ifSpeed = 155000000;
+ ifp->ifType = 37;
+ } else if (name[1] == 'e') {
+ if (!ifp->ifSpeed)
+ ifp->ifSpeed = 10000000;
+ ifp->ifType = 6;
+ } else if (name[1] == 'f') {
+ if (!ifp->ifSpeed)
+ ifp->ifSpeed = 100000000;
+ ifp->ifType = 6;
+ }
+ break;
+
+ case 'i': /* ibd (Infiniband)/ip.tun (IP tunnel) */
+ if (name[1] == 'b')
+ ifp->ifType = 199;
+ else if (name[1] == 'p')
+ ifp->ifType = 131;
+ break;
+ }
+ }
+}
+
+static int
+get_if_stats(mib2_ifEntry_t *ifp)
+{
+ Counter l_tmp;
+ char *name = ifp->ifDescr.o_bytes;
+
+ if (strchr(name, ':'))
+ return (0);
+
+ /*
+ * First try to grab 64-bit counters; if they are not available,
+ * fall back to 32-bit.
+ */
+ if (getKstat(name, "ipackets64", &ifp->ifHCInUcastPkts) != 0) {
+ if (getKstatInt(NULL, name, "ipackets", &ifp->ifInUcastPkts) != 0) {
+ return (-1);
+ }
+ } else {
+ ifp->ifInUcastPkts = (uint32_t)(ifp->ifHCInUcastPkts & 0xffffffff);
+ }
+
+ if (getKstat(name, "rbytes64", &ifp->ifHCInOctets) != 0) {
+ if (getKstatInt(NULL, name, "rbytes", &ifp->ifInOctets) != 0) {
+ ifp->ifInOctets = ifp->ifInUcastPkts * 308;
+ }
+ } else {
+ ifp->ifInOctets = (uint32_t)(ifp->ifHCInOctets & 0xffffffff);
+ }
+
+ if (getKstat(name, "opackets64", &ifp->ifHCOutUcastPkts) != 0) {
+ if (getKstatInt(NULL, name, "opackets", &ifp->ifOutUcastPkts) != 0) {
+ return (-1);
+ }
+ } else {
+ ifp->ifOutUcastPkts = (uint32_t)(ifp->ifHCOutUcastPkts & 0xffffffff);
+ }
+
+ if (getKstat(name, "obytes64", &ifp->ifHCOutOctets) != 0) {
+ if (getKstatInt(NULL, name, "obytes", &ifp->ifOutOctets) != 0) {
+ ifp->ifOutOctets = ifp->ifOutUcastPkts * 308; /* XXX */
+ }
+ } else {
+ ifp->ifOutOctets = (uint32_t)(ifp->ifHCOutOctets & 0xffffffff);
+ }
+
+ if (ifp->ifType == 24) /* Loopback */
+ return (0);
+
+ if (getKstatInt(NULL, name, "ierrors", &ifp->ifInErrors) != 0) {
+ return (-1);
+ }
+
+ if (getKstatInt(NULL, name, "oerrors", &ifp->ifOutErrors) != 0) {
+ return (-1);
+ }
+
+ /* Try to grab some additional information */
+ getKstatInt(NULL, name, "collisions", &ifp->ifCollisions);
+ getKstatInt(NULL, name, "unknowns", &ifp->ifInUnknownProtos);
+
+
+ /*
+ * TODO some NICs maintain 64-bit counters for multi/broadcast
+ * packets; should try to get that information.
+ */
+ if (getKstatInt(NULL, name, "brdcstrcv", &l_tmp) == 0)
+ ifp->ifHCInBroadcastPkts = l_tmp;
+
+ if (getKstatInt(NULL, name, "multircv", &l_tmp) == 0)
+ ifp->ifHCInMulticastPkts = l_tmp;
+
+ ifp->ifInNUcastPkts = (uint32_t)(ifp->ifHCInBroadcastPkts +
+ ifp->ifHCInMulticastPkts);
+
+ if (getKstatInt(NULL, name, "brdcstxmt", &l_tmp) == 0)
+ ifp->ifHCOutBroadcastPkts = l_tmp;
+
+ if (getKstatInt(NULL, name, "multixmt", &l_tmp) == 0)
+ ifp->ifHCOutMulticastPkts = l_tmp;
+
+ ifp->ifOutNUcastPkts = (uint32_t)(ifp->ifHCOutBroadcastPkts +
+ ifp->ifHCOutMulticastPkts);
+ return(0);
+}
+/*
+ * Always TRUE. May be used as a comparison function in getMibstat
+ * to obtain the whole table (GET_FIRST should be used)
+ */
+int
+Get_everything(void *x, void *y)
+{
+ return 0; /* Always TRUE */
+}
+
+/*
+ * Compare name and IP address of the interface to ARP table entry.
+ * Needed to obtain the physical address of the interface in getif.
+ */
+static int
+Name_cmp(void *ifrp, void *ep)
+{
+ struct sockaddr_in *s = (struct sockaddr_in *)
+ &(((struct ifreq *)ifrp)->ifr_addr);
+ mib2_ipNetToMediaEntry_t *Ep = (mib2_ipNetToMediaEntry_t *)ep;
+
+ if ((strncmp(Ep->ipNetToMediaIfIndex.o_bytes,
+ ((struct ifreq *)ifrp)->ifr_name,
+ Ep->ipNetToMediaIfIndex.o_length) == 0) &&
+ (s->sin_addr.s_addr == Ep->ipNetToMediaNetAddress)) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+/*
+ * Try to determine the index of a particular interface. If mfd-rewrites is
+ * specified, then this function would only be used when the system does not
+ * have if_nametoindex(3SOCKET).
+ */
+int
+solaris2_if_nametoindex(const char *Name, int Len)
+{
+ int i, sd, lastlen = 0, interfaces = 0;
+ struct ifconf ifc;
+ struct ifreq *ifrp = NULL;
+ char *buf = NULL;
+
+ if (Name == 0) {
+ return 0;
+ }
+ if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ return 0;
+ }
+
+ /*
+ * Cope with lots of interfaces and brokenness of ioctl SIOCGIFCONF
+ * on some platforms; see W. R. Stevens, ``Unix Network Programming
+ * Volume I'', p.435.
+ */
+
+ for (i = 8;; i += 8) {
+ buf = calloc(i, sizeof(struct ifreq));
+ if (buf == NULL) {
+ close(sd);
+ return 0;
+ }
+ ifc.ifc_len = i * sizeof(struct ifreq);
+ ifc.ifc_buf = (caddr_t) buf;
+
+ if (ioctl(sd, SIOCGIFCONF, (char *) &ifc) < 0) {
+ if (errno != EINVAL || lastlen != 0) {
+ /*
+ * Something has gone genuinely wrong.
+ */
+ free(buf);
+ close(sd);
+ return 0;
+ }
+ /*
+ * Otherwise, it could just be that the buffer is too small.
+ */
+ } else {
+ if (ifc.ifc_len == lastlen) {
+ /*
+ * The length is the same as the last time; we're done.
+ */
+ break;
+ }
+ lastlen = ifc.ifc_len;
+ }
+ free(buf);
+ }
+
+ ifrp = ifc.ifc_req;
+ interfaces = (ifc.ifc_len / sizeof(struct ifreq)) + 1;
+
+ for (i = 1; i < interfaces; i++, ifrp++) {
+ if (strncmp(ifrp->ifr_name, Name, Len) == 0) {
+ free(buf);
+ close(sd);
+ return i;
+ }
+ }
+
+ free(buf);
+ close(sd);
+ return 0;
+}
+
+#ifdef _STDC_COMPAT
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+#ifdef _GETKSTAT_TEST
+
+int
+main(int argc, char **argv)
+{
+ int rc = 0;
+ u_long val = 0;
+
+ if (argc != 3) {
+ snmp_log(LOG_ERR, "Usage: %s stat_name var_name\n", argv[0]);
+ exit(1);
+ }
+
+ snmp_set_do_debugging(1);
+ rc = getKstat(argv[1], argv[2], &val);
+
+ if (rc == 0)
+ snmp_log(LOG_ERR, "%s = %lu\n", argv[2], val);
+ else
+ snmp_log(LOG_ERR, "rc =%d\n", rc);
+ return 0;
+}
+#endif /*_GETKSTAT_TEST */
+
+#ifdef _GETMIBSTAT_TEST
+
+int
+ip20comp(void *ifname, void *ipp)
+{
+ return (strncmp((char *) ifname,
+ ((mib2_ipAddrEntry_t *) ipp)->ipAdEntIfIndex.o_bytes,
+ ((mib2_ipAddrEntry_t *) ipp)->ipAdEntIfIndex.
+ o_length));
+}
+
+int
+ARP_Cmp_Addr(void *addr, void *ep)
+{
+ DEBUGMSGTL(("kernel_sunos5", "ARP: %lx <> %lx\n",
+ ((mib2_ipNetToMediaEntry_t *) ep)->ipNetToMediaNetAddress,
+ *(IpAddress *) addr));
+ if (((mib2_ipNetToMediaEntry_t *) ep)->ipNetToMediaNetAddress ==
+ *(IpAddress *)addr) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+int
+IF_cmp(void *addr, void *ep)
+{
+ if (((mib2_ifEntry_t *)ep)->ifIndex ==((mib2_ifEntry_t *)addr)->ifIndex) {
+ return 0;
+ } else {
+ return 1;
+ }
+}
+
+int
+main(int argc, char **argv)
+{
+ int rc = 0, i, idx;
+ mib2_ipAddrEntry_t ipbuf, *ipp = &ipbuf;
+ mib2_ipNetToMediaEntry_t entry, *ep = &entry;
+ mib2_ifEntry_t ifstat;
+ req_e req_type;
+ IpAddress LastAddr = 0;
+
+ if (argc != 3) {
+ snmp_log(LOG_ERR,
+ "Usage: %s if_name req_type (0 first, 1 exact, 2 next) \n",
+ argv[0]);
+ exit(1);
+ }
+
+ switch (atoi(argv[2])) {
+ case 0:
+ req_type = GET_FIRST;
+ break;
+ case 1:
+ req_type = GET_EXACT;
+ break;
+ case 2:
+ req_type = GET_NEXT;
+ break;
+ };
+
+ snmp_set_do_debugging(0);
+ while ((rc =
+ getMibstat(MIB_INTERFACES, &ifstat, sizeof(mib2_ifEntry_t),
+ req_type, &IF_cmp, &idx)) == 0) {
+ idx = ifstat.ifIndex;
+ DEBUGMSGTL(("kernel_sunos5", "Ifname = %s\n",
+ ifstat.ifDescr.o_bytes));
+ req_type = GET_NEXT;
+ }
+ rc = getMibstat(MIB_IP_ADDR, &ipbuf, sizeof(mib2_ipAddrEntry_t),
+ req_type, ip20comp, argv[1]);
+
+ if (rc == 0)
+ DEBUGMSGTL(("kernel_sunos5", "mtu = %ld\n",
+ ipp->ipAdEntInfo.ae_mtu));
+ else
+ DEBUGMSGTL(("kernel_sunos5", "rc =%d\n", rc));
+
+ while ((rc =
+ getMibstat(MIB_IP_NET, &entry,
+ sizeof(mib2_ipNetToMediaEntry_t), req_type,
+ &ARP_Cmp_Addr, &LastAddr)) == 0) {
+ LastAddr = ep->ipNetToMediaNetAddress;
+ DEBUGMSGTL(("kernel_sunos5", "Ipaddr = %lX\n", (u_long) LastAddr));
+ req_type = GET_NEXT;
+ }
+ return 0;
+}
+#endif /*_GETMIBSTAT_TEST */
+#endif /* SUNOS5 */
+
+
+/*-
+ * These variables describe the formatting of this file. If you don't like the
+ * template defaults, feel free to change them here (not in your .emacs file).
+ *
+ * Local Variables:
+ * comment-column: 32
+ * c-indent-level: 4
+ * c-continued-statement-offset: 4
+ * c-brace-offset: -4
+ * c-argdecl-indent: 0
+ * c-label-offset: -4
+ * fill-column: 79
+ * fill-prefix: " * "
+ * End:
+ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/kernel_sunos5.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/kernel_sunos5.h
new file mode 100644
index 0000000000..cdd2375a44
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/kernel_sunos5.h
@@ -0,0 +1,214 @@
+/*- This is a -*- C -*- compatible header file
+ *
+ * Generic public interface for SUNOS5_INSTRUMENTATION
+ *
+ * This file contains manifest constants (#defines), macros, enumerations,
+ * public structure definitions, static const definitions, global variable
+ * declarations, and function prototypes.
+ *
+ * This file contains types and structures for SunOS 5.x instrumentation
+ *
+ */
+
+#ifndef _KERNEL_SUNOS5_H /* duplicate include prevention */
+#define _KERNEL_SUNOS5_H
+
+#include <inet/mib2.h>
+
+#ifndef HAVE_COUNTER64
+typedef uint64_t Counter64;
+#endif
+
+#define COPY_IPADDR(fp, from, tp, to) \
+ fp = from; \
+ tp = to; \
+ *tp++ = *fp++; \
+ *tp++ = *fp++; \
+ *tp++ = *fp++; \
+ *tp++ = *fp++;
+
+#ifdef MIB2_IP_TRAFFIC_STATS
+#define SOLARIS_HAVE_RFC4293_SUPPORT
+#endif
+
+#ifdef MIB2_IP6
+#define SOLARIS_HAVE_IPV6_MIB_SUPPORT
+#endif
+
+/*-
+ * Manifest constants
+ */
+
+#define KSTAT_DATA_MAX 100 /* Maximum number of kstat entries. To be changed later */
+
+/*-
+ * Macros
+ */
+#define CACHE_MOREDATA 0x001 /* There are unread data outside cache */
+
+/*-
+ * Enumeration types
+ */
+
+typedef enum { GET_FIRST, GET_EXACT, GET_NEXT } req_e;
+typedef enum { FOUND, NOT_FOUND, NEED_NEXT } found_e;
+
+typedef enum {
+ MIB_SYSTEM = 0,
+ MIB_INTERFACES = 1,
+ MIB_AT = 2,
+ MIB_IP = 3,
+ MIB_IP_ADDR = 4,
+ MIB_IP_ROUTE = 5,
+ MIB_IP_NET = 6,
+ MIB_ICMP = 7,
+ MIB_TCP = 8,
+ MIB_TCP_CONN = 9,
+ MIB_UDP = 10,
+ MIB_UDP_LISTEN = 11,
+ MIB_EGP = 12,
+ MIB_CMOT = 13,
+ MIB_TRANSMISSION = 14,
+ MIB_SNMP = 15,
+#ifdef SOLARIS_HAVE_IPV6_MIB_SUPPORT
+ MIB_IP6_ADDR = 16,
+ MIB_TCP6_CONN,
+ MIB_UDP6_ENDPOINT,
+#endif
+ MIBCACHE_SIZE
+} mibgroup_e;
+
+/*-
+ * Structure definitions (use "typedef struct foo {} foo;" form)
+ */
+
+/*
+ * MIB-II cache. Simple buffering scheme - last read block is in the cache
+ */
+
+typedef struct mibcache {
+ mibgroup_e cache_groupid; /* MIB-II group */
+ size_t cache_size; /* Size of this cache table in bytes */
+ void *cache_addr; /* Pointer to real cache memory */
+ size_t cache_length; /* Useful length in bytes */
+ size_t cache_ttl; /* Time this type of cache entry stays valid */
+ time_t cache_time; /* CURRENT time left for this cache entry */
+ int cache_flags; /* Cache state */
+ int cache_last_found; /* Index of last cache element that was found */
+ void *cache_comp; /* Compare routine used to set the cache */
+ void *cache_arg; /* Argument for compare routine used to set the cache */
+} mibcache;
+
+/*
+ * Mapping between mibgroup_t, mibtable_t and mib2.h defines
+ */
+
+typedef struct mibmap {
+ int group; /* mib2.h group name */
+ int table; /* mib2.h table name */
+} mibmap;
+
+/*
+ * Structures, missing in <inet/mib2.h>
+ */
+typedef unsigned long TimeTicks;
+
+typedef struct mib2_ifEntry {
+ int ifIndex; /* ifEntry 1 */
+ DeviceName ifDescr; /* ifEntry 2 */
+ int ifType; /* ifEntry 3 */
+ int ifMtu; /* ifEntry 4 */
+ Gauge ifSpeed; /* ifEntry 5 */
+ PhysAddress ifPhysAddress; /* ifEntry 6 */
+ int ifAdminStatus; /* ifEntry 7 */
+ int ifOperStatus; /* ifEntry 8 */
+ TimeTicks ifLastChange; /* ifEntry 9 */
+ Counter ifInOctets; /* ifEntry 10 */
+ Counter ifInUcastPkts; /* ifEntry 11 */
+ Counter ifInNUcastPkts; /* ifEntry 12 */
+ Counter ifInDiscards; /* ifEntry 13 */
+ Counter ifInErrors; /* ifEntry 14 */
+ Counter ifInUnknownProtos; /* ifEntry 15 */
+ Counter ifOutOctets; /* ifEntry 16 */
+ Counter ifOutUcastPkts; /* ifEntry 17 */
+ Counter ifOutNUcastPkts; /* ifEntry 18 */
+ Counter ifOutDiscards; /* ifEntry 19 */
+ Counter ifOutErrors; /* ifEntry 20 */
+ Gauge ifOutQLen; /* ifEntry 21 */
+ int ifSpecific; /* ifEntry 22 */
+
+ /*
+ * Support ifXTable.
+ */
+ Counter64 ifHCInOctets;
+ Counter64 ifHCInUcastPkts;
+ Counter64 ifHCInMulticastPkts;
+ Counter64 ifHCInBroadcastPkts;
+ Counter64 ifHCOutOctets;
+ Counter64 ifHCOutUcastPkts;
+ Counter64 ifHCOutMulticastPkts;
+ Counter64 ifHCOutBroadcastPkts;
+
+ /*
+ * Counters not part of ifTable or ifXTable
+ */
+ Counter ifCollisions;
+ int flags; /* interface flags (IFF_*) */
+} mib2_ifEntry_t;
+
+/*-
+ * Static const definitions (must be declared static and initialized)
+ */
+
+
+/*-
+ * Global variable declarations (using extern and without initialization)
+ */
+
+/*-
+ * Function prototypes (use void as argument type if there are no arguments)
+ */
+
+#ifdef _STDC_COMPAT
+#ifdef __cplusplus
+extern "C" {
+#endif
+#endif
+ void init_kernel_sunos5(void);
+
+ int getKstat(const char *statname, const char *varname,
+ void *value);
+ int getMibstat(mibgroup_e grid, void *resp,
+ size_t entrysize, req_e req_type,
+ int (*comp) (void *, void *), void *arg);
+ int Get_everything(void *, void *);
+ int getKstatInt(const char *classname,
+ const char *statname, const char *varname,
+ int *value);
+
+ int getKstatString(const char *statname, const char *varname,
+ char *value, size_t value_len);
+
+ int solaris2_if_nametoindex(const char *, int);
+
+#ifdef _STDC_COMPAT
+#ifdef __cplusplus
+}
+#endif
+#endif
+/*-
+ * These variables describe the formatting of this file. If you don't like the
+ * template defaults, feel free to change them here (not in your .emacs file).
+ *
+ * Local Variables:
+ * comment-column: 32
+ * c-indent-level: 4
+ * c-continued-statement-offset: 4
+ * c-brace-offset: -4
+ * c-argdecl-indent: 0
+ * c-label-offset: -4
+ * fill-column: 79
+ * fill-prefix: " * "
+ * End:
+ */
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII.h
new file mode 100644
index 0000000000..9b60d36a03
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII.h
@@ -0,0 +1,32 @@
+/*
+ * module to include the modules relavent to the mib-II mib(s)
+ */
+
+config_require(mibII/system_mib)
+config_require(mibII/sysORTable)
+config_require(mibII/at)
+config_require(mibII/ifTable)
+config_require(mibII/ip)
+config_require(mibII/snmp_mib)
+config_require(mibII/tcp)
+config_require(mibII/icmp)
+config_require(mibII/udp)
+config_require(mibII/vacm_vars)
+config_require(mibII/setSerialNo)
+
+/* mibII/ipv6 is activated via --enable-ipv6 and only builds on Linux+*BSD */
+#if defined(NETSNMP_ENABLE_IPV6) && (defined(linux) || defined(freebsd3) || defined(netbsd) || defined(openbsd))
+config_require(mibII/ipv6)
+#endif
+
+#ifdef NETSNMP_INCLUDE_IFTABLE_REWRITES
+config_require(if-mib)
+#endif
+
+/*
+ * these new module re-rewrites have only been implemented for
+ * linux.
+ */
+#if defined( linux )
+config_require(ip-mib ip-forward-mib tcp-mib udp-mib)
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/at.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/at.c
new file mode 100644
index 0000000000..67f83fda86
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/at.c
@@ -0,0 +1,1263 @@
+/*
+ * Template MIB group implementation - at.c
+ *
+ */
+
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include "mibII_common.h" /* for NETSNMP_KLOOKUP */
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+# if defined (WIN32) || defined (cygwin)
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+
+#if HAVE_NETINET_IF_ETHER_H
+#include <netinet/if_ether.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#if HAVE_NET_IF_DL_H
+#ifndef dynix
+#include <net/if_dl.h>
+#else
+#include <sys/net/if_dl.h>
+#endif
+#endif
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#ifdef solaris2
+#include "kernel_sunos5.h"
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#ifdef hpux11
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif /* hpux11 */
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "at.h"
+#include "interfaces.h"
+
+#include <net-snmp/data_access/interface.h>
+
+#if defined(HAVE_SYS_SYSCTL_H) && !defined(NETSNMP_CAN_USE_SYSCTL)
+# if defined(RTF_LLINFO)
+# define NETSNMP_CAN_USE_SYSCTL 1
+# endif
+#endif
+
+#ifdef cygwin
+#include <windows.h>
+#endif
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+#if !defined (WIN32) && !defined (cygwin)
+#ifndef solaris2
+static void ARP_Scan_Init(void);
+#ifdef ARP_SCAN_FOUR_ARGUMENTS
+static int ARP_Scan_Next(u_long *, char *, u_long *, u_short *);
+#else
+static int ARP_Scan_Next(u_long *, char *, u_long *);
+#endif
+#endif
+#endif
+
+ /*********************
+ *
+ * Public interface functions
+ *
+ *********************/
+
+/*
+ * define the structure we're going to ask the agent to register our
+ * information at
+ */
+struct variable1 at_variables[] = {
+ {ATIFINDEX, ASN_INTEGER, RONLY, var_atEntry, 1, {1}},
+ {ATPHYSADDRESS, ASN_OCTET_STR, RONLY, var_atEntry, 1, {2}},
+ {ATNETADDRESS, ASN_IPADDRESS, RONLY, var_atEntry, 1, {3}}
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+oid at_variables_oid[] = { SNMP_OID_MIB2, 3, 1, 1 };
+
+void
+init_at(void)
+{
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("mibII/at", at_variables, variable1, at_variables_oid);
+#ifdef solaris2
+ init_kernel_sunos5();
+#endif
+}
+
+#if !defined (WIN32) && !defined (cygwin)
+#ifndef solaris2
+
+/*
+ * var_atEntry(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+
+u_char *
+var_atEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * Address Translation table object identifier is of form:
+ * 1.3.6.1.2.1.3.1.1.1.interface.1.A.B.C.D, where A.B.C.D is IP address.
+ * Interface is at offset 10,
+ * IPADDR starts at offset 12.
+ *
+ * IP Net to Media table object identifier is of form:
+ * 1.3.6.1.2.1.4.22.1.1.1.interface.A.B.C.D, where A.B.C.D is IP address.
+ * Interface is at offset 10,
+ * IPADDR starts at offset 11.
+ */
+ u_char *cp;
+ oid *op;
+ oid lowest[16];
+ oid current[16];
+ static char PhysAddr[6], LowPhysAddr[6];
+ u_long Addr, LowAddr, foundone;
+ static in_addr_t addr_ret;
+#ifdef ARP_SCAN_FOUR_ARGUMENTS
+ u_short ifIndex, lowIfIndex = 0;
+#endif /* ARP_SCAN_FOUR_ARGUMENTS */
+ u_long ifType, lowIfType = 0;
+
+ int oid_length;
+
+ /*
+ * fill in object part of name for current (less sizeof instance part)
+ */
+ memcpy((char *) current, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+
+ if (current[6] == 3) { /* AT group oid */
+ oid_length = 16;
+ } else { /* IP NetToMedia group oid */
+ oid_length = 15;
+ }
+
+ LowAddr = 0; /* Don't have one yet */
+ foundone = 0;
+ ARP_Scan_Init();
+ for (;;) {
+#ifdef ARP_SCAN_FOUR_ARGUMENTS
+ if (ARP_Scan_Next(&Addr, PhysAddr, &ifType, &ifIndex) == 0)
+ break;
+ current[10] = ifIndex;
+
+ if (current[6] == 3) { /* AT group oid */
+ current[11] = 1;
+ op = current + 12;
+ } else { /* IP NetToMedia group oid */
+ op = current + 11;
+ }
+#else /* ARP_SCAN_FOUR_ARGUMENTS */
+ if (ARP_Scan_Next(&Addr, PhysAddr, &ifType) == 0)
+ break;
+ current[10] = 1;
+
+ if (current[6] == 3) { /* AT group oid */
+ current[11] = 1;
+ op = current + 12;
+ } else { /* IP NetToMedia group oid */
+ op = current + 11;
+ }
+#endif /* ARP_SCAN_FOUR_ARGUMENTS */
+ cp = (u_char *) & Addr;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+
+ if (exact) {
+ if (snmp_oid_compare(current, oid_length, name, *length) == 0) {
+ memcpy((char *) lowest, (char *) current,
+ oid_length * sizeof(oid));
+ LowAddr = Addr;
+ foundone = 1;
+#ifdef ARP_SCAN_FOUR_ARGUMENTS
+ lowIfIndex = ifIndex;
+#endif /* ARP_SCAN_FOUR_ARGUMENTS */
+ memcpy(LowPhysAddr, PhysAddr, sizeof(PhysAddr));
+ lowIfType = ifType;
+ break; /* no need to search further */
+ }
+ } else {
+ if ((snmp_oid_compare(current, oid_length, name, *length) > 0)
+ && ((foundone == 0)
+ ||
+ (snmp_oid_compare
+ (current, oid_length, lowest, oid_length) < 0))) {
+ /*
+ * if new one is greater than input and closer to input than
+ * previous lowest, save this one as the "next" one.
+ */
+ memcpy((char *) lowest, (char *) current,
+ oid_length * sizeof(oid));
+ LowAddr = Addr;
+ foundone = 1;
+#ifdef ARP_SCAN_FOUR_ARGUMENTS
+ lowIfIndex = ifIndex;
+#endif /* ARP_SCAN_FOUR_ARGUMENTS */
+ memcpy(LowPhysAddr, PhysAddr, sizeof(PhysAddr));
+ lowIfType = ifType;
+ }
+ }
+ }
+ if (foundone == 0)
+ return (NULL);
+
+ memcpy((char *) name, (char *) lowest, oid_length * sizeof(oid));
+ *length = oid_length;
+ *write_method = 0;
+ switch (vp->magic) {
+ case IPMEDIAIFINDEX: /* also ATIFINDEX */
+ *var_len = sizeof long_return;
+#ifdef ARP_SCAN_FOUR_ARGUMENTS
+ long_return = lowIfIndex;
+#else /* ARP_SCAN_FOUR_ARGUMENTS */
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = 1; /* XXX */
+#endif /* ARP_SCAN_FOUR_ARGUMENTS */
+ return (u_char *) & long_return;
+ case IPMEDIAPHYSADDRESS: /* also ATPHYSADDRESS */
+ *var_len = sizeof(LowPhysAddr);
+ return (u_char *) LowPhysAddr;
+ case IPMEDIANETADDRESS: /* also ATNETADDRESS */
+ *var_len = sizeof(addr_ret);
+ addr_ret = LowAddr;
+ return (u_char *) & addr_ret;
+ case IPMEDIATYPE:
+ *var_len = sizeof long_return;
+ long_return = lowIfType;
+ return (u_char *) & long_return;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_atEntry\n",
+ vp->magic));
+ }
+ return NULL;
+}
+#else /* solaris2 */
+
+typedef struct if_ip {
+ int ifIdx;
+ IpAddress ipAddr;
+} if_ip_t;
+
+static int
+AT_Cmp(void *addr, void *ep)
+{
+ mib2_ipNetToMediaEntry_t *mp = (mib2_ipNetToMediaEntry_t *) ep;
+ int ret = -1;
+ oid index;
+
+#ifdef NETSNMP_INCLUDE_IFTABLE_REWRITES
+ mp->ipNetToMediaIfIndex.o_bytes[mp->ipNetToMediaIfIndex.o_length] = '\0';
+ index = netsnmp_access_interface_index_find(
+ mp->ipNetToMediaIfIndex.o_bytes);
+#else
+ index = Interface_Index_By_Name(mp->ipNetToMediaIfIndex.o_bytes,
+ mp->ipNetToMediaIfIndex.o_length);
+#endif
+ DEBUGMSGTL(("mibII/at", "......... AT_Cmp %lx<>%lx %d<>%d (%.5s)\n",
+ mp->ipNetToMediaNetAddress, ((if_ip_t *) addr)->ipAddr,
+ ((if_ip_t *) addr)->ifIdx, index,
+ mp->ipNetToMediaIfIndex.o_bytes));
+ if (mp->ipNetToMediaNetAddress != ((if_ip_t *) addr)->ipAddr)
+ ret = 1;
+ else if (((if_ip_t *) addr)->ifIdx != index)
+ ret = 1;
+ else
+ ret = 0;
+ DEBUGMSGTL(("mibII/at", "......... AT_Cmp returns %d\n", ret));
+ return ret;
+}
+
+u_char *
+var_atEntry(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * object identifier is of form:
+ * 1.3.6.1.2.1.3.1.1.1.interface.1.A.B.C.D, where A.B.C.D is IP address.
+ * Interface is at offset 10,
+ * IPADDR starts at offset 12.
+ */
+#define AT_MAX_NAME_LENGTH 16
+#define AT_IFINDEX_OFF 10
+ u_char *cp;
+ oid *op;
+ oid lowest[AT_MAX_NAME_LENGTH];
+ oid current[AT_MAX_NAME_LENGTH];
+ if_ip_t NextAddr;
+ mib2_ipNetToMediaEntry_t entry;
+ static mib2_ipNetToMediaEntry_t Lowentry;
+ int Found = 0;
+ req_e req_type;
+ int offset, olength;
+ static in_addr_t addr_ret;
+
+ /*
+ * fill in object part of name for current (less sizeof instance part)
+ */
+
+ DEBUGMSGTL(("mibII/at", "var_atEntry: "));
+ DEBUGMSGOID(("mibII/at", vp->name, vp->namelen));
+ DEBUGMSG(("mibII/at", " %d\n", exact));
+
+ memset(&Lowentry, 0, sizeof(Lowentry));
+ memcpy((char *) current, (char *) vp->name, vp->namelen * sizeof(oid));
+ lowest[0] = 1024;
+ for (NextAddr.ipAddr = (u_long) - 1, NextAddr.ifIdx = 255, req_type =
+ GET_FIRST;;
+ NextAddr.ipAddr = entry.ipNetToMediaNetAddress, NextAddr.ifIdx =
+ current[AT_IFINDEX_OFF], req_type = GET_NEXT) {
+ if (getMibstat
+ (MIB_IP_NET, &entry, sizeof(mib2_ipNetToMediaEntry_t),
+ req_type, &AT_Cmp, &NextAddr) != 0)
+ break;
+#ifdef NETSNMP_INCLUDE_IFTABLE_REWRITES
+ entry.ipNetToMediaIfIndex.o_bytes[entry.ipNetToMediaIfIndex.o_length] = '\0';
+ current[AT_IFINDEX_OFF] = netsnmp_access_interface_index_find(
+ entry.ipNetToMediaIfIndex.o_bytes);
+#else
+ current[AT_IFINDEX_OFF] =
+ Interface_Index_By_Name(entry.ipNetToMediaIfIndex.o_bytes,
+ entry.ipNetToMediaIfIndex.o_length);
+#endif
+ if (current[6] == 3) { /* AT group oid */
+ current[AT_IFINDEX_OFF + 1] = 1;
+ offset = AT_IFINDEX_OFF + 2;
+ olength = AT_IFINDEX_OFF + 6;
+ } else {
+ offset = AT_IFINDEX_OFF + 1;
+ olength = AT_IFINDEX_OFF + 5;
+ }
+ COPY_IPADDR(cp, (u_char *) & entry.ipNetToMediaNetAddress, op,
+ current + offset);
+ if (exact) {
+ if (snmp_oid_compare(current, olength, name, *length) == 0) {
+ memcpy((char *) lowest, (char *) current,
+ olength * sizeof(oid));
+ Lowentry = entry;
+ Found++;
+ break; /* no need to search further */
+ }
+ } else {
+ if (snmp_oid_compare(current, olength, name, *length) > 0
+ && snmp_oid_compare(current, olength, lowest,
+ *length) < 0) {
+ /*
+ * if new one is greater than input and closer to input than
+ * previous lowest, and is not equal to it, save this one as the "next" one.
+ */
+ memcpy((char *) lowest, (char *) current,
+ olength * sizeof(oid));
+ Lowentry = entry;
+ Found++;
+ }
+ }
+ }
+ DEBUGMSGTL(("mibII/at", "... Found = %d\n", Found));
+ if (Found == 0)
+ return (NULL);
+ memcpy((char *) name, (char *) lowest, olength * sizeof(oid));
+ *length = olength;
+ *write_method = 0;
+ switch (vp->magic) {
+ case IPMEDIAIFINDEX:
+ *var_len = sizeof long_return;
+#ifdef NETSNMP_INCLUDE_IFTABLE_REWRITES
+ Lowentry.ipNetToMediaIfIndex.o_bytes[
+ Lowentry.ipNetToMediaIfIndex.o_length] = '\0';
+ long_return = netsnmp_access_interface_index_find(
+ Lowentry.ipNetToMediaIfIndex.o_bytes);
+#else
+ long_return = Interface_Index_By_Name(
+ Lowentry.ipNetToMediaIfIndex.o_bytes,
+ Lowentry.ipNetToMediaIfIndex.o_length);
+#endif
+ return (u_char *) & long_return;
+ case IPMEDIAPHYSADDRESS:
+ *var_len = Lowentry.ipNetToMediaPhysAddress.o_length;
+ return Lowentry.ipNetToMediaPhysAddress.o_bytes;
+ case IPMEDIANETADDRESS:
+ *var_len = sizeof(addr_ret);
+ addr_ret = Lowentry.ipNetToMediaNetAddress;
+ return (u_char *) &addr_ret;
+ case IPMEDIATYPE:
+ *var_len = sizeof long_return;
+ long_return = Lowentry.ipNetToMediaType;
+ return (u_char *) & long_return;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_atEntry\n",
+ vp->magic));
+ }
+ return NULL;
+}
+#endif /* solaris2 */
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+#ifndef solaris2
+
+static int arptab_size, arptab_current;
+#if NETSNMP_CAN_USE_SYSCTL
+static char *lim, *rtnext;
+static char *at = 0;
+#else
+#ifdef STRUCT_ARPHD_HAS_AT_NEXT
+static struct arphd *at = 0;
+static struct arptab *at_ptr, at_entry;
+static struct arpcom at_com;
+#elif defined(hpux11)
+static mib_ipNetToMediaEnt *at = (mib_ipNetToMediaEnt *) 0;
+#else
+
+/*
+ * at used to be allocated every time we needed to look at the arp cache.
+ * This cause us to parse /proc/net/arp twice for each request and didn't
+ * allow us to filter things like we'd like to. So now we use it
+ * semi-statically. We initialize it to size 0 and if we need more room
+ * we realloc room for ARP_CACHE_INCR more entries in the table.
+ * We never release what we've taken . . .
+ */
+#define ARP_CACHE_INCR 1024
+static struct arptab *at = NULL;
+static int arptab_curr_max_size = 0;
+
+#endif
+#endif /* NETSNMP_CAN_USE_SYSCTL */
+
+static void
+ARP_Scan_Init(void)
+{
+#ifndef NETSNMP_CAN_USE_SYSCTL
+#ifndef linux
+#ifdef hpux11
+
+ int fd;
+ struct nmparms p;
+ int val;
+ unsigned int ulen;
+ int ret;
+
+ if (at)
+ free(at);
+ at = (mib_ipNetToMediaEnt *) 0;
+ arptab_size = 0;
+
+ if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) >= 0) {
+ p.objid = ID_ipNetToMediaTableNum;
+ p.buffer = (void *) &val;
+ ulen = sizeof(int);
+ p.len = &ulen;
+ if ((ret = get_mib_info(fd, &p)) == 0)
+ arptab_size = val;
+
+ if (arptab_size > 0) {
+ ulen = (unsigned) arptab_size *sizeof(mib_ipNetToMediaEnt);
+ at = (mib_ipNetToMediaEnt *) malloc(ulen);
+ p.objid = ID_ipNetToMediaTable;
+ p.buffer = (void *) at;
+ p.len = &ulen;
+ if ((ret = get_mib_info(fd, &p)) < 0)
+ arptab_size = 0;
+ }
+
+ close_mib(fd);
+ }
+
+ arptab_current = 0;
+
+#else /* hpux11 */
+
+ if (!at) {
+#ifdef ARPTAB_SIZE_SYMBOL
+ auto_nlist(ARPTAB_SIZE_SYMBOL, (char *) &arptab_size,
+ sizeof arptab_size);
+#ifdef STRUCT_ARPHD_HAS_AT_NEXT
+ at = (struct arphd *) malloc(arptab_size * sizeof(struct arphd));
+#else
+ at = (struct arptab *) malloc(arptab_size * sizeof(struct arptab));
+#endif
+#else
+ return;
+#endif
+ }
+#ifdef STRUCT_ARPHD_HAS_AT_NEXT
+ auto_nlist(ARPTAB_SYMBOL, (char *) at,
+ arptab_size * sizeof(struct arphd));
+ at_ptr = at[0].at_next;
+#else
+ auto_nlist(ARPTAB_SYMBOL, (char *) at,
+ arptab_size * sizeof(struct arptab));
+#endif
+ arptab_current = 0;
+
+#endif /* hpux11 */
+#else /* linux */
+
+ static time_t tm = 0; /* Time of last scan */
+ FILE *in;
+ int i;
+ char line[128];
+ int za, zb, zc, zd, ze, zf, zg, zh, zi, zj;
+ char ifname[21];
+
+ arptab_current = 0; /* Anytime this is called we need to reset 'current' */
+
+ if (time(NULL) < tm + 1) { /*Our cool one second cache implementation :-) */
+ return;
+ }
+
+ in = fopen("/proc/net/arp", "r");
+ if (!in) {
+ snmp_log(LOG_ERR, "snmpd: Cannot open /proc/net/arp\n");
+ arptab_size = 0;
+ return;
+ }
+
+ /*
+ * Get rid of the header line
+ */
+ fgets(line, sizeof(line), in);
+
+ i = 0;
+ while (fgets(line, sizeof(line), in)) {
+ u_long tmp_a;
+ int tmp_flags;
+ if (i >= arptab_curr_max_size) {
+ struct arptab *newtab = (struct arptab *)
+ realloc(at, (sizeof(struct arptab) *
+ (arptab_curr_max_size + ARP_CACHE_INCR)));
+ if (newtab == at) {
+ snmp_log(LOG_ERR,
+ "Error allocating more space for arpcache. "
+ "Cache will continue to be limited to %d entries",
+ arptab_curr_max_size);
+ break;
+ } else {
+ arptab_curr_max_size += ARP_CACHE_INCR;
+ at = newtab;
+ }
+ }
+ if (12 !=
+ sscanf(line,
+ "%d.%d.%d.%d 0x%*x 0x%x %x:%x:%x:%x:%x:%x %*[^ ] %20s\n",
+ &za, &zb, &zc, &zd, &tmp_flags, &ze, &zf, &zg, &zh, &zi,
+ &zj, ifname)) {
+ snmp_log(LOG_ERR, "Bad line in /proc/net/arp: %s", line);
+ continue;
+ }
+ /*
+ * Invalidated entries have their flag set to 0.
+ * * We want to ignore them
+ */
+ if (tmp_flags == 0) {
+ continue;
+ }
+ ifname[sizeof(ifname)-1] = 0; /* make sure name is null terminated */
+ at[i].at_flags = tmp_flags;
+ at[i].at_enaddr[0] = ze;
+ at[i].at_enaddr[1] = zf;
+ at[i].at_enaddr[2] = zg;
+ at[i].at_enaddr[3] = zh;
+ at[i].at_enaddr[4] = zi;
+ at[i].at_enaddr[5] = zj;
+ tmp_a = ((u_long) za << 24) |
+ ((u_long) zb << 16) | ((u_long) zc << 8) | ((u_long) zd);
+ at[i].at_iaddr.s_addr = htonl(tmp_a);
+ at[i].if_index = netsnmp_access_interface_index_find(ifname);
+ i++;
+ }
+ arptab_size = i;
+
+ fclose(in);
+ time(&tm);
+#endif /* linux */
+#else /* NETSNMP_CAN_USE_SYSCTL */
+
+ int mib[6];
+ size_t needed;
+
+ mib[0] = CTL_NET;
+ mib[1] = PF_ROUTE;
+ mib[2] = 0;
+ mib[3] = AF_INET;
+ mib[4] = NET_RT_FLAGS;
+ mib[5] = RTF_LLINFO;
+
+ if (at)
+ free(at);
+ rtnext = lim = at = 0;
+
+ if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
+ snmp_log_perror("route-sysctl-estimate");
+ else {
+ if ((at = malloc(needed ? needed : 1)) == NULL)
+ snmp_log_perror("malloc");
+ else {
+ if (sysctl(mib, 6, at, &needed, NULL, 0) < 0)
+ snmp_log_perror("actual retrieval of routing table");
+ else {
+ lim = at + needed;
+ rtnext = at;
+ }
+ }
+ }
+
+#endif /* NETSNMP_CAN_USE_SYSCTL */
+}
+
+#ifdef ARP_SCAN_FOUR_ARGUMENTS
+static int
+ARP_Scan_Next(u_long * IPAddr, char *PhysAddr, u_long * ifType,
+ u_short * ifIndex)
+#else
+static int
+ARP_Scan_Next(u_long * IPAddr, char *PhysAddr, u_long * ifType)
+#endif
+{
+#ifndef NETSNMP_CAN_USE_SYSCTL
+#ifdef linux
+ if (arptab_current < arptab_size) {
+ /*
+ * copy values
+ */
+ *IPAddr = at[arptab_current].at_iaddr.s_addr;
+ *ifType =
+ (at[arptab_current].
+ at_flags & ATF_PERM) ? 4 /*static */ : 3 /*dynamic */ ;
+ *ifIndex = at[arptab_current].if_index;
+ memcpy(PhysAddr, &at[arptab_current].at_enaddr,
+ sizeof(at[arptab_current].at_enaddr));
+
+ /*
+ * increment to point next entry
+ */
+ arptab_current++;
+ /*
+ * return success
+ */
+ return (1);
+ }
+#elif defined(hpux11)
+ if (arptab_current < arptab_size) {
+ /*
+ * copy values
+ */
+ *IPAddr = at[arptab_current].NetAddr;
+ memcpy(PhysAddr, at[arptab_current].PhysAddr.o_bytes,
+ at[arptab_current].PhysAddr.o_length);
+ *ifType = at[arptab_current].Type;
+ *ifIndex = at[arptab_current].IfIndex;
+ /*
+ * increment to point next entry
+ */
+ arptab_current++;
+ /*
+ * return success
+ */
+ return (1);
+ }
+#elif !defined(ARP_SCAN_FOUR_ARGUMENTS) || defined(hpux)
+ register struct arptab *atab;
+
+ while (arptab_current < arptab_size) {
+#ifdef STRUCT_ARPHD_HAS_AT_NEXT
+ /*
+ * The arp table is an array of linked lists of arptab entries.
+ * Unused slots have pointers back to the array entry itself
+ */
+
+ if (at_ptr == (auto_nlist_value(ARPTAB_SYMBOL) +
+ arptab_current * sizeof(struct arphd))) {
+ /*
+ * Usused
+ */
+ arptab_current++;
+ at_ptr = at[arptab_current].at_next;
+ continue;
+ }
+
+ if (!NETSNMP_KLOOKUP(at_ptr, (char *) &at_entry, sizeof(struct arptab))) {
+ DEBUGMSGTL(("mibII/at:ARP_Scan_Next", "klookup failed\n"));
+ break;
+ }
+
+ if (!NETSNMP_KLOOKUP(at_entry.at_ac, (char *) &at_com, sizeof(struct arpcom))) {
+ DEBUGMSGTL(("mibII/at:ARP_Scan_Next", "klookup failed\n"));
+ break;
+ }
+
+ at_ptr = at_entry.at_next;
+ atab = &at_entry;
+ *ifIndex = at_com.ac_if.if_index; /* not strictly ARPHD */
+#else /* STRUCT_ARPHD_HAS_AT_NEXT */
+ atab = &at[arptab_current++];
+#endif /* STRUCT_ARPHD_HAS_AT_NEXT */
+ if (!(atab->at_flags & ATF_COM))
+ continue;
+ *ifType = (atab->at_flags & ATF_PERM) ? 4 : 3;
+ *IPAddr = atab->at_iaddr.s_addr;
+#if defined (sunV3) || defined(sparc) || defined(hpux)
+ memcpy(PhysAddr, (char *) &atab->at_enaddr,
+ sizeof(atab->at_enaddr));
+#endif
+#if defined(mips) || defined(ibm032)
+ memcpy(PhysAddr, (char *) atab->at_enaddr,
+ sizeof(atab->at_enaddr));
+#endif
+ return (1);
+ }
+#endif /* linux || hpux11 || !ARP_SCAN_FOUR_ARGUMENTS || hpux */
+
+ return 0; /* we need someone with an irix box to fix this section */
+
+#else /* !NETSNMP_CAN_USE_SYSCTL */
+ struct rt_msghdr *rtm;
+ struct sockaddr_inarp *sin;
+ struct sockaddr_dl *sdl;
+
+ while (rtnext < lim) {
+ rtm = (struct rt_msghdr *) rtnext;
+ sin = (struct sockaddr_inarp *) (rtm + 1);
+ sdl = (struct sockaddr_dl *) (sin + 1);
+ rtnext += rtm->rtm_msglen;
+ if (sdl->sdl_alen) {
+#ifdef irix6
+ *IPAddr = sin->sarp_addr.s_addr;
+#else
+ *IPAddr = sin->sin_addr.s_addr;
+#endif
+ memcpy(PhysAddr, (char *) LLADDR(sdl), sdl->sdl_alen);
+ *ifIndex = sdl->sdl_index;
+ *ifType = 1; /* XXX */
+ return (1);
+ }
+ }
+ return (0); /* "EOF" */
+#endif /* !NETSNMP_CAN_USE_SYSCTL */
+}
+#endif /* solaris2 */
+
+#else /* WIN32 cygwin */
+#include <iphlpapi.h>
+
+extern WriteMethod write_arp;
+MIB_IPNETROW *arp_row = NULL;
+int create_flag = 0;
+
+u_char *
+var_atEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * Address Translation table object identifier is of form:
+ * 1.3.6.1.2.1.3.1.?.interface.1.A.B.C.D, where A.B.C.D is IP address.
+ * Interface is at offset 10,
+ * IPADDR starts at offset 12.
+ *
+ * IP Net to Media table object identifier is of form:
+ * 1.3.6.1.2.1.4.22.1.?.interface.A.B.C.D, where A.B.C.D is IP address.
+ * Interface is at offset 10,
+ * IPADDR starts at offset 11.
+ */
+ u_char *cp;
+ oid *op;
+ oid lowest[16];
+ oid current[16];
+ int oid_length;
+ int lowState = -1; /* Don't have one yet */
+ PMIB_IPNETTABLE pIpNetTable = NULL;
+ DWORD status = NO_ERROR;
+ DWORD dwActualSize = 0;
+ UINT i;
+ u_char dest_addr[4];
+ static in_addr_t addr_ret;
+
+ /*
+ * fill in object part of name for current (less sizeof instance part)
+ */
+ memcpy((char *) current, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+
+ if (current[6] == 3) { /* AT group oid */
+ oid_length = 16;
+ } else { /* IP NetToMedia group oid */
+ oid_length = 15;
+ }
+
+ status = GetIpNetTable(pIpNetTable, &dwActualSize, TRUE);
+ if (status == ERROR_INSUFFICIENT_BUFFER) {
+ pIpNetTable = (PMIB_IPNETTABLE) malloc(dwActualSize);
+ if (pIpNetTable != NULL) {
+ /*
+ * Get the sorted IpNet Table
+ */
+ status = GetIpNetTable(pIpNetTable, &dwActualSize, TRUE);
+ }
+ }
+
+
+ if (status == NO_ERROR) {
+ for (i = 0; i < pIpNetTable->dwNumEntries; ++i) {
+ current[10] = pIpNetTable->table[i].dwIndex;
+
+
+ if (current[6] == 3) { /* AT group oid */
+ current[11] = 1;
+ op = current + 12;
+ } else { /* IP NetToMedia group oid */
+ op = current + 11;
+ }
+ cp = (u_char *) & pIpNetTable->table[i].dwAddr;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+
+ if (exact) {
+ if (snmp_oid_compare(current, oid_length, name, *length) ==
+ 0) {
+ memcpy((char *) lowest, (char *) current,
+ oid_length * sizeof(oid));
+ lowState = 0;
+ break; /* no need to search further */
+ }
+ } else {
+ if (snmp_oid_compare(current, oid_length, name, *length) >
+ 0) {
+ memcpy((char *) lowest, (char *) current,
+ oid_length * sizeof(oid));
+ lowState = 0;
+ break; /* As the table is sorted, no need to search further */
+ }
+ }
+ }
+ }
+ if (arp_row == NULL) {
+ /*
+ * Free allocated memory in case of SET request's FREE phase
+ */
+ arp_row = (PMIB_IPNETROW) malloc(sizeof(MIB_IPNETROW));
+ }
+
+ if (lowState < 0 || status != NO_ERROR) {
+ /*
+ * for creation of new row, only ipNetToMediaTable case is considered
+ */
+ if (*length == 15 || *length == 16) {
+ create_flag = 1;
+ *write_method = write_arp;
+ arp_row->dwIndex = name[10];
+
+ if (*length == 15) { /* ipNetToMediaTable */
+ i = 11;
+ } else { /* at Table */
+
+ i = 12;
+ }
+
+ dest_addr[0] = (u_char) name[i];
+ dest_addr[1] = (u_char) name[i + 1];
+ dest_addr[2] = (u_char) name[i + 2];
+ dest_addr[3] = (u_char) name[i + 3];
+ arp_row->dwAddr = *((DWORD *) dest_addr);
+
+ arp_row->dwType = 4; /* Static */
+ arp_row->dwPhysAddrLen = 0;
+ }
+ free(pIpNetTable);
+ return (NULL);
+ }
+
+ create_flag = 0;
+ memcpy((char *) name, (char *) lowest, oid_length * sizeof(oid));
+ *length = oid_length;
+ *write_method = write_arp;
+ *arp_row = pIpNetTable->table[i];
+
+ switch (vp->magic) {
+ case IPMEDIAIFINDEX: /* also ATIFINDEX */
+ *var_len = sizeof long_return;
+ long_return = pIpNetTable->table[i].dwIndex;
+ free(pIpNetTable);
+ return (u_char *) & long_return;
+ case IPMEDIAPHYSADDRESS: /* also ATPHYSADDRESS */
+ *var_len = pIpNetTable->table[i].dwPhysAddrLen;
+ memcpy(return_buf, pIpNetTable->table[i].bPhysAddr, *var_len);
+ free(pIpNetTable);
+ return (u_char *) return_buf;
+ case IPMEDIANETADDRESS: /* also ATNETADDRESS */
+ *var_len = sizeof(addr_ret);
+ addr_ret = pIpNetTable->table[i].dwAddr;
+ free(pIpNetTable);
+ return (u_char *) & addr_ret;
+ case IPMEDIATYPE:
+ *var_len = sizeof long_return;
+ long_return = pIpNetTable->table[i].dwType;
+ free(pIpNetTable);
+ return (u_char *) & long_return;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_atEntry\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+int
+write_arp(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len, u_char * statP, oid * name, size_t length)
+{
+ int var, retval = SNMP_ERR_NOERROR;
+ static PMIB_IPNETROW oldarp_row = NULL;
+ MIB_IPNETROW temp_row;
+ DWORD status = NO_ERROR;
+
+ /*
+ * IP Net to Media table object identifier is of form:
+ * 1.3.6.1.2.1.4.22.1.?.interface.A.B.C.D, where A.B.C.D is IP address.
+ * Interface is at offset 10,
+ * IPADDR starts at offset 11.
+ */
+
+ if (name[6] == 3) { /* AT group oid */
+ if (length != 16) {
+ snmp_log(LOG_ERR, "length error\n");
+ return SNMP_ERR_NOCREATION;
+ }
+ } else { /* IP NetToMedia group oid */
+ if (length != 15) {
+ snmp_log(LOG_ERR, "length error\n");
+ return SNMP_ERR_NOCREATION;
+ }
+ }
+
+
+ /*
+ * #define for ipNetToMediaTable entries are 1 less than corresponding sub-id in MIB
+ * * i.e. IPMEDIAIFINDEX defined as 0, but ipNetToMediaIfIndex registered as 1
+ */
+ var = name[9] - 1;
+ switch (action) {
+ case RESERVE1:
+ switch (var) {
+ case IPMEDIAIFINDEX:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR, "not integer\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if ((*((int *) var_val)) < 0) {
+ snmp_log(LOG_ERR, "invalid media ifIndex");
+ return SNMP_ERR_WRONGVALUE;
+ }
+ if (var_val_len > sizeof(int)) {
+ snmp_log(LOG_ERR, "bad length\n");
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ break;
+ case IPMEDIANETADDRESS:
+ if (var_val_type != ASN_IPADDRESS) {
+ snmp_log(LOG_ERR, "not IP Address\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if ((*((int *) var_val)) < 0) {
+ snmp_log(LOG_ERR, "invalid media net address");
+ return SNMP_ERR_WRONGVALUE;
+ }
+ if (var_val_len > sizeof(DWORD)) {
+ snmp_log(LOG_ERR, "bad length\n");
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ break;
+ case IPMEDIATYPE:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR, "not integer\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if ((*((int *) var_val)) < 1 || (*((int *) var_val)) > 4) {
+ snmp_log(LOG_ERR, "invalid media type");
+ return SNMP_ERR_WRONGVALUE;
+ }
+ if (var_val_len > sizeof(int)) {
+ snmp_log(LOG_ERR, "bad length\n");
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ break;
+ case IPMEDIAPHYSADDRESS:
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR, "not octet str");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != 6) {
+ snmp_log(LOG_ERR, "not correct ipAddress length: %d",
+ var_val_len);
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ break;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in write_rte\n",
+ var + 1));
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ break;
+ case RESERVE2:
+ /*
+ * Save the old value, in case of UNDO
+ */
+ if (oldarp_row == NULL) {
+ oldarp_row = (PMIB_IPNETROW) malloc(sizeof(MIB_IPNETROW));
+ *oldarp_row = *arp_row;
+ }
+ break;
+ case ACTION: /* Perform the SET action (if reversible) */
+ switch (var) {
+
+ case IPMEDIAIFINDEX:
+ temp_row = *arp_row;
+ arp_row->dwIndex = *((int *) var_val);
+ /*
+ * In case of new entry, physical address is mandatory.
+ * * SetIpNetEntry will be done in COMMIT case
+ */
+ if (!create_flag) {
+ if (SetIpNetEntry(arp_row) != NO_ERROR) {
+ arp_row->dwIndex = temp_row.dwIndex;
+ retval = SNMP_ERR_COMMITFAILED;
+ }
+ /*
+ * Don't know yet, whether change in ifIndex creates new row or not
+ */
+ /*
+ * else{
+ */
+ /*
+ * temp_row.dwType = 2;
+ */
+ /*
+ * if(SetIpNetEntry(&temp_row) != NO_ERROR)
+ */
+ /*
+ * retval = SNMP_ERR_COMMITFAILED;
+ */
+ /*
+ * }
+ */
+ }
+ break;
+ case IPMEDIANETADDRESS:
+ temp_row = *arp_row;
+ arp_row->dwAddr = *((int *) var_val);
+ if (!create_flag) {
+ if (SetIpNetEntry(arp_row) != NO_ERROR) {
+ arp_row->dwAddr = oldarp_row->dwAddr;
+ retval = SNMP_ERR_COMMITFAILED;
+ } else {
+ temp_row.dwType = 2;
+ if (SetIpNetEntry(&temp_row) != NO_ERROR) {
+ snmp_log(LOG_ERR,
+ "Failed in ACTION, while deleting old row \n");
+ retval = SNMP_ERR_COMMITFAILED;
+ }
+ }
+ }
+ break;
+ case IPMEDIATYPE:
+ arp_row->dwType = *((int *) var_val);
+ if (!create_flag) {
+ if (SetIpNetEntry(arp_row) != NO_ERROR)
+ retval = SNMP_ERR_COMMITFAILED;
+ }
+ break;
+ case IPMEDIAPHYSADDRESS:
+ memcpy(arp_row->bPhysAddr, var_val, var_val_len);
+ arp_row->dwPhysAddrLen = var_val_len;
+ if (!create_flag) {
+ if (SetIpNetEntry(arp_row) != NO_ERROR)
+ retval = SNMP_ERR_COMMITFAILED;
+ }
+ break;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in write_arp\n",
+ var + 1));
+ retval = SNMP_ERR_NOTWRITABLE;
+ }
+ return retval;
+ case UNDO:
+ /*
+ * Reverse the SET action and free resources
+ */
+ if (oldarp_row != NULL) {
+ /*
+ * UNDO the changes done for existing entry.
+ */
+ if (!create_flag) {
+ if ((status = SetIpNetEntry(oldarp_row)) != NO_ERROR) {
+ snmp_log(LOG_ERR, "Error in case UNDO, status : %d\n",
+ status);
+ retval = SNMP_ERR_UNDOFAILED;
+ }
+ }
+
+ if (oldarp_row->dwAddr != arp_row->dwAddr) {
+ arp_row->dwType = 2; /*If row was added/created delete that row */
+
+ if ((status = SetIpNetEntry(arp_row)) != NO_ERROR) {
+ snmp_log(LOG_ERR,
+ "Error while deleting added row, status : %d\n",
+ status);
+ retval = SNMP_ERR_UNDOFAILED;
+ }
+ }
+ free(oldarp_row);
+ oldarp_row = NULL;
+ free(arp_row);
+ arp_row = NULL;
+ return retval;
+ }
+ break;
+ case COMMIT:
+ /*
+ * if new entry and physical address specified, create new entry
+ */
+ if (create_flag) {
+ if (arp_row->dwPhysAddrLen != 0) {
+ if ((status = CreateIpNetEntry(arp_row)) != NO_ERROR) {
+ snmp_log(LOG_ERR,
+ "Inside COMMIT: CreateIpNetEntry failed, status %d\n",
+ status);
+ retval = SNMP_ERR_COMMITFAILED;
+ }
+ } else {
+ /*
+ * For new entry, physical address must be set.
+ */
+ snmp_log(LOG_ERR,
+ "Can't create new entry without physical address\n");
+ retval = SNMP_ERR_WRONGVALUE;
+ }
+ /*
+ * unset the create_flag, so that CreateIpNetEntry called only once
+ */
+ create_flag = 0;
+ }
+
+ case FREE:
+ /*
+ * Free any resources allocated
+ */
+ free(oldarp_row);
+ oldarp_row = NULL;
+ free(arp_row);
+ arp_row = NULL;
+ break;
+ }
+ return retval;
+}
+#endif /* WIN32 cygwin */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/at.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/at.h
new file mode 100644
index 0000000000..e3bd0888fa
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/at.h
@@ -0,0 +1,45 @@
+/*
+ * Template MIB group interface - at.h
+ *
+ */
+
+#ifndef _MIBGROUP_AT_H
+#define _MIBGROUP_AT_H
+
+config_arch_require(solaris2, kernel_sunos5)
+
+ extern void init_at(void);
+ extern FindVarMethod var_atEntry;
+
+
+#define ATIFINDEX 0
+#define ATPHYSADDRESS 1
+#define ATNETADDRESS 2
+
+#define IPMEDIAIFINDEX 0
+#define IPMEDIAPHYSADDRESS 1
+#define IPMEDIANETADDRESS 2
+#define IPMEDIATYPE 3
+
+/*
+ * in case its missing:
+ */
+#ifndef ATF_PERM
+# define ATF_PERM 0x04
+#endif /* ATF_PERM */
+#ifndef ATF_COM
+# define ATF_COM 0x02
+#endif /* ATF_COM */
+
+#if defined(linux) || defined(irix6)
+/*
+ * arp struct to pass flags, hw-addr and ip-addr in bsd manner:
+ */
+ struct arptab {
+ int at_flags;
+ char at_enaddr[6];
+ struct in_addr at_iaddr;
+ int if_index;
+ };
+#endif
+#endif /* _MIBGROUP_AT_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/icmp.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/icmp.c
new file mode 100644
index 0000000000..f3fbb822ee
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/icmp.c
@@ -0,0 +1,803 @@
+/*
+ * ICMP MIB group implementation - icmp.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include "mibII_common.h"
+
+#if HAVE_NETINET_IP_ICMP_H
+#include <netinet/ip_icmp.h>
+#endif
+#if HAVE_NETINET_ICMP_VAR_H
+#include <netinet/icmp_var.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include <net-snmp/agent/cache_handler.h>
+#include <net-snmp/agent/scalar_group.h>
+
+#include "util_funcs.h"
+#include "icmp.h"
+#include "sysORTable.h"
+
+#ifndef MIB_STATS_CACHE_TIMEOUT
+#define MIB_STATS_CACHE_TIMEOUT 5
+#endif
+#ifndef ICMP_STATS_CACHE_TIMEOUT
+#define ICMP_STATS_CACHE_TIMEOUT MIB_STATS_CACHE_TIMEOUT
+#endif
+
+#if defined(HAVE_LIBPERFSTAT_H) && (defined(aix4) || defined(aix5) || defined(aix6)) && !defined(FIRST_PROTOCOL)
+#include <libperfstat.h>
+#ifdef FIRST_PROTOCOL
+perfstat_protocol_t ps_proto;
+perfstat_id_t ps_name;
+#define _USE_PERFSTAT_PROTOCOL 1
+#endif
+#endif
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+
+
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+oid icmp_oid[] = { SNMP_OID_MIB2, 5 };
+#ifdef USING_MIBII_IP_MODULE
+extern oid ip_module_oid[];
+extern int ip_module_oid_len;
+extern int ip_module_count;
+#endif
+
+void
+init_icmp(void)
+{
+ netsnmp_handler_registration *reginfo;
+
+ /*
+ * register ourselves with the agent as a group of scalars...
+ */
+ DEBUGMSGTL(("mibII/icmp", "Initialising ICMP group\n"));
+ reginfo = netsnmp_create_handler_registration("icmp", icmp_handler,
+ icmp_oid, OID_LENGTH(icmp_oid), HANDLER_CAN_RONLY);
+ netsnmp_register_scalar_group(reginfo, ICMPINMSGS, ICMPOUTADDRMASKREPS);
+ /*
+ * .... with a local cache
+ * (except for HP-UX 11, which extracts objects individually)
+ */
+#ifndef hpux11
+ netsnmp_inject_handler( reginfo,
+ netsnmp_get_cache_handler(ICMP_STATS_CACHE_TIMEOUT,
+ icmp_load, icmp_free,
+ icmp_oid, OID_LENGTH(icmp_oid)));
+#endif
+
+#ifdef USING_MIBII_IP_MODULE
+ if (++ip_module_count == 2)
+ REGISTER_SYSOR_TABLE(ip_module_oid, ip_module_oid_len,
+ "The MIB module for managing IP and ICMP implementations");
+#endif
+
+#if !defined(_USE_PERFSTAT_PROTOCOL)
+#ifdef ICMPSTAT_SYMBOL
+ auto_nlist(ICMPSTAT_SYMBOL, 0, 0);
+#endif
+#ifdef solaris2
+ init_kernel_sunos5();
+#endif
+#endif
+}
+
+
+ /*********************
+ *
+ * System specific data formats
+ *
+ *********************/
+
+#ifdef hpux11
+#define ICMP_STAT_STRUCTURE int
+#endif
+
+#ifdef linux
+#define ICMP_STAT_STRUCTURE struct icmp_mib
+#define USES_SNMP_DESIGNED_ICMPSTAT
+#undef ICMPSTAT_SYMBOL
+#endif
+
+#ifdef solaris2
+#define ICMP_STAT_STRUCTURE mib2_icmp_t
+#define USES_SNMP_DESIGNED_ICMPSTAT
+#endif
+
+#if defined (WIN32) || defined (cygwin)
+#include <iphlpapi.h>
+#define ICMP_STAT_STRUCTURE MIB_ICMP
+#endif
+
+/* ?? #if (defined(NETSNMP_CAN_USE_SYSCTL) && defined(ICMPCTL_STATS)) ?? */
+
+#ifdef HAVE_SYS_ICMPIPSTATS_H
+/* or #ifdef HAVE_SYS_TCPIPSTATS_H ??? */
+#define ICMP_STAT_STRUCTURE struct kna
+#define USES_TRADITIONAL_ICMPSTAT
+#endif
+
+#if !defined(ICMP_STAT_STRUCTURE)
+#define ICMP_STAT_STRUCTURE struct icmpstat
+#define USES_TRADITIONAL_ICMPSTAT
+#endif
+
+ICMP_STAT_STRUCTURE icmpstat;
+
+
+ /*********************
+ *
+ * System independent handler
+ * (mostly!)
+ *
+ *********************/
+
+int
+icmp_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ netsnmp_request_info *request;
+ netsnmp_variable_list *requestvb;
+ long ret_value;
+ oid subid;
+#ifdef USES_TRADITIONAL_ICMPSTAT
+ int i;
+#endif
+
+ /*
+ * The cached data should already have been loaded by the
+ * cache handler, higher up the handler chain.
+ * But just to be safe, check this and load it manually if necessary
+ */
+#if defined(_USE_PERFSTAT_PROTOCOL)
+ icmp_load(NULL, NULL);
+#elif !defined(hpux11)
+ if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) {
+ netsnmp_assert(!"cache == valid"); /* always false */
+ icmp_load( NULL, NULL ); /* XXX - check for failure */
+ }
+#endif
+
+
+ /*
+ *
+ *
+ */
+ DEBUGMSGTL(("mibII/icmp", "Handler - mode %s\n",
+ se_find_label_in_slist("agent_mode", reqinfo->mode)));
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ for (request=requests; request; request=request->next) {
+ requestvb = request->requestvb;
+ subid = requestvb->name[OID_LENGTH(icmp_oid)]; /* XXX */
+ DEBUGMSGTL(( "mibII/icmp", "oid: "));
+ DEBUGMSGOID(("mibII/icmp", requestvb->name,
+ requestvb->name_length));
+ DEBUGMSG(( "mibII/icmp", "\n"));
+
+ switch (subid) {
+#ifdef USES_SNMP_DESIGNED_ICMPSTAT
+ case ICMPINMSGS:
+ ret_value = icmpstat.icmpInMsgs;
+ break;
+ case ICMPINERRORS:
+ ret_value = icmpstat.icmpInErrors;
+ break;
+ case ICMPINDESTUNREACHS:
+ ret_value = icmpstat.icmpInDestUnreachs;
+ break;
+ case ICMPINTIMEEXCDS:
+ ret_value = icmpstat.icmpInTimeExcds;
+ break;
+ case ICMPINPARMPROBS:
+ ret_value = icmpstat.icmpInParmProbs;
+ break;
+ case ICMPINSRCQUENCHS:
+ ret_value = icmpstat.icmpInSrcQuenchs;
+ break;
+ case ICMPINREDIRECTS:
+ ret_value = icmpstat.icmpInRedirects;
+ break;
+ case ICMPINECHOS:
+ ret_value = icmpstat.icmpInEchos;
+ break;
+ case ICMPINECHOREPS:
+ ret_value = icmpstat.icmpInEchoReps;
+ break;
+ case ICMPINTIMESTAMPS:
+ ret_value = icmpstat.icmpInTimestamps;
+ break;
+ case ICMPINTIMESTAMPREPS:
+ ret_value = icmpstat.icmpInTimestampReps;
+ break;
+ case ICMPINADDRMASKS:
+ ret_value = icmpstat.icmpInAddrMasks;
+ break;
+ case ICMPINADDRMASKREPS:
+ ret_value = icmpstat.icmpInAddrMaskReps;
+ break;
+ case ICMPOUTMSGS:
+ ret_value = icmpstat.icmpOutMsgs;
+ break;
+ case ICMPOUTERRORS:
+ ret_value = icmpstat.icmpOutErrors;
+ break;
+ case ICMPOUTDESTUNREACHS:
+ ret_value = icmpstat.icmpOutDestUnreachs;
+ break;
+ case ICMPOUTTIMEEXCDS:
+ ret_value = icmpstat.icmpOutTimeExcds;
+ break;
+ case ICMPOUTPARMPROBS:
+ ret_value = icmpstat.icmpOutParmProbs;
+ break;
+ case ICMPOUTSRCQUENCHS:
+ ret_value = icmpstat.icmpOutSrcQuenchs;
+ break;
+ case ICMPOUTREDIRECTS:
+ ret_value = icmpstat.icmpOutRedirects;
+ break;
+ case ICMPOUTECHOS:
+ ret_value = icmpstat.icmpOutEchos;
+ break;
+ case ICMPOUTECHOREPS:
+ ret_value = icmpstat.icmpOutEchoReps;
+ break;
+ case ICMPOUTTIMESTAMPS:
+ ret_value = icmpstat.icmpOutTimestamps;
+ break;
+ case ICMPOUTTIMESTAMPREPS:
+ ret_value = icmpstat.icmpOutTimestampReps;
+ break;
+ case ICMPOUTADDRMASKS:
+ ret_value = icmpstat.icmpOutAddrMasks;
+ break;
+ case ICMPOUTADDRMASKREPS:
+ ret_value = icmpstat.icmpOutAddrMaskReps;
+ break;
+#elif defined(USES_TRADITIONAL_ICMPSTAT) && !defined(_USE_PERFSTAT_PROTOCOL)
+ case ICMPINMSGS:
+ ret_value = icmpstat.icps_badcode +
+ icmpstat.icps_tooshort +
+ icmpstat.icps_checksum + icmpstat.icps_badlen;
+ for (i = 0; i <= ICMP_MAXTYPE; i++)
+ ret_value += icmpstat.icps_inhist[i];
+ break;
+ case ICMPINERRORS:
+ ret_value = icmpstat.icps_badcode +
+ icmpstat.icps_tooshort +
+ icmpstat.icps_checksum + icmpstat.icps_badlen;
+ break;
+ case ICMPINDESTUNREACHS:
+ ret_value = icmpstat.icps_inhist[ICMP_UNREACH];
+ break;
+ case ICMPINTIMEEXCDS:
+ ret_value = icmpstat.icps_inhist[ICMP_TIMXCEED];
+ break;
+ case ICMPINPARMPROBS:
+ ret_value = icmpstat.icps_inhist[ICMP_PARAMPROB];
+ break;
+ case ICMPINSRCQUENCHS:
+ ret_value = icmpstat.icps_inhist[ICMP_SOURCEQUENCH];
+ break;
+ case ICMPINREDIRECTS:
+ ret_value = icmpstat.icps_inhist[ICMP_REDIRECT];
+ break;
+ case ICMPINECHOS:
+ ret_value = icmpstat.icps_inhist[ICMP_ECHO];
+ break;
+ case ICMPINECHOREPS:
+ ret_value = icmpstat.icps_inhist[ICMP_ECHOREPLY];
+ break;
+ case ICMPINTIMESTAMPS:
+ ret_value = icmpstat.icps_inhist[ICMP_TSTAMP];
+ break;
+ case ICMPINTIMESTAMPREPS:
+ ret_value = icmpstat.icps_inhist[ICMP_TSTAMPREPLY];
+ break;
+ case ICMPINADDRMASKS:
+ ret_value = icmpstat.icps_inhist[ICMP_MASKREQ];
+ break;
+ case ICMPINADDRMASKREPS:
+ ret_value = icmpstat.icps_inhist[ICMP_MASKREPLY];
+ break;
+ case ICMPOUTMSGS:
+ ret_value = icmpstat.icps_oldshort + icmpstat.icps_oldicmp;
+ for (i = 0; i <= ICMP_MAXTYPE; i++)
+ ret_value += icmpstat.icps_outhist[i];
+ break;
+ case ICMPOUTERRORS:
+ ret_value = icmpstat.icps_oldshort + icmpstat.icps_oldicmp;
+ break;
+ case ICMPOUTDESTUNREACHS:
+ ret_value = icmpstat.icps_outhist[ICMP_UNREACH];
+ break;
+ case ICMPOUTTIMEEXCDS:
+ ret_value = icmpstat.icps_outhist[ICMP_TIMXCEED];
+ break;
+ case ICMPOUTPARMPROBS:
+ ret_value = icmpstat.icps_outhist[ICMP_PARAMPROB];
+ break;
+ case ICMPOUTSRCQUENCHS:
+ ret_value = icmpstat.icps_outhist[ICMP_SOURCEQUENCH];
+ break;
+ case ICMPOUTREDIRECTS:
+ ret_value = icmpstat.icps_outhist[ICMP_REDIRECT];
+ break;
+ case ICMPOUTECHOS:
+ ret_value = icmpstat.icps_outhist[ICMP_ECHO];
+ break;
+ case ICMPOUTECHOREPS:
+ ret_value = icmpstat.icps_outhist[ICMP_ECHOREPLY];
+ break;
+ case ICMPOUTTIMESTAMPS:
+ ret_value = icmpstat.icps_outhist[ICMP_TSTAMP];
+ break;
+ case ICMPOUTTIMESTAMPREPS:
+ ret_value = icmpstat.icps_outhist[ICMP_TSTAMPREPLY];
+ break;
+ case ICMPOUTADDRMASKS:
+ ret_value = icmpstat.icps_outhist[ICMP_MASKREQ];
+ break;
+ case ICMPOUTADDRMASKREPS:
+ ret_value = icmpstat.icps_outhist[ICMP_MASKREPLY];
+ break;
+#elif defined(hpux11)
+ case ICMPINMSGS:
+ case ICMPINERRORS:
+ case ICMPINDESTUNREACHS:
+ case ICMPINTIMEEXCDS:
+ case ICMPINPARMPROBS:
+ case ICMPINSRCQUENCHS:
+ case ICMPINREDIRECTS:
+ case ICMPINECHOS:
+ case ICMPINECHOREPS:
+ case ICMPINTIMESTAMPS:
+ case ICMPINTIMESTAMPREPS:
+ case ICMPINADDRMASKS:
+ case ICMPINADDRMASKREPS:
+ case ICMPOUTMSGS:
+ case ICMPOUTERRORS:
+ case ICMPOUTDESTUNREACHS:
+ case ICMPOUTTIMEEXCDS:
+ case ICMPOUTPARMPROBS:
+ case ICMPOUTSRCQUENCHS:
+ case ICMPOUTREDIRECTS:
+ case ICMPOUTECHOS:
+ case ICMPOUTECHOREPS:
+ case ICMPOUTTIMESTAMPS:
+ case ICMPOUTTIMESTAMPREPS:
+ case ICMPOUTADDRMASKS:
+ case ICMPOUTADDRMASKREPS:
+ /*
+ * This is a bit of a hack, to shoehorn the HP-UX 11
+ * single-object retrieval approach into the caching
+ * architecture.
+ */
+ if (icmp_load(NULL, (void*)subid) == -1 ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+ }
+ ret_value = icmpstat;
+ break;
+#elif defined (WIN32) || defined (cygwin)
+ case ICMPINMSGS:
+ ret_value = icmpstat.stats.icmpInStats.dwMsgs;
+ break;
+ case ICMPINERRORS:
+ ret_value = icmpstat.stats.icmpInStats.dwErrors;
+ break;
+ case ICMPINDESTUNREACHS:
+ ret_value = icmpstat.stats.icmpInStats.dwDestUnreachs;
+ break;
+ case ICMPINTIMEEXCDS:
+ ret_value = icmpstat.stats.icmpInStats.dwTimeExcds;
+ break;
+ case ICMPINPARMPROBS:
+ ret_value = icmpstat.stats.icmpInStats.dwParmProbs;
+ break;
+ case ICMPINSRCQUENCHS:
+ ret_value = icmpstat.stats.icmpInStats.dwSrcQuenchs;
+ break;
+ case ICMPINREDIRECTS:
+ ret_value = icmpstat.stats.icmpInStats.dwRedirects;
+ break;
+ case ICMPINECHOS:
+ ret_value = icmpstat.stats.icmpInStats.dwEchos;
+ break;
+ case ICMPINECHOREPS:
+ ret_value = icmpstat.stats.icmpInStats.dwEchoReps;
+ break;
+ case ICMPINTIMESTAMPS:
+ ret_value = icmpstat.stats.icmpInStats.dwTimestamps;
+ break;
+ case ICMPINTIMESTAMPREPS:
+ ret_value = icmpstat.stats.icmpInStats.dwTimestampReps;
+ break;
+ case ICMPINADDRMASKS:
+ ret_value = icmpstat.stats.icmpInStats.dwAddrMasks;
+ break;
+ case ICMPINADDRMASKREPS:
+ ret_value = icmpstat.stats.icmpInStats.dwAddrMaskReps;
+ break;
+ case ICMPOUTMSGS:
+ ret_value = icmpstat.stats.icmpOutStats.dwMsgs;
+ break;
+ case ICMPOUTERRORS:
+ ret_value = icmpstat.stats.icmpOutStats.dwErrors;
+ break;
+ case ICMPOUTDESTUNREACHS:
+ ret_value = icmpstat.stats.icmpOutStats.dwDestUnreachs;
+ break;
+ case ICMPOUTTIMEEXCDS:
+ ret_value = icmpstat.stats.icmpOutStats.dwTimeExcds;
+ break;
+ case ICMPOUTPARMPROBS:
+ ret_value = icmpstat.stats.icmpOutStats.dwParmProbs;
+ break;
+ case ICMPOUTSRCQUENCHS:
+ ret_value = icmpstat.stats.icmpOutStats.dwSrcQuenchs;
+ break;
+ case ICMPOUTREDIRECTS:
+ ret_value = icmpstat.stats.icmpOutStats.dwRedirects;
+ break;
+ case ICMPOUTECHOS:
+ ret_value = icmpstat.stats.icmpOutStats.dwEchos;
+ break;
+ case ICMPOUTECHOREPS:
+ ret_value = icmpstat.stats.icmpOutStats.dwEchoReps;
+ break;
+ case ICMPOUTTIMESTAMPS:
+ ret_value = icmpstat.stats.icmpOutStats.dwTimestamps;
+ break;
+ case ICMPOUTTIMESTAMPREPS:
+ ret_value = icmpstat.stats.icmpOutStats.dwTimestampReps;
+ break;
+ case ICMPOUTADDRMASKS:
+ ret_value = icmpstat.stats.icmpOutStats.dwAddrMasks;
+ break;
+ case ICMPOUTADDRMASKREPS:
+ ret_value = icmpstat.stats.icmpOutStats.dwAddrMaskReps;
+ break;
+#elif defined(_USE_PERFSTAT_PROTOCOL)
+ case ICMPINMSGS:
+ ret_value = ps_proto.u.icmp.received;
+ break;
+ case ICMPINERRORS:
+ ret_value = ps_proto.u.icmp.errors;
+ break;
+ case ICMPINDESTUNREACHS:
+ case ICMPINTIMEEXCDS:
+ case ICMPINPARMPROBS:
+ case ICMPINSRCQUENCHS:
+ case ICMPINREDIRECTS:
+ case ICMPINECHOS:
+ case ICMPINECHOREPS:
+ case ICMPINTIMESTAMPS:
+ case ICMPINTIMESTAMPREPS:
+ case ICMPINADDRMASKS:
+ case ICMPINADDRMASKREPS:
+ ret_value = 0;
+ break;
+ case ICMPOUTMSGS:
+ ret_value = ps_proto.u.icmp.sent;
+ break;
+ case ICMPOUTERRORS:
+ ret_value = ps_proto.u.icmp.errors;
+ break;
+ case ICMPOUTDESTUNREACHS:
+ case ICMPOUTTIMEEXCDS:
+ case ICMPOUTPARMPROBS:
+ case ICMPOUTSRCQUENCHS:
+ case ICMPOUTREDIRECTS:
+ case ICMPOUTECHOS:
+ case ICMPOUTECHOREPS:
+ case ICMPOUTTIMESTAMPS:
+ case ICMPOUTTIMESTAMPREPS:
+ case ICMPOUTADDRMASKS:
+ case ICMPOUTADDRMASKREPS:
+ ret_value = 0;
+ break;
+#endif /* USES_SNMP_DESIGNED_ICMPSTAT */
+ }
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER,
+ (u_char *)&ret_value, sizeof(ret_value));
+ }
+ break;
+
+ case MODE_GETNEXT:
+ case MODE_GETBULK:
+ case MODE_SET_RESERVE1:
+ case MODE_SET_RESERVE2:
+ case MODE_SET_ACTION:
+ case MODE_SET_COMMIT:
+ case MODE_SET_FREE:
+ case MODE_SET_UNDO:
+ snmp_log(LOG_WARNING, "mibII/icmp: Unsupported mode (%d)\n",
+ reqinfo->mode);
+ break;
+ default:
+ snmp_log(LOG_WARNING, "mibII/icmp: Unrecognised mode (%d)\n",
+ reqinfo->mode);
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+#ifdef hpux11
+int
+icmp_load(netsnmp_cache *cache, void *vmagic)
+{
+ int fd;
+ struct nmparms p;
+ unsigned int ulen;
+ int ret;
+ int magic = (int) vmagic;
+
+ if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) < 0) {
+ DEBUGMSGTL(("mibII/icmp", "Failed to load ICMP object %d (hpux11)\n", magic));
+ return (-1); /* error */
+ }
+
+ switch (magic) {
+ case ICMPINMSGS:
+ p.objid = ID_icmpInMsgs;
+ break;
+ case ICMPINERRORS:
+ p.objid = ID_icmpInErrors;
+ break;
+ case ICMPINDESTUNREACHS:
+ p.objid = ID_icmpInDestUnreachs;
+ break;
+ case ICMPINTIMEEXCDS:
+ p.objid = ID_icmpInTimeExcds;
+ break;
+ case ICMPINPARMPROBS:
+ p.objid = ID_icmpInParmProbs;
+ break;
+ case ICMPINSRCQUENCHS:
+ p.objid = ID_icmpInSrcQuenchs;
+ break;
+ case ICMPINREDIRECTS:
+ p.objid = ID_icmpInRedirects;
+ break;
+ case ICMPINECHOS:
+ p.objid = ID_icmpInEchos;
+ break;
+ case ICMPINECHOREPS:
+ p.objid = ID_icmpInEchoReps;
+ break;
+ case ICMPINTIMESTAMPS:
+ p.objid = ID_icmpInTimestamps;
+ break;
+ case ICMPINTIMESTAMPREPS:
+ p.objid = ID_icmpInTimestampReps;
+ break;
+ case ICMPINADDRMASKS:
+ p.objid = ID_icmpInAddrMasks;
+ break;
+ case ICMPINADDRMASKREPS:
+ p.objid = ID_icmpInAddrMaskReps;
+ break;
+ case ICMPOUTMSGS:
+ p.objid = ID_icmpOutMsgs;
+ break;
+ case ICMPOUTERRORS:
+ p.objid = ID_icmpOutErrors;
+ break;
+ case ICMPOUTDESTUNREACHS:
+ p.objid = ID_icmpOutDestUnreachs;
+ break;
+ case ICMPOUTTIMEEXCDS:
+ p.objid = ID_icmpOutTimeExcds;
+ break;
+ case ICMPOUTPARMPROBS:
+ p.objid = ID_icmpOutParmProbs;
+ break;
+ case ICMPOUTSRCQUENCHS:
+ p.objid = ID_icmpOutSrcQuenchs;
+ break;
+ case ICMPOUTREDIRECTS:
+ p.objid = ID_icmpOutRedirects;
+ break;
+ case ICMPOUTECHOS:
+ p.objid = ID_icmpOutEchos;
+ break;
+ case ICMPOUTECHOREPS:
+ p.objid = ID_icmpOutEchoReps;
+ break;
+ case ICMPOUTTIMESTAMPS:
+ p.objid = ID_icmpOutTimestamps;
+ break;
+ case ICMPOUTTIMESTAMPREPS:
+ p.objid = ID_icmpOutTimestampReps;
+ break;
+ case ICMPOUTADDRMASKS:
+ p.objid = ID_icmpOutAddrMasks;
+ break;
+ case ICMPOUTADDRMASKREPS:
+ p.objid = ID_icmpOutAddrMaskReps;
+ break;
+ default:
+ icmpstat = 0;
+ close_mib(fd);
+ return (0);
+ }
+
+ p.buffer = (void *)&icmpstat;
+ ulen = sizeof(ICMP_STAT_STRUCTURE);
+ p.len = &ulen;
+ ret = get_mib_info(fd, &p);
+ close_mib(fd);
+
+ DEBUGMSGTL(("mibII/icmp", "%s ICMP object %d (hpux11)\n",
+ (ret < 0 ? "Failed to load" : "Loaded"), magic));
+ return (ret); /* 0: ok, < 0: error */
+}
+#elif defined(linux)
+int
+icmp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ ret_value = linux_read_icmp_stat(&icmpstat);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/icmp", "Failed to load ICMP Group (linux)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/icmp", "Loaded ICMP Group (linux)\n"));
+ }
+ return ret_value;
+}
+#elif defined(solaris2)
+int
+icmp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ ret_value =
+ getMibstat(MIB_ICMP, &icmpstat, sizeof(mib2_icmp_t), GET_FIRST,
+ &Get_everything, NULL);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/icmp", "Failed to load ICMP Group (solaris)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/icmp", "Loaded ICMP Group (solaris)\n"));
+ }
+ return ret_value;
+}
+#elif defined (WIN32) || defined (cygwin)
+int
+icmp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ ret_value = GetIcmpStatistics(&icmpstat);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/icmp", "Failed to load ICMP Group (win32)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/icmp", "Loaded ICMP Group (win32)\n"));
+ }
+ return ret_value;
+}
+#elif defined(_USE_PERFSTAT_PROTOCOL)
+int
+icmp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ strcpy(ps_name.name, "icmp");
+ ret_value = perfstat_protocol(&ps_name, &ps_proto, sizeof(ps_proto), 1);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/icmp", "Failed to load ICMP Group (AIX)\n"));
+ } else {
+ ret_value = 0;
+ DEBUGMSGTL(("mibII/icmp", "Loaded ICMP Group (AIX)\n"));
+ }
+ return ret_value;
+}
+#elif defined(NETSNMP_CAN_USE_SYSCTL) && defined(ICMPCTL_STATS)
+int
+icmp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+ static int sname[4] =
+ { CTL_NET, PF_INET, IPPROTO_ICMP, ICMPCTL_STATS };
+ size_t len = sizeof(icmpstat);
+
+ ret_value = sysctl(sname, 4, &icmpstat, &len, 0, 0);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/icmp", "Failed to load ICMP Group (sysctl)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/icmp", "Loaded ICMP Group (sysctl)\n"));
+ }
+ return ret_value;
+}
+#elif defined(HAVE_SYS_TCPIPSTATS_H)
+int
+icmp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ ret_value =
+ sysmp(MP_SAGET, MPSA_TCPIPSTATS, &icmpstat, sizeof icmpstat);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/icmp", "Failed to load ICMP Group (tcpipstats)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/icmp", "Loaded ICMP Group (tcpipstats)\n"));
+ }
+ return ret_value;
+}
+#elif defined(ICMPSTAT_SYMBOL)
+int
+icmp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ if (auto_nlist(ICMPSTAT_SYMBOL, (char *)&icmpstat, sizeof(icmpstat)))
+ ret_value = 0;
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/icmp", "Failed to load ICMP Group (icmpstat)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/icmp", "Loaded ICMP Group (icmpstat)\n"));
+ }
+ return ret_value;
+}
+#else /* ICMPSTAT_SYMBOL */
+int
+icmp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ DEBUGMSGTL(("mibII/icmp", "Failed to load ICMP Group (null)\n"));
+ return ret_value;
+}
+#endif /* hpux11 */
+
+void
+icmp_free(netsnmp_cache *cache, void *magic)
+{
+#if defined(_USE_PERFSTAT_PROTOCOL)
+ memset(&ps_proto, 0, sizeof(ps_proto));
+#else
+ memset(&icmpstat, 0, sizeof(icmpstat));
+#endif
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/icmp.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/icmp.h
new file mode 100644
index 0000000000..7417639558
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/icmp.h
@@ -0,0 +1,45 @@
+/*
+ * ICMP MIB group interface - icmp.h
+ *
+ */
+#ifndef _MIBGROUP_ICMP_H
+#define _MIBGROUP_ICMP_H
+
+config_arch_require(solaris2, kernel_sunos5)
+config_arch_require(linux, mibII/kernel_linux)
+
+#include <net-snmp/agent/cache_handler.h>
+
+extern void init_icmp(void);
+extern Netsnmp_Node_Handler icmp_handler;
+extern NetsnmpCacheLoad icmp_load;
+extern NetsnmpCacheFree icmp_free;
+
+#define ICMPINMSGS 1
+#define ICMPINERRORS 2
+#define ICMPINDESTUNREACHS 3
+#define ICMPINTIMEEXCDS 4
+#define ICMPINPARMPROBS 5
+#define ICMPINSRCQUENCHS 6
+#define ICMPINREDIRECTS 7
+#define ICMPINECHOS 8
+#define ICMPINECHOREPS 9
+#define ICMPINTIMESTAMPS 10
+#define ICMPINTIMESTAMPREPS 11
+#define ICMPINADDRMASKS 12
+#define ICMPINADDRMASKREPS 13
+#define ICMPOUTMSGS 14
+#define ICMPOUTERRORS 15
+#define ICMPOUTDESTUNREACHS 16
+#define ICMPOUTTIMEEXCDS 17
+#define ICMPOUTPARMPROBS 18
+#define ICMPOUTSRCQUENCHS 19
+#define ICMPOUTREDIRECTS 20
+#define ICMPOUTECHOS 21
+#define ICMPOUTECHOREPS 22
+#define ICMPOUTTIMESTAMPS 23
+#define ICMPOUTTIMESTAMPREPS 24
+#define ICMPOUTADDRMASKS 25
+#define ICMPOUTADDRMASKREPS 26
+
+#endif /* _MIBGROUP_ICMP_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ifTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ifTable.h
new file mode 100644
index 0000000000..65d155eb85
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ifTable.h
@@ -0,0 +1,10 @@
+/*
+ * module to include the ifTable implementation modules
+ *
+ */
+
+#ifdef NETSNMP_INCLUDE_IFTABLE_REWRITES
+config_require(if-mib/ifTable)
+#else
+config_require(mibII/interfaces)
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/interfaces.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/interfaces.c
new file mode 100644
index 0000000000..c6a485721d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/interfaces.c
@@ -0,0 +1,2847 @@
+/*
+ * Interfaces MIB group implementation - interfaces.c
+ *
+ */
+
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL) && !defined(IFNET_NEEDS_KERNEL_LATE)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL) && defined(IFNET_NEEDS_KERNEL_LATE)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifndef STREAM_NEEDS_KERNEL_ISLANDS
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#endif
+#if HAVE_SYS_SOCKETVAR_H
+#include <sys/socketvar.h>
+#endif
+
+#if TIME_WITH_SYS_TIME
+# if defined (WIN32) || defined (cygwin)
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_NETINET_IN_VAR_H
+#include <netinet/in_var.h>
+#endif
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#ifdef STREAM_NEEDS_KERNEL_ISLANDS
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#if HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#if HAVE_SYS_HASHING_H
+#include <sys/hashing.h>
+#endif
+#if HAVE_NETINET_IN_VAR_H
+#include <netinet/in_var.h>
+#endif
+#if HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#ifdef NETSNMP_ENABLE_IPV6
+#if HAVE_NETINET_IP6_H
+#include <netinet/ip6.h>
+#endif
+#endif
+#if HAVE_SYS_QUEUE_H
+#include <sys/queue.h>
+#endif
+#if HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#ifdef NETSNMP_ENABLE_IPV6
+#if HAVE_NETNETSNMP_ENABLE_IPV6_IP6_VAR_H
+#include <netinet6/ip6_var.h>
+#endif
+#endif
+#if HAVE_NETINET_IN_PCB_H
+#include <netinet/in_pcb.h>
+#endif
+#if HAVE_NETINET_IF_ETHER_H
+#include <netinet/if_ether.h>
+#endif
+#if HAVE_NET_IF_TYPES_H
+#include <net/if_types.h>
+#endif
+#if HAVE_NET_IF_DL_H
+#ifndef dynix
+#include <net/if_dl.h>
+#else
+#include <sys/net/if_dl.h>
+#endif
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+#if HAVE_IOCTLS_H
+#include <ioctls.h>
+#endif
+
+#ifdef solaris2
+# include <errno.h>
+#include "kernel_sunos5.h"
+#else
+#include "kernel.h"
+#endif
+
+#ifdef hpux
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif /* hpux */
+
+#ifdef cygwin
+#include <windows.h>
+#endif
+
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+
+#if defined(freebsd3) || defined(freebsd4) || defined(freebsd5)
+# define USE_SYSCTL_IFLIST
+#else
+# if defined(CTL_NET) && !defined(freebsd2) && !defined(netbsd1)
+# ifdef PF_ROUTE
+# ifdef NET_RT_IFLIST
+# ifndef netbsd1
+# define USE_SYSCTL_IFLIST
+# endif
+# endif
+# endif
+# endif
+#endif /* defined(freebsd3) */
+#endif /* HAVE_SYS_SYSCTL_H */
+
+#if HAVE_OSRELDATE_H
+#include <osreldate.h>
+#endif
+#ifdef NETSNMP_CAN_USE_SYSCTL
+#include <sys/sysctl.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+#include <net-snmp/data_access/interface.h>
+
+#include "interfaces.h"
+#include "struct.h"
+#include "util_funcs.h"
+#include "sysORTable.h"
+
+/* if you want caching enabled for speed retrival purposes, set this to 5?*/
+#define MINLOADFREQ 0 /* min reload frequency in seconds */
+#ifdef linux
+static unsigned long LastLoad = 0; /* ET in secs at last table load */
+#endif
+
+extern struct timeval starttime;
+
+struct variable3 interfaces_variables[] = {
+ {IFNUMBER, ASN_INTEGER, RONLY, var_interfaces, 1, {1}},
+ {IFINDEX, ASN_INTEGER, RONLY, var_ifEntry, 3, {2, 1, 1}},
+ {IFDESCR, ASN_OCTET_STR, RONLY, var_ifEntry, 3, {2, 1, 2}},
+ {IFTYPE, ASN_INTEGER, RONLY, var_ifEntry, 3, {2, 1, 3}},
+ {IFMTU, ASN_INTEGER, RONLY, var_ifEntry, 3, {2, 1, 4}},
+ {IFSPEED, ASN_GAUGE, RONLY, var_ifEntry, 3, {2, 1, 5}},
+ {IFPHYSADDRESS, ASN_OCTET_STR, RONLY, var_ifEntry, 3, {2, 1, 6}},
+#if defined (WIN32) || defined (cygwin)
+ {IFADMINSTATUS, ASN_INTEGER, RWRITE, var_ifEntry, 3, {2, 1, 7}},
+#else
+ {IFADMINSTATUS, ASN_INTEGER, RONLY, var_ifEntry, 3, {2, 1, 7}},
+#endif
+ {IFOPERSTATUS, ASN_INTEGER, RONLY, var_ifEntry, 3, {2, 1, 8}},
+ {IFLASTCHANGE, ASN_TIMETICKS, RONLY, var_ifEntry, 3, {2, 1, 9}},
+ {IFINOCTETS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 10}},
+ {IFINUCASTPKTS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 11}},
+ {IFINNUCASTPKTS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 12}},
+ {IFINDISCARDS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 13}},
+ {IFINERRORS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 14}},
+ {IFINUNKNOWNPROTOS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 15}},
+ {IFOUTOCTETS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 16}},
+ {IFOUTUCASTPKTS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 17}},
+ {IFOUTNUCASTPKTS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 18}},
+ {IFOUTDISCARDS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 19}},
+ {IFOUTERRORS, ASN_COUNTER, RONLY, var_ifEntry, 3, {2, 1, 20}},
+ {IFOUTQLEN, ASN_GAUGE, RONLY, var_ifEntry, 3, {2, 1, 21}},
+ {IFSPECIFIC, ASN_OBJECT_ID, RONLY, var_ifEntry, 3, {2, 1, 22}}
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath, and the OID of the MIB module
+ */
+oid interfaces_variables_oid[] = { SNMP_OID_MIB2, 2 };
+oid interfaces_module_oid[] = { SNMP_OID_MIB2, 31 };
+
+void
+init_interfaces(void)
+{
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("mibII/interfaces", interfaces_variables, variable3,
+ interfaces_variables_oid);
+ REGISTER_SYSOR_ENTRY(interfaces_module_oid,
+ "The MIB module to describe generic objects for network interface sub-layers");
+
+#ifndef USE_SYSCTL_IFLIST
+#if HAVE_NET_IF_MIB_H
+ init_interfaces_setup();
+#endif
+#endif
+#ifdef solaris2
+ init_kernel_sunos5();
+#endif
+}
+
+#ifdef linux
+/*
+ * if_type_from_name
+ * Return interface type using the interface name as a clue.
+ * Returns 1 to imply "other" type if name not recognized.
+ */
+static int
+if_type_from_name(const char *pcch)
+{
+ typedef struct _match_if {
+ int mi_type;
+ const char *mi_name;
+ } *pmatch_if, match_if;
+
+ static match_if lmatch_if[] = {
+ {24, "lo"},
+ {6, "eth"},
+ {9, "tr"},
+ {23, "ppp"},
+ {28, "sl"},
+ {0, 0} /* end of list */
+ };
+
+ int ii, len;
+ register pmatch_if pm;
+
+ for (ii = 0, pm = lmatch_if; pm->mi_name; pm++) {
+ len = strlen(pm->mi_name);
+ if (0 == strncmp(pcch, pm->mi_name, len)) {
+ return (pm->mi_type);
+ }
+ }
+ return (1); /* in case search fails */
+}
+#endif
+
+
+#ifdef linux
+static struct ifnet *ifnetaddr_list;
+#endif
+
+
+/*
+ * header_ifEntry(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+#if !defined (WIN32) && !defined (cygwin)
+static int
+header_ifEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define IFENTRY_NAME_LENGTH 10
+ oid newname[MAX_OID_LEN];
+ register int interface;
+ int result, count;
+
+ DEBUGMSGTL(("mibII/interfaces", "var_ifEntry: "));
+ DEBUGMSGOID(("mibII/interfaces", name, *length));
+ DEBUGMSG(("mibII/interfaces", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+ /*
+ * find "next" interface
+ */
+ count = Interface_Scan_Get_Count();
+ for (interface = 1; interface <= count; interface++) {
+ newname[IFENTRY_NAME_LENGTH] = (oid) interface;
+ result =
+ snmp_oid_compare(name, *length, newname,
+ (int) vp->namelen + 1);
+ if ((exact && (result == 0)) || (!exact && (result < 0)))
+ break;
+ }
+ if (interface > count) {
+ DEBUGMSGTL(("mibII/interfaces", "... index out of range\n"));
+ return MATCH_FAILED;
+ }
+
+
+ memcpy((char *) name, (char *) newname,
+ ((int) vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+ DEBUGMSGTL(("mibII/interfaces", "... get I/F stats "));
+ DEBUGMSGOID(("mibII/interfaces", name, *length));
+ DEBUGMSG(("mibII/interfaces", "\n"));
+
+ return interface;
+}
+
+
+
+u_char *
+var_interfaces(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ if (header_generic(vp, name, length, exact, var_len, write_method) ==
+ MATCH_FAILED)
+ return NULL;
+
+ switch (vp->magic) {
+ case IFNUMBER:
+ long_return = Interface_Scan_Get_Count();
+ return (u_char *) & long_return;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_interfaces\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+#ifdef USE_SYSCTL_IFLIST
+
+static u_char *if_list = 0;
+static const u_char *if_list_end;
+static size_t if_list_size = 0;
+
+struct small_ifaddr {
+ struct in_addr sifa_addr;
+ struct in_addr sifa_netmask;
+ struct in_addr sifa_broadcast;
+};
+
+extern const struct sockaddr *get_address(const void *, int, int);
+extern const struct in_addr *get_in_address(const void *, int, int);
+static int Interface_Scan_By_Index(int, struct if_msghdr *, char *,
+ struct small_ifaddr *);
+static int Interface_Get_Ether_By_Index(int, u_char *);
+
+static int
+Interface_Scan_By_Index(int iindex,
+ struct if_msghdr *if_msg,
+ char *if_name, struct small_ifaddr *sifa)
+{
+ u_char *cp;
+ struct if_msghdr *ifp;
+ int have_ifinfo = 0, have_addr = 0;
+
+ if (NULL != sifa)
+ memset(sifa, 0, sizeof(*sifa));
+ for (cp = if_list; cp < if_list_end; cp += ifp->ifm_msglen) {
+ ifp = (struct if_msghdr *) cp;
+ DEBUGMSGTL(("mibII/interfaces", "ifm_type = %d, ifm_index = %d\n",
+ ifp->ifm_type, ifp->ifm_index));
+
+ switch (ifp->ifm_type) {
+ case RTM_IFINFO:
+ {
+ const struct sockaddr *a;
+
+ if (ifp->ifm_index == iindex) {
+ a = get_address(ifp + 1, ifp->ifm_addrs, RTA_IFP);
+ if (a == NULL)
+ return 0;
+ strncpy(if_name,
+ ((const struct sockaddr_in *) a)->sin_zero,
+ ((const u_char *) a)[5]);
+ if_name[((const u_char *) a)[5]] = 0;
+ *if_msg = *ifp;
+ ++have_ifinfo;
+ }
+ }
+ break;
+ case RTM_NEWADDR:
+ {
+ struct ifa_msghdr *ifap = (struct ifa_msghdr *) cp;
+
+ if ((NULL != sifa) && (ifap->ifam_index == iindex)) {
+ const struct in_addr *ia;
+
+ /*
+ * I don't know why the normal get_address() doesn't
+ * work on IRIX 6.2. Maybe this has to do with the
+ * existence of struct sockaddr_new. Hopefully, on
+ * other systems we can simply use get_in_address
+ * three times, with (ifap+1) as the starting
+ * address.
+ */
+
+ sifa->sifa_netmask =
+ *((struct in_addr *) ((char *) (ifap + 1) + 4));
+ ia = get_in_address((char *) (ifap + 1) + 8,
+ ifap->ifam_addrs &=
+ ~RTA_NETMASK, RTA_IFA);
+ if (ia == NULL)
+ return 0;
+
+ sifa->sifa_addr = *ia;
+ ia = get_in_address((char *) (ifap + 1) + 8,
+ ifap->ifam_addrs &= ~RTA_NETMASK,
+ RTA_BRD);
+ if (ia == NULL)
+ return 0;
+
+ sifa->sifa_broadcast = *ia;
+ ++have_addr;
+ }
+ }
+ break;
+ default:
+ DEBUGMSGTL(("mibII/interfaces",
+ "routing socket: unknown message type %d\n",
+ ifp->ifm_type));
+ }
+ }
+ if (have_ifinfo && (NULL == sifa) || (have_addr)) {
+ return 0;
+ } else if (have_ifinfo && !(if_msg->ifm_flags & IFF_UP))
+ return 0;
+ else {
+ return -1;
+ }
+}
+
+int
+Interface_Scan_Get_Count(void)
+{
+ u_char *cp;
+ struct if_msghdr *ifp;
+ long n = 0;
+
+ Interface_Scan_Init();
+
+ if (if_list_size) {
+ for (cp = if_list, n = 0; cp < if_list_end; cp += ifp->ifm_msglen) {
+ ifp = (struct if_msghdr *) cp;
+
+ if (ifp->ifm_type == RTM_IFINFO) {
+ ++n;
+ }
+ }
+ }
+ return n;
+}
+
+void
+Interface_Scan_Init(void)
+{
+ int name[] = { CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST, 0 };
+ size_t size;
+
+ if (sysctl(name, sizeof(name) / sizeof(int), 0, &size, 0, 0) == -1) {
+ snmp_log(LOG_ERR, "sysctl size fail\n");
+ } else {
+ if (if_list == 0 || if_list_size < size) {
+ if (if_list != 0) {
+ free(if_list);
+ }
+ if_list = NULL;
+ if_list_size = 0;
+ if_list_end = 0;
+ if ((if_list = malloc(size)) == NULL) {
+ snmp_log(LOG_ERR,
+ "out of memory allocating route table (size = %d)\n", size);
+ return;
+ }
+ if_list_size = size;
+ } else {
+ size = if_list_size;
+ }
+ if (sysctl(name, sizeof(name) / sizeof(int),
+ if_list, &size, 0, 0) == -1) {
+ snmp_log(LOG_ERR, "sysctl get fail\n");
+ }
+ if_list_end = if_list + size;
+ }
+}
+
+u_char *
+var_ifEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ int interface;
+ struct if_msghdr if_msg;
+ static char if_name[100];
+ conf_if_list *if_ptr;
+ char *cp;
+
+ interface =
+ header_ifEntry(vp, name, length, exact, var_len, write_method);
+ if (interface == MATCH_FAILED)
+ return NULL;
+
+ if (Interface_Scan_By_Index(interface, &if_msg, if_name, NULL) != 0)
+ return NULL;
+ if_ptr = netsnmp_access_interface_entry_overrides_get(if_name);
+
+ switch (vp->magic) {
+ case IFINDEX:
+ long_return = interface;
+ return (u_char *) & long_return;
+ case IFDESCR:
+ cp = if_name;
+ *var_len = strlen(if_name);
+ return (u_char *) cp;
+ case IFTYPE:
+ if (if_ptr)
+ long_return = if_ptr->type;
+ else
+ long_return = (long) if_msg.ifm_data.ifi_type;
+ return (u_char *) & long_return;
+ case IFMTU:
+ long_return = (long) if_msg.ifm_data.ifi_mtu;
+ return (u_char *) & long_return;
+ case IFSPEED:
+ if (if_ptr)
+ long_return = if_ptr->speed;
+ else {
+#if STRUCT_IFNET_HAS_IF_BAUDRATE_IFS_VALUE
+ long_return = (u_long) if_msg.ifm_data.ifi_baudrate.ifs_value <<
+ if_msg.ifm_data.ifi_baudrate.ifs_log2;
+#else
+ long_return = (u_long) if_msg.ifm_data.ifi_baudrate;
+#endif
+ }
+ return (u_char *) & long_return;
+ case IFPHYSADDRESS:
+ /*
+ * XXX
+ */
+ return NULL;
+ case IFADMINSTATUS:
+ long_return = if_msg.ifm_flags & IFF_UP ? 1 : 2;
+ return (u_char *) & long_return;
+ case IFOPERSTATUS:
+ long_return = if_msg.ifm_flags & IFF_RUNNING ? 1 : 2;
+ return (u_char *) & long_return;
+ /*
+ * ifLastChange
+ */
+ case IFINOCTETS:
+ long_return = (u_long) if_msg.ifm_data.ifi_ibytes;
+ return (u_char *) & long_return;
+ case IFINUCASTPKTS:
+ long_return =
+ (u_long) if_msg.ifm_data.ifi_ipackets -
+ if_msg.ifm_data.ifi_imcasts;
+ return (u_char *) & long_return;
+ case IFINNUCASTPKTS:
+ long_return = (u_long) if_msg.ifm_data.ifi_imcasts;
+ return (u_char *) & long_return;
+ case IFINDISCARDS:
+ long_return = (u_long) if_msg.ifm_data.ifi_iqdrops;
+ return (u_char *) & long_return;
+ case IFINERRORS:
+ long_return = (u_long) if_msg.ifm_data.ifi_ierrors;
+ return (u_char *) & long_return;
+ case IFINUNKNOWNPROTOS:
+ long_return = (u_long) if_msg.ifm_data.ifi_noproto;
+ return (u_char *) & long_return;
+ case IFOUTOCTETS:
+ long_return = (u_long) if_msg.ifm_data.ifi_obytes;
+ return (u_char *) & long_return;
+ case IFOUTUCASTPKTS:
+ long_return =
+ (u_long) if_msg.ifm_data.ifi_opackets -
+ if_msg.ifm_data.ifi_omcasts;
+ return (u_char *) & long_return;
+ case IFOUTNUCASTPKTS:
+ long_return = (u_long) if_msg.ifm_data.ifi_omcasts;
+ return (u_char *) & long_return;
+ case IFOUTDISCARDS:
+#ifdef if_odrops
+ long_return = (u_long) if_msg.ifm_data.ifi_odrops;
+#else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = 0;
+#endif
+ return (u_char *) & long_return;
+ case IFOUTERRORS:
+ long_return = (u_long) if_msg.ifm_data.ifi_oerrors;
+ return (u_char *) & long_return;
+ case IFLASTCHANGE:
+#ifdef irix6
+ long_return = 0;
+#else
+ if (if_msg.ifm_data.ifi_lastchange.tv_sec == 0 &&
+ if_msg.ifm_data.ifi_lastchange.tv_usec == 0)
+ long_return = 0;
+ else if (if_msg.ifm_data.ifi_lastchange.tv_sec < starttime.tv_sec)
+ long_return = 0;
+ else {
+ long_return = (u_long)
+ ((if_msg.ifm_data.ifi_lastchange.tv_sec -
+ starttime.tv_sec) * 100 +
+ (if_msg.ifm_data.ifi_lastchange.tv_usec -
+ starttime.tv_usec) / 10000);
+ }
+#endif
+ return (u_char *) & long_return;
+ default:
+ return 0;
+ }
+}
+
+int
+Interface_Scan_Next(short *Index,
+ char *Name,
+ struct ifnet *Retifnet, struct in_ifaddr *Retin_ifaddr)
+{
+ return 0;
+}
+
+#else /* not USE_SYSCTL_IFLIST */
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+#ifndef HAVE_NET_IF_MIB_H
+
+#ifndef solaris2
+#ifndef hpux11
+static int Interface_Scan_By_Index(int, char *, struct ifnet *,
+ struct in_ifaddr *);
+static int Interface_Get_Ether_By_Index(int, u_char *);
+#else
+static int Interface_Scan_By_Index(int, char *, nmapi_phystat *);
+#endif
+#endif
+
+
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+
+#ifndef solaris2
+#ifndef hpux
+
+u_char *
+var_ifEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ static struct ifnet ifnet;
+ int interface;
+ static struct in_ifaddr in_ifaddr;
+ static char Name[16];
+ char *cp;
+ conf_if_list *if_ptr;
+#if STRUCT_IFNET_HAS_IF_LASTCHANGE_TV_SEC
+ struct timeval now;
+#endif
+
+ interface =
+ header_ifEntry(vp, name, length, exact, var_len, write_method);
+ if (interface == MATCH_FAILED)
+ return NULL;
+
+ Interface_Scan_By_Index(interface, Name, &ifnet, &in_ifaddr);
+ if_ptr = netsnmp_access_interface_entry_overrides_get(Name);
+
+ switch (vp->magic) {
+ case IFINDEX:
+ long_return = interface;
+ return (u_char *) & long_return;
+ case IFDESCR:
+ cp = Name;
+ *var_len = strlen(cp);
+ return (u_char *) cp;
+ case IFTYPE:
+ if (if_ptr)
+ long_return = if_ptr->type;
+ else {
+#if STRUCT_IFNET_HAS_IF_TYPE
+ long_return = ifnet.if_type;
+#else
+ long_return = 1; /* OTHER */
+#endif
+ }
+ return (u_char *) & long_return;
+ case IFMTU:{
+ long_return = (long) ifnet.if_mtu;
+ return (u_char *) & long_return;
+ }
+ case IFSPEED:
+ if (if_ptr)
+ long_return = if_ptr->speed;
+ else {
+#if STRUCT_IFNET_HAS_IF_BAUDRATE
+ long_return = ifnet.if_baudrate;
+#elif STRUCT_IFNET_HAS_IF_SPEED
+ long_return = ifnet.if_speed;
+#elif STRUCT_IFNET_HAS_IF_TYPE && defined(IFT_ETHER)
+ if (ifnet.if_type == IFT_ETHER)
+ long_return = 10000000;
+ if (ifnet.if_type == IFT_P10)
+ long_return = 10000000;
+ if (ifnet.if_type == IFT_P80)
+ long_return = 80000000;
+ if (ifnet.if_type == IFT_ISDNBASIC)
+ long_return = 64000; /* EDSS1 only */
+ if (ifnet.if_type == IFT_ISDNPRIMARY)
+ long_return = 64000 * 30;
+#else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = (u_long) 10000000;
+#endif
+ }
+ return (u_char *) & long_return;
+ case IFPHYSADDRESS:
+ Interface_Get_Ether_By_Index(interface, return_buf);
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ *var_len = 0;
+#else
+ if ((return_buf[0] == 0) && (return_buf[1] == 0) &&
+ (return_buf[2] == 0) && (return_buf[3] == 0) &&
+ (return_buf[4] == 0) && (return_buf[5] == 0))
+ *var_len = 0;
+ else
+ *var_len = 6;
+#endif
+ return (u_char *) return_buf;
+ case IFADMINSTATUS:
+ long_return = ifnet.if_flags & IFF_UP ? 1 : 2;
+ return (u_char *) & long_return;
+ case IFOPERSTATUS:
+ long_return = ifnet.if_flags & IFF_RUNNING ? 1 : 2;
+ return (u_char *) & long_return;
+ case IFLASTCHANGE:
+#if defined(STRUCT_IFNET_HAS_IF_LASTCHANGE_TV_SEC) && !(defined(freebsd2) && __FreeBSD_version < 199607)
+ /*
+ * XXX - SNMP's ifLastchange is time when op. status changed
+ * * FreeBSD's if_lastchange is time when packet was input or output
+ * * (at least in 2.1.0-RELEASE. Changed in later versions of the kernel?)
+ */
+ /*
+ * FreeBSD's if_lastchange before the 2.1.5 release is the time when
+ * * a packet was last input or output. In the 2.1.5 and later releases,
+ * * this is fixed, thus the 199607 comparison.
+ */
+ if (ifnet.if_lastchange.tv_sec == 0 &&
+ ifnet.if_lastchange.tv_usec == 0)
+ long_return = 0;
+ else if (ifnet.if_lastchange.tv_sec < starttime.tv_sec)
+ long_return = 0;
+ else {
+ long_return = (u_long)
+ ((ifnet.if_lastchange.tv_sec - starttime.tv_sec) * 100
+ + (ifnet.if_lastchange.tv_usec -
+ starttime.tv_usec) / 10000);
+ }
+#else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = 0; /* XXX */
+#endif
+ return (u_char *) & long_return;
+ case IFINOCTETS:
+#ifdef STRUCT_IFNET_HAS_IF_IBYTES
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ long_return = (u_long) ifnet.if_ibytes & 0xffffffff;
+#else
+ long_return = (u_long) ifnet.if_ibytes;
+#endif
+#else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = (u_long) ifnet.if_ipackets * 308; /* XXX */
+#endif
+ return (u_char *) & long_return;
+ case IFINUCASTPKTS:
+ {
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ long_return = (u_long) ifnet.if_ipackets & 0xffffffff;
+#else
+ long_return = (u_long) ifnet.if_ipackets;
+#endif
+#if STRUCT_IFNET_HAS_IF_IMCASTS
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ long_return -= (u_long) ifnet.if_imcasts & 0xffffffff;
+#else
+ long_return -= (u_long) ifnet.if_imcasts;
+#endif
+#endif
+ }
+ return (u_char *) & long_return;
+ case IFINNUCASTPKTS:
+#if STRUCT_IFNET_HAS_IF_IMCASTS
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ long_return = (u_long) ifnet.if_imcasts & 0xffffffff;
+#else
+ long_return = (u_long) ifnet.if_imcasts;
+#endif
+#else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = (u_long) 0; /* XXX */
+#endif
+ return (u_char *) & long_return;
+ case IFINDISCARDS:
+#if STRUCT_IFNET_HAS_IF_IQDROPS
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ long_return = (u_long) ifnet.if_iqdrops & 0xffffffff;
+#else
+ long_return = (u_long) ifnet.if_iqdrops;
+#endif
+#else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = (u_long) 0; /* XXX */
+#endif
+ return (u_char *) & long_return;
+ case IFINERRORS:
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ long_return = (u_long) ifnet.if_ierrors & 0xffffffff;
+#else
+ long_return = (u_long) ifnet.if_ierrors;
+#endif
+ return (u_char *) & long_return;
+ case IFINUNKNOWNPROTOS:
+#if STRUCT_IFNET_HAS_IF_NOPROTO
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ long_return = (u_long) ifnet.if_noproto & 0xffffffff;
+#else
+ long_return = (u_long) ifnet.if_noproto;
+#endif
+#else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = (u_long) 0; /* XXX */
+#endif
+ return (u_char *) & long_return;
+ case IFOUTOCTETS:
+#ifdef STRUCT_IFNET_HAS_IF_OBYTES
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ long_return = (u_long) ifnet.if_obytes & 0xffffffff;
+#else
+ long_return = (u_long) ifnet.if_obytes;
+#endif
+#else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = (u_long) ifnet.if_opackets * 308; /* XXX */
+#endif
+ return (u_char *) & long_return;
+ case IFOUTUCASTPKTS:
+ {
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ long_return = (u_long) ifnet.if_opackets & 0xffffffff;
+#else
+ long_return = (u_long) ifnet.if_opackets;
+#endif
+#if STRUCT_IFNET_HAS_IF_OMCASTS
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ long_return -= (u_long) ifnet.if_omcasts & 0xffffffff;
+#else
+ long_return -= (u_long) ifnet.if_omcasts;
+#endif
+#endif
+ }
+ return (u_char *) & long_return;
+ case IFOUTNUCASTPKTS:
+#if STRUCT_IFNET_HAS_IF_OMCASTS
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ long_return = (u_long) ifnet.if_omcasts & 0xffffffff;
+#else
+ long_return = (u_long) ifnet.if_omcasts;
+#endif
+#else
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = (u_long) 0; /* XXX */
+#endif
+ return (u_char *) & long_return;
+ case IFOUTDISCARDS:
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ long_return = ifnet.if_snd.ifq_drops & 0xffffffff;
+#else
+ long_return = ifnet.if_snd.ifq_drops;
+#endif
+ return (u_char *) & long_return;
+ case IFOUTERRORS:
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ long_return = ifnet.if_oerrors & 0xffffffff;
+#else
+ long_return = ifnet.if_oerrors;
+#endif
+ return (u_char *) & long_return;
+ case IFOUTQLEN:
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ long_return = ifnet.if_snd.ifq_len & 0xffffffff;
+#else
+ long_return = ifnet.if_snd.ifq_len;
+#endif
+ return (u_char *) & long_return;
+ case IFSPECIFIC:
+ *var_len = nullOidLen;
+ return (u_char *) nullOid;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ifEntry\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+#else /* hpux */
+
+u_char *
+var_ifEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#if defined(hpux11)
+ static nmapi_phystat ifnet;
+#else
+ static struct ifnet ifnet;
+#endif
+ register int interface;
+#if !defined(hpux11)
+ static struct in_ifaddr in_ifaddrVar;
+#endif
+#if defined(hpux11)
+ static char Name[MAX_PHYSADDR_LEN];
+#else
+ static char Name[16];
+#endif
+ register char *cp;
+#if STRUCT_IFNET_HAS_IF_LASTCHANGE_TV_SEC
+ struct timeval now;
+#endif
+#if !defined(hpux11)
+ struct nmparms hp_nmparms;
+ static mib_ifEntry hp_ifEntry;
+ int hp_fd;
+ int hp_len = sizeof(hp_ifEntry);
+#endif
+ conf_if_list *if_ptr;
+
+ interface =
+ header_ifEntry(vp, name, length, exact, var_len, write_method);
+ if (interface == MATCH_FAILED)
+ return NULL;
+
+#if defined(hpux11)
+ Interface_Scan_By_Index(interface, Name, &ifnet);
+#else
+ Interface_Scan_By_Index(interface, Name, &ifnet, &in_ifaddrVar);
+#endif
+
+#if !defined(hpux11)
+ /*
+ * Additional information about the interfaces is available under
+ * HP-UX through the network management interface '/dev/netman'
+ */
+ hp_ifEntry.ifIndex = interface;
+ hp_nmparms.objid = ID_ifEntry;
+ hp_nmparms.buffer = (char *) &hp_ifEntry;
+ hp_nmparms.len = &hp_len;
+ if ((hp_fd = open("/dev/netman", O_RDONLY)) != -1) {
+ if (ioctl(hp_fd, NMIOGET, &hp_nmparms) != -1) {
+ close(hp_fd);
+ } else {
+ close(hp_fd);
+ hp_fd = -1; /* failed */
+ }
+ }
+#endif
+ if_ptr = netsnmp_access_interface_entry_overrides_get(Name);
+
+ switch (vp->magic) {
+ case IFINDEX:
+ long_return = interface;
+ return (u_char *) & long_return;
+ case IFDESCR:
+#if defined(hpux11)
+ cp = ifnet.if_entry.ifDescr;
+#else
+ if (hp_fd != -1)
+ cp = hp_ifEntry.ifDescr;
+ else
+ cp = Name;
+#endif
+ *var_len = strlen(cp);
+ return (u_char *) cp;
+ case IFTYPE:
+ if (if_ptr)
+ long_return = if_ptr->type;
+ else {
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifType;
+#else
+ if (hp_fd != -1)
+ long_return = hp_ifEntry.ifType;
+ else
+ long_return = 1; /* OTHER */
+#endif
+ }
+ return (u_char *) & long_return;
+ case IFMTU:{
+#if defined(hpux11)
+ long_return = (long) ifnet.if_entry.ifMtu;
+#else
+ long_return = (long) ifnet.if_mtu;
+#endif
+ return (u_char *) & long_return;
+ }
+ case IFSPEED:
+ if (if_ptr)
+ long_return = if_ptr->speed;
+ else {
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifSpeed;
+#else
+ if (hp_fd != -1)
+ long_return = hp_ifEntry.ifSpeed;
+ else
+ long_return = (u_long) 1; /* OTHER */
+#endif
+ }
+ return (u_char *) & long_return;
+ case IFPHYSADDRESS:
+#if defined(hpux11)
+ *var_len = ifnet.if_entry.ifPhysAddress.o_length;
+ return (u_char *) ifnet.if_entry.ifPhysAddress.o_bytes;
+#else
+ Interface_Get_Ether_By_Index(interface, return_buf);
+ if ((return_buf[0] == 0) && (return_buf[1] == 0) &&
+ (return_buf[2] == 0) && (return_buf[3] == 0) &&
+ (return_buf[4] == 0) && (return_buf[5] == 0))
+ *var_len = 0;
+ else
+ *var_len = 6;
+ return (u_char *) return_buf;
+#endif
+ case IFADMINSTATUS:
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifAdmin;
+#else
+ long_return = ifnet.if_flags & IFF_UP ? 1 : 2;
+#endif
+ return (u_char *) & long_return;
+ case IFOPERSTATUS:
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifOper;
+#else
+ long_return = ifnet.if_flags & IFF_RUNNING ? 1 : 2;
+#endif
+ return (u_char *) & long_return;
+ case IFLASTCHANGE:
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifLastChange;
+#else
+ if (hp_fd != -1)
+ long_return = hp_ifEntry.ifLastChange;
+ else
+ long_return = 0; /* XXX */
+#endif
+ return (u_char *) & long_return;
+ case IFINOCTETS:
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifInOctets;
+#else
+ if (hp_fd != -1)
+ long_return = hp_ifEntry.ifInOctets;
+ else
+ long_return = (u_long) ifnet.if_ipackets * 308; /* XXX */
+#endif
+ return (u_char *) & long_return;
+ case IFINUCASTPKTS:
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifInUcastPkts;
+#else
+ if (hp_fd != -1)
+ long_return = hp_ifEntry.ifInUcastPkts;
+ else
+ long_return = (u_long) ifnet.if_ipackets;
+#endif
+ return (u_char *) & long_return;
+ case IFINNUCASTPKTS:
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifInNUcastPkts;
+#else
+ if (hp_fd != -1)
+ long_return = hp_ifEntry.ifInNUcastPkts;
+ else
+ long_return = (u_long) 0; /* XXX */
+#endif
+ return (u_char *) & long_return;
+ case IFINDISCARDS:
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifInDiscards;
+#else
+ if (hp_fd != -1)
+ long_return = hp_ifEntry.ifInDiscards;
+ else
+ long_return = (u_long) 0; /* XXX */
+#endif
+ return (u_char *) & long_return;
+ case IFINERRORS:
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifInErrors;
+#else
+ long_return = ifnet.if_ierrors;
+#endif
+ return (u_char *) & long_return;
+ case IFINUNKNOWNPROTOS:
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifInUnknownProtos;
+#else
+ if (hp_fd != -1)
+ long_return = hp_ifEntry.ifInUnknownProtos;
+ else
+ long_return = (u_long) 0; /* XXX */
+#endif
+ return (u_char *) & long_return;
+ case IFOUTOCTETS:
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifOutOctets;
+#else
+ if (hp_fd != -1)
+ long_return = hp_ifEntry.ifOutOctets;
+ else
+ long_return = (u_long) ifnet.if_opackets * 308; /* XXX */
+#endif
+ return (u_char *) & long_return;
+ case IFOUTUCASTPKTS:
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifOutUcastPkts;
+#else
+ if (hp_fd != -1)
+ long_return = hp_ifEntry.ifOutUcastPkts;
+ else
+ long_return = (u_long) ifnet.if_opackets;
+#endif
+ return (u_char *) & long_return;
+ case IFOUTNUCASTPKTS:
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifOutNUcastPkts;
+#else
+ if (hp_fd != -1)
+ long_return = hp_ifEntry.ifOutNUcastPkts;
+ else
+ long_return = (u_long) 0; /* XXX */
+#endif
+ return (u_char *) & long_return;
+ case IFOUTDISCARDS:
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifOutDiscards;
+#else
+ long_return = ifnet.if_snd.ifq_drops;
+#endif
+ return (u_char *) & long_return;
+ case IFOUTERRORS:
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifOutErrors;
+#else
+ long_return = ifnet.if_oerrors;
+#endif
+ return (u_char *) & long_return;
+ case IFOUTQLEN:
+#if defined(hpux11)
+ long_return = ifnet.if_entry.ifOutQlen;
+#else
+ long_return = ifnet.if_snd.ifq_len;
+#endif
+ return (u_char *) & long_return;
+ case IFSPECIFIC:
+ *var_len = nullOidLen;
+ return (u_char *) nullOid;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ifEntry\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+#endif /* hpux */
+#else /* solaris2 */
+
+static int
+IF_cmp(void *addr, void *ep)
+{
+ DEBUGMSGTL(("mibII/interfaces", "... IF_cmp %d %d\n",
+ ((mib2_ifEntry_t *) ep)->ifIndex,
+ ((mib2_ifEntry_t *) addr)->ifIndex));
+ if (((mib2_ifEntry_t *) ep)->ifIndex ==
+ ((mib2_ifEntry_t *) addr)->ifIndex)
+ return (0);
+ else
+ return (1);
+}
+
+u_char *
+var_ifEntry(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ int interface;
+ mib2_ifEntry_t ifstat;
+ conf_if_list *if_ptr = NULL;
+
+ interface =
+ header_ifEntry(vp, name, length, exact, var_len, write_method);
+ if (interface == MATCH_FAILED)
+ return NULL;
+
+ if (getMibstat(MIB_INTERFACES, &ifstat, sizeof(mib2_ifEntry_t),
+ GET_EXACT, &IF_cmp, &interface) != 0) {
+ DEBUGMSGTL(("mibII/interfaces", "... no mib stats\n"));
+ return NULL;
+ }
+ /*
+ * hmmm.. where to get the interface name to check overrides?
+ *
+ * if_ptr = netsnmp_access_interface_entry_overrides_get(Name);
+ */
+ switch (vp->magic) {
+ case IFINDEX:
+ long_return = ifstat.ifIndex;
+ return (u_char *) & long_return;
+ case IFDESCR:
+ *var_len = ifstat.ifDescr.o_length;
+ (void) memcpy(return_buf, ifstat.ifDescr.o_bytes, *var_len);
+ return (u_char *) return_buf;
+ case IFTYPE:
+ if (if_ptr)
+ long_return = if_ptr->type;
+ else
+ long_return = (u_long) ifstat.ifType;
+ return (u_char *) & long_return;
+ case IFMTU:
+ long_return = (u_long) ifstat.ifMtu;
+ return (u_char *) & long_return;
+ case IFSPEED:
+ if (if_ptr)
+ long_return = if_ptr->speed;
+ else
+ long_return = (u_long) ifstat.ifSpeed;
+ return (u_char *) & long_return;
+ case IFPHYSADDRESS:
+ *var_len = ifstat.ifPhysAddress.o_length;
+ (void) memcpy(return_buf, ifstat.ifPhysAddress.o_bytes, *var_len);
+ return (u_char *) return_buf;
+ case IFADMINSTATUS:
+ long_return = (u_long) ifstat.ifAdminStatus;
+ return (u_char *) & long_return;
+ case IFOPERSTATUS:
+ long_return = (u_long) ifstat.ifOperStatus;
+ return (u_char *) & long_return;
+ case IFLASTCHANGE:
+ long_return = (u_long) ifstat.ifLastChange;
+ return (u_char *) & long_return;
+ case IFINOCTETS:
+ long_return = (u_long) ifstat.ifInOctets;
+ return (u_char *) & long_return;
+ case IFINUCASTPKTS:
+ long_return = (u_long) ifstat.ifInUcastPkts;
+ return (u_char *) & long_return;
+ case IFINNUCASTPKTS:
+ long_return = (u_long) ifstat.ifInNUcastPkts;
+ return (u_char *) & long_return;
+ case IFINDISCARDS:
+ long_return = (u_long) ifstat.ifInDiscards;
+ return (u_char *) & long_return;
+ case IFINERRORS:
+ long_return = (u_long) ifstat.ifInErrors;
+ return (u_char *) & long_return;
+ case IFINUNKNOWNPROTOS:
+ long_return = (u_long) ifstat.ifInUnknownProtos;
+ return (u_char *) & long_return;
+ case IFOUTOCTETS:
+ long_return = (u_long) ifstat.ifOutOctets;
+ return (u_char *) & long_return;
+ case IFOUTUCASTPKTS:
+ long_return = (u_long) ifstat.ifOutUcastPkts;
+ return (u_char *) & long_return;
+ case IFOUTNUCASTPKTS:
+ long_return = (u_long) ifstat.ifOutNUcastPkts;
+ return (u_char *) & long_return;
+ case IFOUTDISCARDS:
+ long_return = (u_long) ifstat.ifOutDiscards;
+ return (u_char *) & long_return;
+ case IFOUTERRORS:
+ long_return = (u_long) ifstat.ifOutErrors;
+ return (u_char *) & long_return;
+ case IFOUTQLEN:
+ long_return = (u_long) ifstat.ifOutQLen;
+ return (u_char *) & long_return;
+ case IFSPECIFIC:
+ long_return = (u_long) ifstat.ifSpecific;
+ return (u_char *) & long_return;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ifEntry\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+#endif /* solaris2 */
+
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+
+#ifndef solaris2
+
+#if !defined(sunV3) && !defined(linux) && !defined(hpux11)
+static struct in_ifaddr savein_ifaddr;
+#endif
+#if !defined(hpux11)
+static struct ifnet *ifnetaddr, saveifnet, *saveifnetaddr;
+static char saveName[16];
+#endif
+static int saveIndex = 0;
+
+/**
+* Determines network interface speed. It is system specific. Only linux
+* realization is made.
+*/
+unsigned int getIfSpeed(int fd, struct ifreq ifr)
+{
+#ifdef linux
+ /** temporary expose internal until this module can be re-written */
+ extern unsigned int
+ netsnmp_linux_interface_get_if_speed(int fd, const char *name);
+
+ return netsnmp_linux_interface_get_if_speed(fd, ifr.ifr_name);
+#else /*!linux*/
+ return 10000000;
+#endif
+}
+
+void
+Interface_Scan_Init(void)
+{
+#ifdef linux
+ char line[256], ifname_buf[64], *ifname, *ptr;
+ struct ifreq ifrq;
+ struct ifnet **ifnetaddr_ptr;
+ FILE *devin;
+ int i, fd;
+ conf_if_list *if_ptr;
+ /*
+ * scanline_2_2:
+ * [ IN ]
+ * byte pkts errs drop fifo frame cmprs mcst |
+ * [ OUT ]
+ * byte pkts errs drop fifo colls carrier compressed
+ */
+#ifdef SCNuMAX
+ uintmax_t rec_pkt, rec_oct, rec_err, rec_drop;
+ uintmax_t snd_pkt, snd_oct, snd_err, snd_drop, coll;
+ const char *scan_line_2_2 =
+ "%" SCNuMAX " %" SCNuMAX " %" SCNuMAX " %" SCNuMAX
+ " %*" SCNuMAX " %*" SCNuMAX " %*" SCNuMAX " %*" SCNuMAX
+ " %" SCNuMAX " %" SCNuMAX " %" SCNuMAX " %" SCNuMAX
+ " %*" SCNuMAX " %" SCNuMAX;
+ const char *scan_line_2_0 =
+ "%" SCNuMAX " %" SCNuMAX " %*" SCNuMAX " %*" SCNuMAX
+ " %*" SCNuMAX " %" SCNuMAX " %" SCNuMAX " %*" SCNuMAX
+ " %*" SCNuMAX " %" SCNuMAX;
+#else
+ unsigned long rec_pkt, rec_oct, rec_err, rec_drop;
+ unsigned long snd_pkt, snd_oct, snd_err, snd_drop, coll;
+ const char *scan_line_2_2 =
+ "%lu %lu %lu %lu %*lu %*lu %*lu %*lu %lu %lu %lu %lu %*lu %lu";
+ const char *scan_line_2_0 =
+ "%lu %lu %*lu %*lu %*lu %lu %lu %*lu %*lu %lu";
+#endif
+ const char *scan_line_to_use;
+ struct timeval et; /* elapsed time */
+
+#endif
+
+#if !defined(hpux11) && defined(IFNET_SYMBOL)
+ auto_nlist(IFNET_SYMBOL, (char *) &ifnetaddr, sizeof(ifnetaddr));
+#endif
+ saveIndex = 0;
+
+
+#ifdef linux
+ /* disallow reloading of structures too often */
+ gettimeofday ( &et, ( struct timezone * ) 0 ); /* get time-of-day */
+ if ( et.tv_sec < LastLoad + MINLOADFREQ ) { /* only reload so often */
+ ifnetaddr = ifnetaddr_list; /* initialize pointer */
+ return;
+ }
+ LastLoad = et.tv_sec;
+
+ /*
+ * free old list:
+ */
+ while (ifnetaddr_list) {
+ struct ifnet *old = ifnetaddr_list;
+ ifnetaddr_list = ifnetaddr_list->if_next;
+ free(old->if_name);
+ free(old->if_unit);
+ free(old);
+ }
+
+ ifnetaddr = 0;
+ ifnetaddr_ptr = &ifnetaddr_list;
+
+ if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ DEBUGMSGTL(("snmpd",
+ "socket open failure in Interface_Scan_Init\n"));
+ return; /** exit (1); **/
+ }
+
+ /*
+ * build up ifnetaddr list by hand:
+ */
+
+ /*
+ * at least linux v1.3.53 says EMFILE without reason...
+ */
+ if (!(devin = fopen("/proc/net/dev", "r"))) {
+ close(fd);
+ snmp_log(LOG_ERR, "cannot open /proc/net/dev - continuing...\n");
+ return; /** exit (1); **/
+ }
+
+ i = 0;
+
+ /*
+ * read the second line (a header) and determine the fields we
+ * should read from. This should be done in a better way by
+ * actually looking for the field names we want. But thats too
+ * much work for today. -- Wes
+ */
+ fgets(line, sizeof(line), devin);
+ fgets(line, sizeof(line), devin);
+ if (strstr(line, "compressed")) {
+ scan_line_to_use = scan_line_2_2;
+ DEBUGMSGTL(("mibII/interfaces",
+ "using linux 2.2 kernel /proc/net/dev\n"));
+ } else {
+ scan_line_to_use = scan_line_2_0;
+ DEBUGMSGTL(("mibII/interfaces",
+ "using linux 2.0 kernel /proc/net/dev\n"));
+ }
+
+
+ while (fgets(line, sizeof(line), devin)) {
+ struct ifnet *nnew;
+ char *stats, *ifstart = line;
+
+ if (line[strlen(line) - 1] == '\n')
+ line[strlen(line) - 1] = '\0';
+
+ while (*ifstart && *ifstart == ' ')
+ ifstart++;
+
+ if (!*ifstart || ((stats = strrchr(ifstart, ':')) == NULL)) {
+ snmp_log(LOG_ERR,
+ "/proc/net/dev data format error, line ==|%s|", line);
+ continue;
+ }
+ if ((scan_line_to_use == scan_line_2_2) && ((stats - line) < 6)) {
+ snmp_log(LOG_ERR,
+ "/proc/net/dev data format error, line ==|%s|", line);
+ }
+
+ *stats = 0;
+ strncpy(ifname_buf, ifstart, sizeof(ifname_buf));
+ ifname_buf[ sizeof(ifname_buf)-1 ] = 0;
+ *stats++ = ':';
+ while (*stats == ' ')
+ stats++;
+
+ if ((scan_line_to_use == scan_line_2_2 &&
+ sscanf(stats, scan_line_to_use, &rec_oct, &rec_pkt, &rec_err,
+ &rec_drop, &snd_oct, &snd_pkt, &snd_err, &snd_drop,
+ &coll) != 9) || (scan_line_to_use == scan_line_2_0
+ && sscanf(stats, scan_line_to_use,
+ &rec_pkt, &rec_err,
+ &snd_pkt, &snd_err,
+ &coll) != 5)) {
+ if ((scan_line_to_use == scan_line_2_2)
+ && !strstr(line, "No statistics available"))
+ snmp_log(LOG_ERR,
+ "/proc/net/dev data format error, line ==|%s|",
+ line);
+ continue;
+ }
+
+ nnew = (struct ifnet *) calloc(1, sizeof(struct ifnet));
+ if (nnew == NULL)
+ break; /* alloc error */
+
+ /*
+ * chain in:
+ */
+ *ifnetaddr_ptr = nnew;
+ ifnetaddr_ptr = &nnew->if_next;
+ i++;
+
+ /*
+ * linux previous to 1.3.~13 may miss transmitted loopback pkts:
+ */
+ if (!strcmp(ifname_buf, "lo") && rec_pkt > 0 && !snd_pkt)
+ snd_pkt = rec_pkt;
+
+ nnew->if_ipackets = rec_pkt & 0xffffffff;
+ nnew->if_ierrors = rec_err;
+ nnew->if_opackets = snd_pkt & 0xffffffff;
+ nnew->if_oerrors = snd_err;
+ nnew->if_collisions = coll;
+ if (scan_line_to_use == scan_line_2_2) {
+ nnew->if_ibytes = rec_oct & 0xffffffff;
+ nnew->if_obytes = snd_oct & 0xffffffff;
+ nnew->if_iqdrops = rec_drop;
+ nnew->if_snd.ifq_drops = snd_drop;
+ } else {
+ nnew->if_ibytes = (rec_pkt * 308) & 0xffffffff;
+ nnew->if_obytes = (snd_pkt * 308) & 0xffffffff;
+ }
+
+ /*
+ * ifnames are given as `` eth0'': split in ``eth'' and ``0'':
+ */
+ for (ifname = ifname_buf; *ifname && *ifname == ' '; ifname++);
+
+ /*
+ * set name and interface# :
+ */
+ nnew->if_name = (char *) strdup(ifname);
+ for (ptr = nnew->if_name; *ptr && (*ptr < '0' || *ptr > '9');
+ ptr++);
+ nnew->if_unit = strdup(*ptr ? ptr : "");
+ *ptr = 0;
+
+ strncpy(ifrq.ifr_name, ifname, sizeof(ifrq.ifr_name));
+ ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+ if (ioctl(fd, SIOCGIFADDR, &ifrq) < 0)
+ memset((char *) &nnew->if_addr, 0, sizeof(nnew->if_addr));
+ else
+ nnew->if_addr = ifrq.ifr_addr;
+
+ strncpy(ifrq.ifr_name, ifname, sizeof(ifrq.ifr_name));
+ ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+ if (ioctl(fd, SIOCGIFBRDADDR, &ifrq) < 0)
+ memset((char *) &nnew->ifu_broadaddr, 0,
+ sizeof(nnew->ifu_broadaddr));
+ else
+ nnew->ifu_broadaddr = ifrq.ifr_broadaddr;
+
+ strncpy(ifrq.ifr_name, ifname, sizeof(ifrq.ifr_name));
+ ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+ if (ioctl(fd, SIOCGIFNETMASK, &ifrq) < 0)
+ memset((char *) &nnew->ia_subnetmask, 0,
+ sizeof(nnew->ia_subnetmask));
+ else
+ nnew->ia_subnetmask = ifrq.ifr_netmask;
+
+ strncpy(ifrq.ifr_name, ifname, sizeof(ifrq.ifr_name));
+ ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+ nnew->if_flags = ioctl(fd, SIOCGIFFLAGS, &ifrq) < 0
+ ? 0 : ifrq.ifr_flags;
+
+ nnew->if_type = 0;
+
+ /*
+ * NOTE: this ioctl does not guarantee 6 bytes of a physaddr.
+ * In particular, a 'sit0' interface only appears to get back
+ * 4 bytes of sa_data.
+ */
+ memset(ifrq.ifr_hwaddr.sa_data, (0), IFHWADDRLEN);
+ strncpy(ifrq.ifr_name, ifname, sizeof(ifrq.ifr_name));
+ ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+ if (ioctl(fd, SIOCGIFHWADDR, &ifrq) < 0)
+ memset(nnew->if_hwaddr, (0), IFHWADDRLEN);
+ else {
+ memcpy(nnew->if_hwaddr, ifrq.ifr_hwaddr.sa_data, IFHWADDRLEN);
+
+#ifdef ARPHRD_LOOPBACK
+ switch (ifrq.ifr_hwaddr.sa_family) {
+ case ARPHRD_ETHER:
+ nnew->if_type = 6;
+ break;
+ case ARPHRD_TUNNEL:
+ case ARPHRD_TUNNEL6:
+#ifdef ARPHRD_IPGRE
+ case ARPHRD_IPGRE:
+#endif
+ case ARPHRD_SIT:
+ nnew->if_type = 131;
+ break; /* tunnel */
+ case ARPHRD_SLIP:
+ case ARPHRD_CSLIP:
+ case ARPHRD_SLIP6:
+ case ARPHRD_CSLIP6:
+ nnew->if_type = 28;
+ break; /* slip */
+ case ARPHRD_PPP:
+ nnew->if_type = 23;
+ break; /* ppp */
+ case ARPHRD_LOOPBACK:
+ nnew->if_type = 24;
+ break; /* softwareLoopback */
+ case ARPHRD_FDDI:
+ nnew->if_type = 15;
+ break;
+ case ARPHRD_ARCNET:
+ nnew->if_type = 35;
+ break;
+ case ARPHRD_LOCALTLK:
+ nnew->if_type = 42;
+ break;
+#ifdef ARPHRD_HIPPI
+ case ARPHRD_HIPPI:
+ nnew->if_type = 47;
+ break;
+#endif
+#ifdef ARPHRD_ATM
+ case ARPHRD_ATM:
+ nnew->if_type = 37;
+ break;
+#endif
+ /*
+ * XXX: more if_arp.h:ARPHDR_xxx to IANAifType mappings...
+ */
+ }
+#endif
+ }
+
+ strncpy(ifrq.ifr_name, ifname, sizeof(ifrq.ifr_name));
+ ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+ nnew->if_metric = ioctl(fd, SIOCGIFMETRIC, &ifrq) < 0
+ ? 0 : ifrq.ifr_metric;
+
+#ifdef SIOCGIFMTU
+ strncpy(ifrq.ifr_name, ifname, sizeof(ifrq.ifr_name));
+ ifrq.ifr_name[ sizeof(ifrq.ifr_name)-1 ] = 0;
+ nnew->if_mtu = (ioctl(fd, SIOCGIFMTU, &ifrq) < 0)
+ ? 0 : ifrq.ifr_mtu;
+#else
+ nnew->if_mtu = 0;
+#endif
+
+ if_ptr = netsnmp_access_interface_entry_overrides_get(ifname);
+ if (if_ptr) {
+ nnew->if_type = if_ptr->type;
+ nnew->if_speed = if_ptr->speed;
+ } else {
+ /*
+ * do only guess if_type from name, if we could not read
+ * * it before from SIOCGIFHWADDR
+ */
+ if (!nnew->if_type)
+ nnew->if_type = if_type_from_name(nnew->if_name);
+ nnew->if_speed = nnew->if_type == 6 ? getIfSpeed(fd, ifrq) :
+ nnew->if_type == 24 ? 10000000 :
+ nnew->if_type == 9 ? 4000000 : 0;
+ /*Zero speed means link problem*/
+ if(nnew->if_speed == 0 && nnew->if_flags & IFF_UP){
+ nnew->if_flags &= ~IFF_RUNNING;
+ }
+ }
+
+ } /* while (fgets ... */
+
+ ifnetaddr = ifnetaddr_list;
+
+ if (snmp_get_do_debugging()) {
+ {
+ struct ifnet *x = ifnetaddr;
+ DEBUGMSGTL(("mibII/interfaces", "* see: known interfaces:"));
+ while (x) {
+ DEBUGMSG(("mibII/interfaces", " %s", x->if_name));
+ x = x->if_next;
+ }
+ DEBUGMSG(("mibII/interfaces", "\n"));
+ } /* XXX */
+ }
+
+ fclose(devin);
+ close(fd);
+#endif /* linux */
+}
+
+
+
+#if defined(sunV3) || defined(linux)
+/*
+ * ** 4.2 BSD doesn't have ifaddr
+ * **
+ */
+int
+Interface_Scan_Next(short *Index,
+ char *Name,
+ struct ifnet *Retifnet, struct in_ifaddr *dummy)
+{
+ struct ifnet ifnet;
+ register char *cp;
+
+ while (ifnetaddr) {
+ /*
+ * Get the "ifnet" structure and extract the device name
+ */
+#ifndef linux
+ if (!NETSNMP_KLOOKUP(ifnetaddr, (char *) &ifnet, sizeof ifnet)) {
+ DEBUGMSGTL(("mibII/interfaces:Interface_Scan_Next", "klookup failed\n"));
+ break;
+ }
+
+ if (!NETSNMP_KLOOKUP(ifnet.if_name, (char *) saveName, sizeof saveName)) {
+ DEBUGMSGTL(("mibII/interfaces:Interface_Scan_Next", "klookup failed\n"));
+ break;
+ }
+
+ /*
+ * The purpose of this comparison is lost in the mists of time.
+ * It's been around at least cmu-snmp 2.1.2 for SUNv3 systems and
+ * was applied to linux systems during the cmu-snmp-linux project.
+ * No-one now knows what it was intended for, and it breaks IPv6
+ * tunnel interfaces, so it's been moved out of the Linux code block.
+ */
+ if (strcmp(saveName, "ip") == 0) {
+ ifnetaddr = ifnet.if_next;
+ continue;
+ }
+#else
+ ifnet = *ifnetaddr;
+ strncpy(saveName, ifnet.if_name, sizeof(saveName));
+#endif
+
+ saveName[sizeof(saveName) - 1] = '\0';
+ cp = (char *) strchr(saveName, '\0');
+#ifdef linux
+ strncat(cp, ifnet.if_unit, sizeof(saveName)-strlen(saveName)-1);
+ saveName[sizeof(saveName) - 1] = '\0';
+#else
+ string_append_int(cp, ifnet.if_unit);
+#endif
+ if (1 || strcmp(saveName, "lo0") != 0) { /* XXX */
+
+ if (Index)
+ *Index = ++saveIndex;
+ if (Retifnet)
+ *Retifnet = ifnet;
+ if (Name)
+ strcpy(Name, saveName);
+ saveifnet = ifnet;
+ saveifnetaddr = ifnetaddr;
+ ifnetaddr = ifnet.if_next;
+
+ return (1); /* DONE */
+ }
+ ifnetaddr = ifnet.if_next;
+ }
+ return (0); /* EOF */
+}
+
+#ifdef linux
+int
+Interface_Index_By_Name(char *Name, int Len)
+{
+ short ifIndex = 0;
+ char ifName[20];
+
+ Interface_Scan_Init();
+ while (Interface_Scan_Next(&ifIndex, ifName, NULL, NULL)
+ && strcmp(Name, ifName));
+ return ifIndex;
+}
+#endif
+
+
+#else /* sunV3 || linux */
+
+#if defined(netbsd1) || defined(openbsd2)
+#define ia_next ia_list.tqe_next
+#define if_next if_list.tqe_next
+#endif
+
+#if defined(hpux11)
+
+int
+Interface_Scan_Next(short *Index, char *Name, nmapi_phystat * Retifnet)
+{
+ static nmapi_phystat *if_ptr = (nmapi_phystat *) 0;
+ int count = Interface_Scan_Get_Count();
+ unsigned int ulen;
+ int ret;
+
+ if (!if_ptr) {
+ if (count)
+ if_ptr =
+ (nmapi_phystat *) malloc(sizeof(nmapi_phystat) * count);
+ else
+ return (0); /* EOF */
+ }
+
+ if (saveIndex >= count)
+ return (0); /* EOF */
+
+ ulen = (unsigned int) count *sizeof(nmapi_phystat);
+ if ((ret = get_physical_stat(if_ptr, &ulen)) < 0)
+ return (0); /* EOF */
+
+ if (Retifnet)
+ *Retifnet = if_ptr[saveIndex];
+ if (Name)
+ strcpy(Name, if_ptr[saveIndex].nm_device);
+ saveIndex++;
+ if (Index)
+ *Index = saveIndex;
+ return (1); /* DONE */
+}
+
+#else /* hpux11 */
+
+int
+Interface_Scan_Next(short *Index,
+ char *Name,
+ struct ifnet *Retifnet, struct in_ifaddr *Retin_ifaddr)
+{
+ struct ifnet ifnet;
+ struct in_ifaddr *ia, in_ifaddr;
+ short has_ipaddr = 0;
+#if !STRUCT_IFNET_HAS_IF_XNAME
+ register char *cp;
+#endif
+
+ while (ifnetaddr) {
+ /*
+ * Get the "ifnet" structure and extract the device name
+ */
+ if (!NETSNMP_KLOOKUP(ifnetaddr, (char *) &ifnet, sizeof ifnet)) {
+ DEBUGMSGTL(("mibII/interfaces:Interface_Scan_Next", "klookup failed\n"));
+ break;
+ }
+#if STRUCT_IFNET_HAS_IF_XNAME
+#if defined(netbsd1) || defined(openbsd2)
+ strncpy(saveName, ifnet.if_xname, sizeof saveName);
+#else
+ if (!NETSNMP_KLOOKUP(ifnet.if_xname, (char *) saveName, sizeof saveName)) {
+ DEBUGMSGTL(("mibII/interfaces:Interface_Scan_Next", "klookup failed\n"));
+ break;
+ }
+#endif
+ saveName[sizeof(saveName) - 1] = '\0';
+#else
+ if (!NETSNMP_KLOOKUP(ifnet.if_name, (char *) saveName, sizeof saveName)) {
+ DEBUGMSGTL(("mibII/interfaces:Interface_Scan_Next", "klookup failed\n"));
+ break;
+ }
+
+ saveName[sizeof(saveName) - 1] = '\0';
+ cp = strchr(saveName, '\0');
+ string_append_int(cp, ifnet.if_unit);
+#endif
+ if (1 || strcmp(saveName, "lo0") != 0) { /* XXX */
+ /*
+ * Try to find an address for this interface
+ */
+
+#ifdef netbsd1
+ ia = (struct in_ifaddr *) ifnet.if_addrlist.tqh_first;
+#elif defined(IFADDR_SYMBOL)
+ auto_nlist(IFADDR_SYMBOL, (char *) &ia, sizeof(ia));
+#endif
+ while (ia) {
+ if (!NETSNMP_KLOOKUP(ia, (char *) &in_ifaddr, sizeof(in_ifaddr))) {
+ DEBUGMSGTL(("mibII/interfaces:Interface_Scan_Next", "klookup failed\n"));
+ break;
+ }
+ {
+#ifdef netbsd1
+#define CP(x) ((char *)(x))
+ char *cp;
+ struct sockaddr *sa;
+ cp = (CP(in_ifaddr.ia_ifa.ifa_addr) - CP(ia)) +
+ CP(&in_ifaddr);
+ sa = (struct sockaddr *) cp;
+
+ if (sa->sa_family == AF_INET)
+#endif
+ if (in_ifaddr.ia_ifp == ifnetaddr) {
+ has_ipaddr = 1; /* this IF has IP-address */
+ break;
+ }
+ }
+#ifdef netbsd1
+ ia = (struct in_ifaddr *) in_ifaddr.ia_ifa.ifa_list.
+ tqe_next;
+#else
+ ia = in_ifaddr.ia_next;
+#endif
+ }
+
+#if !defined(netbsd1) && !defined(freebsd2) && !defined(openbsd2) && !defined(STRUCT_IFNET_HAS_IF_ADDRLIST)
+ ifnet.if_addrlist = (struct ifaddr *) ia; /* WRONG DATA TYPE; ONLY A FLAG */
+#endif
+ /*
+ * ifnet.if_addrlist = (struct ifaddr *)&ia->ia_ifa;
+ *
+ * WRONG DATA TYPE; ONLY A FLAG
+ */
+
+ if (Index)
+ *Index = ++saveIndex;
+ if (Retifnet)
+ *Retifnet = ifnet;
+ if (Retin_ifaddr && has_ipaddr) /* assign the in_ifaddr only
+ * if the IF has IP-address */
+ *Retin_ifaddr = in_ifaddr;
+ if (Name)
+ strcpy(Name, saveName);
+ saveifnet = ifnet;
+ saveifnetaddr = ifnetaddr;
+ savein_ifaddr = in_ifaddr;
+ ifnetaddr = ifnet.if_next;
+
+ return (1); /* DONE */
+ }
+ ifnetaddr = ifnet.if_next;
+ }
+ return (0); /* EOF */
+}
+
+#endif /* hpux11 */
+
+#endif /* sunV3 || linux */
+
+#if defined(hpux11)
+
+static int
+Interface_Scan_By_Index(int Index, char *Name, nmapi_phystat * Retifnet)
+{
+ short i;
+
+ Interface_Scan_Init();
+ while (Interface_Scan_Next(&i, Name, Retifnet)) {
+ if (i == Index)
+ break;
+ }
+ if (i != Index)
+ return (-1); /* Error, doesn't exist */
+ return (0); /* DONE */
+}
+
+#else /* hpux11 */
+
+static int
+Interface_Scan_By_Index(int Index,
+ char *Name,
+ struct ifnet *Retifnet,
+ struct in_ifaddr *Retin_ifaddr)
+{
+ short i;
+
+ Interface_Scan_Init();
+ while (Interface_Scan_Next(&i, Name, Retifnet, Retin_ifaddr)) {
+ if (i == Index)
+ break;
+ }
+ if (i != Index)
+ return (-1); /* Error, doesn't exist */
+ return (0); /* DONE */
+}
+
+#endif /* hpux11 */
+
+static int Interface_Count = 0;
+
+#if defined(hpux11)
+
+int
+Interface_Scan_Get_Count(void)
+{
+ if (!Interface_Count) {
+ int fd;
+ struct nmparms p;
+ int val;
+ unsigned int ulen;
+ int ret;
+
+ if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) >= 0) {
+ p.objid = ID_ifNumber;
+ p.buffer = (void *) &val;
+ ulen = sizeof(int);
+ p.len = &ulen;
+ if ((ret = get_mib_info(fd, &p)) == 0)
+ Interface_Count = val;
+ close_mib(fd);
+ }
+ }
+ return (Interface_Count);
+}
+
+#else /* hpux11 */
+
+static time_t scan_time = 0;
+
+int
+Interface_Scan_Get_Count(void)
+{
+ time_t time_now = time(NULL);
+
+ if (!Interface_Count || (time_now > scan_time + 60)) {
+ scan_time = time_now;
+ Interface_Scan_Init();
+ Interface_Count = 0;
+ while (Interface_Scan_Next(NULL, NULL, NULL, NULL) != 0) {
+ Interface_Count++;
+ }
+ }
+ return (Interface_Count);
+}
+
+
+static int
+Interface_Get_Ether_By_Index(int Index, u_char * EtherAddr)
+{
+ short i;
+#if !(defined(linux) || defined(netbsd1) || defined(bsdi2) || defined(openbsd2))
+ struct arpcom arpcom;
+#else /* is linux or netbsd1 */
+ struct arpcom {
+ char ac_enaddr[6];
+ } arpcom;
+#if defined(netbsd1) || defined(bsdi2) || defined(openbsd2)
+ struct sockaddr_dl sadl;
+ struct ifaddr ifaddr;
+ u_long ifaddraddr;
+#endif
+#endif
+
+#if defined(mips) || defined(hpux) || defined(osf4) || defined(osf3) || defined(osf5)
+ memset(arpcom.ac_enaddr, 0, sizeof(arpcom.ac_enaddr));
+#else
+ memset(&arpcom.ac_enaddr, 0, sizeof(arpcom.ac_enaddr));
+#endif
+ memset(EtherAddr, 0, sizeof(arpcom.ac_enaddr));
+
+ if (saveIndex != Index) { /* Optimization! */
+
+ Interface_Scan_Init();
+
+ while (Interface_Scan_Next((short *) &i, NULL, NULL, NULL) != 0) {
+ if (i == Index)
+ break;
+ }
+ if (i != Index)
+ return (-1); /* Error, doesn't exist */
+ }
+#ifdef freebsd2
+ if (saveifnet.if_type != IFT_ETHER) {
+ return (0); /* Not an ethernet if */
+ }
+#endif
+ /*
+ * the arpcom structure is an extended ifnet structure which
+ * contains the ethernet address.
+ */
+#ifndef linux
+#if !(defined(netbsd1) || defined(bsdi2) || defined(openbsd2))
+ if (!NETSNMP_KLOOKUP(saveifnetaddr, (char *) &arpcom, sizeof arpcom)) {
+ DEBUGMSGTL(("mibII/interfaces:Interface_Get_Ether_By_Index", "klookup failed\n"));
+ return 0;
+ }
+#else /* netbsd1 or bsdi2 or openbsd2 */
+
+#if defined(netbsd1) || defined(openbsd2)
+#define if_addrlist if_addrlist.tqh_first
+#define ifa_next ifa_list.tqe_next
+#endif
+
+ ifaddraddr = (unsigned long) saveifnet.if_addrlist;
+ while (ifaddraddr) {
+ if (!NETSNMP_KLOOKUP(ifaddraddr, (char *) &ifaddr, sizeof ifaddr)) {
+ DEBUGMSGTL(("mibII/interfaces:Interface_Get_Ether_By_Index", "klookup failed\n"));
+ break;
+ }
+ if (!NETSNMP_KLOOKUP(ifaddr.ifa_addr, (char *) &sadl, sizeof sadl)) {
+ DEBUGMSGTL(("mibII/interfaces:Interface_Get_Ether_By_Index", "klookup failed\n"));
+ break;
+ }
+ if (sadl.sdl_family == AF_LINK
+ && (saveifnet.if_type == IFT_ETHER
+ || saveifnet.if_type == IFT_ISO88025
+ || saveifnet.if_type == IFT_FDDI)) {
+ memcpy(arpcom.ac_enaddr, sadl.sdl_data + sadl.sdl_nlen,
+ sizeof(arpcom.ac_enaddr));
+ break;
+ }
+ ifaddraddr = (unsigned long) ifaddr.ifa_next;
+ }
+#endif /* netbsd1 or bsdi2 or openbsd2 */
+
+#else /* linux */
+ memcpy(arpcom.ac_enaddr, saveifnetaddr->if_hwaddr, 6);
+#endif
+ if (strncmp("lo", saveName, 2) == 0) {
+ /*
+ * Loopback doesn't have a HW addr, so return 00:00:00:00:00:00
+ */
+ memset(EtherAddr, 0, sizeof(arpcom.ac_enaddr));
+
+ } else {
+
+#if defined(mips) || defined(hpux) || defined(osf4) || defined(osf3)
+ memcpy(EtherAddr, (char *) arpcom.ac_enaddr,
+ sizeof(arpcom.ac_enaddr));
+#else
+ memcpy(EtherAddr, (char *) &arpcom.ac_enaddr,
+ sizeof(arpcom.ac_enaddr));
+#endif
+
+
+ }
+ return (0); /* DONE */
+}
+
+#endif /* hpux11 */
+
+#else /* solaris2 */
+
+int
+Interface_Scan_Get_Count(void)
+{
+ int i, sd;
+
+ if ((sd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ return (0);
+ if (ioctl(sd, SIOCGIFNUM, &i) == -1) {
+ close(sd);
+ return (0);
+ } else {
+ close(sd);
+ return (i);
+ }
+}
+
+int
+Interface_Index_By_Name(char *Name, int Len)
+{
+ return (solaris2_if_nametoindex(Name, Len));
+}
+
+#endif /* solaris2 */
+
+#else /* HAVE_NET_IF_MIB_H */
+
+/*
+ * This code attempts to do the right thing for FreeBSD. Note that
+ * the statistics could be gathered through use of of the
+ * net.route.0.link.iflist.0 sysctl (which we already use to get the
+ * hardware address of the interfaces), rather than using the ifmib
+ * code, but eventually I will implement dot3Stats and we will have to
+ * use the ifmib interface. ifmib is also a much more natural way of
+ * mapping the SNMP MIB onto sysctl(3).
+ */
+
+#include <net/if.h>
+#include <net/if_dl.h>
+#include <net/if_mib.h>
+#include <net/route.h>
+
+static int header_interfaces(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod ** write);
+static int header_ifEntry(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod ** write);
+u_char *var_ifEntry(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod ** write);
+
+static char *physaddrbuf;
+static int nphysaddrs;
+struct sockaddr_dl **physaddrs;
+
+void
+init_interfaces_setup(void)
+{
+ int naddrs, ilen, bit;
+ static int mib[6]
+ = { CTL_NET, PF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, 0 };
+ char *cp;
+ size_t len;
+ struct rt_msghdr *rtm;
+ struct if_msghdr *ifm;
+ struct ifa_msghdr *ifam;
+ struct sockaddr *sa;
+
+ DEBUGMSGTL(("mibII:freebsd", "init_interfaces_setup\n"));
+
+ naddrs = 0;
+ if (physaddrs)
+ free(physaddrs);
+ if (physaddrbuf)
+ free(physaddrbuf);
+ physaddrbuf = 0;
+ physaddrs = 0;
+ nphysaddrs = 0;
+ len = 0;
+ if (sysctl(mib, 6, 0, &len, 0, 0) < 0) {
+ DEBUGMSGTL(("mibII:freebsd", "sysctl 1 < 0\n"));
+ return;
+ }
+
+ cp = physaddrbuf = malloc(len);
+ if (physaddrbuf == 0)
+ return;
+ if (sysctl(mib, 6, physaddrbuf, &len, 0, 0) < 0) {
+ free(physaddrbuf);
+ physaddrbuf = 0;
+ DEBUGMSGTL(("mibII:freebsd", "sysctl 2 < 0\n"));
+ return;
+ }
+
+ loop:
+ ilen = len;
+ cp = physaddrbuf;
+ while (ilen > 0) {
+ rtm = (struct rt_msghdr *) cp;
+ if (rtm->rtm_version != RTM_VERSION || rtm->rtm_type != RTM_IFINFO) {
+ DEBUGMSGTL(("mibII:freebsd", "version:%d/%d type:%d/%d\n",
+ rtm->rtm_version, RTM_VERSION, rtm->rtm_type, RTM_IFINFO));
+ free(physaddrs);
+ physaddrs = 0;
+ free(physaddrbuf);
+ physaddrbuf = 0;
+ }
+ ifm = (struct if_msghdr *) rtm;
+#if defined(freebsd3) || defined(freebsd4) || defined(freebsd5)
+ if (physaddrs != 0)
+ physaddrs[naddrs] = (void *) (ifm + 1);
+ naddrs++;
+#endif
+ ilen -= ifm->ifm_msglen;
+ cp += ifm->ifm_msglen;
+ rtm = (struct rt_msghdr *) cp;
+ while (ilen > 0 && rtm->rtm_type == RTM_NEWADDR) {
+#if defined(freebsd3) || defined(freebsd4) || defined(freebsd5)
+ ilen -= rtm->rtm_msglen;
+ cp += rtm->rtm_msglen;
+#else
+ int is_alias = 0;
+ ifam = (struct ifa_msghdr *) rtm;
+ ilen -= sizeof(*ifam);
+ cp += sizeof(*ifam);
+ sa = (struct sockaddr *) cp;
+#define ROUND(x) (((x) + sizeof(long) - 1) & ~sizeof(long))
+ for (bit = 1; bit && ilen > 0; bit <<= 1) {
+ if (!(ifam->ifam_addrs & bit))
+ continue;
+ ilen -= ROUND(sa->sa_len);
+ cp += ROUND(sa->sa_len);
+
+ if (bit == RTA_IFA) {
+ if (physaddrs)
+#define satosdl(sa) ((struct sockaddr_dl *)(sa))
+ physaddrs[naddrs++]
+ = satosdl(sa);
+ else
+ naddrs++;
+ }
+ sa = (struct sockaddr *) cp;
+ }
+#endif
+ rtm = (struct rt_msghdr *) cp;
+ }
+ }
+ DEBUGMSGTL(("mibII:freebsd", "found %d addrs\n", naddrs));
+ if (physaddrs) {
+ nphysaddrs = naddrs;
+ return;
+ }
+ physaddrs = malloc(naddrs * sizeof(*physaddrs));
+ if (physaddrs == 0)
+ return;
+ naddrs = 0;
+ goto loop;
+
+}
+
+static int
+get_phys_address(int iindex, char **ap, int *len)
+{
+ int i;
+ int once = 1;
+
+ do {
+ for (i = 0; i < nphysaddrs; i++) {
+ if (physaddrs[i]->sdl_index == iindex)
+ break;
+ }
+ if (i < nphysaddrs)
+ break;
+ init_interfaces_setup();
+ } while (once--);
+
+ DEBUGMSGTL(("mibII:freebsd", "get_phys_address %d/%d\n", i, nphysaddrs));
+ if (i < nphysaddrs) {
+ *ap = LLADDR(physaddrs[i]);
+ *len = physaddrs[i]->sdl_alen;
+ return 0;
+ }
+ return -1;
+}
+
+int
+Interface_Scan_Get_Count(void)
+{
+ static int count_oid[5] = { CTL_NET, PF_LINK, NETLINK_GENERIC,
+ IFMIB_SYSTEM, IFMIB_IFCOUNT
+ };
+ size_t len;
+ int count;
+
+ len = sizeof count;
+ if (sysctl(count_oid, 5, &count, &len, (void *) 0, (size_t) 0) < 0) {
+ DEBUGMSGTL(("mibII:freebsd", "Interface_Scan_Get_Count err\n"));
+ return -1;
+ }
+ DEBUGMSGTL(("mibII:freebsd", "Interface_Scan_Get_Count %d\n", count));
+ return count;
+}
+
+
+u_char *
+var_ifEntry(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ int interface;
+ static int sname[6] = { CTL_NET, PF_LINK, NETLINK_GENERIC,
+ IFMIB_IFDATA, 0, IFDATA_GENERAL
+ };
+ static struct ifmibdata ifmd;
+ size_t len;
+ char *cp;
+ conf_if_list *if_ptr = NULL;
+
+ interface = header_ifEntry(vp, name, length, exact, var_len,
+ write_method);
+ if (interface == MATCH_FAILED)
+ return NULL;
+
+ sname[4] = interface;
+ len = sizeof ifmd;
+ if (sysctl(sname, 6, &ifmd, &len, 0, 0) < 0) {
+ DEBUGMSGTL(("mibII:freebsd", "var_ifEntry sysctl err\n"));
+ return NULL;
+ }
+ /*
+ * hmmm.. where to get the interface name to check overrides?
+ *
+ * if_ptr = netsnmp_access_interface_entry_overrides_get(Name);
+ */
+
+ switch (vp->magic) {
+ case IFINDEX:
+ long_return = interface;
+ return (u_char *) & long_return;
+ case IFDESCR:
+ cp = ifmd.ifmd_name;
+ *var_len = strlen(cp);
+ return (u_char *) cp;
+ case IFTYPE:
+ if (if_ptr)
+ long_return = if_ptr->type;
+ else
+ long_return = ifmd.ifmd_data.ifi_type;
+ return (u_char *) & long_return;
+ case IFMTU:
+ long_return = (long) ifmd.ifmd_data.ifi_mtu;
+ return (u_char *) & long_return;
+ case IFSPEED:
+ if (if_ptr)
+ long_return = if_ptr->speed;
+ else
+ long_return = ifmd.ifmd_data.ifi_baudrate;
+ return (u_char *) & long_return;
+ case IFPHYSADDRESS:
+ {
+ char *cp;
+ if (get_phys_address(interface, &cp, var_len))
+ return NULL;
+ else
+ return cp;
+ }
+ case IFADMINSTATUS:
+ long_return = ifmd.ifmd_flags & IFF_UP ? 1 : 2;
+ return (u_char *) & long_return;
+ case IFOPERSTATUS:
+ long_return = ifmd.ifmd_flags & IFF_RUNNING ? 1 : 2;
+ return (u_char *) & long_return;
+ case IFLASTCHANGE:
+ if (ifmd.ifmd_data.ifi_lastchange.tv_sec == 0 &&
+ ifmd.ifmd_data.ifi_lastchange.tv_usec == 0) {
+ long_return = 0;
+ } else if (ifmd.ifmd_data.ifi_lastchange.tv_sec < starttime.tv_sec) {
+ long_return = 0;
+ } else {
+ long_return = (u_long)
+ ((ifmd.ifmd_data.ifi_lastchange.tv_sec -
+ starttime.tv_sec) * 100 +
+ ((ifmd.ifmd_data.ifi_lastchange.tv_usec -
+ starttime.tv_usec) / 10000));
+ }
+ return (u_char *) & long_return;
+ case IFINOCTETS:
+ long_return = (u_long) ifmd.ifmd_data.ifi_ibytes;
+ return (u_char *) & long_return;
+ case IFINUCASTPKTS:
+ long_return = (u_long) ifmd.ifmd_data.ifi_ipackets;
+ long_return -= (u_long) ifmd.ifmd_data.ifi_imcasts;
+ return (u_char *) & long_return;
+ case IFINNUCASTPKTS:
+ long_return = (u_long) ifmd.ifmd_data.ifi_imcasts;
+ return (u_char *) & long_return;
+ case IFINDISCARDS:
+ long_return = (u_long) ifmd.ifmd_data.ifi_iqdrops;
+ return (u_char *) & long_return;
+ case IFINERRORS:
+ long_return = ifmd.ifmd_data.ifi_ierrors;
+ return (u_char *) & long_return;
+ case IFINUNKNOWNPROTOS:
+ long_return = (u_long) ifmd.ifmd_data.ifi_noproto;
+ return (u_char *) & long_return;
+ case IFOUTOCTETS:
+ long_return = (u_long) ifmd.ifmd_data.ifi_obytes;
+ return (u_char *) & long_return;
+ case IFOUTUCASTPKTS:
+ long_return = (u_long) ifmd.ifmd_data.ifi_opackets;
+ long_return -= (u_long) ifmd.ifmd_data.ifi_omcasts;
+ return (u_char *) & long_return;
+ case IFOUTNUCASTPKTS:
+ long_return = (u_long) ifmd.ifmd_data.ifi_omcasts;
+ return (u_char *) & long_return;
+ case IFOUTDISCARDS:
+ long_return = ifmd.ifmd_snd_drops;
+ return (u_char *) & long_return;
+ case IFOUTERRORS:
+ long_return = ifmd.ifmd_data.ifi_oerrors;
+ return (u_char *) & long_return;
+ case IFOUTQLEN:
+ long_return = ifmd.ifmd_snd_len;
+ return (u_char *) & long_return;
+ case IFSPECIFIC:
+ *var_len = nullOidLen;
+ return (u_char *) nullOid;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ifEntry\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+#endif /* HAVE_NET_IF_MIB_H */
+#endif /* !USE_SYSCTL_IFLIST */
+
+#else /* WIN32 cygwin */
+#include <iphlpapi.h>
+
+WriteMethod writeIfEntry;
+long admin_status = 0;
+long oldadmin_status = 0;
+
+static int
+header_ifEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define IFENTRY_NAME_LENGTH 10
+ oid newname[MAX_OID_LEN];
+ register int ifIndex;
+ int result, count;
+ DWORD status = NO_ERROR;
+ DWORD statusRetry = NO_ERROR;
+ DWORD dwActualSize = 0;
+ PMIB_IFTABLE pIfTable = NULL;
+
+ DEBUGMSGTL(("mibII/interfaces", "var_ifEntry: "));
+ DEBUGMSGOID(("mibII/interfaces", name, *length));
+ DEBUGMSG(("mibII/interfaces", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+ /*
+ * find "next" ifIndex
+ */
+
+
+ /*
+ * query for buffer size needed
+ */
+ status = GetIfTable(pIfTable, &dwActualSize, TRUE);
+
+ if (status == ERROR_INSUFFICIENT_BUFFER) {
+ /*
+ * need more space
+ */
+ pIfTable = (PMIB_IFTABLE) malloc(dwActualSize);
+ if (pIfTable != NULL) {
+ /*
+ * Get the sorted IF table
+ */
+ GetIfTable(pIfTable, &dwActualSize, TRUE);
+ }
+ }
+ count = pIfTable->dwNumEntries;
+ for (ifIndex = 0; ifIndex < count; ifIndex++) {
+ newname[IFENTRY_NAME_LENGTH] =
+ (oid) pIfTable->table[ifIndex].dwIndex;
+ result =
+ snmp_oid_compare(name, *length, newname,
+ (int) vp->namelen + 1);
+ if ((exact && (result == 0)) || (!exact && (result < 0)))
+ break;
+ }
+ if (ifIndex > count) {
+ DEBUGMSGTL(("mibII/interfaces", "... index out of range\n"));
+ return MATCH_FAILED;
+ }
+
+
+ memcpy((char *) name, (char *) newname,
+ ((int) vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+ DEBUGMSGTL(("mibII/interfaces", "... get I/F stats "));
+ DEBUGMSGOID(("mibII/interfaces", name, *length));
+ DEBUGMSG(("mibII/interfaces", "\n"));
+
+ count = pIfTable->table[ifIndex].dwIndex;
+ free(pIfTable);
+ return count;
+}
+
+
+
+u_char *
+var_interfaces(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ if (header_generic(vp, name, length, exact, var_len, write_method) ==
+ MATCH_FAILED)
+ return NULL;
+
+ switch (vp->magic) {
+ case IFNUMBER:
+ GetNumberOfInterfaces(&long_return);
+ return (u_char *) & long_return;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_interfaces\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+u_char *
+var_ifEntry(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ int ifIndex;
+ static MIB_IFROW ifRow;
+ conf_if_list *if_ptr = NULL;
+
+ ifIndex =
+ header_ifEntry(vp, name, length, exact, var_len, write_method);
+ if (ifIndex == MATCH_FAILED)
+ return NULL;
+ /*
+ * hmmm.. where to get the interface name to check overrides?
+ *
+ * if_ptr = netsnmp_access_interface_entry_overrides_get(Name);
+ */
+
+ /*
+ * Get the If Table Row by passing index as argument
+ */
+ ifRow.dwIndex = ifIndex;
+ if (GetIfEntry(&ifRow) != NO_ERROR)
+ return NULL;
+ switch (vp->magic) {
+ case IFINDEX:
+ long_return = ifIndex;
+ return (u_char *) & long_return;
+ case IFDESCR:
+ *var_len = ifRow.dwDescrLen;
+ return (u_char *) ifRow.bDescr;
+ case IFTYPE:
+ if (if_ptr)
+ long_return = if_ptr->type;
+ else
+ long_return = ifRow.dwType;
+ return (u_char *) & long_return;
+ case IFMTU:
+ long_return = (long) ifRow.dwMtu;
+ return (u_char *) & long_return;
+ case IFSPEED:
+ if (if_ptr)
+ long_return = if_ptr->speed;
+ else
+ long_return = (long) ifRow.dwSpeed;
+ return (u_char *) & long_return;
+ case IFPHYSADDRESS:
+ *var_len = ifRow.dwPhysAddrLen;
+ memcpy(return_buf, ifRow.bPhysAddr, *var_len);
+ return (u_char *) return_buf;
+ case IFADMINSTATUS:
+ long_return = ifRow.dwAdminStatus;
+ admin_status = long_return;
+ *write_method = writeIfEntry;
+ return (u_char *) & long_return;
+ case IFOPERSTATUS:
+ long_return =
+ (MIB_IF_OPER_STATUS_OPERATIONAL == ifRow.dwOperStatus) ? 1 : 2;
+ return (u_char *) & long_return;
+ case IFLASTCHANGE:
+ long_return = 0 /* XXX not a UNIX epochal time ifRow.dwLastChange */ ;
+ return (u_char *) & long_return;
+ case IFINOCTETS:
+ long_return = ifRow.dwInOctets;
+ return (u_char *) & long_return;
+ case IFINUCASTPKTS:
+ long_return = ifRow.dwInUcastPkts;
+ return (u_char *) & long_return;
+ case IFINNUCASTPKTS:
+ long_return = ifRow.dwInNUcastPkts;
+ return (u_char *) & long_return;
+ case IFINDISCARDS:
+ long_return = ifRow.dwInDiscards;
+ return (u_char *) & long_return;
+ case IFINERRORS:
+ long_return = ifRow.dwInErrors;
+ return (u_char *) & long_return;
+ case IFINUNKNOWNPROTOS:
+ long_return = ifRow.dwInUnknownProtos;
+ return (u_char *) & long_return;
+ case IFOUTOCTETS:
+ long_return = ifRow.dwOutOctets;
+ return (u_char *) & long_return;
+ case IFOUTUCASTPKTS:
+ long_return = ifRow.dwOutUcastPkts;
+ return (u_char *) & long_return;
+ case IFOUTNUCASTPKTS:
+ long_return = ifRow.dwOutNUcastPkts;
+ return (u_char *) & long_return;
+ case IFOUTDISCARDS:
+ long_return = ifRow.dwOutDiscards;
+ return (u_char *) & long_return;
+ case IFOUTERRORS:
+ long_return = ifRow.dwOutErrors;
+ return (u_char *) & long_return;
+ case IFOUTQLEN:
+ long_return = ifRow.dwOutQLen;
+ return (u_char *) & long_return;
+ case IFSPECIFIC:
+ *var_len = nullOidLen;
+ return (u_char *) nullOid;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ifEntry\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+
+int
+writeIfEntry(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ MIB_IFROW ifEntryRow;
+ if ((char) name[9] != IFADMINSTATUS) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ switch (action) {
+ case RESERVE1: /* Check values for acceptability */
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR, "not integer\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(int)) {
+ snmp_log(LOG_ERR, "bad length\n");
+ return SNMP_ERR_WRONGLENGTH;
+ }
+
+ /*
+ * The dwAdminStatus member can be MIB_IF_ADMIN_STATUS_UP or MIB_IF_ADMIN_STATUS_DOWN
+ */
+ if (!(((int) (*var_val) == MIB_IF_ADMIN_STATUS_UP) ||
+ ((int) (*var_val) == MIB_IF_ADMIN_STATUS_DOWN))) {
+ snmp_log(LOG_ERR, "not supported admin state\n");
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+
+ case RESERVE2: /* Allocate memory and similar resources */
+ break;
+
+ case ACTION:
+ /*
+ * Save the old value, in case of UNDO
+ */
+
+ oldadmin_status = admin_status;
+ admin_status = (int) *var_val;
+ break;
+
+ case UNDO: /* Reverse the SET action and free resources */
+ admin_status = oldadmin_status;
+ break;
+
+ case COMMIT: /* Confirm the SET, performing any irreversible actions,
+ * and free resources */
+ ifEntryRow.dwIndex = (int) name[10];
+ ifEntryRow.dwAdminStatus = admin_status;
+ /*
+ * Only UP and DOWN status are supported. Thats why done in COMMIT
+ */
+ if (SetIfEntry(&ifEntryRow) != NO_ERROR) {
+ snmp_log(LOG_ERR,
+ "Error in writeIfEntry case COMMIT with index: %d & adminStatus %d\n",
+ ifEntryRow.dwIndex, ifEntryRow.dwAdminStatus);
+ return SNMP_ERR_COMMITFAILED;
+ }
+
+ case FREE: /* Free any resources allocated */
+ /*
+ * No resources have been allocated
+ */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+} /* end of writeIfEntry */
+#endif /* WIN32 cygwin */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/interfaces.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/interfaces.h
new file mode 100644
index 0000000000..d3cbb6ed79
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/interfaces.h
@@ -0,0 +1,124 @@
+/*
+ * Interfaces MIB group interface - interfaces.h
+ *
+ */
+#ifndef _MIBGROUP_INTERFACES_H
+#define _MIBGROUP_INTERFACES_H
+
+/***********************************************************************
+ * configure macros
+ */
+config_require(util_funcs)
+
+/*
+ * conflicts with the new MFD rewrite
+ */
+config_exclude(if-mib/ifTable/ifTable)
+
+#if !defined(WIN32) && !defined(cygwin)
+config_require(if-mib/data_access/interface)
+#endif
+
+config_arch_require(solaris2, kernel_sunos5)
+/*
+ * need get_address in var_route for some platforms (USE_SYSCTL_IFLIST).
+ * Not sure if that can be translated into a config_arch_require, so be
+ * indiscriminate for now.
+ */
+config_require(mibII/var_route)
+
+/***********************************************************************
+ */
+#ifndef USING_IF_MIB_IFTABLE_MODULE
+#ifdef hpux11
+#include <sys/mib.h>
+#else
+ struct in_ifaddr;
+ struct ifnet;
+#endif
+
+ int Interface_Scan_Get_Count(void);
+ int Interface_Index_By_Name(char *, int);
+ void Interface_Scan_Init(void);
+#if defined(linux) || defined(sunV3)
+ struct in_ifaddr {
+ int dummy;
+ };
+#endif
+#if defined(hpux11)
+ int Interface_Scan_Next(short *, char *, nmapi_phystat *);
+#else
+ int Interface_Scan_Next(short *, char *, struct ifnet *,
+ struct in_ifaddr *);
+#endif
+
+ void init_interfaces(void);
+ extern FindVarMethod var_interfaces;
+ extern FindVarMethod var_ifEntry;
+
+#endif /* USING_IF_MIB_IFTABLE_MODULE */
+
+#define IFNUMBER 0
+#define IFINDEX 1
+#define IFDESCR 2
+#define IFTYPE 3
+#define IFMTU 4
+#define IFSPEED 5
+#define IFPHYSADDRESS 6
+#define IFADMINSTATUS 7
+#define IFOPERSTATUS 8
+#define IFLASTCHANGE 9
+#define IFINOCTETS 10
+#define IFINUCASTPKTS 11
+#define IFINNUCASTPKTS 12
+#define IFINDISCARDS 13
+#define IFINERRORS 14
+#define IFINUNKNOWNPROTOS 15
+#define IFOUTOCTETS 16
+#define IFOUTUCASTPKTS 17
+#define IFOUTNUCASTPKTS 18
+#define IFOUTDISCARDS 19
+#define IFOUTERRORS 20
+#define IFOUTQLEN 21
+#define IFSPECIFIC 22
+
+#ifdef linux
+/*
+ * this struct ifnet is cloned from the generic type and somewhat modified.
+ * it will not work for other un*x'es...
+ */
+
+ struct ifnet {
+ char *if_name; /* name, e.g. ``en'' or ``lo'' */
+ char *if_unit; /* sub-unit for lower level driver */
+ short if_mtu; /* maximum transmission unit */
+ short if_flags; /* up/down, broadcast, etc. */
+ int if_metric; /* routing metric (external only) */
+ char if_hwaddr[6]; /* ethernet address */
+ int if_type; /* interface type: 1=generic,
+ * 28=slip, ether=6, loopback=24 */
+ u_long if_speed; /* interface speed: in bits/sec */
+
+ struct sockaddr if_addr; /* interface's address */
+ struct sockaddr ifu_broadaddr; /* broadcast address */
+ struct sockaddr ia_subnetmask; /* interface's mask */
+
+ struct ifqueue {
+ int ifq_len;
+ int ifq_drops;
+ } if_snd; /* output queue */
+ u_long if_ibytes; /* octets received on interface */
+ u_long if_ipackets; /* packets received on interface */
+ u_long if_ierrors; /* input errors on interface */
+ u_long if_iqdrops; /* input queue overruns */
+ u_long if_obytes; /* octets sent on interface */
+ u_long if_opackets; /* packets sent on interface */
+ u_long if_oerrors; /* output errors on interface */
+ u_long if_collisions; /* collisions on csma interfaces */
+ /*
+ * end statistics
+ */
+ struct ifnet *if_next;
+ };
+#endif /* linux */
+#endif /* _MIBGROUP_INTERFACES_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ip.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ip.c
new file mode 100644
index 0000000000..b9237b1cc2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ip.c
@@ -0,0 +1,957 @@
+/*
+ * IP MIB group implementation - ip.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include "mibII_common.h"
+
+#if HAVE_SYS_HASHING_H
+#include <sys/hashing.h>
+#endif
+#if HAVE_NETINET_IN_VAR_H
+#include <netinet/in_var.h>
+#endif
+#if HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"
+#include "ip.h"
+#include "ipAddr.h"
+#include "interfaces.h"
+#include "sysORTable.h"
+
+#ifndef MIB_STATS_CACHE_TIMEOUT
+#define MIB_STATS_CACHE_TIMEOUT 5
+#endif
+#ifndef IP_STATS_CACHE_TIMEOUT
+#define IP_STATS_CACHE_TIMEOUT MIB_STATS_CACHE_TIMEOUT
+#endif
+
+#if defined(HAVE_LIBPERFSTAT_H) && (defined(aix4) || defined(aix5) || defined(aix6)) && !defined(FIRST_PROTOCOL)
+#include <libperfstat.h>
+#ifdef FIRST_PROTOCOL
+perfstat_protocol_t ps_proto;
+perfstat_id_t ps_name;
+#define _USE_PERFSTAT_PROTOCOL 1
+#endif
+#endif
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+
+extern void init_routes(void);
+
+
+/*
+ * define the structure we're going to ask the agent to register our
+ * information at
+ */
+struct variable1 ipaddr_variables[] = {
+ {IPADADDR, ASN_IPADDRESS, RONLY, var_ipAddrEntry, 1, {1}},
+ {IPADIFINDEX, ASN_INTEGER, RONLY, var_ipAddrEntry, 1, {2}},
+#ifndef sunV3
+ {IPADNETMASK, ASN_IPADDRESS, RONLY, var_ipAddrEntry, 1, {3}},
+#endif
+ {IPADBCASTADDR, ASN_INTEGER, RONLY, var_ipAddrEntry, 1, {4}},
+ {IPADREASMMAX, ASN_INTEGER, RONLY, var_ipAddrEntry, 1, {5}}
+};
+
+struct variable1 iproute_variables[] = {
+ {IPROUTEDEST, ASN_IPADDRESS, RWRITE, var_ipRouteEntry, 1, {1}},
+ {IPROUTEIFINDEX, ASN_INTEGER, RWRITE, var_ipRouteEntry, 1, {2}},
+ {IPROUTEMETRIC1, ASN_INTEGER, RWRITE, var_ipRouteEntry, 1, {3}},
+ {IPROUTEMETRIC2, ASN_INTEGER, RWRITE, var_ipRouteEntry, 1, {4}},
+ {IPROUTEMETRIC3, ASN_INTEGER, RWRITE, var_ipRouteEntry, 1, {5}},
+ {IPROUTEMETRIC4, ASN_INTEGER, RWRITE, var_ipRouteEntry, 1, {6}},
+ {IPROUTENEXTHOP, ASN_IPADDRESS, RWRITE, var_ipRouteEntry, 1, {7}},
+ {IPROUTETYPE, ASN_INTEGER, RWRITE, var_ipRouteEntry, 1, {8}},
+ {IPROUTEPROTO, ASN_INTEGER, RONLY, var_ipRouteEntry, 1, {9}},
+ {IPROUTEAGE, ASN_INTEGER, RWRITE, var_ipRouteEntry, 1, {10}},
+ {IPROUTEMASK, ASN_IPADDRESS, RWRITE, var_ipRouteEntry, 1, {11}},
+ {IPROUTEMETRIC5, ASN_INTEGER, RWRITE, var_ipRouteEntry, 1, {12}},
+ {IPROUTEINFO, ASN_OBJECT_ID, RONLY, var_ipRouteEntry, 1, {13}}
+};
+
+struct variable1 ipmedia_variables[] = {
+#ifdef USING_MIBII_AT_MODULE
+#if defined (WIN32) || defined (cygwin)
+ {IPMEDIAIFINDEX, ASN_INTEGER, RWRITE, var_atEntry, 1, {1}},
+ {IPMEDIAPHYSADDRESS, ASN_OCTET_STR, RWRITE, var_atEntry, 1, {2}},
+ {IPMEDIANETADDRESS, ASN_IPADDRESS, RWRITE, var_atEntry, 1, {3}},
+ {IPMEDIATYPE, ASN_INTEGER, RWRITE, var_atEntry, 1, {4}}
+#else
+ {IPMEDIAIFINDEX, ASN_INTEGER, RONLY, var_atEntry, 1, {1}},
+ {IPMEDIAPHYSADDRESS, ASN_OCTET_STR, RONLY, var_atEntry, 1, {2}},
+ {IPMEDIANETADDRESS, ASN_IPADDRESS, RONLY, var_atEntry, 1, {3}},
+ {IPMEDIATYPE, ASN_INTEGER, RONLY, var_atEntry, 1, {4}}
+#endif
+#endif
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath, and the OID of the MIB module
+ */
+oid ip_oid[] = { SNMP_OID_MIB2, 4 };
+
+oid ipaddr_variables_oid[] = { SNMP_OID_MIB2, 4, 20, 1 };
+oid iproute_variables_oid[] = { SNMP_OID_MIB2, 4, 21, 1 };
+oid ipmedia_variables_oid[] = { SNMP_OID_MIB2, 4, 22, 1 };
+oid ip_module_oid[] = { SNMP_OID_MIB2, 4 };
+oid ip_module_oid_len = sizeof(ip_module_oid) / sizeof(oid);
+int ip_module_count = 0; /* Need to liaise with icmp.c */
+
+void
+init_ip(void)
+{
+ netsnmp_handler_registration *reginfo;
+
+ /*
+ * register ourselves with the agent as a group of scalars...
+ */
+ DEBUGMSGTL(("mibII/ip", "Initialising IP group\n"));
+ reginfo = netsnmp_create_handler_registration("ip", ip_handler,
+ ip_oid, OID_LENGTH(ip_oid), HANDLER_CAN_RONLY);
+ netsnmp_register_scalar_group(reginfo, IPFORWARDING, IPROUTEDISCARDS);
+
+ /*
+ * .... with a local cache
+ * (except for HP-UX 11, which extracts objects individually)
+ */
+#ifndef hpux11
+ netsnmp_inject_handler( reginfo,
+ netsnmp_get_cache_handler(IP_STATS_CACHE_TIMEOUT,
+ ip_load, ip_free,
+ ip_oid, OID_LENGTH(ip_oid)));
+#endif
+
+ /*
+ * register (using the old-style API) to handle the IP tables
+ */
+ REGISTER_MIB("mibII/ipaddr", ipaddr_variables,
+ variable1, ipaddr_variables_oid);
+ REGISTER_MIB("mibII/iproute", iproute_variables,
+ variable1, iproute_variables_oid);
+ REGISTER_MIB("mibII/ipmedia", ipmedia_variables,
+ variable1, ipmedia_variables_oid);
+ if (++ip_module_count == 2)
+ REGISTER_SYSOR_ENTRY(ip_module_oid,
+ "The MIB module for managing IP and ICMP implementations");
+
+
+ /*
+ * for speed optimization, we call this now to do the lookup
+ */
+#ifndef _USE_PERFSTAT_PROTOCOL
+#ifdef IPSTAT_SYMBOL
+ auto_nlist(IPSTAT_SYMBOL, 0, 0);
+#endif
+#ifdef IP_FORWARDING_SYMBOL
+ auto_nlist(IP_FORWARDING_SYMBOL, 0, 0);
+#endif
+#ifdef TCP_TTL_SYMBOL
+ auto_nlist(TCP_TTL_SYMBOL, 0, 0);
+#endif
+#ifdef MIB_IPCOUNTER_SYMBOL
+ auto_nlist(MIB_IPCOUNTER_SYMBOL, 0, 0);
+#endif
+#ifdef solaris2
+ init_kernel_sunos5();
+#endif
+#endif
+}
+
+
+ /*********************
+ *
+ * System specific data formats
+ *
+ *********************/
+
+#ifdef hpux11
+#define IP_STAT_STRUCTURE int
+#endif
+
+#ifdef linux
+#define IP_STAT_STRUCTURE struct ip_mib
+#define USES_SNMP_DESIGNED_IPSTAT
+#endif
+
+#ifdef solaris2
+#define IP_STAT_STRUCTURE mib2_ip_t
+#define USES_SNMP_DESIGNED_IPSTAT
+#endif
+
+#if defined (WIN32) || defined (cygwin)
+#include <iphlpapi.h>
+#define IP_STAT_STRUCTURE MIB_IPSTATS
+long ipForwarding;
+long oldipForwarding;
+long ipTTL, oldipTTL;
+#endif /* WIN32 cygwin */
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+#define IP_STAT_STRUCTURE struct kna
+#define USES_TRADITIONAL_IPSTAT
+#endif
+
+#if !defined(IP_STAT_STRUCTURE)
+#define IP_STAT_STRUCTURE struct ipstat
+#define USES_TRADITIONAL_IPSTAT
+#endif
+
+IP_STAT_STRUCTURE ipstat;
+
+
+
+ /*********************
+ *
+ * System independent handler
+ * (mostly)
+ *
+ *********************/
+
+
+int
+ip_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ netsnmp_request_info *request;
+ netsnmp_variable_list *requestvb;
+ long ret_value;
+ oid subid;
+ int type = ASN_COUNTER;
+
+ /*
+ * The cached data should already have been loaded by the
+ * cache handler, higher up the handler chain.
+ * But just to be safe, check this and load it manually if necessary
+ */
+#ifdef _USE_PERFSTAT_PROTOCOL
+ ip_load(NULL, NULL);
+#elif !defined(hpux11)
+ if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) {
+ netsnmp_assert(!"cache == valid"); /* always false */
+ ip_load( NULL, NULL ); /* XXX - check for failure */
+ }
+#endif
+
+
+ /*
+ *
+ *
+ */
+ DEBUGMSGTL(("mibII/ip", "Handler - mode %s\n",
+ se_find_label_in_slist("agent_mode", reqinfo->mode)));
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ for (request=requests; request; request=request->next) {
+ requestvb = request->requestvb;
+ subid = requestvb->name[OID_LENGTH(ip_oid)]; /* XXX */
+ DEBUGMSGTL(( "mibII/ip", "oid: "));
+ DEBUGMSGOID(("mibII/ip", requestvb->name,
+ requestvb->name_length));
+ DEBUGMSG(( "mibII/ip", "\n"));
+
+ switch (subid) {
+#ifdef USES_SNMP_DESIGNED_IPSTAT
+ case IPFORWARDING:
+ ret_value = ipstat.ipForwarding;
+ type = ASN_INTEGER;
+ break;
+ case IPDEFAULTTTL:
+ ret_value = ipstat.ipDefaultTTL;
+ type = ASN_INTEGER;
+ break;
+ case IPINRECEIVES:
+ ret_value = ipstat.ipInReceives;
+ break;
+ case IPINHDRERRORS:
+ ret_value = ipstat.ipInHdrErrors;
+ break;
+ case IPINADDRERRORS:
+ ret_value = ipstat.ipInAddrErrors;
+ break;
+ case IPFORWDATAGRAMS:
+ ret_value = ipstat.ipForwDatagrams;
+ break;
+ case IPINUNKNOWNPROTOS:
+ ret_value = ipstat.ipInUnknownProtos;
+ break;
+ case IPINDISCARDS:
+ ret_value = ipstat.ipInDiscards;
+ break;
+ case IPINDELIVERS:
+ ret_value = ipstat.ipInDelivers;
+ break;
+ case IPOUTREQUESTS:
+ ret_value = ipstat.ipOutRequests;
+ break;
+ case IPOUTDISCARDS:
+ ret_value = ipstat.ipOutDiscards;
+ break;
+ case IPOUTNOROUTES:
+ ret_value = ipstat.ipOutNoRoutes;
+ break;
+ case IPREASMTIMEOUT:
+ ret_value = ipstat.ipReasmTimeout;
+ type = ASN_INTEGER;
+ break;
+ case IPREASMREQDS:
+ ret_value = ipstat.ipReasmReqds;
+ break;
+ case IPREASMOKS:
+ ret_value = ipstat.ipReasmOKs;
+ break;
+ case IPREASMFAILS:
+ ret_value = ipstat.ipReasmFails;
+ break;
+ case IPFRAGOKS:
+ ret_value = ipstat.ipFragOKs;
+ break;
+ case IPFRAGFAILS:
+ ret_value = ipstat.ipFragFails;
+ break;
+ case IPFRAGCREATES:
+ ret_value = ipstat.ipFragCreates;
+ break;
+ case IPROUTEDISCARDS:
+ ret_value = ipstat.ipRoutingDiscards;
+ break;
+
+#elif defined(USES_TRADITIONAL_IPSTAT) && !defined(_USE_PERFSTAT_PROTOCOL)
+#ifdef HAVE_SYS_TCPIPSTATS_H
+ /*
+ * This actually reads statistics for *all* the groups together,
+ * so we need to isolate the IP-specific bits.
+ */
+#define ipstat ipstat.ipstat
+#endif
+ case IPFORWARDING:
+ case IPDEFAULTTTL:
+ /*
+ * Query these two individually
+ */
+ ret_value = ip_load(NULL, (void *)subid);
+ if (ret_value == -1 ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+ }
+ type = ASN_INTEGER;
+ break;
+ case IPINRECEIVES:
+ ret_value = ipstat.ips_total;
+ break;
+ case IPINHDRERRORS:
+ ret_value = ipstat.ips_badsum
+ + ipstat.ips_tooshort
+ + ipstat.ips_toosmall + ipstat.ips_badhlen + ipstat.ips_badlen;
+ break;
+ case IPINADDRERRORS:
+ ret_value = ipstat.ips_cantforward;
+ break;
+ case IPFORWDATAGRAMS:
+ ret_value = ipstat.ips_forward;
+ break;
+ case IPINUNKNOWNPROTOS:
+#if STRUCT_IPSTAT_HAS_IPS_NOPROTO
+ ret_value = ipstat.ips_noproto;
+ break;
+#else
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+#endif
+ case IPINDISCARDS:
+#if STRUCT_IPSTAT_HAS_IPS_FRAGDROPPED
+ ret_value = ipstat.ips_fragdropped; /* ?? */
+ break;
+#else
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+#endif
+ case IPINDELIVERS:
+#if STRUCT_IPSTAT_HAS_IPS_DELIVERED
+ ret_value = ipstat.ips_delivered;
+ break;
+#else
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+#endif
+ case IPOUTREQUESTS:
+#if STRUCT_IPSTAT_HAS_IPS_LOCALOUT
+ ret_value = ipstat.ips_localout;
+ break;
+#else
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+#endif
+ case IPOUTDISCARDS:
+#if STRUCT_IPSTAT_HAS_IPS_ODROPPED
+ ret_value = ipstat.ips_odropped;
+ break;
+#else
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+#endif
+ case IPOUTNOROUTES:
+ /*
+ * XXX: how to calculate this (counts dropped routes, not packets)?
+ * ipstat.ips_cantforward isn't right, as it counts packets.
+ * ipstat.ips_noroute is also incorrect.
+ */
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+ case IPREASMTIMEOUT:
+ ret_value = IPFRAGTTL;
+ type = ASN_INTEGER;
+ break;
+ case IPREASMREQDS:
+ ret_value = ipstat.ips_fragments;
+ break;
+ case IPREASMOKS:
+#if STRUCT_IPSTAT_HAS_IPS_REASSEMBLED
+ ret_value = ipstat.ips_reassembled;
+ break;
+#else
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+#endif
+ case IPREASMFAILS:
+ ret_value = ipstat.ips_fragdropped + ipstat.ips_fragtimeout;
+ break;
+ case IPFRAGOKS:
+#if STRUCT_IPSTAT_HAS_IPS_FRAGMENTED
+ ret_value = ipstat.ips_fragments;
+ break;
+#else /* XXX */
+ ret_value = ipstat.ips_fragments
+ - (ipstat.ips_fragdropped + ipstat.ips_fragtimeout);
+ break;
+#endif
+ case IPFRAGFAILS:
+#if STRUCT_IPSTAT_HAS_IPS_CANTFRAG
+ ret_value = ipstat.ips_cantfrag;
+ break;
+#else
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+#endif
+ case IPFRAGCREATES:
+#if STRUCT_IPSTAT_HAS_IPS_OFRAGMENTS
+ ret_value = ipstat.ips_ofragments;
+ break;
+#else
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+#endif
+ case IPROUTEDISCARDS:
+#if STRUCT_IPSTAT_HAS_IPS_NOROUTE
+ ret_value = ipstat.ips_noroute;
+ break;
+#else
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+#endif
+#ifdef HAVE_SYS_TCPIPSTATS_H
+#undef ipstat
+#endif
+#elif defined(hpux11)
+ case IPFORWARDING:
+ case IPDEFAULTTTL:
+ case IPREASMTIMEOUT:
+ type = ASN_INTEGER;
+ case IPINRECEIVES:
+ case IPINHDRERRORS:
+ case IPINADDRERRORS:
+ case IPFORWDATAGRAMS:
+ case IPINUNKNOWNPROTOS:
+ case IPINDISCARDS:
+ case IPINDELIVERS:
+ case IPOUTREQUESTS:
+ case IPOUTDISCARDS:
+ case IPOUTNOROUTES:
+ case IPREASMREQDS:
+ case IPREASMOKS:
+ case IPREASMFAILS:
+ case IPFRAGOKS:
+ case IPFRAGFAILS:
+ case IPFRAGCREATES:
+ case IPROUTEDISCARDS:
+ /*
+ * This is a bit of a hack, to shoehorn the HP-UX 11
+ * single-object retrieval approach into the caching
+ * architecture.
+ */
+ if (ip_load(NULL, (void*)subid) == -1 ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+ }
+ ret_value = ipstat;
+ break;
+#elif defined (WIN32) || defined (cygwin)
+ case IPFORWARDING:
+ ipForwarding = ipstat.dwForwarding;
+ ret_value = ipstat.dwForwarding;
+ type = ASN_INTEGER;
+ break;
+ case IPDEFAULTTTL:
+ ipTTL = ipstat.dwDefaultTTL;
+ ret_value = ipstat.dwDefaultTTL;
+ type = ASN_INTEGER;
+ break;
+ case IPINRECEIVES:
+ ret_value = ipstat.dwInReceives;
+ break;
+ case IPINHDRERRORS:
+ ret_value = ipstat.dwInHdrErrors;
+ break;
+ case IPINADDRERRORS:
+ ret_value = ipstat.dwInAddrErrors;
+ break;
+ case IPFORWDATAGRAMS:
+ ret_value = ipstat.dwForwDatagrams;
+ break;
+ case IPINUNKNOWNPROTOS:
+ ret_value = ipstat.dwInUnknownProtos;
+ break;
+ case IPINDISCARDS:
+ ret_value = ipstat.dwInDiscards;
+ break;
+ case IPINDELIVERS:
+ ret_value = ipstat.dwInDelivers;
+ break;
+ case IPOUTREQUESTS:
+ ret_value = ipstat.dwOutRequests;
+ break;
+ case IPOUTDISCARDS:
+ ret_value = ipstat.dwOutDiscards;
+ break;
+ case IPOUTNOROUTES:
+ ret_value = ipstat.dwOutNoRoutes;
+ break;
+ case IPREASMTIMEOUT:
+ ret_value = ipstat.dwReasmTimeout;
+ type = ASN_INTEGER;
+ break;
+ case IPREASMREQDS:
+ ret_value = ipstat.dwReasmReqds;
+ break;
+ case IPREASMOKS:
+ ret_value = ipstat.dwReasmOks;
+ break;
+ case IPREASMFAILS:
+ ret_value = ipstat.dwReasmFails;
+ break;
+ case IPFRAGOKS:
+ ret_value = ipstat.dwFragOks;
+ break;
+ case IPFRAGFAILS:
+ ret_value = ipstat.dwFragFails;
+ break;
+ case IPFRAGCREATES:
+ ret_value = ipstat.dwFragCreates;
+ break;
+ case IPROUTEDISCARDS:
+ ret_value = ipstat.dwRoutingDiscards;
+ break;
+#elif defined(_USE_PERFSTAT_PROTOCOL)
+ case IPFORWARDING:
+ ret_value = 0;
+ type = ASN_INTEGER;
+ break;
+ case IPDEFAULTTTL:
+ ret_value = 0;
+ type = ASN_INTEGER;
+ break;
+ case IPINRECEIVES:
+ ret_value = ps_proto.u.ip.ipackets;
+ break;
+ case IPINHDRERRORS:
+ case IPINADDRERRORS:
+ case IPFORWDATAGRAMS:
+ ret_value = 0;
+ break;
+ case IPINUNKNOWNPROTOS:
+ ret_value = ps_proto.u.ip.ierrors;
+ break;
+ case IPINDISCARDS:
+ ret_value = 0;
+ break;
+ case IPINDELIVERS:
+ case IPOUTREQUESTS:
+ ret_value = ps_proto.u.ip.opackets;
+ break;
+ case IPOUTDISCARDS:
+ case IPOUTNOROUTES:
+ ret_value = 0;
+ break;
+ case IPREASMTIMEOUT:
+ ret_value = 0;
+ type = ASN_INTEGER;
+ break;
+ case IPREASMREQDS:
+ case IPREASMOKS:
+ case IPREASMFAILS:
+ case IPFRAGOKS:
+ case IPFRAGFAILS:
+ case IPFRAGCREATES:
+ ret_value = 0;
+ break;
+ case IPROUTEDISCARDS:
+ ret_value = ps_proto.u.ip.oerrors;
+ break;
+#endif /* USES_SNMP_DESIGNED_IPSTAT */
+
+ case IPADDRTABLE:
+ case IPROUTETABLE:
+ case IPMEDIATABLE:
+ /*
+ * These are not actually valid scalar objects.
+ * The relevant table registrations should take precedence,
+ * so skip these three subtrees, regardless of architecture.
+ */
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+
+ }
+ snmp_set_var_typed_value(request->requestvb, (u_char)type,
+ (u_char *)&ret_value, sizeof(ret_value));
+ }
+ break;
+
+ case MODE_GETNEXT:
+ case MODE_GETBULK:
+ case MODE_SET_RESERVE1:
+ /* XXX - Windows currently supports setting this */
+ case MODE_SET_RESERVE2:
+ case MODE_SET_ACTION:
+ case MODE_SET_COMMIT:
+ case MODE_SET_FREE:
+ case MODE_SET_UNDO:
+ snmp_log(LOG_WARNING, "mibII/ip: Unsupported mode (%d)\n",
+ reqinfo->mode);
+ break;
+ default:
+ snmp_log(LOG_WARNING, "mibII/ip: Unrecognised mode (%d)\n",
+ reqinfo->mode);
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+
+#ifdef hpux11
+int
+ip_load(netsnmp_cache *cache, void *vmagic)
+{
+ int fd;
+ struct nmparms p;
+ unsigned int ulen;
+ int ret;
+ int magic = (int) vmagic;
+
+ if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) < 0) {
+ DEBUGMSGTL(("mibII/ip", "Failed to load IP object %d (hpux11)\n", magic));
+ return (-1); /* error */
+ }
+
+ switch (magic) {
+ case IPFORWARDING:
+ p.objid = ID_ipForwarding;
+ break;
+ case IPDEFAULTTTL:
+ p.objid = ID_ipDefaultTTL;
+ break;
+ case IPINRECEIVES:
+ p.objid = ID_ipInReceives;
+ break;
+ case IPINHDRERRORS:
+ p.objid = ID_ipInHdrErrors;
+ break;
+ case IPINADDRERRORS:
+ p.objid = ID_ipInAddrErrors;
+ break;
+ case IPFORWDATAGRAMS:
+ p.objid = ID_ipForwDatagrams;
+ break;
+ case IPINUNKNOWNPROTOS:
+ p.objid = ID_ipInUnknownProtos;
+ break;
+ case IPINDISCARDS:
+ p.objid = ID_ipInDiscards;
+ break;
+ case IPINDELIVERS:
+ p.objid = ID_ipInDelivers;
+ break;
+ case IPOUTREQUESTS:
+ p.objid = ID_ipOutRequests;
+ break;
+ case IPOUTDISCARDS:
+ p.objid = ID_ipOutDiscards;
+ break;
+ case IPOUTNOROUTES:
+ p.objid = ID_ipOutNoRoutes;
+ break;
+ case IPREASMTIMEOUT:
+ p.objid = ID_ipReasmTimeout;
+ break;
+ case IPREASMREQDS:
+ p.objid = ID_ipReasmReqds;
+ break;
+ case IPREASMOKS:
+ p.objid = ID_ipReasmOKs;
+ break;
+ case IPREASMFAILS:
+ p.objid = ID_ipReasmFails;
+ break;
+ case IPFRAGOKS:
+ p.objid = ID_ipFragOKs;
+ break;
+ case IPFRAGFAILS:
+ p.objid = ID_ipFragFails;
+ break;
+ case IPFRAGCREATES:
+ p.objid = ID_ipFragCreates;
+ break;
+ case IPROUTEDISCARDS:
+ p.objid = ID_ipRoutingDiscards;
+ break;
+ default:
+ ipstat = 0;
+ close_mib(fd);
+ return (0);
+ }
+
+ p.buffer = (void *)&ipstat;
+ ulen = sizeof(IP_STAT_STRUCTURE);
+ p.len = &ulen;
+ ret = get_mib_info(fd, &p);
+ close_mib(fd);
+
+ DEBUGMSGTL(("mibII/ip", "%s IP object %d (hpux11)\n",
+ (ret < 0 ? "Failed to load" : "Loaded"), magic));
+ return (ret); /* 0: ok, < 0: error */
+}
+#elif defined(linux)
+int
+ip_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ ret_value = linux_read_ip_stat(&ipstat);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/ip", "Failed to load IP Group (linux)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/ip", "Loaded IP Group (linux)\n"));
+ }
+ return ret_value;
+}
+#elif defined(solaris2)
+int
+ip_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ ret_value =
+ getMibstat(MIB_IP, &ipstat, sizeof(mib2_ip_t), GET_FIRST,
+ &Get_everything, NULL);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/ip", "Failed to load IP Group (solaris)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/ip", "Loaded IP Group (solaris)\n"));
+ }
+ return ret_value;
+}
+#elif defined (WIN32) || defined (cygwin)
+int
+ip_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ ret_value = GetIpStatistics(&ipstat);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/ip", "Failed to load IP Group (win32)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/ip", "Loaded IP Group (win32)\n"));
+ }
+ return ret_value;
+}
+#elif defined(_USE_PERFSTAT_PROTOCOL)
+int
+ip_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ strcpy(ps_name.name, "ip");
+ ret_value = perfstat_protocol(&ps_name, &ps_proto, sizeof(ps_proto), 1);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/ip", "Failed to load IP Group (AIX)\n"));
+ } else {
+ ret_value = 0;
+ DEBUGMSGTL(("mibII/ip", "Loaded IP Group (AIX)\n"));
+ }
+ return ret_value;
+}
+#elif defined(NETSNMP_CAN_USE_SYSCTL) && defined(IPCTL_STATS)
+int
+ip_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = 0;
+ int i;
+ static int sname[4] = { CTL_NET, PF_INET, IPPROTO_IP, 0 };
+ size_t len;
+ int magic = (int) vmagic;
+
+ switch (magic) {
+ case IPFORWARDING:
+ len = sizeof i;
+ sname[3] = IPCTL_FORWARDING;
+ if (sysctl(sname, 4, &i, &len, 0, 0) < 0)
+ return -1;
+ else
+ return (i ? 1 /* GATEWAY */
+ : 2 /* HOST */ );
+
+ case IPDEFAULTTTL:
+ len = sizeof i;
+ sname[3] = IPCTL_DEFTTL;
+ if (sysctl(sname, 4, &i, &len, 0, 0) < 0)
+ return -1;
+ else
+ return i;
+
+ default:
+ len = sizeof(ipstat);
+ sname[3] = IPCTL_STATS;
+ ret_value = sysctl(sname, 4, &ipstat, &len, 0, 0);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/ip", "Failed to load IP Group (sysctl)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/ip", "Loaded IP Group (sysctl)\n"));
+ }
+ return ret_value;
+ }
+}
+#elif defined(HAVE_SYS_TCPIPSTATS_H)
+int
+ip_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+ int magic = (int) vmagic;
+
+ switch (magic) {
+ case IPFORWARDING:
+ if (!auto_nlist
+ (IP_FORWARDING_SYMBOL, (char *) &ret_value, sizeof(ret_value)))
+ return -1;
+ else
+ return (ret_value ? 1 /* GATEWAY */
+ : 2 /* HOST */ );
+
+ case IPDEFAULTTTL:
+ if (!auto_nlist
+ (TCP_TTL_SYMBOL, (char *) &ret_value, sizeof(ret_value)))
+ return -1;
+ else
+ return ret_value;
+
+ default:
+ ret_value = sysmp(MP_SAGET, MPSA_TCPIPSTATS, &ipstat, sizeof ipstat);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/ip", "Failed to load IP Group (tcpipstats)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/ip", "Loaded IP Group (tcpipstats)\n"));
+ }
+ return ret_value;
+ }
+}
+#elif defined(IPSTAT_SYMBOL)
+int
+ip_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+ int magic = (int) vmagic;
+
+ switch (magic) {
+ case IPFORWARDING:
+ if (!auto_nlist
+ (IP_FORWARDING_SYMBOL, (char *) &ret_value, sizeof(ret_value)))
+ return -1;
+ else
+ return (ret_value ? 1 /* GATEWAY */
+ : 2 /* HOST */ );
+
+ case IPDEFAULTTTL:
+ if (!auto_nlist
+ (TCP_TTL_SYMBOL, (char *) &ret_value, sizeof(ret_value)))
+ return -1;
+ else
+ return ret_value;
+
+ default:
+ if (auto_nlist(IPSTAT_SYMBOL, (char *)&ipstat, sizeof(ipstat)))
+ ret_value = 0;
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/ip", "Failed to load IP Group (ipstat)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/ip", "Loaded IP Group (ipstat)\n"));
+ }
+ return ret_value;
+ }
+}
+#else /* IPSTAT_SYMBOL */
+int
+ip_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ DEBUGMSGTL(("mibII/ip", "Failed to load IP Group (null)\n"));
+ return ret_value;
+}
+#endif /* hpux11 */
+
+void
+ip_free(netsnmp_cache *cache, void *magic)
+{
+#if defined(_USE_PERFSTAT_PROTOCOL)
+ memset(&ps_proto, 0, sizeof(ps_proto));
+#else
+ memset(&ipstat, 0, sizeof(ipstat));
+#endif
+}
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ip.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ip.h
new file mode 100644
index 0000000000..57967ab5aa
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ip.h
@@ -0,0 +1,80 @@
+/*
+ * Template MIB group interface - ip.h
+ *
+ */
+
+#ifndef _MIBGROUP_IP_H
+#define _MIBGROUP_IP_H
+
+
+config_require(mibII/ifTable)
+config_require(mibII/ipAddr)
+config_require(mibII/at)
+config_require(mibII/var_route mibII/route_write)
+
+config_arch_require(solaris2, kernel_sunos5)
+config_arch_require(linux, mibII/kernel_linux)
+
+#include "var_route.h"
+#include "route_write.h"
+
+extern void init_ip(void);
+extern Netsnmp_Node_Handler ip_handler;
+extern NetsnmpCacheLoad ip_load;
+extern NetsnmpCacheFree ip_free;
+
+#ifdef USING_MIBII_AT_MODULE
+#include "at.h" /* for var_atEntry() */
+#endif
+
+
+#define IPFORWARDING 1
+#define IPDEFAULTTTL 2
+#define IPINRECEIVES 3
+#define IPINHDRERRORS 4
+#define IPINADDRERRORS 5
+#define IPFORWDATAGRAMS 6
+#define IPINUNKNOWNPROTOS 7
+#define IPINDISCARDS 8
+#define IPINDELIVERS 9
+#define IPOUTREQUESTS 10
+#define IPOUTDISCARDS 11
+#define IPOUTNOROUTES 12
+#define IPREASMTIMEOUT 13
+#define IPREASMREQDS 14
+#define IPREASMOKS 15
+#define IPREASMFAILS 16
+#define IPFRAGOKS 17
+#define IPFRAGFAILS 18
+#define IPFRAGCREATES 19
+#define IPADDRTABLE 20 /* Placeholder */
+#define IPROUTETABLE 21 /* Placeholder */
+#define IPMEDIATABLE 22 /* Placeholder */
+#define IPROUTEDISCARDS 23
+
+#define IPADADDR 1
+#define IPADIFINDEX 2
+#define IPADNETMASK 3
+#define IPADBCASTADDR 4
+#define IPADREASMMAX 5
+
+#define IPROUTEDEST 1
+#define IPROUTEIFINDEX 2
+#define IPROUTEMETRIC1 3
+#define IPROUTEMETRIC2 4
+#define IPROUTEMETRIC3 5
+#define IPROUTEMETRIC4 6
+#define IPROUTENEXTHOP 7
+#define IPROUTETYPE 8
+#define IPROUTEPROTO 9
+#define IPROUTEAGE 10
+#define IPROUTEMASK 11
+#define IPROUTEMETRIC5 12
+#define IPROUTEINFO 13
+
+/* #define IPMEDIAIFINDEX 1 */
+/* #define IPMEDIAPHYSADDRESS 2 */
+/* #define IPMEDIANETADDRESS 3 */
+/* #define IPMEDIATYPE 4 */
+
+#endif /* _MIBGROUP_IP_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipAddr.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipAddr.c
new file mode 100644
index 0000000000..bd2cf09f0f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipAddr.c
@@ -0,0 +1,1072 @@
+/*
+ * IP MIB group implementation - ip.c
+ *
+ */
+
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_UNISTD_H
+#ifdef irix6
+#define _STANDALONE 1
+#endif
+#include <unistd.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#include <sys/sysctl.h>
+#ifdef _I_DEFINED_KERNEL
+#define _KERNEL 1
+#endif
+#endif
+#if HAVE_SYS_SYSMP_H
+#include <sys/sysmp.h>
+#endif
+#if HAVE_SYS_TCPIPSTATS_H
+#include <sys/tcpipstats.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#if HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#if HAVE_SYS_HASHING_H
+#include <sys/hashing.h>
+#endif
+#if HAVE_NETINET_IN_VAR_H
+#include <netinet/in_var.h>
+#endif
+#if HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#if HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#if HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+
+#if defined(MIB_IPCOUNTER_SYMBOL) || defined(hpux11)
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif /* MIB_IPCOUNTER_SYMBOL || hpux11 */
+
+#ifdef solaris2
+#include "kernel_sunos5.h"
+#else
+#include "kernel.h"
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+#include <net-snmp/data_access/interface.h>
+
+#include "ip.h"
+#include "interfaces.h"
+#include "sysORTable.h"
+
+#ifdef cygwin
+#include <windows.h>
+#endif
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+#if !defined (WIN32) && !defined (cygwin)
+
+#if !defined(NETSNMP_CAN_USE_SYSCTL) || !defined(IPCTL_STATS)
+#ifndef solaris2
+
+#if defined(freebsd2) || defined(hpux11) || defined(linux)
+static void Address_Scan_Init(void);
+#ifdef freebsd2
+static int Address_Scan_Next(short *, struct in_ifaddr *);
+#else
+#ifdef linux
+static struct ifconf ifc;
+static int Address_Scan_Next(short *, struct ifnet *);
+#else
+static int Address_Scan_Next(short *, mib_ipAdEnt *);
+#endif
+#endif
+#endif
+
+/*
+ * var_ipAddrEntry(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+
+u_char *
+var_ipAddrEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * object identifier is of form:
+ * 1.3.6.1.2.1.4.20.1.?.A.B.C.D, where A.B.C.D is IP address.
+ * IPADDR starts at offset 10.
+ */
+ oid lowest[14];
+ oid current[14], *op;
+ u_char *cp;
+ int lowinterface = 0;
+#ifndef freebsd2
+ short interface;
+#endif
+#ifdef hpux11
+ static mib_ipAdEnt in_ifaddr, lowin_ifaddr;
+#else
+#if !defined(linux) && !defined(sunV3)
+ static struct in_ifaddr in_ifaddr, lowin_ifaddr;
+#else
+ static struct ifnet lowin_ifnet;
+#endif
+ static struct ifnet ifnet;
+#endif /* hpux11 */
+ static in_addr_t addr_ret;
+
+ /*
+ * fill in object part of name for current (less sizeof instance part)
+ */
+
+ memcpy((char *) current, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+
+#if !defined(freebsd2) && !defined(hpux11) && !defined(linux)
+ Interface_Scan_Init();
+#else
+ Address_Scan_Init();
+#endif
+ for (;;) {
+
+#if !defined(freebsd2) && !defined(hpux11) && !defined(linux)
+ if (Interface_Scan_Next(&interface, NULL, &ifnet, &in_ifaddr) == 0)
+ break;
+#ifdef STRUCT_IFNET_HAS_IF_ADDRLIST
+ if (ifnet.if_addrlist == 0)
+ continue; /* No address found for interface */
+#endif
+#else /* !freebsd2 && !hpux11 */
+#if defined(linux)
+ if (Address_Scan_Next(&interface, &ifnet) == 0)
+ break;
+#else
+ if (Address_Scan_Next(&interface, &in_ifaddr) == 0)
+ break;
+#endif
+#endif /* !freebsd2 && !hpux11 && !linux */
+
+#ifdef hpux11
+ cp = (u_char *) & in_ifaddr.Addr;
+#elif defined(linux) || defined(sunV3)
+ cp = (u_char *) & (((struct sockaddr_in *) &(ifnet.if_addr))->
+ sin_addr.s_addr);
+#else
+ cp = (u_char *) & (((struct sockaddr_in *) &(in_ifaddr.ia_addr))->
+ sin_addr.s_addr);
+#endif
+
+ op = current + 10;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ if (exact) {
+ if (snmp_oid_compare(current, 14, name, *length) == 0) {
+ memcpy((char *) lowest, (char *) current,
+ 14 * sizeof(oid));
+ lowinterface = interface;
+#if defined(linux) || defined(sunV3)
+ lowin_ifnet = ifnet;
+#else
+ lowin_ifaddr = in_ifaddr;
+#endif
+ break; /* no need to search further */
+ }
+ } else {
+ if ((snmp_oid_compare(current, 14, name, *length) > 0) &&
+ (!lowinterface
+ || (snmp_oid_compare(current, 14, lowest, 14) < 0))) {
+ /*
+ * if new one is greater than input and closer to input than
+ * previous lowest, save this one as the "next" one.
+ */
+ lowinterface = interface;
+#if defined(linux) || defined(sunV3)
+ lowin_ifnet = ifnet;
+#else
+ lowin_ifaddr = in_ifaddr;
+#endif
+ memcpy((char *) lowest, (char *) current,
+ 14 * sizeof(oid));
+ }
+ }
+ }
+
+#if defined(linux)
+ SNMP_FREE(ifc.ifc_buf);
+#endif
+
+ if (!lowinterface)
+ return (NULL);
+ memcpy((char *) name, (char *) lowest, 14 * sizeof(oid));
+ *length = 14;
+ *write_method = 0;
+ *var_len = sizeof(long_return);
+ switch (vp->magic) {
+ case IPADADDR:
+ *var_len = sizeof(addr_ret);
+#ifdef hpux11
+ addr_ret = lowin_ifaddr.Addr;
+ return (u_char *) & addr_ret;
+#elif defined(linux) || defined(sunV3)
+ return (u_char *) & ((struct sockaddr_in *) &lowin_ifnet.if_addr)->
+ sin_addr.s_addr;
+#else
+ return (u_char *) & ((struct sockaddr_in *) &lowin_ifaddr.
+ ia_addr)->sin_addr.s_addr;
+#endif
+ case IPADIFINDEX:
+ long_return = lowinterface;
+ return (u_char *) & long_return;
+ case IPADNETMASK:
+ *var_len = sizeof(addr_ret);
+#ifdef hpux11
+ addr_ret = lowin_ifaddr.NetMask;
+ return (u_char *) & addr_ret;
+#elif defined(linux)
+ return (u_char *) & ((struct sockaddr_in *) &lowin_ifnet.
+ ia_subnetmask)->sin_addr.s_addr;
+#elif !defined(sunV3)
+ addr_ret = lowin_ifaddr.ia_subnetmask;
+ return (u_char *) & addr_ret;
+#endif
+ case IPADBCASTADDR:
+#ifdef hpux11
+ long_return = lowin_ifaddr.BcastAddr & 1;
+#elif defined(linux) || defined(sunV3)
+ *var_len = sizeof(long_return);
+ long_return =
+ ntohl(((struct sockaddr_in *) &lowin_ifnet.ifu_broadaddr)->
+ sin_addr.s_addr) & 1;
+#elif defined(netbsd1)
+ long_return =
+ ((struct sockaddr_in *) &lowin_ifaddr.ia_broadaddr)->sin_addr.
+ s_addr & 1;
+#else
+ long_return =
+ ntohl(((struct sockaddr_in *) &lowin_ifaddr.ia_broadaddr)->
+ sin_addr.s_addr) & 1;
+#endif
+ return (u_char *) & long_return;
+ case IPADREASMMAX:
+#ifdef hpux11
+ long_return = lowin_ifaddr.ReasmMaxSize;
+ return (u_char *) & long_return;
+#elif defined(NETSNMP_NO_DUMMY_VALUES)
+ return NULL;
+#else
+ long_return = -1;
+ return (u_char *) & long_return;
+#endif
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipAddrEntry\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+#ifdef freebsd2
+static struct in_ifaddr *in_ifaddraddr = NULL;
+
+static void
+Address_Scan_Init(void)
+{
+ int rc = auto_nlist(IFADDR_SYMBOL, (char *) &in_ifaddraddr,
+ sizeof(in_ifaddraddr));
+ if (0 == rc)
+ in_ifaddraddr = NULL;
+}
+
+/*
+ * NB: Index is the number of the corresponding interface, not of the address
+ */
+static int
+Address_Scan_Next(Index, Retin_ifaddr)
+ short *Index;
+ struct in_ifaddr *Retin_ifaddr;
+{
+ struct in_ifaddr in_ifaddr;
+ struct ifnet ifnet, *ifnetaddr; /* NOTA: same name as another one */
+ short iindex = 1;
+
+ while (in_ifaddraddr) {
+ /*
+ * Get the "in_ifaddr" structure
+ */
+ if (!NETSNMP_KLOOKUP(in_ifaddraddr, (char *) &in_ifaddr, sizeof in_ifaddr)) {
+ DEBUGMSGTL(("mibII/ip:Address_Scan_Next", "klookup failed\n"));
+ return 0;
+ }
+
+ in_ifaddraddr = in_ifaddr.ia_next;
+
+ if (Retin_ifaddr)
+ *Retin_ifaddr = in_ifaddr;
+
+ /*
+ * Now, more difficult, find the index of the interface to which
+ * this address belongs
+ */
+
+ auto_nlist(IFNET_SYMBOL, (char *) &ifnetaddr, sizeof(ifnetaddr));
+ while (ifnetaddr && ifnetaddr != in_ifaddr.ia_ifp) {
+ if (!NETSNMP_KLOOKUP(ifnetaddr, (char *) &ifnet, sizeof ifnet)) {
+ DEBUGMSGTL(("mibII/ip:Address_Scan_Next", "klookup failed\n"));
+ return 0;
+ }
+ ifnetaddr = ifnet.if_next;
+ iindex++;
+ }
+
+ /*
+ * XXX - might not find it?
+ */
+
+ if (Index)
+ *Index = iindex;
+
+ return (1); /* DONE */
+ }
+ return (0); /* EOF */
+}
+
+#elif defined(hpux11)
+
+static int iptab_size, iptab_current;
+static mib_ipAdEnt *ip = (mib_ipAdEnt *) 0;
+
+static void
+Address_Scan_Init(void)
+{
+ int fd;
+ struct nmparms p;
+ int val;
+ unsigned int ulen;
+ int ret;
+
+ if (ip)
+ free(ip);
+ ip = (mib_ipAdEnt *) 0;
+ iptab_size = 0;
+
+ if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) >= 0) {
+ p.objid = ID_ipAddrNumEnt;
+ p.buffer = (void *) &val;
+ ulen = sizeof(int);
+ p.len = &ulen;
+ if ((ret = get_mib_info(fd, &p)) == 0)
+ iptab_size = val;
+
+ if (iptab_size > 0) {
+ ulen = (unsigned) iptab_size *sizeof(mib_ipAdEnt);
+ ip = (mib_ipAdEnt *) malloc(ulen);
+ p.objid = ID_ipAddrTable;
+ p.buffer = (void *) ip;
+ p.len = &ulen;
+ if ((ret = get_mib_info(fd, &p)) < 0)
+ iptab_size = 0;
+ }
+
+ close_mib(fd);
+ }
+
+ iptab_current = 0;
+}
+
+/*
+ * NB: Index is the number of the corresponding interface, not of the address
+ */
+static int
+Address_Scan_Next(Index, Retin_ifaddr)
+ short *Index;
+ mib_ipAdEnt *Retin_ifaddr;
+{
+ if (iptab_current < iptab_size) {
+ /*
+ * copy values
+ */
+ *Index = ip[iptab_current].IfIndex;
+ *Retin_ifaddr = ip[iptab_current];
+ /*
+ * increment to point to next entry
+ */
+ iptab_current++;
+ /*
+ * return success
+ */
+ return (1);
+ }
+
+ /*
+ * return done
+ */
+ return (0);
+}
+
+#elif defined(linux)
+static struct ifreq *ifr;
+static int ifr_counter;
+
+static void
+Address_Scan_Init(void)
+{
+ int num_interfaces = 0;
+ int fd;
+
+ /* get info about all interfaces */
+
+ ifc.ifc_len = 0;
+ SNMP_FREE(ifc.ifc_buf);
+ ifr_counter = 0;
+
+ do
+ {
+ if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ {
+ DEBUGMSGTL(("snmpd", "socket open failure in Address_Scan_Init\n"));
+ return;
+ }
+ num_interfaces += 16;
+
+ ifc.ifc_len = sizeof(struct ifreq) * num_interfaces;
+ ifc.ifc_buf = (char*) realloc(ifc.ifc_buf, ifc.ifc_len);
+
+ if (ioctl(fd, SIOCGIFCONF, &ifc) < 0)
+ {
+ ifr=NULL;
+ close(fd);
+ return;
+ }
+ close(fd);
+ }
+ while (ifc.ifc_len >= (sizeof(struct ifreq) * num_interfaces));
+
+ ifr = ifc.ifc_req;
+ close(fd);
+}
+
+/*
+ * NB: Index is the number of the corresponding interface, not of the address
+ */
+static int
+Address_Scan_Next(short *Index, struct ifnet *Retifnet)
+{
+ struct ifnet ifnet_store;
+ int fd;
+ if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ {
+ DEBUGMSGTL(("snmpd", "socket open failure in Address_Scan_Next\n"));
+ return(0);
+ }
+
+ while (ifr) {
+
+ ifnet_store.if_addr = ifr->ifr_addr;
+
+ if (Retifnet)
+ {
+ Retifnet->if_addr = ifr->ifr_addr;
+
+ if (ioctl(fd, SIOCGIFBRDADDR, ifr) < 0)
+ {
+ memset((char *) &Retifnet->ifu_broadaddr, 0, sizeof(Retifnet->ifu_broadaddr));
+ }
+ else
+ Retifnet->ifu_broadaddr = ifr->ifr_broadaddr;
+
+ ifr->ifr_addr = Retifnet->if_addr;
+ if (ioctl(fd, SIOCGIFNETMASK, ifr) < 0)
+ {
+ memset((char *) &Retifnet->ia_subnetmask, 0, sizeof(Retifnet->ia_subnetmask));
+ }
+ else
+ Retifnet->ia_subnetmask = ifr->ifr_netmask;
+
+ }
+
+ if (Index)
+ {
+ ifr->ifr_addr = ifnet_store.if_addr;
+ *Index = netsnmp_access_interface_index_find(ifr->ifr_name);
+ }
+
+ ifr++;
+ ifr_counter+=sizeof(struct ifreq);
+ if (ifr_counter >= ifc.ifc_len)
+ {
+ ifr = NULL; /* beyond the end */
+ }
+
+ close(fd);
+ return (1); /* DONE */
+ }
+ close(fd);
+ return (0); /* EOF */
+}
+
+#endif /* freebsd,hpux11,linux */
+
+#else /* solaris2 */
+
+
+static int
+IP_Cmp(void *addr, void *ep)
+{
+ if (((mib2_ipAddrEntry_t *) ep)->ipAdEntAddr == *(IpAddress *) addr)
+ return (0);
+ else
+ return (1);
+}
+
+u_char *
+var_ipAddrEntry(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * object identifier is of form:
+ * 1.3.6.1.2.1.4.20.1.?.A.B.C.D, where A.B.C.D is IP address.
+ * IPADDR starts at offset 10.
+ */
+#define IP_ADDRNAME_LENGTH 14
+#define IP_ADDRINDEX_OFF 10
+ oid lowest[IP_ADDRNAME_LENGTH];
+ oid current[IP_ADDRNAME_LENGTH], *op;
+ u_char *cp;
+ IpAddress NextAddr;
+ mib2_ipAddrEntry_t entry;
+ static mib2_ipAddrEntry_t Lowentry;
+ int Found = 0;
+ req_e req_type;
+ static in_addr_t addr_ret;
+
+ /*
+ * fill in object part of name for current (less sizeof instance part)
+ */
+
+ DEBUGMSGTL(("mibII/ip", "var_ipAddrEntry: "));
+ DEBUGMSGOID(("mibII/ip", name, *length));
+ DEBUGMSG(("mibII/ip", " %d\n", exact));
+
+ memset(&Lowentry, 0, sizeof(Lowentry));
+ memcpy((char *) current, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+ if (*length == IP_ADDRNAME_LENGTH) /* Assume that the input name is the lowest */
+ memcpy((char *) lowest, (char *) name,
+ IP_ADDRNAME_LENGTH * sizeof(oid));
+ else
+ lowest[0] = 0xff;
+ for (NextAddr = (u_long) - 1, req_type = GET_FIRST;;
+ NextAddr = entry.ipAdEntAddr, req_type = GET_NEXT) {
+ if (getMibstat
+ (MIB_IP_ADDR, &entry, sizeof(mib2_ipAddrEntry_t), req_type,
+ &IP_Cmp, &NextAddr) != 0)
+ break;
+ COPY_IPADDR(cp, (u_char *) & entry.ipAdEntAddr, op,
+ current + IP_ADDRINDEX_OFF);
+ if (exact) {
+ if (snmp_oid_compare
+ (current, IP_ADDRNAME_LENGTH, name, *length) == 0) {
+ memcpy((char *) lowest, (char *) current,
+ IP_ADDRNAME_LENGTH * sizeof(oid));
+ Lowentry = entry;
+ Found++;
+ break; /* no need to search further */
+ }
+ } else {
+ if ((snmp_oid_compare
+ (current, IP_ADDRNAME_LENGTH, name, *length) > 0)
+ && (((NextAddr == (u_long) - 1))
+ ||
+ (snmp_oid_compare
+ (current, IP_ADDRNAME_LENGTH, lowest,
+ IP_ADDRNAME_LENGTH) < 0)
+ ||
+ (snmp_oid_compare
+ (name, *length, lowest, IP_ADDRNAME_LENGTH) == 0))) {
+ /*
+ * if new one is greater than input and closer to input than
+ * previous lowest, and is not equal to it, save this one as the "next" one.
+ */
+ Lowentry = entry;
+ Found++;
+ memcpy((char *) lowest, (char *) current,
+ IP_ADDRNAME_LENGTH * sizeof(oid));
+ }
+ }
+ }
+ DEBUGMSGTL(("mibII/ip", "... Found = %d\n", Found));
+ if (Found == 0)
+ return (NULL);
+ memcpy((char *) name, (char *) lowest,
+ IP_ADDRNAME_LENGTH * sizeof(oid));
+ *length = IP_ADDRNAME_LENGTH;
+ *write_method = 0;
+ *var_len = sizeof(long_return);
+ switch (vp->magic) {
+ case IPADADDR:
+ *var_len = sizeof(addr_ret);
+ addr_ret = Lowentry.ipAdEntAddr;
+ return (u_char *) & addr_ret;
+ case IPADIFINDEX:
+#ifdef NETSNMP_INCLUDE_IFTABLE_REWRITES
+ Lowentry.ipAdEntIfIndex.o_bytes[Lowentry.ipAdEntIfIndex.o_length] = '\0';
+ long_return =
+ netsnmp_access_interface_index_find(Lowentry.
+ ipAdEntIfIndex.o_bytes);
+#else
+ long_return =
+ Interface_Index_By_Name(Lowentry.ipAdEntIfIndex.o_bytes,
+ Lowentry.ipAdEntIfIndex.o_length);
+#endif
+ return (u_char *) & long_return;
+ case IPADNETMASK:
+ *var_len = sizeof(addr_ret);
+ addr_ret = Lowentry.ipAdEntNetMask;
+ return (u_char *) & addr_ret;
+ case IPADBCASTADDR:
+ long_return = Lowentry.ipAdEntBcastAddr;
+ return (u_char *) & long_return;
+ case IPADREASMMAX:
+ long_return = Lowentry.ipAdEntReasmMaxSize;
+ return (u_char *) & long_return;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipAddrEntry\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+#endif /* solaris2 */
+
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+
+#else /* NETSNMP_CAN_USE_SYSCTL && IPCTL_STATS */
+
+/*
+ * Ideally, this would be combined with the code in interfaces.c.
+ * Even separate, it's still better than what went before.
+ */
+struct iflist {
+ int flags;
+ int index;
+ struct in_addr addr;
+ struct in_addr mask;
+ struct in_addr bcast;
+};
+static struct iflist *ifs;
+static int nifs;
+
+static void
+get_iflist(void)
+{
+ int naddrs, bit;
+ static int mib[6]
+ = { CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_IFLIST, 0 };
+ char *cp, *ifbuf;
+ size_t len;
+ struct rt_msghdr *rtm;
+ struct if_msghdr *ifm;
+ struct ifa_msghdr *ifam;
+ struct sockaddr *sa;
+ int flags;
+
+ naddrs = 0;
+ if (ifs)
+ free(ifs);
+ ifs = 0;
+ nifs = 0;
+ len = 0;
+ if (sysctl(mib, 6, 0, &len, 0, 0) < 0)
+ return;
+
+ ifbuf = malloc(len);
+ if (ifbuf == 0)
+ return;
+ if (sysctl(mib, 6, ifbuf, &len, 0, 0) < 0) {
+ syslog(LOG_WARNING, "sysctl net-route-iflist: %m");
+ free(ifbuf);
+ return;
+ }
+
+ loop:
+ cp = ifbuf;
+ while (cp < &ifbuf[len]) {
+ int gotaddr;
+
+ gotaddr = 0;
+ rtm = (struct rt_msghdr *) cp;
+ if (rtm->rtm_version != RTM_VERSION || rtm->rtm_type != RTM_IFINFO) {
+ free(ifs);
+ ifs = 0;
+ nifs = 0;
+ free(ifbuf);
+ return;
+ }
+ ifm = (struct if_msghdr *) rtm;
+ flags = ifm->ifm_flags;
+ cp += ifm->ifm_msglen;
+ rtm = (struct rt_msghdr *) cp;
+ while (cp < &ifbuf[len] && rtm->rtm_type == RTM_NEWADDR) {
+ ifam = (struct ifa_msghdr *) rtm;
+ cp += sizeof(*ifam);
+ /*
+ * from route.c
+ */
+#define ROUND(a) \
+ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+ for (bit = 1; bit && cp < &ifbuf[len]; bit <<= 1) {
+ if (!(ifam->ifam_addrs & bit))
+ continue;
+ sa = (struct sockaddr *) cp;
+ cp += ROUND(sa->sa_len);
+
+ /*
+ * Netmasks are returned as bit
+ * strings of type AF_UNSPEC. The
+ * others are pretty ok.
+ */
+ if (bit == RTA_IFA) {
+#define satosin(sa) ((struct sockaddr_in *)(sa))
+ if (ifs) {
+ ifs[naddrs].addr = satosin(sa)->sin_addr;
+ ifs[naddrs].index = ifam->ifam_index;
+ ifs[naddrs].flags = flags;
+ }
+ gotaddr = 1;
+ } else if (bit == RTA_NETMASK) {
+ if (ifs)
+ ifs[naddrs].mask = satosin(sa)->sin_addr;
+ } else if (bit == RTA_BRD) {
+ if (ifs)
+ ifs[naddrs].bcast = satosin(sa)->sin_addr;
+ }
+ }
+ if (gotaddr)
+ naddrs++;
+ cp = (char *) rtm + rtm->rtm_msglen;
+ rtm = (struct rt_msghdr *) cp;
+ }
+ }
+ if (ifs) {
+ nifs = naddrs;
+ free(ifbuf);
+ return;
+ }
+ ifs = malloc(naddrs * sizeof(*ifs));
+ if (ifs == 0) {
+ free(ifbuf);
+ return;
+ }
+ naddrs = 0;
+ goto loop;
+}
+
+u_char *
+var_ipAddrEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * object identifier is of form:
+ * 1.3.6.1.2.1.4.20.1.?.A.B.C.D, where A.B.C.D is IP address.
+ * IPADDR starts at offset 10.
+ */
+ oid lowest[14];
+ oid current[14], *op;
+ u_char *cp;
+ int lowinterface = -1;
+ int i, interface;
+ static in_addr_t addr_ret;
+
+ /*
+ * fill in object part of name for current (less sizeof instance part)
+ */
+ memcpy(current, vp->name, (int) vp->namelen * sizeof(oid));
+
+ /*
+ * Get interface table from kernel.
+ */
+ get_iflist();
+
+ for (i = 0; i < nifs; i++) {
+ op = &current[10];
+ cp = (u_char *) & ifs[i].addr;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ if (exact) {
+ if (snmp_oid_compare(current, 14, name, *length) == 0) {
+ memcpy(lowest, current, 14 * sizeof(oid));
+ lowinterface = i;
+ break; /* no need to search further */
+ }
+ } else {
+ if ((snmp_oid_compare(current, 14, name, *length) > 0) &&
+ (lowinterface < 0
+ || (snmp_oid_compare(current, 14, lowest, 14) < 0))) {
+ /*
+ * if new one is greater than input
+ * and closer to input than previous
+ * lowest, save this one as the "next"
+ * one.
+ */
+ lowinterface = i;
+ memcpy(lowest, current, 14 * sizeof(oid));
+ }
+ }
+ }
+
+ if (lowinterface < 0)
+ return NULL;
+ i = lowinterface;
+ memcpy(name, lowest, 14 * sizeof(oid));
+ *length = 14;
+ *write_method = 0;
+ *var_len = sizeof(long_return);
+ switch (vp->magic) {
+ case IPADADDR:
+ *var_len = sizeof(addr_ret);
+ addr_ret = ifs[i].addr.s_addr;
+ return (u_char *) & addr_ret;
+
+ case IPADIFINDEX:
+ long_return = ifs[i].index;
+ return (u_char *) & long_return;
+
+ case IPADNETMASK:
+ *var_len = sizeof(addr_ret);
+ addr_ret = ifs[i].mask.s_addr;
+ return (u_char *) & addr_ret;
+
+ case IPADBCASTADDR:
+ long_return = ntohl(ifs[i].bcast.s_addr) & 1;
+ return (u_char *) & long_return;
+
+ case IPADREASMMAX:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#else
+ long_return = -1;
+ return (u_char *) & long_return;
+#endif
+
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipAddrEntry\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+#endif /* NETSNMP_CAN_USE_SYSCTL && IPCTL_STATS */
+
+#else /* WIN32 cygwin */
+#include <iphlpapi.h>
+u_char *
+var_ipAddrEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * object identifier is of form:
+ * 1.3.6.1.2.1.4.20.1.?.A.B.C.D, where A.B.C.D is IP address.
+ * IPADDR starts at offset 10.
+ */
+ oid lowest[14];
+ oid current[14], *op;
+ u_char *cp;
+ int lowinterface = -1;
+ int i;
+ PMIB_IPADDRTABLE pIpAddrTable = NULL;
+ DWORD status = NO_ERROR;
+ DWORD statusRetry = NO_ERROR;
+ DWORD dwActualSize = 0;
+ static in_addr_t addr_ret;
+
+ /*
+ * fill in object part of name for current (less sizeof instance part)
+ */
+ memcpy(current, vp->name, (int) vp->namelen * sizeof(oid));
+
+ /*
+ * Get interface table from kernel.
+ */
+ status = GetIpAddrTable(pIpAddrTable, &dwActualSize, TRUE);
+ if (status == ERROR_INSUFFICIENT_BUFFER) {
+ pIpAddrTable = (PMIB_IPADDRTABLE) malloc(dwActualSize);
+ if (pIpAddrTable != NULL) {
+ statusRetry =
+ GetIpAddrTable(pIpAddrTable, &dwActualSize, TRUE);
+ }
+ }
+
+ if (statusRetry == NO_ERROR || status == NO_ERROR) {
+
+ for (i = 0; i < (int) pIpAddrTable->dwNumEntries; ++i) {
+ op = &current[10];
+ cp = (u_char *) & pIpAddrTable->table[i].dwAddr;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ if (exact) {
+ if (snmp_oid_compare(current, 14, name, *length) == 0) {
+ memcpy(lowest, current, 14 * sizeof(oid));
+ lowinterface = i;
+ break; /* no need to search further */
+ }
+ } else {
+ if (snmp_oid_compare(current, 14, name, *length) > 0) {
+
+ lowinterface = i;
+ memcpy(lowest, current, 14 * sizeof(oid));
+ break; /* Since the table is sorted, no need to search further */
+ }
+ }
+ }
+ }
+
+ if (lowinterface < 0) {
+ free(pIpAddrTable);
+ return NULL;
+ }
+ i = lowinterface;
+ memcpy(name, lowest, 14 * sizeof(oid));
+ *length = 14;
+ *write_method = 0;
+ *var_len = sizeof(long_return);
+ switch (vp->magic) {
+ case IPADADDR:
+ *var_len = sizeof(addr_ret);
+ addr_ret = pIpAddrTable->table[i].dwAddr;
+ return (u_char *) & addr_ret;
+
+ case IPADIFINDEX:
+ long_return = pIpAddrTable->table[i].dwIndex;
+ free(pIpAddrTable);
+ return (u_char *) & long_return;
+
+ case IPADNETMASK:
+ *var_len = sizeof(addr_ret);
+ addr_ret = pIpAddrTable->table[i].dwMask;
+ free(pIpAddrTable);
+ return (u_char *) & addr_ret;
+
+ case IPADBCASTADDR:
+ long_return = pIpAddrTable->table[i].dwBCastAddr;
+ free(pIpAddrTable);
+ return (u_char *) & long_return;
+
+ case IPADREASMMAX:
+ long_return = pIpAddrTable->table[i].dwReasmSize;
+ free(pIpAddrTable);
+ return (u_char *) & long_return;
+
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipAddrEntry\n",
+ vp->magic));
+ }
+ return NULL;
+}
+#endif /* WIN32 cygwin */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipAddr.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipAddr.h
new file mode 100644
index 0000000000..526a060241
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipAddr.h
@@ -0,0 +1,15 @@
+/*
+ * Template MIB group interface - ipAddr.h
+ *
+ */
+#ifndef _MIBGROUP_IPADDR_H
+#define _MIBGROUP_IPADDR_H
+
+config_require(util_funcs)
+#if !defined(NETSNMP_ENABLE_MFD_REWRITES)
+config_require(mibII/ip)
+#endif
+
+ extern FindVarMethod var_ipAddrEntry;
+
+#endif /* _MIBGROUP_IPADDR_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable.c
new file mode 100644
index 0000000000..1bb3db9ed6
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable.c
@@ -0,0 +1,1131 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate_access.conf$
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include "route_headers.h"
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "ipCidrRouteTable.h"
+#include "ipCidrRouteTable_checkfns.h"
+#include "ipCidrRouteTable_access.h"
+
+#include "var_route.h"
+
+static netsnmp_oid_stash_node *undoStorage;
+
+struct undoInfo {
+ void *ptr;
+ size_t len;
+};
+
+void
+free_undoInfo(void *vp)
+{
+ struct undoInfo *ui = (struct undoInfo *) vp;
+ if (!ui)
+ return;
+ SNMP_FREE(ui->ptr);
+ SNMP_FREE(ui);
+}
+
+/** Initialize the ipCidrRouteTable table by defining its contents and how it's structured */
+void
+initialize_table_ipCidrRouteTable(void)
+{
+ static oid ipCidrRouteTable_oid[] =
+ { 1, 3, 6, 1, 2, 1, 4, 24, 4 };
+ netsnmp_table_registration_info *table_info;
+ netsnmp_handler_registration *my_handler;
+ netsnmp_iterator_info *iinfo;
+
+ /** create the table registration information structures */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+ /** if your table is read only, it's easiest to change the
+ HANDLER_CAN_RWRITE definition below to HANDLER_CAN_RONLY */
+ my_handler = netsnmp_create_handler_registration("ipCidrRouteTable",
+ ipCidrRouteTable_handler,
+ ipCidrRouteTable_oid,
+ OID_LENGTH
+ (ipCidrRouteTable_oid),
+ HANDLER_CAN_RWRITE);
+
+ if (!my_handler || !table_info || !iinfo) {
+ snmp_log(LOG_ERR,
+ "malloc failed in initialize_table_ipCidrRouteTable");
+ return; /** Serious error. */
+ }
+
+ /***************************************************
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(table_info, ASN_IPADDRESS,
+ /** index: ipCidrRouteDest */
+ ASN_IPADDRESS,
+ /** index: ipCidrRouteMask */
+ ASN_INTEGER,
+ /** index: ipCidrRouteTos */
+ ASN_IPADDRESS,
+ /** index: ipCidrRouteNextHop */
+ 0);
+
+ /** Define the minimum and maximum accessible columns. This
+ optimizes retrival. */
+ table_info->min_column = 1;
+ table_info->max_column = 16;
+
+ /** iterator access routines */
+ iinfo->get_first_data_point = ipCidrRouteTable_get_first_data_point;
+ iinfo->get_next_data_point = ipCidrRouteTable_get_next_data_point;
+
+ /** you may wish to set these as well */
+#ifdef MAYBE_USE_THESE
+ iinfo->make_data_context = ipCidrRouteTable_context_convert_function;
+ iinfo->free_data_context = ipCidrRouteTable_data_free;
+
+ /** pick *only* one of these if you use them */
+ iinfo->free_loop_context = ipCidrRouteTable_loop_free;
+ iinfo->free_loop_context_at_end = ipCidrRouteTable_loop_free;
+#endif
+
+ /** tie the two structures together */
+ iinfo->table_reginfo = table_info;
+
+ /***************************************************
+ * registering the table with the master agent
+ */
+ DEBUGMSGTL(("initialize_table_ipCidrRouteTable",
+ "Registering table ipCidrRouteTable as a table iterator\n"));
+ netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/** Initializes the ipCidrRouteTable module */
+void
+init_ipCidrRouteTable(void)
+{
+
+ /** here we initialize all the tables we're planning on supporting */
+ initialize_table_ipCidrRouteTable();
+}
+
+
+/* globals */
+static size_t rtsize;
+static RTENTRY **rthead;
+
+netsnmp_variable_list *
+ipCidrRouteTable_set_indexes(RTENTRY *ourroute,
+ netsnmp_variable_list *put_index_data) {
+ netsnmp_variable_list *vptr;
+
+ /** ipCidrRouteDest */
+ vptr = put_index_data;
+ snmp_set_var_value(vptr, (u_char *) &((struct sockaddr_in *) (&ourroute->rt_dst))->sin_addr.s_addr,
+ sizeof(((struct sockaddr_in *) (&ourroute->rt_dst))->sin_addr));
+
+ /** ipCidrRouteMask */
+ vptr = vptr->next_variable;
+ snmp_set_var_value(vptr, (u_char *) &((struct sockaddr_in *) (&ourroute->rt_genmask))->sin_addr.s_addr,
+ sizeof(((struct sockaddr_in *) (&ourroute->rt_genmask))->sin_addr));
+
+ /** ipCidrRouteTos */
+ vptr = vptr->next_variable;
+ snmp_set_var_value(vptr, (u_char *) &ourroute->rt_tos,
+ sizeof(ourroute->rt_tos));
+ vptr = vptr->next_variable;
+
+ /** ipCidrRouteNextHop */
+ snmp_set_var_value(vptr,
+ (u_char *) &((struct sockaddr_in *) (&ourroute->rt_gateway))->sin_addr.s_addr,
+ sizeof(((struct sockaddr_in *) (&ourroute->rt_gateway))->sin_addr));
+
+ return put_index_data;
+}
+
+/** returns the first data point within the ipCidrRouteTable table data.
+
+ Set the my_loop_context variable to the first data point structure
+ of your choice (from which you can find the next one). This could
+ be anything from the first node in a linked list, to an integer
+ pointer containing the beginning of an array variable.
+
+ Set the my_data_context variable to something to be returned to
+ you later that will provide you with the data to return in a given
+ row. This could be the same pointer as what my_loop_context is
+ set to, or something different.
+
+ The put_index_data variable contains a list of snmp variable
+ bindings, one for each index in your table. Set the values of
+ each appropriately according to the data matching the first row
+ and return the put_index_data variable at the end of the function.
+*/
+netsnmp_variable_list *
+ipCidrRouteTable_get_first_data_point(void **my_loop_context,
+ void **my_data_context,
+ netsnmp_variable_list *
+ put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+ int *position;
+
+ /* we could do this with a file-static variable, but for learning
+ purposes we'll use memory allocation to demonstrate simplistic
+ freeing of a loop_context */
+ position = malloc(sizeof(position));
+ if (!position)
+ return NULL;
+
+ /* read the routing table into the route array. This function is
+ defined in var_route.c, but is sorted incorrectly for this
+ table. By using a table_iterator we don't do any sorting
+ ourselves and the table_iterator handles it all for us, so we
+ don't resort with different criteria. */
+ rthead = netsnmp_get_routes(&rtsize);
+
+ if (!rthead) {
+ snmp_log(LOG_ERR,"ipCidrRouteTable: failed to get routes\n");
+ free(position);
+ return NULL;
+ }
+
+ /* We use the positinonal count as our loop context */
+ *position = 0;
+ *my_loop_context = position;
+
+ /* our data context is the individual array element, in this case
+ it's the first. */
+ *my_data_context = rthead[*position];
+
+ /* now, save the index data into the passed in (linked list) pointer */
+ return ipCidrRouteTable_set_indexes(rthead[*position], put_index_data);
+}
+
+/** functionally the same as ipCidrRouteTable_get_first_data_point, but
+ my_loop_context has already been set to a previous value and should
+ be updated to the next in the list. For example, if it was a
+ linked list, you might want to cast it and the return
+ my_loop_context->next. The my_data_context pointer should be set
+ to something you need later and the indexes in put_index_data
+ updated again. */
+
+netsnmp_variable_list *
+ipCidrRouteTable_get_next_data_point(void **my_loop_context,
+ void **my_data_context,
+ netsnmp_variable_list *
+ put_index_data,
+ netsnmp_iterator_info *mydata)
+{
+
+ int *position = (int *) *my_loop_context;
+
+ /* make sure we were called correctly */
+ if (!position)
+ return NULL;
+
+ /* go to the next route in the list */
+ (*position)++;
+
+ /* Are we beyond the end? */
+ if (*position >= rtsize) {
+ /* End of routes. stop here by returning NULL */
+ SNMP_FREE(position);
+ *my_loop_context = NULL;
+ *my_data_context = NULL;
+ return NULL;
+ }
+
+ /* our data context is the individual array element, in this case
+ it's the first. */
+ *my_data_context = rthead[*position];
+
+ /* now, save the index data into the passed in (linked list) pointer */
+ return ipCidrRouteTable_set_indexes(rthead[*position], put_index_data);
+}
+
+/** handles requests for the ipCidrRouteTable table, if anything else
+ needs to be done */
+int
+ipCidrRouteTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ netsnmp_variable_list *var;
+
+ void *data_context;
+
+ oid *suffix;
+ size_t suffix_len;
+
+ /** column and row index encoded portion */
+ suffix = requests->requestvb->name + reginfo->rootoid_len + 1;
+ suffix_len = requests->requestvb->name_length -
+ (reginfo->rootoid_len + 1);
+
+ for (request = requests; request; request = request->next) {
+ var = request->requestvb;
+ if (request->processed != 0)
+ continue;
+
+ data_context = netsnmp_extract_iterator_context(request);
+ if (data_context == NULL) {
+ if (reqinfo->mode == MODE_GET) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ /** XXX: no row existed, if you support creation and this is a
+ set, start dealing with it here, else continue */
+ }
+
+ /** extracts the information about the table from the request */
+ table_info = netsnmp_extract_table_info(request);
+ /** table_info->colnum contains the column number requested */
+ /** table_info->indexes contains a linked list of snmp variable
+ bindings for the indexes of the table. Values in the list
+ have been set corresponding to the indexes of the
+ request */
+ if (table_info == NULL) {
+ continue;
+ }
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ switch (table_info->colnum) {
+ case COLUMN_IPCIDRROUTEDEST:
+ {
+ u_long *retval;
+ size_t retval_len = 0;
+ retval =
+ get_ipCidrRouteDest(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_IPADDRESS,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_IPCIDRROUTEMASK:
+ {
+ u_long *retval;
+ size_t retval_len = 0;
+ retval =
+ get_ipCidrRouteMask(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_IPADDRESS,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_IPCIDRROUTETOS:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ retval = get_ipCidrRouteTos(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_IPCIDRROUTENEXTHOP:
+ {
+ u_long *retval;
+ size_t retval_len = 0;
+ retval =
+ get_ipCidrRouteNextHop(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_IPADDRESS,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_IPCIDRROUTEIFINDEX:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ retval =
+ get_ipCidrRouteIfIndex(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_IPCIDRROUTETYPE:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ retval =
+ get_ipCidrRouteType(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_IPCIDRROUTEPROTO:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ retval =
+ get_ipCidrRouteProto(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_IPCIDRROUTEAGE:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ retval = get_ipCidrRouteAge(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_IPCIDRROUTEINFO:
+ {
+ oid *retval;
+ size_t retval_len = 0;
+ retval =
+ get_ipCidrRouteInfo(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_OBJECT_ID,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_IPCIDRROUTENEXTHOPAS:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ retval =
+ get_ipCidrRouteNextHopAS(data_context,
+ &retval_len);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_IPCIDRROUTEMETRIC1:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ retval =
+ get_ipCidrRouteMetric1(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_IPCIDRROUTEMETRIC2:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ retval =
+ get_ipCidrRouteMetric2(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_IPCIDRROUTEMETRIC3:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ retval =
+ get_ipCidrRouteMetric3(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_IPCIDRROUTEMETRIC4:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ retval =
+ get_ipCidrRouteMetric4(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_IPCIDRROUTEMETRIC5:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ retval =
+ get_ipCidrRouteMetric5(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ case COLUMN_IPCIDRROUTESTATUS:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ retval =
+ get_ipCidrRouteStatus(data_context, &retval_len);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (const u_char *) retval,
+ retval_len);
+ }
+ break;
+
+ default:
+ /** We shouldn't get here */
+ snmp_log(LOG_ERR,
+ "problem encountered in ipCidrRouteTable_handler: unknown column\n");
+ }
+ break;
+
+ case MODE_SET_RESERVE1:
+ /** mib2cXXX: clear out old undo info if we have any. Remove if
+ table_iterator becomes un-serialized */
+ netsnmp_oid_stash_free(&undoStorage, free_undoInfo);
+
+ switch (table_info->colnum) {
+ case COLUMN_IPCIDRROUTEIFINDEX:
+ {
+ int ret =
+ check_ipCidrRouteIfIndex(request->requestvb->type,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret != 0) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTETYPE:
+ {
+ int ret =
+ check_ipCidrRouteType(request->requestvb->type,
+ (long *) request->requestvb->
+ val.string,
+ request->requestvb->val_len);
+ if (ret != 0) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEINFO:
+ {
+ int ret =
+ check_ipCidrRouteInfo(request->requestvb->type,
+ (oid *) request->requestvb->
+ val.string,
+ request->requestvb->val_len);
+ if (ret != 0) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTENEXTHOPAS:
+ {
+ int ret =
+ check_ipCidrRouteNextHopAS(request->requestvb->
+ type,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret != 0) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC1:
+ {
+ int ret =
+ check_ipCidrRouteMetric1(request->requestvb->type,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret != 0) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC2:
+ {
+ int ret =
+ check_ipCidrRouteMetric2(request->requestvb->type,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret != 0) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC3:
+ {
+ int ret =
+ check_ipCidrRouteMetric3(request->requestvb->type,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret != 0) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC4:
+ {
+ int ret =
+ check_ipCidrRouteMetric4(request->requestvb->type,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret != 0) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC5:
+ {
+ int ret =
+ check_ipCidrRouteMetric5(request->requestvb->type,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret != 0) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTESTATUS:
+ {
+ int ret =
+ check_ipCidrRouteStatus(request->requestvb->type,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret != 0) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_NOTWRITABLE);
+ break;
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ /** save a variable copy */
+ switch (table_info->colnum) {
+ case COLUMN_IPCIDRROUTEIFINDEX:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ struct undoInfo *ui;
+ retval =
+ get_ipCidrRouteIfIndex(data_context, &retval_len);
+ if (retval) {
+ ui = SNMP_MALLOC_STRUCT(undoInfo);
+ ui->len = retval_len;
+ memdup((u_char **) & ui->ptr,
+ (u_char *) retval, ui->len);
+ netsnmp_oid_stash_add_data(&undoStorage,
+ suffix, suffix_len, ui);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTETYPE:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ struct undoInfo *ui;
+ retval =
+ get_ipCidrRouteType(data_context, &retval_len);
+ if (retval) {
+ ui = SNMP_MALLOC_STRUCT(undoInfo);
+ ui->len = retval_len;
+ memdup((u_char **) & ui->ptr,
+ (u_char *) retval, ui->len);
+ netsnmp_oid_stash_add_data(&undoStorage,
+ suffix, suffix_len, ui);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEINFO:
+ {
+ oid *retval;
+ size_t retval_len = 0;
+ struct undoInfo *ui;
+ retval =
+ get_ipCidrRouteInfo(data_context, &retval_len);
+ if (retval) {
+ ui = SNMP_MALLOC_STRUCT(undoInfo);
+ ui->len = retval_len;
+ memdup((u_char **) & ui->ptr,
+ (u_char *) retval, ui->len);
+ netsnmp_oid_stash_add_data(&undoStorage,
+ suffix, suffix_len, ui);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTENEXTHOPAS:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ struct undoInfo *ui;
+ retval =
+ get_ipCidrRouteNextHopAS(data_context,
+ &retval_len);
+ if (retval) {
+ ui = SNMP_MALLOC_STRUCT(undoInfo);
+ ui->len = retval_len;
+ memdup((u_char **) & ui->ptr,
+ (u_char *) retval, ui->len);
+ netsnmp_oid_stash_add_data(&undoStorage,
+ suffix, suffix_len, ui);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC1:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ struct undoInfo *ui;
+ retval =
+ get_ipCidrRouteMetric1(data_context, &retval_len);
+ if (retval) {
+ ui = SNMP_MALLOC_STRUCT(undoInfo);
+ ui->len = retval_len;
+ memdup((u_char **) & ui->ptr,
+ (u_char *) retval, ui->len);
+ netsnmp_oid_stash_add_data(&undoStorage,
+ suffix, suffix_len, ui);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC2:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ struct undoInfo *ui;
+ retval =
+ get_ipCidrRouteMetric2(data_context, &retval_len);
+ if (retval) {
+ ui = SNMP_MALLOC_STRUCT(undoInfo);
+ ui->len = retval_len;
+ memdup((u_char **) & ui->ptr,
+ (u_char *) retval, ui->len);
+ netsnmp_oid_stash_add_data(&undoStorage,
+ suffix, suffix_len, ui);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC3:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ struct undoInfo *ui;
+ retval =
+ get_ipCidrRouteMetric3(data_context, &retval_len);
+ if (retval) {
+ ui = SNMP_MALLOC_STRUCT(undoInfo);
+ ui->len = retval_len;
+ memdup((u_char **) & ui->ptr,
+ (u_char *) retval, ui->len);
+ netsnmp_oid_stash_add_data(&undoStorage,
+ suffix, suffix_len, ui);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC4:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ struct undoInfo *ui;
+ retval =
+ get_ipCidrRouteMetric4(data_context, &retval_len);
+ if (retval) {
+ ui = SNMP_MALLOC_STRUCT(undoInfo);
+ ui->len = retval_len;
+ memdup((u_char **) & ui->ptr,
+ (u_char *) retval, ui->len);
+ netsnmp_oid_stash_add_data(&undoStorage,
+ suffix, suffix_len, ui);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC5:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ struct undoInfo *ui;
+ retval =
+ get_ipCidrRouteMetric5(data_context, &retval_len);
+ if (retval) {
+ ui = SNMP_MALLOC_STRUCT(undoInfo);
+ ui->len = retval_len;
+ memdup((u_char **) & ui->ptr,
+ (u_char *) retval, ui->len);
+ netsnmp_oid_stash_add_data(&undoStorage,
+ suffix, suffix_len, ui);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTESTATUS:
+ {
+ long *retval;
+ size_t retval_len = 0;
+ struct undoInfo *ui;
+ retval =
+ get_ipCidrRouteStatus(data_context, &retval_len);
+ if (retval) {
+ ui = SNMP_MALLOC_STRUCT(undoInfo);
+ ui->len = retval_len;
+ memdup((u_char **) & ui->ptr,
+ (u_char *) retval, ui->len);
+ netsnmp_oid_stash_add_data(&undoStorage,
+ suffix, suffix_len, ui);
+ }
+ }
+ break;
+ }
+ break;
+
+ case MODE_SET_FREE:
+ /** Forget undo data, if exists */
+ netsnmp_oid_stash_free(&undoStorage, free_undoInfo);
+ break;
+
+ case MODE_SET_ACTION:
+ /** save a variable copy */
+ switch (table_info->colnum) {
+ case COLUMN_IPCIDRROUTEIFINDEX:
+ {
+ int ret =
+ set_ipCidrRouteIfIndex(data_context,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTETYPE:
+ {
+ int ret = set_ipCidrRouteType(data_context,
+ (long *)
+ request->
+ requestvb->
+ val.string,
+ request->
+ requestvb->
+ val_len);
+ if (ret) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEINFO:
+ {
+ int ret = set_ipCidrRouteInfo(data_context,
+ (oid *)
+ request->
+ requestvb->
+ val.string,
+ request->
+ requestvb->
+ val_len);
+ if (ret) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTENEXTHOPAS:
+ {
+ int ret =
+ set_ipCidrRouteNextHopAS(data_context,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC1:
+ {
+ int ret =
+ set_ipCidrRouteMetric1(data_context,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC2:
+ {
+ int ret =
+ set_ipCidrRouteMetric2(data_context,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC3:
+ {
+ int ret =
+ set_ipCidrRouteMetric3(data_context,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC4:
+ {
+ int ret =
+ set_ipCidrRouteMetric4(data_context,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC5:
+ {
+ int ret =
+ set_ipCidrRouteMetric5(data_context,
+ (long *) request->
+ requestvb->val.string,
+ request->requestvb->
+ val_len);
+ if (ret) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTESTATUS:
+ {
+ int ret =
+ set_ipCidrRouteStatus(data_context,
+ (long *) request->requestvb->
+ val.string,
+ request->requestvb->val_len);
+ if (ret) {
+ netsnmp_set_request_error(reqinfo, requests, ret);
+ }
+ }
+ break;
+ }
+ break;
+
+ case MODE_SET_COMMIT:
+ /** answers were all good. Forget undo data */
+ netsnmp_oid_stash_free(&undoStorage, free_undoInfo);
+ /** mib2cXXX: call commit hook */
+ break;
+
+ case MODE_SET_UNDO:
+ /** save a variable copy */
+ switch (table_info->colnum) {
+ case COLUMN_IPCIDRROUTEIFINDEX:
+ {
+ int retval;
+ struct undoInfo *ui;
+ ui = netsnmp_oid_stash_get_data(undoStorage,
+ suffix, suffix_len);
+ retval =
+ set_ipCidrRouteIfIndex(data_context, ui->ptr,
+ ui->len);
+ if (retval) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_UNDOFAILED);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTETYPE:
+ {
+ int retval;
+ struct undoInfo *ui;
+ ui = netsnmp_oid_stash_get_data(undoStorage,
+ suffix, suffix_len);
+ retval =
+ set_ipCidrRouteType(data_context, ui->ptr,
+ ui->len);
+ if (retval) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_UNDOFAILED);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEINFO:
+ {
+ int retval;
+ struct undoInfo *ui;
+ ui = netsnmp_oid_stash_get_data(undoStorage,
+ suffix, suffix_len);
+ retval =
+ set_ipCidrRouteInfo(data_context, ui->ptr,
+ ui->len);
+ if (retval) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_UNDOFAILED);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTENEXTHOPAS:
+ {
+ int retval;
+ struct undoInfo *ui;
+ ui = netsnmp_oid_stash_get_data(undoStorage,
+ suffix, suffix_len);
+ retval =
+ set_ipCidrRouteNextHopAS(data_context, ui->ptr,
+ ui->len);
+ if (retval) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_UNDOFAILED);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC1:
+ {
+ int retval;
+ struct undoInfo *ui;
+ ui = netsnmp_oid_stash_get_data(undoStorage,
+ suffix, suffix_len);
+ retval =
+ set_ipCidrRouteMetric1(data_context, ui->ptr,
+ ui->len);
+ if (retval) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_UNDOFAILED);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC2:
+ {
+ int retval;
+ struct undoInfo *ui;
+ ui = netsnmp_oid_stash_get_data(undoStorage,
+ suffix, suffix_len);
+ retval =
+ set_ipCidrRouteMetric2(data_context, ui->ptr,
+ ui->len);
+ if (retval) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_UNDOFAILED);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC3:
+ {
+ int retval;
+ struct undoInfo *ui;
+ ui = netsnmp_oid_stash_get_data(undoStorage,
+ suffix, suffix_len);
+ retval =
+ set_ipCidrRouteMetric3(data_context, ui->ptr,
+ ui->len);
+ if (retval) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_UNDOFAILED);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC4:
+ {
+ int retval;
+ struct undoInfo *ui;
+ ui = netsnmp_oid_stash_get_data(undoStorage,
+ suffix, suffix_len);
+ retval =
+ set_ipCidrRouteMetric4(data_context, ui->ptr,
+ ui->len);
+ if (retval) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_UNDOFAILED);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTEMETRIC5:
+ {
+ int retval;
+ struct undoInfo *ui;
+ ui = netsnmp_oid_stash_get_data(undoStorage,
+ suffix, suffix_len);
+ retval =
+ set_ipCidrRouteMetric5(data_context, ui->ptr,
+ ui->len);
+ if (retval) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_UNDOFAILED);
+ }
+ }
+ break;
+ case COLUMN_IPCIDRROUTESTATUS:
+ {
+ int retval;
+ struct undoInfo *ui;
+ ui = netsnmp_oid_stash_get_data(undoStorage,
+ suffix, suffix_len);
+ retval =
+ set_ipCidrRouteStatus(data_context, ui->ptr,
+ ui->len);
+ if (retval) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_UNDOFAILED);
+ }
+ }
+ break;
+ }
+ /** mib2cXXX: remove cache! hard to do when serialized, however */
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "problem encountered in ipCidrRouteTable_handler: unsupported mode\n");
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable.h
new file mode 100644
index 0000000000..3c508af869
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable.h
@@ -0,0 +1,34 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.iterate_access.conf
+ */
+#ifndef IPCIDRROUTETABLE_H
+#define IPCIDRROUTETABLE_H
+
+/** other required module components */
+config_require(mibII/ipCidrRouteTable_access)
+config_require(mibII/ipCidrRouteTable_checkfns)
+config_add_mib(IP-FORWARD-MIB)
+config_add_mib(IANA-RTPROTO-MIB)
+
+/*
+ * function declarations
+ */
+void init_ipCidrRouteTable(void);
+void initialize_table_ipCidrRouteTable(void);
+Netsnmp_Node_Handler ipCidrRouteTable_handler;
+
+Netsnmp_First_Data_Point ipCidrRouteTable_get_first_data_point;
+Netsnmp_Next_Data_Point ipCidrRouteTable_get_next_data_point;
+
+/*
+ * column number definitions for table ipCidrRouteTable
+ */
+#include "ipCidrRouteTable_columns.h"
+
+/*
+ * enum definions
+ */
+#include "ipCidrRouteTable_enums.h"
+
+#endif /** IPCIDRROUTETABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_access.c
new file mode 100644
index 0000000000..0a91a50c56
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_access.c
@@ -0,0 +1,258 @@
+
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.access_functions.conf$
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include "route_headers.h"
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "ipCidrRouteTable_access.h"
+#include "ipCidrRouteTable_enums.h"
+
+/*
+ * NOTE:
+ * - these GET routines MUST return freshly malloced data and must not
+ * return a pointer which is still in use somewhere else.
+ * - these SET routines must copy the incoming data and can not take
+ * ownership of the memory passed in by the val pointer.
+ */
+
+/** a global static we'll make use of a lot to map to the right
+ datatype to return (which for SNMP integer's is always a long). */
+static u_long long_ret;
+
+
+/*
+ * User-defined data access functions for data in table ipCidrRouteTable
+ */
+
+u_long *
+get_ipCidrRouteDest(void *data_context, size_t * ret_len)
+{
+ RTENTRY *ourroute = (RTENTRY *) data_context;
+ long_ret = ((struct sockaddr_in *) (&ourroute->rt_dst))->sin_addr.s_addr;
+ *ret_len = sizeof(long_ret);
+ return &long_ret;
+}
+
+u_long *
+get_ipCidrRouteMask(void *data_context, size_t * ret_len)
+{
+ RTENTRY *ourroute = (RTENTRY *) data_context;
+ long_ret = ((struct sockaddr_in *) (&ourroute->rt_genmask))->sin_addr.s_addr;
+ *ret_len = sizeof(long_ret);
+ return &long_ret;
+}
+
+long *
+get_ipCidrRouteTos(void *data_context, size_t * ret_len)
+{
+ RTENTRY *ourroute = (RTENTRY *) data_context;
+ long_ret = ourroute->rt_tos;
+ *ret_len = sizeof(long_ret);
+ return &long_ret;
+}
+
+u_long *
+get_ipCidrRouteNextHop(void *data_context, size_t * ret_len)
+{
+ RTENTRY *ourroute = (RTENTRY *) data_context;
+ long_ret = ((struct sockaddr_in *) (&ourroute->rt_gateway))->sin_addr.s_addr;
+ *ret_len = sizeof(long_ret);
+ return &long_ret;
+}
+
+long *
+get_ipCidrRouteIfIndex(void *data_context, size_t * ret_len)
+{
+ RTENTRY *ourroute = (RTENTRY *) data_context;
+ long_ret = ourroute->rt_unit;
+ *ret_len = sizeof(long_ret);;
+ return &long_ret;
+}
+
+int
+set_ipCidrRouteIfIndex(void *data_context, long *val, size_t val_len)
+{
+ return SNMP_ERR_NOERROR; /** XXX: change if an error occurs */
+}
+
+long *
+get_ipCidrRouteType(void *data_context, size_t * ret_len)
+{
+ RTENTRY *ourroute = (RTENTRY *) data_context;
+
+ if (ourroute->rt_flags & RTF_UP) {
+ if (ourroute->rt_flags & RTF_GATEWAY) {
+ long_ret = IPCIDRROUTETYPE_REMOTE;
+ } else {
+ long_ret = IPCIDRROUTETYPE_LOCAL;
+ }
+ } else {
+ long_ret = IPCIDRROUTETYPE_REJECT;
+ }
+ *ret_len = sizeof(long_ret);
+ return &long_ret;
+
+}
+
+int
+set_ipCidrRouteType(void *data_context, long *val, size_t val_len)
+{
+ return SNMP_ERR_NOERROR; /** XXX: change if an error occurs */
+}
+
+long *
+get_ipCidrRouteProto(void *data_context, size_t * ret_len)
+{
+ RTENTRY *ourroute = (RTENTRY *) data_context;
+ /* XXX: this is wacked */
+ long_ret = (ourroute->rt_flags & RTF_DYNAMIC)
+ ? IPCIDRROUTEPROTO_ICMP : IPCIDRROUTEPROTO_LOCAL;
+ *ret_len = sizeof(long_ret);
+ return &long_ret;
+}
+
+long *
+get_ipCidrRouteAge(void *data_context, size_t * ret_len)
+{
+ long_ret = 0; /* we don't know, and defval = 0 */
+ *ret_len = sizeof(long_ret);
+ return &long_ret;
+}
+
+oid *
+get_ipCidrRouteInfo(void *data_context, size_t * ret_len)
+{
+ static oid zerodotzero[2] = { 0, 0 };
+ *ret_len = sizeof(zerodotzero);
+ return zerodotzero;
+}
+
+int
+set_ipCidrRouteInfo(void *data_context, oid * val, size_t val_len)
+{
+ return SNMP_ERR_NOERROR; /** XXX: change if an error occurs */
+}
+
+/** XXX: return a data pointer to the data for the ipCidrRouteNextHopAS column and set
+ ret_len to its proper size in bytes. */
+long *
+get_ipCidrRouteNextHopAS(void *data_context, size_t * ret_len)
+{
+ long_ret = 0; /* we don't know, and defval = 0 */
+ *ret_len = sizeof(long_ret);
+ return &long_ret;
+}
+
+int
+set_ipCidrRouteNextHopAS(void *data_context, long *val, size_t val_len)
+{
+ return SNMP_ERR_NOERROR; /** XXX: change if an error occurs */
+}
+
+long *
+get_ipCidrRouteMetric1(void *data_context, size_t * ret_len)
+{
+ RTENTRY *ourroute = (RTENTRY *) data_context;
+ long_ret = ourroute->rt_metric;
+ *ret_len = sizeof(long_ret);
+ return &long_ret;
+}
+
+int
+set_ipCidrRouteMetric1(void *data_context, long *val, size_t val_len)
+{
+ return SNMP_ERR_NOERROR; /** XXX: change if an error occurs */
+}
+
+long *
+get_ipCidrRouteMetric2(void *data_context, size_t * ret_len)
+{
+ long_ret = -1; /* unused */
+ *ret_len = sizeof(long_ret);
+ return &long_ret;
+}
+
+ /** XXX: Set the value of the ipCidrRouteMetric2 column and return
+ SNMPERR_SUCCESS on SNMPERR_GENERR on failure. */
+int
+set_ipCidrRouteMetric2(void *data_context, long *val, size_t val_len)
+{
+ return SNMP_ERR_NOERROR; /** XXX: change if an error occurs */
+}
+
+/** XXX: return a data pointer to the data for the ipCidrRouteMetric3 column and set
+ ret_len to its proper size in bytes. */
+long *
+get_ipCidrRouteMetric3(void *data_context, size_t * ret_len)
+{
+ long_ret = -1; /* unused */
+ *ret_len = sizeof(long_ret);
+ return &long_ret;
+}
+
+ /** XXX: Set the value of the ipCidrRouteMetric3 column and return
+ SNMPERR_SUCCESS on SNMPERR_GENERR on failure. */
+int
+set_ipCidrRouteMetric3(void *data_context, long *val, size_t val_len)
+{
+ return SNMP_ERR_NOERROR; /** XXX: change if an error occurs */
+}
+
+/** XXX: return a data pointer to the data for the ipCidrRouteMetric4 column and set
+ ret_len to its proper size in bytes. */
+long *
+get_ipCidrRouteMetric4(void *data_context, size_t * ret_len)
+{
+ long_ret = -1; /* unused */
+ *ret_len = sizeof(long_ret);
+ return &long_ret;
+}
+
+ /** XXX: Set the value of the ipCidrRouteMetric4 column and return
+ SNMPERR_SUCCESS on SNMPERR_GENERR on failure. */
+int
+set_ipCidrRouteMetric4(void *data_context, long *val, size_t val_len)
+{
+ return SNMP_ERR_NOERROR; /** XXX: change if an error occurs */
+}
+
+/** XXX: return a data pointer to the data for the ipCidrRouteMetric5 column and set
+ ret_len to its proper size in bytes. */
+long *
+get_ipCidrRouteMetric5(void *data_context, size_t * ret_len)
+{
+ long_ret = -1; /* unused */
+ *ret_len = sizeof(long_ret);
+ return &long_ret;
+}
+
+ /** XXX: Set the value of the ipCidrRouteMetric5 column and return
+ SNMPERR_SUCCESS on SNMPERR_GENERR on failure. */
+int
+set_ipCidrRouteMetric5(void *data_context, long *val, size_t val_len)
+{
+ return SNMP_ERR_NOERROR; /** XXX: change if an error occurs */
+}
+
+/** XXX: return a data pointer to the data for the ipCidrRouteStatus column and set
+ ret_len to its proper size in bytes. */
+long *
+get_ipCidrRouteStatus(void *data_context, size_t * ret_len)
+{
+ /* the only value supported for real routes */
+ long_ret = IPCIDRROUTESTATUS_ACTIVE;
+ *ret_len = sizeof(long_ret);
+ return &long_ret;
+}
+
+ /** XXX: Set the value of the ipCidrRouteStatus column and return
+ SNMPERR_SUCCESS on SNMPERR_GENERR on failure. */
+int
+set_ipCidrRouteStatus(void *data_context, long *val, size_t val_len)
+{
+ return SNMP_ERR_NOERROR; /** XXX: change if an error occurs */
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_access.h
new file mode 100644
index 0000000000..1ce2c1d493
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_access.h
@@ -0,0 +1,57 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.access_functions.conf $
+ */
+#ifndef IPCIDRROUTETABLE_ACCESS_H
+#define IPCIDRROUTETABLE_ACCESS_H
+
+/*
+ * User-defined data access functions for data in table ipCidrRouteTable
+ */
+u_long *get_ipCidrRouteDest(void *data_context, size_t * ret_len);
+u_long *get_ipCidrRouteMask(void *data_context, size_t * ret_len);
+long *get_ipCidrRouteTos(void *data_context, size_t * ret_len);
+u_long *get_ipCidrRouteNextHop(void *data_context,
+ size_t * ret_len);
+long *get_ipCidrRouteIfIndex(void *data_context,
+ size_t * ret_len);
+int set_ipCidrRouteIfIndex(void *data_context, long *val,
+ size_t val_len);
+long *get_ipCidrRouteType(void *data_context, size_t * ret_len);
+int set_ipCidrRouteType(void *data_context, long *val,
+ size_t val_len);
+long *get_ipCidrRouteProto(void *data_context, size_t * ret_len);
+long *get_ipCidrRouteAge(void *data_context, size_t * ret_len);
+oid *get_ipCidrRouteInfo(void *data_context, size_t * ret_len);
+int set_ipCidrRouteInfo(void *data_context, oid * val,
+ size_t val_len);
+long *get_ipCidrRouteNextHopAS(void *data_context,
+ size_t * ret_len);
+int set_ipCidrRouteNextHopAS(void *data_context, long *val,
+ size_t val_len);
+long *get_ipCidrRouteMetric1(void *data_context,
+ size_t * ret_len);
+int set_ipCidrRouteMetric1(void *data_context, long *val,
+ size_t val_len);
+long *get_ipCidrRouteMetric2(void *data_context,
+ size_t * ret_len);
+int set_ipCidrRouteMetric2(void *data_context, long *val,
+ size_t val_len);
+long *get_ipCidrRouteMetric3(void *data_context,
+ size_t * ret_len);
+int set_ipCidrRouteMetric3(void *data_context, long *val,
+ size_t val_len);
+long *get_ipCidrRouteMetric4(void *data_context,
+ size_t * ret_len);
+int set_ipCidrRouteMetric4(void *data_context, long *val,
+ size_t val_len);
+long *get_ipCidrRouteMetric5(void *data_context,
+ size_t * ret_len);
+int set_ipCidrRouteMetric5(void *data_context, long *val,
+ size_t val_len);
+long *get_ipCidrRouteStatus(void *data_context,
+ size_t * ret_len);
+int set_ipCidrRouteStatus(void *data_context, long *val,
+ size_t val_len);
+
+#endif /* IPCIDRROUTETABLE_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_checkfns.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_checkfns.c
new file mode 100644
index 0000000000..f307686754
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_checkfns.c
@@ -0,0 +1,267 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.check_values.conf,v 1.1 2003/02/06 06:07:12 hardaker Exp $
+ */
+
+/*
+ * standard headers
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include "ipCidrRouteTable_checkfns.h"
+#include "ipCidrRouteTable_enums.h"
+
+/** Decides if an incoming value for the ipCidrRouteIfIndex mib node is legal.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_ipCidrRouteIfIndex(int type, long *val, size_t val_len)
+{
+
+ /** Check to see that we were called legally */
+ if (!val)
+ return SNMP_ERR_GENERR;
+
+ /** Check the incoming type for correctness */
+ if (type != ASN_INTEGER)
+ return SNMP_ERR_WRONGTYPE;
+
+
+ /** looks ok */
+ return SNMP_ERR_NOERROR;
+}
+
+/** Decides if an incoming value for the ipCidrRouteType mib node is legal.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_ipCidrRouteType(int type, long *val, size_t val_len)
+{
+
+ /** Check to see that we were called legally */
+ if (!val)
+ return SNMP_ERR_GENERR;
+
+ /** Check the incoming type for correctness */
+ if (type != ASN_INTEGER)
+ return SNMP_ERR_WRONGTYPE;
+
+ /** Check the enums. Legal values continue. */
+ switch (*val) {
+ case IPCIDRROUTETYPE_OTHER:
+ case IPCIDRROUTETYPE_REJECT:
+ case IPCIDRROUTETYPE_LOCAL:
+ case IPCIDRROUTETYPE_REMOTE:
+ break;
+
+ /** not a legal enum value. return an error */
+ default:
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ /** looks ok */
+ return SNMP_ERR_NOERROR;
+}
+
+/** Decides if an incoming value for the ipCidrRouteInfo mib node is legal.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_ipCidrRouteInfo(int type, oid * val, size_t val_len)
+{
+
+ /** Check to see that we were called legally */
+ if (!val)
+ return SNMP_ERR_GENERR;
+
+ /** Check the incoming type for correctness */
+ if (type != ASN_OBJECT_ID)
+ return SNMP_ERR_WRONGTYPE;
+
+ /** looks ok */
+ return SNMP_ERR_NOERROR;
+}
+
+/** Decides if an incoming value for the ipCidrRouteNextHopAS mib node is legal.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_ipCidrRouteNextHopAS(int type, long *val, size_t val_len)
+{
+
+ /** Check to see that we were called legally */
+ if (!val)
+ return SNMP_ERR_GENERR;
+
+ /** Check the incoming type for correctness */
+ if (type != ASN_INTEGER)
+ return SNMP_ERR_WRONGTYPE;
+
+
+ /** looks ok */
+ return SNMP_ERR_NOERROR;
+}
+
+/** Decides if an incoming value for the ipCidrRouteMetric1 mib node is legal.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_ipCidrRouteMetric1(int type, long *val, size_t val_len)
+{
+
+ /** Check to see that we were called legally */
+ if (!val)
+ return SNMP_ERR_GENERR;
+
+ /** Check the incoming type for correctness */
+ if (type != ASN_INTEGER)
+ return SNMP_ERR_WRONGTYPE;
+
+
+ /** looks ok */
+ return SNMP_ERR_NOERROR;
+}
+
+/** Decides if an incoming value for the ipCidrRouteMetric2 mib node is legal.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_ipCidrRouteMetric2(int type, long *val, size_t val_len)
+{
+
+ /** Check to see that we were called legally */
+ if (!val)
+ return SNMP_ERR_GENERR;
+
+ /** Check the incoming type for correctness */
+ if (type != ASN_INTEGER)
+ return SNMP_ERR_WRONGTYPE;
+
+
+ /** looks ok */
+ return SNMP_ERR_NOERROR;
+}
+
+/** Decides if an incoming value for the ipCidrRouteMetric3 mib node is legal.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_ipCidrRouteMetric3(int type, long *val, size_t val_len)
+{
+
+ /** Check to see that we were called legally */
+ if (!val)
+ return SNMP_ERR_GENERR;
+
+ /** Check the incoming type for correctness */
+ if (type != ASN_INTEGER)
+ return SNMP_ERR_WRONGTYPE;
+
+
+ /** looks ok */
+ return SNMP_ERR_NOERROR;
+}
+
+/** Decides if an incoming value for the ipCidrRouteMetric4 mib node is legal.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_ipCidrRouteMetric4(int type, long *val, size_t val_len)
+{
+
+ /** Check to see that we were called legally */
+ if (!val)
+ return SNMP_ERR_GENERR;
+
+ /** Check the incoming type for correctness */
+ if (type != ASN_INTEGER)
+ return SNMP_ERR_WRONGTYPE;
+
+
+ /** looks ok */
+ return SNMP_ERR_NOERROR;
+}
+
+/** Decides if an incoming value for the ipCidrRouteMetric5 mib node is legal.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_ipCidrRouteMetric5(int type, long *val, size_t val_len)
+{
+
+ /** Check to see that we were called legally */
+ if (!val)
+ return SNMP_ERR_GENERR;
+
+ /** Check the incoming type for correctness */
+ if (type != ASN_INTEGER)
+ return SNMP_ERR_WRONGTYPE;
+
+
+ /** looks ok */
+ return SNMP_ERR_NOERROR;
+}
+
+/** Decides if an incoming value for the ipCidrRouteStatus mib node is legal.
+ * @param type The incoming data type.
+ * @param val The value to be checked.
+ * @param val_len The length of data stored in val (in bytes).
+ * @return 0 if the incoming value is legal, an SNMP error code otherwise.
+ */
+int
+check_ipCidrRouteStatus(int type, long *val, size_t val_len)
+{
+
+ /** Check to see that we were called legally */
+ if (!val)
+ return SNMP_ERR_GENERR;
+
+ /** Check the incoming type for correctness */
+ if (type != ASN_INTEGER)
+ return SNMP_ERR_WRONGTYPE;
+
+ /** Check the enums. Legal values continue. */
+ switch (*val) {
+ case IPCIDRROUTESTATUS_ACTIVE:
+ case IPCIDRROUTESTATUS_NOTINSERVICE:
+ case IPCIDRROUTESTATUS_NOTREADY:
+ case IPCIDRROUTESTATUS_CREATEANDGO:
+ case IPCIDRROUTESTATUS_CREATEANDWAIT:
+ case IPCIDRROUTESTATUS_DESTROY:
+ break;
+
+ /** not a legal enum value. return an error */
+ default:
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ /** looks ok */
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_checkfns.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_checkfns.h
new file mode 100644
index 0000000000..187611a0e8
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_checkfns.h
@@ -0,0 +1,33 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.check_values.conf $
+ */
+#ifndef IPCIDRROUTETABLE_CHECKFNS_H
+#define IPCIDRROUTETABLE_CHECKFNS_H
+
+/*
+ * these functions are designed to check incoming values for
+ * columns in the ipCidrRouteTable table for legality with respect to
+ * datatype and value.
+ */
+
+int check_ipCidrRouteIfIndex(int type, long *val,
+ size_t val_len);
+int check_ipCidrRouteType(int type, long *val, size_t val_len);
+int check_ipCidrRouteInfo(int type, oid * val, size_t val_len);
+int check_ipCidrRouteNextHopAS(int type, long *val,
+ size_t val_len);
+int check_ipCidrRouteMetric1(int type, long *val,
+ size_t val_len);
+int check_ipCidrRouteMetric2(int type, long *val,
+ size_t val_len);
+int check_ipCidrRouteMetric3(int type, long *val,
+ size_t val_len);
+int check_ipCidrRouteMetric4(int type, long *val,
+ size_t val_len);
+int check_ipCidrRouteMetric5(int type, long *val,
+ size_t val_len);
+int check_ipCidrRouteStatus(int type, long *val,
+ size_t val_len);
+
+#endif /* IPCIDRROUTETABLE_CHECKFNS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_columns.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_columns.h
new file mode 100644
index 0000000000..68c6b625e0
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_columns.h
@@ -0,0 +1,27 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.column_defines.conf,v 5.1 2002/05/08 05:42:47 hardaker Exp $
+ */
+#ifndef IPCIDRROUTETABLE_COLUMNS_H
+#define IPCIDRROUTETABLE_COLUMNS_H
+
+/*
+ * column number definitions for table ipCidrRouteTable
+ */
+#define COLUMN_IPCIDRROUTEDEST 1
+#define COLUMN_IPCIDRROUTEMASK 2
+#define COLUMN_IPCIDRROUTETOS 3
+#define COLUMN_IPCIDRROUTENEXTHOP 4
+#define COLUMN_IPCIDRROUTEIFINDEX 5
+#define COLUMN_IPCIDRROUTETYPE 6
+#define COLUMN_IPCIDRROUTEPROTO 7
+#define COLUMN_IPCIDRROUTEAGE 8
+#define COLUMN_IPCIDRROUTEINFO 9
+#define COLUMN_IPCIDRROUTENEXTHOPAS 10
+#define COLUMN_IPCIDRROUTEMETRIC1 11
+#define COLUMN_IPCIDRROUTEMETRIC2 12
+#define COLUMN_IPCIDRROUTEMETRIC3 13
+#define COLUMN_IPCIDRROUTEMETRIC4 14
+#define COLUMN_IPCIDRROUTEMETRIC5 15
+#define COLUMN_IPCIDRROUTESTATUS 16
+#endif /* IPCIDRROUTETABLE_COLUMNS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_enums.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_enums.h
new file mode 100644
index 0000000000..10039f7cbe
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipCidrRouteTable_enums.h
@@ -0,0 +1,46 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.column_enums.conf,v 5.1 2002/05/08 05:42:47 hardaker Exp $
+ */
+#ifndef IPCIDRROUTETABLE_ENUMS_H
+#define IPCIDRROUTETABLE_ENUMS_H
+
+/*
+ * enums for column ipCidrRouteType
+ */
+#define IPCIDRROUTETYPE_OTHER 1
+#define IPCIDRROUTETYPE_REJECT 2
+#define IPCIDRROUTETYPE_LOCAL 3
+#define IPCIDRROUTETYPE_REMOTE 4
+
+/*
+ * enums for column ipCidrRouteProto
+ */
+#define IPCIDRROUTEPROTO_OTHER 1
+#define IPCIDRROUTEPROTO_LOCAL 2
+#define IPCIDRROUTEPROTO_NETMGMT 3
+#define IPCIDRROUTEPROTO_ICMP 4
+#define IPCIDRROUTEPROTO_EGP 5
+#define IPCIDRROUTEPROTO_GGP 6
+#define IPCIDRROUTEPROTO_HELLO 7
+#define IPCIDRROUTEPROTO_RIP 8
+#define IPCIDRROUTEPROTO_ISIS 9
+#define IPCIDRROUTEPROTO_ESIS 10
+#define IPCIDRROUTEPROTO_CISCOIGRP 11
+#define IPCIDRROUTEPROTO_BBNSPFIGP 12
+#define IPCIDRROUTEPROTO_OSPF 13
+#define IPCIDRROUTEPROTO_BGP 14
+#define IPCIDRROUTEPROTO_IDPR 15
+#define IPCIDRROUTEPROTO_CISCOEIGRP 16
+
+/*
+ * enums for column ipCidrRouteStatus
+ */
+#define IPCIDRROUTESTATUS_ACTIVE 1
+#define IPCIDRROUTESTATUS_NOTINSERVICE 2
+#define IPCIDRROUTESTATUS_NOTREADY 3
+#define IPCIDRROUTESTATUS_CREATEANDGO 4
+#define IPCIDRROUTESTATUS_CREATEANDWAIT 5
+#define IPCIDRROUTESTATUS_DESTROY 6
+
+#endif /* IPCIDRROUTETABLE_ENUMS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipv6.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipv6.c
new file mode 100644
index 0000000000..1e24989fa9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipv6.c
@@ -0,0 +1,2148 @@
+/*
+ * IP MIB group implementation - ipv6.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
+# if HAVE_SYS_SOCKETVAR_H
+# include <sys/socketvar.h>
+# endif
+#endif
+
+#if STDC_HEADERS
+#include <string.h>
+#include <stdlib.h>
+#else
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#include <sys/sysctl.h>
+#ifdef _I_DEFINED_KERNEL
+#define _KERNEL 1
+#endif
+#endif
+#if HAVE_SYS_SYSMP_H
+#include <sys/sysmp.h>
+#endif
+#if HAVE_SYS_TCPIPSTATS_H
+#include <sys/tcpipstats.h>
+#endif
+#include <net/if.h>
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#if HAVE_NET_IF_DL_H
+#include <net/if_dl.h>
+#endif
+#ifdef HAVE_NET_IF_MIB_H
+#include <net/if_mib.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+#include <netinet/in_systm.h>
+#if HAVE_SYS_HASHING_H
+#include <sys/hashing.h>
+#endif
+#if HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
+#if HAVE_NETINET6_IN6_VAR_H
+#include <netinet6/in6_var.h>
+#endif
+#include <netinet/ip6.h>
+#if HAVE_NETINET_IP_VAR_H
+# include <netinet/ip_var.h>
+#endif
+#if HAVE_NETINET6_IP6_VAR_H
+# include <netinet6/ip6_var.h>
+#endif
+#include <net/route.h>
+#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
+# if HAVE_NETINET_IN_PCB_H
+# include <netinet/in_pcb.h>
+# endif
+#endif
+#if HAVE_NETINET6_IN6_PCB_H
+# include <netinet6/in6_pcb.h>
+#endif
+#if HAVE_NETINET6_TCP6_H
+# define TCP6
+#endif
+#ifndef TCP6
+# if HAVE_NETINET_TCP_H
+# include <netinet/tcp.h>
+# endif
+# if HAVE_NETINET_TCP_TIMER_H
+# include <netinet/tcp_timer.h>
+# endif
+# if HAVE_NETINET_TCP_VAR_H
+# include <netinet/tcp_var.h>
+# endif
+# if HAVE_NETINET_TCP_FSM_H
+# include <netinet/tcp_fsm.h>
+# endif
+#endif
+#if HAVE_NETINET6_TCP6_H
+# include <netinet6/tcp6.h>
+#endif
+#if HAVE_NETINET6_TCP6_TIMER_H
+#include <netinet6/tcp6_timer.h>
+#endif
+#if HAVE_NETINET6_TCP6_VAR_H
+#include <netinet6/tcp6_var.h>
+#endif
+#if HAVE_NETINET6_TCP6_FSM_H
+#include <netinet6/tcp6_fsm.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+
+#ifdef MIB_IPCOUNTER_SYMBOL
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif /* MIB_IPCOUNTER_SYMBOL */
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "kernel.h"
+#include "util_funcs.h"
+#include "ipv6.h"
+#include "interfaces.h"
+
+static int header_ipv6
+(register struct variable *, oid *, size_t *, int, size_t *,
+ WriteMethod **);
+static int header_ipv6_scan
+(register struct variable *, oid *, size_t *, int, size_t *,
+ WriteMethod **, int, int);
+static int if_initialize (void);
+static int if_maxifindex (void);
+static char *if_getname (int);
+#ifdef notused
+static int if_getindex (const char *);
+#endif
+
+struct variable3 ipv6_variables[] = {
+ {IPV6FORWARDING, ASN_INTEGER, RONLY, var_ipv6, 1, {1}},
+ {IPV6DEFAULTHOPLIMIT, ASN_INTEGER, RONLY, var_ipv6, 1, {2}},
+ {IPV6INTERFACES, ASN_GAUGE, RONLY, var_ipv6, 1, {3}},
+ {IPV6IFTBLLASTCHG, ASN_TIMETICKS, RONLY, var_ipv6, 1, {4}},
+
+ {IPV6IFDESCR, ASN_OCTET_STR, RONLY, var_ifv6Entry, 3, {5, 1, 2}},
+ {IPV6IFLOWLAYER, ASN_OBJECT_ID, RONLY, var_ifv6Entry, 3, {5, 1, 3}},
+ {IPV6IFEFFECTMTU, ASN_UNSIGNED, RONLY, var_ifv6Entry, 3, {5, 1, 4}},
+ {IPV6IFREASMMAXSIZE, ASN_UNSIGNED, RONLY, var_ifv6Entry, 3, {5, 1, 5}},
+
+ {IPV6IFTOKEN, ASN_OCTET_STR, RONLY, var_ifv6Entry, 3, {5, 1, 6}},
+ {IPV6IFTOKENLEN, ASN_INTEGER, RONLY, var_ifv6Entry, 3, {5, 1, 7}},
+ {IPV6IFPHYSADDRESS, ASN_OCTET_STR, RONLY, var_ifv6Entry, 3, {5, 1, 8}},
+ {IPV6IFADMSTATUS, ASN_INTEGER, RONLY, var_ifv6Entry, 3, {5, 1, 9}},
+ {IPV6IFOPERSTATUS, ASN_INTEGER, RONLY, var_ifv6Entry, 3, {5, 1, 10}},
+ {IPV6IFLASTCHANGE, ASN_TIMETICKS, RONLY, var_ifv6Entry, 3, {5, 1, 11}},
+
+ {IPV6IFSTATSINRCVS, ASN_COUNTER, RONLY, var_ifv6Entry, 3, {6, 1, 1}},
+ {IPV6IFSTATSINHDRERRS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 2}},
+ {IPV6IFSTATSTOOBIGERRS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 3}},
+ {IPV6IFSTATSINNOROUTES, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 4}},
+ {IPV6IFSTATSINADDRERRS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 5}},
+ {IPV6IFSTATSINUNKNOWPROTS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 6}},
+ {IPV6IFSTATSINTRUNCATPKTS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 7}},
+ {IPV6IFSTATSINDISCARDS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 8}},
+ {IPV6IFSTATSINDELIVERS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 9}},
+ {IPV6IFSTATSOUTFORWDATAS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 10}},
+ {IPV6IFSTATSOUTREQS, ASN_COUNTER, RONLY, var_ifv6Entry, 3, {6, 1, 11}},
+ {IPV6IFSTATSOUTDISCARDS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 12}},
+ {IPV6IFSTATSOUTFRAGOKS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 13}},
+ {IPV6IFSTATSOUTFRAGFAILS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 14}},
+ {IPV6IFSTATSOUTFRAGCREATS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 15}},
+ {IPV6IFSTATSOUTREASMREQS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 16}},
+ {IPV6IFSTATSOUTREASMOKS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 17}},
+ {IPV6IFSTATSOUTREASMFAILS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 18}},
+ {IPV6IFSTATSINMCASTPKTS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 19}},
+ {IPV6IFSTATSOUTMCASTPKTS, ASN_COUNTER, RONLY, var_ifv6Entry, 3,
+ {6, 1, 20}},
+
+#if 0
+ {IPV6ADDRPREFIXONLINKFLG, INTEGER, RONLY, var_ipv6AddrEntry, 3,
+ {7, 1, 3}},
+ {IPV6ADDRPREFIXAUTONOMOUSFLAG, INTEGER, RONLY, var_ipv6AddrEntry, 3,
+ {7, 1, 4}},
+ {IPV6ADDRPREFIXADVPREFERLIFE, UNSIGNED32, RONLY, var_ipv6AddrEntry, 3,
+ {7, 1, 5}},
+ {IPV6ADDRPREFIXVALIDLIFE, UNSIGNED32, RONLY, var_ipv6AddrEntry, 3,
+ {7, 1, 6}},
+
+ {IPV6ADDRPFXLEN, INTEGER, RONLY, var_ipv6AddrEntry, 3, {8, 1, 2}},
+ {IPV6ADDRTYPE, INTEGER, RONLY, var_ipv6AddrEntry, 3, {8, 1, 3}},
+ {IPV6ADDRANYCASTFLAG, INTEGER, RONLY, var_ipv6AddrEntry, 3, {8, 1, 4}},
+ {IPV6ADDRSTATUS, INTEGER, RONLY, var_ipv6AddrEntry, 3, {8, 1, 5}},
+
+ {IPV6ROUTEIFINDEX, IpV6IFINDEX, RONLY, var_ipv6RouteEntry, 3,
+ {11, 1, 4}},
+ {IPV6ROUTENEXTHOP, IpV6ADDRESS, RONLY, var_ipv6RouteEntry, 3,
+ {11, 1, 5}},
+ {IPV6ROUTETYPE, INTEGER, RONLY, var_ipv6RouteEntry, 3, {11, 1, 6}},
+ {IPV6ROUTEPROTOCOL, INTEGER, RONLY, var_ipv6RouteEntry, 3, {11, 1, 7}},
+ {IPV6ROUTEPOLICY, UNSIGNED32, RONLY, var_ipv6RouteEntry, 3,
+ {11, 1, 8}},
+ {IPV6ROUTEAGE, UNSIGNED32, RONLY, var_ipv6RouteEntry, 3, {11, 1, 9}},
+ {IPV6ROUTENEXTHOPRDI, UNSIGNED32, RONLY, var_ipv6RouteEntry, 3,
+ {11, 1, 10}},
+ {IPV6ROUTEMETRIC, UNSIGNED32, RONLY, var_ipv6RouteEntry, 3,
+ {11, 1, 11}},
+ {IPV6ROUTEWEIGHT, UNSIGNED32, RONLY, var_ipv6RouteEntry, 3,
+ {11, 1, 12}},
+ {IPV6ROUTEINFO, OBJID, RONLY, var_ipv6RouteEntry, 3, {11, 1, 13}},
+ {IPV6ROUTEVALID, INTEGER, RONLY, var_ipv6RouteEntry, 3, {11, 1, 14}},
+
+ {IPV6NETTOMEDIAPHYADDR, STRING, RONLY, var_ndpEntry, 3, {12, 1, 2}},
+ {IPV6NETTOMEDIATYPE, INTEGER, RONLY, var_ndpEntry, 3, {12, 1, 3}},
+ {IPV6NETTOMEDIASTATE, INTEGER, RONLY, var_ndpEntry, 3, {12, 1, 4}},
+ {IPV6NETTOMEDIALASTUPDATE, TIMETICKS, RONLY, var_ndpEntry, 3,
+ {12, 1, 5}},
+ {IPV6NETTOMEDIAVALID, INTEGER, RONLY, var_ndpEntry, 3, {12, 1, 6}},
+#endif
+};
+oid ipv6_variables_oid[] = { SNMP_OID_MIB2, 55, 1 };
+#if 0
+config_load_mib(MIB .55 .1, 8, ipv6_variables)
+ config_add_mib(IPV6 - TC)
+ config_add_mib(IPV6 - MIB)
+#endif
+ struct variable3 ipv6icmp_variables[] = {
+ {IPV6IFICMPINMSG, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 1}},
+ {IPV6IFICMPINERRORS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 2}},
+ {IPV6IFICMPINDSTUNRCHS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 3}},
+ {IPV6IFICMPINADMPROHS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 4}},
+ {IPV6IFICMPINTIMEXCDS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 5}},
+ {IPV6IFICMPINPARMPROBS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 6}},
+ {IPV6IFICMPINPKTTOOBIGS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 7}},
+ {IPV6IFICMPINECHOS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 8}},
+ {IPV6IFICMPINECHOREPS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 9}},
+ {IPV6IFICMPINRTRSLICITS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 10}},
+ {IPV6IFICMPINRTRADVS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 11}},
+ {IPV6IFICMPINNBRSLICITS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 12}},
+ {IPV6IFICMPINNBRADVS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 13}},
+ {IPV6IFICMPINREDIRECTS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 14}},
+ {IPV6IFICMPINGRPMEQERYS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 15}},
+ {IPV6IFICMPINGRPMERSPS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 16}},
+ {IPV6IFICMPINGRPMEREDCS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 17}},
+ {IPV6IFICMPOUTMSG, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 18}},
+ {IPV6IFICMPOUTERRORS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 19}},
+ {IPV6IFICMPOUTDSTUNRCHS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 20}},
+ {IPV6IFICMPOUTADMPROHS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 21}},
+ {IPV6IFICMPOUTTIMEXCDS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 22}},
+ {IPV6IFICMPOUTPARMPROBS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 23}},
+ {IPV6IFICMPOUTPKTTOOBIGS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 24}},
+ {IPV6IFICMPOUTECHOS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 25}},
+ {IPV6IFICMPOUTECHOREPS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 26}},
+ {IPV6IFICMPOUTRTRSLICITS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 27}},
+ {IPV6IFICMPOUTRTRADVS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 28}},
+ {IPV6IFICMPOUTNBRSLICITS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 29}},
+ {IPV6IFICMPOUTNBRADVS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 30}},
+ {IPV6IFICMPOUTREDIRECTS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 31}},
+ {IPV6IFICMPOUTGRPMEQERYS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 32}},
+ {IPV6IFICMPOUTGRPMERSPS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 33}},
+ {IPV6IFICMPOUTGRPMEREDCS, ASN_COUNTER, RONLY, var_icmpv6Entry, 3,
+ {1, 1, 34}}
+ };
+oid ipv6icmp_variables_oid[] = { 1, 3, 6, 1, 2, 1, 56, 1 };
+#if 0
+config_load_mib(MIB .56 .1, 8, ipv6icmp_variables)
+ config_add_mib(IPV6 - ICMP - MIB)
+#endif
+ struct variable2 ipv6udp_variables[] = {
+ {IPV6UDPLOCALADDRESS, ASN_OCTET_STR, RONLY, var_udp6, 2, {1, 1}},
+ {IPV6UDPLOCALPORT, ASN_INTEGER, RONLY, var_udp6, 2, {1, 2}},
+ {IPV6UDPIFINDEX, ASN_INTEGER, RONLY, var_udp6, 2, {1, 3}}
+ };
+oid ipv6udp_variables_oid[] = { 1, 3, 6, 1, 2, 1, 7, 6 };
+#if 0
+config_load_mib(1.3 .6 .1 .3 .87 .1, 7, ipv6udp_variables)
+ config_add_mib(IPV6 - UDP - MIB)
+#endif
+ struct variable2 ipv6tcp_variables[] = {
+ {IPV6TCPLOCALADDR, ASN_OCTET_STR, RONLY, var_tcp6, 2, {1, 1}},
+ {IPV6TCPLOCALPORT, ASN_INTEGER, RONLY, var_tcp6, 2, {1, 2}},
+ {IPV6TCPREMOTEADDR, ASN_OCTET_STR, RONLY, var_tcp6, 2, {1, 3}},
+ {IPV6TCPREMOTEPORT, ASN_INTEGER, RONLY, var_tcp6, 2, {1, 4}},
+ {IPV6TCPIFINDEX, ASN_INTEGER, RONLY, var_tcp6, 2, {1, 5}},
+ {IPV6TCPCONNSTATE, ASN_INTEGER, RONLY, var_tcp6, 2, {1, 6}},
+ };
+oid ipv6tcp_variables_oid[] = { 1, 3, 6, 1, 2, 1, 6, 16 };
+#if 0
+config_load_mib(1.3 .6 .1 .3 .86 .1, 7, ipv6tcp_variables)
+ config_add_mib(IPV6 - TCP - MIB)
+#endif
+ void
+ init_ipv6()
+{
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("mibII/ipv6", ipv6_variables, variable3,
+ ipv6_variables_oid);
+ REGISTER_MIB("mibII/icmpv6", ipv6icmp_variables, variable3,
+ ipv6icmp_variables_oid);
+ REGISTER_MIB("mibII/ipv6udp", ipv6udp_variables, variable2,
+ ipv6udp_variables_oid);
+ REGISTER_MIB("mibII/ipv6tcp", ipv6tcp_variables, variable2,
+ ipv6tcp_variables_oid);
+}
+
+static int
+header_ipv6(register struct variable *vp,
+ /*
+ * IN - pointer to variable entry that points here
+ */
+ oid * name, /* IN/OUT - input name requested, output name found */
+ size_t * length, /* IN/OUT - length of input and output oid's */
+ int exact, /* IN - TRUE if an exact match was requested */
+ size_t * var_len, /* OUT - length of variable or 0 if function returned */
+ WriteMethod ** write_method)
+{
+ oid newname[MAX_OID_LEN];
+ int result;
+
+ DEBUGMSGTL(("mibII/ipv6", "header_ipv6: "));
+ DEBUGMSGOID(("mibII/ipv6", name, *length));
+ DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+ newname[(int) vp->namelen] = 0;
+ result =
+ snmp_oid_compare(name, *length, newname, (int) vp->namelen + 1);
+ if ((exact && (result != 0)) || (!exact && (result >= 0)))
+ return (MATCH_FAILED);
+ memcpy((char *) name, (char *) newname,
+ ((int) vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+ return (MATCH_SUCCEEDED);
+}
+
+static int
+header_ipv6_scan(register struct variable *vp,
+ /*
+ * IN - pointer to variable entry that points here
+ */
+ oid * name, /* IN/OUT - input name requested, output name found */
+ size_t * length, /* IN/OUT - length of input and output oid's */
+ int exact, /* IN - TRUE if an exact match was requested */
+ size_t * var_len, /* OUT - length of variable or 0 if function returned */
+ WriteMethod ** write_method, int from, int to)
+{
+ oid newname[MAX_OID_LEN];
+ int result;
+ int i;
+
+ DEBUGMSGTL(("mibII/ipv6", "header_ipv6_scan: "));
+ DEBUGMSGOID(("mibII/ipv6", name, *length));
+ DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+ for (i = from; i <= to; i++) {
+ newname[(int) vp->namelen] = i;
+ result =
+ snmp_oid_compare(name, *length, newname,
+ (int) vp->namelen + 1);
+ if (((exact && result == 0) || (!exact && result < 0))
+ && if_getname(i))
+ break;
+ }
+ if (to < i)
+ return (MATCH_FAILED);
+ memcpy((char *) name, (char *) newname,
+ ((int) vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+ return (MATCH_SUCCEEDED);
+}
+
+static struct if_nameindex *ifnames = NULL;
+
+#ifdef linux
+static void linux_if_freenameindex(struct if_nameindex *);
+static struct if_nameindex *linux_if_nameindex(void);
+#endif
+
+static int
+if_initialize(void)
+{
+#ifndef HAVE_IF_NAMEINDEX
+ return -1;
+#else
+#ifndef linux
+ if (ifnames)
+ if_freenameindex(ifnames);
+ ifnames = if_nameindex();
+#else
+ if (ifnames)
+ linux_if_freenameindex(ifnames);
+ ifnames = linux_if_nameindex();
+#endif
+ if (!ifnames) {
+ ERROR_MSG("if_nameindex() failed");
+ return -1;
+ }
+ return 0;
+#endif
+}
+
+static int
+if_maxifindex(void)
+{
+#ifndef HAVE_IF_NAMEINDEX
+ return -1;
+#else
+ struct if_nameindex *p;
+ int max = 0;
+
+ if (!ifnames) {
+ if (if_initialize() < 0)
+ return -1;
+ }
+ for (p = ifnames; p && p->if_index; p++) {
+ if (max < p->if_index)
+ max = p->if_index;
+ }
+ return max;
+#endif
+}
+
+static int
+if_countifindex(void)
+{
+#ifndef HAVE_IF_NAMEINDEX
+ return -1;
+#else
+ struct if_nameindex *p;
+ int count = 0;
+
+ if (!ifnames) {
+ if (if_initialize() < 0)
+ return -1;
+ }
+ for (p = ifnames; p && p->if_index; p++) {
+ count++;
+ }
+ return count;
+#endif
+}
+
+static char *
+if_getname(int idx)
+{
+#ifndef HAVE_IF_NAMEINDEX
+ return NULL;
+#else
+ struct if_nameindex *p;
+
+ if (!ifnames) {
+ if (if_initialize() < 0)
+ return NULL;
+ }
+ for (p = ifnames; p && p->if_index; p++) {
+ if (p->if_index == idx)
+ return p->if_name;
+ }
+ return NULL;
+#endif
+}
+
+#ifdef notused
+static int
+if_getindex(const char *name)
+{
+#ifndef HAVE_IF_NAMEINDEX
+ return -1;
+#else
+ struct if_nameindex *p;
+
+ if (!ifnames) {
+ if (if_initialize() < 0)
+ return -1;
+ }
+ for (p = ifnames; p && p->if_index; p++) {
+ if (strcmp(name, p->if_name) == 0)
+ return p->if_index;
+ }
+ return -1;
+#endif
+}
+#endif /* notused */
+
+/*------------------------------------------------------------*/
+#ifndef linux
+/*
+ * KAME dependent part
+ */
+static int
+if_getifnet(int idx, struct ifnet *result)
+{
+ caddr_t q;
+ struct ifnet tmp;
+
+ if (!auto_nlist("ifnet", (char *) &q, sizeof(q)))
+ return -1;
+ while (q) {
+ if (!NETSNMP_KLOOKUP(q, (char *) &tmp, sizeof(tmp))) {
+ DEBUGMSGTL(("mibII/ipv6:if_getifnet", "klookup failed\n"));
+ return -1;
+ }
+ if (idx == tmp.if_index) {
+ memcpy(result, &tmp, sizeof(tmp));
+ return 0;
+ }
+#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
+ q = (caddr_t) TAILQ_NEXT(&tmp, if_link);
+#else
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+ q = (caddr_t) TAILQ_NEXT(&tmp, if_list);
+# else
+ q = (caddr_t) tmp.if_next;
+# endif
+#endif
+ }
+ return -1;
+}
+
+#if TRUST_IFLASTCHANGE /*untrustable value returned... */
+#ifdef HAVE_NET_IF_MIB_H
+#if defined(HAVE_SYS_SYSCTL_H) && defined(CTL_NET)
+static int
+if_getifmibdata(int idx, struct ifmibdata *result)
+{
+ int mib[6] = {
+ CTL_NET, PF_LINK, NETLINK_GENERIC, IFMIB_IFDATA, 0, IFDATA_GENERAL
+ };
+ size_t len;
+ struct ifmibdata tmp;
+
+ mib[4] = idx;
+ len = sizeof(struct ifmibdata);
+ if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), &tmp, &len, 0, 0) < 0)
+ return -1;
+ memcpy(result, &tmp, sizeof(tmp));
+ return 0;
+}
+#endif
+#endif /*HAVE_NET_IF_MIB_H */
+#endif /* TRUST_IFLASTCHANGE */
+
+#ifdef __KAME__
+#define IPV6_FORWARDING_SYMBOL "ip6_forwarding"
+#define IPV6_DEFHLIM_SYMBOL "ip6_defhlim"
+#endif
+
+u_char *
+var_ipv6(register struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ int i;
+
+ if (header_ipv6(vp, name, length, exact, var_len, write_method)
+ == MATCH_FAILED) {
+ return NULL;
+ }
+#if defined(HAVE_SYS_SYSCTL_H) && defined(CTL_NET)
+ /*
+ * try with sysctl routines
+ */
+ {
+ int name[] = { CTL_NET, PF_INET6, IPPROTO_IPV6, 0 };
+ const char *namestr = NULL;
+ int result;
+ size_t resultsiz;
+
+ resultsiz = sizeof(result);
+ switch (vp->magic) {
+ case IPV6FORWARDING:
+ name[3] = IPV6CTL_FORWARDING;
+ namestr = "IPV6CTL_FORWARDING";
+ if (sysctl
+ (name, sizeof(name) / sizeof(name[0]), &result, &resultsiz,
+ 0, 0) < 0) {
+ DEBUGMSGTL(("mibII/ipv6",
+ "sysctl(CTL_NET, PF_INET6, IPPROTO_IPV6, %s)\n",
+ namestr));
+ break;
+ } else {
+ if (result)
+ long_return = 1; /* GATEWAY */
+ else
+ long_return = 2; /* HOST */
+ return (u_char *) & long_return;
+ }
+ break;
+ case IPV6DEFAULTHOPLIMIT:
+ name[3] = IPV6CTL_DEFHLIM;
+ namestr = "IPV6CTL_DEFHLIM";
+ if (sysctl
+ (name, sizeof(name) / sizeof(name[0]), &result, &resultsiz,
+ 0, 0) < 0) {
+ DEBUGMSGTL(("mibII/ipv6",
+ "sysctl(CTL_NET, PF_INET6, IPPROTO_IPV6, %s)\n",
+ namestr));
+ break;
+ } else {
+ long_return = result;
+ return (u_char *) & long_return;
+ }
+ }
+ }
+#endif /* not (HAVE_SYS_SYSCTL_H && CTL_NET) */
+
+ /*
+ * try looking into the kernel variable
+ */
+ switch (vp->magic) {
+#ifdef IPV6_FORWARDING_SYMBOL
+ case IPV6FORWARDING:
+ if (auto_nlist(IPV6_FORWARDING_SYMBOL, (char *) &i, sizeof(i))) {
+ if (i)
+ long_return = 1;
+ /*GATEWAY*/
+ else
+ long_return = 2;
+ /*HOST*/ return (u_char *) & long_return;
+ }
+ break;
+#endif
+#ifdef IPV6_DEFHLIM_SYMBOL
+ case IPV6DEFAULTHOPLIMIT:
+ if (auto_nlist(IPV6_DEFHLIM_SYMBOL, (char *) &i, sizeof(i))) {
+ long_return = i;
+ return (u_char *) & long_return;
+ }
+ break;
+#endif
+ case IPV6INTERFACES:
+#ifdef HAVE_IF_NAMEINDEX
+ /*
+ * not really the right answer... we must count IPv6 capable
+ * interfaces only.
+ */
+ long_return = if_countifindex();
+ if (long_return < 0)
+ break;
+ return (u_char *) & long_return;
+#endif
+ break;
+#if 0
+ case IPV6IFTBLLASTCHG:
+ long_return = 0;
+ /*XXX*/ return (u_char *) & long_return;
+#endif
+ default:
+ break;
+ }
+ ERROR_MSG("");
+ return NULL;
+}
+
+u_char *
+var_ifv6Entry(register struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#ifndef HAVE_IF_NAMEINDEX
+ return NULL;
+#else
+ int interface;
+ int max;
+ char *p;
+
+ max = if_maxifindex();
+ if (max < 0)
+ return NULL;
+
+ if (header_ipv6_scan
+ (vp, name, length, exact, var_len, write_method, 1, max)
+ == MATCH_FAILED) {
+ return NULL;
+ }
+ interface = name[*length - 1];
+ DEBUGMSGTL(("mibII/ipv6", "interface: %d(%s)\n",
+ interface, if_getname(interface)));
+ if (interface > max)
+ return NULL;
+
+ switch (vp->magic) {
+ case IPV6IFDESCR:
+ p = if_getname(interface);
+ if (p) {
+ *var_len = strlen(p);
+ return p;
+ }
+ break;
+ case IPV6IFLOWLAYER:
+ /*
+ * should check if type, this is a hard one...
+ */
+ *var_len = nullOidLen;
+ return (u_char *) nullOid;
+ case IPV6IFEFFECTMTU:
+ {
+#if defined(SIOCGIFMTU) && !defined(__OpenBSD__)
+ struct ifreq ifr;
+ int s;
+
+ memset(&ifr, 0, sizeof(ifr));
+ ifr.ifr_addr.sa_family = AF_INET6;
+ strncpy(ifr.ifr_name, if_getname(interface),
+ sizeof(ifr.ifr_name));
+ if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
+ break;
+ if (ioctl(s, SIOCGIFMTU, (caddr_t) & ifr) < 0) {
+ close(s);
+ break;
+ }
+ long_return = ifr.ifr_mtu;
+ close(s);
+ return (u_char *) & long_return;
+#else
+ break;
+#endif
+ }
+#if 0 /*not yet */
+ case IPV6IFREASMMAXSIZE:
+ /*
+ * I dunno what the spec means for this MIB
+ */
+ case IPV6IFTOKEN:
+ case IPV6IFTOKENLEN:
+#endif
+ case IPV6IFPHYSADDRESS:
+ {
+ struct ifnet ifnet;
+ struct ifaddr ifaddr;
+ static struct sockaddr_dl sdl;
+ caddr_t ifa;
+
+ if (if_getifnet(interface, &ifnet) < 0)
+ break;
+#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
+ ifa = (caddr_t) TAILQ_FIRST(&ifnet.if_addrhead);
+#else
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+ ifa = (caddr_t) TAILQ_FIRST(&ifnet.if_addrlist);
+# else
+ ifa = (caddr_t) ifnet.if_addrlist;
+# endif
+#endif
+ while (ifa) {
+ if (!NETSNMP_KLOOKUP(ifa, (char *) &ifaddr, sizeof(ifaddr))) {
+ DEBUGMSGTL(("mibII/ipv6:var_ipv6", "klookup failed\n"));
+ break;
+ }
+ if (!NETSNMP_KLOOKUP(ifaddr.ifa_addr,
+ (char *) &sdl, sizeof(sdl))) {
+ DEBUGMSGTL(("mibII/ipv6:var_ipv6", "klookup failed\n"));
+ break;
+ }
+ if (sdl.sdl_family == AF_LINK) {
+ if (sizeof(sdl.sdl_data) < sdl.sdl_nlen + sdl.sdl_alen) {
+ ERROR_MSG("sdl_alen too long for interface\n");
+ break;
+ }
+ *var_len = sdl.sdl_alen;
+ return (u_char *) (sdl.sdl_data + sdl.sdl_nlen);
+ }
+#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
+ ifa = (caddr_t) TAILQ_NEXT(&ifaddr, ifa_link);
+#else
+# if defined(__NetBSD__) || defined(__OpenBSD__)
+ ifa = (caddr_t) TAILQ_NEXT(&ifaddr, ifa_list);
+# else
+ ifa = (caddr_t) ifaddr.ifa_next;
+# endif
+#endif
+ }
+
+ /*
+ * no physical address found
+ */
+ *var_len = 0;
+ return NULL;
+ }
+ case IPV6IFADMSTATUS:
+ {
+ struct ifnet ifnet;
+
+ if (if_getifnet(interface, &ifnet) < 0)
+ break;
+ long_return = (ifnet.if_flags & IFF_RUNNING) ? 1 : 2;
+ return (u_char *) & long_return;
+ }
+ case IPV6IFOPERSTATUS:
+ {
+ struct ifnet ifnet;
+
+ if (if_getifnet(interface, &ifnet) < 0)
+ break;
+ long_return = (ifnet.if_flags & IFF_UP) ? 1 : 2;
+ return (u_char *) & long_return;
+ }
+#if TRUST_IFLASTCHANGE /*untrustable value returned... */
+ case IPV6IFLASTCHANGE:
+ {
+ struct timeval lastchange;
+ struct timeval now;
+ int gotanswer;
+
+ gotanswer = 0;
+ lastchange.tv_sec = lastchange.tv_usec = 0;
+#ifdef HAVE_NET_IF_MIB_H
+ if (!gotanswer) {
+ struct ifmibdata ifmd;
+
+ if (if_getifmibdata(interface, &ifmd) < 0);
+ else {
+ lastchange = ifmd.ifmd_data.ifi_lastchange;
+ gotanswer++;
+ }
+ }
+#endif
+#ifdef STRUCT_IFNET_HAS_IF_LASTCHANGE_TV_SEC
+ if (!gotanswer) {
+ struct ifnet ifnet;
+
+ if (if_getifnet(interface, &ifnet) < 0);
+ else {
+ lastchange = ifnet.if_lastchange;
+ gotanswer++;
+ }
+ }
+#endif
+ DEBUGMSGTL(("mibII/ipv6", "lastchange = { %d.%06d }\n",
+ lastchange.tv_sec, lastchange.tv_usec));
+ if (lastchange.tv_sec == 0 && lastchange.tv_usec == 0)
+ long_return = 0;
+ else {
+ gettimeofday(&now, (struct timezone *) NULL);
+ long_return =
+ (u_long) ((now.tv_sec - lastchange.tv_sec) * 100);
+ long_return +=
+ (u_long) ((now.tv_usec - lastchange.tv_usec) / 10000);
+ }
+ return (u_char *) & long_return;
+ }
+#endif /* TRUST_IFLASTCHANGE */
+
+#ifdef SIOCGIFSTAT_IN6
+ case IPV6IFSTATSINRCVS:
+ case IPV6IFSTATSINHDRERRS:
+ case IPV6IFSTATSTOOBIGERRS:
+ case IPV6IFSTATSINNOROUTES:
+ case IPV6IFSTATSINADDRERRS:
+ case IPV6IFSTATSINUNKNOWPROTS:
+ case IPV6IFSTATSINTRUNCATPKTS:
+ case IPV6IFSTATSINDISCARDS:
+ case IPV6IFSTATSINDELIVERS:
+ case IPV6IFSTATSOUTFORWDATAS:
+ case IPV6IFSTATSOUTREQS:
+ case IPV6IFSTATSOUTDISCARDS:
+ case IPV6IFSTATSOUTFRAGOKS:
+ case IPV6IFSTATSOUTFRAGFAILS:
+ case IPV6IFSTATSOUTFRAGCREATS:
+ case IPV6IFSTATSOUTREASMREQS:
+ case IPV6IFSTATSOUTREASMOKS:
+ case IPV6IFSTATSOUTREASMFAILS:
+ case IPV6IFSTATSINMCASTPKTS:
+ case IPV6IFSTATSOUTMCASTPKTS:
+ {
+ struct in6_ifstat *ifs6;
+ struct in6_ifreq ifr;
+ int s;
+
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, if_getname(interface),
+ sizeof(ifr.ifr_name));
+ if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+ break;
+ if (ioctl(s, SIOCGIFSTAT_IN6, (caddr_t) & ifr) < 0) {
+ close(s);
+ break;
+ }
+ close(s);
+ ifs6 = &ifr.ifr_ifru.ifru_stat;
+ switch (vp->magic) {
+ case IPV6IFSTATSINRCVS:
+ long_return = ifs6->ifs6_in_receive;
+ break;
+ case IPV6IFSTATSINHDRERRS:
+ long_return = ifs6->ifs6_in_hdrerr;
+ break;
+ case IPV6IFSTATSTOOBIGERRS:
+ long_return = ifs6->ifs6_in_toobig;
+ break;
+ case IPV6IFSTATSINNOROUTES:
+ long_return = ifs6->ifs6_in_noroute;
+ break;
+ case IPV6IFSTATSINADDRERRS:
+ long_return = ifs6->ifs6_in_addrerr;
+ break;
+ case IPV6IFSTATSINUNKNOWPROTS:
+ long_return = ifs6->ifs6_in_protounknown;
+ break;
+ case IPV6IFSTATSINTRUNCATPKTS:
+ long_return = ifs6->ifs6_in_truncated;
+ break;
+ case IPV6IFSTATSINDISCARDS:
+ long_return = ifs6->ifs6_in_discard;
+ break;
+ case IPV6IFSTATSINDELIVERS:
+ long_return = ifs6->ifs6_in_deliver;
+ break;
+ case IPV6IFSTATSOUTFORWDATAS:
+ long_return = ifs6->ifs6_out_forward;
+ break;
+ case IPV6IFSTATSOUTREQS:
+ long_return = ifs6->ifs6_out_request;
+ break;
+ case IPV6IFSTATSOUTDISCARDS:
+ long_return = ifs6->ifs6_out_discard;
+ break;
+ case IPV6IFSTATSOUTFRAGOKS:
+ long_return = ifs6->ifs6_out_fragok;
+ break;
+ case IPV6IFSTATSOUTFRAGFAILS:
+ long_return = ifs6->ifs6_out_fragfail;
+ break;
+ case IPV6IFSTATSOUTFRAGCREATS:
+ long_return = ifs6->ifs6_out_fragcreat;
+ break;
+ case IPV6IFSTATSOUTREASMREQS:
+ long_return = ifs6->ifs6_reass_reqd;
+ break;
+ case IPV6IFSTATSOUTREASMOKS:
+ long_return = ifs6->ifs6_reass_ok;
+ break;
+ case IPV6IFSTATSOUTREASMFAILS:
+ long_return = ifs6->ifs6_reass_fail;
+ break;
+ case IPV6IFSTATSINMCASTPKTS:
+ long_return = ifs6->ifs6_in_mcast;
+ break;
+ case IPV6IFSTATSOUTMCASTPKTS:
+ long_return = ifs6->ifs6_out_mcast;
+ break;
+ default:
+ return NULL;
+ }
+ return (u_char *) & long_return;
+ }
+#endif
+ default:
+ break;
+ }
+ return NULL;
+#endif
+}
+
+u_char *
+var_icmpv6Entry(register struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#ifndef HAVE_IF_NAMEINDEX
+ return NULL;
+#else
+ int interface;
+ int max;
+
+ max = if_maxifindex();
+ if (max < 0)
+ return NULL;
+
+ if (header_ipv6_scan
+ (vp, name, length, exact, var_len, write_method, 1, max)
+ == MATCH_FAILED) {
+ return NULL;
+ }
+ interface = name[*length - 1];
+ DEBUGMSGTL(("mibII/ipv6", "interface: %d(%s)\n",
+ interface, if_getname(interface)));
+ if (interface >= max)
+ return NULL;
+
+ switch (vp->magic) {
+#ifdef SIOCGIFSTAT_ICMP6
+ case IPV6IFICMPINMSG:
+ case IPV6IFICMPINERRORS:
+ case IPV6IFICMPINDSTUNRCHS:
+ case IPV6IFICMPINADMPROHS:
+ case IPV6IFICMPINTIMEXCDS:
+ case IPV6IFICMPINPARMPROBS:
+ case IPV6IFICMPINPKTTOOBIGS:
+ case IPV6IFICMPINECHOS:
+ case IPV6IFICMPINECHOREPS:
+ case IPV6IFICMPINRTRSLICITS:
+ case IPV6IFICMPINRTRADVS:
+ case IPV6IFICMPINNBRSLICITS:
+ case IPV6IFICMPINNBRADVS:
+ case IPV6IFICMPINREDIRECTS:
+ case IPV6IFICMPINGRPMEQERYS:
+ case IPV6IFICMPINGRPMERSPS:
+ case IPV6IFICMPINGRPMEREDCS:
+ case IPV6IFICMPOUTMSG:
+ case IPV6IFICMPOUTERRORS:
+ case IPV6IFICMPOUTDSTUNRCHS:
+ case IPV6IFICMPOUTADMPROHS:
+ case IPV6IFICMPOUTTIMEXCDS:
+ case IPV6IFICMPOUTPARMPROBS:
+ case IPV6IFICMPOUTPKTTOOBIGS:
+ case IPV6IFICMPOUTECHOS:
+ case IPV6IFICMPOUTECHOREPS:
+ case IPV6IFICMPOUTRTRSLICITS:
+ case IPV6IFICMPOUTRTRADVS:
+ case IPV6IFICMPOUTNBRSLICITS:
+ case IPV6IFICMPOUTNBRADVS:
+ case IPV6IFICMPOUTREDIRECTS:
+ case IPV6IFICMPOUTGRPMEQERYS:
+ case IPV6IFICMPOUTGRPMERSPS:
+ case IPV6IFICMPOUTGRPMEREDCS:
+ {
+ struct icmp6_ifstat *ifs6;
+ struct in6_ifreq ifr;
+ int s;
+
+ memset(&ifr, 0, sizeof(ifr));
+ strncpy(ifr.ifr_name, if_getname(interface),
+ sizeof(ifr.ifr_name));
+ if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+ break;
+ if (ioctl(s, SIOCGIFSTAT_ICMP6, (caddr_t) & ifr) < 0) {
+ close(s);
+ break;
+ }
+ close(s);
+ ifs6 = &ifr.ifr_ifru.ifru_icmp6stat;
+ switch (vp->magic) {
+ case IPV6IFICMPINMSG:
+ long_return = ifs6->ifs6_in_msg;
+ break;
+ case IPV6IFICMPINERRORS:
+ long_return = ifs6->ifs6_in_error;
+ break;
+ case IPV6IFICMPINDSTUNRCHS:
+ long_return = ifs6->ifs6_in_dstunreach;
+ break;
+ case IPV6IFICMPINADMPROHS:
+ long_return = ifs6->ifs6_in_adminprohib;
+ break;
+ case IPV6IFICMPINTIMEXCDS:
+ long_return = ifs6->ifs6_in_timeexceed;
+ break;
+ case IPV6IFICMPINPARMPROBS:
+ long_return = ifs6->ifs6_in_paramprob;
+ break;
+ case IPV6IFICMPINPKTTOOBIGS:
+ long_return = ifs6->ifs6_in_pkttoobig;
+ break;
+ case IPV6IFICMPINECHOS:
+ long_return = ifs6->ifs6_in_echo;
+ break;
+ case IPV6IFICMPINECHOREPS:
+ long_return = ifs6->ifs6_in_echoreply;
+ break;
+ case IPV6IFICMPINRTRSLICITS:
+ long_return = ifs6->ifs6_in_routersolicit;
+ break;
+ case IPV6IFICMPINRTRADVS:
+ long_return = ifs6->ifs6_in_routeradvert;
+ break;
+ case IPV6IFICMPINNBRSLICITS:
+ long_return = ifs6->ifs6_in_neighborsolicit;
+ break;
+ case IPV6IFICMPINNBRADVS:
+ long_return = ifs6->ifs6_in_neighboradvert;
+ break;
+ case IPV6IFICMPINREDIRECTS:
+ long_return = ifs6->ifs6_in_redirect;
+ break;
+ case IPV6IFICMPINGRPMEQERYS:
+ long_return = ifs6->ifs6_in_mldquery;
+ break;
+ case IPV6IFICMPINGRPMERSPS:
+ long_return = ifs6->ifs6_in_mldreport;
+ break;
+ case IPV6IFICMPINGRPMEREDCS:
+ long_return = ifs6->ifs6_in_mlddone;
+ break;
+ case IPV6IFICMPOUTMSG:
+ long_return = ifs6->ifs6_out_msg;
+ break;
+ case IPV6IFICMPOUTERRORS:
+ long_return = ifs6->ifs6_out_error;
+ break;
+ case IPV6IFICMPOUTDSTUNRCHS:
+ long_return = ifs6->ifs6_out_dstunreach;
+ break;
+ case IPV6IFICMPOUTADMPROHS:
+ long_return = ifs6->ifs6_out_adminprohib;
+ break;
+ case IPV6IFICMPOUTTIMEXCDS:
+ long_return = ifs6->ifs6_out_timeexceed;
+ break;
+ case IPV6IFICMPOUTPARMPROBS:
+ long_return = ifs6->ifs6_out_paramprob;
+ break;
+ case IPV6IFICMPOUTPKTTOOBIGS:
+ long_return = ifs6->ifs6_out_pkttoobig;
+ break;
+ case IPV6IFICMPOUTECHOS:
+ long_return = ifs6->ifs6_out_echo;
+ break;
+ case IPV6IFICMPOUTECHOREPS:
+ long_return = ifs6->ifs6_out_echoreply;
+ break;
+ case IPV6IFICMPOUTRTRSLICITS:
+ long_return = ifs6->ifs6_out_routersolicit;
+ break;
+ case IPV6IFICMPOUTRTRADVS:
+ long_return = ifs6->ifs6_out_routeradvert;
+ break;
+ case IPV6IFICMPOUTNBRSLICITS:
+ long_return = ifs6->ifs6_out_neighborsolicit;
+ break;
+ case IPV6IFICMPOUTNBRADVS:
+ long_return = ifs6->ifs6_out_neighboradvert;
+ break;
+ case IPV6IFICMPOUTREDIRECTS:
+ long_return = ifs6->ifs6_out_redirect;
+ break;
+ case IPV6IFICMPOUTGRPMEQERYS:
+ long_return = ifs6->ifs6_out_mldquery;
+ break;
+ case IPV6IFICMPOUTGRPMERSPS:
+ long_return = ifs6->ifs6_out_mldreport;
+ break;
+ case IPV6IFICMPOUTGRPMEREDCS:
+ long_return = ifs6->ifs6_out_mlddone;
+ break;
+ default:
+ return NULL;
+ }
+ return (u_char *) & long_return;
+ }
+#endif
+ default:
+ break;
+ }
+ return NULL;
+#endif
+}
+
+u_char *
+var_udp6(register struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ oid newname[MAX_OID_LEN];
+ oid savname[MAX_OID_LEN];
+ int result;
+ int i, j;
+ caddr_t p;
+ static struct in6pcb in6pcb, savpcb;
+ int found, savnameLen;
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
+ struct inpcbtable udbtable;
+ caddr_t first;
+#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
+ char *sysctl_buf;
+ struct xinpgen *xig, *oxig;
+#else
+ static struct in6pcb udb6;
+#endif
+
+ DEBUGMSGTL(("mibII/ipv6", "var_udp6: "));
+ DEBUGMSGOID(("mibII/ipv6", name, *length));
+ DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
+ if (!auto_nlist("udbtable", (char *) &udbtable, sizeof(udbtable)))
+ return NULL;
+ first = p = (caddr_t)udbtable.inpt_queue.cqh_first;
+#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
+ if (!auto_nlist("udb6", (char *) &udb6, sizeof(udb6)))
+ return NULL;
+ p = (caddr_t) udb6.in6p_next;
+#else
+ {
+ const char *udblist = "net.inet.udp.pcblist";
+ const char *pp = udblist;
+ size_t len;
+
+ if (sysctlbyname(udblist, 0, &len, 0, 0) < 0)
+ return NULL;
+ if ((sysctl_buf = malloc(len)) == NULL)
+ return NULL;
+ udblist = pp;
+ if (sysctlbyname(udblist, sysctl_buf, &len, 0, 0) < 0) {
+ free(sysctl_buf);
+ return NULL;
+ }
+ oxig = (struct xinpgen *) sysctl_buf;
+ xig = (struct xinpgen *) ((char *) oxig + oxig->xig_len);
+ p = (caddr_t) ((char *) xig); /* silence compiler warning */
+ }
+#endif
+ found = savnameLen = 0;
+ memcpy((char *) newname, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+ DEBUGMSGTL(("mibII/ipv6", "start: p=%x\n", p));
+ while (
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
+ p && p != first
+#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
+ p && (u_long) p != auto_nlist_value("udb6")
+#else
+ xig->xig_len > sizeof(struct xinpgen)
+#endif
+ ) {
+ DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p));
+
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
+ if (!NETSNMP_KLOOKUP(p, (char *) &in6pcb, sizeof(in6pcb))) {
+ DEBUGMSGTL(("mibII/ipv6", "klookup fail for udb6 at %x\n",
+ p));
+ found = 0;
+ break;
+ }
+#else
+ in6pcb = ((struct xinpcb *) xig)->xi_inp;
+#endif
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
+ if (in6pcb.in6p_af != AF_INET6)
+ goto skip;
+#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
+ if (0 == (in6pcb.inp_vflag & INP_IPV6))
+ goto skip;
+#endif
+
+ j = (int) vp->namelen;
+ for (i = 0; i < sizeof(struct in6_addr); i++)
+ newname[j++] = in6pcb.in6p_laddr.s6_addr[i];
+ newname[j++] = ntohs(in6pcb.in6p_lport);
+ if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+ newname[j++] =
+ ntohs(*(uint16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+ else
+ newname[j++] = 0;
+ /*XXX*/
+ DEBUGMSGTL(("mibII/ipv6", "var_udp6 new: %d %d ",
+ (int) vp->namelen, j));
+ DEBUGMSGOID(("mibII/ipv6", newname, j));
+ DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+ result = snmp_oid_compare(name, *length, newname, j);
+ if (exact && (result == 0)) {
+ memcpy(&savpcb, &in6pcb, sizeof(savpcb));
+ savnameLen = j;
+ memcpy(savname, newname, j * sizeof(oid));
+ found++;
+ break;
+ } else if (!exact && (result < 0)) {
+ /*
+ * take the least greater one
+ */
+ if ((savnameLen == 0) ||
+ (snmp_oid_compare(savname, savnameLen, newname, j) > 0)) {
+ memcpy(&savpcb, &in6pcb, sizeof(savpcb));
+ savnameLen = j;
+ memcpy(savname, newname, j * sizeof(oid));
+ found++;
+ }
+ }
+
+ skip:
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
+ p = (caddr_t)in6pcb.in6p_queue.cqe_next;
+#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
+ p = (caddr_t) in6pcb.in6p_next;
+#else
+ xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+#endif
+ }
+#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
+ free(sysctl_buf);
+#endif
+ DEBUGMSGTL(("mibII/ipv6", "found=%d\n", found));
+ if (!found)
+ return NULL;
+ *length = savnameLen;
+ memcpy((char *) name, (char *) savname, *length * sizeof(oid));
+ memcpy(&in6pcb, &savpcb, sizeof(savpcb));
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+/*
+ DEBUGMSGTL(("mibII/ipv6", "var_udp6 found: "));
+ DEBUGMSGOID(("mibII/ipv6", name, *length));
+ DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+*/
+ DEBUGMSGTL(("mibII/ipv6", "magic=%d\n", vp->magic));
+ switch (vp->magic) {
+ case IPV6UDPLOCALADDRESS:
+ *var_len = sizeof(struct in6_addr);
+ return in6pcb.in6p_laddr.s6_addr;
+ case IPV6UDPLOCALPORT:
+ long_return = ntohs(in6pcb.in6p_lport);
+ return (u_char *) & long_return;
+ case IPV6UDPIFINDEX:
+ if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+ long_return =
+ ntohs(*(uint16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+ else
+ long_return = 0;
+ /*XXX*/ return (u_char *) & long_return;
+ default:
+ break;
+ }
+ ERROR_MSG("");
+ return NULL;
+}
+
+#ifdef TCP6
+u_char *
+var_tcp6(register struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ oid newname[MAX_OID_LEN];
+ oid savname[MAX_OID_LEN];
+ int result;
+ int i, j;
+ caddr_t p;
+ static struct in6pcb in6pcb, savpcb;
+ struct tcp6cb tcp6cb;
+ int found, savnameLen;
+ static int tcp6statemap[TCP6_NSTATES];
+ static int initialized = 0;
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
+ struct inpcbtable tcbtable;
+ caddr_t first;
+#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
+ char *sysctl_buf;
+ struct xinpgen *xig, *oxig;
+#else
+ static struct in6pcb tcb6;
+#endif
+
+ if (!initialized) {
+ tcp6statemap[TCP6S_CLOSED] = 1;
+ tcp6statemap[TCP6S_LISTEN] = 2;
+ tcp6statemap[TCP6S_SYN_SENT] = 3;
+ tcp6statemap[TCP6S_SYN_RECEIVED] = 4;
+ tcp6statemap[TCP6S_ESTABLISHED] = 5;
+ tcp6statemap[TCP6S_CLOSE_WAIT] = 8;
+ tcp6statemap[TCP6S_FIN_WAIT_1] = 6;
+ tcp6statemap[TCP6S_CLOSING] = 10;
+ tcp6statemap[TCP6S_LAST_ACK] = 9;
+ tcp6statemap[TCP6S_FIN_WAIT_2] = 7;
+ tcp6statemap[TCP6S_TIME_WAIT] = 11;
+ initialized++;
+ }
+
+ DEBUGMSGTL(("mibII/ipv6", "var_tcp6: "));
+ DEBUGMSGOID(("mibII/ipv6", name, *length));
+ DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
+ if (!auto_nlist("tcbtable", (char *) &tcbtable, sizeof(tcbtable)))
+ return NULL;
+ first = p = (caddr_t)tcbtable.inpt_queue.cqh_first;
+#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
+ if (!auto_nlist("tcb6", (char *) &tcb6, sizeof(tcb6)))
+ return NULL;
+ p = (caddr_t) tcb6.in6p_next;
+#else
+ {
+ const char *tcblist = "net.inet.tcp.pcblist";
+ const char *pp = tcblist;
+ size_t len;
+
+ if (sysctlbyname(tcblist, 0, &len, 0, 0) < 0)
+ return NULL;
+ if ((sysctl_buf = malloc(len)) == NULL)
+ return NULL;
+ tcblist = pp;
+ if (sysctlbyname(tcblist, sysctl_buf, &len, 0, 0) < 0) {
+ free(sysctl_buf);
+ return NULL;
+ }
+ oxig = (struct xinpgen *) sysctl_buf;
+ xig = (struct xinpgen *) ((char *) oxig + oxig->xig_len);
+ p = (caddr_t) ((char *) xig); /* silence compiler warning */
+ }
+#endif
+ found = savnameLen = 0;
+ memcpy((char *) newname, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+ DEBUGMSGTL(("mibII/ipv6", "start: p=%x\n", p));
+ while (
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
+ p && p != first
+#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
+ p && (u_long) p != auto_nlist_value("tcb6")
+#else
+ xig->xig_len > sizeof(struct xinpgen)
+#endif
+ ) {
+ DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p));
+
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
+ if (!NETSNMP_KLOOKUP(p, (char *) &in6pcb, sizeof(in6pcb))) {
+ DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcb6 at %x\n",
+ p));
+ found = 0;
+ break;
+ }
+#else
+ in6pcb = ((struct xinpcb *) xig)->xi_inp;
+#endif
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
+ if (in6pcb.in6p_af != AF_INET6)
+ goto skip;
+#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
+ if (0 == (in6pcb.inp_vflag & INP_IPV6))
+ goto skip;
+#endif
+ if (!NETSNMP_KLOOKUP(in6pcb.in6p_ppcb, (char *) &tcp6cb, sizeof(tcp6cb))) {
+ DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcb6.tcp6cb at %x\n",
+ in6pcb.in6p_ppcb));
+ found = 0;
+ break;
+ }
+ j = (int) vp->namelen;
+ for (i = 0; i < sizeof(struct in6_addr); i++)
+ newname[j++] = in6pcb.in6p_laddr.s6_addr[i];
+ newname[j++] = ntohs(in6pcb.in6p_lport);
+ for (i = 0; i < sizeof(struct in6_addr); i++)
+ newname[j++] = in6pcb.in6p_faddr.s6_addr[i];
+ newname[j++] = ntohs(in6pcb.in6p_fport);
+ if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+ newname[j++] =
+ ntohs(*(uint16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+ else
+ newname[j++] = 0;
+ /*XXX*/ newname[j++] = tcp6statemap[tcp6cb.t_state];
+
+ DEBUGMSGTL(("mibII/ipv6", "var_tcp6 new: %d %d ",
+ (int) vp->namelen, j));
+ DEBUGMSGOID(("mibII/ipv6", newname, j));
+ DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+#if 1 /* this is very odd but sometimes happen, and cause infinite loop */
+ if (ntohs(in6pcb.in6p_lport) == 0)
+ goto skip;
+#endif
+
+ result = snmp_oid_compare(name, *length, newname, j);
+ if (exact && (result == 0)) {
+ memcpy(&savpcb, &in6pcb, sizeof(savpcb));
+ savnameLen = j;
+ memcpy(savname, newname, j * sizeof(oid));
+ found++;
+ break;
+ } else if (!exact && (result < 0)) {
+ /*
+ * take the least greater one
+ */
+ if ((savnameLen == 0) ||
+ (snmp_oid_compare(savname, savnameLen, newname, j) > 0)) {
+ memcpy(&savpcb, &in6pcb, sizeof(savpcb));
+ savnameLen = j;
+ memcpy(savname, newname, j * sizeof(oid));
+ found++;
+ }
+ }
+
+ skip:
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
+ p = (caddr_t)in6pcb.in6p_queue.cqe_next;
+#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
+ p = (caddr_t) in6pcb.in6p_next;
+#else
+ xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+#endif
+ }
+#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
+ free(sysctl_buf);
+#endif
+ DEBUGMSGTL(("mibII/ipv6", "found=%d\n", found));
+ if (!found)
+ return NULL;
+ *length = savnameLen;
+ memcpy((char *) name, (char *) savname, *length * sizeof(oid));
+ memcpy(&in6pcb, &savpcb, sizeof(savpcb));
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+/*
+ DEBUGMSGTL(("mibII/ipv6", "var_tcp6 found: "));
+ DEBUGMSGOID(("mibII/ipv6", name, *length));
+ DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+*/
+ DEBUGMSGTL(("mibII/ipv6", "magic=%d\n", vp->magic));
+ switch (vp->magic) {
+ case IPV6TCPLOCALADDR:
+ *var_len = sizeof(struct in6_addr);
+ return (u_char *) & in6pcb.in6p_laddr.s6_addr[0];
+ case IPV6TCPLOCALPORT:
+ long_return = ntohs(in6pcb.in6p_lport);
+ return (u_char *) & long_return;
+ case IPV6TCPREMOTEADDR:
+ *var_len = sizeof(struct in6_addr);
+ return (u_char *) & in6pcb.in6p_faddr.s6_addr[0];
+ case IPV6TCPREMOTEPORT:
+ long_return = ntohs(in6pcb.in6p_fport);
+ return (u_char *) & long_return;
+ case IPV6TCPIFINDEX:
+ if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+ long_return =
+ ntohs(*(uint16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+ else
+ long_return = 0;
+ /*XXX*/ return (u_char *) & long_return;
+ case IPV6TCPCONNSTATE:
+ long_return = tcp6statemap[tcp6cb.t_state];
+ return (u_char *) & long_return;
+ default:
+ break;
+ }
+ ERROR_MSG("");
+ return NULL;
+}
+
+#else /* ! TCP6 */
+
+static int mapTcpState( int val)
+{
+ static int tcpstatemap[16 /*TCP_NSTATES*/];
+ static int initialized = 0;
+
+ if (!initialized) {
+ memset(tcpstatemap, 0, sizeof(tcpstatemap));
+
+ tcpstatemap[TCPS_CLOSED] = 1;
+ tcpstatemap[TCPS_LISTEN] = 2;
+ tcpstatemap[TCPS_SYN_SENT] = 3;
+ tcpstatemap[TCPS_SYN_RECEIVED] = 4;
+ tcpstatemap[TCPS_ESTABLISHED] = 5;
+ tcpstatemap[TCPS_CLOSE_WAIT] = 8;
+ tcpstatemap[TCPS_FIN_WAIT_1] = 6;
+ tcpstatemap[TCPS_CLOSING] = 10;
+ tcpstatemap[TCPS_LAST_ACK] = 9;
+ tcpstatemap[TCPS_FIN_WAIT_2] = 7;
+ tcpstatemap[TCPS_TIME_WAIT] = 11;
+ initialized++;
+ }
+ /* XXX GIGO 0 is an invalid state */
+ return (tcpstatemap[0x0f & val]);
+}
+
+u_char *
+var_tcp6(register struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ oid newname[MAX_OID_LEN];
+ oid savname[MAX_OID_LEN];
+ int result;
+ int i, j;
+ caddr_t p;
+ static struct in6pcb in6pcb, savpcb;
+ struct tcpcb tcpcb;
+ int found, savnameLen;
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
+ struct inpcbtable tcbtable;
+ caddr_t first;
+#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
+ char *sysctl_buf;
+ struct xinpgen *xig, *oxig;
+#else
+ static struct in6pcb tcb6;
+#endif
+
+ DEBUGMSGTL(("mibII/ipv6", "var_tcp6: "));
+ DEBUGMSGOID(("mibII/ipv6", name, *length));
+ DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
+ if (!auto_nlist("tcbtable", (char *) &tcbtable, sizeof(tcbtable)))
+ return NULL;
+ first = p = (caddr_t)tcbtable.inpt_queue.cqh_first;
+#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
+ if (!auto_nlist("tcb6", (char *) &tcb6, sizeof(tcb6)))
+ return NULL;
+ p = (caddr_t) tcb6.in6p_next;
+#else
+ {
+ const char *tcblist = "net.inet.tcp.pcblist";
+ const char *pp = tcblist;
+ size_t len;
+
+ if (sysctlbyname(tcblist, 0, &len, 0, 0) < 0)
+ return NULL;
+ if ((sysctl_buf = malloc(len)) == NULL)
+ return NULL;
+ tcblist = pp;
+ if (sysctlbyname(tcblist, sysctl_buf, &len, 0, 0) < 0) {
+ free(sysctl_buf);
+ return NULL;
+ }
+ oxig = (struct xinpgen *) sysctl_buf;
+ xig = (struct xinpgen *) ((char *) oxig + oxig->xig_len);
+ p = (caddr_t) ((char *) xig); /* silence compiler warning */
+ }
+#endif
+ found = savnameLen = 0;
+ memcpy((char *) newname, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+ DEBUGMSGTL(("mibII/ipv6", "start: p=%x\n", p));
+ while (
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
+ p && p != first
+#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
+ p && (u_long) p != auto_nlist_value("tcb6")
+#else
+ xig->xig_len > sizeof(struct xinpgen)
+#endif
+ ) {
+ DEBUGMSGTL(("mibII/ipv6", "looping: p=%x\n", p));
+
+#if !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
+ if (!NETSNMP_KLOOKUP(p, (char *) &in6pcb, sizeof(in6pcb))) {
+ DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcb6 at %x\n",
+ p));
+ found = 0;
+ break;
+ }
+#else
+ in6pcb = ((struct xinpcb *) xig)->xi_inp;
+#endif
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
+ if (in6pcb.in6p_af != AF_INET6)
+ goto skip;
+#elif (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
+ if (0 == (in6pcb.inp_vflag & INP_IPV6))
+ goto skip;
+#endif
+ if (!NETSNMP_KLOOKUP(in6pcb.in6p_ppcb, (char *) &tcpcb, sizeof(tcpcb))) {
+ DEBUGMSGTL(("mibII/ipv6", "klookup fail for tcb6.tcpcb at %x\n",
+ in6pcb.in6p_ppcb));
+ found = 0;
+ break;
+ }
+ j = (int) vp->namelen;
+ for (i = 0; i < sizeof(struct in6_addr); i++)
+ newname[j++] = in6pcb.in6p_laddr.s6_addr[i];
+ newname[j++] = ntohs(in6pcb.in6p_lport);
+ for (i = 0; i < sizeof(struct in6_addr); i++)
+ newname[j++] = in6pcb.in6p_faddr.s6_addr[i];
+ newname[j++] = ntohs(in6pcb.in6p_fport);
+ if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+ newname[j++] =
+ ntohs(*(uint16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+ else
+ newname[j++] = 0;
+ /*XXX*/ newname[j++] = mapTcpState((int)tcpcb.t_state);
+
+ DEBUGMSGTL(("mibII/ipv6", "var_tcp6 new: %d %d ",
+ (int) vp->namelen, j));
+ DEBUGMSGOID(("mibII/ipv6", newname, j));
+ DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+
+#if 1 /* this is very odd but sometimes happen, and cause infinite loop */
+ if (ntohs(in6pcb.in6p_lport) == 0)
+ goto skip;
+#endif
+ result = snmp_oid_compare(name, *length, newname, j);
+ if (exact && (result == 0)) {
+ memcpy(&savpcb, &in6pcb, sizeof(savpcb));
+ savnameLen = j;
+ memcpy(savname, newname, j * sizeof(oid));
+ found++;
+ break;
+ } else if (!exact && (result < 0)) {
+ /*
+ * take the least greater one
+ */
+ if ((savnameLen == 0) ||
+ (snmp_oid_compare(savname, savnameLen, newname, j) > 0)) {
+ memcpy(&savpcb, &in6pcb, sizeof(savpcb));
+ savnameLen = j;
+ memcpy(savname, newname, j * sizeof(oid));
+ found++;
+ }
+ }
+
+ skip:
+#if defined(__NetBSD__) && __NetBSD_Version__ >= 106250000 /*1.6Y*/
+ p = (caddr_t)in6pcb.in6p_queue.cqe_next;
+#elif !(defined(__FreeBSD__) && __FreeBSD__ >= 3) && !defined(darwin)
+ p = (caddr_t) in6pcb.in6p_next;
+#else
+ xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+#endif
+ }
+#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(darwin)
+ free(sysctl_buf);
+#endif
+ DEBUGMSGTL(("mibII/ipv6", "found=%d\n", found));
+ if (!found)
+ return NULL;
+ *length = savnameLen;
+ memcpy((char *) name, (char *) savname, *length * sizeof(oid));
+ memcpy(&in6pcb, &savpcb, sizeof(savpcb));
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+/*
+ DEBUGMSGTL(("mibII/ipv6", "var_tcp6 found: "));
+ DEBUGMSGOID(("mibII/ipv6", name, *length));
+ DEBUGMSG(("mibII/ipv6", " %d\n", exact));
+*/
+ DEBUGMSGTL(("mibII/ipv6", "magic=%d\n", vp->magic));
+ switch (vp->magic) {
+ case IPV6TCPLOCALADDR:
+ *var_len = sizeof(struct in6_addr);
+ return (u_char *) & in6pcb.in6p_laddr.s6_addr[0];
+ case IPV6TCPLOCALPORT:
+ long_return = ntohs(in6pcb.in6p_lport);
+ return (u_char *) & long_return;
+ case IPV6TCPREMOTEADDR:
+ *var_len = sizeof(struct in6_addr);
+ return (u_char *) & in6pcb.in6p_faddr.s6_addr[0];
+ case IPV6TCPREMOTEPORT:
+ long_return = ntohs(in6pcb.in6p_fport);
+ return (u_char *) & long_return;
+ case IPV6TCPIFINDEX:
+ if (IN6_IS_ADDR_LINKLOCAL(&in6pcb.in6p_laddr))
+ long_return =
+ ntohs(*(uint16_t *) & in6pcb.in6p_laddr.s6_addr[2]);
+ else
+ long_return = 0;
+ /*XXX*/ return (u_char *) & long_return;
+ case IPV6TCPCONNSTATE:
+ long_return = mapTcpState((int)tcpcb.t_state);
+ return (u_char *) & long_return;
+ default:
+ break;
+ }
+ ERROR_MSG("");
+ return NULL;
+}
+
+#endif /*TCP6 */
+
+#else /* !linux / linux */
+
+/*
+ * Linux dependent part
+ */
+static unsigned long
+linux_read_ip6_stat_ulong(const char *file)
+{
+ FILE *f;
+ unsigned long value;
+ f = fopen(file, "r");
+ if (!f)
+ return 0;
+ if (fscanf(f, "%lu", &value) != 1) {
+ fclose(f);
+ return 0;
+ }
+ fclose(f);
+ return value;
+}
+
+void
+linux_read_ip6_stat(struct ip6_mib *ip6stat)
+{
+ if (!ip6stat)
+ return;
+ memset(ip6stat, 0, sizeof(*ip6stat));
+ ip6stat->Ipv6Forwarding =
+ linux_read_ip6_stat_ulong
+ ("/proc/sys/net/ipv6/conf/all/forwarding");
+ ip6stat->Ipv6DefaultHopLimit =
+ linux_read_ip6_stat_ulong
+ ("/proc/sys/net/ipv6/conf/default/hop_limit");
+}
+
+u_char *
+var_ipv6(register struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ static struct ip6_mib ip6stat;
+
+ if (header_ipv6(vp, name, length, exact, var_len, write_method)
+ == MATCH_FAILED) {
+ return NULL;
+ }
+ linux_read_ip6_stat(&ip6stat);
+
+ switch (vp->magic) {
+ case IPV6DEFAULTHOPLIMIT:
+ return (u_char *) & ip6stat.Ipv6DefaultHopLimit;
+ case IPV6FORWARDING:
+ long_return = (ip6stat.Ipv6Forwarding) ? 1 : 2;
+ return (u_char *) & long_return;
+ case IPV6INTERFACES:
+#ifdef HAVE_IF_NAMEINDEX
+ long_return = if_countifindex();
+ if (long_return < 0)
+ break;
+ return (u_char *) & long_return;
+#endif
+ break;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipv6\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+u_char *
+var_ifv6Entry(register struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#ifndef HAVE_IF_NAMEINDEX
+ return NULL;
+#else
+ int interface;
+ int max;
+ char *p;
+ struct ifreq ifr;
+ int s;
+
+ max = if_maxifindex();
+ if (max < 0)
+ return NULL;
+
+ if (header_ipv6_scan
+ (vp, name, length, exact, var_len, write_method, 1, max)
+ == MATCH_FAILED) {
+ return NULL;
+ }
+ interface = name[*length - 1];
+ DEBUGMSGTL(("mibII/ipv6", "interface: %d(%s)\n",
+ interface, if_getname(interface)));
+ if (interface > max)
+ return NULL;
+
+ switch (vp->magic) {
+ case IPV6IFDESCR:
+ p = if_getname(interface);
+ if (p) {
+ *var_len = strlen(p);
+ return p;
+ }
+ break;
+ case IPV6IFLOWLAYER:
+ /*
+ * should check if type, this is a hard one...
+ */
+ *var_len = nullOidLen;
+ return (u_char *) nullOid;
+ case IPV6IFEFFECTMTU:
+ {
+ p = if_getname(interface);
+ if (!p)
+ break;
+ memset(&ifr, 0, sizeof(ifr));
+ ifr.ifr_addr.sa_family = AF_INET6;
+ strncpy(ifr.ifr_name, p, sizeof(ifr.ifr_name));
+ if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
+ break;
+ if (ioctl(s, SIOCGIFMTU, (caddr_t) & ifr) < 0) {
+ close(s);
+ break;
+ }
+ long_return = ifr.ifr_mtu;
+ close(s);
+ return (u_char *) & long_return;
+ }
+ case IPV6IFPHYSADDRESS:
+ {
+ static struct ifreq buf;
+ int ok = 0;
+ p = if_getname(interface);
+ if (!p)
+ break;
+ memset(&ifr, 0, sizeof(ifr));
+ ifr.ifr_addr.sa_family = AF_INET6;
+ strncpy(ifr.ifr_name, p, sizeof(ifr.ifr_name));
+ if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
+ break;
+ if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) {
+ memset(buf.ifr_hwaddr.sa_data, 0,
+ sizeof(buf.ifr_hwaddr.sa_data));
+ *var_len = 0;
+ } else {
+ memcpy(buf.ifr_hwaddr.sa_data, ifr.ifr_hwaddr.sa_data, 6);
+ *var_len = (buf.ifr_hwaddr.sa_data[0] |
+ buf.ifr_hwaddr.sa_data[1] |
+ buf.ifr_hwaddr.sa_data[2] |
+ buf.ifr_hwaddr.sa_data[3] |
+ buf.ifr_hwaddr.sa_data[4] |
+ buf.ifr_hwaddr.sa_data[5]) ? 6 : 0;
+ ok = 1;
+ }
+ close(s);
+ return (ok ? ((u_char *) & buf.ifr_hwaddr.sa_data) : NULL);
+ }
+ case IPV6IFADMSTATUS:
+ case IPV6IFOPERSTATUS:
+ {
+ int flag = 0;
+ p = if_getname(interface);
+ if (!p)
+ break;
+ memset(&ifr, 0, sizeof(ifr));
+ ifr.ifr_addr.sa_family = AF_INET6;
+ strncpy(ifr.ifr_name, p, sizeof(ifr.ifr_name));
+ if ((s = socket(ifr.ifr_addr.sa_family, SOCK_DGRAM, 0)) < 0)
+ break;
+ if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
+ close(s);
+ break;
+ }
+ close(s);
+ switch (vp->magic) {
+ case IPV6IFADMSTATUS:
+ flag = IFF_RUNNING;
+ break;
+ case IPV6IFOPERSTATUS:
+ flag = IFF_UP;
+ break;
+ }
+ long_return = (ifr.ifr_flags & flag) ? 1 : 2;
+ return (u_char *) & long_return;
+ }
+ }
+ return NULL;
+#endif
+}
+
+u_char *
+var_icmpv6Entry(register struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ return NULL;
+}
+
+u_char *
+var_udp6(register struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ return NULL;
+}
+
+u_char *
+var_tcp6(register struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ return NULL;
+}
+
+/*
+ * misc functions (against broken kernels )
+ */
+void
+linux_if_freenameindex(struct if_nameindex *ifndx)
+{
+ int i;
+ if (!ifndx)
+ return;
+ for (i = 1; ifndx[i].if_index; i++) {
+ free(ifndx[i].if_name);
+ }
+ free(ifndx);
+}
+
+#define linux_freeinternalnameindex(ifni, max) { \
+ int i; \
+ for (i=1; i<=max; i++){ \
+ if (ifni[i].if_name) free(ifni[i].if_name); \
+ } \
+ free(ifni); \
+}
+
+#define LINUX_PROC_NET_IFINET6 "/proc/net/if_inet6"
+struct if_nameindex *
+linux_if_nameindex(void)
+{
+ FILE *f;
+ unsigned long if_index;
+ char if_name[256];
+ struct if_nameindex *ifndx = NULL, *iflist = NULL, *tmp;
+ int i, j;
+ int maxidx, if_count = 0;
+
+ f = fopen(LINUX_PROC_NET_IFINET6, "r");
+ if (f) {
+ if_count = 0;
+ maxidx = -1;
+ while (!feof(f)) {
+ if (fscanf(f, "%*s %lx %*x %*x %*x %s",
+ &if_index, if_name) != 2)
+ continue;
+ if (if_index == 0)
+ continue;
+ if_name[sizeof(if_name) - 1] = '\0';
+ if (maxidx < 0 || maxidx < if_index) {
+
+ tmp =
+ realloc(iflist,
+ (sizeof(struct if_nameindex)) * (if_index +
+ 2));
+ if (!tmp) {
+ linux_freeinternalnameindex(iflist, if_index);
+ if_count = 0;
+ iflist = NULL;
+ break;
+ }
+ iflist = tmp;
+ for (i = maxidx + 1; i <= if_index; i++)
+ memset(&iflist[i], 0, sizeof(struct if_nameindex));
+ memset(&iflist[if_index + 1], 0,
+ sizeof(struct if_nameindex));
+ maxidx = if_index;
+ }
+ if (iflist[if_index].if_index == 0) {
+ if_count++;
+ iflist[if_index].if_index = if_index;
+ iflist[if_index].if_name = strdup(if_name);
+ if (!iflist[if_index].if_name) {
+ linux_freeinternalnameindex(iflist, if_index);
+ if_count = 0;
+ iflist = NULL;
+ break;
+ }
+ }
+ }
+ fclose(f);
+ if (if_count > 0) {
+ ifndx = malloc(sizeof(struct if_nameindex) * (if_count + 1));
+ j = 0;
+ for (i = 1; i <= maxidx; i++) {
+ if (iflist[i].if_index > 0 && *iflist[i].if_name) {
+ memcpy(&ifndx[j++], &iflist[i],
+ sizeof(struct if_nameindex));
+ }
+ }
+ ifndx[j].if_index = 0;
+ ifndx[j].if_name = NULL;
+ }
+ free(iflist);
+ }
+ return (ifndx);
+}
+
+#endif /* linux */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipv6.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipv6.h
new file mode 100644
index 0000000000..a029baff09
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/ipv6.h
@@ -0,0 +1,144 @@
+/*
+ * Template MIB group interface - ipv6.h
+ *
+ */
+
+#ifndef _MIBGROUP_IPV6_H
+#define _MIBGROUP_IPV6_H
+
+#ifdef linux
+struct ip6_mib {
+ unsigned long Ipv6DefaultHopLimit;
+ unsigned long Ipv6Forwarding;
+};
+#endif
+
+config_require(mibII/ifTable mibII/at mibII/var_route mibII/route_write)
+config_add_mib(IPV6-ICMP-MIB:IPV6-MIB:IPV6-TCP-MIB:IPV6-UDP-MIB)
+config_arch_require(solaris2, kernel_sunos5)
+#include "var_route.h"
+#include "route_write.h"
+extern void init_ipv6(void);
+extern FindVarMethod var_ipv6;
+extern FindVarMethod var_ifv6Entry;
+extern FindVarMethod var_icmpv6Entry;
+extern FindVarMethod var_udp6;
+extern FindVarMethod var_tcp6;
+
+#include "at.h" /* for var_atEntry() */
+
+#define IPV6FORWARDING 1
+#define IPV6DEFAULTHOPLIMIT 2
+#define IPV6INTERFACES 3
+#define IPV6IFTBLLASTCHG 4
+
+#define IPV6IFDESCR 2
+#define IPV6IFLOWLAYER 3
+#define IPV6IFEFFECTMTU 4
+#define IPV6IFREASMMAXSIZE 5
+#define IPV6IFTOKEN 6
+#define IPV6IFTOKENLEN 7
+#define IPV6IFPHYSADDRESS 8
+#define IPV6IFADMSTATUS 9
+#define IPV6IFOPERSTATUS 10
+#define IPV6IFLASTCHANGE 11
+
+#define IPV6IFSTATSINRCVS 12
+#define IPV6IFSTATSINHDRERRS 13
+#define IPV6IFSTATSTOOBIGERRS 14
+#define IPV6IFSTATSINNOROUTES 15
+#define IPV6IFSTATSINADDRERRS 16
+#define IPV6IFSTATSINUNKNOWPROTS 17
+#define IPV6IFSTATSINTRUNCATPKTS 18
+#define IPV6IFSTATSINDISCARDS 19
+#define IPV6IFSTATSINDELIVERS 20
+#define IPV6IFSTATSOUTFORWDATAS 21
+#define IPV6IFSTATSOUTREQS 22
+#define IPV6IFSTATSOUTDISCARDS 23
+#define IPV6IFSTATSOUTFRAGOKS 24
+#define IPV6IFSTATSOUTFRAGFAILS 25
+#define IPV6IFSTATSOUTFRAGCREATS 26
+#define IPV6IFSTATSOUTREASMREQS 27
+#define IPV6IFSTATSOUTREASMOKS 28
+#define IPV6IFSTATSOUTREASMFAILS 29
+#define IPV6IFSTATSINMCASTPKTS 30
+#define IPV6IFSTATSOUTMCASTPKTS 31
+
+#define IPV6ADDRPREFIXONLINKFLG 3
+#define IPV6ADDRPREFIXAUTONOMOUSFLAG 4
+#define IPV6ADDRPREFIXADVPREFERLIFE 5
+#define IPV6ADDRPREFIXVALIDLIFE 6
+
+#define IPV6ADDRPFXLEN 7
+#define IPV6ADDRTYPE 8
+#define IPV6ADDRANYCASTFLAG 9
+#define IPV6ADDRSTATUS 10
+
+#define IPV6INSTALLEDROUTES 5
+#define IPV6DISCARDEDROUTES 6
+
+#define IPV6ROUTEIFINDEX 4
+#define IPV6ROUTENEXTHOP 5
+#define IPV6ROUTETYPE 6
+#define IPV6ROUTEPROTOCOL 7
+#define IPV6ROUTEPOLICY 8
+#define IPV6ROUTEAGE 9
+#define IPV6ROUTENEXTHOPRDI 10
+#define IPV6ROUTEMETRIC 11
+#define IPV6ROUTEWEIGHT 12
+#define IPV6ROUTEINFO 13
+#define IPV6ROUTEVALID 14
+
+#define IPV6NETTOMEDIAPHYADDR 2
+#define IPV6NETTOMEDIATYPE 3
+#define IPV6NETTOMEDIASTATE 4
+#define IPV6NETTOMEDIALASTUPDATE 5
+#define IPV6NETTOMEDIAVALID 6
+
+#define IPV6IFICMPINMSG 1
+#define IPV6IFICMPINERRORS 2
+#define IPV6IFICMPINDSTUNRCHS 3
+#define IPV6IFICMPINADMPROHS 4
+#define IPV6IFICMPINTIMEXCDS 5
+#define IPV6IFICMPINPARMPROBS 6
+#define IPV6IFICMPINPKTTOOBIGS 7
+#define IPV6IFICMPINECHOS 8
+#define IPV6IFICMPINECHOREPS 9
+#define IPV6IFICMPINRTRSLICITS 10
+#define IPV6IFICMPINRTRADVS 11
+#define IPV6IFICMPINNBRSLICITS 12
+#define IPV6IFICMPINNBRADVS 13
+#define IPV6IFICMPINREDIRECTS 14
+#define IPV6IFICMPINGRPMEQERYS 15
+#define IPV6IFICMPINGRPMERSPS 16
+#define IPV6IFICMPINGRPMEREDCS 17
+#define IPV6IFICMPOUTMSG 18
+#define IPV6IFICMPOUTERRORS 19
+#define IPV6IFICMPOUTDSTUNRCHS 20
+#define IPV6IFICMPOUTADMPROHS 21
+#define IPV6IFICMPOUTTIMEXCDS 22
+#define IPV6IFICMPOUTPARMPROBS 23
+#define IPV6IFICMPOUTPKTTOOBIGS 24
+#define IPV6IFICMPOUTECHOS 25
+#define IPV6IFICMPOUTECHOREPS 26
+#define IPV6IFICMPOUTRTRSLICITS 27
+#define IPV6IFICMPOUTRTRADVS 28
+#define IPV6IFICMPOUTNBRSLICITS 29
+#define IPV6IFICMPOUTNBRADVS 30
+#define IPV6IFICMPOUTREDIRECTS 31
+#define IPV6IFICMPOUTGRPMEQERYS 32
+#define IPV6IFICMPOUTGRPMERSPS 33
+#define IPV6IFICMPOUTGRPMEREDCS 34
+
+#define IPV6UDPLOCALADDRESS 1
+#define IPV6UDPLOCALPORT 2
+#define IPV6UDPIFINDEX 3
+
+#define IPV6TCPLOCALADDR 1
+#define IPV6TCPLOCALPORT 2
+#define IPV6TCPREMOTEADDR 3
+#define IPV6TCPREMOTEPORT 4
+#define IPV6TCPIFINDEX 5
+#define IPV6TCPCONNSTATE 6
+
+#endif /* _MIBGROUP_IPV6_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/kernel_linux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/kernel_linux.c
new file mode 100644
index 0000000000..bb6f867c69
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/kernel_linux.c
@@ -0,0 +1,221 @@
+/*
+ * Linux kernel interface
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#include <sys/types.h>
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#include "kernel_linux.h"
+
+struct ip_mib cached_ip_mib;
+struct icmp_mib cached_icmp_mib;
+struct tcp_mib cached_tcp_mib;
+struct udp_mib cached_udp_mib;
+
+#define IP_STATS_LINE "Ip: %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu"
+#define ICMP_STATS_LINE "Icmp: %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu"
+#define TCP_STATS_LINE "Tcp: %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu"
+#define UDP_STATS_LINE "Udp: %lu %lu %lu %lu"
+#define UDP6_STATS_LINE "Udp6"
+
+#define IP_STATS_PREFIX_LEN 4
+#define ICMP_STATS_PREFIX_LEN 6
+#define TCP_STATS_PREFIX_LEN 5
+#define UDP_STATS_PREFIX_LEN 5
+#define UDP6_STATS_PREFIX_LEN 4
+
+
+int
+linux_read_mibII_stats(void)
+{
+ FILE *in = fopen("/proc/net/snmp", "r");
+#ifdef NETSNMP_ENABLE_IPV6
+ FILE *in6;
+ unsigned long value;
+#endif
+ char line[1024];
+
+ if (!in) {
+ DEBUGMSGTL(("mibII/kernel_linux","Unable to open /proc/net/snmp"));
+ return -1;
+ }
+
+
+ while (line == fgets(line, sizeof(line), in)) {
+ if (!strncmp(line, IP_STATS_LINE, IP_STATS_PREFIX_LEN)) {
+ sscanf(line, IP_STATS_LINE,
+ &cached_ip_mib.ipForwarding,
+ &cached_ip_mib.ipDefaultTTL,
+ &cached_ip_mib.ipInReceives,
+ &cached_ip_mib.ipInHdrErrors,
+ &cached_ip_mib.ipInAddrErrors,
+ &cached_ip_mib.ipForwDatagrams,
+ &cached_ip_mib.ipInUnknownProtos,
+ &cached_ip_mib.ipInDiscards,
+ &cached_ip_mib.ipInDelivers,
+ &cached_ip_mib.ipOutRequests,
+ &cached_ip_mib.ipOutDiscards,
+ &cached_ip_mib.ipOutNoRoutes,
+ &cached_ip_mib.ipReasmTimeout,
+ &cached_ip_mib.ipReasmReqds,
+ &cached_ip_mib.ipReasmOKs,
+ &cached_ip_mib.ipReasmFails,
+ &cached_ip_mib.ipFragOKs,
+ &cached_ip_mib.ipFragFails,
+ &cached_ip_mib.ipFragCreates);
+ cached_ip_mib.ipRoutingDiscards = 0; /* XXX */
+ } else if (!strncmp(line, ICMP_STATS_LINE, ICMP_STATS_PREFIX_LEN)) {
+ sscanf(line, ICMP_STATS_LINE,
+ &cached_icmp_mib.icmpInMsgs,
+ &cached_icmp_mib.icmpInErrors,
+ &cached_icmp_mib.icmpInDestUnreachs,
+ &cached_icmp_mib.icmpInTimeExcds,
+ &cached_icmp_mib.icmpInParmProbs,
+ &cached_icmp_mib.icmpInSrcQuenchs,
+ &cached_icmp_mib.icmpInRedirects,
+ &cached_icmp_mib.icmpInEchos,
+ &cached_icmp_mib.icmpInEchoReps,
+ &cached_icmp_mib.icmpInTimestamps,
+ &cached_icmp_mib.icmpInTimestampReps,
+ &cached_icmp_mib.icmpInAddrMasks,
+ &cached_icmp_mib.icmpInAddrMaskReps,
+ &cached_icmp_mib.icmpOutMsgs,
+ &cached_icmp_mib.icmpOutErrors,
+ &cached_icmp_mib.icmpOutDestUnreachs,
+ &cached_icmp_mib.icmpOutTimeExcds,
+ &cached_icmp_mib.icmpOutParmProbs,
+ &cached_icmp_mib.icmpOutSrcQuenchs,
+ &cached_icmp_mib.icmpOutRedirects,
+ &cached_icmp_mib.icmpOutEchos,
+ &cached_icmp_mib.icmpOutEchoReps,
+ &cached_icmp_mib.icmpOutTimestamps,
+ &cached_icmp_mib.icmpOutTimestampReps,
+ &cached_icmp_mib.icmpOutAddrMasks,
+ &cached_icmp_mib.icmpOutAddrMaskReps);
+ } else if (!strncmp(line, TCP_STATS_LINE, TCP_STATS_PREFIX_LEN)) {
+ int ret = sscanf(line, TCP_STATS_LINE,
+ &cached_tcp_mib.tcpRtoAlgorithm,
+ &cached_tcp_mib.tcpRtoMin,
+ &cached_tcp_mib.tcpRtoMax,
+ &cached_tcp_mib.tcpMaxConn,
+ &cached_tcp_mib.tcpActiveOpens,
+ &cached_tcp_mib.tcpPassiveOpens,
+ &cached_tcp_mib.tcpAttemptFails,
+ &cached_tcp_mib.tcpEstabResets,
+ &cached_tcp_mib.tcpCurrEstab,
+ &cached_tcp_mib.tcpInSegs,
+ &cached_tcp_mib.tcpOutSegs,
+ &cached_tcp_mib.tcpRetransSegs,
+ &cached_tcp_mib.tcpInErrs,
+ &cached_tcp_mib.tcpOutRsts);
+ cached_tcp_mib.tcpInErrsValid = (ret > 12) ? 1 : 0;
+ cached_tcp_mib.tcpOutRstsValid = (ret > 13) ? 1 : 0;
+ } else if (!strncmp(line, UDP_STATS_LINE, UDP_STATS_PREFIX_LEN)) {
+ sscanf(line, UDP_STATS_LINE,
+ &cached_udp_mib.udpInDatagrams,
+ &cached_udp_mib.udpNoPorts,
+ &cached_udp_mib.udpInErrors,
+ &cached_udp_mib.udpOutDatagrams);
+ }
+ }
+ fclose(in);
+
+#ifdef NETSNMP_ENABLE_IPV6
+ in6 = fopen("/proc/net/snmp6", "r");
+ if (in6) {
+
+ while (line == fgets(line, sizeof(line), in6)) {
+
+ if (('U' != line[0]) ||
+ (0 != strncmp(line, UDP6_STATS_LINE, UDP6_STATS_PREFIX_LEN)))
+ continue;
+
+ sscanf(line, "%*s %lu" , &value);
+
+ if ('O' == line[4]) /* Udp6OutDatagrams */
+ cached_udp_mib.udpOutDatagrams += value;
+ else if ('N' == line[4]) /* Udp6NoPorts */
+ cached_udp_mib.udpNoPorts += value;
+ else if ('D' == line[6]) /* Udp6InDatagrams */
+ cached_udp_mib.udpInDatagrams += value;
+ else if ('E' == line[6]) /* Udp6InErrors */
+ cached_udp_mib.udpInErrors += value;
+
+ }
+ fclose(in6);
+ } else {
+ DEBUGMSGTL(("mibII/kernel_linux","Unable to open /proc/net/snmp6"));
+ }
+
+#endif
+
+ /*
+ * Tweak illegal values:
+ *
+ * valid values for ipForwarding are 1 == yup, 2 == nope
+ * a 0 is forbidden, so patch:
+ */
+ if (!cached_ip_mib.ipForwarding)
+ cached_ip_mib.ipForwarding = 2;
+
+ /*
+ * 0 is illegal for tcpRtoAlgorithm
+ * so assume `other' algorithm:
+ */
+ if (!cached_tcp_mib.tcpRtoAlgorithm)
+ cached_tcp_mib.tcpRtoAlgorithm = 1;
+ return 0;
+}
+
+int
+linux_read_ip_stat(struct ip_mib *ipstat)
+{
+ memset((char *) ipstat, (0), sizeof(*ipstat));
+ if (linux_read_mibII_stats() == -1)
+ return -1;
+ memcpy((char *) ipstat, (char *) &cached_ip_mib, sizeof(*ipstat));
+ return 0;
+}
+
+int
+linux_read_icmp_stat(struct icmp_mib *icmpstat)
+{
+ memset((char *) icmpstat, (0), sizeof(*icmpstat));
+ if (linux_read_mibII_stats() == -1)
+ return -1;
+ memcpy((char *) icmpstat, (char *) &cached_icmp_mib,
+ sizeof(*icmpstat));
+ return 0;
+}
+
+int
+linux_read_tcp_stat(struct tcp_mib *tcpstat)
+{
+ memset((char *) tcpstat, (0), sizeof(*tcpstat));
+ if (linux_read_mibII_stats() == -1)
+ return -1;
+ memcpy((char *) tcpstat, (char *) &cached_tcp_mib, sizeof(*tcpstat));
+ return 0;
+}
+
+int
+linux_read_udp_stat(struct udp_mib *udpstat)
+{
+ memset((char *) udpstat, (0), sizeof(*udpstat));
+ if (linux_read_mibII_stats() == -1)
+ return -1;
+ memcpy((char *) udpstat, (char *) &cached_udp_mib, sizeof(*udpstat));
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/kernel_linux.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/kernel_linux.h
new file mode 100644
index 0000000000..fb7db96113
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/kernel_linux.h
@@ -0,0 +1,93 @@
+/*
+ * MIB statistics gathering routines
+ * for Linux architecture
+ */
+
+#ifndef _MIBGROUP_KERNEL_LINUX_H
+#define _MIBGROUP_KERNEL_LINUX_H
+
+struct ip_mib {
+ unsigned long ipForwarding;
+ unsigned long ipDefaultTTL;
+ unsigned long ipInReceives;
+ unsigned long ipInHdrErrors;
+ unsigned long ipInAddrErrors;
+ unsigned long ipForwDatagrams;
+ unsigned long ipInUnknownProtos;
+ unsigned long ipInDiscards;
+ unsigned long ipInDelivers;
+ unsigned long ipOutRequests;
+ unsigned long ipOutDiscards;
+ unsigned long ipOutNoRoutes;
+ unsigned long ipReasmTimeout;
+ unsigned long ipReasmReqds;
+ unsigned long ipReasmOKs;
+ unsigned long ipReasmFails;
+ unsigned long ipFragOKs;
+ unsigned long ipFragFails;
+ unsigned long ipFragCreates;
+ unsigned long ipRoutingDiscards;
+};
+
+struct icmp_mib {
+ unsigned long icmpInMsgs;
+ unsigned long icmpInErrors;
+ unsigned long icmpInDestUnreachs;
+ unsigned long icmpInTimeExcds;
+ unsigned long icmpInParmProbs;
+ unsigned long icmpInSrcQuenchs;
+ unsigned long icmpInRedirects;
+ unsigned long icmpInEchos;
+ unsigned long icmpInEchoReps;
+ unsigned long icmpInTimestamps;
+ unsigned long icmpInTimestampReps;
+ unsigned long icmpInAddrMasks;
+ unsigned long icmpInAddrMaskReps;
+ unsigned long icmpOutMsgs;
+ unsigned long icmpOutErrors;
+ unsigned long icmpOutDestUnreachs;
+ unsigned long icmpOutTimeExcds;
+ unsigned long icmpOutParmProbs;
+ unsigned long icmpOutSrcQuenchs;
+ unsigned long icmpOutRedirects;
+ unsigned long icmpOutEchos;
+ unsigned long icmpOutEchoReps;
+ unsigned long icmpOutTimestamps;
+ unsigned long icmpOutTimestampReps;
+ unsigned long icmpOutAddrMasks;
+ unsigned long icmpOutAddrMaskReps;
+};
+
+struct udp_mib {
+ unsigned long udpInDatagrams;
+ unsigned long udpNoPorts;
+ unsigned long udpInErrors;
+ unsigned long udpOutDatagrams;
+};
+
+struct tcp_mib {
+ unsigned long tcpRtoAlgorithm;
+ unsigned long tcpRtoMin;
+ unsigned long tcpRtoMax;
+ unsigned long tcpMaxConn;
+ unsigned long tcpActiveOpens;
+ unsigned long tcpPassiveOpens;
+ unsigned long tcpAttemptFails;
+ unsigned long tcpEstabResets;
+ unsigned long tcpCurrEstab;
+ unsigned long tcpInSegs;
+ unsigned long tcpOutSegs;
+ unsigned long tcpRetransSegs;
+ unsigned long tcpInErrs;
+ unsigned long tcpOutRsts;
+ short tcpInErrsValid;
+ short tcpOutRstsValid;
+};
+
+
+int linux_read_ip_stat(struct ip_mib *);
+int linux_read_icmp_stat(struct icmp_mib *);
+int linux_read_udp_stat(struct udp_mib *);
+int linux_read_tcp_stat(struct tcp_mib *);
+
+#endif /* _MIBGROUP_KERNEL_LINUX_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/mibII_common.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/mibII_common.h
new file mode 100644
index 0000000000..5200c3a1d9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/mibII_common.h
@@ -0,0 +1,111 @@
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_SYS_SYSMP_H
+#include <sys/sysmp.h>
+#endif
+#if HAVE_SYS_TCPIPSTATS_H
+#include <sys/tcpipstats.h>
+#endif
+#if defined(IFNET_NEEDS_KERNEL) && !defined(_KERNEL)
+#define _KERNEL 1
+#define _I_DEFINED_KERNEL
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#if HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#ifdef _I_DEFINED_KERNEL
+#undef _KERNEL
+#endif
+
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#if HAVE_NETINET_IN_SYSTM_H
+#include <netinet/in_systm.h>
+#endif
+#if HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif
+#if HAVE_SYS_QUEUE_H
+#include <sys/queue.h>
+#endif
+/* IRIX 6.5 build breaks on sys/socketvar.h because _KMEMUSER brings in
+ sys/pda.h which doesn't compile */
+#ifndef irix6
+#if HAVE_SYS_SOCKETVAR_H
+#include <sys/socketvar.h>
+#endif
+#endif /* irix6 */
+#if HAVE_NETINET_IP_VAR_H
+#include <netinet/ip_var.h>
+#endif
+#ifdef NETSNMP_ENABLE_IPV6
+#if HAVE_NETNETSNMP_ENABLE_IPV6_IP6_VAR_H
+#include <netinet6/ip6_var.h>
+#endif
+#endif
+#if HAVE_NETINET_IN_PCB_H
+#include <netinet/in_pcb.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+
+#ifdef solaris2
+#include "kernel_sunos5.h"
+#else
+#include "kernel.h"
+#endif
+#ifdef linux
+#include "kernel_linux.h"
+#endif
+ /* or MIB_xxxCOUNTER_SYMBOL || hpux11 */
+#ifdef hpux
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif
+
+#ifdef cygwin
+#include <windows.h>
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/mta_sendmail.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/mta_sendmail.c
new file mode 100644
index 0000000000..ea838e5278
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/mta_sendmail.c
@@ -0,0 +1,1536 @@
+/*
+ * MTA-MIB implementation for sendmail - mibII/mta_sendmail.c
+ * Christoph Mammitzsch <Christoph.Mammitzsch@tu-clausthal.de>
+ *
+ * todo: put queue directory into description?
+ *
+ * 13.02.2002:
+ * - support sendmail 8.12 queue groups
+ *
+ *
+ * 05.04.2000:
+ *
+ * - supports sendmail 8.10.0 statistics files now
+ * - function read_option has been removed
+ *
+ * 12.04.2000:
+ *
+ * - renamed configuration tokens:
+ * sendmail config -> sendmail_config
+ * sendmail stats -> sendmail_stats
+ * sendmail queue -> sendmail_queue
+ * sendmail index -> sendmail_index
+ * sendmail statcachetime -> sendmail_stats_t
+ * sendmail dircacetime -> sendmail_queue_t
+ *
+ * - now using snmpd_register_config_handler instead of config_parse_dot_conf
+ *
+ * 15.04.2000:
+ *
+ * - introduced new function print_error
+ * - changed open_sendmailst and read_sendmailcf to use the new function
+ * - changed calls to open_sendmailst and read_sendmailcf
+ * - added some error handling to calls to chdir(), close() and closedir()
+ *
+ */
+
+
+/** "include files" */
+#ifdef __lint
+# define NETSNMP_NO_DEBUGGING 1 /* keeps lint from complaining about the DEBUGMSG* macros */
+#endif
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "mta_sendmail.h"
+
+#include <sys/types.h>
+
+#include <stdio.h>
+
+#include <ctype.h>
+
+#ifdef HAVE_STRING_H
+# include <string.h>
+#else
+# include <strings.h>
+#endif
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#else
+# define dirent direct
+# if HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif
+
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#if HAVE_STDARG_H
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#include <errno.h>
+
+ /**/
+/** "macros and variables for registering the OID tree" */
+ /*
+ * prefix for all OIDs
+ */
+
+static FindVarMethod var_mtaEntry;
+static FindVarMethod var_mtaGroupEntry;
+
+static oid mta_variables_oid[] = { 1, 3, 6, 1, 2, 1, 28 };
+
+/*
+ * bits that indicate what's needed to compute the value
+ */
+#define NEEDS_STATS (1 << 6)
+#define NEEDS_DIR (1 << 7)
+#define NEEDS (NEEDS_STATS | NEEDS_DIR)
+
+/*
+ * symbolic names for the magic values
+ */
+enum {
+ MTARECEIVEDMESSAGES = 3 | NEEDS_STATS,
+ MTASTOREDMESSAGES = 4 | NEEDS_DIR,
+ MTATRANSMITTEDMESSAGES = 5 | NEEDS_STATS,
+ MTARECEIVEDVOLUME = 6 | NEEDS_STATS,
+ MTASTOREDVOLUME = 7 | NEEDS_DIR,
+ MTATRANSMITTEDVOLUME = 8 | NEEDS_STATS,
+ MTAGROUPSTOREDMESSAGES = 17 | NEEDS_DIR,
+ MTAGROUPSTOREDVOLUME = 18 | NEEDS_DIR,
+ MTAGROUPRECEIVEDMESSAGES = 19 | NEEDS_STATS,
+ MTAGROUPREJECTEDMESSAGES = 20 | NEEDS_STATS,
+ MTAGROUPTRANSMITTEDMESSAGES = 22 | NEEDS_STATS,
+ MTAGROUPRECEIVEDVOLUME = 23 | NEEDS_STATS,
+ MTAGROUPTRANSMITTEDVOLUME = 25 | NEEDS_STATS,
+ MTAGROUPNAME = 43,
+ MTAGROUPHIERARCHY = 49
+};
+
+/*
+ * structure that tells the agent, which function returns what values
+ */
+static struct variable3 mta_variables[] = {
+ {MTARECEIVEDMESSAGES, ASN_COUNTER, RONLY, var_mtaEntry, 3, {1, 1, 1}},
+ {MTASTOREDMESSAGES, ASN_GAUGE, RONLY, var_mtaEntry, 3, {1, 1, 2}},
+ {MTATRANSMITTEDMESSAGES, ASN_COUNTER, RONLY, var_mtaEntry, 3,
+ {1, 1, 3}},
+ {MTARECEIVEDVOLUME, ASN_COUNTER, RONLY, var_mtaEntry, 3, {1, 1, 4}},
+ {MTASTOREDVOLUME, ASN_GAUGE, RONLY, var_mtaEntry, 3, {1, 1, 5}},
+ {MTATRANSMITTEDVOLUME, ASN_COUNTER, RONLY, var_mtaEntry, 3, {1, 1, 6}},
+
+ {MTAGROUPRECEIVEDMESSAGES, ASN_COUNTER, RONLY, var_mtaGroupEntry, 3,
+ {2, 1, 2}},
+ {MTAGROUPREJECTEDMESSAGES, ASN_COUNTER, RONLY, var_mtaGroupEntry, 3,
+ {2, 1, 3}},
+ {MTAGROUPSTOREDMESSAGES, ASN_GAUGE, RONLY, var_mtaGroupEntry, 3,
+ {2, 1, 4}},
+ {MTAGROUPTRANSMITTEDMESSAGES, ASN_COUNTER, RONLY, var_mtaGroupEntry, 3,
+ {2, 1, 5}},
+ {MTAGROUPRECEIVEDVOLUME, ASN_COUNTER, RONLY, var_mtaGroupEntry, 3,
+ {2, 1, 6}},
+ {MTAGROUPSTOREDVOLUME, ASN_GAUGE, RONLY, var_mtaGroupEntry, 3,
+ {2, 1, 7}},
+ {MTAGROUPTRANSMITTEDVOLUME, ASN_COUNTER, RONLY, var_mtaGroupEntry, 3,
+ {2, 1, 8}},
+ {MTAGROUPNAME, ASN_OCTET_STR, RONLY, var_mtaGroupEntry, 3, {2, 1, 25}},
+ {MTAGROUPHIERARCHY, ASN_INTEGER, RONLY, var_mtaGroupEntry, 3,
+ {2, 1, 31}}
+};
+ /**/
+/** "other macros and structures" */
+ /*
+ * for boolean values
+ */
+#ifndef FALSE
+#define FALSE 0
+#endif
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef BOOL
+#define BOOL short
+#endif
+ /*
+ * important constants
+ */
+#define FILENAMELEN 200 /* maximum length for filenames */
+#define MAXMAILERS 25 /* maximum number of mailers (copied from the sendmail sources) */
+#define MAXQUEUEGROUPS 50 /* maximum # of queue groups (copied from sendmail) */
+#define MNAMELEN 20 /* maximum length of mailernames (copied from the sendmail sources) */
+#define STAT_VERSION_8_9 2 /* version of sendmail V8.9.x statistics files (copied from the sendmail sources) */
+#define STAT_VERSION_8_10 3 /* version of sendmail V8.10.x statistics files (copied from the sendmail sources) */
+#define STAT_VERSION_8_12_QUAR 4 /* version of sendmail V8.12.x statistics files using -D_FFR_QUARANTINE (commercial and edge-living opensource*/
+#define STAT_MAGIC 0x1B1DE /* magic value to identify statistics files from sendmail V8.9.x or higher (copied from the sendmail sources) */
+ /*
+ * structure of sendmail.st file from sendmail V8.10.x (copied from the sendmail sources)
+ */
+
+struct statisticsV8_12_QUAR {
+ int stat_magic; /* magic number */
+ int stat_version; /* stat file version */
+ time_t stat_itime; /* file initialization time */
+ short stat_size; /* size of this structure */
+ long stat_cf; /* # from connections */
+ long stat_ct; /* # to connections */
+ long stat_cr; /* # rejected connections */
+ long stat_nf[MAXMAILERS]; /* # msgs from each mailer */
+ long stat_bf[MAXMAILERS]; /* kbytes from each mailer */
+ long stat_nt[MAXMAILERS]; /* # msgs to each mailer */
+ long stat_bt[MAXMAILERS]; /* kbytes to each mailer */
+ long stat_nr[MAXMAILERS]; /* # rejects by each mailer */
+ long stat_nd[MAXMAILERS]; /* # discards by each mailer */
+ long stat_nq[MAXMAILERS]; /* # quarantines by each mailer*/
+};
+
+ struct statisticsV8_10 {
+ int stat_magic; /* magic number */
+ int stat_version; /* stat file version */
+ time_t stat_itime; /* file initialization time */
+ short stat_size; /* size of this structure */
+ long stat_cf; /* # from connections */
+ long stat_ct; /* # to connections */
+ long stat_cr; /* # rejected connections */
+ long stat_nf[MAXMAILERS]; /* # msgs from each mailer */
+ long stat_bf[MAXMAILERS]; /* kbytes from each mailer */
+ long stat_nt[MAXMAILERS]; /* # msgs to each mailer */
+ long stat_bt[MAXMAILERS]; /* kbytes to each mailer */
+ long stat_nr[MAXMAILERS]; /* # rejects by each mailer */
+ long stat_nd[MAXMAILERS]; /* # discards by each mailer */
+
+};
+
+/*
+ * structure of sendmail.st file from sendmail V8.9.x (copied from the sendmail sources)
+ */
+struct statisticsV8_9 {
+ int stat_magic; /* magic number */
+ int stat_version; /* stat file version */
+ time_t stat_itime; /* file initialization time */
+ short stat_size; /* size of this structure */
+ long stat_nf[MAXMAILERS]; /* # msgs from each mailer */
+ long stat_bf[MAXMAILERS]; /* kbytes from each mailer */
+ long stat_nt[MAXMAILERS]; /* # msgs to each mailer */
+ long stat_bt[MAXMAILERS]; /* kbytes to each mailer */
+ long stat_nr[MAXMAILERS]; /* # rejects by each mailer */
+ long stat_nd[MAXMAILERS]; /* # discards by each mailer */
+};
+
+/*
+ * structure of sendmail.st file from sendmail V8.8.x (copied from the sendmail sources)
+ */
+struct statisticsV8_8 {
+ time_t stat_itime; /* file initialization time */
+ short stat_size; /* size of this structure */
+ long stat_nf[MAXMAILERS]; /* # msgs from each mailer */
+ long stat_bf[MAXMAILERS]; /* kbytes from each mailer */
+ long stat_nt[MAXMAILERS]; /* # msgs to each mailer */
+ long stat_bt[MAXMAILERS]; /* kbytes to each mailer */
+};
+ /**/
+ /*
+ * queue groups (strictly a sendmail 8.12+ thing
+ */
+ struct QDir {
+ char dir[FILENAMELEN + 1];
+ struct QDir *next;
+};
+
+struct QGrp {
+ char *name; /* name of queuegroup */
+
+ time_t last; /* last time we counted */
+ int count; /* # of files */
+ int size; /* size of files */
+
+ struct QDir *dirs; /* directories in queue group */
+};
+
+/** "static variables" */
+
+/*
+ * a list of all the queue groups, NULL terminated
+ */
+static struct QGrp qgrps[MAXQUEUEGROUPS];
+static int nqgrps = 0;
+
+static char sendmailst_fn[FILENAMELEN + 1]; /* name of statistics file */
+static int sendmailst_fh = -1; /* filehandle for statistics file */
+static char sendmailcf_fn[FILENAMELEN + 1]; /* name of sendmails config file */
+static char mailernames[MAXMAILERS][MNAMELEN + 1]; /* array of mailer names */
+static int mailers = MAXMAILERS; /* number of mailer names in array */
+
+static long *stat_nf; /* pointer to stat_nf array within the statistics structure */
+static long *stat_bf; /* pointer to stat_bf array within the statistics structure */
+static long *stat_nt; /* pointer to stat_nt array within the statistics structure */
+static long *stat_bt; /* pointer to stat_bt array within the statistics structure */
+static long *stat_nr; /* pointer to stat_nr array within the statistics structure,
+ * only valid for statistics files from sendmail >=V8.9.0 */
+static long *stat_nd; /* pointer to stat_nd array within the statistics structure,
+ * only valid for statistics files from sendmail >=V8.9.0 */
+static int stats_size; /* size of statistics structure */
+static long stats[sizeof(struct statisticsV8_12_QUAR) / sizeof(long) + 1]; /* buffer for statistics structure */
+static time_t lastreadstats; /* time stats file has been read */
+static long applindex = 1; /* ApplIndex value for OIDs */
+static long stat_cache_time = 5; /* time (in seconds) to wait before reading stats file again */
+static long dir_cache_time = 10; /* time (in seconds) to wait before scanning queue directoy again */
+
+ /**/
+/** static void print_error(int priority, BOOL config, BOOL config_only, char *function, char *format, ...)
+ *
+ * Description:
+ *
+ * Called to print errors. It uses the config_perror or the snmp_log function
+ * depending on whether the config parameter is TRUE or FALSE.
+ *
+ * Parameters:
+ *
+ * priority: priority to be used when calling the snmp_log function
+ *
+ * config: indicates whether this function has been called during the
+ * configuration process or not. If set to TRUE, the function
+ * config_perror will be used to report the error.
+ *
+ * config_only: if set to TRUE, the error will only be printed when function
+ * has been called during the configuration process.
+ *
+ * function: name of the calling function. Used when printing via snmp_log.
+ *
+ * format: format string for the error message
+ *
+ * ...: additional parameters to insert into the error message string
+ *
+ */
+#if HAVE_STDARG_H
+ static void
+print_error(int priority, BOOL config, BOOL config_only,
+ const char *function, const char *format, ...)
+#else
+ static void
+print_error(va_alist)
+ va_dcl
+#endif
+{
+ va_list ap;
+ char buffer[2 * FILENAMELEN + 200]; /* I know, that's not perfectly safe, but since I don't use more
+ * than two filenames in one error message, that should be enough */
+
+#if HAVE_STDARG_H
+ va_start(ap, format);
+#else
+ int priority;
+ BOOL config;
+ BOOL config_only;
+ const char *function;
+ const char *format;
+
+ va_start(ap);
+ priority = va_arg(ap, int);
+ config = va_arg(ap, BOOL);
+ config_only = va_arg(ap, BOOL);
+ function = va_arg(ap, char *);
+ format = va_arg(ap, char *);
+#endif
+
+ vsnprintf(buffer, sizeof(buffer), format, ap);
+
+ if (config) {
+ config_perror(buffer);
+ } else if (!config_only) {
+ snmp_log(priority, "%s: %s\n", function, buffer);
+ }
+ va_end(ap);
+}
+
+ /**/
+/** static void open_sendmailst(BOOL config)
+ *
+ * Description:
+ *
+ * Closes old sendmail.st file, then tries to open the new sendmail.st file
+ * and guess it's version. If it succeeds, it initializes the stat_*
+ * pointers and the stats_size variable.
+ *
+ * Parameters:
+ *
+ * config: TRUE if function has been called during the configuration process
+ *
+ * Returns:
+ *
+ * nothing
+ *
+ */
+ static void
+open_sendmailst(BOOL config)
+{
+ int filelen;
+
+ if (sendmailst_fh != -1) {
+ while (close(sendmailst_fh) == -1 && errno == EINTR) {
+ /*
+ * do nothing
+ */
+ }
+ }
+
+ sendmailst_fh = open(sendmailst_fn, O_RDONLY);
+
+ if (sendmailst_fh == -1) {
+ print_error(LOG_ERR, config, TRUE,
+ "mibII/mta_sendmail.c:open_sendmailst",
+ "could not open file \"%s\"", sendmailst_fn);
+ return;
+ }
+
+ filelen = read(sendmailst_fh, (void *) &stats, sizeof stats);
+
+ if (((struct statisticsV8_10 *) stats)->stat_magic == STAT_MAGIC) {
+
+ if (((struct statisticsV8_12_QUAR *) stats)->stat_version ==
+ STAT_VERSION_8_12_QUAR
+ && ((struct statisticsV8_12_QUAR *) stats)->stat_size ==
+ sizeof(struct statisticsV8_12_QUAR)
+ && filelen == sizeof(struct statisticsV8_12_QUAR)) {
+ DEBUGMSGTL(("mibII/mta_sendmail.c:open_sendmailst",
+ "looks like file \"%s\" has been created by sendmail V8.10.0 or newer\n",
+ sendmailst_fn));
+ stat_nf = (((struct statisticsV8_12_QUAR *) stats)->stat_nf);
+ stat_bf = (((struct statisticsV8_12_QUAR *) stats)->stat_bf);
+ stat_nt = (((struct statisticsV8_12_QUAR *) stats)->stat_nt);
+ stat_bt = (((struct statisticsV8_12_QUAR *) stats)->stat_bt);
+ stat_nr = (((struct statisticsV8_12_QUAR *) stats)->stat_nr);
+ stat_nd = (((struct statisticsV8_12_QUAR *) stats)->stat_nd);
+ stats_size = sizeof(struct statisticsV8_12_QUAR);
+ } else
+
+ if (((struct statisticsV8_10 *) stats)->stat_version ==
+ STAT_VERSION_8_10
+ && ((struct statisticsV8_10 *) stats)->stat_size ==
+ sizeof(struct statisticsV8_10)
+ && filelen == sizeof(struct statisticsV8_10)) {
+ DEBUGMSGTL(("mibII/mta_sendmail.c:open_sendmailst",
+ "looks like file \"%s\" has been created by sendmail V8.10.0 or newer\n",
+ sendmailst_fn));
+ stat_nf = (((struct statisticsV8_10 *) stats)->stat_nf);
+ stat_bf = (((struct statisticsV8_10 *) stats)->stat_bf);
+ stat_nt = (((struct statisticsV8_10 *) stats)->stat_nt);
+ stat_bt = (((struct statisticsV8_10 *) stats)->stat_bt);
+ stat_nr = (((struct statisticsV8_10 *) stats)->stat_nr);
+ stat_nd = (((struct statisticsV8_10 *) stats)->stat_nd);
+ stats_size = sizeof(struct statisticsV8_10);
+
+ } else if (((struct statisticsV8_9 *) stats)->stat_version ==
+ STAT_VERSION_8_9
+ && ((struct statisticsV8_9 *) stats)->stat_size ==
+ sizeof(struct statisticsV8_9)
+ && filelen == sizeof(struct statisticsV8_9)) {
+ DEBUGMSGTL(("mibII/mta_sendmail.c:open_sendmailst",
+ "looks like file \"%s\" has been created by sendmail V8.9.x\n",
+ sendmailst_fn));
+ stat_nf = (((struct statisticsV8_9 *) stats)->stat_nf);
+ stat_bf = (((struct statisticsV8_9 *) stats)->stat_bf);
+ stat_nt = (((struct statisticsV8_9 *) stats)->stat_nt);
+ stat_bt = (((struct statisticsV8_9 *) stats)->stat_bt);
+ stat_nr = (((struct statisticsV8_9 *) stats)->stat_nr);
+ stat_nd = (((struct statisticsV8_9 *) stats)->stat_nd);
+ stats_size = sizeof(struct statisticsV8_9);
+ } else {
+ print_error(LOG_WARNING, config, FALSE,
+ "mibII/mta_sendmail.c:open_sendmailst",
+ "could not guess version of statistics file \"%s\"",
+ sendmailst_fn);
+ while (close(sendmailst_fh) == -1 && errno == EINTR) {
+ /*
+ * do nothing
+ */
+ }
+ sendmailst_fh = -1;
+ }
+ } else {
+ if (((struct statisticsV8_8 *) stats)->stat_size ==
+ sizeof(struct statisticsV8_8)
+ && filelen == sizeof(struct statisticsV8_8)) {
+ DEBUGMSGTL(("mibII/mta_sendmail.c:open_sendmailst",
+ "looks like file \"%s\" has been created by sendmail V8.8.x\n",
+ sendmailst_fn));
+ stat_nf = (((struct statisticsV8_8 *) stats)->stat_nf);
+ stat_bf = (((struct statisticsV8_8 *) stats)->stat_bf);
+ stat_nt = (((struct statisticsV8_8 *) stats)->stat_nt);
+ stat_bt = (((struct statisticsV8_8 *) stats)->stat_bt);
+ stat_nr = (long *) NULL;
+ stat_nd = (long *) NULL;
+ stats_size = sizeof(struct statisticsV8_8);
+ } else {
+ print_error(LOG_WARNING, config, FALSE,
+ "mibII/mta_sendmail.c:open_sendmailst",
+ "could not guess version of statistics file \"%s\"",
+ sendmailst_fn);
+ while (close(sendmailst_fh) == -1 && errno == EINTR) {
+ /*
+ * do nothing
+ */
+ }
+ sendmailst_fh = -1;
+ }
+ }
+}
+
+ /**/ static void
+count_queuegroup(struct QGrp *qg)
+{
+ struct QDir *d;
+ char cwd[200];
+ time_t current_time = time(NULL);
+
+ if (current_time <= (qg->last + dir_cache_time)) {
+ return;
+ }
+
+ if (getcwd(cwd, sizeof cwd) == NULL) {
+ snmp_log(LOG_ERR,
+ "mibII/mta_sendmail.c:count_queuegroup: could not get current working directory\n");
+ return;
+ }
+
+ qg->count = 0;
+ qg->size = 0;
+
+ for (d = qg->dirs; d != NULL; d = d->next) {
+ DIR *dp;
+ struct dirent *dirp;
+ struct stat filestat;
+
+ if (chdir(d->dir) != 0)
+ continue;
+ dp = opendir(".");
+ if (dp == NULL)
+ continue;
+ while ((dirp = readdir(dp)) != NULL) {
+ if (dirp->d_name[0] == 'd' && dirp->d_name[1] == 'f') {
+ if (stat(dirp->d_name, &filestat) == 0) {
+ qg->size += (filestat.st_size + 999) / 1000;
+ }
+ } else if (dirp->d_name[0] == 'q' && dirp->d_name[1] == 'f') {
+ qg->count++;
+ }
+ }
+ closedir(dp);
+ }
+
+ qg->last = current_time;
+
+ chdir(cwd);
+}
+
+/** static void add_queuegroup(const char *name, const char *path)
+ *
+ * Description:
+ *
+ * Adds a queuegroup of 'name' with root path 'path' to the static
+ * list of queue groups. if 'path' ends in a *, we expand it out to
+ * all matching subdirs. also look for 'qf' subdirectories.
+ *
+ * Parameters:
+ *
+ * qgname: name of the queuegroup discovered
+ * path: path of queuegroup discovered
+ */
+static void
+add_queuegroup(const char *name, char *path)
+{
+ char parentdir[FILENAMELEN];
+ char *p;
+ struct QDir *new = NULL;
+ struct QDir *subdir = NULL;
+ DIR *dp;
+ struct dirent *dirp;
+
+ if (nqgrps == MAXQUEUEGROUPS) {
+ /*
+ * xxx error
+ */
+ return;
+ }
+
+ if (strlen(path) > FILENAMELEN - 10) {
+ /*
+ * xxx error
+ */
+ return;
+ }
+
+ p = path + strlen(path) - 1;
+ if (*p == '*') { /* multiple queue dirs */
+ /*
+ * remove *
+ */
+ *p = '\0';
+
+ strcpy(parentdir, path);
+ /*
+ * remove last directory component from parentdir
+ */
+ for (p = parentdir + strlen(parentdir) - 1; p >= parentdir; p--) {
+ if (*p == '/') {
+ *p = '\0';
+ break;
+ }
+ }
+
+ if (p < parentdir) {
+ /*
+ * no trailing / ?!?
+ */
+
+ /*
+ * xxx error
+ */
+ return;
+ }
+ p++;
+
+ /*
+ * p is now the prefix we need to match
+ */
+ if ((dp = opendir(parentdir)) == NULL) {
+ /*
+ * xxx can't open parentdir
+ */
+ return;
+ }
+
+ while ((dirp = readdir(dp)) != NULL) {
+ if (!strncmp(dirp->d_name, p, strlen(p)) &&
+ dirp->d_name[0] != '.') {
+ /*
+ * match, add it to the list
+ */
+
+ /*
+ * single queue directory
+ */
+ subdir = (struct QDir *) malloc(sizeof(struct QDir));
+ snprintf(subdir->dir, FILENAMELEN - 5, "%s/%s", parentdir,
+ dirp->d_name);
+ subdir->next = new;
+ new = subdir;
+ }
+ }
+
+ closedir(dp);
+ } else {
+ /*
+ * single queue directory
+ */
+ new = (struct QDir *) malloc(sizeof(struct QDir));
+ strcpy(new->dir, path);
+ new->next = NULL;
+ }
+
+ /*
+ * check 'new' for /qf directories
+ */
+ for (subdir = new; subdir != NULL; subdir = subdir->next) {
+ char qf[FILENAMELEN + 1];
+
+ snprintf(qf, FILENAMELEN, "%s/qf", subdir->dir);
+ if ((dp = opendir(qf)) != NULL) {
+ /*
+ * it exists !
+ */
+ strcpy(subdir->dir, qf);
+ closedir(dp);
+ }
+ }
+
+ /*
+ * we now have the list of directories in 'new'; create the queuegroup
+ * object
+ */
+ qgrps[nqgrps].name = strdup(name);
+ qgrps[nqgrps].last = 0;
+ qgrps[nqgrps].count = 0;
+ qgrps[nqgrps].size = 0;
+ qgrps[nqgrps].dirs = new;
+
+ nqgrps++;
+}
+
+/** static BOOL read_sendmailcf(BOOL config)
+ *
+ * Description:
+ *
+ * Tries to open the file named in sendmailcf_fn and to get the names of
+ * the mailers, the status file and the mailqueue directories.
+ *
+ * Parameters:
+ *
+ * config: TRUE if function has been called during the configuration process
+ *
+ * Returns:
+ *
+ * TRUE : config file has been successfully opened
+ *
+ * FALSE : could not open config file
+ *
+ */
+
+static BOOL
+read_sendmailcf(BOOL config)
+{
+ FILE *sendmailcf_fp;
+ char line[500];
+ char *filename;
+ char *qgname, *p;
+ int linenr;
+ int linelen;
+ int found_sendmailst = FALSE;
+ int i;
+
+
+ sendmailcf_fp = fopen(sendmailcf_fn, "r");
+ if (sendmailcf_fp == NULL) {
+ print_error(LOG_ERR, config, TRUE,
+ "mibII/mta_sendmail.c:read_sendmailcf",
+ "could not open file \"%s\"", sendmailcf_fn);
+ return FALSE;
+ }
+
+ /*
+ * initializes the standard mailers, which aren't necessarily mentioned in the sendmail.cf file
+ */
+ strcpy(mailernames[0], "prog");
+ strcpy(mailernames[1], "*file*");
+ strcpy(mailernames[2], "*include*");
+ mailers = 3;
+
+ /*
+ * reset queuegroups
+ */
+
+ linenr = 1;
+ while (fgets(line, sizeof line, sendmailcf_fp) != NULL) {
+ linelen = strlen(line);
+
+ if (line[linelen - 1] != '\n') {
+ print_error(LOG_WARNING, config, FALSE,
+ "mibII/mta_sendmail.c:read_sendmailcf",
+ "line %d in config file \"%s is too long\n",
+ linenr, sendmailcf_fn);
+ while (fgets(line, sizeof line, sendmailcf_fp) != NULL && line[strlen(line) - 1] != '\n') { /* skip rest of the line */
+ /*
+ * nothing to do
+ */
+ }
+ linenr++;
+ continue;
+ }
+
+ line[--linelen] = '\0';
+
+ switch (line[0]) {
+
+ case 'M':
+
+ if (mailers < MAXMAILERS) {
+ for (i = 1;
+ line[i] != ',' && !isspace(line[i]) && line[i] != '\0'
+ && i <= MNAMELEN; i++) {
+ mailernames[mailers][i - 1] = line[i];
+ }
+ mailernames[mailers][i - 1] = '\0';
+
+ DEBUGMSGTL(("mibII/mta_sendmail.c:read_sendmailcf",
+ "found mailer \"%s\"\n",
+ mailernames[mailers]));
+
+ for (i = 0;
+ i < mailers
+ && strcmp(mailernames[mailers], mailernames[i]) != 0;
+ i++) {
+ /*
+ * nothing to do
+ */
+ }
+
+ if (i == mailers) {
+ mailers++;
+ } else {
+ if (i < 3) {
+ DEBUGMSGTL(("mibII/mta_sendmail.c:read_sendmailcf",
+ "mailer \"%s\" already existed, but since it's one of the predefined mailers, that's probably nothing to worry about\n",
+ mailernames[mailers]));
+ } else {
+ DEBUGMSGTL(("mibII/mta_sendmail.c:read_sendmailcf",
+ "mailer \"%s\" already existed\n",
+ mailernames[mailers]));
+ }
+ mailernames[mailers][0] = '\0';
+ }
+ } else {
+ print_error(LOG_WARNING, config, FALSE,
+ "mibII/mta_sendmail.c:read_sendmailcf",
+ "found too many mailers in config file \"%s\"",
+ sendmailcf_fn);
+ }
+
+
+ break;
+
+ case 'O':
+ switch (line[1]) {
+ case ' ':
+ /*
+ * long option
+ */
+ if (strncasecmp(line + 2, "StatusFile", 10) == 0) {
+ filename = line + 12;
+ } else if (strncasecmp(line + 2, "QueueDirectory", 14) ==
+ 0) {
+ filename = line + 16;
+ } else {
+ /*
+ * not an option we care about
+ */
+ break;
+ }
+
+ /*
+ * make sure it's the end of the option
+ */
+ if (*filename != ' ' && *filename != '=')
+ break;
+
+ /*
+ * skip WS
+ */
+ while (*filename == ' ')
+ filename++;
+
+ /*
+ * must be O <option> = <file>
+ */
+ if (*filename++ != '=') {
+ print_error(LOG_WARNING, config, FALSE,
+ "mibII/mta_sendmail.c:read_sendmailcf",
+ "line %d in config file \"%s\" ist missing an '='",
+ linenr, sendmailcf_fn);
+ break;
+ }
+
+ /*
+ * skip WS
+ */
+ while (*filename == ' ')
+ filename++;
+
+ if (strlen(filename) > FILENAMELEN) {
+ print_error(LOG_WARNING, config, FALSE,
+ "mibII/mta_sendmail.c:read_sendmailcf",
+ "line %d config file \"%s\" contains a filename that's too long",
+ linenr, sendmailcf_fn);
+ break;
+ }
+
+ if (strncasecmp(line + 2, "StatusFile", 10) == 0) {
+ strncpy(sendmailst_fn, filename, sizeof(sendmailst_fn));
+ sendmailst_fn[ sizeof(sendmailst_fn)-1 ] = 0;
+ found_sendmailst = TRUE;
+ DEBUGMSGTL(("mibII/mta_sendmail.c:read_sendmailcf",
+ "found statatistics file \"%s\"\n",
+ sendmailst_fn));
+ } else if (strncasecmp(line + 2, "QueueDirectory", 14) ==
+ 0) {
+ add_queuegroup("mqueue", filename);
+ } else {
+ print_error(LOG_CRIT, config, FALSE,
+ "mibII/mta_sendmail.c:read_sendmailcf",
+ "This shouldn't happen.");
+ abort();
+ }
+ break;
+
+ case 'S':
+ if (strlen(line + 2) > FILENAMELEN) {
+ print_error(LOG_WARNING, config, FALSE,
+ "mibII/mta_sendmail.c:read_sendmailcf",
+ "line %d config file \"%s\" contains a filename that's too long",
+ linenr, sendmailcf_fn);
+ break;
+ }
+ strcpy(sendmailst_fn, line + 2);
+ found_sendmailst = TRUE;
+ DEBUGMSGTL(("mibII/mta_sendmail.c:read_sendmailcf",
+ "found statatistics file \"%s\"\n",
+ sendmailst_fn));
+ break;
+
+ case 'Q':
+ if (strlen(line + 2) > FILENAMELEN) {
+ print_error(LOG_WARNING, config, FALSE,
+ "mibII/mta_sendmail.c:read_sendmailcf",
+ "line %d config file \"%s\" contains a filename that's too long",
+ linenr, sendmailcf_fn);
+ break;
+ }
+
+ add_queuegroup("mqueue", line + 2);
+ break;
+ }
+ break;
+
+ case 'Q':
+ /*
+ * found a queue group
+ */
+ p = qgname = line + 1;
+ while (*p && *p != ',') {
+ p++;
+ }
+ if (*p == '\0') {
+ print_error(LOG_WARNING, config, FALSE,
+ "mibII/mta_sendmail.c:read_sendmailcf",
+ "line %d config file \"%s\" contains a weird queuegroup",
+ linenr, sendmailcf_fn);
+ break;
+ }
+
+ /*
+ * look for the directory
+ */
+ filename = NULL;
+ *p++ = '\0';
+ while (*p != '\0') {
+ /*
+ * skip WS
+ */
+ while (*p && *p == ' ')
+ p++;
+
+ if (*p == 'P') { /* found path */
+ while (*p && *p != '=')
+ p++;
+ if (*p++ != '=') {
+ print_error(LOG_WARNING, config, FALSE,
+ "mibII/mta_sendmail.c:read_sendmailcf",
+ "line %d config file \"%s\" contains a weird queuegroup",
+ linenr, sendmailcf_fn);
+ break;
+ }
+ filename = p;
+
+ /*
+ * find next ',', turn into \0
+ */
+ while (*p && *p != ',')
+ p++;
+ *p = '\0';
+ }
+
+ /*
+ * skip to next ,
+ */
+ while (*p && *p != ',') {
+ p++;
+ }
+ }
+
+ /*
+ * we found a directory
+ */
+ if (filename) {
+ add_queuegroup(qgname, filename);
+ } else {
+ print_error(LOG_WARNING, config, FALSE,
+ "mibII/mta_sendmail.c:read_sendmailcf",
+ "line %d config file \"%s\" contains a weird queuegroup: no directory",
+ linenr, sendmailcf_fn);
+ }
+
+ break;
+ }
+
+ linenr++;
+ }
+
+ for (i = 0; i < 10 && fclose(sendmailcf_fp) != 0; i++) {
+ /*
+ * nothing to do
+ */
+ }
+
+ for (i = mailers; i < MAXMAILERS; i++) {
+ mailernames[i][0] = '\0';
+ }
+
+ if (found_sendmailst) {
+ open_sendmailst(config);
+ }
+
+ return TRUE;
+}
+
+ /**/
+/** static void mta_sendmail_parse_config(const char* token, char *line)
+ *
+ * Description:
+ *
+ * Called by the agent for each configuration line that belongs to this module.
+ * The possible tokens are:
+ *
+ * sendmail_config - filename of the sendmail configutarion file
+ * sendmail_stats - filename of the sendmail statistics file
+ * sendmail_queue - name of the sendmail mailqueue directory
+ * sendmail_index - the ApplIndex to use for the table
+ * sendmail_stats_t - the time (in seconds) to cache statistics
+ * sendmail_queue_t - the time (in seconds) to cache the directory scanning results
+ *
+ * For "sendmail_config", "sendmail_stats" and "sendmail_queue", the copy_nword
+ * function is used to copy the filename.
+ *
+ * Parameters:
+ *
+ * token: first word of the line
+ *
+ * line: rest of the line
+ *
+ * Returns:
+ *
+ * nothing
+ *
+ */
+ static void
+mta_sendmail_parse_config(const char *token, char *line)
+{
+ if (strlen(line) > FILENAMELEN) { /* Might give some false alarm, but better to be safe than sorry */
+ config_perror("line too long");
+ return;
+ }
+
+ if (strcasecmp(token, "sendmail_stats") == 0) {
+ while (isspace(*line)) {
+ line++;
+ }
+ copy_nword(line, sendmailst_fn, sizeof(sendmailst_fn));
+
+ open_sendmailst(TRUE);
+
+ if (sendmailst_fh == -1) {
+ char str[FILENAMELEN + 50];
+ sprintf(str, "couldn't open file \"%s\"", sendmailst_fn);
+ config_perror(str);
+ return;
+ }
+
+ DEBUGMSGTL(("mibII/mta_sendmail.c:mta_sendmail_parse_config",
+ "opened statistics file \"%s\"\n", sendmailst_fn));
+ return;
+ } else if (strcasecmp(token, "sendmail_config") == 0) {
+ while (isspace(*line)) {
+ line++;
+ }
+ copy_nword(line, sendmailcf_fn, sizeof(sendmailcf_fn));
+
+ read_sendmailcf(TRUE);
+
+ DEBUGMSGTL(("mibII/mta_sendmail.c:mta_sendmail_parse_config",
+ "read config file \"%s\"\n", sendmailcf_fn));
+ return;
+ } else if (strcasecmp(token, "sendmail_queue") == 0) {
+ while (isspace(*line)) {
+ line++;
+ }
+ add_queuegroup("mqueue", line);
+
+ return;
+ } else if (strcasecmp(token, "sendmail_index") == 0) {
+ while (isspace(*line)) {
+ line++;
+ }
+ applindex = atol(line);
+ if (applindex < 1) {
+ config_perror("invalid index number");
+ applindex = 1;
+ }
+ } else if (strcasecmp(token, "sendmail_stats_t") == 0) {
+ while (isspace(*line)) {
+ line++;
+ }
+ stat_cache_time = atol(line);
+ if (stat_cache_time < 1) {
+ config_perror("invalid cache time");
+ applindex = 5;
+ }
+ } else if (strcasecmp(token, "sendmail_queue_t") == 0) {
+ while (isspace(*line)) {
+ line++;
+ }
+ dir_cache_time = atol(line);
+ if (dir_cache_time < 1) {
+ config_perror("invalid cache time");
+ applindex = 10;
+ }
+ } else {
+ config_perror
+ ("mibII/mta_sendmail.c says: What should I do with that token? Did you ./configure the agent properly?");
+ }
+
+ return;
+}
+
+ /**/
+/** void init_mta_sendmail(void)
+ *
+ * Description:
+ *
+ * Called by the agent to initialize the module. The function will register
+ * the OID tree and the config handler and try some default values for the
+ * sendmail.cf and sendmail.st files and for the mailqueue directory.
+ *
+ * Parameters:
+ *
+ * none
+ *
+ * Returns:
+ *
+ * nothing
+ *
+ */
+ void
+init_mta_sendmail(void)
+{
+ REGISTER_MIB("mibII/mta_sendmail", mta_variables, variable3,
+ mta_variables_oid);
+
+ snmpd_register_config_handler("sendmail_config",
+ mta_sendmail_parse_config, NULL, "file");
+ snmpd_register_config_handler("sendmail_stats",
+ mta_sendmail_parse_config, NULL, "file");
+ snmpd_register_config_handler("sendmail_queue",
+ mta_sendmail_parse_config, NULL,
+ "directory");
+ snmpd_register_config_handler("sendmail_index",
+ mta_sendmail_parse_config, NULL,
+ "integer");
+ snmpd_register_config_handler("sendmail_stats_t",
+ mta_sendmail_parse_config, NULL,
+ "cachetime/sec");
+ snmpd_register_config_handler("sendmail_queue_t",
+ mta_sendmail_parse_config, NULL,
+ "cachetime/sec");
+
+ strcpy(sendmailcf_fn, "/etc/mail/sendmail.cf");
+ if (read_sendmailcf(FALSE) == FALSE) {
+ strcpy(sendmailcf_fn, "/etc/sendmail.cf");
+ read_sendmailcf(FALSE);
+ }
+
+ if (sendmailst_fh == -1) {
+ strcpy(sendmailst_fn, "/etc/mail/statistics");
+ open_sendmailst(FALSE);
+ if (sendmailst_fh == -1) {
+ strcpy(sendmailst_fn, "/etc/mail/sendmail.st");
+ open_sendmailst(FALSE);
+ }
+ }
+
+}
+
+ /**/
+/** unsigned char *var_mtaEntry(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
+ *
+ * Description:
+ *
+ * Called by the agent in order to get the values for the mtaTable.
+ *
+ * Parameters:
+ *
+ * see agent documentation
+ *
+ * Returns:
+ *
+ * see agent documentation
+ *
+ */
+unsigned char *
+var_mtaEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+
+
+ static long long_ret;
+ auto int i;
+ auto int result;
+ auto time_t current_time;
+ int global_count = 0;
+ int global_size = 0;
+
+ if (exact) {
+ if (*length != vp->namelen + 1) {
+ return NULL;
+ }
+ result =
+ snmp_oid_compare(name, *length - 1, vp->name, vp->namelen);
+ if (result != 0 || name[*length - 1] != applindex) {
+ return NULL;
+ }
+ } else {
+ if (*length <= vp->namelen) {
+ result = -1;
+ } else {
+ result =
+ snmp_oid_compare(name, *length - 1, vp->name, vp->namelen);
+ }
+ if (result > 0) {
+ return NULL;
+ }
+ if (result == 0 && name[*length - 1] >= applindex) {
+ return NULL;
+ }
+ if (result < 0) {
+ memcpy(name, vp->name, (int) vp->namelen * (int) sizeof *name);
+ *length = vp->namelen + 1;
+ }
+ name[vp->namelen] = applindex;
+ }
+
+ *write_method = (WriteMethod *) NULL;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+ if (vp->magic & NEEDS_STATS) {
+ if (sendmailst_fh == -1)
+ return NULL;
+ current_time = time(NULL);
+ if (current_time == (time_t) - 1
+ || current_time > lastreadstats + stat_cache_time) {
+ if (lseek(sendmailst_fh, 0, SEEK_SET) == -1) {
+ snmp_log(LOG_ERR,
+ "mibII/mta_sendmail.c:var_mtaEntry: could not rewind to the beginning of file \"%s\"\n",
+ sendmailst_fn);
+ return NULL;
+ }
+ if (read(sendmailst_fh, (void *) &stats, stats_size) !=
+ stats_size) {
+ snmp_log(LOG_ERR,
+ "mibII/mta_sendmail.c:var_mtaEntry: could not read from statistics file \"%s\"\n",
+ sendmailst_fn);
+ return NULL;
+ }
+ if (current_time != (time_t) - 1) {
+ lastreadstats = current_time;
+ }
+ }
+ }
+
+ if (vp->magic & NEEDS_DIR) {
+ global_count = 0;
+ global_size = 0;
+ /*
+ * count all queue group messages
+ */
+ for (i = 0; i < nqgrps; i++) {
+ count_queuegroup(&qgrps[i]);
+ global_count += qgrps[i].count;
+ global_size += qgrps[i].size;
+ }
+ }
+
+ switch (vp->magic) {
+
+ case MTARECEIVEDMESSAGES:
+
+ long_ret = 0;
+ for (i = 0; i < MAXMAILERS; i++) {
+ long_ret += stat_nf[i];
+ }
+ return (unsigned char *) &long_ret;
+
+ case MTASTOREDMESSAGES:
+
+ long_ret = global_count;
+ return (unsigned char *) &long_ret;
+
+ case MTATRANSMITTEDMESSAGES:
+
+ long_ret = 0;
+ for (i = 0; i < MAXMAILERS; i++) {
+ long_ret += stat_nt[i];
+ }
+ return (unsigned char *) &long_ret;
+
+ case MTARECEIVEDVOLUME:
+
+ long_ret = 0;
+ for (i = 0; i < MAXMAILERS; i++) {
+ long_ret += stat_bf[i];
+ }
+ return (unsigned char *) &long_ret;
+
+ case MTASTOREDVOLUME:
+
+ long_ret = global_size;
+ return (unsigned char *) &long_ret;
+
+ case MTATRANSMITTEDVOLUME:
+
+ long_ret = 0;
+ for (i = 0; i < MAXMAILERS; i++) {
+ long_ret += stat_bt[i];
+ }
+ return (unsigned char *) &long_ret;
+
+ default:
+ snmp_log(LOG_ERR,
+ "mibII/mta_sendmail.c:mtaEntry: unknown magic value\n");
+ }
+ return NULL;
+}
+
+ /**/
+/** unsigned char *var_mtaGroupEntry(struct variable *vp, oid *name, size_t *length, int exact, size_t *var_len, WriteMethod **write_method)
+ *
+ * Description:
+ *
+ * Called by the agent in order to get the values for the mtaGroupTable.
+ *
+ * Parameters:
+ *
+ * see agent documentation
+ *
+ * Returns:
+ *
+ * see agent documentation
+ *
+ */
+unsigned char *
+var_mtaGroupEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+ auto long row;
+ auto int result;
+ auto time_t current_time;
+
+
+ if (exact) {
+ if (*length != vp->namelen + 2) {
+ return NULL;
+ }
+ result =
+ snmp_oid_compare(name, *length - 2, vp->name, vp->namelen);
+ if (result != 0 || name[*length - 2] != applindex
+ || name[*length - 1] <= 0
+ || name[*length - 1] > mailers + nqgrps) {
+ return NULL;
+ }
+ } else {
+ if (*length < vp->namelen) {
+ result = -1;
+ } else {
+ result =
+ snmp_oid_compare(name, vp->namelen, vp->name, vp->namelen);
+ }
+
+ if (result > 0) {
+ /*
+ * OID prefix too large
+ */
+ return NULL;
+ }
+
+ if (result == 0) {
+ /*
+ * OID prefix matches exactly,...
+ */
+ if (*length > vp->namelen && name[vp->namelen] > applindex) {
+ /*
+ * ... but ApplIndex too large
+ */
+ return NULL;
+ }
+ if (*length > vp->namelen && name[vp->namelen] == applindex) {
+ /*
+ * ... ApplIndex ok,...
+ */
+ if (*length > vp->namelen + 1
+ && name[vp->namelen + 1] >= 1) {
+ if (name[vp->namelen + 1] >= mailers + nqgrps) {
+ /*
+ * ... but mailernr too large
+ */
+ return NULL;
+ } else {
+ name[vp->namelen + 1]++;
+ }
+ } else {
+ name[vp->namelen + 1] = 1;
+ }
+ } else {
+ name[vp->namelen] = applindex;
+ name[vp->namelen + 1] = 1;
+ }
+ } else { /* OID prefix too small */
+ memcpy(name, vp->name, (int) vp->namelen * (int) sizeof *name);
+ name[vp->namelen] = applindex;
+ name[vp->namelen + 1] = 1;
+ }
+ *length = vp->namelen + 2;
+ }
+
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+
+ if (vp->magic & NEEDS_STATS) {
+ if (sendmailst_fh == -1)
+ return NULL;
+ current_time = time(NULL);
+ if (current_time == (time_t) - 1 ||
+ current_time > lastreadstats + stat_cache_time) {
+ if (lseek(sendmailst_fh, 0, SEEK_SET) == -1) {
+ snmp_log(LOG_ERR,
+ "mibII/mta_sendmail.c:var_mtaGroupEntry: could not rewind to beginning of file \"%s\"\n",
+ sendmailst_fn);
+ return NULL;
+ }
+ if (read(sendmailst_fh, (void *) &stats, stats_size) !=
+ stats_size) {
+ snmp_log(LOG_ERR,
+ "mibII/mta_sendmail.c:var_mtaGroupEntry: could not read statistics file \"%s\"\n",
+ sendmailst_fn);
+ return NULL;
+ }
+ if (current_time != (time_t) - 1) {
+ lastreadstats = current_time;
+ }
+ }
+ }
+
+ row = name[*length - 1] - 1;
+
+ /*
+ * if this is a mailer but we're asking for queue-group only info,
+ * bump there
+ */
+ if (!exact && row < mailers && (vp->magic == MTAGROUPSTOREDMESSAGES ||
+ vp->magic == MTAGROUPSTOREDVOLUME)) {
+ row = mailers;
+ name[*length - 1] = row + 1;
+ }
+
+ if (row < mailers) {
+ switch (vp->magic) {
+ case MTAGROUPRECEIVEDMESSAGES:
+ long_ret = (long) stat_nf[row];
+ return (unsigned char *) &long_ret;
+
+ case MTAGROUPREJECTEDMESSAGES:
+ if (stat_nr != NULL && stat_nd != NULL) {
+ long_ret = (long) (stat_nr[row] + stat_nd[row]); /* Number of rejected plus number of discarded messages */
+ return (unsigned char *) &long_ret;
+ } else {
+ return NULL;
+ }
+
+ case MTAGROUPTRANSMITTEDMESSAGES:
+ long_ret = (long) stat_nt[row];
+ return (unsigned char *) &long_ret;
+
+ case MTAGROUPRECEIVEDVOLUME:
+ long_ret = (long) stat_bf[row];
+ return (unsigned char *) &long_ret;
+
+ case MTAGROUPTRANSMITTEDVOLUME:
+ long_ret = (long) stat_bt[row];
+ return (unsigned char *) &long_ret;
+
+ case MTAGROUPNAME:
+ *var_len = strlen(mailernames[row]);
+ return (unsigned char *) (*var_len >
+ 0 ? mailernames[row] : NULL);
+
+ case MTAGROUPHIERARCHY:
+ long_ret = (long) -1;
+ return (unsigned char *) &long_ret;
+
+ default:
+ return NULL;
+ }
+ } else {
+ /*
+ * this is the queue group part of the table
+ */
+ row -= mailers;
+ switch (vp->magic) {
+ case MTAGROUPSTOREDMESSAGES:
+ count_queuegroup(&qgrps[row]);
+ long_ret = (long) qgrps[row].count;
+ return (unsigned char *) &long_ret;
+
+ case MTAGROUPSTOREDVOLUME:
+ count_queuegroup(&qgrps[row]);
+ long_ret = (long) qgrps[row].size;
+ return (unsigned char *) &long_ret;
+
+ case MTAGROUPNAME:
+ *var_len = strlen(qgrps[row].name);
+ return (unsigned char *) (*var_len >
+ 0 ? qgrps[row].name : NULL);
+
+ case MTAGROUPHIERARCHY:
+ long_ret = (long) -2;
+ return (unsigned char *) &long_ret;
+
+ default:
+ return NULL;
+ }
+
+ }
+ return NULL;
+}
+
+ /**/
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/mta_sendmail.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/mta_sendmail.h
new file mode 100644
index 0000000000..8368ca9f00
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/mta_sendmail.h
@@ -0,0 +1,9 @@
+#ifndef _MIBGROUP_MTA_H
+#define _MIBGROUP_MTA_H
+
+config_add_mib(MTA-MIB)
+config_add_mib(NETWORK-SERVICES-MIB)
+
+ void init_mta_sendmail(void);
+
+#endif /* _MIBGROUP_MTA_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/route_headers.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/route_headers.h
new file mode 100644
index 0000000000..34830f2799
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/route_headers.h
@@ -0,0 +1,180 @@
+#if defined(NETSNMP_CAN_USE_SYSCTL)
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <syslog.h>
+#include <time.h>
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/socket.h>
+#include <sys/sysctl.h>
+#if HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#include <net/if_dl.h>
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#include <net/route.h>
+#include <netinet/in.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "ip.h"
+#include "kernel.h"
+#include "interfaces.h"
+#include "struct.h"
+#include "util_funcs.h"
+
+#else /* !NETSNMP_CAN_USE_SYSCTL */
+
+#define GATEWAY /* MultiNet is always configured this way! */
+#include <stdio.h>
+#include <sys/types.h>
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# if defined (WIN32) || defined (cygwin)
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+#if HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#if HAVE_SYS_MBUF_H
+#include <sys/mbuf.h>
+#endif
+#if HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+#ifdef HAVE_NET_IF_VAR_H
+#include <net/if_var.h>
+#endif
+#if HAVE_SYS_HASHING_H
+#include <sys/hashing.h>
+#endif
+#if HAVE_NETINET_IN_VAR_H
+#include <netinet/in_var.h>
+#endif
+#define KERNEL /* to get routehash and RTHASHSIZ */
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#undef KERNEL
+#ifdef RTENTRY_4_4
+#ifndef STRUCT_RTENTRY_HAS_RT_UNIT
+#define rt_unit rt_refcnt /* Reuse this field for device # */
+#endif
+#ifndef STRUCT_RTENTRY_HAS_RT_DST
+#define rt_dst rt_nodes->rn_key
+#endif
+#else /* RTENTRY_4_3 */
+#ifndef STRUCT_RTENTRY_HAS_RT_DST
+#define rt_dst rt_nodes->rn_key
+#endif
+#ifndef STRUCT_RTENTRY_HAS_RT_HASH
+#define rt_hash rt_pad1
+#endif
+#ifndef STRUCT_RTENTRY_HAS_RT_REFCNT
+#ifndef hpux10
+#define rt_refcnt rt_pad2
+#endif
+#endif
+#ifndef STRUCT_RTENTRY_HAS_RT_USE
+#define rt_use rt_pad3
+#endif
+#ifndef STRUCT_RTENTRY_HAS_RT_UNIT
+#define rt_unit rt_refcnt /* Reuse this field for device # */
+#endif
+#endif
+#ifndef NULL
+#define NULL 0
+#endif
+#if HAVE_KVM_OPENFILES
+#include <fcntl.h>
+#endif
+#if HAVE_KVM_H
+#include <kvm.h>
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_INET_MIB2_H
+#include <inet/mib2.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#if HAVE_NET_IF_DL_H
+#ifndef dynix
+#include <net/if_dl.h>
+#else
+#include <sys/net/if_dl.h>
+#endif
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#if HAVE_NLIST_H
+#include <nlist.h>
+#endif
+
+#ifdef solaris2
+#include "kernel_sunos5.h"
+#endif
+
+#ifdef HAVE_SYS_SYSCTL_H
+# ifdef CTL_NET
+# ifdef PF_ROUTE
+# ifdef NET_RT_DUMP
+# define USE_SYSCTL_ROUTE_DUMP
+# endif
+# endif
+# endif
+#endif
+
+#ifdef cygwin
+#include <windows.h>
+#endif
+
+#endif /* !NETSNMP_CAN_USE_SYSCTL */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/route_write.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/route_write.c
new file mode 100644
index 0000000000..6f4d8ca586
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/route_write.c
@@ -0,0 +1,759 @@
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_FILE_H
+#include <sys/file.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#if HAVE_SYS_SOCKIO_H
+#include <sys/sockio.h>
+#endif
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#if HAVE_SYS_MBUF_H
+#include <sys/mbuf.h>
+#endif
+
+
+#if HAVE_SYS_STREAM_H
+#include <sys/stream.h>
+#endif
+#if HAVE_NET_ROUTE_H
+#include <net/route.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#include <errno.h>
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <stdio.h>
+#include <ctype.h>
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "ip.h"
+#include "route_write.h"
+
+#ifdef cygwin
+#include <windows.h>
+#endif
+
+#if !defined (WIN32) && !defined (cygwin)
+
+#ifndef STRUCT_RTENTRY_HAS_RT_DST
+#define rt_dst rt_nodes->rn_key
+#endif
+#ifndef STRUCT_RTENTRY_HAS_RT_HASH
+#define rt_hash rt_pad1
+#endif
+
+#ifdef irix6
+#define SIOCADDRT SIOCADDMULTI
+#define SIOCDELRT SIOCDELMULTI
+#endif
+
+#ifdef linux
+#define NETSNMP_ROUTE_WRITE_PROTOCOL PF_ROUTE
+#else
+#define NETSNMP_ROUTE_WRITE_PROTOCOL 0
+#endif
+
+int
+addRoute(u_long dstip, u_long gwip, u_long iff, u_short flags)
+{
+#if defined SIOCADDRT && !defined(irix6)
+ struct sockaddr_in dst;
+ struct sockaddr_in gateway;
+ int s, rc;
+ RTENTRY route;
+
+ s = socket(AF_INET, SOCK_RAW, NETSNMP_ROUTE_WRITE_PROTOCOL);
+ if (s < 0) {
+ snmp_log_perror("socket");
+ return -1;
+ }
+
+
+ flags |= RTF_UP;
+
+ dst.sin_family = AF_INET;
+ dst.sin_addr.s_addr = htonl(dstip);
+
+
+ gateway.sin_family = AF_INET;
+ gateway.sin_addr.s_addr = htonl(gwip);
+
+ memcpy(&route.rt_dst, &dst, sizeof(struct sockaddr_in));
+ memcpy(&route.rt_gateway, &gateway, sizeof(struct sockaddr_in));
+
+ route.rt_flags = flags;
+#ifndef RTENTRY_4_4
+ route.rt_hash = iff;
+#endif
+
+ rc = ioctl(s, SIOCADDRT, (caddr_t) & route);
+ close(s);
+ if (rc < 0)
+ snmp_log_perror("ioctl");
+ return rc;
+
+#else /* SIOCADDRT */
+ return -1;
+#endif
+}
+
+
+
+int
+delRoute(u_long dstip, u_long gwip, u_long iff, u_short flags)
+{
+#if defined SIOCDELRT && !defined(irix6)
+
+ struct sockaddr_in dst;
+ struct sockaddr_in gateway;
+ int s, rc;
+ RTENTRY route;
+
+ s = socket(AF_INET, SOCK_RAW, NETSNMP_ROUTE_WRITE_PROTOCOL);
+ if (s < 0) {
+ snmp_log_perror("socket");
+ return 0;
+ }
+
+
+ flags |= RTF_UP;
+
+ dst.sin_family = AF_INET;
+ dst.sin_addr.s_addr = htonl(dstip);
+
+
+ gateway.sin_family = AF_INET;
+ gateway.sin_addr.s_addr = htonl(gwip);
+
+ memcpy(&route.rt_dst, &dst, sizeof(struct sockaddr_in));
+ memcpy(&route.rt_gateway, &gateway, sizeof(struct sockaddr_in));
+
+ route.rt_flags = flags;
+#ifndef RTENTRY_4_4
+ route.rt_hash = iff;
+#endif
+
+ rc = ioctl(s, SIOCDELRT, (caddr_t) & route);
+ close(s);
+ return rc;
+
+#else /* SIOCDELRT */
+ return 0;
+#endif
+}
+
+
+#ifndef STRUCT_RTENTRY_HAS_RT_DST
+#undef rt_dst
+#endif
+
+
+#define MAX_CACHE 8
+
+struct rtent {
+
+ u_long in_use;
+ u_long old_dst;
+ u_long old_nextIR;
+ u_long old_ifix;
+ u_long old_flags;
+
+ u_long rt_dst; /* main entries */
+ u_long rt_ifix;
+ u_long rt_metric1;
+ u_long rt_nextIR;
+ u_long rt_type;
+ u_long rt_proto;
+
+
+ u_long xx_dst; /* shadow entries */
+ u_long xx_ifix;
+ u_long xx_metric1;
+ u_long xx_nextIR;
+ u_long xx_type;
+ u_long xx_proto;
+};
+
+struct rtent rtcache[MAX_CACHE];
+
+struct rtent *
+findCacheRTE(u_long dst)
+{
+ int i;
+
+ for (i = 0; i < MAX_CACHE; i++) {
+
+ if (rtcache[i].in_use && (rtcache[i].rt_dst == dst)) { /* valid & match? */
+ return (&rtcache[i]);
+ }
+ }
+ return 0;
+}
+
+struct rtent *
+newCacheRTE(void)
+{
+
+ int i;
+
+ for (i = 0; i < MAX_CACHE; i++) {
+
+ if (!rtcache[i].in_use) {
+ rtcache[i].in_use = 1;
+ return (&rtcache[i]);
+ }
+ }
+ return 0;
+
+}
+
+int
+delCacheRTE(u_long dst)
+{
+ struct rtent *rt;
+
+ rt = findCacheRTE(dst);
+ if (!rt) {
+ return 0;
+ }
+
+ rt->in_use = 0;
+ return 1;
+}
+
+
+struct rtent *
+cacheKernelRTE(u_long dst)
+{
+ return 0; /* for now */
+ /*
+ * ......
+ */
+}
+
+/*
+ * If statP is non-NULL, the referenced object is at that location.
+ * If statP is NULL and ap is non-NULL, the instance exists, but not this variable.
+ * If statP is NULL and ap is NULL, then neither this instance nor the variable exists.
+ */
+
+int
+write_rte(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len, u_char * statP, oid * name, size_t length)
+{
+ struct rtent *rp;
+ int var;
+ long val;
+ u_long dst;
+ char buf[8];
+ u_short flags;
+ int oldty;
+
+ /*
+ * object identifier is of form:
+ * 1.3.6.1.2.1.4.21.1.X.A.B.C.D , where A.B.C.D is IP address.
+ * IPADDR starts at offset 10.
+ */
+
+ if (length != 14) {
+ snmp_log(LOG_ERR, "length error\n");
+ return SNMP_ERR_NOCREATION;
+ }
+
+#ifdef solaris2 /* not implemented */
+ return SNMP_ERR_NOTWRITABLE;
+#endif
+
+ var = name[9];
+
+ dst = *((u_long *) & name[10]);
+
+ rp = findCacheRTE(dst);
+
+ if (!rp) {
+ rp = cacheKernelRTE(dst);
+ }
+
+
+ if (action == RESERVE1 && !rp) {
+
+ rp = newCacheRTE();
+ if (!rp) {
+ snmp_log(LOG_ERR, "newCacheRTE");
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ rp->rt_dst = dst;
+ rp->rt_type = rp->xx_type = 2;
+
+ } else if (action == COMMIT) {
+
+
+ } else if (action == FREE) {
+ if (rp && rp->rt_type == 2) { /* was invalid before */
+ delCacheRTE(dst);
+ }
+ }
+
+ netsnmp_assert(NULL != rp); /* should have found or created rp */
+
+
+ switch (var) {
+
+ case IPROUTEDEST:
+
+ if (action == RESERVE1) {
+
+ if (var_val_type != ASN_IPADDRESS) {
+ snmp_log(LOG_ERR, "not IP address");
+ return SNMP_ERR_WRONGTYPE;
+ }
+
+ memcpy(buf, var_val, (var_val_len > 8) ? 8 : var_val_len);
+
+ if (var_val_type != ASN_IPADDRESS) {
+ snmp_log(LOG_ERR, "not IP address 2");
+ return SNMP_ERR_WRONGTYPE;
+ }
+
+ rp->xx_dst = *((u_long *) buf);
+
+
+ } else if (action == COMMIT) {
+ rp->rt_dst = rp->xx_dst;
+ }
+ break;
+
+ case IPROUTEMETRIC1:
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR, "not int1");
+ return SNMP_ERR_WRONGTYPE;
+ }
+
+ val = *((long *) var_val);
+
+ if (val < -1) {
+ snmp_log(LOG_ERR, "not right1");
+ return SNMP_ERR_WRONGVALUE;
+ }
+
+ rp->xx_metric1 = val;
+
+ } else if (action == RESERVE2) {
+
+ if ((rp->xx_metric1 == 1) && (rp->xx_type != 4)) {
+ snmp_log(LOG_ERR, "reserve2 failed\n");
+ return SNMP_ERR_WRONGVALUE;
+ }
+
+ } else if (action == COMMIT) {
+ rp->rt_metric1 = rp->xx_metric1;
+ }
+ break;
+
+ case IPROUTEIFINDEX:
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR, "not right2");
+ return SNMP_ERR_WRONGTYPE;
+ }
+
+ val = *((long *) var_val);
+
+ if (val <= 0) {
+ snmp_log(LOG_ERR, "not right3");
+ return SNMP_ERR_WRONGVALUE;
+ }
+
+ rp->xx_ifix = val;
+
+ } else if (action == COMMIT) {
+ rp->rt_ifix = rp->xx_ifix;
+ }
+ break;
+
+ case IPROUTENEXTHOP:
+
+ if (action == RESERVE1) {
+
+ if (var_val_type != ASN_IPADDRESS) {
+ snmp_log(LOG_ERR, "not right4");
+ return SNMP_ERR_WRONGTYPE;
+ }
+
+ memcpy(buf, var_val, (var_val_len > 8) ? 8 : var_val_len);
+
+ if (var_val_type != ASN_IPADDRESS) {
+ snmp_log(LOG_ERR, "not right5");
+ return SNMP_ERR_WRONGTYPE;
+ }
+
+ rp->xx_nextIR = *((u_long *) buf);
+
+ } else if (action == COMMIT) {
+ rp->rt_nextIR = rp->xx_nextIR;
+ }
+
+
+ case IPROUTETYPE:
+
+ /*
+ * flag meaning:
+ *
+ * IPROUTEPROTO (rt_proto): none: (cant set == 3 (netmgmt))
+ *
+ * IPROUTEMETRIC1: 1 iff gateway, 0 otherwise
+ * IPROUTETYPE: 4 iff gateway, 3 otherwise
+ */
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+
+ val = *((long *) var_val);
+
+ if ((val < 2) || (val > 4)) { /* only accept invalid, direct, indirect */
+ snmp_log(LOG_ERR, "not right6");
+ return SNMP_ERR_WRONGVALUE;
+ }
+
+ rp->xx_type = val;
+
+ } else if (action == COMMIT) {
+
+ oldty = rp->rt_type;
+ rp->rt_type = rp->xx_type;
+
+ if (rp->rt_type == 2) { /* invalid, so delete from kernel */
+
+ if (delRoute
+ (rp->rt_dst, rp->rt_nextIR, rp->rt_ifix,
+ rp->old_flags) < 0) {
+ snmp_log_perror("delRoute");
+ }
+
+ } else {
+
+ /*
+ * it must be valid now, so flush to kernel
+ */
+
+ if (oldty != 2) { /* was the old entry valid ? */
+ if (delRoute
+ (rp->old_dst, rp->old_nextIR, rp->old_ifix,
+ rp->old_flags) < 0) {
+ snmp_log_perror("delRoute");
+ }
+ }
+
+ /*
+ * not invalid, so remove from cache
+ */
+
+ flags = (rp->rt_type == 4 ? RTF_GATEWAY : 0);
+
+ if (addRoute(rp->rt_dst, rp->rt_nextIR, rp->rt_ifix, flags)
+ < 0) {
+ snmp_log_perror("addRoute");
+ }
+
+ delCacheRTE(rp->rt_type);
+ }
+ }
+ break;
+
+
+ case IPROUTEPROTO:
+
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in write_rte\n", var));
+ return SNMP_ERR_NOCREATION;
+
+
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+#else /* WIN32 cygwin */
+#include <iphlpapi.h>
+
+extern PMIB_IPFORWARDROW route_row;
+extern int create_flag;
+
+int
+write_rte(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len, u_char * statP, oid * name, size_t length)
+{
+ int var, retval = NO_ERROR;
+ static PMIB_IPFORWARDROW oldroute_row = NULL;
+ static int mask_flag = 0, nexthop_flag = 0;
+ static int index_flag = 0, metric_flag = 0;
+ static int dest_flag = 0;
+ DWORD status = NO_ERROR;
+ /*
+ * object identifier is of form:
+ * 1.3.6.1.2.1.4.21.1.X.A.B.C.D , where A.B.C.D is IP address.
+ * IPADDR starts at offset 10.
+ */
+
+ if (length != 14) {
+ snmp_log(LOG_ERR, "length error\n");
+ return SNMP_ERR_NOCREATION;
+ }
+ /*
+ * #define for ipRouteTable entries are 1 less than corresponding sub-id in MIB
+ * * i.e. IPROUTEDEST defined as 0, but ipRouteDest registered as 1
+ */
+ var = name[9] - 1;
+
+ switch (action) {
+ case RESERVE1:
+ switch (var) {
+ case IPROUTEMETRIC1:
+ case IPROUTEMETRIC2:
+ case IPROUTEMETRIC3:
+ case IPROUTEMETRIC4:
+ case IPROUTEMETRIC5:
+ case IPROUTETYPE:
+ case IPROUTEAGE:
+ case IPROUTEIFINDEX:
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR, "not integer\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(int)) {
+ snmp_log(LOG_ERR, "bad length\n");
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (var == IPROUTETYPE) {
+ if ((*((int *) var_val)) < 2 || (*((int *) var_val)) > 4) {
+ snmp_log(LOG_ERR, "invalid ipRouteType\n");
+ return SNMP_ERR_WRONGVALUE;
+ }
+ } else if ((var == IPROUTEIFINDEX) || (var == IPROUTEAGE)) {
+ if ((*((int *) var_val)) < 0) {
+ snmp_log(LOG_ERR, "invalid ipRouteIfIndex\n");
+ return SNMP_ERR_WRONGVALUE;
+ }
+ } else {
+ if ((*((int *) var_val)) < -1) {
+ snmp_log(LOG_ERR, "not right1");
+ return SNMP_ERR_WRONGVALUE;
+ }
+ }
+ break;
+ case IPROUTENEXTHOP:
+ case IPROUTEMASK:
+ case IPROUTEDEST:
+ if (var_val_type != ASN_IPADDRESS) {
+ snmp_log(LOG_ERR, "not right4");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != 4) {
+ snmp_log(LOG_ERR, "incorrect ipAddress length");
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ break;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in write_rte\n",
+ var + 1));
+ retval = SNMP_ERR_NOTWRITABLE;
+ }
+ break;
+
+ case RESERVE2:
+ /*
+ * Save the old value, in case of UNDO
+ */
+ if (oldroute_row == NULL) {
+ oldroute_row =
+ (PMIB_IPFORWARDROW) malloc(sizeof(MIB_IPFORWARDROW));
+ *oldroute_row = *route_row;
+ }
+ break;
+
+ case ACTION: /* Perform the SET action (if reversible) */
+ switch (var) {
+ case IPROUTEMETRIC1:
+ metric_flag = 1;
+ route_row->dwForwardMetric1 = *((int *) var_val);
+ break;
+ case IPROUTEMETRIC2:
+ route_row->dwForwardMetric2 = *((int *) var_val);
+ break;
+ case IPROUTEMETRIC3:
+ route_row->dwForwardMetric3 = *((int *) var_val);
+ break;
+ case IPROUTEMETRIC4:
+ route_row->dwForwardMetric4 = *((int *) var_val);
+ break;
+ case IPROUTEMETRIC5:
+ route_row->dwForwardMetric5 = *((int *) var_val);
+ break;
+ case IPROUTETYPE:
+ route_row->dwForwardType = *((int *) var_val);
+ break;
+ case IPROUTEAGE:
+ /*
+ * Irrespective of suppied value, this will be set with 0.
+ * * As row will be updated and this field gives the number of
+ * * seconds since this route was last updated
+ */
+ route_row->dwForwardAge = *((int *) var_val);
+ break;
+ case IPROUTEIFINDEX:
+ index_flag = 1;
+ route_row->dwForwardIfIndex = *((int *) var_val);
+ break;
+
+ case IPROUTENEXTHOP:
+ nexthop_flag = 1;
+ route_row->dwForwardNextHop = *((DWORD *) var_val);
+ break;
+ case IPROUTEMASK:
+ mask_flag = 1;
+ route_row->dwForwardMask = *((DWORD *) var_val);
+ break;
+ case IPROUTEDEST:
+ dest_flag = 1;
+ route_row->dwForwardDest = *((DWORD *) var_val);
+ break;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in write_rte\n",
+ var + 1));
+ retval = SNMP_ERR_NOTWRITABLE;
+ }
+ return retval;
+ case UNDO:
+ /*
+ * Reverse the SET action and free resources
+ */
+ if (oldroute_row) {
+ *route_row = *oldroute_row;
+ free(oldroute_row);
+ oldroute_row = NULL;
+ free(route_row);
+ route_row = NULL;
+ }
+ break;
+
+ case COMMIT:
+ /*
+ * When this case entered 'route_row' will have user supplied values for asked entries.
+ * * Thats why it is enough if we call SetIpForwardEntry/CreateIpForwardEntry only once
+ * * SetIpForwardENtry is not done in ACTION phase, as that will reset ipRouteAge on success
+ * * and if any varbind fails, then we can't UNDO the change for ipROuteAge.
+ */
+ if (route_row) {
+ if (!create_flag) {
+
+ if (SetIpForwardEntry(route_row) != NO_ERROR) {
+ snmp_log(LOG_ERR,
+ "Can't set route table's row with specified value\n");
+ retval = SNMP_ERR_COMMITFAILED;
+ } else {
+ /*
+ * SET on IpRouteNextHop, IpRouteMask & ipRouteDest creates new row.
+ * *If Set succeeds, then delete the old row.
+ * * Don't know yet whether SET on ipRouteIfIndex creates new row.
+ * * If it creates then index_flag should be added to following if statement
+ */
+
+ if (dest_flag || nexthop_flag || mask_flag) {
+ oldroute_row->dwForwardType = 2;
+ if (SetIpForwardEntry(oldroute_row) != NO_ERROR) {
+ snmp_log(LOG_ERR,
+ "Set on ipRouteTable created new row, but failed to delete the old row\n");
+ retval = SNMP_ERR_GENERR;
+ }
+ }
+ }
+ }
+ /*
+ * Only if create_flag, mask, nexthop, ifIndex and metric are specified, create new entry
+ */
+ if (create_flag) {
+ if (mask_flag && nexthop_flag && metric_flag && index_flag) {
+ if ((status =
+ CreateIpForwardEntry(route_row)) != NO_ERROR) {
+ snmp_log(LOG_ERR,
+ "Inside COMMIT: CreateIpNetEntry failed, status %d\n",
+ status);
+ retval = SNMP_ERR_COMMITFAILED;
+ }
+ } else {
+ /*
+ * For new entry, mask, nexthop, ifIndex and metric must be supplied
+ */
+ snmp_log(LOG_ERR,
+ "case COMMIT, can't create without index, mask, nextHop and metric\n");
+ retval = SNMP_ERR_WRONGVALUE;
+ }
+ }
+ }
+
+ case FREE:
+ /*
+ * Free any resources allocated
+ */
+ free(oldroute_row);
+ oldroute_row = NULL;
+ free(route_row);
+ route_row = NULL;
+ mask_flag = nexthop_flag = metric_flag = index_flag = dest_flag =
+ 0;
+ break;
+ }
+ return retval;
+}
+
+#endif /* WIN32 cygwin */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/route_write.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/route_write.h
new file mode 100644
index 0000000000..4d6b9126f0
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/route_write.h
@@ -0,0 +1,20 @@
+/*
+ * Template MIB group interface - route_write.h
+ *
+ */
+#ifndef _MIBGROUP_ROUTE_WRITE_H
+#define _MIBGROUP_ROUTE_WRITE_H
+
+#if !defined(NETSNMP_ENABLE_MFD_REWRITES)
+config_require(mibII/ip)
+#endif
+
+ int addRoute(u_long, u_long, u_long, u_short);
+ int delRoute(u_long, u_long, u_long, u_short);
+ struct rtent *findCacheRTE(u_long);
+ struct rtent *newCacheRTE(void);
+ int delCacheRTE(u_long);
+ struct rtent *cacheKernelRTE(u_long);
+ WriteMethod write_rte;
+
+#endif /* _MIBGROUP_ROUTE_WRITE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/setSerialNo.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/setSerialNo.c
new file mode 100644
index 0000000000..90a0aba220
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/setSerialNo.c
@@ -0,0 +1,72 @@
+/**
+ * This file implements the snmpSetSerialNo TestAndIncr counter
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "setSerialNo.h"
+
+/*
+ * A watched spinlock can be fully implemented by the spinlock helper,
+ * but we still need a suitable variable to hold the value.
+ */
+static int setserialno;
+
+ /*
+ * TestAndIncr values should persist across agent restarts,
+ * so we need config handling routines to load and save the
+ * current value (incrementing this whenever it's loaded).
+ */
+static void
+setserial_parse_config( const char *token, char *cptr )
+{
+ setserialno = atoi(cptr);
+ setserialno++;
+ DEBUGMSGTL(("snmpSetSerialNo",
+ "Re-setting SnmpSetSerialNo to %d\n", setserialno));
+}
+static int
+setserial_store_config( int a, int b, void *c, void *d )
+{
+ char line[SNMP_MAXBUF_SMALL];
+ snprintf(line, SNMP_MAXBUF_SMALL, "setserialno %d", setserialno);
+ snmpd_store_config( line );
+ return 0;
+}
+
+void
+init_setSerialNo(void)
+{
+ oid set_serial_oid[] = { 1, 3, 6, 1, 6, 3, 1, 1, 6, 1 };
+
+ /*
+ * If we can't retain the TestAndIncr value across an agent restart,
+ * then it should be initialised to a pseudo-random value. So set it
+ * as such, before registering the config handlers to override this.
+ */
+#ifdef SVR4
+ setserialno = lrand48();
+#else
+ setserialno = random();
+#endif
+ DEBUGMSGTL(("snmpSetSerialNo",
+ "Initalizing SnmpSetSerialNo to %d\n", setserialno));
+ snmpd_register_config_handler("setserialno", setserial_parse_config,
+ NULL, "integer");
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ setserial_store_config, NULL);
+
+ /*
+ * Register 'setserialno' as a watched spinlock object
+ */
+ netsnmp_register_watched_spinlock(
+ netsnmp_create_handler_registration("snmpSetSerialNo", NULL,
+ set_serial_oid,
+ OID_LENGTH(set_serial_oid),
+ HANDLER_CAN_RWRITE),
+ &setserialno );
+
+ DEBUGMSGTL(("scalar_int", "Done initalizing example scalar int\n"));
+}
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/setSerialNo.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/setSerialNo.h
new file mode 100644
index 0000000000..4ffd8714da
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/setSerialNo.h
@@ -0,0 +1,6 @@
+#ifndef SETSERIALNO_H
+#define SETSERIALNO_H
+
+void init_setSerialNo(void);
+
+#endif /* SETSERIALNO_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/snmp_mib.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/snmp_mib.c
new file mode 100644
index 0000000000..0b301960eb
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/snmp_mib.c
@@ -0,0 +1,253 @@
+/*
+ * SNMPv1 MIB group implementation - snmp.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <sys/types.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+#include "snmp_mib.h"
+#include "sysORTable.h"
+
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+extern int snmp_enableauthentraps;
+extern int snmp_enableauthentrapsset;
+int old_snmp_enableauthentraps;
+
+/*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+
+/*
+ * define the structure we're going to ask the agent to register our
+ * information at
+ */
+struct variable1 snmp_variables[] = {
+ {SNMPINPKTS, ASN_COUNTER, RONLY, var_snmp, 1, {1}},
+ {SNMPOUTPKTS, ASN_COUNTER, RONLY, var_snmp, 1, {2}},
+ {SNMPINBADVERSIONS, ASN_COUNTER, RONLY, var_snmp, 1, {3}},
+#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
+ {SNMPINBADCOMMUNITYNAMES, ASN_COUNTER, RONLY, var_snmp, 1, {4}},
+ {SNMPINBADCOMMUNITYUSES, ASN_COUNTER, RONLY, var_snmp, 1, {5}},
+#endif /* support for community based SNMP */
+ {SNMPINASNPARSEERRORS, ASN_COUNTER, RONLY, var_snmp, 1, {6}},
+ {SNMPINTOOBIGS, ASN_COUNTER, RONLY, var_snmp, 1, {8}},
+ {SNMPINNOSUCHNAMES, ASN_COUNTER, RONLY, var_snmp, 1, {9}},
+ {SNMPINBADVALUES, ASN_COUNTER, RONLY, var_snmp, 1, {10}},
+ {SNMPINREADONLYS, ASN_COUNTER, RONLY, var_snmp, 1, {11}},
+ {SNMPINGENERRS, ASN_COUNTER, RONLY, var_snmp, 1, {12}},
+ {SNMPINTOTALREQVARS, ASN_COUNTER, RONLY, var_snmp, 1, {13}},
+ {SNMPINTOTALSETVARS, ASN_COUNTER, RONLY, var_snmp, 1, {14}},
+ {SNMPINGETREQUESTS, ASN_COUNTER, RONLY, var_snmp, 1, {15}},
+ {SNMPINGETNEXTS, ASN_COUNTER, RONLY, var_snmp, 1, {16}},
+ {SNMPINSETREQUESTS, ASN_COUNTER, RONLY, var_snmp, 1, {17}},
+ {SNMPINGETRESPONSES, ASN_COUNTER, RONLY, var_snmp, 1, {18}},
+ {SNMPINTRAPS, ASN_COUNTER, RONLY, var_snmp, 1, {19}},
+ {SNMPOUTTOOBIGS, ASN_COUNTER, RONLY, var_snmp, 1, {20}},
+ {SNMPOUTNOSUCHNAMES, ASN_COUNTER, RONLY, var_snmp, 1, {21}},
+ {SNMPOUTBADVALUES, ASN_COUNTER, RONLY, var_snmp, 1, {22}},
+ {SNMPOUTGENERRS, ASN_COUNTER, RONLY, var_snmp, 1, {24}},
+ {SNMPOUTGETREQUESTS, ASN_COUNTER, RONLY, var_snmp, 1, {25}},
+ {SNMPOUTGETNEXTS, ASN_COUNTER, RONLY, var_snmp, 1, {26}},
+ {SNMPOUTSETREQUESTS, ASN_COUNTER, RONLY, var_snmp, 1, {27}},
+ {SNMPOUTGETRESPONSES, ASN_COUNTER, RONLY, var_snmp, 1, {28}},
+ {SNMPOUTTRAPS, ASN_COUNTER, RONLY, var_snmp, 1, {29}},
+ {SNMPENABLEAUTHENTRAPS, ASN_INTEGER, RWRITE, var_snmp, 1, {30}},
+ {SNMPSILENTDROPS, ASN_COUNTER, RONLY, var_snmp, 1, {31}},
+ {SNMPPROXYDROPS, ASN_COUNTER, RONLY, var_snmp, 1, {32}}
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+oid snmp_variables_oid[] = { SNMP_OID_MIB2, 11 };
+#ifdef USING_MIBII_SYSTEM_MIB_MODULE
+extern oid system_module_oid[];
+extern int system_module_oid_len;
+extern int system_module_count;
+#endif
+
+static int
+snmp_enableauthentraps_store(int a, int b, void *c, void *d)
+{
+ char line[SNMP_MAXBUF_SMALL];
+
+ if (snmp_enableauthentrapsset > 0) {
+ snprintf(line, SNMP_MAXBUF_SMALL, "pauthtrapenable %d",
+ snmp_enableauthentraps);
+ snmpd_store_config(line);
+ }
+ return 0;
+}
+
+void
+init_snmp_mib(void)
+{
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("mibII/snmp", snmp_variables, variable1,
+ snmp_variables_oid);
+
+#ifdef USING_MIBII_SYSTEM_MIB_MODULE
+ if (++system_module_count == 3)
+ REGISTER_SYSOR_TABLE(system_module_oid, system_module_oid_len,
+ "The MIB module for SNMPv2 entities");
+#endif
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ snmp_enableauthentraps_store, NULL);
+}
+
+/*
+ * header_snmp(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+
+ /*********************
+ *
+ * System specific implementation functions
+ * (actually common!)
+ *
+ *********************/
+
+
+u_char *
+var_snmp(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+
+ *write_method = 0; /* assume it isnt writable for the time being */
+ *var_len = sizeof(long_ret); /* assume an integer and change later if not */
+
+ if (header_generic(vp, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return NULL;
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ if (vp->magic == SNMPENABLEAUTHENTRAPS) {
+ *write_method = write_snmp;
+ long_return = snmp_enableauthentraps;
+ return (u_char *) & long_return;
+ } else if ((vp->magic >= 1)
+ && (vp->magic <=
+ (STAT_SNMP_STATS_END - STAT_SNMP_STATS_START + 1))) {
+ long_ret =
+ snmp_get_statistic(vp->magic + STAT_SNMP_STATS_START - 1);
+ return (unsigned char *) &long_ret;
+ }
+ return NULL;
+}
+
+/*
+ * only for snmpEnableAuthenTraps:
+ */
+
+int
+write_snmp(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len, u_char * statP, oid * name, size_t name_len)
+{
+ long intval = 0;
+
+ switch (action) {
+ case RESERVE1: /* Check values for acceptability */
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("mibII/snmp_mib", "%x not integer type",
+ var_val_type));
+ return SNMP_ERR_WRONGTYPE;
+ }
+
+ intval = *((long *) var_val);
+ if (intval != 1 && intval != 2) {
+ DEBUGMSGTL(("mibII/snmp_mib", "not valid %x\n", intval));
+ return SNMP_ERR_WRONGVALUE;
+ }
+ if (snmp_enableauthentrapsset < 0) {
+ /*
+ * The object is set in a read-only configuration file.
+ */
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ break;
+
+ case RESERVE2: /* Allocate memory and similar resources */
+
+ /*
+ * Using static variables, so nothing needs to be done
+ */
+ break;
+
+ case ACTION: /* Perform the SET action (if reversible) */
+
+ /*
+ * Save the old value, in case of UNDO
+ */
+ intval = *((long *) var_val);
+ old_snmp_enableauthentraps = snmp_enableauthentraps;
+ snmp_enableauthentraps = intval;
+ break;
+
+ case UNDO: /* Reverse the SET action and free resources */
+
+ snmp_enableauthentraps = old_snmp_enableauthentraps;
+ break;
+
+ case COMMIT:
+ snmp_enableauthentrapsset = 1;
+ snmp_save_persistent(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE));
+ (void) snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
+ SNMP_CALLBACK_STORE_DATA, NULL);
+ snmp_clean_persistent(netsnmp_ds_get_string
+ (NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE));
+ break;
+
+ case FREE: /* Free any resources allocated */
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+/*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/snmp_mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/snmp_mib.h
new file mode 100644
index 0000000000..31ce442f15
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/snmp_mib.h
@@ -0,0 +1,83 @@
+/*
+ * SNMP MIB group interface - snmp.h
+ *
+ */
+#ifndef _MIBGROUP_SNMP_H
+#define _MIBGROUP_SNMP_H
+
+struct variable;
+
+extern FindVarMethod var_snmp;
+extern WriteMethod write_snmp;
+
+void init_snmp_mib(void);
+
+extern int snmp_inpkts; /* 1 - current */
+extern int snmp_outpkts; /* 2 - obsolete */
+extern int snmp_inbadversions; /* 3 - current */
+extern int snmp_inbadcommunitynames; /* 4 - current */
+extern int snmp_inbadcommunityuses; /* 5 - current */
+extern int snmp_inasnparseerrors; /* 6 - current */
+extern int snmp_intoobigs; /* 8 - obsolete */
+extern int snmp_innosuchnames; /* 9 - obsolete */
+extern int snmp_inbadvalues; /* 10 - obsolete */
+extern int snmp_inreadonlys; /* 11 - obsolete */
+extern int snmp_ingenerrs; /* 12 - obsolete */
+extern int snmp_intotalreqvars; /* 13 - obsolete */
+extern int snmp_intotalsetvars; /* 14 - obsolete */
+extern int snmp_ingetrequests; /* 15 - obsolete */
+extern int snmp_ingetnexts; /* 16 - obsolete */
+extern int snmp_insetrequests; /* 17 - obsolete */
+extern int snmp_ingetresponses; /* 18 - obsolete */
+extern int snmp_intraps; /* 19 - obsolete */
+extern int snmp_outtoobigs; /* 20 - obsolete */
+extern int snmp_outnosuchnames; /* 21 - obsolete */
+extern int snmp_outbadvalues; /* 22 - obsolete */
+extern int snmp_outgenerrs; /* 24 - obsolete */
+extern int snmp_outgetrequests; /* 25 - obsolete */
+extern int snmp_outgetnexts; /* 26 - obsolete */
+extern int snmp_outsetrequests; /* 27 - obsolete */
+extern int snmp_outgetresponses; /* 28 - obsolete */
+extern int snmp_outtraps; /* 29 - obsolete */
+extern int snmp_enableauthentraps; /* 30 - current */
+extern int snmp_silentdrops; /* 31 - current */
+extern int snmp_proxydrops; /* 32 - current */
+
+extern char *snmp_trapsink;
+extern char *snmp_trapcommunity;
+
+
+#define SNMPINPKTS 1
+#define SNMPOUTPKTS 2
+#define SNMPINBADVERSIONS 3
+#define SNMPINBADCOMMUNITYNAMES 4
+#define SNMPINBADCOMMUNITYUSES 5
+#define SNMPINASNPARSEERRORS 6
+#define SNMPINBADTYPES 7
+#define SNMPINTOOBIGS 8
+#define SNMPINNOSUCHNAMES 9
+#define SNMPINBADVALUES 10
+#define SNMPINREADONLYS 11
+#define SNMPINGENERRS 12
+#define SNMPINTOTALREQVARS 13
+#define SNMPINTOTALSETVARS 14
+#define SNMPINGETREQUESTS 15
+#define SNMPINGETNEXTS 16
+#define SNMPINSETREQUESTS 17
+#define SNMPINGETRESPONSES 18
+#define SNMPINTRAPS 19
+#define SNMPOUTTOOBIGS 20
+#define SNMPOUTNOSUCHNAMES 21
+#define SNMPOUTBADVALUES 22
+#define SNMPOUTREADONLYS 23
+#define SNMPOUTGENERRS 24
+#define SNMPOUTGETREQUESTS 25
+#define SNMPOUTGETNEXTS 26
+#define SNMPOUTSETREQUESTS 27
+#define SNMPOUTGETRESPONSES 28
+#define SNMPOUTTRAPS 29
+#define SNMPENABLEAUTHENTRAPS 30
+#define SNMPSILENTDROPS 31
+#define SNMPPROXYDROPS 32
+
+#endif /* _MIBGROUP_SNMP_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/sysORTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/sysORTable.c
new file mode 100644
index 0000000000..f8ffa50c21
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/sysORTable.c
@@ -0,0 +1,344 @@
+/*
+ * Template MIB group implementation - sysORTable.c
+ *
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/agent_callbacks.h>
+
+#include "struct.h"
+#include "util_funcs.h"
+#include "sysORTable.h"
+#include "snmpd.h"
+
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+#include "agentx/subagent.h"
+#include "agentx/client.h"
+#endif
+
+
+static int
+_register_sysOR_callback(int majorID, int minorID,
+ void *serverarg, void *clientarg);
+static int
+_unregister_sysOR_callback(int majorID, int minorID,
+ void *serverarg, void *clientarg);
+static int
+_unregister_sysOR_by_session_callback(int majorID, int minorID,
+ void *serverarg, void *clientarg);
+
+struct timeval sysOR_lastchange;
+static struct sysORTable *table = NULL;
+static int numEntries = 0;
+
+/*
+ * define the structure we're going to ask the agent to register our
+ * information at
+ */
+struct variable1 sysORTable_variables[] = {
+ {SYSORTABLEID, ASN_OBJECT_ID, RONLY, var_sysORTable, 1, {2}},
+ {SYSORTABLEDESCR, ASN_OCTET_STR, RONLY, var_sysORTable, 1, {3}},
+ {SYSORTABLEUPTIME, ASN_TIMETICKS, RONLY, var_sysORTable, 1, {4}}
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+oid sysORTable_variables_oid[] = { SNMP_OID_MIB2, 1, 9, 1 };
+#ifdef USING_MIBII_SYSTEM_MIB_MODULE
+extern oid system_module_oid[];
+extern int system_module_oid_len;
+extern int system_module_count;
+#endif
+
+void
+init_sysORTable(void)
+{
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+
+#ifdef USING_AGENTX_SUBAGENT_MODULE
+ if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE) == MASTER_AGENT)
+ (void) register_mib_priority("mibII/sysORTable",
+ (struct variable *)
+ sysORTable_variables,
+ sizeof(struct variable1),
+ sizeof(sysORTable_variables) /
+ sizeof(struct variable1),
+ sysORTable_variables_oid,
+ sizeof(sysORTable_variables_oid) /
+ sizeof(oid), 1);
+ else
+#endif
+ REGISTER_MIB("mibII/sysORTable", sysORTable_variables, variable1,
+ sysORTable_variables_oid);
+
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_REQ_REG_SYSOR,
+ _register_sysOR_callback, NULL);
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_REQ_UNREG_SYSOR,
+ _unregister_sysOR_callback, NULL);
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_REQ_UNREG_SYSOR_SESS,
+ _unregister_sysOR_by_session_callback, NULL);
+
+#ifdef USING_MIBII_SYSTEM_MIB_MODULE
+ if (++system_module_count == 3)
+ REGISTER_SYSOR_TABLE(system_module_oid, system_module_oid_len,
+ "The MIB module for SNMPv2 entities");
+#endif
+
+ gettimeofday(&sysOR_lastchange, NULL);
+}
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+u_char *
+var_sysORTable(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ unsigned long i = 0;
+ static unsigned long ret;
+ struct sysORTable *ptr = table;
+
+ if (header_simple_table
+ (vp, name, length, exact, var_len, write_method, numEntries))
+ return NULL;
+
+ for (i = 1; ptr != NULL && i < name[*length - 1]; ptr = ptr->next, i++) {
+ DEBUGMSGTL(("mibII/sysORTable", "sysORTable -- %lu != %lu\n",
+ i, name[*length - 1]));
+ }
+ if (ptr == NULL) {
+ DEBUGMSGTL(("mibII/sysORTable", "sysORTable -- no match: %lu\n",
+ i));
+ return NULL;
+ }
+ DEBUGMSGTL(("mibII/sysORTable", "sysORTable -- match: %lu\n", i));
+
+ switch (vp->magic) {
+ case SYSORTABLEID:
+ *var_len = ptr->OR_oidlen * sizeof(ptr->OR_oid[0]);
+ return (u_char *) ptr->OR_oid;
+
+ case SYSORTABLEDESCR:
+ *var_len = strlen(ptr->OR_descr);
+ return (u_char *) ptr->OR_descr;
+
+ case SYSORTABLEUPTIME:
+ ret = netsnmp_timeval_uptime(&ptr->OR_uptime);
+ return (u_char *) & ret;
+
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_sysORTable\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+
+int
+register_sysORTable_sess(oid * oidin,
+ size_t oidlen,
+ const char *descr, netsnmp_session * ss)
+{
+ struct sysORTable *ptr, **nptr;
+ struct register_sysOR_parameters reg_sysOR_parms;
+
+ DEBUGMSGTL(("mibII/sysORTable", "sysORTable registering: "));
+ DEBUGMSGOID(("mibII/sysORTable", oidin, oidlen));
+ DEBUGMSG(("mibII/sysORTable", "\n"));
+
+ ptr = (struct sysORTable *) malloc(sizeof(struct sysORTable));
+ if (ptr == NULL) {
+ return SYS_ORTABLE_REGISTRATION_FAILED;
+ }
+ ptr->OR_descr = (char *) strdup(descr);
+ if (ptr->OR_descr == NULL) {
+ free(ptr);
+ return SYS_ORTABLE_REGISTRATION_FAILED;
+ }
+ ptr->OR_oidlen = oidlen;
+ ptr->OR_oid = (oid *) malloc(sizeof(oid) * oidlen);
+ if (ptr->OR_oid == NULL) {
+ free(ptr->OR_descr);
+ free(ptr);
+ return SYS_ORTABLE_REGISTRATION_FAILED;
+ }
+ memcpy(ptr->OR_oid, oidin, sizeof(oid) * oidlen);
+ gettimeofday(&(ptr->OR_uptime), NULL);
+ gettimeofday(&(sysOR_lastchange), NULL);
+ ptr->OR_sess = ss;
+ ptr->next = NULL;
+ numEntries++;
+
+ /* add this entry to the end of the chained list */
+ nptr = &table;
+ while (*nptr != NULL)
+ nptr = &((*nptr)->next);
+ *nptr = ptr;
+
+ reg_sysOR_parms.name = oidin;
+ reg_sysOR_parms.namelen = oidlen;
+ reg_sysOR_parms.descr = descr;
+ snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_REG_SYSOR, &reg_sysOR_parms);
+
+ return SYS_ORTABLE_REGISTERED_OK;
+}
+
+int
+register_sysORTable(oid * oidin, size_t oidlen, const char *descr)
+{
+ return register_sysORTable_sess(oidin, oidlen, descr, NULL);
+}
+
+
+
+int
+unregister_sysORTable_sess(oid * oidin,
+ size_t oidlen, netsnmp_session * ss)
+{
+ struct sysORTable *ptr, *prev = NULL, *next;
+ int found = SYS_ORTABLE_NO_SUCH_REGISTRATION;
+ struct register_sysOR_parameters reg_sysOR_parms;
+
+ DEBUGMSGTL(("mibII/sysORTable", "sysORTable unregistering: "));
+ DEBUGMSGOID(("mibII/sysORTable", oidin, oidlen));
+ DEBUGMSG(("mibII/sysORTable", "\n"));
+
+ for (ptr = table; ptr; ptr = next)
+ {
+ next = ptr->next;
+ if (ptr->OR_sess == ss &&
+ (snmp_oid_compare(oidin, oidlen, ptr->OR_oid, ptr->OR_oidlen) == 0))
+ {
+ if (prev == NULL)
+ table = ptr->next;
+ else
+ prev->next = ptr->next;
+
+ free(ptr->OR_oid);
+ free(ptr->OR_descr);
+ free(ptr);
+ numEntries--;
+ gettimeofday(&(sysOR_lastchange), NULL);
+ found = SYS_ORTABLE_UNREGISTERED_OK;
+ break;
+ } else
+ prev = ptr;
+ }
+
+ reg_sysOR_parms.name = oidin;
+ reg_sysOR_parms.namelen = oidlen;
+ snmp_call_callbacks(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_UNREG_SYSOR, &reg_sysOR_parms);
+
+ return found;
+}
+
+
+int
+unregister_sysORTable(oid * oidin, size_t oidlen)
+{
+ return unregister_sysORTable_sess(oidin, oidlen, NULL);
+}
+
+void
+unregister_sysORTable_by_session(netsnmp_session * ss)
+{
+ struct sysORTable *ptr, *prev = NULL, *next;
+
+ for (ptr = table; ptr; ptr = next)
+ {
+ next = ptr->next;
+ if (((ss->flags & SNMP_FLAGS_SUBSESSION) && ptr->OR_sess == ss) ||
+ (!(ss->flags & SNMP_FLAGS_SUBSESSION) && ptr->OR_sess &&
+ ptr->OR_sess->subsession == ss)) {
+ if (prev == NULL)
+ table = next;
+ else
+ prev->next = next;
+ free(ptr->OR_oid);
+ free(ptr->OR_descr);
+ free(ptr);
+ numEntries--;
+ gettimeofday(&(sysOR_lastchange), NULL);
+ } else
+ prev = ptr;
+ }
+}
+
+static int
+_register_sysOR_callback(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ struct sysORTable *parms = (struct sysORTable *) serverarg;
+
+ return register_sysORTable_sess(parms->OR_oid, parms->OR_oidlen,
+ parms->OR_descr, parms->OR_sess);
+}
+
+static int
+_unregister_sysOR_by_session_callback(int majorID, int minorID,
+ void *serverarg, void *clientarg)
+{
+ netsnmp_session *session = (netsnmp_session *) serverarg;
+
+ unregister_sysORTable_by_session(session);
+
+ return 0;
+}
+
+static int
+_unregister_sysOR_callback(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ struct sysORTable *parms = (struct sysORTable *) serverarg;
+
+ return unregister_sysORTable_sess(parms->OR_oid,
+ parms->OR_oidlen,
+ parms->OR_sess);
+}
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/sysORTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/sysORTable.h
new file mode 100644
index 0000000000..59fb7e0730
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/sysORTable.h
@@ -0,0 +1,57 @@
+/*
+ * Template MIB group interface - sysORTable.h
+ *
+ */
+#ifndef _MIBGROUP_SYSORTABLE_H
+#define _MIBGROUP_SYSORTABLE_H
+
+config_require(util_funcs)
+config_require(mibII/system_mib)
+
+ struct sysORTable {
+ char *OR_descr;
+ oid *OR_oid;
+ size_t OR_oidlen;
+ struct timeval OR_uptime;
+ netsnmp_session *OR_sess;
+ struct sysORTable *next;
+ };
+
+ struct register_sysOR_parameters {
+ oid *name;
+ int namelen;
+ const char *descr;
+ };
+
+ extern void init_sysORTable(void);
+ extern FindVarMethod var_sysORTable;
+ extern FindVarMethod var_sysORLastChange;
+ extern int register_sysORTable(oid *, size_t, const char *);
+ extern int unregister_sysORTable(oid *, size_t);
+ extern int register_sysORTable_sess(oid *, size_t, const char *,
+ netsnmp_session *);
+ extern int unregister_sysORTable_sess(oid *, size_t,
+ netsnmp_session *);
+ extern void unregister_sysORTable_by_session(netsnmp_session *);
+
+#define SYSORTABLEINDEX 1
+#define SYSORTABLEID 2
+#define SYSORTABLEDESCR 3
+#define SYSORTABLEUPTIME 4
+
+#define SYS_ORTABLE_REGISTERED_OK 0
+#define SYS_ORTABLE_REGISTRATION_FAILED -1
+#define SYS_ORTABLE_UNREGISTERED_OK 0
+#define SYS_ORTABLE_NO_SUCH_REGISTRATION -1
+
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+#define REGISTER_SYSOR_ENTRY(theoid, descr) \
+ (void)register_sysORTable(theoid, sizeof(theoid)/sizeof(oid), descr);
+#define REGISTER_SYSOR_TABLE(theoid, len, descr) \
+ (void)register_sysORTable(theoid, len, descr);
+
+#else
+#define REGISTER_SYSOR_ENTRY(x,y)
+#define REGISTER_SYSOR_TABLE(x,y,z)
+#endif /* USING_MIBII_SYSORTABLE_MODULE */
+#endif /* _MIBGROUP_SYSORTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/system_mib.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/system_mib.c
new file mode 100644
index 0000000000..51eee1211b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/system_mib.c
@@ -0,0 +1,765 @@
+/*
+ * System MIB group implementation - system.c
+ *
+ */
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#include <ctype.h>
+#if HAVE_UTSNAME_H
+#include <utsname.h>
+#else
+#if HAVE_SYS_UTSNAME_H
+#include <sys/utsname.h>
+#endif
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+#include "system_mib.h"
+#include "struct.h"
+#include "sysORTable.h"
+
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+#define SYS_STRING_LEN 256
+char version_descr[SYS_STRING_LEN] = NETSNMP_VERS_DESC;
+char sysContact[SYS_STRING_LEN] = NETSNMP_SYS_CONTACT;
+char sysName[SYS_STRING_LEN] = NETSNMP_SYS_NAME;
+char sysLocation[SYS_STRING_LEN] = NETSNMP_SYS_LOC;
+oid sysObjectID[MAX_OID_LEN];
+size_t sysObjectIDLength;
+
+extern oid version_sysoid[];
+extern int version_sysoid_len;
+
+char oldversion_descr[SYS_STRING_LEN];
+char oldsysContact[SYS_STRING_LEN];
+char oldsysName[SYS_STRING_LEN];
+char oldsysLocation[SYS_STRING_LEN];
+
+int sysServices = 72;
+int sysServicesConfiged = 0;
+
+extern oid version_id[];
+extern int version_id_len;
+
+static int sysContactSet = 0, sysLocationSet = 0, sysNameSet = 0;
+
+WriteMethod writeSystem;
+int header_system(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+
+#if (defined (WIN32) && defined (HAVE_WIN32_PLATFORM_SDK)) || defined (mingw32)
+static void windowsOSVersionString(char [], size_t);
+#endif
+
+ /*********************
+ *
+ * snmpd.conf config parsing
+ *
+ *********************/
+
+void
+system_parse_config_sysdescr(const char *token, char *cptr)
+{
+ char tmpbuf[1024];
+
+ if (strlen(cptr) >= sizeof(version_descr)) {
+ snprintf(tmpbuf,
+ sizeof(tmpbuf),
+ "sysdescr token too long (must be < %lu):\n\t%s",
+ (unsigned long)sizeof(version_descr),
+ cptr);
+ config_perror(tmpbuf);
+ } else if (strcmp(cptr, "\"\"") == 0) {
+ version_descr[0] = '\0';
+ } else {
+ strcpy(version_descr, cptr);
+ }
+}
+
+void
+system_parse_config_sysloc(const char *token, char *cptr)
+{
+ char tmpbuf[1024];
+
+ if (strlen(cptr) >= sizeof(sysLocation)) {
+ snprintf(tmpbuf, 1024,
+ "syslocation token too long (must be < %lu):\n\t%s",
+ (unsigned long)sizeof(sysLocation), cptr);
+ config_perror(tmpbuf);
+ }
+
+ if (strcmp(token, "psyslocation") == 0) {
+ if (sysLocationSet < 0) {
+ /*
+ * This is bogus (and shouldn't happen anyway) -- the sysLocation
+ * is already configured read-only.
+ */
+ snmp_log(LOG_WARNING,
+ "ignoring attempted override of read-only sysLocation.0\n");
+ return;
+ } else {
+ sysLocationSet++;
+ }
+ } else {
+ if (sysLocationSet > 0) {
+ /*
+ * This is bogus (and shouldn't happen anyway) -- we already read a
+ * persistent value of sysLocation, which we should ignore in
+ * favour of this one.
+ */
+ snmp_log(LOG_WARNING,
+ "ignoring attempted override of read-only sysLocation.0\n");
+ /*
+ * Fall through and copy in this value.
+ */
+ }
+ sysLocationSet = -1;
+ }
+
+ if (strcmp(cptr, "\"\"") == 0) {
+ sysLocation[0] = '\0';
+ } else if (strlen(cptr) < sizeof(sysLocation)) {
+ strcpy(sysLocation, cptr);
+ }
+}
+
+void
+system_parse_config_syscon(const char *token, char *cptr)
+{
+ char tmpbuf[1024];
+
+ if (strlen(cptr) >= sizeof(sysContact)) {
+ snprintf(tmpbuf, 1024,
+ "syscontact token too long (must be < %lu):\n\t%s",
+ (unsigned long)sizeof(sysContact), cptr);
+ config_perror(tmpbuf);
+ }
+
+ if (strcmp(token, "psyscontact") == 0) {
+ if (sysContactSet < 0) {
+ /*
+ * This is bogus (and shouldn't happen anyway) -- the sysContact
+ * is already configured read-only.
+ */
+ snmp_log(LOG_WARNING,
+ "ignoring attempted override of read-only sysContact.0\n");
+ return;
+ } else {
+ sysContactSet++;
+ }
+ } else {
+ if (sysContactSet > 0) {
+ /*
+ * This is bogus (and shouldn't happen anyway) -- we already read a
+ * persistent value of sysContact, which we should ignore in favour
+ * of this one.
+ */
+ snmp_log(LOG_WARNING,
+ "ignoring attempted override of read-only sysContact.0\n");
+ /*
+ * Fall through and copy in this value.
+ */
+ }
+ sysContactSet = -1;
+ }
+
+ if (strcmp(cptr, "\"\"") == 0) {
+ sysContact[0] = '\0';
+ } else if (strlen(cptr) < sizeof(sysContact)) {
+ strcpy(sysContact, cptr);
+ }
+}
+
+void
+system_parse_config_sysname(const char *token, char *cptr)
+{
+ char tmpbuf[1024];
+
+ if (strlen(cptr) >= sizeof(sysName)) {
+ snprintf(tmpbuf, 1024,
+ "sysname token too long (must be < %lu):\n\t%s",
+ (unsigned long)sizeof(sysName), cptr);
+ config_perror(tmpbuf);
+ }
+
+ if (strcmp(token, "psysname") == 0) {
+ if (sysNameSet < 0) {
+ /*
+ * This is bogus (and shouldn't happen anyway) -- the sysName
+ * is already configured read-only.
+ */
+ snmp_log(LOG_WARNING,
+ "ignoring attempted override of read-only sysName.0\n");
+ return;
+ } else {
+ sysNameSet++;
+ }
+ } else {
+ if (sysNameSet > 0) {
+ /*
+ * This is bogus (and shouldn't happen anyway) -- we already read a
+ * persistent value of sysName, which we should ignore in favour
+ * of this one.
+ */
+ snmp_log(LOG_WARNING,
+ "ignoring attempted override of read-only sysName.0\n");
+ /*
+ * Fall through and copy in this value.
+ */
+ }
+ sysNameSet = -1;
+ }
+
+ if (strcmp(cptr, "\"\"") == 0) {
+ sysName[0] = '\0';
+ } else if (strlen(cptr) < sizeof(sysName)) {
+ strcpy(sysName, cptr);
+ }
+}
+
+void
+system_parse_config_sysServices(const char *token, char *cptr)
+{
+ sysServices = atoi(cptr);
+ sysServicesConfiged = 1;
+}
+
+void system_parse_config_sysObjectID(const char *token, char *cptr)
+{
+ char tmpbuf[1024];
+
+ sysObjectIDLength = MAX_OID_LEN;
+ if (!read_objid(cptr, sysObjectID, &sysObjectIDLength)) {
+ snprintf(tmpbuf,
+ sizeof(tmpbuf),
+ "sysobjectid token not a parsable OID:\n\t%s",
+ cptr);
+ config_perror(tmpbuf);
+ memcpy(sysObjectID, version_sysoid, version_sysoid_len * sizeof(oid));
+ sysObjectIDLength = version_sysoid_len;
+ }
+}
+
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+
+/*
+ * define the structure we're going to ask the agent to register our
+ * information at
+ */
+struct variable1 system_variables[] = {
+ {VERSION_DESCR, ASN_OCTET_STR, RONLY, var_system, 1, {1}},
+ {VERSIONID, ASN_OBJECT_ID, RONLY, var_system, 1, {2}},
+ {UPTIME, ASN_TIMETICKS, RONLY, var_system, 1, {3}},
+ {SYSCONTACT, ASN_OCTET_STR, RWRITE, var_system, 1, {4}},
+ {SYSTEMNAME, ASN_OCTET_STR, RWRITE, var_system, 1, {5}},
+ {SYSLOCATION, ASN_OCTET_STR, RWRITE, var_system, 1, {6}},
+ {SYSSERVICES, ASN_INTEGER, RONLY, var_system, 1, {7}},
+ {SYSORLASTCHANGE, ASN_TIMETICKS, RONLY, var_system, 1, {8}}
+};
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+oid system_variables_oid[] = { SNMP_OID_MIB2, 1 };
+oid system_module_oid[] = { SNMP_OID_SNMPMODULES, 1 };
+int system_module_oid_len =
+ sizeof(system_module_oid) / sizeof(oid);
+int system_module_count = 0;
+
+static int
+system_store(int a, int b, void *c, void *d)
+{
+ char line[SNMP_MAXBUF_SMALL];
+
+ if (sysLocationSet > 0) {
+ snprintf(line, SNMP_MAXBUF_SMALL, "psyslocation %s", sysLocation);
+ snmpd_store_config(line);
+ }
+ if (sysContactSet > 0) {
+ snprintf(line, SNMP_MAXBUF_SMALL, "psyscontact %s", sysContact);
+ snmpd_store_config(line);
+ }
+ if (sysNameSet > 0) {
+ snprintf(line, SNMP_MAXBUF_SMALL, "psysname %s", sysName);
+ snmpd_store_config(line);
+ }
+
+ return 0;
+}
+
+void
+init_system_mib(void)
+{
+
+#ifdef HAVE_UNAME
+ struct utsname utsName;
+
+ uname(&utsName);
+ snprintf(version_descr, sizeof(version_descr),
+ "%s %s %s %s %s", utsName.sysname,
+ utsName.nodename, utsName.release, utsName.version,
+ utsName.machine);
+ version_descr[ sizeof(version_descr)-1 ] = 0;
+#else
+#if HAVE_EXECV
+ struct extensible extmp;
+
+ /*
+ * set default values of system stuff
+ */
+ sprintf(extmp.command, "%s -a", UNAMEPROG);
+ /*
+ * setup defaults
+ */
+ extmp.type = EXECPROC;
+ extmp.next = NULL;
+ exec_command(&extmp);
+ strncpy(version_descr, extmp.output, sizeof(version_descr));
+ version_descr[sizeof(version_descr) - 1] = 0;
+ version_descr[strlen(version_descr) - 1] = 0; /* chomp new line */
+#else
+#if (defined (WIN32) && defined (HAVE_WIN32_PLATFORM_SDK)) || defined (mingw32)
+ windowsOSVersionString(version_descr, sizeof(version_descr));
+#else
+ strcpy(version_descr, "unknown");
+#endif
+#endif
+#endif
+
+#ifdef HAVE_GETHOSTNAME
+ gethostname(sysName, sizeof(sysName));
+#else
+#ifdef HAVE_UNAME
+ strncpy(sysName, utsName.nodename, sizeof(sysName));
+#else
+#if defined (HAVE_EXECV) && !defined (mingw32)
+ sprintf(extmp.command, "%s -n", UNAMEPROG);
+ /*
+ * setup defaults
+ */
+ extmp.type = EXECPROC;
+ extmp.next = NULL;
+ exec_command(&extmp);
+ strncpy(sysName, extmp.output, sizeof(sysName));
+ sysName[strlen(sysName) - 1] = 0; /* chomp new line */
+#else
+ strcpy(sysName, "unknown");
+#endif /* HAVE_EXECV */
+#endif /* HAVE_UNAME */
+#endif /* HAVE_GETHOSTNAME */
+
+#if (defined (WIN32) && defined (HAVE_WIN32_PLATFORM_SDK)) || defined (mingw32)
+ {
+ HKEY hKey;
+ /* Default sysContact is the registered windows user */
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {
+ char registeredOwner[256] = "";
+ DWORD registeredOwnerSz = 256;
+ if (RegQueryValueEx(hKey, "RegisteredOwner", NULL, NULL, (LPBYTE)registeredOwner, &registeredOwnerSz) == ERROR_SUCCESS) {
+ strcpy(sysContact, registeredOwner);
+ }
+ RegCloseKey(hKey);
+ }
+ }
+#endif
+
+ /* default sysObjectID */
+ memcpy(sysObjectID, version_sysoid, version_sysoid_len * sizeof(oid));
+ sysObjectIDLength = version_sysoid_len;
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("mibII/system", system_variables, variable1,
+ system_variables_oid);
+
+ if (++system_module_count == 3)
+ REGISTER_SYSOR_ENTRY(system_module_oid,
+ "The MIB module for SNMPv2 entities");
+
+ sysContactSet = sysLocationSet = sysNameSet = 0;
+
+ /*
+ * register our config handlers
+ */
+ snmpd_register_config_handler("sysdescr",
+ system_parse_config_sysdescr, NULL,
+ "description");
+ snmpd_register_config_handler("syslocation",
+ system_parse_config_sysloc, NULL,
+ "location");
+ snmpd_register_config_handler("syscontact", system_parse_config_syscon,
+ NULL, "contact-name");
+ snmpd_register_config_handler("sysname", system_parse_config_sysname,
+ NULL, "node-name");
+ snmpd_register_config_handler("psyslocation",
+ system_parse_config_sysloc, NULL, NULL);
+ snmpd_register_config_handler("psyscontact",
+ system_parse_config_syscon, NULL, NULL);
+ snmpd_register_config_handler("psysname", system_parse_config_sysname,
+ NULL, NULL);
+ snmpd_register_config_handler("sysservices",
+ system_parse_config_sysServices, NULL,
+ "NUMBER");
+ snmpd_register_config_handler("sysobjectid",
+ system_parse_config_sysObjectID, NULL,
+ "OID");
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ system_store, NULL);
+
+}
+
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+extern struct timeval sysOR_lastchange;
+#endif
+
+u_char *
+var_system(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ static u_long ulret;
+
+ if (header_generic(vp, name, length, exact, var_len, write_method) ==
+ MATCH_FAILED)
+ return NULL;
+
+ switch (vp->magic) {
+ case VERSION_DESCR:
+ *var_len = strlen(version_descr);
+ return (u_char *) version_descr;
+ case VERSIONID:
+ *var_len = sysObjectIDLength * sizeof(sysObjectID[0]);
+ return (u_char *)sysObjectID;
+ case UPTIME:
+ ulret = netsnmp_get_agent_uptime();
+ return ((u_char *) & ulret);
+ case SYSCONTACT:
+ *var_len = strlen(sysContact);
+ *write_method = writeSystem;
+ return (u_char *) sysContact;
+ case SYSTEMNAME:
+ *var_len = strlen(sysName);
+ *write_method = writeSystem;
+ return (u_char *) sysName;
+ case SYSLOCATION:
+ *var_len = strlen(sysLocation);
+ *write_method = writeSystem;
+ return (u_char *) sysLocation;
+ case SYSSERVICES:
+#if NETSNMP_NO_DUMMY_VALUES
+ if (!sysServicesConfiged)
+ return NULL;
+#endif
+ long_return = sysServices;
+ return (u_char *) & long_return;
+
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+ case SYSORLASTCHANGE:
+ ulret = netsnmp_timeval_uptime(&sysOR_lastchange);
+ return ((u_char *) & ulret);
+#endif
+
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_system\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+
+
+int
+writeSystem(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ u_char *cp;
+ char *buf = NULL, *oldbuf = NULL;
+ int count, *setvar = NULL;
+
+ switch ((char) name[7]) {
+ case VERSION_DESCR:
+ case VERSIONID:
+ case UPTIME:
+ snmp_log(LOG_ERR, "Attempt to write to R/O OID\n");
+ return SNMP_ERR_NOTWRITABLE;
+ case SYSCONTACT:
+ buf = sysContact;
+ oldbuf = oldsysContact;
+ setvar = &sysContactSet;
+ break;
+ case SYSTEMNAME:
+ buf = sysName;
+ oldbuf = oldsysName;
+ setvar = &sysNameSet;
+ break;
+ case SYSLOCATION:
+ buf = sysLocation;
+ oldbuf = oldsysLocation;
+ setvar = &sysLocationSet;
+ break;
+ case SYSSERVICES:
+ case SYSORLASTCHANGE:
+ snmp_log(LOG_ERR, "Attempt to write to R/O OID\n");
+ return SNMP_ERR_NOTWRITABLE;
+ default:
+ return SNMP_ERR_GENERR; /* ??? */
+ }
+
+ switch (action) {
+ case RESERVE1: /* Check values for acceptability */
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR, "not string\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(sysLocation) - 1) {
+ snmp_log(LOG_ERR, "bad length\n");
+ return SNMP_ERR_WRONGLENGTH;
+ }
+
+ for (cp = var_val, count = 0; count < (int) var_val_len;
+ count++, cp++) {
+ if (!isprint(*cp)) {
+ snmp_log(LOG_ERR, "not print %x\n", *cp);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ }
+ if (setvar != NULL && *setvar < 0) {
+ /*
+ * The object is set in a read-only configuration file.
+ */
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ break;
+
+ case RESERVE2: /* Allocate memory and similar resources */
+
+ /*
+ * Using static strings, so nothing needs to be done
+ */
+ break;
+
+ case ACTION: /* Perform the SET action (if reversible) */
+
+ /*
+ * Save the old value, in case of UNDO
+ */
+ strcpy(oldbuf, buf);
+ memcpy(buf, var_val, var_val_len);
+ buf[var_val_len] = 0;
+ break;
+
+ case UNDO: /* Reverse the SET action and free resources */
+
+ strcpy(buf, oldbuf);
+ oldbuf[0] = 0;
+ break;
+
+ case COMMIT:
+ if (setvar != NULL) {
+ *setvar = 1;
+ }
+ snmp_save_persistent(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE));
+ (void) snmp_call_callbacks(SNMP_CALLBACK_LIBRARY,
+ SNMP_CALLBACK_STORE_DATA, NULL);
+ snmp_clean_persistent(netsnmp_ds_get_string
+ (NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE));
+
+ case FREE: /* Free any resources allocated */
+
+ /*
+ * No resources have been allocated, but "empty" the 'oldbuf'
+ */
+ oldbuf[0] = 0;
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+} /* end of writeSystem */
+
+ /*********************
+ *
+ * Internal implementation functions - None
+ *
+ *********************/
+
+#if (defined (WIN32) && defined (HAVE_WIN32_PLATFORM_SDK)) || defined (mingw32)
+static void
+windowsOSVersionString(char stringbuf[], size_t stringbuflen)
+{
+ /* copy OS version to string buffer in 'uname -a' format */
+ OSVERSIONINFOEX osVersionInfo;
+ BOOL gotOsVersionInfoEx;
+ char windowsVersion[256] = "";
+ char hostname[256] = "";
+ char identifier[256] = "";
+ DWORD identifierSz = 256;
+ HKEY hKey;
+
+ ZeroMemory(&osVersionInfo, sizeof(OSVERSIONINFOEX));
+ osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+ gotOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *)&osVersionInfo);
+ if (gotOsVersionInfoEx == FALSE) {
+ GetVersionEx((OSVERSIONINFO *)&osVersionInfo);
+ }
+
+ switch (osVersionInfo.dwPlatformId) {
+ case VER_PLATFORM_WIN32_NT:
+ if ((osVersionInfo.dwMajorVersion == 5) && (osVersionInfo.dwMinorVersion == 2)) {
+ strcat(windowsVersion, "Server 2003");
+ } else if ((osVersionInfo.dwMajorVersion == 5) && (osVersionInfo.dwMinorVersion == 1)) {
+ strcat(windowsVersion, "XP");
+ } else if ((osVersionInfo.dwMajorVersion == 5) && (osVersionInfo.dwMinorVersion == 0)) {
+ strcat(windowsVersion, "2000");
+ } else if (osVersionInfo.dwMajorVersion <= 4) {
+ strcat(windowsVersion, "NT");
+ }
+ if (gotOsVersionInfoEx == TRUE) {
+ if (osVersionInfo.wProductType == VER_NT_WORKSTATION) {
+ if (osVersionInfo.dwMajorVersion == 4) {
+ strcat(windowsVersion, " Workstation 4.0");
+ } else if (osVersionInfo.wSuiteMask & VER_SUITE_PERSONAL) {
+ strcat(windowsVersion, " Home Edition");
+ } else {
+ strcat(windowsVersion, " Professional");
+ }
+ } else if (osVersionInfo.wProductType == VER_NT_SERVER) {
+ if ((osVersionInfo.dwMajorVersion == 5) && (osVersionInfo.dwMinorVersion == 2)) {
+ if (osVersionInfo.wSuiteMask & VER_SUITE_DATACENTER) {
+ strcat(windowsVersion, " Datacenter Edition");
+ } else if (osVersionInfo.wSuiteMask & VER_SUITE_ENTERPRISE) {
+ strcat(windowsVersion, " Enterprise Edition");
+ } else if (osVersionInfo.wSuiteMask == VER_SUITE_BLADE) {
+ strcat(windowsVersion, " Web Edition");
+ } else {
+ strcat(windowsVersion, " Standard Edition");
+ }
+ } else if ((osVersionInfo.dwMajorVersion == 5) && (osVersionInfo.dwMinorVersion == 0)) {
+ if (osVersionInfo.wSuiteMask & VER_SUITE_DATACENTER) {
+ strcat(windowsVersion, " Datacenter Server");
+ } else if (osVersionInfo.wSuiteMask & VER_SUITE_ENTERPRISE) {
+ strcat(windowsVersion, " Advanced Server");
+ } else {
+ strcat(windowsVersion, " Server");
+ }
+ } else {
+ if (osVersionInfo.wSuiteMask & VER_SUITE_ENTERPRISE) {
+ strcat(windowsVersion, " Server 4.0, Enterprise Edition");
+ } else {
+ strcat(windowsVersion, " Server 4.0");
+ }
+ }
+ }
+ } else {
+ char productType[80];
+ DWORD productTypeSz = 80;
+
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\ProductOptions", 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {
+ if (RegQueryValueEx(hKey, "ProductType", NULL, NULL, (LPBYTE) productType, &productTypeSz) == ERROR_SUCCESS) {
+ char versionStr[10];
+ if (strcmpi("WINNT", productType) == 0) {
+ strcat(windowsVersion, " Workstation");
+ } else if (strcmpi("LANMANNT", productType) == 0) {
+ strcat(windowsVersion, " Server");
+ } else if (strcmpi("SERVERNT", productType) == 0) {
+ strcat(windowsVersion, " Advanced Server");
+ }
+ sprintf(versionStr, " %d.%d", (int)osVersionInfo.dwMajorVersion, (int)osVersionInfo.dwMinorVersion);
+ strcat(windowsVersion, versionStr);
+ }
+ RegCloseKey(hKey);
+ }
+ }
+ break;
+ case VER_PLATFORM_WIN32_WINDOWS:
+ if ((osVersionInfo.dwMajorVersion == 4) && (osVersionInfo.dwMinorVersion == 90)) {
+ strcat(windowsVersion, "ME");
+ } else if ((osVersionInfo.dwMajorVersion == 4) && (osVersionInfo.dwMinorVersion == 10)) {
+ strcat(windowsVersion, "98");
+ if (osVersionInfo.szCSDVersion[1] == 'A') {
+ strcat(windowsVersion, " SE");
+ }
+ } else if ((osVersionInfo.dwMajorVersion == 4) && (osVersionInfo.dwMinorVersion == 0)) {
+ strcat(windowsVersion, "95");
+ if ((osVersionInfo.szCSDVersion[1] == 'C') || (osVersionInfo.szCSDVersion[1] == 'B')) {
+ strcat(windowsVersion, " OSR2");
+ }
+ }
+ break;
+ }
+
+ gethostname(hostname, sizeof(hostname));
+
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS) {
+ RegQueryValueEx(hKey, "Identifier", NULL, NULL, (LPBYTE)&identifier, &identifierSz);
+ RegCloseKey(hKey);
+ }
+
+ /* Output is made to look like results from uname -a */
+ snprintf(stringbuf, stringbuflen,
+ "Windows %s %d.%d.%d %s %s %s", hostname,
+ (int)osVersionInfo.dwMajorVersion, (int)osVersionInfo.dwMinorVersion,
+ (int)osVersionInfo.dwBuildNumber, osVersionInfo.szCSDVersion,
+ windowsVersion, identifier);
+}
+#endif /* WIN32 and HAVE_WIN32_PLATFORM_SDK or mingw32 */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/system_mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/system_mib.h
new file mode 100644
index 0000000000..ec3312d35a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/system_mib.h
@@ -0,0 +1,31 @@
+/*
+ * System MIB group interface - system.h
+ *
+ */
+#ifndef _MIBGROUP_SYSTEM_MIB_H
+#define _MIBGROUP_SYSTEM_MIB_H
+
+config_require(util_funcs)
+
+ extern char version_descr[];
+
+ void init_system_mib(void);
+ extern FindVarMethod var_system;
+
+/*
+ * config file parsing routines
+ */
+ void system_parse_config_sysloc(const char *, char *);
+ void system_parse_config_syscon(const char *, char *);
+ void system_parse_config_sysname(const char *, char *);
+
+#define VERSION_DESCR 1
+#define VERSIONID 2
+#define UPTIME 3
+#define SYSCONTACT 4
+#define SYSTEMNAME 5
+#define SYSLOCATION 6
+#define SYSSERVICES 7
+#define SYSORLASTCHANGE 8
+
+#endif /* _MIBGROUP_SYSTEM_MIB_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/tcp.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/tcp.c
new file mode 100644
index 0000000000..7e707009cd
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/tcp.c
@@ -0,0 +1,793 @@
+
+/*
+ * TCP MIB group implementation - tcp.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include "mibII_common.h"
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#if HAVE_SYS_PROTOSW_H
+#include <sys/protosw.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#if defined(osf4) || defined(osf5) || defined(aix4) || defined(hpux10)
+/*
+ * these are undefed to remove a stupid warning on osf compilers
+ * because they get redefined with a slightly different notation of the
+ * same value. -- Wes
+ */
+#undef TCP_NODELAY
+#undef TCP_MAXSEG
+#endif
+#if HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
+#if HAVE_NETINET_TCPIP_H
+#include <netinet/tcpip.h>
+#endif
+#if HAVE_NETINET_TCP_TIMER_H
+#include <netinet/tcp_timer.h>
+#endif
+#if HAVE_NETINET_TCP_VAR_H
+#include <netinet/tcp_var.h>
+#endif
+#if HAVE_NETINET_TCP_FSM_H
+#include <netinet/tcp_fsm.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"
+#include "tcp.h"
+#include "tcpTable.h"
+#include "sysORTable.h"
+
+#ifndef MIB_STATS_CACHE_TIMEOUT
+#define MIB_STATS_CACHE_TIMEOUT 5
+#endif
+#ifndef TCP_STATS_CACHE_TIMEOUT
+#define TCP_STATS_CACHE_TIMEOUT MIB_STATS_CACHE_TIMEOUT
+#endif
+
+#if defined(HAVE_LIBPERFSTAT_H) && (defined(aix4) || defined(aix5) || defined(aix6)) && !defined(FIRST_PROTOCOL)
+#include <libperfstat.h>
+#ifdef FIRST_PROTOCOL
+perfstat_protocol_t ps_proto;
+perfstat_id_t ps_name;
+#define _USE_FIRST_PROTOCOL 1
+#endif
+#endif
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+ /*
+ * FreeBSD4 *does* need an explicit variable 'hz'
+ * since this appears in a system header file.
+ * But only define it under FreeBSD, since it
+ * breaks other systems (notable AIX)
+ */
+#ifdef freebsd4
+int hz = 1000;
+#endif
+
+extern int TCP_Count_Connections( void );
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath, and the OID for the MIB module
+ */
+oid tcp_oid[] = { SNMP_OID_MIB2, 6 };
+oid tcp_module_oid[] = { SNMP_OID_MIB2, 49 };
+
+void
+init_tcp(void)
+{
+ netsnmp_handler_registration *reginfo;
+
+ /*
+ * register ourselves with the agent as a group of scalars...
+ */
+ DEBUGMSGTL(("mibII/tcpScalar", "Initialising TCP scalar group\n"));
+ reginfo = netsnmp_create_handler_registration("tcp", tcp_handler,
+ tcp_oid, OID_LENGTH(tcp_oid), HANDLER_CAN_RONLY);
+ netsnmp_register_scalar_group(reginfo, TCPRTOALGORITHM, TCPOUTRSTS);
+
+ /*
+ * .... with a local cache
+ * (except for HP-UX 11, which extracts objects individually)
+ */
+#ifndef hpux11
+ netsnmp_inject_handler( reginfo,
+ netsnmp_get_cache_handler(TCP_STATS_CACHE_TIMEOUT,
+ tcp_load, tcp_free,
+ tcp_oid, OID_LENGTH(tcp_oid)));
+#endif
+
+ REGISTER_SYSOR_ENTRY(tcp_module_oid,
+ "The MIB module for managing TCP implementations");
+
+#if !defined(_USE_FIRST_PROTOCOL)
+#ifdef TCPSTAT_SYMBOL
+ auto_nlist(TCPSTAT_SYMBOL, 0, 0);
+#endif
+#ifdef TCP_SYMBOL
+ auto_nlist(TCP_SYMBOL, 0, 0);
+#endif
+#ifdef freebsd4
+ hz = sysconf(_SC_CLK_TCK); /* get ticks/s from system */
+#endif
+#ifdef solaris2
+ init_kernel_sunos5();
+#endif
+#endif
+}
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+#ifdef hpux11
+#define TCP_STAT_STRUCTURE int
+#endif
+
+#ifdef linux
+#define TCP_STAT_STRUCTURE struct tcp_mib
+#define USES_SNMP_DESIGNED_TCPSTAT
+#undef TCPSTAT_SYMBOL
+#endif
+
+#ifdef solaris2
+#define TCP_STAT_STRUCTURE mib2_tcp_t
+#define USES_SNMP_DESIGNED_TCPSTAT
+#endif
+
+#if defined (WIN32) || defined (cygwin)
+#include <iphlpapi.h>
+#define TCP_STAT_STRUCTURE MIB_TCPSTATS
+#endif
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+#define TCP_STAT_STRUCTURE struct kna
+#define USES_TRADITIONAL_TCPSTAT
+#endif
+
+#if !defined(TCP_STAT_STRUCTURE)
+#define TCP_STAT_STRUCTURE struct tcpstat
+#define USES_TRADITIONAL_TCPSTAT
+#endif
+
+TCP_STAT_STRUCTURE tcpstat;
+
+
+
+ /*********************
+ *
+ * System independent handler (mostly)
+ *
+ *********************/
+
+
+
+int
+tcp_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ netsnmp_request_info *request;
+ netsnmp_variable_list *requestvb;
+ long ret_value = -1;
+ oid subid;
+ int type = ASN_COUNTER;
+
+ /*
+ * The cached data should already have been loaded by the
+ * cache handler, higher up the handler chain.
+ * But just to be safe, check this and load it manually if necessary
+ */
+#if defined(_USE_FIRST_PROTOCOL)
+ tcp_load(NULL, NULL);
+#elif !defined(hpux11)
+ if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) {
+ netsnmp_assert(!"cache == valid"); /* always false */
+ tcp_load( NULL, NULL ); /* XXX - check for failure */
+ }
+#endif
+
+
+ /*
+ *
+ *
+ */
+ DEBUGMSGTL(("mibII/tcpScalar", "Handler - mode %s\n",
+ se_find_label_in_slist("agent_mode", reqinfo->mode)));
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ for (request=requests; request; request=request->next) {
+ requestvb = request->requestvb;
+ subid = requestvb->name[OID_LENGTH(tcp_oid)]; /* XXX */
+
+ DEBUGMSGTL(( "mibII/tcpScalar", "oid: "));
+ DEBUGMSGOID(("mibII/tcpScalar", requestvb->name,
+ requestvb->name_length));
+ DEBUGMSG(( "mibII/tcpScalar", "\n"));
+ switch (subid) {
+#ifdef USES_SNMP_DESIGNED_TCPSTAT
+ case TCPRTOALGORITHM:
+ ret_value = tcpstat.tcpRtoAlgorithm;
+ type = ASN_INTEGER;
+ break;
+ case TCPRTOMIN:
+ ret_value = tcpstat.tcpRtoMin;
+ type = ASN_INTEGER;
+ break;
+ case TCPRTOMAX:
+ ret_value = tcpstat.tcpRtoMax;
+ type = ASN_INTEGER;
+ break;
+ case TCPMAXCONN:
+ ret_value = tcpstat.tcpMaxConn;
+ type = ASN_INTEGER;
+ break;
+ case TCPACTIVEOPENS:
+ ret_value = tcpstat.tcpActiveOpens;
+ break;
+ case TCPPASSIVEOPENS:
+ ret_value = tcpstat.tcpPassiveOpens;
+ break;
+ case TCPATTEMPTFAILS:
+ ret_value = tcpstat.tcpAttemptFails;
+ break;
+ case TCPESTABRESETS:
+ ret_value = tcpstat.tcpEstabResets;
+ break;
+ case TCPCURRESTAB:
+ ret_value = tcpstat.tcpCurrEstab;
+ type = ASN_GAUGE;
+ break;
+ case TCPINSEGS:
+ ret_value = tcpstat.tcpInSegs;
+ break;
+ case TCPOUTSEGS:
+ ret_value = tcpstat.tcpOutSegs;
+ break;
+ case TCPRETRANSSEGS:
+ ret_value = tcpstat.tcpRetransSegs;
+ break;
+ case TCPINERRS:
+#ifdef solaris2
+ ret_value = tcp_load(NULL, (void *)TCPINERRS);
+ if (ret_value == -1) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+ }
+ break;
+#elif defined(linux)
+ if (tcpstat.tcpInErrsValid) {
+ ret_value = tcpstat.tcpInErrs;
+ break;
+ } else {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+ }
+#else /* linux */
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+#endif /* solaris2 */
+ case TCPOUTRSTS:
+#ifdef linux
+ if (tcpstat.tcpOutRstsValid) {
+ ret_value = tcpstat.tcpOutRsts;
+ break;
+ }
+#endif /* linux */
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+#elif defined(USES_TRADITIONAL_TCPSTAT) && !defined(_USE_FIRST_PROTOCOL)
+#ifdef HAVE_SYS_TCPIPSTATS_H
+ /*
+ * This actually reads statistics for *all* the groups together,
+ * so we need to isolate the TCP-specific bits.
+ */
+#define tcpstat tcpstat.tcpstat
+#endif
+ case TCPRTOALGORITHM: /* Assume Van Jacobsen's algorithm */
+ ret_value = 4;
+ type = ASN_INTEGER;
+ break;
+ case TCPRTOMIN:
+#ifdef TCPTV_NEEDS_HZ
+ ret_value = TCPTV_MIN;
+#else
+ ret_value = TCPTV_MIN / PR_SLOWHZ * 1000;
+#endif
+ type = ASN_INTEGER;
+ break;
+ case TCPRTOMAX:
+#ifdef TCPTV_NEEDS_HZ
+ ret_value = TCPTV_REXMTMAX;
+#else
+ ret_value = TCPTV_REXMTMAX / PR_SLOWHZ * 1000;
+#endif
+ type = ASN_INTEGER;
+ break;
+ case TCPMAXCONN:
+ ret_value = -1; /* Dynamic maximum */
+ type = ASN_INTEGER;
+ break;
+ case TCPACTIVEOPENS:
+ ret_value = tcpstat.tcps_connattempt;
+ break;
+ case TCPPASSIVEOPENS:
+ ret_value = tcpstat.tcps_accepts;
+ break;
+ /*
+ * NB: tcps_drops is actually the sum of the two MIB
+ * counters tcpAttemptFails and tcpEstabResets.
+ */
+ case TCPATTEMPTFAILS:
+ ret_value = tcpstat.tcps_conndrops;
+ break;
+ case TCPESTABRESETS:
+ ret_value = tcpstat.tcps_drops;
+ break;
+ case TCPCURRESTAB:
+#ifdef USING_MIBII_TCPTABLE_MODULE
+ ret_value = TCP_Count_Connections();
+#else
+ ret_value = 0;
+#endif
+ type = ASN_GAUGE;
+ break;
+ case TCPINSEGS:
+ ret_value = tcpstat.tcps_rcvtotal;
+ break;
+ case TCPOUTSEGS:
+ /*
+ * RFC 1213 defines this as the number of segments sent
+ * "excluding those containing only retransmitted octets"
+ */
+ ret_value = tcpstat.tcps_sndtotal - tcpstat.tcps_sndrexmitpack;
+ break;
+ case TCPRETRANSSEGS:
+ ret_value = tcpstat.tcps_sndrexmitpack;
+ break;
+ case TCPINERRS:
+ ret_value = tcpstat.tcps_rcvbadsum + tcpstat.tcps_rcvbadoff
+#ifdef STRUCT_TCPSTAT_HAS_TCPS_RCVMEMDROP
+ + tcpstat.tcps_rcvmemdrop
+#endif
+ + tcpstat.tcps_rcvshort;
+ break;
+ case TCPOUTRSTS:
+ ret_value = tcpstat.tcps_sndctrl - tcpstat.tcps_closed;
+ break;
+#ifdef HAVE_SYS_TCPIPSTATS_H
+#undef tcpstat
+#endif
+#elif defined(hpux11)
+ case TCPRTOALGORITHM:
+ case TCPRTOMIN:
+ case TCPRTOMAX:
+ case TCPMAXCONN:
+ case TCPCURRESTAB:
+ if (subid == TCPCURRESTAB)
+ type = ASN_GAUGE;
+ else
+ type = ASN_INTEGER;
+ case TCPACTIVEOPENS:
+ case TCPPASSIVEOPENS:
+ case TCPATTEMPTFAILS:
+ case TCPESTABRESETS:
+ case TCPINSEGS:
+ case TCPOUTSEGS:
+ case TCPRETRANSSEGS:
+ case TCPINERRS:
+ case TCPOUTRSTS:
+ /*
+ * This is a bit of a hack, to shoehorn the HP-UX 11
+ * single-object retrieval approach into the caching
+ * architecture.
+ */
+ if (tcp_load(NULL, (void*)subid) == -1 ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+ }
+ ret_value = tcpstat;
+ break;
+#elif defined (WIN32) || defined (cygwin)
+ case TCPRTOALGORITHM:
+ ret_value = tcpstat.dwRtoAlgorithm;
+ type = ASN_INTEGER;
+ break;
+ case TCPRTOMIN:
+ ret_value = tcpstat.dwRtoMin;
+ type = ASN_INTEGER;
+ break;
+ case TCPRTOMAX:
+ ret_value = tcpstat.dwRtoMax;
+ type = ASN_INTEGER;
+ break;
+ case TCPMAXCONN:
+ ret_value = tcpstat.dwMaxConn;
+ type = ASN_INTEGER;
+ break;
+ case TCPACTIVEOPENS:
+ ret_value = tcpstat.dwActiveOpens;
+ break;
+ case TCPPASSIVEOPENS:
+ ret_value = tcpstat.dwPassiveOpens;
+ break;
+ case TCPATTEMPTFAILS:
+ ret_value = tcpstat.dwAttemptFails;
+ break;
+ case TCPESTABRESETS:
+ ret_value = tcpstat.dwEstabResets;
+ break;
+ case TCPCURRESTAB:
+ ret_value = tcpstat.dwCurrEstab;
+ type = ASN_GAUGE;
+ break;
+ case TCPINSEGS:
+ ret_value = tcpstat.dwInSegs;
+ break;
+ case TCPOUTSEGS:
+ ret_value = tcpstat.dwOutSegs;
+ break;
+ case TCPRETRANSSEGS:
+ ret_value = tcpstat.dwRetransSegs;
+ break;
+ case TCPINERRS:
+ ret_value = tcpstat.dwInErrs;
+ break;
+ case TCPOUTRSTS:
+ ret_value = tcpstat.dwOutRsts;
+ break;
+#elif defined(_USE_FIRST_PROTOCOL)
+ case TCPRTOALGORITHM:
+ ret_value = 4;
+ type = ASN_INTEGER;
+ break;
+ case TCPRTOMIN:
+ ret_value = 0;
+ type = ASN_INTEGER;
+ break;
+ case TCPRTOMAX:
+ ret_value = 0;
+ type = ASN_INTEGER;
+ break;
+ case TCPMAXCONN:
+ ret_value = -1;
+ type = ASN_INTEGER;
+ break;
+ case TCPACTIVEOPENS:
+ ret_value = ps_proto.u.tcp.initiated;
+ break;
+ case TCPPASSIVEOPENS:
+ ret_value = ps_proto.u.tcp.accepted;
+ break;
+ case TCPATTEMPTFAILS:
+ ret_value = ps_proto.u.tcp.dropped;
+ break;
+ case TCPESTABRESETS:
+ ret_value = ps_proto.u.tcp.dropped;
+ break;
+ case TCPCURRESTAB:
+ /* this value is currently missing */
+ ret_value = 0; /*ps_proto.u.tcp.established;*/
+ type = ASN_GAUGE;
+ break;
+ case TCPINSEGS:
+ ret_value = ps_proto.u.tcp.ipackets;
+ break;
+ case TCPOUTSEGS:
+ ret_value = ps_proto.u.tcp.opackets;
+ break;
+ case TCPRETRANSSEGS:
+ ret_value = 0;
+ break;
+ case TCPINERRS:
+ ret_value = ps_proto.u.tcp.ierrors;
+ break;
+ case TCPOUTRSTS:
+ ret_value = 0;
+ break;
+#endif /* USES_SNMP_DESIGNED_TCPSTAT */
+
+ case TCPCONNTABLE:
+ /*
+ * This is not actually a valid scalar object.
+ * The table registration should take precedence,
+ * so skip this subtree, regardless of architecture.
+ */
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+
+ }
+ snmp_set_var_typed_value(request->requestvb, (u_char)type,
+ (u_char *)&ret_value, sizeof(ret_value));
+ }
+ break;
+
+ case MODE_GETNEXT:
+ case MODE_GETBULK:
+ case MODE_SET_RESERVE1:
+ case MODE_SET_RESERVE2:
+ case MODE_SET_ACTION:
+ case MODE_SET_COMMIT:
+ case MODE_SET_FREE:
+ case MODE_SET_UNDO:
+ snmp_log(LOG_WARNING, "mibII/tcp: Unsupported mode (%d)\n",
+ reqinfo->mode);
+ break;
+ default:
+ snmp_log(LOG_WARNING, "mibII/tcp: Unrecognised mode (%d)\n",
+ reqinfo->mode);
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+#ifdef hpux11
+int
+tcp_load(netsnmp_cache *cache, void *vmagic)
+{
+ int fd;
+ struct nmparms p;
+ unsigned int ulen;
+ int ret;
+ int magic = (int) vmagic;
+
+ if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) < 0) {
+ DEBUGMSGTL(("mibII/tcpScalar", "Failed to load TCP object %d (hpux11)\n", magic));
+ return (-1); /* error */
+ }
+
+ switch (magic) {
+ case TCPRTOALGORITHM:
+ p.objid = ID_tcpRtoAlgorithm;
+ break;
+ case TCPRTOMIN:
+ p.objid = ID_tcpRtoMin;
+ break;
+ case TCPRTOMAX:
+ p.objid = ID_tcpRtoMax;
+ break;
+ case TCPMAXCONN:
+ p.objid = ID_tcpMaxConn;
+ break;
+ case TCPACTIVEOPENS:
+ p.objid = ID_tcpActiveOpens;
+ break;
+ case TCPPASSIVEOPENS:
+ p.objid = ID_tcpPassiveOpens;
+ break;
+ case TCPATTEMPTFAILS:
+ p.objid = ID_tcpAttemptFails;
+ break;
+ case TCPESTABRESETS:
+ p.objid = ID_tcpEstabResets;
+ break;
+ case TCPCURRESTAB:
+ p.objid = ID_tcpCurrEstab;
+ break;
+ case TCPINSEGS:
+ p.objid = ID_tcpInSegs;
+ break;
+ case TCPOUTSEGS:
+ p.objid = ID_tcpOutSegs;
+ break;
+ case TCPRETRANSSEGS:
+ p.objid = ID_tcpRetransSegs;
+ break;
+ case TCPINERRS:
+ p.objid = ID_tcpInErrs;
+ break;
+ case TCPOUTRSTS:
+ p.objid = ID_tcpOutRsts;
+ break;
+ default:
+ tcpstat = 0;
+ close_mib(fd);
+ return -1;
+ }
+
+ p.buffer = (void *)&tcpstat;
+ ulen = sizeof(TCP_STAT_STRUCTURE);
+ p.len = &ulen;
+ ret = get_mib_info(fd, &p);
+ close_mib(fd);
+
+ DEBUGMSGTL(("mibII/tcpScalar", "%s TCP object %d (hpux11)\n",
+ (ret < 0 ? "Failed to load" : "Loaded"), magic));
+ return (ret); /* 0: ok, < 0: error */
+}
+#elif defined(linux)
+int
+tcp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ ret_value = linux_read_tcp_stat(&tcpstat);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/tcpScalar", "Failed to load TCP scalar Group (linux)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/tcpScalar", "Loaded TCP scalar Group (linux)\n"));
+ }
+ return ret_value;
+}
+#elif defined(solaris2)
+int
+tcp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+ int magic = (int)vmagic;
+ mib2_ip_t ipstat;
+
+ /*
+ * tcpInErrs is actually implemented as part of the MIB_IP group
+ * so we need to retrieve this independently
+ */
+ if (magic == TCPINERRS) {
+ if (getMibstat
+ (MIB_IP, &ipstat, sizeof(mib2_ip_t), GET_FIRST,
+ &Get_everything, NULL) < 0) {
+ DEBUGMSGTL(("mibII/tcpScalar", "Failed to load TCP object %d (solaris)\n", magic));
+ return -1;
+ } else {
+ DEBUGMSGTL(("mibII/tcpScalar", "Loaded TCP object %d (solaris)\n", magic));
+ return ipstat.tcpInErrs;
+ }
+ }
+
+ /*
+ * Otherwise, retrieve the whole of the MIB_TCP group (and cache it)
+ */
+ ret_value = getMibstat(MIB_TCP, &tcpstat, sizeof(mib2_tcp_t),
+ GET_FIRST, &Get_everything, NULL);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/tcpScalar", "Failed to load TCP scalar Group (solaris)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/tcpScalar", "Loaded TCP scalar Group (solaris)\n"));
+ }
+ return ret_value;
+}
+#elif defined (WIN32) || defined (cygwin)
+int
+tcp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ ret_value = GetTcpStatistics(&tcpstat);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/tcpScalar", "Failed to load TCP scalar Group (win32)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/tcpScalar", "Loaded TCP scalar Group (win32)\n"));
+ }
+ return ret_value;
+}
+#elif defined(_USE_FIRST_PROTOCOL)
+int
+tcp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ strcpy(ps_name.name, "tcp");
+ ret_value = perfstat_protocol(&ps_name, &ps_proto, sizeof(ps_proto), 1);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/tcpScalar", "Failed to load TCP scalar Group (AIX)\n"));
+ } else {
+ ret_value = 0;
+ DEBUGMSGTL(("mibII/tcpScalar", "Loaded TCP scalar Group (AIX)\n"));
+ }
+ return ret_value;
+}
+#elif (defined(NETSNMP_CAN_USE_SYSCTL) && defined(TCPCTL_STATS))
+int
+tcp_load(netsnmp_cache *cache, void *vmagic)
+{
+ int sname[4] = { CTL_NET, PF_INET, IPPROTO_TCP, TCPCTL_STATS };
+ size_t len = sizeof(tcpstat);
+ long ret_value = -1;
+
+ ret_value = sysctl(sname, 4, &tcpstat, &len, 0, 0);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/tcpScalar", "Failed to load TCP scalar Group (sysctl)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/tcpScalar", "Loaded TCP scalar Group (sysctl)\n"));
+ }
+ return ret_value;
+}
+#elif defined(HAVE_SYS_TCPIPSTATS_H)
+int
+tcp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ ret_value = sysmp(MP_SAGET, MPSA_TCPIPSTATS, &tcpstat, sizeof(tcpstat));
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/tcpScalar", "Failed to load TCP scalar Group (tcpipstats)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/tcpScalar", "Loaded TCP scalar Group (tcpipstats)\n"));
+ }
+ return ret_value;
+}
+#elif defined(TCPSTAT_SYMBOL)
+int
+tcp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ if (auto_nlist(TCPSTAT_SYMBOL, (char *)&tcpstat, sizeof(tcpstat)))
+ ret_value = 0;
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/tcpScalar", "Failed to load TCP scalar Group (tcpstat)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/tcpScalar", "Loaded TCP scalar Group (tcpstat)\n"));
+ }
+ return ret_value;
+}
+#else /* TCPSTAT_SYMBOL */
+int
+tcp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ DEBUGMSGTL(("mibII/tcpScalar", "Failed to load TCP scalar Group (null)\n"));
+ return ret_value;
+}
+#endif /* WIN32 cygwin */
+
+
+void
+tcp_free(netsnmp_cache *cache, void *magic)
+{
+#if defined(_USE_FIRST_PROTOCOL)
+ memset(&ps_proto, 0, sizeof(ps_proto));
+#else
+ memset(&tcpstat, 0, sizeof(tcpstat));
+#endif
+}
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/tcp.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/tcp.h
new file mode 100644
index 0000000000..479661dfa5
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/tcp.h
@@ -0,0 +1,36 @@
+/*
+ * TCP MIB group interface - tcp.h
+ *
+ */
+#ifndef _MIBGROUP_TCP_H
+#define _MIBGROUP_TCP_H
+
+
+config_require(mibII/tcpTable util_funcs)
+config_arch_require(solaris2, kernel_sunos5)
+config_arch_require(linux, mibII/kernel_linux)
+
+extern void init_tcp(void);
+extern Netsnmp_Node_Handler tcp_handler;
+extern NetsnmpCacheLoad tcp_load;
+extern NetsnmpCacheFree tcp_free;
+
+
+#define TCPRTOALGORITHM 1
+#define TCPRTOMIN 2
+#define TCPRTOMAX 3
+#define TCPMAXCONN 4
+#define TCPACTIVEOPENS 5
+#define TCPPASSIVEOPENS 6
+#define TCPATTEMPTFAILS 7
+#define TCPESTABRESETS 8
+#define TCPCURRESTAB 9
+#define TCPINSEGS 10
+#define TCPOUTSEGS 11
+#define TCPRETRANSSEGS 12
+#define TCPCONNTABLE 13 /* Placeholder */
+#define TCPINERRS 14
+#define TCPOUTRSTS 15
+
+
+#endif /* _MIBGROUP_TCP_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/tcpTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/tcpTable.c
new file mode 100644
index 0000000000..4e512875e4
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/tcpTable.c
@@ -0,0 +1,903 @@
+/*
+ * TCP MIB group Table implementation - tcpTable.c
+ *
+ */
+
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include "mibII_common.h"
+
+#if HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
+#if HAVE_NETINET_TCP_TIMER_H
+#include <netinet/tcp_timer.h>
+#endif
+#if HAVE_NETINET_TCPIP_H
+#include <netinet/tcpip.h>
+#endif
+#if HAVE_NETINET_TCP_VAR_H
+#include <netinet/tcp_var.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "tcp.h"
+#include "tcpTable.h"
+#include "sysORTable.h"
+
+#ifdef hpux11
+#define TCPTABLE_ENTRY_TYPE mib_tcpConnEnt
+#define TCPTABLE_STATE State
+#define TCPTABLE_LOCALADDRESS LocalAddress
+#define TCPTABLE_LOCALPORT LocalPort
+#define TCPTABLE_REMOTEADDRESS RemAddress
+#define TCPTABLE_REMOTEPORT RemPort
+#define TCPTABLE_IS_TABLE
+#else
+
+#ifdef solaris2
+typedef struct netsnmp_tcpConnEntry_s netsnmp_tcpConnEntry;
+struct netsnmp_tcpConnEntry_s {
+ mib2_tcpConnEntry_t entry;
+ netsnmp_tcpConnEntry *inp_next;
+};
+#define TCPTABLE_ENTRY_TYPE netsnmp_tcpConnEntry
+#define TCPTABLE_STATE entry.tcpConnState
+#define TCPTABLE_LOCALADDRESS entry.tcpConnLocalAddress
+#define TCPTABLE_LOCALPORT entry.tcpConnLocalPort
+#define TCPTABLE_REMOTEADDRESS entry.tcpConnRemAddress
+#define TCPTABLE_REMOTEPORT entry.tcpConnRemPort
+#define TCPTABLE_IS_LINKED_LIST
+#else
+
+#if defined (WIN32) || defined (cygwin)
+#include <iphlpapi.h>
+#define TCPTABLE_ENTRY_TYPE MIB_TCPROW
+#define TCPTABLE_STATE dwState
+#define TCPTABLE_LOCALADDRESS dwLocalAddr
+#define TCPTABLE_LOCALPORT dwLocalPort
+#define TCPTABLE_REMOTEADDRESS dwRemoteAddr
+#define TCPTABLE_REMOTEPORT dwRemotePort
+#define TCPTABLE_IS_TABLE
+#else
+
+#ifdef linux
+#define TCPTABLE_ENTRY_TYPE struct inpcb
+#define TCPTABLE_STATE inp_state
+#define TCPTABLE_LOCALADDRESS inp_laddr.s_addr
+#define TCPTABLE_LOCALPORT inp_lport
+#define TCPTABLE_REMOTEADDRESS inp_faddr.s_addr
+#define TCPTABLE_REMOTEPORT inp_fport
+#define TCPTABLE_IS_LINKED_LIST
+
+#else /* everything else */
+
+typedef struct netsnmp_inpcb_s netsnmp_inpcb;
+struct netsnmp_inpcb_s {
+ struct inpcb pcb;
+ int state;
+ netsnmp_inpcb *inp_next;
+};
+#define INP_NEXT_SYMBOL inp_next
+#define TCPTABLE_ENTRY_TYPE netsnmp_inpcb
+#define TCPTABLE_STATE state
+#define TCPTABLE_LOCALADDRESS pcb.inp_laddr.s_addr
+#define TCPTABLE_LOCALPORT pcb.inp_lport
+#define TCPTABLE_REMOTEADDRESS pcb.inp_faddr.s_addr
+#define TCPTABLE_REMOTEPORT pcb.inp_fport
+#define TCPTABLE_IS_LINKED_LIST
+
+#endif /* linux */
+#endif /* WIN32 cygwin */
+#endif /* solaris2 */
+#endif /* hpux11 */
+
+ /* Head of linked list, or root of table */
+TCPTABLE_ENTRY_TYPE *tcp_head = NULL;
+int tcp_size = 0; /* Only used for table-based systems */
+int tcp_estab = 0;
+
+
+ /*
+ *
+ * Initialization and handler routines are common to all architectures
+ *
+ */
+#ifndef MIB_STATS_CACHE_TIMEOUT
+#define MIB_STATS_CACHE_TIMEOUT 5
+#endif
+#ifndef TCP_STATS_CACHE_TIMEOUT
+#define TCP_STATS_CACHE_TIMEOUT MIB_STATS_CACHE_TIMEOUT
+#endif
+
+#if defined(TCP_PORTS_IN_HOST_ORDER) && TCP_PORTS_IN_HOST_ORDER
+#define TCP_PORT_TO_HOST_ORDER(x) x
+#else
+#define TCP_PORT_TO_HOST_ORDER(x) ntohs(x)
+#endif
+
+oid tcpTable_oid[] = { SNMP_OID_MIB2, 6, 13 };
+
+void
+init_tcpTable(void)
+{
+ netsnmp_table_registration_info *table_info;
+ netsnmp_iterator_info *iinfo;
+ netsnmp_handler_registration *reginfo;
+
+ DEBUGMSGTL(("mibII/tcpTable", "Initialising TCP Table\n"));
+ /*
+ * Create the table data structure, and define the indexing....
+ */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ if (!table_info) {
+ return;
+ }
+ netsnmp_table_helper_add_indexes(table_info, ASN_IPADDRESS,
+ ASN_INTEGER,
+ ASN_IPADDRESS,
+ ASN_INTEGER, 0);
+ table_info->min_column = TCPCONNSTATE;
+ table_info->max_column = TCPCONNREMOTEPORT;
+
+
+ /*
+ * .... and iteration information ....
+ */
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+ if (!iinfo) {
+ return;
+ }
+ iinfo->get_first_data_point = tcpTable_first_entry;
+ iinfo->get_next_data_point = tcpTable_next_entry;
+ iinfo->table_reginfo = table_info;
+#if defined (WIN32) || defined (cygwin)
+ iinfo->flags |= NETSNMP_ITERATOR_FLAG_SORTED;
+#endif /* WIN32 || cygwin */
+
+
+ /*
+ * .... and register the table with the agent.
+ */
+ reginfo = netsnmp_create_handler_registration("tcpTable",
+ tcpTable_handler,
+ tcpTable_oid, OID_LENGTH(tcpTable_oid),
+ HANDLER_CAN_RONLY),
+ netsnmp_register_table_iterator(reginfo, iinfo);
+
+ /*
+ * .... with a local cache
+ * (except for Solaris, which uses a different approach)
+ */
+ netsnmp_inject_handler( reginfo,
+ netsnmp_get_cache_handler(TCP_STATS_CACHE_TIMEOUT,
+ tcpTable_load, tcpTable_free,
+ tcpTable_oid, OID_LENGTH(tcpTable_oid)));
+}
+
+
+
+int
+tcpTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ netsnmp_request_info *request;
+ netsnmp_variable_list *requestvb;
+ netsnmp_table_request_info *table_info;
+ TCPTABLE_ENTRY_TYPE *entry;
+ oid subid;
+ long port;
+ long state;
+
+ DEBUGMSGTL(("mibII/tcpTable", "Handler - mode %s\n",
+ se_find_label_in_slist("agent_mode", reqinfo->mode)));
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ for (request=requests; request; request=request->next) {
+ requestvb = request->requestvb;
+ DEBUGMSGTL(( "mibII/tcpTable", "oid: "));
+ DEBUGMSGOID(("mibII/tcpTable", requestvb->name,
+ requestvb->name_length));
+ DEBUGMSG(( "mibII/tcpTable", "\n"));
+
+ entry = (TCPTABLE_ENTRY_TYPE *)netsnmp_extract_iterator_context(request);
+ if (!entry)
+ continue;
+ table_info = netsnmp_extract_table_info(request);
+ subid = table_info->colnum;
+
+ switch (subid) {
+ case TCPCONNSTATE:
+ state = entry->TCPTABLE_STATE;
+ snmp_set_var_typed_value(requestvb, ASN_INTEGER,
+ (u_char *)&state, sizeof(state));
+ break;
+ case TCPCONNLOCALADDRESS:
+#if defined(osf5) && defined(IN6_EXTRACT_V4ADDR)
+ snmp_set_var_typed_value(requestvb, ASN_IPADDRESS,
+ (u_char*)IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr),
+ sizeof(IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr)));
+#else
+ snmp_set_var_typed_value(requestvb, ASN_IPADDRESS,
+ (u_char *)&entry->TCPTABLE_LOCALADDRESS,
+ sizeof(entry->TCPTABLE_LOCALADDRESS));
+#endif
+ break;
+ case TCPCONNLOCALPORT:
+ port = TCP_PORT_TO_HOST_ORDER((u_short)entry->TCPTABLE_LOCALPORT);
+ snmp_set_var_typed_value(requestvb, ASN_INTEGER,
+ (u_char *)&port, sizeof(port));
+ break;
+ case TCPCONNREMOTEADDRESS:
+#if defined(osf5) && defined(IN6_EXTRACT_V4ADDR)
+ snmp_set_var_typed_value(requestvb, ASN_IPADDRESS,
+ (u_char*)IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr),
+ sizeof(IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr)));
+#else
+ snmp_set_var_typed_value(requestvb, ASN_IPADDRESS,
+ (u_char *)&entry->TCPTABLE_REMOTEADDRESS,
+ sizeof(entry->TCPTABLE_REMOTEADDRESS));
+#endif
+ break;
+ case TCPCONNREMOTEPORT:
+ port = TCP_PORT_TO_HOST_ORDER((u_short)entry->TCPTABLE_REMOTEPORT);
+ snmp_set_var_typed_value(requestvb, ASN_INTEGER,
+ (u_char *)&port, sizeof(port));
+ break;
+ }
+ }
+ break;
+
+ case MODE_GETNEXT:
+ case MODE_GETBULK:
+ case MODE_SET_RESERVE1:
+ case MODE_SET_RESERVE2:
+ case MODE_SET_ACTION:
+ case MODE_SET_COMMIT:
+ case MODE_SET_FREE:
+ case MODE_SET_UNDO:
+ snmp_log(LOG_WARNING, "mibII/tcpTable: Unsupported mode (%d)\n",
+ reqinfo->mode);
+ break;
+ default:
+ snmp_log(LOG_WARNING, "mibII/tcpTable: Unrecognised mode (%d)\n",
+ reqinfo->mode);
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+TCP_Count_Connections( void ) {
+ return tcp_estab;
+}
+
+ /*
+ * Two forms of iteration hook routines:
+ * One for when the TCP table is stored as a table
+ * One for when the TCP table is stored as a linked list
+ *
+ * Also applies to the cache-handler free routine
+ */
+
+#ifdef TCPTABLE_IS_TABLE
+netsnmp_variable_list *
+tcpTable_first_entry(void **loop_context,
+ void **data_context,
+ netsnmp_variable_list *index,
+ netsnmp_iterator_info *data)
+{
+ /*
+ * XXX - How can we tell if the cache is valid?
+ * No access to 'reqinfo'
+ */
+ if (tcp_size == 0)
+ return NULL;
+
+ /*
+ * Point to the first entry, and use the
+ * 'next_entry' hook to retrieve this row
+ */
+ *loop_context = 0;
+ return tcpTable_next_entry( loop_context, data_context, index, data );
+}
+
+netsnmp_variable_list *
+tcpTable_next_entry( void **loop_context,
+ void **data_context,
+ netsnmp_variable_list *index,
+ netsnmp_iterator_info *data)
+{
+ int i = (int)*loop_context;
+ netsnmp_variable_list *idx;
+ long port;
+
+ if (tcp_size < i)
+ return NULL;
+
+ /*
+ * Set up the indexing for the specified row...
+ */
+ idx = index;
+#if defined (WIN32) || defined (cygwin)
+ port = ntohl((u_long)tcp_head[i].TCPTABLE_LOCALADDRESS);
+ snmp_set_var_value(idx, (u_char *)&port,
+ sizeof(tcp_head[i].TCPTABLE_LOCALADDRESS));
+#else
+ snmp_set_var_value(idx, (u_char *)&tcp_head[i].TCPTABLE_LOCALADDRESS,
+ sizeof(tcp_head[i].TCPTABLE_LOCALADDRESS));
+#endif
+
+ port = TCP_PORT_TO_HOST_ORDER((u_short)tcp_head[i].TCPTABLE_LOCALPORT);
+ idx = idx->next_variable;
+ snmp_set_var_value(idx, (u_char*)&port, sizeof(port));
+
+ idx = idx->next_variable;
+#if defined (WIN32) || defined (cygwin)
+ port = ntohl((u_long)tcp_head[i].TCPTABLE_REMOTEADDRESS);
+ snmp_set_var_value(idx, (u_char *)&port,
+ sizeof(tcp_head[i].TCPTABLE_REMOTEADDRESS));
+#else
+ snmp_set_var_value(idx, (u_char *)&tcp_head[i].TCPTABLE_REMOTEADDRESS,
+ sizeof(tcp_head[i].TCPTABLE_REMOTEADDRESS));
+#endif
+
+ port = TCP_PORT_TO_HOST_ORDER((u_short)tcp_head[i].TCPTABLE_REMOTEPORT);
+ idx = idx->next_variable;
+ snmp_set_var_value(idx, (u_char*)&port, sizeof(port));
+
+ /*
+ * ... return the data structure for this row,
+ * and update the loop context ready for the next one.
+ */
+ *data_context = (void*)&tcp_head[i];
+ *loop_context = (void*)++i;
+
+ return index;
+}
+
+void
+tcpTable_free(netsnmp_cache *cache, void *magic)
+{
+#if defined (WIN32) || defined (cygwin)
+ if (tcp_head) {
+ /* the allocated structure is a count followed by table entries */
+ free((char *)(tcp_head) - sizeof(DWORD));
+ }
+#else
+ if (tcp_head)
+ free(tcp_head);
+#endif
+ tcp_head = NULL;
+ tcp_size = 0;
+ tcp_estab = 0;
+}
+#else
+#ifdef TCPTABLE_IS_LINKED_LIST
+netsnmp_variable_list *
+tcpTable_first_entry(void **loop_context,
+ void **data_context,
+ netsnmp_variable_list *index,
+ netsnmp_iterator_info *data)
+{
+ /*
+ * XXX - How can we tell if the cache is valid?
+ * No access to 'reqinfo'
+ */
+ if (tcp_head == 0)
+ return NULL;
+
+ /*
+ * Point to the first entry, and use the
+ * 'next_entry' hook to retrieve this row
+ */
+ *loop_context = (void*)tcp_head;
+ return tcpTable_next_entry( loop_context, data_context, index, data );
+}
+
+netsnmp_variable_list *
+tcpTable_next_entry( void **loop_context,
+ void **data_context,
+ netsnmp_variable_list *index,
+ netsnmp_iterator_info *data)
+{
+ TCPTABLE_ENTRY_TYPE *entry = (TCPTABLE_ENTRY_TYPE *)*loop_context;
+ netsnmp_variable_list *idx;
+ long addr, port;
+
+ if (!entry)
+ return NULL;
+
+ /*
+ * Set up the indexing for the specified row...
+ */
+ idx = index;
+#if defined(osf5) && defined(IN6_EXTRACT_V4ADDR)
+ addr = ntohl(IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr));
+#else
+ addr = ntohl(entry->TCPTABLE_LOCALADDRESS);
+#endif
+ snmp_set_var_value(idx, (u_char *)&addr, sizeof(addr));
+
+ port = TCP_PORT_TO_HOST_ORDER(entry->TCPTABLE_LOCALPORT);
+ idx = idx->next_variable;
+ snmp_set_var_value(idx, (u_char*)&port, sizeof(port));
+
+ idx = idx->next_variable;
+#if defined(osf5) && defined(IN6_EXTRACT_V4ADDR)
+ addr = ntohl(IN6_EXTRACT_V4ADDR(&entry->pcb.inp_faddr));
+#else
+ addr = ntohl(entry->TCPTABLE_REMOTEADDRESS);
+#endif
+ snmp_set_var_value(idx, (u_char *)&addr, sizeof(addr));
+
+ port = TCP_PORT_TO_HOST_ORDER(entry->TCPTABLE_REMOTEPORT);
+ idx = idx->next_variable;
+ snmp_set_var_value(idx, (u_char*)&port, sizeof(port));
+
+ /*
+ * ... return the data structure for this row,
+ * and update the loop context ready for the next one.
+ */
+ *data_context = (void*)entry;
+ *loop_context = (void*)entry->INP_NEXT_SYMBOL;
+ return index;
+}
+
+void
+tcpTable_free(netsnmp_cache *cache, void *magic)
+{
+ TCPTABLE_ENTRY_TYPE *p;
+ while (tcp_head) {
+ p = tcp_head;
+ tcp_head = tcp_head->INP_NEXT_SYMBOL;
+ free(p);
+ }
+
+ tcp_head = NULL;
+ tcp_size = 0;
+ tcp_estab = 0;
+}
+#endif /* TCPTABLE_IS_LINKED_LIST */
+#endif /* TCPTABLE_IS_TABLE */
+
+
+ /*
+ *
+ * The cache-handler loading routine is the main
+ * place for architecture-specific code
+ *
+ * Load into either a table structure, or a linked list
+ * depending on the system architecture
+ */
+
+
+#ifdef hpux11
+int
+tcpTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ int fd;
+ struct nmparms p;
+ int val = 0;
+ unsigned int ulen;
+ int ret;
+ int i;
+
+ tcpTable_free(NULL, NULL);
+
+ if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) >= 0) {
+ p.objid = ID_tcpConnNumEnt;
+ p.buffer = (void *) &val;
+ ulen = sizeof(int);
+ p.len = &ulen;
+ if ((ret = get_mib_info(fd, &p)) == 0)
+ tcp_size = val;
+
+ if (tcp_size > 0) {
+ ulen = (unsigned) tcp_size *sizeof(mib_tcpConnEnt);
+ tcp_head = (mib_tcpConnEnt *) malloc(ulen);
+ p.objid = ID_tcpConnTable;
+ p.buffer = (void *) tcp_head;
+ p.len = &ulen;
+ if ((ret = get_mib_info(fd, &p)) < 0) {
+ tcp_size = 0;
+ }
+ }
+
+ close_mib(fd);
+ }
+
+ /*
+ * Count the number of established connections
+ * Probably not actually necessary for HP-UX
+ */
+ for (i = 0; i < tcp_size; i++) {
+ if (tcp_head[i].State == 5 /* established */ ||
+ tcp_head[i].State == 8 /* closeWait */ )
+ tcp_estab++;
+ }
+
+ if (tcp_size > 0) {
+ DEBUGMSGTL(("mibII/tcpTable", "Loaded TCP Table\n"));
+ return 0;
+ }
+ DEBUGMSGTL(("mibII/tcpTable", "Failed to load TCP Table (hpux11)\n"));
+ return -1;
+}
+#else /* hpux11 */
+
+#ifdef linux
+int
+tcpTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ FILE *in;
+ char line[256];
+
+ tcpTable_free(cache, NULL);
+
+ if (!(in = fopen("/proc/net/tcp", "r"))) {
+ DEBUGMSGTL(("mibII/tcpTable", "Failed to load TCP Table (linux1)\n"));
+ snmp_log(LOG_ERR, "snmpd: cannot open /proc/net/tcp ...\n");
+ return -1;
+ }
+
+ /*
+ * scan proc-file and build up a linked list
+ * This will actually be built up in reverse,
+ * but since the entries are unsorted, that doesn't matter.
+ */
+ while (line == fgets(line, sizeof(line), in)) {
+ struct inpcb pcb, *nnew;
+ static int linux_states[12] =
+ { 1, 5, 3, 4, 6, 7, 11, 1, 8, 9, 2, 10 };
+ int state, lp, fp, uid;
+
+ if (6 != sscanf(line,
+ "%*d: %x:%x %x:%x %x %*X:%*X %*X:%*X %*X %d",
+ &pcb.inp_laddr.s_addr, &lp,
+ &pcb.inp_faddr.s_addr, &fp, &state, &uid))
+ continue;
+
+ pcb.inp_lport = htons((unsigned short) lp);
+ pcb.inp_fport = htons((unsigned short) fp);
+
+ pcb.inp_state = (state & 0xf) < 12 ? linux_states[state & 0xf] : 2;
+ if (pcb.inp_state == 5 /* established */ ||
+ pcb.inp_state == 8 /* closeWait */ )
+ tcp_estab++;
+ pcb.uid = uid;
+
+ nnew = SNMP_MALLOC_TYPEDEF(struct inpcb);
+ if (nnew == NULL)
+ break;
+ memcpy(nnew, &pcb, sizeof(struct inpcb));
+ nnew->inp_next = tcp_head;
+ tcp_head = nnew;
+ }
+
+ fclose(in);
+
+ DEBUGMSGTL(("mibII/tcpTable", "Loaded TCP Table\n"));
+ return 0;
+}
+#else /* linux */
+
+#ifdef solaris2
+static int
+TCP_Cmp(void *addr, void *ep)
+{
+ if (memcmp((mib2_tcpConnEntry_t *) ep, (mib2_tcpConnEntry_t *) addr,
+ sizeof(mib2_tcpConnEntry_t)) == 0)
+ return (0);
+ else
+ return (1);
+}
+
+int
+tcpTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ mib2_tcpConnEntry_t entry;
+ netsnmp_tcpConnEntry *nnew;
+ netsnmp_tcpConnEntry *prev_entry = NULL;
+
+ tcpTable_free(NULL, NULL);
+
+ if (getMibstat(MIB_TCP_CONN, &entry, sizeof(mib2_tcpConnEntry_t),
+ GET_FIRST, &TCP_Cmp, &entry) != 0) {
+ DEBUGMSGTL(("mibII/tcpTable", "Failed to load TCP Table (solaris)\n"));
+ return -1;
+ }
+
+ while (1) {
+ /*
+ * Build up a linked list copy of the getMibstat results
+ * Note that since getMibstat returns rows in sorted order,
+ * we need to retain this order while building the list
+ * so new entries are added onto the end of the list.
+ * Note 2: at least Solaris 8-10 do not return rows in
+ * sorted order anymore
+ */
+ nnew = SNMP_MALLOC_TYPEDEF(netsnmp_tcpConnEntry);
+ if (nnew == NULL)
+ break;
+ memcpy(&(nnew->entry), &entry, sizeof(mib2_tcpConnEntry_t));
+ if (!prev_entry)
+ tcp_head = nnew;
+ else
+ prev_entry->inp_next = nnew;
+ prev_entry = nnew;
+
+ if (getMibstat(MIB_TCP_CONN, &entry, sizeof(mib2_tcpConnEntry_t),
+ GET_NEXT, &TCP_Cmp, &entry) != 0)
+ break;
+ }
+
+ if (tcp_head) {
+ DEBUGMSGTL(("mibII/tcpTable", "Loaded TCP Table\n"));
+ return 0;
+ }
+ DEBUGMSGTL(("mibII/tcpTable", "Failed to load TCP Table (solaris)\n"));
+ return -1;
+}
+#else /* solaris2 */
+
+#if defined (WIN32) || defined (cygwin)
+int
+tcpTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ PMIB_TCPTABLE pTcpTable = NULL;
+ DWORD dwActualSize = 0;
+ DWORD status = NO_ERROR;
+
+ /*
+ * query for the buffer size needed
+ */
+ status = GetTcpTable(pTcpTable, &dwActualSize, TRUE);
+ if (status == ERROR_INSUFFICIENT_BUFFER) {
+ pTcpTable = (PMIB_TCPTABLE) malloc(dwActualSize);
+ if (pTcpTable != NULL) {
+ /*
+ * Get the sorted TCP table
+ */
+ status = GetTcpTable(pTcpTable, &dwActualSize, TRUE);
+ }
+ }
+
+ if (status == NO_ERROR) {
+ int i;
+
+ DEBUGMSGTL(("mibII/tcpTable", "Loaded TCP Table\n"));
+ tcp_size = pTcpTable->dwNumEntries -1; /* entries are counted starting with 0 */
+ tcp_head = pTcpTable->table;
+
+ /*
+ * Count the number of established connections
+ * Probably not actually necessary for Windows
+ */
+ for (i = 0; i < tcp_size; i++) {
+ if (tcp_head[i].dwState == 5 /* established */ ||
+ tcp_head[i].dwState == 8 /* closeWait */ )
+ tcp_estab++;
+ }
+ return 0;
+ }
+
+ DEBUGMSGTL(("mibII/tcpTable", "Failed to load TCP Table (win32)\n"));
+ if (pTcpTable)
+ free(pTcpTable);
+ return -1;
+}
+#else /* WIN32 cygwin */
+
+#if (defined(NETSNMP_CAN_USE_SYSCTL) && defined(TCPCTL_PCBLIST))
+
+#if defined(freebsd4) || defined(darwin)
+ #define NS_ELEM struct xtcpcb
+#else
+ #define NS_ELEM struct xinpcb
+#endif
+
+int
+tcpTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ size_t len;
+ int sname[] = { CTL_NET, PF_INET, IPPROTO_TCP, TCPCTL_PCBLIST };
+ char *tcpcb_buf = NULL;
+ struct xinpgen *xig = NULL;
+ netsnmp_inpcb *nnew;
+ int StateMap[] = { 1, 2, 3, 4, 5, 8, 6, 10, 9, 7, 11 };
+
+ tcpTable_free(NULL, NULL);
+
+ /*
+ * Read in the buffer containing the TCP table data
+ */
+ len = 0;
+ if (sysctl(sname, 4, 0, &len, 0, 0) < 0 ||
+ (tcpcb_buf = malloc(len)) == NULL)
+ return -1;
+ if (sysctl(sname, 4, tcpcb_buf, &len, 0, 0) < 0) {
+ free(tcpcb_buf);
+ return -1;
+ }
+
+ /*
+ * Unpick this into the constituent 'xinpgen' structures, and extract
+ * the 'inpcb' elements into a linked list (built in reverse)
+ */
+ xig = (struct xinpgen *) tcpcb_buf;
+ xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+
+ while (xig && (xig->xig_len > sizeof(struct xinpgen))) {
+ nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb);
+ if (!nnew)
+ break;
+ nnew->state = StateMap[((NS_ELEM *) xig)->xt_tp.t_state];
+ if (nnew->state == 5 /* established */ ||
+ nnew->state == 8 /* closeWait */ )
+ tcp_estab++;
+ memcpy(&(nnew->pcb), &(((NS_ELEM *) xig)->xt_inp),
+ sizeof(struct inpcb));
+
+ nnew->inp_next = tcp_head;
+ tcp_head = nnew;
+ xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+ }
+
+ free(tcpcb_buf);
+ if (tcp_head) {
+ DEBUGMSGTL(("mibII/tcpTable", "Loaded TCP Table\n"));
+ return 0;
+ }
+ DEBUGMSGTL(("mibII/tcpTable", "Failed to load TCP Table (sysctl)\n"));
+ return -1;
+}
+#undef NS_ELEM
+
+#else /* (defined(NETSNMP_CAN_USE_SYSCTL) && defined(TCPCTL_PCBLIST)) */
+#ifdef PCB_TABLE
+int
+tcpTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ struct inpcbtable table;
+ struct inpcb *entry;
+ struct tcpcb tcpcb;
+ netsnmp_inpcb *nnew;
+ int StateMap[] = { 1, 2, 3, 4, 5, 8, 6, 10, 9, 7, 11 };
+
+ tcpTable_free(NULL, NULL);
+
+ if (!auto_nlist(TCP_SYMBOL, (char *) &table, sizeof(table))) {
+ DEBUGMSGTL(("mibII/tcpTable", "Failed to read inpcbtable\n"));
+ return -1;
+ }
+
+ /*
+ * Set up a linked list
+ */
+ entry = table.inpt_queue.cqh_first;
+ while (entry) {
+
+ nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb);
+ if (!nnew)
+ break;
+ if (!NETSNMP_KLOOKUP(entry, (char *)&(nnew->pcb), sizeof(struct inpcb))) {
+ DEBUGMSGTL(("mibII/tcpTable:TcpTable_load", "klookup failed\n"));
+ break;
+ }
+
+ if (!NETSNMP_KLOOKUP(nnew->pcb.inp_ppcb, (char *)&tcpcb, sizeof(struct tcpcb))) {
+ DEBUGMSGTL(("mibII/tcpTable:TcpTable_load", "klookup failed\n"));
+ break;
+ }
+ nnew->state = StateMap[tcpcb.t_state];
+ if (nnew->state == 5 /* established */ ||
+ nnew->state == 8 /* closeWait */ )
+ tcp_estab++;
+
+ entry = nnew->INP_NEXT_SYMBOL; /* Next kernel entry */
+ nnew->inp_next = tcp_head;
+ tcp_head = nnew;
+
+ if (entry == table.inpt_queue.cqh_first)
+ break;
+ }
+
+ if (tcp_head) {
+ DEBUGMSGTL(("mibII/tcpTable", "Loaded TCP Table\n"));
+ return 0;
+ }
+ DEBUGMSGTL(("mibII/tcpTable", "Failed to load TCP Table (pcb_table)\n"));
+ return -1;
+}
+
+#else /* PCB_TABLE */
+#ifdef TCP_SYMBOL
+int
+tcpTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ struct inpcb tcp_inpcb;
+ struct tcpcb tcpcb;
+ netsnmp_inpcb *nnew;
+ struct inpcb *entry;
+#ifdef hpux
+ int StateMap[] = { 1, 2, 3, -1, 4, 5, 8, 6, 10, 9, 7, 11 };
+#else
+ int StateMap[] = { 1, 2, 3, 4, 5, 8, 6, 10, 9, 7, 11 };
+#endif
+
+ tcpTable_free(NULL, NULL);
+
+ if (!auto_nlist(TCP_SYMBOL, (char *) &tcp_inpcb, sizeof(tcp_inpcb))) {
+ DEBUGMSGTL(("mibII/tcpTable", "Failed to read tcp_symbol\n"));
+ return -1;
+ }
+
+ /*
+ * Set up a linked list
+ */
+ entry = tcp_inpcb.INP_NEXT_SYMBOL;
+ while (entry) {
+
+ nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb);
+ if (!nnew)
+ break;
+ if (!NETSNMP_KLOOKUP(entry, (char *)&(nnew->pcb), sizeof(struct inpcb))) {
+ DEBUGMSGTL(("mibII/tcpTable:tcpTable_load", "klookup failed\n"));
+ break;
+ }
+ if (!NETSNMP_KLOOKUP(nnew->pcb.inp_ppcb, (char *)&tcpcb, sizeof(struct tcpcb))) {
+ DEBUGMSGTL(("mibII/tcpTable:tcpTable_load", "klookup failed\n"));
+ break;
+ }
+ nnew->state = StateMap[tcpcb.t_state];
+ if (nnew->state == 5 /* established */ ||
+ nnew->state == 8 /* closeWait */ )
+ tcp_estab++;
+
+ entry = nnew->pcb.INP_NEXT_SYMBOL; /* Next kernel entry */
+ nnew->inp_next = tcp_head;
+ tcp_head = nnew;
+
+ if (entry == tcp_inpcb.INP_NEXT_SYMBOL)
+ break;
+ }
+
+ if (tcp_head) {
+ DEBUGMSGTL(("mibII/tcpTable", "Loaded TCP Table\n"));
+ return 0;
+ }
+ DEBUGMSGTL(("mibII/tcpTable", "Failed to load TCP Table (tcp_symbol)\n"));
+ return -1;
+}
+
+#else /* UDB_SYMBOL */
+int
+tcpTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ DEBUGMSGTL(("mibII/tcpTable", "Loading TCP Table not implemented\n"));
+ return -1;
+}
+#endif /* UDB_SYMBOL */
+#endif /* PCB_TABLE */
+#endif /* (defined(NETSNMP_CAN_USE_SYSCTL) && defined(TCPCTL_PCBLIST)) */
+#endif /* WIN32 cygwin */
+#endif /* linux */
+#endif /* solaris2 */
+#endif /* hpux11 */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/tcpTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/tcpTable.h
new file mode 100644
index 0000000000..a5a6f7693f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/tcpTable.h
@@ -0,0 +1,39 @@
+/*
+ * Template MIB group interface - tcp.h
+ *
+ */
+#ifndef _MIBGROUP_TCPTABLE_H
+#define _MIBGROUP_TCPTABLE_H
+
+config_arch_require(solaris2, kernel_sunos5)
+config_require(util_funcs)
+#if !defined(NETSNMP_ENABLE_MFD_REWRITES)
+config_require(mibII/ip)
+#endif
+
+#ifdef linux
+struct inpcb {
+ struct inpcb *inp_next; /* pointers to other pcb's */
+ struct in_addr inp_faddr; /* foreign host table entry */
+ u_short inp_fport; /* foreign port */
+ struct in_addr inp_laddr; /* local host table entry */
+ u_short inp_lport; /* local port */
+ int inp_state;
+ int uid; /* owner of the connection */
+};
+#endif
+
+extern void init_tcpTable(void);
+extern Netsnmp_Node_Handler tcpTable_handler;
+extern NetsnmpCacheLoad tcpTable_load;
+extern NetsnmpCacheFree tcpTable_free;
+extern Netsnmp_First_Data_Point tcpTable_first_entry;
+extern Netsnmp_Next_Data_Point tcpTable_next_entry;
+
+#define TCPCONNSTATE 1
+#define TCPCONNLOCALADDRESS 2
+#define TCPCONNLOCALPORT 3
+#define TCPCONNREMOTEADDRESS 4
+#define TCPCONNREMOTEPORT 5
+
+#endif /* _MIBGROUP_TCPTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/udp.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/udp.c
new file mode 100644
index 0000000000..7ca0d80c88
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/udp.c
@@ -0,0 +1,566 @@
+/*
+ * UDP MIB group implementation - udp.c
+ *
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include "mibII_common.h"
+
+#ifdef HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"
+
+#ifdef solaris2
+#include "kernel_sunos5.h"
+#else
+#include "kernel.h"
+#endif
+
+#ifdef linux
+#include "kernel_linux.h"
+#endif
+
+#ifdef cygwin
+#define WIN32
+#include <windows.h>
+#endif
+
+#ifdef hpux
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif /* hpux */
+
+#ifdef linux
+#include "tcp.h"
+#endif
+#include "udp.h"
+#include "udpTable.h"
+#include "sysORTable.h"
+
+#ifdef NETSNMP_CAN_USE_SYSCTL
+#include <sys/sysctl.h>
+#endif
+
+#ifndef MIB_STATS_CACHE_TIMEOUT
+#define MIB_STATS_CACHE_TIMEOUT 5
+#endif
+#ifndef UDP_STATS_CACHE_TIMEOUT
+#define UDP_STATS_CACHE_TIMEOUT MIB_STATS_CACHE_TIMEOUT
+#endif
+
+#if defined(HAVE_LIBPERFSTAT_H) && (defined(aix4) || defined(aix5) || defined(aix6)) && !defined(FIRST_PROTOCOL)
+#include <libperfstat.h>
+#ifdef FIRST_PROTOCOL
+perfstat_protocol_t ps_proto;
+perfstat_id_t ps_name;
+#define _USE_PERFSTAT_PROTOCOL 1
+#endif
+#endif
+
+ /*********************
+ *
+ * Kernel & interface information,
+ * and internal forward declarations
+ *
+ *********************/
+
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath, and the OID for the MIB module
+ */
+oid udp_oid[] = { SNMP_OID_MIB2, 7 };
+oid udp_module_oid[] = { SNMP_OID_MIB2, 50 };
+
+void
+init_udp(void)
+{
+ netsnmp_handler_registration *reginfo;
+
+ /*
+ * register ourselves with the agent as a group of scalars...
+ */
+ DEBUGMSGTL(("mibII/udpScalar", "Initialising UDP scalar group\n"));
+ reginfo = netsnmp_create_handler_registration("udp", udp_handler,
+ udp_oid, OID_LENGTH(udp_oid), HANDLER_CAN_RONLY);
+ netsnmp_register_scalar_group(reginfo, UDPINDATAGRAMS, UDPOUTDATAGRAMS);
+
+ /*
+ * .... with a local cache
+ * (except for HP-UX 11, which extracts objects individually)
+ */
+#ifndef hpux11
+ netsnmp_inject_handler( reginfo,
+ netsnmp_get_cache_handler(UDP_STATS_CACHE_TIMEOUT,
+ udp_load, udp_free,
+ udp_oid, OID_LENGTH(udp_oid)));
+#endif
+
+ REGISTER_SYSOR_ENTRY(udp_module_oid,
+ "The MIB module for managing UDP implementations");
+
+#if !defined(_USE_PERFSTAT_PROTOCOL)
+#ifdef UDPSTAT_SYMBOL
+ auto_nlist(UDPSTAT_SYMBOL, 0, 0);
+#endif
+#ifdef UDB_SYMBOL
+ auto_nlist(UDB_SYMBOL, 0, 0);
+#endif
+#ifdef solaris2
+ init_kernel_sunos5();
+#endif
+#endif
+}
+
+
+ /*********************
+ *
+ * System specific implementation functions
+ *
+ *********************/
+
+#ifdef hpux11
+#define UDP_STAT_STRUCTURE int
+#endif
+
+#ifdef linux
+#define UDP_STAT_STRUCTURE struct udp_mib
+#define USES_SNMP_DESIGNED_UDPSTAT
+#undef UDPSTAT_SYMBOL
+#endif
+
+#ifdef solaris2
+#define UDP_STAT_STRUCTURE mib2_udp_t
+#define USES_SNMP_DESIGNED_UDPSTAT
+#endif
+
+#ifdef WIN32
+#include <iphlpapi.h>
+#define UDP_STAT_STRUCTURE MIB_UDPSTATS
+#endif
+
+#ifdef HAVE_SYS_TCPIPSTATS_H
+#define UDP_STAT_STRUCTURE struct kna
+#define USES_TRADITIONAL_UDPSTAT
+#endif
+
+
+#if !defined(UDP_STAT_STRUCTURE)
+#define UDP_STAT_STRUCTURE struct udpstat
+#define USES_TRADITIONAL_UDPSTAT
+#endif
+
+UDP_STAT_STRUCTURE udpstat;
+
+
+ /*********************
+ *
+ * System independent handler (mostly)
+ *
+ *********************/
+
+
+
+int
+udp_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ netsnmp_request_info *request;
+ netsnmp_variable_list *requestvb;
+ long ret_value = -1;
+ oid subid;
+ int type = ASN_COUNTER;
+
+ /*
+ * The cached data should already have been loaded by the
+ * cache handler, higher up the handler chain.
+ * But just to be safe, check this and load it manually if necessary
+ */
+#if defined(_USE_PERFSTAT_PROTOCOL)
+ udp_load(NULL, NULL);
+#elif !defined(hpux11)
+ if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) {
+ netsnmp_assert(!"cache == valid"); /* always false */
+ udp_load( NULL, NULL ); /* XXX - check for failure */
+ }
+#endif
+
+
+ /*
+ *
+ *
+ */
+ DEBUGMSGTL(("mibII/udpScalar", "Handler - mode %s\n",
+ se_find_label_in_slist("agent_mode", reqinfo->mode)));
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ for (request=requests; request; request=request->next) {
+ requestvb = request->requestvb;
+ subid = requestvb->name[OID_LENGTH(udp_oid)]; /* XXX */
+ DEBUGMSGTL(( "mibII/udpScalar", "oid: "));
+ DEBUGMSGOID(("mibII/udpScalar", requestvb->name,
+ requestvb->name_length));
+ DEBUGMSG(( "mibII/udpScalar", "\n"));
+
+ switch (subid) {
+#ifdef USES_SNMP_DESIGNED_UDPSTAT
+ case UDPINDATAGRAMS:
+ ret_value = udpstat.udpInDatagrams;
+ break;
+ case UDPNOPORTS:
+#ifdef solaris2
+ ret_value = udp_load(NULL, (void *)UDPNOPORTS);
+ if (ret_value == -1) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+ }
+ break;
+#else
+ ret_value = udpstat.udpNoPorts;
+ break;
+#endif
+ case UDPOUTDATAGRAMS:
+ ret_value = udpstat.udpOutDatagrams;
+ break;
+ case UDPINERRORS:
+ ret_value = udpstat.udpInErrors;
+ break;
+#elif defined(USES_TRADITIONAL_UDPSTAT) && !defined(_USE_PERFSTAT_PROTOCOL)
+#ifdef HAVE_SYS_TCPIPSTATS_H
+ /*
+ * This actually reads statistics for *all* the groups together,
+ * so we need to isolate the UDP-specific bits.
+ */
+#define udpstat udpstat.udpstat
+#endif
+ case UDPINDATAGRAMS:
+#if STRUCT_UDPSTAT_HAS_UDPS_IPACKETS
+ ret_value = udpstat.udps_ipackets;
+ break;
+#else
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+#endif
+
+ case UDPNOPORTS:
+#if STRUCT_UDPSTAT_HAS_UDPS_NOPORT
+ ret_value = udpstat.udps_noport;
+ break;
+#else
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+#endif
+
+ case UDPOUTDATAGRAMS:
+#if STRUCT_UDPSTAT_HAS_UDPS_OPACKETS
+ ret_value = udpstat.udps_opackets;
+ break;
+#else
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+#endif
+
+ case UDPINERRORS:
+ ret_value = udpstat.udps_hdrops + udpstat.udps_badsum +
+#ifdef STRUCT_UDPSTAT_HAS_UDPS_DISCARD
+ udpstat.udps_discard +
+#endif
+#ifdef STRUCT_UDPSTAT_HAS_UDPS_FULLSOCK
+ udpstat.udps_fullsock +
+#endif
+ udpstat.udps_badlen;
+ break;
+#ifdef HAVE_SYS_TCPIPSTATS_H
+#undef udpstat
+#endif
+#elif defined(hpux11)
+ case UDPINDATAGRAMS:
+ case UDPNOPORTS:
+ case UDPOUTDATAGRAMS:
+ case UDPINERRORS:
+ /*
+ * This is a bit of a hack, to shoehorn the HP-UX 11
+ * single-object retrieval approach into the caching
+ * architecture.
+ */
+ if (udp_load(NULL, (void*)subid) == -1 ) {
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ continue;
+ }
+ ret_value = udpstat;
+ break;
+#elif defined(WIN32)
+ case UDPINDATAGRAMS:
+ ret_value = udpstat.dwInDatagrams;
+ break;
+ case UDPNOPORTS:
+ ret_value = udpstat.dwNoPorts;
+ break;
+ case UDPOUTDATAGRAMS:
+ ret_value = udpstat.dwOutDatagrams;
+ break;
+ case UDPINERRORS:
+ ret_value = udpstat.dwInErrors;
+ break;
+#elif defined(_USE_PERFSTAT_PROTOCOL)
+ case UDPINDATAGRAMS:
+ ret_value = ps_proto.u.udp.ipackets;
+ break;
+ case UDPNOPORTS:
+ ret_value = ps_proto.u.udp.no_socket;
+ break;
+ case UDPOUTDATAGRAMS:
+ ret_value = ps_proto.u.udp.opackets;
+ break;
+ case UDPINERRORS:
+ ret_value = ps_proto.u.udp.ierrors;
+ break;
+#endif /* USES_SNMP_DESIGNED_UDPSTAT */
+
+ }
+ snmp_set_var_typed_value(request->requestvb, (u_char)type,
+ (u_char *)&ret_value, sizeof(ret_value));
+ }
+ break;
+
+ case MODE_GETNEXT:
+ case MODE_GETBULK:
+ case MODE_SET_RESERVE1:
+ case MODE_SET_RESERVE2:
+ case MODE_SET_ACTION:
+ case MODE_SET_COMMIT:
+ case MODE_SET_FREE:
+ case MODE_SET_UNDO:
+ snmp_log(LOG_WARNING, "mibII/udp: Unsupported mode (%d)\n",
+ reqinfo->mode);
+ break;
+ default:
+ snmp_log(LOG_WARNING, "mibII/udp: Unrecognised mode (%d)\n",
+ reqinfo->mode);
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+ /*********************
+ *
+ * Internal implementation functions
+ *
+ *********************/
+
+#ifdef hpux11
+int
+udp_load(netsnmp_cache *cache, void *vmagic)
+{
+ int fd;
+ struct nmparms p;
+ unsigned int ulen;
+ int ret;
+ int magic = (int) vmagic;
+
+ if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) < 0) {
+ DEBUGMSGTL(("mibII/udpScalar", "Failed to load UDP object %d (hpux11)\n", magic));
+ return (-1); /* error */
+ }
+
+ switch (magic) {
+ case UDPINDATAGRAMS:
+ p.objid = ID_udpInDatagrams;
+ break;
+ case UDPNOPORTS:
+ p.objid = ID_udpNoPorts;
+ break;
+ case UDPOUTDATAGRAMS:
+ p.objid = ID_udpOutDatagrams;
+ break;
+ case UDPINERRORS:
+ p.objid = ID_udpInErrors;
+ break;
+ default:
+ udpstat = 0;
+ close_mib(fd);
+ return -1;
+ }
+
+ p.buffer = (void *)&udpstat;
+ ulen = sizeof(UDP_STAT_STRUCTURE);
+ p.len = &ulen;
+ ret = get_mib_info(fd, &p);
+ close_mib(fd);
+
+ DEBUGMSGTL(("mibII/udpScalar", "%s UDP object %d (hpux11)\n",
+ (ret < 0 ? "Failed to load" : "Loaded"), magic));
+ return (ret); /* 0: ok, < 0: error */
+}
+#elif defined(linux)
+int
+udp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ ret_value = linux_read_udp_stat(&udpstat);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/udpScalar", "Failed to load UDP scalar Group (linux)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/udpScalar", "Loaded UDP scalar Group (linux)\n"));
+ }
+ return ret_value;
+}
+#elif defined(solaris2)
+int
+udp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+ int magic = (int)vmagic;
+ mib2_ip_t ipstat;
+
+ /*
+ * udpNoPorts is actually implemented as part of the MIB_IP group
+ * so we need to retrieve this independently
+ */
+ if (magic == UDPNOPORTS) {
+ if (getMibstat
+ (MIB_IP, &ipstat, sizeof(mib2_ip_t), GET_FIRST,
+ &Get_everything, NULL) < 0) {
+ DEBUGMSGTL(("mibII/udpScalar", "Failed to load UDP object %d (solaris)\n", magic));
+ return -1;
+ } else {
+ DEBUGMSGTL(("mibII/udpScalar", "Loaded UDP object %d (solaris)\n", magic));
+ return ipstat.udpNoPorts;
+ }
+ }
+
+ /*
+ * Otherwise, retrieve the whole of the MIB_UDP group (and cache it)
+ */
+ ret_value = getMibstat(MIB_UDP, &udpstat, sizeof(mib2_udp_t),
+ GET_FIRST, &Get_everything, NULL);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/udpScalar", "Failed to load UDP scalar Group (solaris)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/udpScalar", "Loaded UDP scalar Group (solaris)\n"));
+ }
+ return ret_value;
+}
+#elif defined(WIN32)
+int
+udp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ ret_value = GetUdpStatistics(&udpstat);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/udpScalar", "Failed to load UDP scalar Group (win32)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/udpScalar", "Loaded UDP scalar Group (win32)\n"));
+ }
+ return ret_value;
+}
+#elif defined(_USE_PERFSTAT_PROTOCOL)
+int
+udp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ strcpy(ps_name.name, "udp");
+ ret_value = perfstat_protocol(&ps_name, &ps_proto, sizeof(ps_proto), 1);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/udpScalar", "Failed to load UDP scalar Group (AIX)\n"));
+ } else {
+ ret_value = 0;
+ DEBUGMSGTL(("mibII/udpScalar", "Loaded UDP scalar Group (AIX)\n"));
+ }
+ return ret_value;
+}
+#elif (defined(NETSNMP_CAN_USE_SYSCTL) && defined(UDPCTL_STATS))
+int
+udp_load(netsnmp_cache *cache, void *vmagic)
+{
+ int sname[4] = { CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_STATS };
+ size_t len = sizeof(udpstat);
+ long ret_value = -1;
+
+ ret_value = sysctl(sname, 4, &udpstat, &len, 0, 0);
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/udpScalar", "Failed to load UDP scalar Group (sysctl)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/udpScalar", "Loaded UDP scalar Group (sysctl)\n"));
+ }
+ return ret_value;
+}
+#elif defined(HAVE_SYS_TCPIPSTATS_H)
+int
+udp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ ret_value = sysmp(MP_SAGET, MPSA_TCPIPSTATS, &udpstat, sizeof(udpstat));
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/udpScalar", "Failed to load UDP scalar Group (tcpipstats)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/udpScalar", "Loaded UDP scalar Group (tcpipstats)\n"));
+ }
+ return ret_value;
+}
+#elif defined(UDPSTAT_SYMBOL)
+int
+udp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ if (auto_nlist(UDPSTAT_SYMBOL, (char *)&udpstat, sizeof(udpstat)))
+ ret_value = 0;
+
+ if ( ret_value < 0 ) {
+ DEBUGMSGTL(("mibII/udpScalar", "Failed to load UDP scalar Group (udpstat)\n"));
+ } else {
+ DEBUGMSGTL(("mibII/udpScalar", "Loaded UDP scalar Group (udpstat)\n"));
+ }
+ return ret_value;
+}
+#else /* UDPSTAT_SYMBOL */
+int
+udp_load(netsnmp_cache *cache, void *vmagic)
+{
+ long ret_value = -1;
+
+ DEBUGMSGTL(("mibII/udpScalar", "Failed to load UDP scalar Group (null)\n"));
+ return ret_value;
+}
+#endif /* hpux11 */
+
+
+void
+udp_free(netsnmp_cache *cache, void *magic)
+{
+#if defined(_USE_PERFSTAT_PROTOCOL)
+ memset(&ps_proto, 0, sizeof(ps_proto));
+#else
+ memset(&udpstat, 0, sizeof(udpstat));
+#endif
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/udp.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/udp.h
new file mode 100644
index 0000000000..809d8917eb
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/udp.h
@@ -0,0 +1,24 @@
+/*
+ * Template MIB group interface - udp.h
+ *
+ */
+#ifndef _MIBGROUP_UDP_H
+#define _MIBGROUP_UDP_H
+
+
+config_require(mibII/udpTable util_funcs)
+config_arch_require(solaris2, kernel_sunos5)
+config_arch_require(linux, mibII/kernel_linux)
+
+extern void init_udp(void);
+extern Netsnmp_Node_Handler udp_handler;
+extern NetsnmpCacheLoad udp_load;
+extern NetsnmpCacheFree udp_free;
+
+
+#define UDPINDATAGRAMS 1
+#define UDPNOPORTS 2
+#define UDPINERRORS 3
+#define UDPOUTDATAGRAMS 4
+
+#endif /* _MIBGROUP_UDP_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/udpTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/udpTable.c
new file mode 100644
index 0000000000..18e7c304d6
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/udpTable.c
@@ -0,0 +1,775 @@
+/*
+ * UDP MIB group Table implementation - udpTable.c
+ *
+ */
+
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include "mibII_common.h"
+
+#if HAVE_NETINET_UDP_H
+#include <netinet/udp.h>
+#endif
+#if HAVE_NETINET_UDP_VAR_H
+#include <netinet/udp_var.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#ifdef linux
+#include "tcpTable.h"
+#endif
+#include "udp.h"
+#include "udpTable.h"
+#include "sysORTable.h"
+
+#ifdef hpux11
+#define UDPTABLE_ENTRY_TYPE mib_udpLsnEnt
+#define UDPTABLE_LOCALADDRESS LocalAddress
+#define UDPTABLE_LOCALPORT LocalPort
+#define UDPTABLE_IS_TABLE
+#else
+
+#ifdef solaris2
+typedef struct netsnmp_udpEntry_s netsnmp_udpEntry;
+struct netsnmp_udpEntry_s {
+ mib2_udpEntry_t entry;
+ netsnmp_udpEntry *inp_next;
+};
+#define UDPTABLE_ENTRY_TYPE netsnmp_udpEntry
+#define UDPTABLE_LOCALADDRESS entry.udpLocalAddress
+#define UDPTABLE_LOCALPORT entry.udpLocalPort
+#define UDPTABLE_IS_LINKED_LIST
+#else
+
+#if defined (WIN32) || defined (cygwin)
+#include <iphlpapi.h>
+#define UDPTABLE_ENTRY_TYPE MIB_UDPROW /* ??? */
+#define UDPTABLE_LOCALADDRESS dwLocalAddr
+#define UDPTABLE_LOCALPORT dwLocalPort
+#define UDPTABLE_IS_TABLE
+#else /* everything else */
+
+#ifdef linux
+#define INP_NEXT_SYMBOL inp_next
+#endif
+
+#if defined(freebsd4) || defined(darwin) || defined(osf5)
+typedef struct netsnmp_inpcb_s netsnmp_inpcb;
+struct netsnmp_inpcb_s {
+ struct inpcb pcb;
+ int state;
+ netsnmp_inpcb *inp_next;
+};
+#define UDPTABLE_ENTRY_TYPE netsnmp_inpcb
+#define UDPTABLE_LOCALADDRESS pcb.inp_laddr.s_addr
+#define UDPTABLE_LOCALPORT pcb.inp_lport
+#else
+#define UDPTABLE_ENTRY_TYPE struct inpcb
+#define UDPTABLE_LOCALADDRESS inp_laddr.s_addr
+#define UDPTABLE_LOCALPORT inp_lport
+#endif
+#define UDPTABLE_IS_LINKED_LIST
+
+#endif /* WIN32 cygwin */
+#endif /* solaris2 */
+#endif /* hpux11 */
+
+ /* Head of linked list, or root of table */
+UDPTABLE_ENTRY_TYPE *udp_head = NULL;
+int udp_size = 0; /* Only used for table-based systems */
+
+
+ /*
+ *
+ * Initialization and handler routines are common to all architectures
+ *
+ */
+#ifndef MIB_STATS_CACHE_TIMEOUT
+#define MIB_STATS_CACHE_TIMEOUT 5
+#endif
+#ifndef UDP_STATS_CACHE_TIMEOUT
+#define UDP_STATS_CACHE_TIMEOUT MIB_STATS_CACHE_TIMEOUT
+#endif
+
+#ifdef UDP_ADDRESSES_IN_HOST_ORDER
+#define UDP_ADDRESS_TO_HOST_ORDER(x) x
+#define UDP_ADDRESS_TO_NETWORK_ORDER(x) htonl(x)
+#else
+#define UDP_ADDRESS_TO_HOST_ORDER(x) ntohl(x)
+#define UDP_ADDRESS_TO_NETWORK_ORDER(x) x
+#endif
+
+#ifdef UDP_PORTS_IN_HOST_ORDER
+#define UDP_PORT_TO_HOST_ORDER(x) x
+#else
+#define UDP_PORT_TO_HOST_ORDER(x) ntohs(x)
+#endif
+
+
+oid udpTable_oid[] = { SNMP_OID_MIB2, 7, 5 };
+
+void
+init_udpTable(void)
+{
+ netsnmp_table_registration_info *table_info;
+ netsnmp_iterator_info *iinfo;
+ netsnmp_handler_registration *reginfo;
+
+ DEBUGMSGTL(("mibII/udpTable", "Initialising UDP Table\n"));
+ /*
+ * Create the table data structure, and define the indexing....
+ */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ if (!table_info) {
+ return;
+ }
+ netsnmp_table_helper_add_indexes(table_info, ASN_IPADDRESS,
+ ASN_INTEGER, 0);
+ table_info->min_column = UDPLOCALADDRESS;
+ table_info->max_column = UDPLOCALPORT;
+
+
+ /*
+ * .... and iteration information ....
+ */
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+ if (!iinfo) {
+ return;
+ }
+ iinfo->get_first_data_point = udpTable_first_entry;
+ iinfo->get_next_data_point = udpTable_next_entry;
+ iinfo->table_reginfo = table_info;
+#if defined (WIN32) || defined (cygwin)
+ iinfo->flags |= NETSNMP_ITERATOR_FLAG_SORTED;
+#endif /* WIN32 || cygwin */
+
+
+ /*
+ * .... and register the table with the agent.
+ */
+ reginfo = netsnmp_create_handler_registration("udpTable",
+ udpTable_handler,
+ udpTable_oid, OID_LENGTH(udpTable_oid),
+ HANDLER_CAN_RONLY),
+ netsnmp_register_table_iterator(reginfo, iinfo);
+
+ /*
+ * .... with a local cache
+ */
+ netsnmp_inject_handler( reginfo,
+ netsnmp_get_cache_handler(UDP_STATS_CACHE_TIMEOUT,
+ udpTable_load, udpTable_free,
+ udpTable_oid, OID_LENGTH(udpTable_oid)));
+}
+
+
+
+int
+udpTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ netsnmp_request_info *request;
+ netsnmp_variable_list *requestvb;
+ netsnmp_table_request_info *table_info;
+ UDPTABLE_ENTRY_TYPE *entry;
+ oid subid;
+ long port;
+ in_addr_t addr;
+
+ DEBUGMSGTL(("mibII/udpTable", "Handler - mode %s\n",
+ se_find_label_in_slist("agent_mode", reqinfo->mode)));
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ for (request=requests; request; request=request->next) {
+ requestvb = request->requestvb;
+ DEBUGMSGTL(( "mibII/udpTable", "oid: "));
+ DEBUGMSGOID(("mibII/udpTable", requestvb->name,
+ requestvb->name_length));
+ DEBUGMSG(( "mibII/udpTable", "\n"));
+
+ entry = (UDPTABLE_ENTRY_TYPE *)netsnmp_extract_iterator_context(request);
+ if (!entry)
+ continue;
+ table_info = netsnmp_extract_table_info(request);
+ subid = table_info->colnum;
+
+ switch (subid) {
+ case UDPLOCALADDRESS:
+#if defined(osf5) && defined(IN6_EXTRACT_V4ADDR)
+ addr = ntohl(IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr));
+ snmp_set_var_typed_value(requestvb, ASN_IPADDRESS,
+ (u_char*)&addr,
+ sizeof(uint32_t));
+#else
+ addr = UDP_ADDRESS_TO_HOST_ORDER(entry->UDPTABLE_LOCALADDRESS);
+ snmp_set_var_typed_value(requestvb, ASN_IPADDRESS,
+ (u_char *)&addr,
+ sizeof(uint32_t));
+#endif
+ break;
+ case UDPLOCALPORT:
+ port = UDP_PORT_TO_HOST_ORDER((u_short)entry->UDPTABLE_LOCALPORT);
+ snmp_set_var_typed_value(requestvb, ASN_INTEGER,
+ (u_char *)&port, sizeof(port));
+ break;
+ }
+ }
+ break;
+
+ case MODE_GETNEXT:
+ case MODE_GETBULK:
+ case MODE_SET_RESERVE1:
+ case MODE_SET_RESERVE2:
+ case MODE_SET_ACTION:
+ case MODE_SET_COMMIT:
+ case MODE_SET_FREE:
+ case MODE_SET_UNDO:
+ snmp_log(LOG_WARNING, "mibII/udpTable: Unsupported mode (%d)\n",
+ reqinfo->mode);
+ break;
+ default:
+ snmp_log(LOG_WARNING, "mibII/udpTable: Unrecognised mode (%d)\n",
+ reqinfo->mode);
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+ /*
+ * Two forms of iteration hook routines:
+ * One for when the UDP table is stored as a table
+ * One for when the UDP table is stored as a linked list
+ *
+ * Also applies to the cache-handler free routine
+ */
+
+#ifdef UDPTABLE_IS_TABLE
+netsnmp_variable_list *
+udpTable_first_entry(void **loop_context,
+ void **data_context,
+ netsnmp_variable_list *index,
+ netsnmp_iterator_info *data)
+{
+ /*
+ * XXX - How can we tell if the cache is valid?
+ * No access to 'reqinfo'
+ */
+ if (udp_size == 0)
+ return NULL;
+
+ /*
+ * Point to the first entry, and use the
+ * 'next_entry' hook to retrieve this row
+ */
+ *loop_context = 0;
+ return udpTable_next_entry( loop_context, data_context, index, data );
+}
+
+netsnmp_variable_list *
+udpTable_next_entry( void **loop_context,
+ void **data_context,
+ netsnmp_variable_list *index,
+ netsnmp_iterator_info *data)
+{
+ int i = (int)*loop_context;
+ long port;
+
+ if (udp_size < i)
+ return NULL;
+
+ /*
+ * Set up the indexing for the specified row...
+ */
+#if defined (WIN32) || defined (cygwin)
+ port = ntohl((u_long)udp_head[i].UDPTABLE_LOCALADDRESS);
+ snmp_set_var_value(index, (u_char *)&port,
+ sizeof(udp_head[i].UDPTABLE_LOCALADDRESS));
+#else
+ snmp_set_var_value(index, (u_char *)&udp_head[i].UDPTABLE_LOCALADDRESS,
+ sizeof(udp_head[i].UDPTABLE_LOCALADDRESS));
+#endif
+ port = UDP_PORT_TO_HOST_ORDER((u_short)udp_head[i].UDPTABLE_LOCALPORT);
+ snmp_set_var_value(index->next_variable,
+ (u_char*)&port, sizeof(port));
+ /*
+ * ... return the data structure for this row,
+ * and update the loop context ready for the next one.
+ */
+ *data_context = (void*)&udp_head[i];
+ *loop_context = (void*)++i;
+ return index;
+}
+
+void
+udpTable_free(netsnmp_cache *cache, void *magic)
+{
+#if defined (WIN32) || defined (cygwin)
+ if (udp_head) {
+ /* the allocated structure is a count followed by table entries */
+ free((char *)(udp_head) - sizeof(DWORD));
+ }
+#else
+ if (udp_head)
+ free(udp_head);
+#endif
+ udp_head = NULL;
+ udp_size = 0;
+}
+#else
+#ifdef UDPTABLE_IS_LINKED_LIST
+netsnmp_variable_list *
+udpTable_first_entry(void **loop_context,
+ void **data_context,
+ netsnmp_variable_list *index,
+ netsnmp_iterator_info *data)
+{
+ /*
+ * XXX - How can we tell if the cache is valid?
+ * No access to 'reqinfo'
+ */
+ if (udp_head == 0)
+ return NULL;
+
+ /*
+ * Point to the first entry, and use the
+ * 'next_entry' hook to retrieve this row
+ */
+ *loop_context = (void*)udp_head;
+ return udpTable_next_entry( loop_context, data_context, index, data );
+}
+
+netsnmp_variable_list *
+udpTable_next_entry( void **loop_context,
+ void **data_context,
+ netsnmp_variable_list *index,
+ netsnmp_iterator_info *data)
+{
+ UDPTABLE_ENTRY_TYPE *entry = (UDPTABLE_ENTRY_TYPE *)*loop_context;
+ long port;
+ in_addr_t addr;
+
+ if (!entry)
+ return NULL;
+
+ /*
+ * Set up the indexing for the specified row...
+ */
+#if defined(osf5) && defined(IN6_EXTRACT_V4ADDR)
+ snmp_set_var_value(index,
+ (u_char*)&IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr),
+ sizeof(IN6_EXTRACT_V4ADDR(&entry->pcb.inp_laddr)));
+#else
+ addr = UDP_ADDRESS_TO_NETWORK_ORDER((in_addr_t)entry->UDPTABLE_LOCALADDRESS);
+ snmp_set_var_value(index, (u_char *)&addr,
+ sizeof(entry->UDPTABLE_LOCALADDRESS));
+#endif
+ port = UDP_PORT_TO_HOST_ORDER(entry->UDPTABLE_LOCALPORT);
+ snmp_set_var_value(index->next_variable,
+ (u_char*)&port, sizeof(port));
+
+ /*
+ * ... return the data structure for this row,
+ * and update the loop context ready for the next one.
+ */
+ *data_context = (void*)entry;
+ *loop_context = (void*)entry->INP_NEXT_SYMBOL;
+ return index;
+}
+
+void
+udpTable_free(netsnmp_cache *cache, void *magic)
+{
+ UDPTABLE_ENTRY_TYPE *p;
+ while (udp_head) {
+ p = udp_head;
+ udp_head = udp_head->INP_NEXT_SYMBOL;
+ free(p);
+ }
+
+ udp_head = NULL;
+}
+#endif /* UDPTABLE_IS_LINKED_LIST */
+#endif /* UDPTABLE_IS_TABLE */
+
+
+ /*
+ *
+ * The cache-handler loading routine is the main
+ * place for architecture-specific code
+ *
+ * Load into either a table structure, or a linked list
+ * depending on the system architecture
+ */
+
+
+#ifdef hpux11
+int
+udpTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ int fd;
+ struct nmparms p;
+ int val = 0;
+ unsigned int ulen;
+ int ret;
+
+ udpTable_free(NULL, NULL);
+
+ if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) >= 0) {
+ p.objid = ID_udpLsnNumEnt;
+ p.buffer = (void *) &val;
+ ulen = sizeof(int);
+ p.len = &ulen;
+ if ((ret = get_mib_info(fd, &p)) == 0)
+ udp_size = val;
+
+ if (udp_size > 0) {
+ ulen = (unsigned) udp_size *sizeof(mib_udpLsnEnt);
+ udp_head = (mib_udpLsnEnt *) malloc(ulen);
+ p.objid = ID_udpLsnTable;
+ p.buffer = (void *) udp_head;
+ p.len = &ulen;
+ if ((ret = get_mib_info(fd, &p)) < 0) {
+ udp_size = 0;
+ }
+ }
+
+ close_mib(fd);
+ }
+
+ if (udp_size > 0) {
+ DEBUGMSGTL(("mibII/udpTable", "Loaded UDP Table\n"));
+ return 0;
+ }
+ DEBUGMSGTL(("mibII/udpTable", "Failed to load UDP Table (hpux11)\n"));
+ return -1;
+}
+#else /* hpux11 */
+
+#ifdef linux
+int
+udpTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ FILE *in;
+ char line[256];
+
+ udpTable_free(cache, NULL);
+
+ if (!(in = fopen("/proc/net/udp", "r"))) {
+ DEBUGMSGTL(("mibII/udpTable", "Failed to load UDP Table (linux)\n"));
+ snmp_log(LOG_ERR, "snmpd: cannot open /proc/net/udp ...\n");
+ return -1;
+ }
+
+ /*
+ * scan proc-file and build up a linked list
+ * This will actually be built up in reverse,
+ * but since the entries are unsorted, that doesn't matter.
+ */
+ while (line == fgets(line, sizeof(line), in)) {
+ struct inpcb pcb, *nnew;
+ unsigned int state, lport;
+
+ if (3 != sscanf(line, "%*d: %x:%x %*x:%*x %x",
+ &pcb.inp_laddr.s_addr, &lport, &state))
+ continue;
+
+ if (state != 7) /* fix me: UDP_LISTEN ??? */
+ continue;
+
+ /* store in network byte order */
+ pcb.inp_laddr.s_addr = htonl(pcb.inp_laddr.s_addr);
+ pcb.inp_lport = htons((unsigned short) (lport));
+
+ nnew = SNMP_MALLOC_TYPEDEF(struct inpcb);
+ if (nnew == NULL)
+ break;
+ memcpy(nnew, &pcb, sizeof(struct inpcb));
+ nnew->inp_next = udp_head;
+ udp_head = nnew;
+ }
+
+ fclose(in);
+
+ DEBUGMSGTL(("mibII/udpTable", "Loaded UDP Table\n"));
+ return 0;
+}
+#else /* linux */
+
+#ifdef solaris2
+static int
+UDP_Cmp(void *addr, void *ep)
+{
+ if (memcmp((mib2_udpEntry_t *) ep, (mib2_udpEntry_t *) addr,
+ sizeof(mib2_udpEntry_t)) == 0)
+ return (0);
+ else
+ return (1);
+}
+
+
+int
+udpTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ mib2_udpEntry_t entry;
+ netsnmp_udpEntry *nnew;
+ netsnmp_udpEntry *prev_entry = NULL;
+
+
+ udpTable_free(NULL, NULL);
+
+ if (getMibstat(MIB_UDP_LISTEN, &entry, sizeof(mib2_udpEntry_t),
+ GET_FIRST, &UDP_Cmp, &entry) != 0) {
+ DEBUGMSGTL(("mibII/udpTable", "Failed to load UDP Table (solaris)\n"));
+ return -1;
+ }
+
+ while (1) {
+ /*
+ * Not interested in 'idle' entries, apparently....
+ */
+ DEBUGMSGTL(("mibII/udpTable", "UDP Entry %x:%d (%d)\n",
+ entry.udpLocalAddress, entry.udpLocalPort, entry.udpEntryInfo.ue_state));
+ if (entry.udpEntryInfo.ue_state == MIB2_UDP_idle) {
+ /*
+ * Build up a linked list copy of the getMibstat results
+ * Note that since getMibstat returns rows in sorted order,
+ * we need to retain this order while building the list
+ * so new entries are added onto the end of the list.
+ * xxx-rks: WARNING: this is NOT TRUE on the sf cf solaris boxes.
+ */
+ nnew = SNMP_MALLOC_TYPEDEF(netsnmp_udpEntry);
+ if (nnew == NULL)
+ break;
+ memcpy(&(nnew->entry), &entry, sizeof(mib2_udpEntry_t));
+ if (!prev_entry)
+ udp_head = nnew;
+ else
+ prev_entry->inp_next = nnew;
+ prev_entry = nnew;
+ }
+
+ if (getMibstat(MIB_UDP_LISTEN, &entry, sizeof(mib2_udpEntry_t),
+ GET_NEXT, &UDP_Cmp, &entry) != 0)
+ break;
+ }
+
+ if (udp_head) {
+ DEBUGMSGTL(("mibII/udpTable", "Loaded UDP Table\n"));
+ return 0;
+ }
+ DEBUGMSGTL(("mibII/udpTable", "Failed to load UDP Table (solaris)\n"));
+ return -1;
+}
+#else /* solaris2 */
+
+#if defined (WIN32) || defined (cygwin)
+int
+udpTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ PMIB_UDPTABLE pUdpTable = NULL;
+ DWORD dwActualSize = 0;
+ DWORD status = NO_ERROR;
+
+ /*
+ * query for the buffer size needed
+ */
+ status = GetUdpTable(pUdpTable, &dwActualSize, TRUE);
+ if (status == ERROR_INSUFFICIENT_BUFFER) {
+ pUdpTable = (PMIB_UDPTABLE) malloc(dwActualSize);
+ if (pUdpTable != NULL) {
+ /*
+ * Get the sorted UDP table
+ */
+ status = GetUdpTable(pUdpTable, &dwActualSize, TRUE);
+ }
+ }
+ if (status == NO_ERROR) {
+ DEBUGMSGTL(("mibII/udpTable", "Loaded UDP Table\n"));
+ udp_size = pUdpTable->dwNumEntries -1; /* entries are counted starting with 0 */
+ udp_head = pUdpTable->table;
+ return 0;
+ }
+ DEBUGMSGTL(("mibII/udpTable", "Failed to load UDP Table (win32)\n"));
+ if (pUdpTable)
+ free(pUdpTable);
+ return -1;
+}
+#else /* WIN32 cygwin*/
+
+#if (defined(NETSNMP_CAN_USE_SYSCTL) && defined(UDPCTL_PCBLIST))
+int
+udpTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ size_t len;
+ int sname[] = { CTL_NET, PF_INET, IPPROTO_UDP, UDPCTL_PCBLIST };
+ char *udpcb_buf = NULL;
+ struct xinpgen *xig = NULL;
+ UDPTABLE_ENTRY_TYPE *nnew;
+
+ udpTable_free(NULL, NULL);
+
+ /*
+ * Read in the buffer containing the UDP table data
+ */
+ len = 0;
+ if (sysctl(sname, 4, 0, &len, 0, 0) < 0 ||
+ (udpcb_buf = malloc(len)) == NULL)
+ return -1;
+ if (sysctl(sname, 4, udpcb_buf, &len, 0, 0) < 0) {
+ free(udpcb_buf);
+ return -1;
+ }
+
+ /*
+ * Unpick this into the constituent 'xinpgen' structures, and extract
+ * the 'inpcb' elements into a linked list (built in reverse)
+ */
+ xig = (struct xinpgen *) udpcb_buf;
+ xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+
+ while (xig && (xig->xig_len > sizeof(struct xinpgen))) {
+ nnew = SNMP_MALLOC_TYPEDEF(UDPTABLE_ENTRY_TYPE);
+ if (!nnew)
+ break;
+#if defined(freebsd4) || defined(darwin)
+ memcpy(nnew, &((struct xinpcb *) xig)->xi_inp, sizeof(struct inpcb));
+ nnew->inp_next = udp_head;
+#else
+ memcpy(nnew, ((struct xinpcb *) xig)->xi_inp, sizeof(struct inpcb));
+ nnew->next = udp_head; /* XXX - ?? Check 'next' pointer */
+#endif
+
+ udp_head = nnew;
+ xig = (struct xinpgen *) ((char *) xig + xig->xig_len);
+ }
+
+ free(udpcb_buf);
+ if (udp_head) {
+ DEBUGMSGTL(("mibII/udpTable", "Loaded UDP Table\n"));
+ return 0;
+ }
+ DEBUGMSGTL(("mibII/udpTable", "Failed to load UDP Table (sysctl)\n"));
+ return -1;
+}
+#else /* (defined(NETSNMP_CAN_USE_SYSCTL) && defined(UDPCTL_PCBLIST)) */
+#ifdef PCB_TABLE
+int
+udpTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ struct inpcbtable table;
+ struct inpcb *nnew, *entry;
+
+ udpTable_free(NULL, NULL);
+
+ if (!auto_nlist(UDB_SYMBOL, (char *) &table, sizeof(table))) {
+ DEBUGMSGTL(("mibII/udpTable", "Failed to read inpcbtable\n"));
+ return -1;
+ }
+
+ /*
+ * Set up a linked list
+ */
+ entry = table.inpt_queue.cqh_first;
+ while (entry) {
+
+ nnew = SNMP_MALLOC_TYPEDEF(struct inpcb);
+ if (!nnew)
+ break;
+
+ if (!NETSNMP_KLOOKUP(entry, (char *) nnew, sizeof(struct inpcb))) {
+ DEBUGMSGTL(("mibII/udpTable:udpTable_load", "klookup failed\n"));
+ break;
+ }
+
+ entry = nnew->inp_queue.cqe_next; /* Next kernel entry */
+ nnew->inp_queue.cqe_next = udp_head;
+ udp_head = nnew;
+
+ if (entry == table.inpt_queue.cqh_first)
+ break;
+ }
+
+ if (udp_head) {
+ DEBUGMSGTL(("mibII/udpTable", "Loaded UDP Table\n"));
+ return 0;
+ }
+ DEBUGMSGTL(("mibII/udpTable", "Failed to load UDP Table (pcb_table)\n"));
+ return -1;
+}
+
+#else /* PCB_TABLE */
+#ifdef UDB_SYMBOL
+int
+udpTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ struct inpcb udp_inpcb;
+ struct inpcb *nnew, *entry;
+
+ udpTable_free(NULL, NULL);
+
+ if (!auto_nlist(UDB_SYMBOL, (char *) &udp_inpcb, sizeof(udp_inpcb))) {
+ DEBUGMSGTL(("mibII/udpTable", "Failed to read udb_symbol\n"));
+ return -1;
+ }
+
+ /*
+ * Set up a linked list
+ */
+ entry = udp_inpcb.INP_NEXT_SYMBOL;
+ while (entry) {
+
+ nnew = SNMP_MALLOC_TYPEDEF(struct inpcb);
+ if (!nnew)
+ break;
+
+ if (!NETSNMP_KLOOKUP(entry, (char *) nnew, sizeof(struct inpcb))) {
+ DEBUGMSGTL(("mibII/udpTable:udpTable_load", "klookup failed\n"));
+ break;
+ }
+
+ entry = nnew->INP_NEXT_SYMBOL; /* Next kernel entry */
+ nnew->INP_NEXT_SYMBOL = udp_head;
+ udp_head = nnew;
+
+ if (entry == udp_inpcb.INP_NEXT_SYMBOL)
+ break;
+ }
+
+ if (udp_head) {
+ DEBUGMSGTL(("mibII/udpTable", "Loaded UDP Table\n"));
+ return 0;
+ }
+ DEBUGMSGTL(("mibII/udpTable", "Failed to load UDP Table (udb_symbol)\n"));
+ return -1;
+}
+
+#else /* UDB_SYMBOL */
+int
+udpTable_load(netsnmp_cache *cache, void *vmagic)
+{
+ DEBUGMSGTL(("mibII/udpTable", "Loading UDP Table not implemented\n"));
+ return -1;
+}
+#endif /* UDB_SYMBOL */
+#endif /* PCB_TABLE */
+#endif /* (defined(NETSNMP_CAN_USE_SYSCTL) && defined(UDPCTL_PCBLIST)) */
+#endif /* WIN32 cygwin*/
+#endif /* linux */
+#endif /* solaris2 */
+#endif /* hpux11 */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/udpTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/udpTable.h
new file mode 100644
index 0000000000..2c61cda97c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/udpTable.h
@@ -0,0 +1,21 @@
+/*
+ * Template MIB group interface - udp.h
+ *
+ */
+#ifndef _MIBGROUP_UDPTABLE_H
+#define _MIBGROUP_UDPTABLE_H
+
+config_arch_require(solaris2, kernel_sunos5)
+config_require(util_funcs mibII/ip)
+
+extern void init_udpTable(void);
+extern Netsnmp_Node_Handler udpTable_handler;
+extern NetsnmpCacheLoad udpTable_load;
+extern NetsnmpCacheFree udpTable_free;
+extern Netsnmp_First_Data_Point udpTable_first_entry;
+extern Netsnmp_Next_Data_Point udpTable_next_entry;
+
+#define UDPLOCALADDRESS 1
+#define UDPLOCALPORT 2
+
+#endif /* _MIBGROUP_UDPTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_conf.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_conf.c
new file mode 100644
index 0000000000..c3d465682a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_conf.c
@@ -0,0 +1,1490 @@
+/*
+ * SNMPv3 View-based Access Control Model
+ */
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#include <ctype.h>
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/agent_callbacks.h>
+#include "vacm_conf.h"
+#include "util_funcs.h"
+
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#include "sysORTable.h"
+#endif
+
+#include "snmpd.h"
+
+/**
+ * Registers the VACM token handlers for inserting rows into the vacm tables.
+ * These tokens will be recognised by both 'snmpd' and 'snmptrapd'.
+ */
+void
+init_vacm_config_tokens(void) {
+ snmpd_register_config_handler("group", vacm_parse_group,
+ vacm_free_group,
+ "name v1|v2c|usm|... security");
+ snmpd_register_config_handler("access", vacm_parse_access,
+ vacm_free_access,
+ "name context model level prefix read write notify");
+ snmpd_register_config_handler("setaccess", vacm_parse_setaccess,
+ vacm_free_access,
+ "name context model level prefix viewname viewval");
+ snmpd_register_config_handler("view", vacm_parse_view, vacm_free_view,
+ "name type subtree [mask]");
+ snmpd_register_config_handler("vacmView", vacm_parse_config_view, NULL,
+ NULL);
+ snmpd_register_config_handler("vacmGroup", vacm_parse_config_group,
+ NULL, NULL);
+ snmpd_register_config_handler("vacmAccess", vacm_parse_config_access,
+ NULL, NULL);
+ snmpd_register_config_handler("vacmAuthAccess", vacm_parse_config_auth_access,
+ NULL, NULL);
+
+ /* easy community auth handler */
+ snmpd_register_config_handler("authcommunity",
+ vacm_parse_authcommunity,
+ NULL, "authtype1,authtype2 community [default|hostname|network/bits [oid|-V view]]");
+
+ /* easy user auth handler */
+ snmpd_register_config_handler("authuser",
+ vacm_parse_authuser,
+ NULL, "authtype1,authtype2 [-s secmodel] user [noauth|auth|priv [oid|-V view]]");
+ /* easy group auth handler */
+ snmpd_register_config_handler("authgroup",
+ vacm_parse_authuser,
+ NULL, "authtype1,authtype2 [-s secmodel] group [noauth|auth|priv [oid|-V view]]");
+
+ snmpd_register_config_handler("authaccess", vacm_parse_authaccess,
+ vacm_free_access,
+ "name authtype1,authtype2 [-s secmodel] group view [noauth|auth|priv [context|context*]]");
+
+ /*
+ * Define standard views "_all_" and "_none_"
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+ SNMP_CALLBACK_POST_PREMIB_READ_CONFIG,
+ vacm_standard_views, NULL);
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+ SNMP_CALLBACK_POST_READ_CONFIG,
+ vacm_warn_if_not_configured, NULL);
+}
+
+/**
+ * Registers the easier-to-use VACM token handlers for quick access rules.
+ * These tokens will only be recognised by 'snmpd'.
+ */
+void
+init_vacm_snmpd_easy_tokens(void) {
+#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
+ snmpd_register_config_handler("rwcommunity", vacm_parse_rwcommunity, NULL,
+ "community [default|hostname|network/bits [oid]]");
+ snmpd_register_config_handler("rocommunity", vacm_parse_rocommunity, NULL,
+ "community [default|hostname|network/bits [oid]]");
+#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
+ snmpd_register_config_handler("rwcommunity6", vacm_parse_rwcommunity6, NULL,
+ "community [default|hostname|network/bits [oid]]");
+ snmpd_register_config_handler("rocommunity6", vacm_parse_rocommunity6, NULL,
+ "community [default|hostname|network/bits [oid]]");
+#endif
+#endif /* support for community based SNMP */
+ snmpd_register_config_handler("rwuser", vacm_parse_rwuser, NULL,
+ "user [noauth|auth|priv [oid]]");
+ snmpd_register_config_handler("rouser", vacm_parse_rouser, NULL,
+ "user [noauth|auth|priv [oid]]");
+}
+
+void
+init_vacm_conf(void)
+{
+ init_vacm_config_tokens();
+ init_vacm_snmpd_easy_tokens();
+ /*
+ * register ourselves to handle access control ('snmpd' only)
+ */
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_ACM_CHECK, vacm_in_view_callback,
+ NULL);
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_ACM_CHECK_INITIAL,
+ vacm_in_view_callback, NULL);
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_ACM_CHECK_SUBTREE,
+ vacm_in_view_callback, NULL);
+}
+
+
+
+void
+vacm_parse_group(const char *token, char *param)
+{
+ char *group, *model, *security;
+ int imodel;
+ struct vacm_groupEntry *gp = NULL;
+ char *st;
+
+ group = strtok_r(param, " \t\n", &st);
+ model = strtok_r(NULL, " \t\n", &st);
+ security = strtok_r(NULL, " \t\n", &st);
+
+ if (group == NULL || *group == 0) {
+ config_perror("missing GROUP parameter");
+ return;
+ }
+ if (model == NULL || *model == 0) {
+ config_perror("missing MODEL parameter");
+ return;
+ }
+ if (security == NULL || *security == 0) {
+ config_perror("missing SECURITY parameter");
+ return;
+ }
+ if (strcasecmp(model, "v1") == 0)
+ imodel = SNMP_SEC_MODEL_SNMPv1;
+ else if (strcasecmp(model, "v2c") == 0)
+ imodel = SNMP_SEC_MODEL_SNMPv2c;
+ else if (strcasecmp(model, "any") == 0) {
+ config_perror
+ ("bad security model \"any\" should be: v1, v2c, usm or a registered security plugin name - installing anyway");
+ imodel = SNMP_SEC_MODEL_ANY;
+ } else {
+ if ((imodel = se_find_value_in_slist("snmp_secmods", model)) ==
+ SE_DNE) {
+ config_perror
+ ("bad security model, should be: v1, v2c or usm or a registered security plugin name");
+ return;
+ }
+ }
+ if (strlen(security) + 1 > sizeof(gp->groupName)) {
+ config_perror("security name too long");
+ return;
+ }
+ gp = vacm_createGroupEntry(imodel, security);
+ if (!gp) {
+ config_perror("failed to create group entry");
+ return;
+ }
+ strncpy(gp->groupName, group, sizeof(gp->groupName));
+ gp->groupName[ sizeof(gp->groupName)-1 ] = 0;
+ gp->storageType = SNMP_STORAGE_PERMANENT;
+ gp->status = SNMP_ROW_ACTIVE;
+ free(gp->reserved);
+ gp->reserved = NULL;
+}
+
+void
+vacm_free_group(void)
+{
+ vacm_destroyAllGroupEntries();
+}
+
+#define PARSE_CONT 0
+#define PARSE_FAIL 1
+
+int
+_vacm_parse_access_common(const char *token, char *param, char **st,
+ char **name, char **context, int *imodel,
+ int *ilevel, int *iprefix)
+{
+ char *model, *level, *prefix;
+
+ *name = strtok_r(param, " \t\n", st);
+ if (!*name) {
+ config_perror("missing NAME parameter");
+ return PARSE_FAIL;
+ }
+ *context = strtok_r(NULL, " \t\n", st);
+ if (!*context) {
+ config_perror("missing CONTEXT parameter");
+ return PARSE_FAIL;
+ }
+
+ model = strtok_r(NULL, " \t\n", st);
+ if (!model) {
+ config_perror("missing MODEL parameter");
+ return PARSE_FAIL;
+ }
+ level = strtok_r(NULL, " \t\n", st);
+ if (!level) {
+ config_perror("missing LEVEL parameter");
+ return PARSE_FAIL;
+ }
+ prefix = strtok_r(NULL, " \t\n", st);
+ if (!prefix) {
+ config_perror("missing PREFIX parameter");
+ return PARSE_FAIL;
+ }
+
+ if (strcmp(*context, "\"\"") == 0)
+ **context = 0;
+ if (strcasecmp(model, "any") == 0)
+ *imodel = SNMP_SEC_MODEL_ANY;
+ else if (strcasecmp(model, "v1") == 0)
+ *imodel = SNMP_SEC_MODEL_SNMPv1;
+ else if (strcasecmp(model, "v2c") == 0)
+ *imodel = SNMP_SEC_MODEL_SNMPv2c;
+ else {
+ if ((*imodel = se_find_value_in_slist("snmp_secmods", model))
+ == SE_DNE) {
+ config_perror
+ ("bad security model, should be: v1, v2c or usm or a registered security plugin name");
+ return PARSE_FAIL;
+ }
+ }
+
+ if (strcasecmp(level, "noauth") == 0)
+ *ilevel = SNMP_SEC_LEVEL_NOAUTH;
+ else if (strcasecmp(level, "noauthnopriv") == 0)
+ *ilevel = SNMP_SEC_LEVEL_NOAUTH;
+ else if (strcasecmp(level, "auth") == 0)
+ *ilevel = SNMP_SEC_LEVEL_AUTHNOPRIV;
+ else if (strcasecmp(level, "authnopriv") == 0)
+ *ilevel = SNMP_SEC_LEVEL_AUTHNOPRIV;
+ else if (strcasecmp(level, "priv") == 0)
+ *ilevel = SNMP_SEC_LEVEL_AUTHPRIV;
+ else if (strcasecmp(level, "authpriv") == 0)
+ *ilevel = SNMP_SEC_LEVEL_AUTHPRIV;
+ else {
+ config_perror
+ ("bad security level (noauthnopriv, authnopriv, authpriv)");
+ return PARSE_FAIL;
+ }
+
+ if (strcmp(prefix, "exact") == 0)
+ *iprefix = 1;
+ else if (strcmp(prefix, "prefix") == 0)
+ *iprefix = 2;
+ else if (strcmp(prefix, "0") == 0) {
+ config_perror
+ ("bad prefix match parameter \"0\", should be: exact or prefix - installing anyway");
+ *iprefix = 1;
+ } else {
+ config_perror
+ ("bad prefix match parameter, should be: exact or prefix");
+ return PARSE_FAIL;
+ }
+
+ return PARSE_CONT;
+}
+
+/* **************************************/
+/* authorization parsing token handlers */
+/* **************************************/
+
+int
+vacm_parse_authtokens(const char *token, char **confline)
+{
+ char authspec[SNMP_MAXBUF_MEDIUM];
+ char *strtok_state;
+ char *type;
+ int viewtype, viewtypes = 0;
+
+ *confline = copy_nword(*confline, authspec, sizeof(authspec));
+
+ DEBUGMSGTL(("vacm_parse_authtokens","parsing %s",authspec));
+ if (!*confline) {
+ config_perror("Illegal configuration line: missing fields");
+ return -1;
+ }
+
+ type = strtok_r(authspec, ",|:", &strtok_state);
+ while(type && *type != '\0') {
+ viewtype = se_find_value_in_slist(VACM_VIEW_ENUM_NAME, type);
+ if (viewtype < 0 || viewtype >= VACM_MAX_VIEWS) {
+ config_perror("Illegal view name");
+ } else {
+ viewtypes |= (1 << viewtype);
+ }
+ type = strtok_r(NULL, ",|:", &strtok_state);
+ }
+ DEBUGMSG(("vacm_parse_authtokens"," .. result = 0x%x\n",viewtypes));
+ return viewtypes;
+}
+
+void
+vacm_parse_authuser(const char *token, char *confline)
+{
+ int viewtypes = vacm_parse_authtokens(token, &confline);
+ if (viewtypes != -1)
+ vacm_create_simple(token, confline, VACM_CREATE_SIMPLE_V3, viewtypes);
+}
+
+void
+vacm_parse_authcommunity(const char *token, char *confline)
+{
+ int viewtypes = vacm_parse_authtokens(token, &confline);
+ if (viewtypes != -1)
+ vacm_create_simple(token, confline, VACM_CREATE_SIMPLE_COM, viewtypes);
+}
+
+void
+vacm_parse_authaccess(const char *token, char *confline)
+{
+ char *group, *view, *context, *tmp;
+ int model = SNMP_SEC_MODEL_ANY;
+ int level, prefix;
+ int i;
+ char *st;
+ struct vacm_accessEntry *ap;
+ int viewtypes = vacm_parse_authtokens(token, &confline);
+
+ if (viewtypes == -1)
+ return;
+
+ group = strtok_r(confline, " \t\n", &st);
+ if (!group) {
+ config_perror("missing GROUP parameter");
+ return;
+ }
+ view = strtok_r(NULL, " \t\n", &st);
+ if (!view) {
+ config_perror("missing VIEW parameter");
+ return;
+ }
+
+ /*
+ * Check for security model option
+ */
+ if ( strcasecmp(view, "-s") == 0 ) {
+ tmp = strtok_r(NULL, " \t\n", &st);
+ if (tmp) {
+ if (strcasecmp(tmp, "any") == 0)
+ model = SNMP_SEC_MODEL_ANY;
+ else if (strcasecmp(tmp, "v1") == 0)
+ model = SNMP_SEC_MODEL_SNMPv1;
+ else if (strcasecmp(tmp, "v2c") == 0)
+ model = SNMP_SEC_MODEL_SNMPv2c;
+ else {
+ model = se_find_value_in_slist("snmp_secmods", tmp);
+ if (model == SE_DNE) {
+ config_perror
+ ("bad security model, should be: v1, v2c or usm or a registered security plugin name");
+ return;
+ }
+ }
+ } else {
+ config_perror("missing SECMODEL parameter");
+ return;
+ }
+ view = strtok_r(NULL, " \t\n", &st);
+ if (!view) {
+ config_perror("missing VIEW parameter");
+ return;
+ }
+ }
+ if (strlen(view) >= VACMSTRINGLEN ) {
+ config_perror("View value too long");
+ return;
+ }
+
+ /*
+ * Now parse optional fields, or provide default values
+ */
+
+ tmp = strtok_r(NULL, " \t\n", &st);
+ if (tmp) {
+ if (strcasecmp(tmp, "noauth") == 0)
+ level = SNMP_SEC_LEVEL_NOAUTH;
+ else if (strcasecmp(tmp, "noauthnopriv") == 0)
+ level = SNMP_SEC_LEVEL_NOAUTH;
+ else if (strcasecmp(tmp, "auth") == 0)
+ level = SNMP_SEC_LEVEL_AUTHNOPRIV;
+ else if (strcasecmp(tmp, "authnopriv") == 0)
+ level = SNMP_SEC_LEVEL_AUTHNOPRIV;
+ else if (strcasecmp(tmp, "priv") == 0)
+ level = SNMP_SEC_LEVEL_AUTHPRIV;
+ else if (strcasecmp(tmp, "authpriv") == 0)
+ level = SNMP_SEC_LEVEL_AUTHPRIV;
+ else {
+ config_perror
+ ("bad security level (noauthnopriv, authnopriv, authpriv)");
+ return;
+ }
+ } else {
+ /* What about SNMP_SEC_MODEL_ANY ?? */
+ if ( model == SNMP_SEC_MODEL_SNMPv1 ||
+ model == SNMP_SEC_MODEL_SNMPv2c )
+ level = SNMP_SEC_LEVEL_NOAUTH;
+ else
+ level = SNMP_SEC_LEVEL_AUTHNOPRIV;
+ }
+
+
+ context = strtok_r(NULL, " \t\n", &st);
+ if (context) {
+ tmp = (context + strlen(context)-1);
+ if (tmp && *tmp == '*') {
+ *tmp = '\0';
+ prefix = 2;
+ } else {
+ prefix = 1;
+ }
+ } else {
+ context = "";
+ prefix = 1; /* Or prefix(2) ?? */
+ }
+
+ /*
+ * Now we can create the access entry
+ */
+ ap = vacm_getAccessEntry(group, context, model, level);
+ if (!ap) {
+ ap = vacm_createAccessEntry(group, context, model, level);
+ DEBUGMSGTL(("vacm:conf:authaccess",
+ "no existing access found; creating a new one\n"));
+ } else {
+ DEBUGMSGTL(("vacm:conf:authaccess",
+ "existing access found, using it\n"));
+ }
+ if (!ap) {
+ config_perror("failed to create access entry");
+ return;
+ }
+
+ for (i = 0; i <= VACM_MAX_VIEWS; i++) {
+ if (viewtypes & (1 << i)) {
+ strcpy(ap->views[i], view);
+ }
+ }
+ ap->contextMatch = prefix;
+ ap->storageType = SNMP_STORAGE_PERMANENT;
+ ap->status = SNMP_ROW_ACTIVE;
+ if (ap->reserved)
+ free(ap->reserved);
+ ap->reserved = NULL;
+}
+
+void
+vacm_parse_setaccess(const char *token, char *param)
+{
+ char *name, *context, *viewname, *viewval;
+ int imodel, ilevel, iprefix;
+ int viewnum;
+ char *st;
+ struct vacm_accessEntry *ap;
+
+ if (_vacm_parse_access_common(token, param, &st, &name,
+ &context, &imodel, &ilevel, &iprefix)
+ == PARSE_FAIL) {
+ return;
+ }
+
+ viewname = strtok_r(NULL, " \t\n", &st);
+ if (!viewname) {
+ config_perror("missing viewname parameter");
+ return;
+ }
+ viewval = strtok_r(NULL, " \t\n", &st);
+ if (!viewval) {
+ config_perror("missing viewval parameter");
+ return;
+ }
+
+ if (strlen(viewval) + 1 > sizeof(ap->views[VACM_VIEW_NOTIFY])) {
+ config_perror("View value too long");
+ return;
+ }
+
+ viewnum = se_find_value_in_slist(VACM_VIEW_ENUM_NAME, viewname);
+ if (viewnum < 0 || viewnum >= VACM_MAX_VIEWS) {
+ config_perror("Illegal view name");
+ return;
+ }
+
+ ap = vacm_getAccessEntry(name, context, imodel, ilevel);
+ if (!ap) {
+ ap = vacm_createAccessEntry(name, context, imodel, ilevel);
+ DEBUGMSGTL(("vacm:conf:setaccess",
+ "no existing access found; creating a new one\n"));
+ } else {
+ DEBUGMSGTL(("vacm:conf:setaccess",
+ "existing access found, using it\n"));
+ }
+ if (!ap) {
+ config_perror("failed to create access entry");
+ return;
+ }
+ if (!ap) {
+ config_perror("failed to create access entry");
+ return;
+ }
+
+ strcpy(ap->views[viewnum], viewval);
+ ap->contextMatch = iprefix;
+ ap->storageType = SNMP_STORAGE_PERMANENT;
+ ap->status = SNMP_ROW_ACTIVE;
+ free(ap->reserved);
+ ap->reserved = NULL;
+}
+
+void
+vacm_parse_access(const char *token, char *param)
+{
+ char *name, *context, *readView, *writeView, *notify;
+ int imodel, ilevel, iprefix;
+ struct vacm_accessEntry *ap;
+ char *st;
+
+
+ if (_vacm_parse_access_common(token, param, &st, &name,
+ &context, &imodel, &ilevel, &iprefix)
+ == PARSE_FAIL) {
+ return;
+ }
+
+ readView = strtok_r(NULL, " \t\n", &st);
+ if (!readView) {
+ config_perror("missing readView parameter");
+ return;
+ }
+ writeView = strtok_r(NULL, " \t\n", &st);
+ if (!writeView) {
+ config_perror("missing writeView parameter");
+ return;
+ }
+ notify = strtok_r(NULL, " \t\n", &st);
+ if (!notify) {
+ config_perror("missing notifyView parameter");
+ return;
+ }
+
+ if (strlen(readView) + 1 > sizeof(ap->views[VACM_VIEW_READ])) {
+ config_perror("readView too long");
+ return;
+ }
+ if (strlen(writeView) + 1 > sizeof(ap->views[VACM_VIEW_WRITE])) {
+ config_perror("writeView too long");
+ return;
+ }
+ if (strlen(notify) + 1 > sizeof(ap->views[VACM_VIEW_NOTIFY])) {
+ config_perror("notifyView too long");
+ return;
+ }
+ ap = vacm_createAccessEntry(name, context, imodel, ilevel);
+ if (!ap) {
+ config_perror("failed to create access entry");
+ return;
+ }
+ strcpy(ap->views[VACM_VIEW_READ], readView);
+ strcpy(ap->views[VACM_VIEW_WRITE], writeView);
+ strcpy(ap->views[VACM_VIEW_NOTIFY], notify);
+ ap->contextMatch = iprefix;
+ ap->storageType = SNMP_STORAGE_PERMANENT;
+ ap->status = SNMP_ROW_ACTIVE;
+ free(ap->reserved);
+ ap->reserved = NULL;
+}
+
+void
+vacm_free_access(void)
+{
+ vacm_destroyAllAccessEntries();
+}
+
+void
+vacm_parse_view(const char *token, char *param)
+{
+ char *name, *type, *subtree, *mask;
+ int inclexcl;
+ struct vacm_viewEntry *vp;
+ oid suboid[MAX_OID_LEN];
+ size_t suboid_len = 0;
+ size_t mask_len = 0;
+ u_char viewMask[VACMSTRINGLEN];
+ int i;
+ char *st;
+
+ name = strtok_r(param, " \t\n", &st);
+ if (!name) {
+ config_perror("missing NAME parameter");
+ return;
+ }
+ type = strtok_r(NULL, " \n\t", &st);
+ if (!type) {
+ config_perror("missing TYPE parameter");
+ return;
+ }
+ subtree = strtok_r(NULL, " \t\n", &st);
+ if (!subtree) {
+ config_perror("missing SUBTREE parameter");
+ return;
+ }
+ mask = strtok_r(NULL, "\0", &st);
+
+ if (strcmp(type, "included") == 0)
+ inclexcl = SNMP_VIEW_INCLUDED;
+ else if (strcmp(type, "excluded") == 0)
+ inclexcl = SNMP_VIEW_EXCLUDED;
+ else {
+ config_perror("TYPE must be included/excluded?");
+ return;
+ }
+ suboid_len = strlen(subtree)-1;
+ if (subtree[suboid_len] == '.')
+ subtree[suboid_len] = '\0'; /* stamp on a trailing . */
+ suboid_len = MAX_OID_LEN;
+ if (!snmp_parse_oid(subtree, suboid, &suboid_len)) {
+ config_perror("bad SUBTREE object id");
+ return;
+ }
+ if (mask) {
+ int val;
+ i = 0;
+ for (mask = strtok_r(mask, " .:", &st); mask; mask = strtok_r(NULL, " .:", &st)) {
+ if (i >= sizeof(viewMask)) {
+ config_perror("MASK too long");
+ return;
+ }
+ if (sscanf(mask, "%x", &val) == 0) {
+ config_perror("invalid MASK");
+ return;
+ }
+ viewMask[i] = val;
+ i++;
+ }
+ mask_len = i;
+ } else {
+ for (i = 0; i < sizeof(viewMask); i++)
+ viewMask[i] = 0xff;
+ }
+ vp = vacm_createViewEntry(name, suboid, suboid_len);
+ if (!vp) {
+ config_perror("failed to create view entry");
+ return;
+ }
+ memcpy(vp->viewMask, viewMask, sizeof(viewMask));
+ vp->viewMaskLen = mask_len;
+ vp->viewType = inclexcl;
+ vp->viewStorageType = SNMP_STORAGE_PERMANENT;
+ vp->viewStatus = SNMP_ROW_ACTIVE;
+ free(vp->reserved);
+ vp->reserved = NULL;
+}
+
+void
+vacm_free_view(void)
+{
+ vacm_destroyAllViewEntries();
+}
+
+void
+vacm_gen_com2sec(int commcount, char *community, char *addressname,
+ char *publishtoken,
+ void (*parser)(const char *, char *),
+ char *secname, size_t secname_len,
+ char *viewname, size_t viewname_len, int version)
+{
+ char line[SPRINT_MAX_LEN];
+
+ /*
+ * com2sec6|comsec anonymousSecNameNUM ADDRESS COMMUNITY
+ */
+ snprintf(secname, secname_len-1, "comm%d", commcount);
+ secname[secname_len-1] = '\0';
+ if (viewname) {
+ snprintf(viewname, viewname_len-1, "viewComm%d", commcount);
+ viewname[viewname_len-1] = '\0';
+ }
+ snprintf(line, sizeof(line), "%s %s '%s'",
+ secname, addressname, community);
+ line[ sizeof(line)-1 ] = 0;
+ DEBUGMSGTL((publishtoken, "passing: %s %s\n", publishtoken, line));
+ (*parser)(publishtoken, line);
+
+ /*
+ * sec->group mapping
+ */
+ /*
+ * group anonymousGroupNameNUM any anonymousSecNameNUM
+ */
+ if ( version & SNMP_SEC_MODEL_SNMPv1 ) {
+ snprintf(line, sizeof(line),
+ "grp%.28s v1 %s", secname, secname);
+ line[ sizeof(line)-1 ] = 0;
+ DEBUGMSGTL((publishtoken, "passing: %s %s\n", "group", line));
+ vacm_parse_group("group", line);
+ }
+
+ if ( version & SNMP_SEC_MODEL_SNMPv2c ) {
+ snprintf(line, sizeof(line),
+ "grp%.28s v2c %s", secname, secname);
+ line[ sizeof(line)-1 ] = 0;
+ DEBUGMSGTL((publishtoken, "passing: %s %s\n", "group", line));
+ vacm_parse_group("group", line);
+ }
+}
+
+void
+vacm_parse_rwuser(const char *token, char *confline)
+{
+ vacm_create_simple(token, confline, VACM_CREATE_SIMPLE_V3,
+ VACM_VIEW_READ_BIT | VACM_VIEW_WRITE_BIT);
+}
+
+void
+vacm_parse_rouser(const char *token, char *confline)
+{
+ vacm_create_simple(token, confline, VACM_CREATE_SIMPLE_V3,
+ VACM_VIEW_READ_BIT);
+}
+
+void
+vacm_parse_rocommunity(const char *token, char *confline)
+{
+ vacm_create_simple(token, confline, VACM_CREATE_SIMPLE_COMIPV4,
+ VACM_VIEW_READ_BIT);
+}
+
+void
+vacm_parse_rwcommunity(const char *token, char *confline)
+{
+ vacm_create_simple(token, confline, VACM_CREATE_SIMPLE_COMIPV4,
+ VACM_VIEW_READ_BIT | VACM_VIEW_WRITE_BIT);
+}
+
+void
+vacm_parse_rocommunity6(const char *token, char *confline)
+{
+ vacm_create_simple(token, confline, VACM_CREATE_SIMPLE_COMIPV6,
+ VACM_VIEW_READ_BIT);
+}
+
+void
+vacm_parse_rwcommunity6(const char *token, char *confline)
+{
+ vacm_create_simple(token, confline, VACM_CREATE_SIMPLE_COMIPV6,
+ VACM_VIEW_READ_BIT | VACM_VIEW_WRITE_BIT);
+}
+
+
+void
+vacm_create_simple(const char *token, char *confline,
+ int parsetype, int viewtypes)
+{
+ char line[SPRINT_MAX_LEN];
+ char community[COMMUNITY_MAX_LEN];
+ char theoid[SPRINT_MAX_LEN];
+ char viewname[SPRINT_MAX_LEN];
+ char *view_ptr = viewname;
+#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
+ char addressname[SPRINT_MAX_LEN];
+#endif
+ const char *rw = "none";
+ char model[SPRINT_MAX_LEN];
+ char *cp, *tmp;
+ char secname[SPRINT_MAX_LEN];
+ char grpname[SPRINT_MAX_LEN];
+ char authlevel[SPRINT_MAX_LEN];
+ char context[SPRINT_MAX_LEN];
+ int ctxprefix = 1; /* Default to matching all contexts */
+ static int commcount = 0;
+ /* Conveniently, the community-based security
+ model values can also be used as bit flags */
+ int commversion = SNMP_SEC_MODEL_SNMPv1 |
+ SNMP_SEC_MODEL_SNMPv2c;
+
+ /*
+ * init
+ */
+ strcpy(model, "any");
+ memset(context, 0, sizeof(context));
+ memset(secname, 0, sizeof(secname));
+ memset(grpname, 0, sizeof(grpname));
+
+ /*
+ * community name or user name
+ */
+ cp = copy_nword(confline, community, sizeof(community));
+
+ if (parsetype == VACM_CREATE_SIMPLE_V3) {
+ /*
+ * maybe security model type
+ */
+ if (strcmp(community, "-s") == 0) {
+ /*
+ * -s model ...
+ */
+ if (cp)
+ cp = copy_nword(cp, model, sizeof(model));
+ if (!cp) {
+ config_perror("illegal line");
+ return;
+ }
+ if (cp)
+ cp = copy_nword(cp, community, sizeof(community));
+ } else {
+ strcpy(model, "usm");
+ }
+ /*
+ * authentication level
+ */
+ if (cp && *cp)
+ cp = copy_nword(cp, authlevel, sizeof(authlevel));
+ else
+ strcpy(authlevel, "auth");
+ DEBUGMSGTL((token, "setting auth level: \"%s\"\n", authlevel));
+#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
+ } else {
+ if (strcmp(community, "-v") == 0) {
+ /*
+ * -v version ...
+ */
+ if (cp)
+ cp = copy_nword(cp, model, sizeof(model));
+ if (!cp) {
+ config_perror("illegal line");
+ return;
+ }
+ if ( strcasecmp( model, "1" ) == 0 )
+ strcpy(model, "v1");
+ if ( strcasecmp( model, "v1" ) == 0 )
+ commversion = SNMP_SEC_MODEL_SNMPv1;
+ if ( strcasecmp( model, "2c" ) == 0 )
+ strcpy(model, "v2c");
+ if ( strcasecmp( model, "v2c" ) == 0 )
+ commversion = SNMP_SEC_MODEL_SNMPv2c;
+ if (cp)
+ cp = copy_nword(cp, community, sizeof(community));
+ }
+ /*
+ * source address
+ */
+ if (cp && *cp) {
+ cp = copy_nword(cp, addressname, sizeof(addressname));
+ } else {
+ strcpy(addressname, "default");
+ }
+ /*
+ * authlevel has to be noauth
+ */
+ strcpy(authlevel, "noauth");
+#endif /* support for community based SNMP */
+ }
+
+ /*
+ * oid they can touch
+ */
+ if (cp && *cp) {
+ if (strncmp(cp, "-V ", 3) == 0) {
+ cp = skip_token(cp);
+ cp = copy_nword(cp, viewname, sizeof(viewname));
+ view_ptr = NULL;
+ } else {
+ cp = copy_nword(cp, theoid, sizeof(theoid));
+ }
+ } else {
+ strcpy(theoid, ".1");
+ strcpy(viewname, "_all_");
+ view_ptr = NULL;
+ }
+ /*
+ * optional, non-default context
+ */
+ if (cp && *cp) {
+ cp = copy_nword(cp, context, sizeof(context));
+ tmp = (context + strlen(context)-1);
+ if (tmp && *tmp == '*') {
+ *tmp = '\0';
+ ctxprefix = 1;
+ } else {
+ /*
+ * If no context field is given, then we default to matching
+ * all contexts (for compatability with previous releases).
+ * But if a field context is specified (not ending with '*')
+ * then this should be taken as an exact match.
+ * Specifying a context field of "" will match the default
+ * context (and *only* the default context).
+ */
+ ctxprefix = 0;
+ }
+ }
+
+ if (viewtypes & VACM_VIEW_WRITE_BIT)
+ rw = viewname;
+
+ commcount++;
+
+#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
+ if (parsetype == VACM_CREATE_SIMPLE_COMIPV4 ||
+ parsetype == VACM_CREATE_SIMPLE_COM) {
+ vacm_gen_com2sec(commcount, community, addressname,
+ "com2sec", &netsnmp_udp_parse_security,
+ secname, sizeof(secname),
+ view_ptr, sizeof(viewname), commversion);
+ }
+
+#ifdef NETSNMP_TRANSPORT_UNIX_DOMAIN
+ if (parsetype == VACM_CREATE_SIMPLE_COMUNIX ||
+ parsetype == VACM_CREATE_SIMPLE_COM) {
+ snprintf(line, sizeof(line), "%s %s '%s'",
+ secname, addressname, community);
+ line[ sizeof(line)-1 ] = 0;
+ DEBUGMSGTL((token, "passing: %s %s\n", "com2secunix", line));
+ netsnmp_unix_parse_security("com2secunix", line);
+ }
+#endif
+
+#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
+ if (parsetype == VACM_CREATE_SIMPLE_COMIPV6 ||
+ parsetype == VACM_CREATE_SIMPLE_COM) {
+ vacm_gen_com2sec(commcount, community, addressname,
+ "com2sec6", &netsnmp_udp6_parse_security,
+ secname, sizeof(secname),
+ view_ptr, sizeof(viewname), commversion);
+ }
+#endif
+#endif /* support for community based SNMP */
+
+ if (parsetype == VACM_CREATE_SIMPLE_V3) {
+ /* support for SNMPv3 user names */
+ if (view_ptr) {
+ sprintf(viewname,"viewUSM%d",commcount);
+ }
+ if ( strcmp( token, "authgroup" ) == 0 ) {
+ strncpy(grpname, community, sizeof(grpname));
+ grpname[ sizeof(grpname)-1 ] = 0;
+ } else {
+ strncpy(secname, community, sizeof(secname));
+ secname[ sizeof(secname)-1 ] = 0;
+
+ /*
+ * sec->group mapping
+ */
+ /*
+ * group anonymousGroupNameNUM any anonymousSecNameNUM
+ */
+ snprintf(grpname, sizeof(grpname), "grp%.28s", secname);
+ for (tmp=grpname; *tmp; tmp++)
+ if (!isalnum(*tmp))
+ *tmp = '_';
+ snprintf(line, sizeof(line),
+ "%s %s %s", grpname, model, secname);
+ line[ sizeof(line)-1 ] = 0;
+ DEBUGMSGTL((token, "passing: %s %s\n", "group", line));
+ vacm_parse_group("group", line);
+ }
+ } else {
+ snprintf(grpname, sizeof(grpname), "grp%.28s", secname);
+ for (tmp=grpname; *tmp; tmp++)
+ if (!isalnum(*tmp))
+ *tmp = '_';
+ }
+
+ /*
+ * view definition
+ */
+ /*
+ * view anonymousViewNUM included OID
+ */
+ if (view_ptr) {
+ snprintf(line, sizeof(line), "%s included %s", viewname, theoid);
+ line[ sizeof(line)-1 ] = 0;
+ DEBUGMSGTL((token, "passing: %s %s\n", "view", line));
+ vacm_parse_view("view", line);
+ }
+
+ /*
+ * map everything together
+ */
+ if ((viewtypes == VACM_VIEW_READ_BIT) ||
+ (viewtypes == (VACM_VIEW_READ_BIT | VACM_VIEW_WRITE_BIT))) {
+ /* Use the simple line access command */
+ /*
+ * access anonymousGroupNameNUM "" MODEL AUTHTYPE prefix anonymousViewNUM [none/anonymousViewNUM] [none/anonymousViewNUM]
+ */
+ snprintf(line, sizeof(line),
+ "%s %s %s %s %s %s %s %s",
+ grpname, context[0] ? context : "\"\"",
+ model, authlevel,
+ (ctxprefix ? "prefix" : "exact"),
+ viewname, rw, rw);
+ line[ sizeof(line)-1 ] = 0;
+ DEBUGMSGTL((token, "passing: %s %s\n", "access", line));
+ vacm_parse_access("access", line);
+ } else {
+ /* Use one setaccess line per access type */
+ /*
+ * setaccess anonymousGroupNameNUM "" MODEL AUTHTYPE prefix viewname viewval
+ */
+ int i;
+ DEBUGMSGTL((token, " checking view levels for %x\n", viewtypes));
+ for(i = 0; i <= VACM_MAX_VIEWS; i++) {
+ if (viewtypes & (1 << i)) {
+ snprintf(line, sizeof(line),
+ "%s %s %s %s %s %s %s",
+ grpname, context[0] ? context : "\"\"",
+ model, authlevel,
+ (ctxprefix ? "prefix" : "exact"),
+ se_find_label_in_slist(VACM_VIEW_ENUM_NAME, i),
+ viewname);
+ line[ sizeof(line)-1 ] = 0;
+ DEBUGMSGTL((token, "passing: %s %s\n", "setaccess", line));
+ vacm_parse_setaccess("setaccess", line);
+ }
+ }
+ }
+}
+
+int
+vacm_standard_views(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ char line[SPRINT_MAX_LEN];
+
+ memset(line, 0, sizeof(line));
+
+ snprintf(line, sizeof(line), "_all_ included .0");
+ vacm_parse_view("view", line);
+ snprintf(line, sizeof(line), "_all_ included .1");
+ vacm_parse_view("view", line);
+ snprintf(line, sizeof(line), "_all_ included .2");
+ vacm_parse_view("view", line);
+
+ snprintf(line, sizeof(line), "_none_ excluded .0");
+ vacm_parse_view("view", line);
+ snprintf(line, sizeof(line), "_none_ excluded .1");
+ vacm_parse_view("view", line);
+ snprintf(line, sizeof(line), "_none_ excluded .2");
+ vacm_parse_view("view", line);
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+vacm_warn_if_not_configured(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ const char * name = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_APPTYPE);
+ const int agent_mode = netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_ROLE);
+ if (NULL==name)
+ name = "snmpd";
+
+ if (!vacm_is_configured()) {
+ /*
+ * An AgentX subagent relies on the master agent to apply suitable
+ * access control checks, so doesn't need local VACM configuration.
+ * The trap daemon has a separate check (see below).
+ *
+ * Otherwise, an AgentX master or SNMP standalone agent requires some
+ * form of VACM configuration. No config means that no incoming
+ * requests will be accepted, so warn the user accordingly.
+ */
+ if ((MASTER_AGENT == agent_mode) && (strcmp(name, "snmptrapd") != 0)) {
+ snmp_log(LOG_WARNING,
+ "Warning: no access control information configured.\n It's "
+ "unlikely this agent can serve any useful purpose in this "
+ "state.\n Run \"snmpconf -g basic_setup\" to help you "
+ "configure the %s.conf file for this agent.\n", name );
+ }
+
+ /*
+ * The trap daemon implements VACM-style access control for incoming
+ * notifications, but offers a way of turning this off (for backwards
+ * compatability). Check for this explicitly, and warn if necessary.
+ *
+ * NB: The NETSNMP_DS_APP_NO_AUTHORIZATION definition is a duplicate
+ * of an identical setting in "apps/snmptrapd_ds.h".
+ * These two need to be kept in synch.
+ */
+#ifndef NETSNMP_DS_APP_NO_AUTHORIZATION
+#define NETSNMP_DS_APP_NO_AUTHORIZATION 17
+#endif
+ if (!strcmp(name, "snmptrapd") &&
+ !netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_APP_NO_AUTHORIZATION)) {
+ snmp_log(LOG_WARNING,
+ "Warning: no access control information configured.\n"
+ "This receiver will *NOT* accept any incoming notifications.\n");
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+vacm_in_view_callback(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ struct view_parameters *view_parms =
+ (struct view_parameters *) serverarg;
+ int retval;
+
+ if (view_parms == NULL)
+ return 1;
+ retval = vacm_in_view(view_parms->pdu, view_parms->name,
+ view_parms->namelen, view_parms->check_subtree);
+ if (retval != 0)
+ view_parms->errorcode = retval;
+ return retval;
+}
+
+
+/**
+ * vacm_in_view: decides if a given PDU can be acted upon
+ *
+ * Parameters:
+ * *pdu
+ * *name
+ * namelen
+ * check_subtree
+ *
+ * Returns:
+ * VACM_SUCCESS(0) On success.
+ * VACM_NOSECNAME(1) Missing security name.
+ * VACM_NOGROUP(2) Missing group
+ * VACM_NOACCESS(3) Missing access
+ * VACM_NOVIEW(4) Missing view
+ * VACM_NOTINVIEW(5) Not in view
+ * VACM_NOSUCHCONTEXT(6) No Such Context
+ * VACM_SUBTREE_UNKNOWN(7) When testing an entire subtree, UNKNOWN (ie, the entire
+ * subtree has both allowed and disallowed portions)
+ *
+ * Debug output listed as follows:
+ * \<securityName\> \<groupName\> \<viewName\> \<viewType\>
+ */
+int
+vacm_in_view(netsnmp_pdu *pdu, oid * name, size_t namelen,
+ int check_subtree)
+{
+ int viewtype;
+
+ switch (pdu->command) {
+ case SNMP_MSG_GET:
+ case SNMP_MSG_GETNEXT:
+ case SNMP_MSG_GETBULK:
+ viewtype = VACM_VIEW_READ;
+ break;
+ case SNMP_MSG_SET:
+ viewtype = VACM_VIEW_WRITE;
+ break;
+ case SNMP_MSG_TRAP:
+ case SNMP_MSG_TRAP2:
+ case SNMP_MSG_INFORM:
+ viewtype = VACM_VIEW_NOTIFY;
+ break;
+ default:
+ snmp_log(LOG_ERR, "bad msg type in vacm_in_view: %d\n",
+ pdu->command);
+ viewtype = VACM_VIEW_READ;
+ }
+ return vacm_check_view(pdu, name, namelen, check_subtree, viewtype);
+}
+
+/**
+ * vacm_check_view: decides if a given PDU can be taken based on a view type
+ *
+ * Parameters:
+ * *pdu
+ * *name
+ * namelen
+ * check_subtree
+ * viewtype
+ *
+ * Returns:
+ * VACM_SUCCESS(0) On success.
+ * VACM_NOSECNAME(1) Missing security name.
+ * VACM_NOGROUP(2) Missing group
+ * VACM_NOACCESS(3) Missing access
+ * VACM_NOVIEW(4) Missing view
+ * VACM_NOTINVIEW(5) Not in view
+ * VACM_NOSUCHCONTEXT(6) No Such Context
+ * VACM_SUBTREE_UNKNOWN(7) When testing an entire subtree, UNKNOWN (ie, the entire
+ * subtree has both allowed and disallowed portions)
+ *
+ * Debug output listed as follows:
+ * \<securityName\> \<groupName\> \<viewName\> \<viewType\>
+ */
+int
+vacm_check_view(netsnmp_pdu *pdu, oid * name, size_t namelen,
+ int check_subtree, int viewtype)
+{
+ struct vacm_accessEntry *ap;
+ struct vacm_groupEntry *gp;
+ struct vacm_viewEntry *vp;
+ char vacm_default_context[1] = "";
+ char *contextName = vacm_default_context;
+ char *sn = NULL;
+ char *vn;
+ char *pdu_community;
+
+ /*
+ * len defined by the vacmContextName object
+ */
+#define CONTEXTNAMEINDEXLEN 32
+ char contextNameIndex[CONTEXTNAMEINDEXLEN + 1];
+
+#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
+#if defined(NETSNMP_DISABLE_SNMPV1)
+ if (pdu->version == SNMP_VERSION_2c)
+#else
+#if defined(NETSNMP_DISABLE_SNMPV2C)
+ if (pdu->version == SNMP_VERSION_1)
+#else
+ if (pdu->version == SNMP_VERSION_1 || pdu->version == SNMP_VERSION_2c)
+#endif
+#endif
+ {
+ pdu_community = pdu->community;
+ if (!pdu_community)
+ pdu_community = "";
+ if (snmp_get_do_debugging()) {
+ char *buf;
+ if (pdu->community) {
+ buf = (char *) malloc(1 + pdu->community_len);
+ memcpy(buf, pdu->community, pdu->community_len);
+ buf[pdu->community_len] = '\0';
+ } else {
+ DEBUGMSGTL(("mibII/vacm_vars", "NULL community"));
+ buf = strdup("NULL");
+ }
+
+ DEBUGMSGTL(("mibII/vacm_vars",
+ "vacm_in_view: ver=%d, community=%s\n",
+ pdu->version, buf));
+ free(buf);
+ }
+
+ /*
+ * Okay, if this PDU was received from a UDP or a TCP transport then
+ * ask the transport abstraction layer to map its source address and
+ * community string to a security name for us.
+ */
+
+ if (pdu->tDomain == netsnmpUDPDomain
+#ifdef NETSNMP_TRANSPORT_TCP_DOMAIN
+ || pdu->tDomain == netsnmp_snmpTCPDomain
+#endif
+ ) {
+ if (!netsnmp_udp_getSecName(pdu->transport_data,
+ pdu->transport_data_length,
+ (char *) pdu_community,
+ pdu->community_len, &sn,
+ &contextName)) {
+ /*
+ * There are no com2sec entries.
+ */
+ sn = NULL;
+ }
+ /* force the community -> context name mapping here */
+ SNMP_FREE(pdu->contextName);
+ pdu->contextName = strdup(contextName);
+ pdu->contextNameLen = strlen(contextName);
+#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
+ } else if (pdu->tDomain == netsnmp_UDPIPv6Domain
+#ifdef NETSNMP_TRANSPORT_TCPIPV6_DOMAIN
+ || pdu->tDomain == netsnmp_TCPIPv6Domain
+#endif
+ ) {
+ if (!netsnmp_udp6_getSecName(pdu->transport_data,
+ pdu->transport_data_length,
+ (char *) pdu_community,
+ pdu->community_len, &sn,
+ &contextName)) {
+ /*
+ * There are no com2sec entries.
+ */
+ sn = NULL;
+ }
+ /* force the community -> context name mapping here */
+ SNMP_FREE(pdu->contextName);
+ pdu->contextName = strdup(contextName);
+ pdu->contextNameLen = strlen(contextName);
+#endif
+#ifdef NETSNMP_TRANSPORT_UNIX_DOMAIN
+ } else if (pdu->tDomain == netsnmp_UnixDomain){
+ if (!netsnmp_unix_getSecName(pdu->transport_data,
+ pdu->transport_data_length,
+ (char *) pdu_community,
+ pdu->community_len, &sn,
+ &contextName)) {
+ sn = NULL;
+ }
+ /* force the community -> context name mapping here */
+ SNMP_FREE(pdu->contextName);
+ pdu->contextName = strdup(contextName);
+ pdu->contextNameLen = strlen(contextName);
+#endif
+ } else {
+ /*
+ * Map other <community, transport-address> pairs to security names
+ * here. For now just let non-IPv4 transport always succeed.
+ *
+ * WHAAAATTTT. No, we don't let non-IPv4 transports
+ * succeed! You must fix this to make it usable, sorry.
+ * From a security standpoint this is insane. -- Wes
+ */
+ /** @todo alternate com2sec mappings for non v4 transports.
+ Should be implemented via registration */
+ sn = NULL;
+ }
+
+ } else
+#endif /* support for community based SNMP */
+ if (find_sec_mod(pdu->securityModel)) {
+ /*
+ * any legal defined v3 security model
+ */
+ DEBUGMSG(("mibII/vacm_vars",
+ "vacm_in_view: ver=%d, model=%d, secName=%s\n",
+ pdu->version, pdu->securityModel, pdu->securityName));
+ sn = pdu->securityName;
+ contextName = pdu->contextName;
+ } else {
+ sn = NULL;
+ }
+
+ if (sn == NULL) {
+#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
+ snmp_increment_statistic(STAT_SNMPINBADCOMMUNITYNAMES);
+#endif
+ DEBUGMSGTL(("mibII/vacm_vars",
+ "vacm_in_view: No security name found\n"));
+ return VACM_NOSECNAME;
+ }
+
+ if (pdu->contextNameLen > CONTEXTNAMEINDEXLEN) {
+ DEBUGMSGTL(("mibII/vacm_vars",
+ "vacm_in_view: bad ctxt length %d\n",
+ pdu->contextNameLen));
+ return VACM_NOSUCHCONTEXT;
+ }
+ /*
+ * NULL termination of the pdu field is ugly here. Do in PDU parsing?
+ */
+ if (pdu->contextName)
+ strncpy(contextNameIndex, pdu->contextName, pdu->contextNameLen);
+ else
+ contextNameIndex[0] = '\0';
+
+ contextNameIndex[pdu->contextNameLen] = '\0';
+ if (!netsnmp_subtree_find_first(contextNameIndex)) {
+ /*
+ * rfc 3415 section 3.2, step 1
+ * no such context here; return no such context error
+ */
+ DEBUGMSGTL(("mibII/vacm_vars", "vacm_in_view: no such ctxt \"%s\"\n",
+ contextNameIndex));
+ return VACM_NOSUCHCONTEXT;
+ }
+
+ DEBUGMSGTL(("mibII/vacm_vars", "vacm_in_view: sn=%s", sn));
+
+ gp = vacm_getGroupEntry(pdu->securityModel, sn);
+ if (gp == NULL) {
+ DEBUGMSG(("mibII/vacm_vars", "\n"));
+ return VACM_NOGROUP;
+ }
+ DEBUGMSG(("mibII/vacm_vars", ", gn=%s", gp->groupName));
+
+ ap = vacm_getAccessEntry(gp->groupName, contextNameIndex,
+ pdu->securityModel, pdu->securityLevel);
+ if (ap == NULL) {
+ DEBUGMSG(("mibII/vacm_vars", "\n"));
+ return VACM_NOACCESS;
+ }
+
+ if (name == 0) { /* only check the setup of the vacm for the request */
+ DEBUGMSG(("mibII/vacm_vars", ", Done checking setup\n"));
+ return VACM_SUCCESS;
+ }
+
+ if (viewtype < 0 || viewtype >= VACM_MAX_VIEWS) {
+ DEBUGMSG(("mibII/vacm_vars", " illegal view type\n"));
+ return VACM_NOACCESS;
+ }
+ vn = ap->views[viewtype];
+ DEBUGMSG(("mibII/vacm_vars", ", vn=%s", vn));
+
+ if (check_subtree) {
+ DEBUGMSG(("mibII/vacm_vars", "\n"));
+ return vacm_checkSubtree(vn, name, namelen);
+ }
+
+ vp = vacm_getViewEntry(vn, name, namelen, VACM_MODE_FIND);
+
+ if (vp == NULL) {
+ DEBUGMSG(("mibII/vacm_vars", "\n"));
+ return VACM_NOVIEW;
+ }
+ DEBUGMSG(("mibII/vacm_vars", ", vt=%d\n", vp->viewType));
+
+ if (vp->viewType == SNMP_VIEW_EXCLUDED) {
+#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
+#if defined(NETSNMP_DISABLE_SNMPV1)
+ if (pdu->version == SNMP_VERSION_2c)
+#else
+#if defined(NETSNMP_DISABLE_SNMPV2C)
+ if (pdu->version == SNMP_VERSION_1)
+#else
+ if (pdu->version == SNMP_VERSION_1 || pdu->version == SNMP_VERSION_2c)
+#endif
+#endif
+ {
+ snmp_increment_statistic(STAT_SNMPINBADCOMMUNITYUSES);
+ }
+#endif
+ return VACM_NOTINVIEW;
+ }
+
+ return VACM_SUCCESS;
+
+} /* end vacm_in_view() */
+
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_conf.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_conf.h
new file mode 100644
index 0000000000..8e1597876c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_conf.h
@@ -0,0 +1,47 @@
+/*
+ * SNMPv3 View-based Access Control Model
+ */
+
+#ifndef _MIBGROUP_VACM_CONF_H
+#define _MIBGROUP_VACM_CONF_H
+
+#include <net-snmp/library/vacm.h>
+
+config_require(util_funcs)
+config_belongs_in(agent_module)
+
+#define VACM_CREATE_SIMPLE_V3 1
+#define VACM_CREATE_SIMPLE_COM 2
+#define VACM_CREATE_SIMPLE_COMIPV4 3
+#define VACM_CREATE_SIMPLE_COMIPV6 4
+#define VACM_CREATE_SIMPLE_COMUNIX 5
+
+ void init_vacm_conf(void);
+ void init_vacm_config_tokens(void);
+ void vacm_free_group(void);
+ void vacm_free_access(void);
+ void vacm_free_view(void);
+ void vacm_parse_group(const char *, char *);
+ void vacm_parse_access(const char *, char *);
+ void vacm_parse_setaccess(const char *, char *);
+ void vacm_parse_view(const char *, char *);
+ void vacm_parse_rocommunity(const char *, char *);
+ void vacm_parse_rwcommunity(const char *, char *);
+ void vacm_parse_rocommunity6(const char *, char *);
+ void vacm_parse_rwcommunity6(const char *, char *);
+ void vacm_parse_rouser(const char *, char *);
+ void vacm_parse_rwuser(const char *, char *);
+ void vacm_create_simple(const char *, char *, int, int);
+ void vacm_parse_authcommunity(const char *, char *);
+ void vacm_parse_authuser(const char *, char *);
+ void vacm_parse_authgroup(const char *, char *);
+ void vacm_parse_authaccess(const char *, char *);
+
+ SNMPCallback vacm_in_view_callback;
+ SNMPCallback vacm_warn_if_not_configured;
+ SNMPCallback vacm_standard_views;
+
+ int vacm_in_view(netsnmp_pdu *, oid *, size_t, int);
+ int vacm_check_view(netsnmp_pdu *, oid *, size_t, int, int);
+
+#endif /* _MIBGROUP_VACM_CONF_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_context.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_context.c
new file mode 100644
index 0000000000..46afc9078b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_context.c
@@ -0,0 +1,167 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/table_iterator.h>
+
+#include "vacm_context.h"
+
+static oid vacm_context_oid[] = { 1, 3, 6, 1, 6, 3, 16, 1, 1 };
+
+#define CONTEXTNAME_COLUMN 1
+
+/*
+ * return the index data from the first node in the agent's
+ * subtree_context_cache list.
+ */
+netsnmp_variable_list *
+get_first_context(void **my_loop_context, void **my_data_context,
+ netsnmp_variable_list * put_data,
+ netsnmp_iterator_info *iinfo)
+{
+ subtree_context_cache *context_ptr;
+ context_ptr = get_top_context_cache();
+
+ if (!context_ptr)
+ return NULL;
+
+ *my_loop_context = context_ptr;
+ *my_data_context = context_ptr;
+
+ snmp_set_var_value(put_data, context_ptr->context_name,
+ strlen(context_ptr->context_name));
+ return put_data;
+}
+
+/*
+ * return the next index data from the first node in the agent's
+ * subtree_context_cache list.
+ */
+netsnmp_variable_list *
+get_next_context(void **my_loop_context,
+ void **my_data_context,
+ netsnmp_variable_list * put_data,
+ netsnmp_iterator_info *iinfo)
+{
+ subtree_context_cache *context_ptr;
+
+ if (!my_loop_context || !*my_loop_context)
+ return NULL;
+
+ context_ptr = (subtree_context_cache *) (*my_loop_context);
+ context_ptr = context_ptr->next;
+ *my_loop_context = context_ptr;
+ *my_data_context = context_ptr;
+
+ if (!context_ptr)
+ return NULL;
+
+ snmp_set_var_value(put_data, context_ptr->context_name,
+ strlen(context_ptr->context_name));
+ return put_data;
+}
+
+void
+init_vacm_context(void)
+{
+ /*
+ * table vacm_context
+ */
+ netsnmp_handler_registration *my_handler;
+ netsnmp_table_registration_info *table_info;
+ netsnmp_iterator_info *iinfo;
+
+ my_handler = netsnmp_create_handler_registration("vacm_context",
+ vacm_context_handler,
+ vacm_context_oid,
+ sizeof
+ (vacm_context_oid) /
+ sizeof(oid),
+ HANDLER_CAN_RONLY);
+
+ if (!my_handler)
+ return;
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ iinfo = SNMP_MALLOC_TYPEDEF(netsnmp_iterator_info);
+
+ if (!table_info || !iinfo) {
+ SNMP_FREE(table_info);
+ SNMP_FREE(iinfo);
+ return;
+ }
+
+ netsnmp_table_helper_add_index(table_info, ASN_OCTET_STR)
+ table_info->min_column = 1;
+ table_info->max_column = 1;
+ iinfo->get_first_data_point = get_first_context;
+ iinfo->get_next_data_point = get_next_context;
+ iinfo->table_reginfo = table_info;
+ netsnmp_register_table_iterator(my_handler, iinfo);
+}
+
+/*
+ * returns a list of known context names
+ */
+
+int
+vacm_context_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ subtree_context_cache *context_ptr;
+
+ for(; requests; requests = requests->next) {
+ netsnmp_variable_list *var = requests->requestvb;
+
+ if (requests->processed != 0)
+ continue;
+
+
+ context_ptr = (subtree_context_cache *)
+ netsnmp_extract_iterator_context(requests);
+
+ if (context_ptr == NULL) {
+ snmp_log(LOG_ERR,
+ "vacm_context_handler called without data\n");
+ continue;
+ }
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ /*
+ * if here we should have a context_ptr passed in already
+ */
+ /*
+ * only one column should ever reach us, so don't check it
+ */
+ snmp_set_var_typed_value(var, ASN_OCTET_STR,
+ context_ptr->context_name,
+ strlen(context_ptr->context_name));
+
+ break;
+
+ default:
+ /*
+ * We should never get here, getnext already have been
+ * handled by the table_iterator and we're read_only
+ */
+ snmp_log(LOG_ERR,
+ "vacm_context table accessed as mode=%d. We're improperly registered!",
+ reqinfo->mode);
+ break;
+
+
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_context.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_context.h
new file mode 100644
index 0000000000..924d0655c6
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_context.h
@@ -0,0 +1,6 @@
+/*
+ * testhandler.h
+ */
+
+void init_vacm_context(void);
+Netsnmp_Node_Handler vacm_context_handler;
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_vars.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_vars.c
new file mode 100644
index 0000000000..ed142a70a9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_vars.c
@@ -0,0 +1,1918 @@
+/*
+ * SNMPv3 View-based Access Control Model
+ */
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#include <ctype.h>
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/agent_callbacks.h>
+#include "vacm_vars.h"
+#include "util_funcs.h"
+
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#include "sysORTable.h"
+#endif
+static unsigned int vacmViewSpinLock = 0;
+
+void
+init_vacm_vars(void)
+{
+
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+ static oid reg[] = { SNMP_OID_SNMPMODULES, 16, 2, 2, 1 };
+#endif
+
+#define PRIVRW (NETSNMP_SNMPV2ANY | 0x5000)
+
+ struct variable1 vacm_sec2group[] = {
+ {SECURITYGROUP, ASN_OCTET_STR, RWRITE, var_vacm_sec2group, 1, {3}},
+ {SECURITYSTORAGE, ASN_INTEGER, RWRITE, var_vacm_sec2group, 1, {4}},
+ {SECURITYSTATUS, ASN_INTEGER, RWRITE, var_vacm_sec2group, 1, {5}},
+ };
+
+ struct variable1 vacm_access[] = {
+ {ACCESSMATCH, ASN_INTEGER, RWRITE, var_vacm_access, 1, {4}},
+ {ACCESSREAD, ASN_OCTET_STR, RWRITE, var_vacm_access, 1, {5}},
+ {ACCESSWRITE, ASN_OCTET_STR, RWRITE, var_vacm_access, 1, {6}},
+ {ACCESSNOTIFY, ASN_OCTET_STR, RWRITE, var_vacm_access, 1, {7}},
+ {ACCESSSTORAGE, ASN_INTEGER, RWRITE, var_vacm_access, 1, {8}},
+ {ACCESSSTATUS, ASN_INTEGER, RWRITE, var_vacm_access, 1, {9}},
+ };
+
+ struct variable3 vacm_view[] = {
+ {VACMVIEWSPINLOCK, ASN_INTEGER, RWRITE, var_vacm_view, 1, {1}},
+ {VIEWMASK, ASN_OCTET_STR, RWRITE, var_vacm_view, 3, {2, 1, 3}},
+ {VIEWTYPE, ASN_INTEGER, RWRITE, var_vacm_view, 3, {2, 1, 4}},
+ {VIEWSTORAGE, ASN_INTEGER, RWRITE, var_vacm_view, 3, {2, 1, 5}},
+ {VIEWSTATUS, ASN_INTEGER, RWRITE, var_vacm_view, 3, {2, 1, 6}},
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid vacm_sec2group_oid[] = { OID_VACMGROUPENTRY };
+ oid vacm_access_oid[] = { OID_VACMACCESSENTRY };
+ oid vacm_view_oid[] = { OID_VACMMIBVIEWS };
+
+ /*
+ * we need to be called back later
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_vacm, NULL);
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("mibII/vacm:sec2group", vacm_sec2group, variable1,
+ vacm_sec2group_oid);
+ REGISTER_MIB("mibII/vacm:access", vacm_access, variable1,
+ vacm_access_oid);
+ REGISTER_MIB("mibII/vacm:view", vacm_view, variable3, vacm_view_oid);
+
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+ register_sysORTable(reg, 10,
+ "View-based Access Control Model for SNMP.");
+#endif
+
+}
+
+
+
+u_char *
+var_vacm_sec2group(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ struct vacm_groupEntry *gp;
+ oid *groupSubtree;
+ int groupSubtreeLen;
+ int secmodel;
+ char secname[VACMSTRINGLEN], *cp;
+
+ /*
+ * Set up write_method first, in case we return NULL before getting to
+ * the switch (vp->magic) below. In some of these cases, we still want
+ * to call the appropriate write_method, if only to have it return the
+ * appropriate error.
+ */
+
+ switch (vp->magic) {
+ case SECURITYGROUP:
+ *write_method = write_vacmGroupName;
+ break;
+ case SECURITYSTORAGE:
+ *write_method = write_vacmSecurityToGroupStorageType;
+ break;
+ case SECURITYSTATUS:
+ *write_method = write_vacmSecurityToGroupStatus;
+ break;
+ default:
+ *write_method = NULL;
+ }
+
+ if (memcmp(name, vp->name, sizeof(oid) * vp->namelen) != 0) {
+ memcpy(name, vp->name, sizeof(oid) * vp->namelen);
+ *length = vp->namelen;
+ }
+ if (exact) {
+ if (*length < 13)
+ return NULL;
+
+ secmodel = name[11];
+ groupSubtree = name + 13;
+ groupSubtreeLen = *length - 13;
+ if ( name[12] != groupSubtreeLen )
+ return 0; /* Either extra subids, or an incomplete string */
+ cp = secname;
+ while (groupSubtreeLen-- > 0) {
+ if (*groupSubtree > 255)
+ return 0; /* illegal value */
+ if (cp - secname > VACM_MAX_STRING)
+ return 0;
+ *cp++ = (char) *groupSubtree++;
+ }
+ *cp = 0;
+
+ gp = vacm_getGroupEntry(secmodel, secname);
+ } else {
+ secmodel = *length > 11 ? name[11] : 0;
+ groupSubtree = name + 12;
+ groupSubtreeLen = *length - 12;
+ cp = secname;
+ while (groupSubtreeLen-- > 0) {
+ if (*groupSubtree > 255)
+ return 0; /* illegal value */
+ if (cp - secname > VACM_MAX_STRING)
+ return 0;
+ *cp++ = (char) *groupSubtree++;
+ }
+ *cp = 0;
+ vacm_scanGroupInit();
+ while ((gp = vacm_scanGroupNext()) != NULL) {
+ if (gp->securityModel > secmodel ||
+ (gp->securityModel == secmodel
+ && strcmp(gp->securityName, secname) > 0))
+ break;
+ }
+ if (gp) {
+ name[11] = gp->securityModel;
+ *length = 12;
+ cp = gp->securityName;
+ while (*cp) {
+ name[(*length)++] = *cp++;
+ }
+ }
+ }
+
+ if (gp == NULL) {
+ return NULL;
+ }
+
+ *var_len = sizeof(long_return);
+ switch (vp->magic) {
+ case SECURITYMODEL:
+ long_return = gp->securityModel;
+ return (u_char *) & long_return;
+
+ case SECURITYNAME:
+ *var_len = gp->securityName[0];
+ return (u_char *) & gp->securityName[1];
+
+ case SECURITYGROUP:
+ *var_len = strlen(gp->groupName);
+ return (u_char *) gp->groupName;
+
+ case SECURITYSTORAGE:
+ long_return = gp->storageType;
+ return (u_char *) & long_return;
+
+ case SECURITYSTATUS:
+ long_return = gp->status;
+ return (u_char *) & long_return;
+
+ default:
+ break;
+ }
+ return NULL;
+}
+
+u_char *
+var_vacm_access(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ struct vacm_accessEntry *gp;
+ int secmodel, seclevel;
+ char groupName[VACMSTRINGLEN] = { 0 };
+ char contextPrefix[VACMSTRINGLEN] = { 0 };
+ oid *op;
+ unsigned long len, i = 0;
+ char *cp;
+ int cmp;
+
+ /*
+ * Set up write_method first, in case we return NULL before getting to
+ * the switch (vp->magic) below. In some of these cases, we still want
+ * to call the appropriate write_method, if only to have it return the
+ * appropriate error.
+ */
+
+ switch (vp->magic) {
+ case ACCESSMATCH:
+ *write_method = write_vacmAccessContextMatch;
+ break;
+ case ACCESSREAD:
+ *write_method = write_vacmAccessReadViewName;
+ break;
+ case ACCESSWRITE:
+ *write_method = write_vacmAccessWriteViewName;
+ break;
+ case ACCESSNOTIFY:
+ *write_method = write_vacmAccessNotifyViewName;
+ break;
+ case ACCESSSTORAGE:
+ *write_method = write_vacmAccessStorageType;
+ break;
+ case ACCESSSTATUS:
+ *write_method = write_vacmAccessStatus;
+ break;
+ default:
+ *write_method = NULL;
+ }
+
+ if (memcmp(name, vp->name, sizeof(oid) * vp->namelen) != 0) {
+ memcpy(name, vp->name, sizeof(oid) * vp->namelen);
+ *length = vp->namelen;
+ }
+
+ if (exact) {
+ if (*length < 15)
+ return NULL;
+
+ /*
+ * Extract the group name index from the requested OID ....
+ */
+ op = name + 11;
+ len = *op++;
+ if (len > VACM_MAX_STRING)
+ return 0;
+ cp = groupName;
+ while (len-- > 0) {
+ if (*op > 255)
+ return 0; /* illegal value */
+ *cp++ = (char) *op++;
+ }
+ *cp = 0;
+
+ /*
+ * ... followed by the context index ...
+ */
+ len = *op++;
+ if (len > VACM_MAX_STRING)
+ return 0;
+ cp = contextPrefix;
+ while (len-- > 0) {
+ if (*op > 255)
+ return 0; /* illegal value */
+ *cp++ = (char) *op++;
+ }
+ *cp = 0;
+
+ /*
+ * ... and the secModel and secLevel index values.
+ */
+ secmodel = *op++;
+ seclevel = *op++;
+ if (op != name + *length) {
+ return NULL;
+ }
+
+ gp = vacm_getAccessEntry(groupName, contextPrefix, secmodel,
+ seclevel);
+ if ( gp && gp->securityLevel != seclevel )
+ return NULL; /* This isn't strictly what was asked for */
+
+ } else {
+ secmodel = seclevel = 0;
+ groupName[0] = 0;
+ contextPrefix[0] = 0;
+ op = name + 11;
+ if (op >= name + *length) {
+ } else {
+ len = *op;
+ if (len > VACM_MAX_STRING)
+ return 0;
+ cp = groupName;
+ for (i = 0; i <= len; i++) {
+ if (*op > 255) {
+ return 0; /* illegal value */
+ }
+ *cp++ = (char) *op++;
+ }
+ *cp = 0;
+ }
+ if (op >= name + *length) {
+ } else {
+ len = *op;
+ if (len > VACM_MAX_STRING)
+ return 0;
+ cp = contextPrefix;
+ for (i = 0; i <= len; i++) {
+ if (*op > 255) {
+ return 0; /* illegal value */
+ }
+ *cp++ = (char) *op++;
+ }
+ *cp = 0;
+ }
+ if (op >= name + *length) {
+ } else {
+ secmodel = *op++;
+ }
+ if (op >= name + *length) {
+ } else {
+ seclevel = *op++;
+ }
+ vacm_scanAccessInit();
+ while ((gp = vacm_scanAccessNext()) != NULL) {
+ cmp = strcmp(gp->groupName, groupName);
+ if (cmp > 0)
+ break;
+ if (cmp < 0)
+ continue;
+ cmp = strcmp(gp->contextPrefix, contextPrefix);
+ if (cmp > 0)
+ break;
+ if (cmp < 0)
+ continue;
+ if (gp->securityModel > secmodel)
+ break;
+ if (gp->securityModel < secmodel)
+ continue;
+ if (gp->securityLevel > seclevel)
+ break;
+ }
+ if (gp) {
+ *length = 11;
+ cp = gp->groupName;
+ do {
+ name[(*length)++] = *cp++;
+ } while (*cp);
+ cp = gp->contextPrefix;
+ do {
+ name[(*length)++] = *cp++;
+ } while (*cp);
+ name[(*length)++] = gp->securityModel;
+ name[(*length)++] = gp->securityLevel;
+ }
+ }
+
+ if (!gp) {
+ return NULL;
+ }
+
+ *var_len = sizeof(long_return);
+ switch (vp->magic) {
+ case ACCESSMATCH:
+ long_return = gp->contextMatch;
+ return (u_char *) & long_return;
+
+ case ACCESSLEVEL:
+ long_return = gp->securityLevel;
+ return (u_char *) & long_return;
+
+ case ACCESSMODEL:
+ long_return = gp->securityModel;
+ return (u_char *) & long_return;
+
+ case ACCESSPREFIX:
+ *var_len = *gp->contextPrefix;
+ return (u_char *) & gp->contextPrefix[1];
+
+ case ACCESSREAD:
+ *var_len = strlen(gp->views[VACM_VIEW_READ]);
+ return (u_char *) gp->views[VACM_VIEW_READ];
+
+ case ACCESSWRITE:
+ *var_len = strlen(gp->views[VACM_VIEW_WRITE]);
+ return (u_char *) gp->views[VACM_VIEW_WRITE];
+
+ case ACCESSNOTIFY:
+ *var_len = strlen(gp->views[VACM_VIEW_NOTIFY]);
+ return (u_char *) gp->views[VACM_VIEW_NOTIFY];
+
+ case ACCESSSTORAGE:
+ long_return = gp->storageType;
+ return (u_char *) & long_return;
+
+ case ACCESSSTATUS:
+ long_return = gp->status;
+ return (u_char *) & long_return;
+ }
+ return NULL;
+}
+
+u_char *
+var_vacm_view(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ struct vacm_viewEntry *gp = NULL;
+ char viewName[VACMSTRINGLEN] = { 0 };
+ oid subtree[MAX_OID_LEN] = { 0 };
+ size_t subtreeLen = 0;
+ oid *op, *op1;
+ unsigned long len = 0, i = 0;
+ char *cp;
+ int cmp, cmp2;
+
+ /*
+ * Set up write_method first, in case we return NULL before getting to
+ * the switch (vp->magic) below. In some of these cases, we still want
+ * to call the appropriate write_method, if only to have it return the
+ * appropriate error.
+ */
+
+ switch (vp->magic) {
+ case VIEWMASK:
+ *write_method = write_vacmViewMask;
+ break;
+ case VIEWTYPE:
+ *write_method = write_vacmViewType;
+ break;
+ case VIEWSTORAGE:
+ *write_method = write_vacmViewStorageType;
+ break;
+ case VIEWSTATUS:
+ *write_method = write_vacmViewStatus;
+ break;
+ default:
+ *write_method = NULL;
+ }
+
+ *var_len = sizeof(long_return);
+ if (vp->magic != VACMVIEWSPINLOCK) {
+ if (memcmp(name, vp->name, sizeof(oid) * vp->namelen) != 0) {
+ memcpy(name, vp->name, sizeof(oid) * vp->namelen);
+ *length = vp->namelen;
+ }
+
+ if (exact) {
+ if (*length < 15)
+ return NULL;
+
+ /*
+ * Extract the view name index from the requested OID ....
+ */
+ op = name + 12;
+ len = *op++;
+ if (len > VACM_MAX_STRING)
+ return 0;
+ cp = viewName;
+ while (len-- > 0) {
+ if (*op > 255)
+ return 0;
+ *cp++ = (char) *op++;
+ }
+ *cp = 0;
+
+ /*
+ * ... followed by the view OID index.
+ */
+ subtree[0] = len = *op++;
+ subtreeLen = 1;
+ if (len > MAX_OID_LEN)
+ return 0;
+ if ( (op+len) != (name + *length) )
+ return NULL; /* Declared length doesn't match what we actually got */
+ op1 = &(subtree[1]);
+ while (len-- > 0) {
+ *op1++ = *op++;
+ subtreeLen++;
+ }
+
+ gp = vacm_getViewEntry(viewName, &subtree[1], subtreeLen-1,
+ VACM_MODE_IGNORE_MASK);
+ if (gp != NULL) {
+ if (gp->viewSubtreeLen != subtreeLen) {
+ gp = NULL;
+ }
+ }
+ } else {
+ viewName[0] = 0;
+ op = name + 12;
+ if (op >= name + *length) {
+ } else {
+ len = *op;
+ if (len > VACM_MAX_STRING)
+ return 0;
+ cp = viewName;
+ for (i = 0; i <= len && op < name + *length; i++) {
+ if (*op > 255) {
+ return 0;
+ }
+ *cp++ = (char) *op++;
+ }
+ *cp = 0;
+ }
+ if (op >= name + *length) {
+ } else {
+ len = *op++;
+ op1 = subtree;
+ *op1++ = len;
+ subtreeLen++;
+ for (i = 0; i <= len && op < name + *length; i++) {
+ *op1++ = *op++;
+ subtreeLen++;
+ }
+ }
+ vacm_scanViewInit();
+ while ((gp = vacm_scanViewNext()) != NULL) {
+ cmp = strcmp(gp->viewName, viewName);
+ cmp2 =
+ snmp_oid_compare(gp->viewSubtree, gp->viewSubtreeLen,
+ subtree, subtreeLen);
+ if (cmp == 0 && cmp2 > 0)
+ break;
+ if (cmp > 0)
+ break;
+ }
+ if (gp) {
+ *length = 12;
+ cp = gp->viewName;
+ do {
+ name[(*length)++] = *cp++;
+ } while (*cp);
+ op1 = gp->viewSubtree;
+ len = gp->viewSubtreeLen;
+ while (len-- > 0) {
+ name[(*length)++] = *op1++;
+ }
+ }
+ }
+
+ if (gp == NULL) {
+ return NULL;
+ }
+ } else {
+ if (header_generic(vp, name, length, exact, var_len, write_method)) {
+ return NULL;
+ }
+ } /*endif -- vp->magic != VACMVIEWSPINLOCK */
+
+ switch (vp->magic) {
+ case VACMVIEWSPINLOCK:
+ *write_method = write_vacmViewSpinLock;
+ long_return = vacmViewSpinLock;
+ return (u_char *) & long_return;
+
+ case VIEWNAME:
+ *var_len = gp->viewName[0];
+ return (u_char *) & gp->viewName[1];
+
+ case VIEWSUBTREE:
+ *var_len = gp->viewSubtreeLen * sizeof(oid);
+ return (u_char *) gp->viewSubtree;
+
+ case VIEWMASK:
+ *var_len = gp->viewMaskLen;
+ return (u_char *) gp->viewMask;
+
+ case VIEWTYPE:
+ long_return = gp->viewType;
+ return (u_char *) & long_return;
+
+ case VIEWSTORAGE:
+ long_return = gp->viewStorageType;
+ return (u_char *) & long_return;
+
+ case VIEWSTATUS:
+ long_return = gp->viewStatus;
+ return (u_char *) & long_return;
+ }
+ return NULL;
+}
+
+oid *
+sec2group_generate_OID(oid * prefix, size_t prefixLen,
+ struct vacm_groupEntry * geptr, size_t * length)
+{
+ oid *indexOid;
+ int i, securityNameLen;
+
+ securityNameLen = strlen(geptr->securityName);
+
+ *length = 2 + securityNameLen + prefixLen;
+ indexOid = (oid *) malloc(*length * sizeof(oid));
+ if (indexOid) {
+ memmove(indexOid, prefix, prefixLen * sizeof(oid));
+
+ indexOid[prefixLen] = geptr->securityModel;
+
+ indexOid[prefixLen + 1] = securityNameLen;
+ for (i = 0; i < securityNameLen; i++)
+ indexOid[prefixLen + 2 + i] = (oid) geptr->securityName[i];
+
+ }
+ return indexOid;
+
+}
+
+int
+sec2group_parse_oid(oid * oidIndex, size_t oidLen,
+ int *model, unsigned char **name, size_t * nameLen)
+{
+ int nameL;
+ int i;
+
+ /*
+ * first check the validity of the oid
+ */
+ if ((oidLen <= 0) || (!oidIndex)) {
+ return 1;
+ }
+ nameL = oidIndex[1]; /* the initial name length */
+ if ((int) oidLen != nameL + 2) {
+ return 1;
+ }
+
+ /*
+ * its valid, malloc the space and store the results
+ */
+ if (name == NULL) {
+ return 1;
+ }
+
+ *name = (unsigned char *) malloc(nameL + 1);
+ if (*name == NULL) {
+ return 1;
+ }
+
+ *model = oidIndex[0];
+ *nameLen = nameL;
+
+
+ for (i = 0; i < nameL; i++) {
+ if (oidIndex[i + 2] > 255) {
+ free(*name);
+ return 1;
+ }
+ name[0][i] = (unsigned char) oidIndex[i + 2];
+ }
+ name[0][nameL] = 0;
+
+ return 0;
+
+}
+
+struct vacm_groupEntry *
+sec2group_parse_groupEntry(oid * name, size_t name_len)
+{
+ struct vacm_groupEntry *geptr;
+
+ char *newName;
+ int model;
+ size_t nameLen;
+
+ /*
+ * get the name and engineID out of the incoming oid
+ */
+ if (sec2group_parse_oid
+ (&name[SEC2GROUP_MIB_LENGTH], name_len - SEC2GROUP_MIB_LENGTH,
+ &model, (u_char **) & newName, &nameLen))
+ return NULL;
+
+ /*
+ * Now see if a user exists with these index values
+ */
+ geptr = vacm_getGroupEntry(model, newName);
+ free(newName);
+
+ return geptr;
+
+} /* end vacm_parse_groupEntry() */
+
+int
+write_vacmGroupName(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static unsigned char string[VACMSTRINGLEN];
+ struct vacm_groupEntry *geptr;
+ static int resetOnFail;
+
+ if (action == RESERVE1) {
+ resetOnFail = 0;
+ if (var_val_type != ASN_OCTET_STR) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len < 1 || var_val_len > 32) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ } else if (action == RESERVE2) {
+ if ((geptr = sec2group_parse_groupEntry(name, name_len)) == NULL) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ resetOnFail = 1;
+ memcpy(string, geptr->groupName, VACMSTRINGLEN);
+ memcpy(geptr->groupName, var_val, var_val_len);
+ geptr->groupName[var_val_len] = 0;
+ if (geptr->status == RS_NOTREADY) {
+ geptr->status = RS_NOTINSERVICE;
+ }
+ }
+ } else if (action == FREE) {
+ /*
+ * Try to undo the SET here (abnormal usage of FREE clause)
+ */
+ if ((geptr = sec2group_parse_groupEntry(name, name_len)) != NULL &&
+ resetOnFail) {
+ memcpy(geptr->groupName, string, VACMSTRINGLEN);
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmSecurityToGroupStorageType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ /*
+ * variables we may use later
+ */
+ static long long_ret;
+ struct vacm_groupEntry *geptr;
+
+ if (var_val_type != ASN_INTEGER) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(long_ret)) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (action == COMMIT) {
+ /*
+ * don't allow creations here
+ */
+ if ((geptr = sec2group_parse_groupEntry(name, name_len)) == NULL) {
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ long_ret = *((long *) var_val);
+ if ((long_ret == ST_VOLATILE || long_ret == ST_NONVOLATILE) &&
+ (geptr->storageType == ST_VOLATILE ||
+ geptr->storageType == ST_NONVOLATILE)) {
+ geptr->storageType = long_ret;
+ } else if (long_ret == geptr->storageType) {
+ return SNMP_ERR_NOERROR;
+ } else {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+write_vacmSecurityToGroupStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static long long_ret;
+ int model;
+ char *newName;
+ size_t nameLen;
+ struct vacm_groupEntry *geptr;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long_ret)) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ long_ret = *((long *) var_val);
+ if (long_ret == RS_NOTREADY || long_ret < 1 || long_ret > 6) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+
+ /*
+ * See if we can parse the oid for model/name first.
+ */
+
+ if (sec2group_parse_oid(&name[SEC2GROUP_MIB_LENGTH],
+ name_len - SEC2GROUP_MIB_LENGTH,
+ &model, (u_char **) & newName, &nameLen)) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+
+ if (model < 1 || nameLen < 1 || nameLen > 32) {
+ free(newName);
+ return SNMP_ERR_NOCREATION;
+ }
+
+ /*
+ * Now see if a group already exists with these index values.
+ */
+ geptr = vacm_getGroupEntry(model, newName);
+
+ if (geptr != NULL) {
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+ free(newName);
+ long_ret = RS_NOTREADY;
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (long_ret == RS_DESTROY && geptr->storageType == ST_PERMANENT) {
+ free(newName);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ } else {
+ if (long_ret == RS_ACTIVE || long_ret == RS_NOTINSERVICE) {
+ free(newName);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+
+ /*
+ * Generate a new group entry.
+ */
+ if ((geptr =
+ vacm_createGroupEntry(model, newName)) == NULL) {
+ free(newName);
+ return SNMP_ERR_GENERR;
+ }
+
+ /*
+ * Set defaults.
+ */
+ geptr->storageType = ST_NONVOLATILE;
+ geptr->status = RS_NOTREADY;
+ }
+ }
+ free(newName);
+ } else if (action == ACTION) {
+ sec2group_parse_oid(&name[SEC2GROUP_MIB_LENGTH],
+ name_len - SEC2GROUP_MIB_LENGTH,
+ &model, (u_char **) & newName, &nameLen);
+
+ geptr = vacm_getGroupEntry(model, newName);
+
+ if (geptr != NULL) {
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_ACTIVE) {
+ /*
+ * Check that all the mandatory objects have been set by now,
+ * otherwise return inconsistentValue.
+ */
+ if (geptr->groupName[0] == 0) {
+ free(newName);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ geptr->status = RS_ACTIVE;
+ } else if (long_ret == RS_CREATEANDWAIT) {
+ if (geptr->groupName[0] != 0) {
+ geptr->status = RS_NOTINSERVICE;
+ }
+ } else if (long_ret == RS_NOTINSERVICE) {
+ if (geptr->status == RS_ACTIVE) {
+ geptr->status = RS_NOTINSERVICE;
+ } else if (geptr->status == RS_NOTREADY) {
+ free(newName);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ }
+ }
+ free(newName);
+ } else if (action == COMMIT) {
+ sec2group_parse_oid(&name[SEC2GROUP_MIB_LENGTH],
+ name_len - SEC2GROUP_MIB_LENGTH,
+ &model, (u_char **) & newName, &nameLen);
+
+ geptr = vacm_getGroupEntry(model, newName);
+
+ if (geptr != NULL) {
+ if (long_ret == RS_DESTROY) {
+ vacm_destroyGroupEntry(model, newName);
+ }
+ }
+ free(newName);
+ } else if (action == UNDO) {
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+ sec2group_parse_oid(&name[SEC2GROUP_MIB_LENGTH],
+ name_len - SEC2GROUP_MIB_LENGTH,
+ &model, (u_char **) & newName, &nameLen);
+
+ geptr = vacm_getGroupEntry(model, newName);
+
+ if (geptr != NULL) {
+ vacm_destroyGroupEntry(model, newName);
+ }
+ free(newName);
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+oid *
+access_generate_OID(oid * prefix, size_t prefixLen,
+ struct vacm_accessEntry * aptr, size_t * length)
+{
+ oid *indexOid;
+ int i, groupNameLen, contextPrefixLen;
+
+ groupNameLen = strlen(aptr->groupName);
+ contextPrefixLen = strlen(aptr->contextPrefix);
+
+ *length = 4 + groupNameLen + contextPrefixLen + prefixLen;
+ indexOid = (oid *) malloc(*length * sizeof(oid));
+ if (indexOid) {
+ memmove(indexOid, prefix, prefixLen * sizeof(oid));
+
+ indexOid[prefixLen] = groupNameLen;
+ for (i = 0; i < groupNameLen; i++)
+ indexOid[groupNameLen + 1 + i] = (oid) aptr->groupName[i];
+
+ indexOid[prefixLen + groupNameLen + 1] = contextPrefixLen;
+ for (i = 0; i < contextPrefixLen; i++)
+ indexOid[prefixLen + groupNameLen + 2 + i] =
+ (oid) aptr->contextPrefix[i];
+
+ indexOid[prefixLen + groupNameLen + contextPrefixLen + 3] =
+ aptr->securityModel;
+ indexOid[prefixLen + groupNameLen + contextPrefixLen + 4] =
+ aptr->securityLevel;
+
+ }
+ return indexOid;
+
+}
+
+int
+access_parse_oid(oid * oidIndex, size_t oidLen,
+ unsigned char **groupName, size_t * groupNameLen,
+ unsigned char **contextPrefix, size_t * contextPrefixLen,
+ int *model, int *level)
+{
+ int groupNameL, contextPrefixL;
+ int i;
+
+ /*
+ * first check the validity of the oid
+ */
+ if ((oidLen <= 0) || (!oidIndex)) {
+ return 1;
+ }
+ groupNameL = oidIndex[0];
+ contextPrefixL = oidIndex[groupNameL + 1]; /* the initial name length */
+ if ((int) oidLen != groupNameL + contextPrefixL + 4) {
+ return 1;
+ }
+
+ /*
+ * its valid, malloc the space and store the results
+ */
+ if (contextPrefix == NULL || groupName == NULL) {
+ return 1;
+ }
+
+ *groupName = (unsigned char *) malloc(groupNameL + 1);
+ if (*groupName == NULL) {
+ return 1;
+ }
+
+ *contextPrefix = (unsigned char *) malloc(contextPrefixL + 1);
+ if (*contextPrefix == NULL) {
+ free(*groupName);
+ return 1;
+ }
+
+ *contextPrefixLen = contextPrefixL;
+ *groupNameLen = groupNameL;
+
+ for (i = 0; i < groupNameL; i++) {
+ if (oidIndex[i + 1] > 255) {
+ free(*groupName);
+ free(*contextPrefix);
+ return 1;
+ }
+ groupName[0][i] = (unsigned char) oidIndex[i + 1];
+ }
+ groupName[0][groupNameL] = 0;
+
+
+ for (i = 0; i < contextPrefixL; i++) {
+ if (oidIndex[i + groupNameL + 2] > 255) {
+ free(*groupName);
+ free(*contextPrefix);
+ return 1;
+ }
+ contextPrefix[0][i] = (unsigned char) oidIndex[i + groupNameL + 2];
+ }
+ contextPrefix[0][contextPrefixL] = 0;
+
+ *model = oidIndex[groupNameL + contextPrefixL + 2];
+ *level = oidIndex[groupNameL + contextPrefixL + 3];
+
+ return 0;
+
+}
+
+struct vacm_accessEntry *
+access_parse_accessEntry(oid * name, size_t name_len)
+{
+ struct vacm_accessEntry *aptr;
+
+ char *newGroupName = NULL;
+ char *newContextPrefix = NULL;
+ int model, level;
+ size_t groupNameLen, contextPrefixLen;
+
+ /*
+ * get the name and engineID out of the incoming oid
+ */
+ if (access_parse_oid
+ (&name[ACCESS_MIB_LENGTH], name_len - ACCESS_MIB_LENGTH,
+ (u_char **) & newGroupName, &groupNameLen,
+ (u_char **) & newContextPrefix, &contextPrefixLen, &model,
+ &level))
+ return NULL;
+
+ /*
+ * Now see if a user exists with these index values
+ */
+ aptr =
+ vacm_getAccessEntry(newGroupName, newContextPrefix, model, level);
+ SNMP_FREE(newContextPrefix);
+ SNMP_FREE(newGroupName);
+
+ return aptr;
+
+} /* end vacm_parse_accessEntry() */
+
+int
+write_vacmAccessStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static long long_ret;
+ int model, level;
+ char *newGroupName, *newContextPrefix;
+ size_t groupNameLen, contextPrefixLen;
+ struct vacm_accessEntry *aptr = NULL;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long_ret)) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ long_ret = *((long *) var_val);
+ if (long_ret == RS_NOTREADY || long_ret < 1 || long_ret > 6) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+
+ /*
+ * See if we can parse the oid for model/name first.
+ */
+ if (access_parse_oid(&name[ACCESS_MIB_LENGTH],
+ name_len - ACCESS_MIB_LENGTH,
+ (u_char **) & newGroupName, &groupNameLen,
+ (u_char **) & newContextPrefix,
+ &contextPrefixLen, &model, &level)) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+
+ if (model < 0 || groupNameLen < 1 || groupNameLen > 32 ||
+ contextPrefixLen > 32) {
+ free(newGroupName);
+ free(newContextPrefix);
+ return SNMP_ERR_NOCREATION;
+ }
+
+ /*
+ * Now see if a group already exists with these index values.
+ */
+ aptr =
+ vacm_getAccessEntry(newGroupName, newContextPrefix, model,
+ level);
+
+ if (aptr != NULL) {
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+ free(newGroupName);
+ free(newContextPrefix);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (long_ret == RS_DESTROY && aptr->storageType == ST_PERMANENT) {
+ free(newGroupName);
+ free(newContextPrefix);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ } else {
+ if (long_ret == RS_ACTIVE || long_ret == RS_NOTINSERVICE) {
+ free(newGroupName);
+ free(newContextPrefix);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+ if ((aptr = vacm_createAccessEntry(newGroupName,
+ newContextPrefix,
+ model,
+ level)) == NULL) {
+ free(newGroupName);
+ free(newContextPrefix);
+ return SNMP_ERR_GENERR;
+ }
+
+ /*
+ * Set defaults.
+ */
+ aptr->contextMatch = 1; /* exact(1) is the DEFVAL */
+ aptr->storageType = ST_NONVOLATILE;
+ aptr->status = RS_NOTREADY;
+ }
+ }
+ free(newGroupName);
+ free(newContextPrefix);
+ } else if (action == ACTION) {
+ access_parse_oid(&name[ACCESS_MIB_LENGTH],
+ name_len - ACCESS_MIB_LENGTH,
+ (u_char **) & newGroupName, &groupNameLen,
+ (u_char **) & newContextPrefix, &contextPrefixLen,
+ &model, &level);
+ aptr =
+ vacm_getAccessEntry(newGroupName, newContextPrefix, model,
+ level);
+
+ if (aptr != NULL) {
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_ACTIVE) {
+ aptr->status = RS_ACTIVE;
+ } else if (long_ret == RS_CREATEANDWAIT) {
+ aptr->status = RS_NOTINSERVICE;
+ } else if (long_ret == RS_NOTINSERVICE) {
+ if (aptr->status == RS_ACTIVE) {
+ aptr->status = RS_NOTINSERVICE;
+ } else if (aptr->status == RS_NOTREADY) {
+ free(newGroupName);
+ free(newContextPrefix);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ }
+ }
+ free(newGroupName);
+ free(newContextPrefix);
+ } else if (action == COMMIT) {
+ access_parse_oid(&name[ACCESS_MIB_LENGTH],
+ name_len - ACCESS_MIB_LENGTH,
+ (u_char **) & newGroupName, &groupNameLen,
+ (u_char **) & newContextPrefix, &contextPrefixLen,
+ &model, &level);
+ aptr =
+ vacm_getAccessEntry(newGroupName, newContextPrefix, model,
+ level);
+
+ if (aptr) {
+ if (long_ret == RS_DESTROY) {
+ vacm_destroyAccessEntry(newGroupName, newContextPrefix,
+ model, level);
+ }
+ }
+ free(newGroupName);
+ free(newContextPrefix);
+ } else if (action == UNDO) {
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+ access_parse_oid(&name[ACCESS_MIB_LENGTH],
+ name_len - ACCESS_MIB_LENGTH,
+ (u_char **) & newGroupName, &groupNameLen,
+ (u_char **) & newContextPrefix,
+ &contextPrefixLen, &model, &level);
+ aptr =
+ vacm_getAccessEntry(newGroupName, newContextPrefix, model,
+ level);
+ if (aptr != NULL) {
+ vacm_destroyAccessEntry(newGroupName, newContextPrefix,
+ model, level);
+ }
+ }
+ free(newGroupName);
+ free(newContextPrefix);
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmAccessStorageType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ /*
+ * variables we may use later
+ */
+ static long long_ret;
+ struct vacm_accessEntry *aptr;
+
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("mibII/vacm_vars",
+ "write to vacmSecurityToGroupStorageType not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(long_ret)) {
+ DEBUGMSGTL(("mibII/vacm_vars",
+ "write to vacmSecurityToGroupStorageType: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (action == COMMIT) {
+ /*
+ * don't allow creations here
+ */
+ if ((aptr = access_parse_accessEntry(name, name_len)) == NULL) {
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ long_ret = *((long *) var_val);
+ /*
+ * if ((long_ret == ST_VOLATILE || long_ret == ST_NONVOLATILE) &&
+ * (aptr->storageType == ST_VOLATILE ||
+ * aptr->storageType == ST_NONVOLATILE))
+ */
+ /*
+ * This version only supports volatile storage
+ */
+ if (long_ret == aptr->storageType) {
+ return SNMP_ERR_NOERROR;
+ } else {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmAccessContextMatch(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ /*
+ * variables we may use later
+ */
+ static long long_ret;
+ struct vacm_accessEntry *aptr;
+
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("mibII/vacm_vars",
+ "write to vacmAccessContextMatch not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(long_ret)) {
+ DEBUGMSGTL(("mibII/vacm_vars",
+ "write to vacmAccessContextMatch: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (action == COMMIT) {
+ /*
+ * don't allow creations here
+ */
+ if ((aptr = access_parse_accessEntry(name, name_len)) == NULL) {
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ long_ret = *((long *) var_val);
+ if (long_ret == CM_EXACT || long_ret == CM_PREFIX) {
+ aptr->contextMatch = long_ret;
+ } else {
+ return SNMP_ERR_WRONGVALUE;
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmAccessReadViewName(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static unsigned char string[VACMSTRINGLEN];
+ struct vacm_accessEntry *aptr = NULL;
+ static int resetOnFail;
+
+ if (action == RESERVE1) {
+ resetOnFail = 0;
+ if (var_val_type != ASN_OCTET_STR) {
+ DEBUGMSGTL(("mibII/vacm_vars",
+ "write to vacmAccessReadViewName not ASN_OCTET_STR\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > 32) {
+ DEBUGMSGTL(("mibII/vacm_vars",
+ "write to vacmAccessReadViewName: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ } else if (action == RESERVE2) {
+ if ((aptr = access_parse_accessEntry(name, name_len)) == NULL) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ resetOnFail = 1;
+ memcpy(string, aptr->views[VACM_VIEW_READ], VACMSTRINGLEN);
+ memcpy(aptr->views[VACM_VIEW_READ], var_val, var_val_len);
+ aptr->views[VACM_VIEW_READ][var_val_len] = 0;
+ }
+ } else if (action == FREE) {
+ /*
+ * Try to undo the SET here (abnormal usage of FREE clause)
+ */
+ if ((aptr = access_parse_accessEntry(name, name_len)) != NULL &&
+ resetOnFail) {
+ memcpy(aptr->views[VACM_VIEW_READ], string, var_val_len);
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmAccessWriteViewName(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static unsigned char string[VACMSTRINGLEN];
+ struct vacm_accessEntry *aptr = NULL;
+ static int resetOnFail;
+
+ if (action == RESERVE1) {
+ resetOnFail = 0;
+ if (var_val_type != ASN_OCTET_STR) {
+ DEBUGMSGTL(("mibII/vacm_vars",
+ "write to vacmAccessWriteViewName not ASN_OCTET_STR\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > 32) {
+ DEBUGMSGTL(("mibII/vacm_vars",
+ "write to vacmAccessWriteViewName: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ } else if (action == RESERVE2) {
+ if ((aptr = access_parse_accessEntry(name, name_len)) == NULL) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ resetOnFail = 1;
+ memcpy(string, aptr->views[VACM_VIEW_WRITE], VACMSTRINGLEN);
+ memcpy(aptr->views[VACM_VIEW_WRITE], var_val, var_val_len);
+ aptr->views[VACM_VIEW_WRITE][var_val_len] = 0;
+ }
+ } else if (action == FREE) {
+ /*
+ * Try to undo the SET here (abnormal usage of FREE clause)
+ */
+ if ((aptr = access_parse_accessEntry(name, name_len)) != NULL &&
+ resetOnFail) {
+ memcpy(aptr->views[VACM_VIEW_WRITE], string, var_val_len);
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmAccessNotifyViewName(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static unsigned char string[VACMSTRINGLEN];
+ struct vacm_accessEntry *aptr = NULL;
+ static int resetOnFail;
+
+ if (action == RESERVE1) {
+ resetOnFail = 0;
+ if (var_val_type != ASN_OCTET_STR) {
+ DEBUGMSGTL(("mibII/vacm_vars",
+ "write to vacmAccessNotifyViewName not ASN_OCTET_STR\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > 32) {
+ DEBUGMSGTL(("mibII/vacm_vars",
+ "write to vacmAccessNotifyViewName: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ } else if (action == RESERVE2) {
+ if ((aptr = access_parse_accessEntry(name, name_len)) == NULL) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ resetOnFail = 1;
+ memcpy(string, aptr->views[VACM_VIEW_NOTIFY], VACMSTRINGLEN);
+ memcpy(aptr->views[VACM_VIEW_NOTIFY], var_val, var_val_len);
+ aptr->views[VACM_VIEW_NOTIFY][var_val_len] = 0;
+ }
+ } else if (action == FREE) {
+ /*
+ * Try to undo the SET here (abnormal usage of FREE clause)
+ */
+ if ((aptr = access_parse_accessEntry(name, name_len)) != NULL &&
+ resetOnFail) {
+ memcpy(aptr->views[VACM_VIEW_NOTIFY], string, var_val_len);
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+view_parse_oid(oid * oidIndex, size_t oidLen,
+ unsigned char **viewName, size_t * viewNameLen,
+ oid ** subtree, size_t * subtreeLen)
+{
+ int viewNameL, subtreeL, i;
+
+ /*
+ * first check the validity of the oid
+ */
+ if ((oidLen <= 0) || (!oidIndex)) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+ viewNameL = oidIndex[0];
+ subtreeL = oidLen - viewNameL - 1; /* the initial name length */
+
+ /*
+ * its valid, malloc the space and store the results
+ */
+ if (viewName == NULL || subtree == NULL) {
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+
+ if (subtreeL < 0) {
+ return SNMP_ERR_NOCREATION;
+ }
+
+ *viewName = (unsigned char *) malloc(viewNameL + 1);
+
+ if (*viewName == NULL) {
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+
+ *subtree = (oid *) malloc(subtreeL * sizeof(oid));
+ if (*subtree == NULL) {
+ free(*viewName);
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+
+ *subtreeLen = subtreeL;
+ *viewNameLen = viewNameL;
+
+ for (i = 0; i < viewNameL; i++) {
+ if (oidIndex[i + 1] > 255) {
+ free(*viewName);
+ free(*subtree);
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+ viewName[0][i] = (unsigned char) oidIndex[i + 1];
+ }
+ viewName[0][viewNameL] = 0;
+
+ for (i = 0; i < subtreeL; i++) {
+ if (oidIndex[i + viewNameL + 1] > 255) {
+ free(*viewName);
+ free(*subtree);
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+ subtree[0][i] = (oid) oidIndex[i + viewNameL + 1];
+ }
+
+ return 0;
+}
+
+oid *
+view_generate_OID(oid * prefix, size_t prefixLen,
+ struct vacm_viewEntry * vptr, size_t * length)
+{
+ oid *indexOid;
+ int i, viewNameLen, viewSubtreeLen;
+
+ viewNameLen = strlen(vptr->viewName);
+ viewSubtreeLen = vptr->viewSubtreeLen;
+
+ *length = 2 + viewNameLen + viewSubtreeLen + prefixLen;
+ indexOid = (oid *) malloc(*length * sizeof(oid));
+ if (indexOid) {
+ memmove(indexOid, prefix, prefixLen * sizeof(oid));
+
+ indexOid[prefixLen] = viewNameLen;
+ for (i = 0; i < viewNameLen; i++)
+ indexOid[viewNameLen + 1 + i] = (oid) vptr->viewName[i];
+
+ indexOid[prefixLen + viewNameLen + 1] = viewSubtreeLen;
+ for (i = 0; i < viewSubtreeLen; i++)
+ indexOid[prefixLen + viewNameLen + 2 + i] =
+ (oid) vptr->viewSubtree[i];
+
+ }
+ return indexOid;
+
+}
+
+struct vacm_viewEntry *
+view_parse_viewEntry(oid * name, size_t name_len)
+{
+ struct vacm_viewEntry *vptr;
+
+ char *newViewName;
+ oid *newViewSubtree;
+ size_t viewNameLen, viewSubtreeLen;
+
+ if (view_parse_oid(&name[VIEW_MIB_LENGTH], name_len - VIEW_MIB_LENGTH,
+ (u_char **) & newViewName, &viewNameLen,
+ (oid **) & newViewSubtree, &viewSubtreeLen))
+ return NULL;
+
+ vptr =
+ vacm_getViewEntry(newViewName, &newViewSubtree[1], viewSubtreeLen-1,
+ VACM_MODE_IGNORE_MASK);
+ free(newViewName);
+ free(newViewSubtree);
+
+ return vptr;
+
+} /* end vacm_parse_viewEntry() */
+
+int
+write_vacmViewStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static long long_ret;
+ char *newViewName;
+ oid *newViewSubtree;
+ size_t viewNameLen, viewSubtreeLen;
+ struct vacm_viewEntry *vptr;
+ int rc = 0;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long_ret)) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ long_ret = *((long *) var_val);
+ if (long_ret == RS_NOTREADY || long_ret < 1 || long_ret > 6) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+
+ /*
+ * See if we can parse the oid for model/name first.
+ */
+ if ((rc =
+ view_parse_oid(&name[VIEW_MIB_LENGTH],
+ name_len - VIEW_MIB_LENGTH,
+ (u_char **) & newViewName, &viewNameLen,
+ (oid **) & newViewSubtree, &viewSubtreeLen))) {
+ return rc;
+ }
+
+ if (viewNameLen < 1 || viewNameLen > 32) {
+ free(newViewName);
+ free(newViewSubtree);
+ return SNMP_ERR_NOCREATION;
+ }
+
+ /*
+ * Now see if a group already exists with these index values.
+ */
+ vptr =
+ vacm_getViewEntry(newViewName, &newViewSubtree[1], viewSubtreeLen-1,
+ VACM_MODE_IGNORE_MASK);
+ if (vptr &&
+ netsnmp_oid_equals(vptr->viewSubtree + 1, vptr->viewSubtreeLen - 1,
+ newViewSubtree + 1, viewSubtreeLen - 1) != 0) {
+ vptr = NULL;
+ }
+ if (vptr != NULL) {
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+ free(newViewName);
+ free(newViewSubtree);
+ long_ret = RS_NOTREADY;
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (long_ret == RS_DESTROY && vptr->viewStorageType == ST_PERMANENT) {
+ free(newViewName);
+ free(newViewSubtree);
+ return SNMP_ERR_WRONGVALUE;
+ }
+ } else {
+ if (long_ret == RS_ACTIVE || long_ret == RS_NOTINSERVICE) {
+ free(newViewName);
+ free(newViewSubtree);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+
+ /*
+ * Generate a new group entry.
+ */
+ if ((vptr =
+ vacm_createViewEntry(newViewName, &newViewSubtree[1],
+ viewSubtreeLen - 1)) == NULL) {
+ free(newViewName);
+ free(newViewSubtree);
+ return SNMP_ERR_GENERR;
+ }
+
+ /*
+ * Set defaults.
+ */
+ vptr->viewStorageType = ST_NONVOLATILE;
+ vptr->viewStatus = RS_NOTREADY;
+ vptr->viewType = SNMP_VIEW_INCLUDED;
+ }
+ }
+ free(newViewName);
+ free(newViewSubtree);
+ } else if (action == ACTION) {
+ view_parse_oid(&name[VIEW_MIB_LENGTH], name_len - VIEW_MIB_LENGTH,
+ (u_char **) & newViewName, &viewNameLen,
+ (oid **) & newViewSubtree, &viewSubtreeLen);
+
+ vptr =
+ vacm_getViewEntry(newViewName, &newViewSubtree[1], viewSubtreeLen-1,
+ VACM_MODE_IGNORE_MASK);
+
+ if (vptr != NULL) {
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_ACTIVE) {
+ vptr->viewStatus = RS_ACTIVE;
+ } else if (long_ret == RS_CREATEANDWAIT) {
+ vptr->viewStatus = RS_NOTINSERVICE;
+ } else if (long_ret == RS_NOTINSERVICE) {
+ if (vptr->viewStatus == RS_ACTIVE) {
+ vptr->viewStatus = RS_NOTINSERVICE;
+ } else if (vptr->viewStatus == RS_NOTREADY) {
+ free(newViewName);
+ free(newViewSubtree);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ }
+ }
+ free(newViewName);
+ free(newViewSubtree);
+ } else if (action == COMMIT) {
+ view_parse_oid(&name[VIEW_MIB_LENGTH], name_len - VIEW_MIB_LENGTH,
+ (u_char **) & newViewName, &viewNameLen,
+ (oid **) & newViewSubtree, &viewSubtreeLen);
+
+ vptr =
+ vacm_getViewEntry(newViewName, &newViewSubtree[1], viewSubtreeLen-1,
+ VACM_MODE_IGNORE_MASK);
+
+ if (vptr != NULL) {
+ if (long_ret == RS_DESTROY) {
+ vacm_destroyViewEntry(newViewName, newViewSubtree,
+ viewSubtreeLen);
+ }
+ }
+ free(newViewName);
+ free(newViewSubtree);
+ } else if (action == UNDO) {
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+ view_parse_oid(&name[VIEW_MIB_LENGTH],
+ name_len - VIEW_MIB_LENGTH,
+ (u_char **) & newViewName, &viewNameLen,
+ (oid **) & newViewSubtree, &viewSubtreeLen);
+
+ vptr = vacm_getViewEntry(newViewName, &newViewSubtree[1],
+ viewSubtreeLen-1, VACM_MODE_IGNORE_MASK);
+
+ if (vptr != NULL) {
+ vacm_destroyViewEntry(newViewName, newViewSubtree,
+ viewSubtreeLen);
+ }
+ free(newViewName);
+ free(newViewSubtree);
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmViewStorageType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ long newValue = *((long *) var_val);
+ static long oldValue;
+ struct vacm_viewEntry *vptr = NULL;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long)) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ } else if (action == RESERVE2) {
+ if ((vptr = view_parse_viewEntry(name, name_len)) == NULL) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ if ((newValue == ST_VOLATILE || newValue == ST_NONVOLATILE) &&
+ (vptr->viewStorageType == ST_VOLATILE ||
+ vptr->viewStorageType == ST_NONVOLATILE)) {
+ oldValue = vptr->viewStorageType;
+ vptr->viewStorageType = newValue;
+ } else if (newValue == vptr->viewStorageType) {
+ return SNMP_ERR_NOERROR;
+ } else {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ }
+ } else if (action == UNDO) {
+ if ((vptr = view_parse_viewEntry(name, name_len)) != NULL) {
+ vptr->viewStorageType = oldValue;
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmViewMask(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static unsigned char string[VACMSTRINGLEN];
+ static long length;
+ struct vacm_viewEntry *vptr = NULL;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_OCTET_STR) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > 16) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ } else if (action == RESERVE2) {
+ if ((vptr = view_parse_viewEntry(name, name_len)) == NULL) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ memcpy(string, vptr->viewMask, vptr->viewMaskLen);
+ length = vptr->viewMaskLen;
+ memcpy(vptr->viewMask, var_val, var_val_len);
+ vptr->viewMaskLen = var_val_len;
+ }
+ } else if (action == FREE) {
+ if ((vptr = view_parse_viewEntry(name, name_len)) != NULL) {
+ memcpy(vptr->viewMask, string, length);
+ vptr->viewMaskLen = length;
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmViewType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ long newValue = *((long *) var_val);
+ static long oldValue;
+ struct vacm_viewEntry *vptr = NULL;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long)) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (newValue < 1 || newValue > 2) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+ } else if (action == RESERVE2) {
+ if ((vptr = view_parse_viewEntry(name, name_len)) == NULL) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ oldValue = vptr->viewType;
+ vptr->viewType = newValue;
+ }
+ } else if (action == UNDO) {
+ if ((vptr = view_parse_viewEntry(name, name_len)) != NULL) {
+ vptr->viewType = oldValue;
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_vacmViewSpinLock(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static long long_ret;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("mibII/vacm_vars",
+ "write to vacmViewSpinLock not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long_ret)) {
+ DEBUGMSGTL(("mibII/vacm_vars",
+ "write to vacmViewSpinLock: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ long_ret = *((long *) var_val);
+ if (long_ret != (long) vacmViewSpinLock) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else if (action == COMMIT) {
+ if (vacmViewSpinLock == 2147483647) {
+ vacmViewSpinLock = 0;
+ } else {
+ vacmViewSpinLock++;
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_vars.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_vars.h
new file mode 100644
index 0000000000..809315748c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/vacm_vars.h
@@ -0,0 +1,94 @@
+/*
+ * SNMPv3 View-based Access Control Model
+ */
+
+#ifndef _MIBGROUP_VACM_H
+#define _MIBGROUP_VACM_H
+
+#include <net-snmp/library/vacm.h>
+
+config_require(util_funcs)
+config_require(mibII/vacm_context)
+config_require(mibII/vacm_conf)
+config_add_mib(SNMP-VIEW-BASED-ACM-MIB)
+config_add_mib(SNMP-COMMUNITY-MIB)
+
+ void init_vacm_vars(void);
+
+ extern FindVarMethod var_vacm_sec2group;
+ extern FindVarMethod var_vacm_access;
+ extern FindVarMethod var_vacm_view;
+
+ WriteMethod write_vacmGroupName;
+ WriteMethod write_vacmSecurityToGroupStatus;
+ WriteMethod write_vacmSecurityToGroupStorageType;
+
+ WriteMethod write_vacmAccessContextMatch;
+ WriteMethod write_vacmAccessNotifyViewName;
+ WriteMethod write_vacmAccessReadViewName;
+ WriteMethod write_vacmAccessWriteViewName;
+ WriteMethod write_vacmAccessStatus;
+ WriteMethod write_vacmAccessStorageType;
+
+ WriteMethod write_vacmViewSpinLock;
+ WriteMethod write_vacmViewMask;
+ WriteMethod write_vacmViewStatus;
+ WriteMethod write_vacmViewStorageType;
+ WriteMethod write_vacmViewType;
+
+
+ oid *access_generate_OID(oid * prefix, size_t prefixLen,
+ struct vacm_accessEntry *aptr,
+ size_t * length);
+ struct vacm_accessEntry *access_parse_accessEntry(oid * name,
+ size_t name_len);
+ int access_parse_oid(oid * oidIndex, size_t oidLen,
+ unsigned char **groupName,
+ size_t * groupNameLen,
+ unsigned char **contextPrefix,
+ size_t * contextPrefixLen,
+ int *model, int *level);
+
+ oid *sec2group_generate_OID(oid * prefix, size_t prefixLen,
+ struct vacm_groupEntry *geptr,
+ size_t * length);
+ int sec2group_parse_oid(oid * oidIndex, size_t oidLen,
+ int *model, unsigned char **name,
+ size_t * nameLen);
+ struct vacm_groupEntry *sec2group_parse_groupEntry(oid * name,
+ size_t name_len);
+
+ oid *view_generate_OID(oid * prefix, size_t prefixLen,
+ struct vacm_viewEntry *vptr,
+ size_t * length);
+ int view_parse_oid(oid * oidIndex, size_t oidLen,
+ unsigned char **viewName,
+ size_t * viewNameLen, oid ** subtree,
+ size_t * subtreeLen);
+ struct vacm_viewEntry *view_parse_viewEntry(oid * name,
+ size_t name_len);
+
+
+
+#define OID_SNMPVACMMIB SNMP_OID_SNMPMODULES, 16
+#define OID_VACMMIBOBJECTS OID_SNMPVACMMIB, 1
+
+#define OID_VACMCONTEXTTABLE OID_VACMMIBOBJECTS, 1
+#define OID_VACMCONTEXTENTRY OID_VACMCONTEXTTABLE, 1
+
+#define OID_VACMGROUPTABLE OID_VACMMIBOBJECTS, 2
+#define OID_VACMGROUPENTRY OID_VACMGROUPTABLE, 1
+
+#define OID_VACMACCESSTABLE OID_VACMMIBOBJECTS, 4
+#define OID_VACMACCESSENTRY OID_VACMACCESSTABLE, 1
+
+#define OID_VACMMIBVIEWS OID_VACMMIBOBJECTS, 5
+#define OID_VACMVIEWTABLE OID_VACMMIBVIEWS, 2
+#define OID_VACMVIEWENTRY OID_VACMVIEWTABLE, 1
+#define SEC2GROUP_MIB_LENGTH 11
+#define ACCESS_MIB_LENGTH 11
+#define VIEW_MIB_LENGTH 12
+#define CM_EXACT 1
+#define CM_PREFIX 2
+
+#endif /* _MIBGROUP_VACM_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/var_route.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/var_route.c
new file mode 100644
index 0000000000..eac70acde5
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/var_route.c
@@ -0,0 +1,2101 @@
+/*
+ * snmp_var_route.c - return a pointer to the named variable.
+ *
+ *
+ */
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/***********************************************************
+ Copyright 1988, 1989 by Carnegie Mellon University
+ Copyright 1989 TGV, Incorporated
+
+ All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of CMU and TGV not be used
+in advertising or publicity pertaining to distribution of the software
+without specific, written prior permission.
+
+CMU AND TGV DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL CMU OR TGV BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+******************************************************************/
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+/*
+ * additions, fixes and enhancements for Linux by Erik Schoenfelder
+ * (schoenfr@ibr.cs.tu-bs.de) 1994/1995.
+ * Linux additions taken from CMU to UCD stack by Jennifer Bray of Origin
+ * (jbray@origin-at.co.uk) 1997
+ * Support for system({CTL_NET,PF_ROUTE,...) by Simon Leinen
+ * (simon@switch.ch) 1997
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include "route_headers.h"
+#define CACHE_TIME (120) /* Seconds */
+
+#if !defined(NETSNMP_CAN_USE_SYSCTL)
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+#include <net-snmp/data_access/interface.h>
+
+#include "ip.h"
+#include "kernel.h"
+#include "interfaces.h"
+#include "struct.h"
+#include "util_funcs.h"
+
+#ifndef MIN
+#define MIN(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+
+#ifdef hpux11
+#include <sys/mib.h>
+#include <netinet/mib_kern.h>
+#endif /* hpux */
+
+extern WriteMethod write_rte;
+
+#if !defined (WIN32) && !defined (cygwin)
+
+#ifdef USE_SYSCTL_ROUTE_DUMP
+
+static void Route_Scan_Reload(void);
+
+static unsigned char *all_routes = 0;
+static unsigned char *all_routes_end;
+static size_t all_routes_size;
+
+extern const struct sockaddr *get_address(const void *, int, int);
+extern const struct in_addr *get_in_address(const void *, int, int);
+
+/*
+ * var_ipRouteEntry(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method out - pointer to function to set variable, otherwise 0
+ */
+u_char *
+var_ipRouteEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * object identifier is of form:
+ * 1.3.6.1.2.1.4.21.1.1.A.B.C.D, where A.B.C.D is IP address.
+ * IPADDR starts at offset 10.
+ */
+ struct rt_msghdr *rtp, *saveRtp = 0;
+ register int Save_Valid, result;
+ static int saveNameLen = 0, saveExact = 0;
+ static oid saveName[MAX_OID_LEN], Current[MAX_OID_LEN];
+ u_char *cp;
+ u_char *ap;
+ oid *op;
+ static in_addr_t addr_ret;
+
+ *write_method = NULL; /* write_rte; XXX: SET support not really implemented */
+
+#if 0
+ /**
+ ** this optimisation fails, if there is only a single route avail.
+ ** it is a very special case, but better leave it out ...
+ **/
+#if 0
+ if (rtsize <= 1)
+ Save_Valid = 0;
+ else
+#endif /* 0 */
+ /*
+ * OPTIMIZATION:
+ *
+ * If the name was the same as the last name, with the possible
+ * exception of the [9]th token, then don't read the routing table
+ *
+ */
+
+ if ((saveNameLen == *length) && (saveExact == exact)) {
+ register int temp = name[9];
+ name[9] = 0;
+ Save_Valid =
+ (snmp_oid_compare(name, *length, saveName, saveNameLen) == 0);
+ name[9] = temp;
+ } else
+ Save_Valid = 0;
+
+ if (Save_Valid && saveRtp) {
+ register int temp = name[9]; /* Fix up 'lowest' found entry */
+ memcpy((char *) name, (char *) Current, 14 * sizeof(oid));
+ name[9] = temp;
+ *length = 14;
+ rtp = saveRtp;
+ } else {
+#endif /* 0 */
+ /*
+ * fill in object part of name for current (less sizeof instance part)
+ */
+
+ memcpy((char *) Current, (char *) vp->name,
+ (int) (vp->namelen) * sizeof(oid));
+
+#if 0
+ /*
+ * Only reload if this is the start of a wildcard
+ */
+ if (*length < 14) {
+ Route_Scan_Reload();
+ }
+#else
+ Route_Scan_Reload();
+#endif
+ for (ap = all_routes; ap < all_routes_end; ap += rtp->rtm_msglen) {
+ rtp = (struct rt_msghdr *) ap;
+ if (rtp->rtm_type == 0)
+ break;
+ if (rtp->rtm_version != RTM_VERSION) {
+ snmp_log(LOG_ERR,
+ "routing socket message version mismatch (%d instead of %d)\n",
+ rtp->rtm_version, RTM_VERSION);
+ break;
+ }
+ if (rtp->rtm_type != RTM_GET) {
+ snmp_log(LOG_ERR,
+ "routing socket returned message other than GET (%d)\n",
+ rtp->rtm_type);
+ continue;
+ }
+ if (!(rtp->rtm_addrs & RTA_DST))
+ continue;
+ cp = (u_char *) get_in_address((struct sockaddr *) (rtp + 1),
+ rtp->rtm_addrs, RTA_DST);
+ if (cp == NULL)
+ return NULL;
+
+ op = Current + 10;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+
+ result = snmp_oid_compare(name, *length, Current, 14);
+ if ((exact && (result == 0)) || (!exact && (result < 0)))
+ break;
+ }
+ if (ap >= all_routes_end || rtp->rtm_type == 0)
+ return 0;
+ /*
+ * Save in the 'cache'
+ */
+ memcpy((char *) saveName, (char *) name,
+ SNMP_MIN(*length, MAX_OID_LEN) * sizeof(oid));
+ saveName[9] = '\0';
+ saveNameLen = *length;
+ saveExact = exact;
+ saveRtp = rtp;
+ /*
+ * Return the name
+ */
+ memcpy((char *) name, (char *) Current, 14 * sizeof(oid));
+ *length = 14;
+#if 0
+ }
+#endif /* 0 */
+
+ *var_len = sizeof(long_return);
+
+ switch (vp->magic) {
+ case IPROUTEDEST:
+ *var_len = sizeof(addr_ret);
+ return (u_char *) get_in_address((struct sockaddr *) (rtp + 1),
+ rtp->rtm_addrs, RTA_DST);
+ case IPROUTEIFINDEX:
+ long_return = (u_long) rtp->rtm_index;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC1:
+ long_return = (rtp->rtm_flags & RTF_UP) ? 1 : 0;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC2:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = -1;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC3:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = -1;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC4:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = -1;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC5:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = -1;
+ return (u_char *) & long_return;
+ case IPROUTENEXTHOP:
+ *var_len = sizeof(addr_ret);
+ return (u_char *) get_in_address((struct sockaddr *) (rtp + 1),
+ rtp->rtm_addrs, RTA_GATEWAY);
+ case IPROUTETYPE:
+ if (rtp->rtm_flags & RTF_UP) {
+ if (rtp->rtm_flags & RTF_GATEWAY) {
+ long_return = 4; /* indirect(4) */
+ } else {
+ long_return = 3; /* direct(3) */
+ }
+ } else {
+ long_return = 2; /* invalid(2) */
+ }
+ return (u_char *) & long_return;
+ case IPROUTEPROTO:
+ long_return = (rtp->rtm_flags & RTF_DYNAMIC)
+ ? 10 : (rtp->rtm_flags & RTF_STATIC)
+ ? 2 : (rtp->rtm_flags & RTF_DYNAMIC) ? 4 : 1;
+ return (u_char *) & long_return;
+ case IPROUTEAGE:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = 0;
+ return (u_char *) & long_return;
+ case IPROUTEMASK:
+ *var_len = sizeof(addr_ret);
+ if (rtp->rtm_flags & RTF_HOST) {
+ addr_ret = 0x00000001;
+ return (u_char *) & addr_ret;
+ } else {
+ return (u_char *) get_in_address((struct sockaddr *) (rtp + 1),
+ rtp->rtm_addrs, RTA_NETMASK);
+ }
+ case IPROUTEINFO:
+ *var_len = nullOidLen;
+ return (u_char *) nullOid;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipRouteEntry\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+#else /* not USE_SYSCTL_ROUTE_DUMP */
+
+#ifdef hpux11
+static int rtsize = 0;
+static mib_ipRouteEnt *rt = (mib_ipRouteEnt *) 0;
+static void Route_Scan_Reload(void);
+#elif !defined(solaris2)
+static RTENTRY **rthead = 0;
+static int rtsize = 0, rtallocate = 0;
+
+static void Route_Scan_Reload(void);
+
+RTENTRY **netsnmp_get_routes(size_t *size) {
+ Route_Scan_Reload();
+ if (size)
+ *size = rtsize;
+ return rthead;
+}
+#endif /* hpux11 */
+
+#if !(defined(linux) || defined(solaris2) || defined(hpux11)) && defined(RTHOST_SYMBOL) && defined(RTNET_SYMBOL)
+#define NUM_ROUTE_SYMBOLS 2
+static char *route_symbols[] = {
+ RTHOST_SYMBOL,
+ RTNET_SYMBOL
+};
+#endif
+#endif
+
+#ifdef USE_SYSCTL_ROUTE_DUMP
+
+void
+init_var_route(void)
+{
+#ifdef solaris2
+ init_kernel_sunos5();
+#endif
+}
+
+static void
+Route_Scan_Reload(void)
+{
+ size_t size = 0;
+ int name[] = { CTL_NET, PF_ROUTE, 0, 0, NET_RT_DUMP, 0 };
+
+ if (sysctl(name, sizeof(name) / sizeof(int), 0, &size, 0, 0) == -1) {
+ snmp_log(LOG_ERR, "sysctl(CTL_NET,PF_ROUTE,0,0,NET_RT_DUMP,0)\n");
+ } else {
+ if (all_routes == 0 || all_routes_size < size) {
+ if (all_routes != 0) {
+ free(all_routes);
+ all_routes = 0;
+ }
+ if ((all_routes = malloc(size)) == 0) {
+ snmp_log(LOG_ERR,
+ "out of memory allocating route table\n");
+ }
+ all_routes_size = size;
+ } else {
+ size = all_routes_size;
+ }
+ if (sysctl(name, sizeof(name) / sizeof(int),
+ all_routes, &size, 0, 0) == -1) {
+ snmp_log(LOG_ERR,
+ "sysctl(CTL_NET,PF_ROUTE,0,0,NET_RT_DUMP,0)\n");
+ }
+ all_routes_end = all_routes + size;
+ }
+}
+
+#else /* not USE_SYSCTL_ROUTE_DUMP */
+
+void
+init_var_route(void)
+{
+#ifdef RTTABLES_SYMBOL
+ auto_nlist(RTTABLES_SYMBOL, 0, 0);
+#endif
+#ifdef RTHASHSIZE_SYMBOL
+ auto_nlist(RTHASHSIZE_SYMBOL, 0, 0);
+#endif
+#ifdef RTHOST_SYMBOL
+ auto_nlist(RTHOST_SYMBOL, 0, 0);
+#endif
+#ifdef RTNET_SYMBOL
+ auto_nlist(RTNET_SYMBOL, 0, 0);
+#endif
+}
+
+#ifndef solaris2
+
+#if NEED_KLGETSA
+static union {
+ struct sockaddr_in sin;
+ u_short data[128];
+} klgetsatmp;
+
+struct sockaddr_in *
+klgetsa(struct sockaddr_in *dst)
+{
+ if (!NETSNMP_KLOOKUP(dst, (char *) &klgetsatmp.sin, sizeof klgetsatmp.sin)) {
+ DEBUGMSGTL(("mibII/var_route", "klookup failed\n"));
+ return NULL;
+ }
+ if (klgetsatmp.sin.sin_len > sizeof(klgetsatmp.sin)) {
+ if (!NETSNMP_KLOOKUP(dst, (char *) &klgetsatmp.sin, klgetsatmp.sin.sin_len)) {
+ DEBUGMSGTL(("mibII/var_route", "klookup failed\n"));
+ return NULL;
+ }
+ }
+ return (&klgetsatmp.sin);
+}
+#endif
+
+u_char *
+var_ipRouteEntry(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * object identifier is of form:
+ * 1.3.6.1.2.1.4.21.1.1.A.B.C.D, where A.B.C.D is IP address.
+ * IPADDR starts at offset 10.
+ */
+ register int Save_Valid, result, RtIndex;
+ static int saveNameLen = 0, saveExact = 0, saveRtIndex = 0;
+ static oid saveName[MAX_OID_LEN], Current[MAX_OID_LEN];
+ u_char *cp;
+ oid *op;
+ static in_addr_t addr_ret;
+#if NEED_KLGETSA
+ struct sockaddr_in *sa;
+#endif
+#if !defined(linux) && !defined(hpux11)
+ struct ifnet rt_ifnet;
+ struct in_ifaddr rt_ifnetaddr;
+#endif
+
+ *write_method = NULL; /* write_rte; XXX: SET support not really implemented */
+
+ /**
+ ** this optimisation fails, if there is only a single route avail.
+ ** it is a very special case, but better leave it out ...
+ **/
+#if NETSNMP_NO_DUMMY_VALUES
+ saveNameLen = 0;
+#endif
+ if (rtsize <= 1)
+ Save_Valid = 0;
+ else
+ /*
+ * OPTIMIZATION:
+ *
+ * If the name was the same as the last name, with the possible
+ * exception of the [9]th token, then don't read the routing table
+ *
+ */
+
+ if ((saveNameLen == *length) && (saveExact == exact)) {
+ register int temp = name[9];
+ name[9] = 0;
+ Save_Valid =
+ (snmp_oid_compare(name, *length, saveName, saveNameLen) == 0);
+ name[9] = temp;
+ } else
+ Save_Valid = 0;
+
+ if (Save_Valid) {
+ register int temp = name[9]; /* Fix up 'lowest' found entry */
+ memcpy((char *) name, (char *) Current, 14 * sizeof(oid));
+ name[9] = temp;
+ *length = 14;
+ RtIndex = saveRtIndex;
+ } else {
+ /*
+ * fill in object part of name for current (less sizeof instance part)
+ */
+
+ memcpy((char *) Current, (char *) vp->name,
+ (int) (vp->namelen) * sizeof(oid));
+
+#if 0
+ /*
+ * Only reload if this is the start of a wildcard
+ */
+ if (*length < 14) {
+ Route_Scan_Reload();
+ }
+#else
+ Route_Scan_Reload();
+#endif
+ for (RtIndex = 0; RtIndex < rtsize; RtIndex++) {
+#if NEED_KLGETSA
+ sa = klgetsa((struct sockaddr_in *) rthead[RtIndex]->rt_dst);
+ cp = (u_char *) & (sa->sin_addr.s_addr);
+#elif defined(hpux11)
+ cp = (u_char *) & rt[RtIndex].Dest;
+#else
+ cp = (u_char *) &
+ (((struct sockaddr_in *) &(rthead[RtIndex]->rt_dst))->
+ sin_addr.s_addr);
+#endif
+ op = Current + 10;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+
+ result = snmp_oid_compare(name, *length, Current, 14);
+ if ((exact && (result == 0)) || (!exact && (result < 0)))
+ break;
+ }
+ if (RtIndex >= rtsize)
+ return (NULL);
+ /*
+ * Save in the 'cache'
+ */
+ memcpy((char *) saveName, (char *) name,
+ SNMP_MIN(*length, MAX_OID_LEN) * sizeof(oid));
+ saveName[9] = 0;
+ saveNameLen = *length;
+ saveExact = exact;
+ saveRtIndex = RtIndex;
+ /*
+ * Return the name
+ */
+ memcpy((char *) name, (char *) Current, 14 * sizeof(oid));
+ *length = 14;
+ }
+
+ *var_len = sizeof(long_return);
+
+ switch (vp->magic) {
+ case IPROUTEDEST:
+ *var_len = sizeof(addr_ret);
+#if NEED_KLGETSA
+ sa = klgetsa((struct sockaddr_in *) rthead[RtIndex]->rt_dst);
+ return (u_char *) & (sa->sin_addr.s_addr);
+#elif defined(hpux11)
+ addr_ret = rt[RtIndex].Dest;
+ return (u_char *) & addr_ret;
+#else
+ return (u_char *) & ((struct sockaddr_in *) &rthead[RtIndex]->
+ rt_dst)->sin_addr.s_addr;
+#endif
+ case IPROUTEIFINDEX:
+#ifdef hpux11
+ long_return = rt[RtIndex].IfIndex;
+#else
+ long_return = (u_long) rthead[RtIndex]->rt_unit;
+#endif
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC1:
+#ifdef hpux11
+ long_return = rt[RtIndex].Metric1;
+#else
+ long_return = (rthead[RtIndex]->rt_flags & RTF_GATEWAY) ? 1 : 0;
+#endif
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC2:
+#ifdef hpux11
+ long_return = rt[RtIndex].Metric2;
+ return (u_char *) & long_return;
+#elif defined(NETSNMP_NO_DUMMY_VALUES)
+ return NULL;
+#endif
+ long_return = -1;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC3:
+#ifdef hpux11
+ long_return = rt[RtIndex].Metric3;
+ return (u_char *) & long_return;
+#elif defined(NETSNMP_NO_DUMMY_VALUES)
+ return NULL;
+#endif
+ long_return = -1;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC4:
+#ifdef hpux11
+ long_return = rt[RtIndex].Metric4;
+ return (u_char *) & long_return;
+#elif defined(NETSNMP_NO_DUMMY_VALUES)
+ return NULL;
+#endif
+ long_return = -1;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC5:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = -1;
+ return (u_char *) & long_return;
+ case IPROUTENEXTHOP:
+ *var_len = sizeof(addr_ret);
+#if NEED_KLGETSA
+ sa = klgetsa((struct sockaddr_in *) rthead[RtIndex]->rt_gateway);
+ return (u_char *) & (sa->sin_addr.s_addr);
+#elif defined(hpux11)
+ addr_ret = rt[RtIndex].NextHop;
+ return (u_char *) & addr_ret;
+#else
+ return (u_char *) & ((struct sockaddr_in *) &rthead[RtIndex]->
+ rt_gateway)->sin_addr.s_addr;
+#endif /* *bsd */
+ case IPROUTETYPE:
+#ifdef hpux11
+ long_return = rt[RtIndex].Type;
+#else
+ if (rthead[RtIndex]->rt_flags & RTF_UP) {
+ if (rthead[RtIndex]->rt_flags & RTF_GATEWAY) {
+ long_return = 4; /* indirect(4) */
+ } else {
+ long_return = 3; /* direct(3) */
+ }
+ } else {
+ long_return = 2; /* invalid(2) */
+ }
+#endif
+ return (u_char *) & long_return;
+ case IPROUTEPROTO:
+#ifdef hpux11
+ long_return = rt[RtIndex].Proto;
+#else
+ long_return = (rthead[RtIndex]->rt_flags & RTF_DYNAMIC) ? 4 : 2;
+#endif
+ return (u_char *) & long_return;
+ case IPROUTEAGE:
+#ifdef hpux11
+ long_return = rt[RtIndex].Age;
+ return (u_char *) & long_return;
+#elif defined(NETSNMP_NO_DUMMY_VALUES)
+ return NULL;
+#endif
+ long_return = 0;
+ return (u_char *) & long_return;
+ case IPROUTEMASK:
+ *var_len = sizeof(addr_ret);
+#if NEED_KLGETSA
+ /*
+ * XXX - Almost certainly not right
+ * but I don't have a suitable system to test this on
+ */
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ addr_ret = 0;
+#elif defined(hpux11)
+ addr_ret = rt[RtIndex].Mask;
+ return (u_char *) & addr_ret;
+#else /* !NEED_KLGETSA && !hpux11 */
+ if (((struct sockaddr_in *) &rthead[RtIndex]->rt_dst)->sin_addr.
+ s_addr == 0)
+ addr_ret = 0; /* Default route */
+ else {
+#ifndef linux
+ if (!NETSNMP_KLOOKUP(rthead[RtIndex]->rt_ifp,
+ (char *) &rt_ifnet, sizeof(rt_ifnet))) {
+ DEBUGMSGTL(("mibII/var_route", "klookup failed\n"));
+ return NULL;
+ }
+ if (!NETSNMP_KLOOKUP(rt_ifnet.if_addrlist,
+ (char *) &rt_ifnetaddr, sizeof(rt_ifnetaddr))) {
+ DEBUGMSGTL(("mibII/var_route", "klookup failed\n"));
+ return NULL;
+ }
+
+ addr_ret = rt_ifnetaddr.ia_subnetmask;
+#else /* linux */
+ cp = (u_char *) &
+ (((struct sockaddr_in *) &(rthead[RtIndex]->rt_dst))->
+ sin_addr.s_addr);
+ return (u_char *) &
+ (((struct sockaddr_in *) &(rthead[RtIndex]->rt_genmask))->
+ sin_addr.s_addr);
+#endif /* linux */
+ }
+#endif /* NEED_KLGETSA */
+ return (u_char *) & addr_ret;
+ case IPROUTEINFO:
+ *var_len = nullOidLen;
+ return (u_char *) nullOid;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipRouteEntry\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+#else /* solaris2 */
+
+static int
+IP_Cmp_Route(void *addr, void *ep)
+{
+ mib2_ipRouteEntry_t *Ep = ep, *Addr = addr;
+
+ if ((Ep->ipRouteDest == Addr->ipRouteDest) &&
+ (Ep->ipRouteNextHop == Addr->ipRouteNextHop) &&
+ (Ep->ipRouteType == Addr->ipRouteType) &&
+ (Ep->ipRouteProto == Addr->ipRouteProto) &&
+ (Ep->ipRouteMask == Addr->ipRouteMask) &&
+ (Ep->ipRouteInfo.re_max_frag == Addr->ipRouteInfo.re_max_frag) &&
+ (Ep->ipRouteInfo.re_rtt == Addr->ipRouteInfo.re_rtt) &&
+ (Ep->ipRouteInfo.re_ref == Addr->ipRouteInfo.re_ref) &&
+ (Ep->ipRouteInfo.re_frag_flag == Addr->ipRouteInfo.re_frag_flag) &&
+ (Ep->ipRouteInfo.re_src_addr == Addr->ipRouteInfo.re_src_addr) &&
+ (Ep->ipRouteInfo.re_ire_type == Addr->ipRouteInfo.re_ire_type) &&
+ (Ep->ipRouteInfo.re_obpkt == Addr->ipRouteInfo.re_obpkt) &&
+ (Ep->ipRouteInfo.re_ibpkt == Addr->ipRouteInfo.re_ibpkt)
+ )
+ return (0);
+ else
+ return (1); /* Not found */
+}
+
+u_char *
+var_ipRouteEntry(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * object identifier is of form:
+ * 1.3.6.1.2.1.4.21.1.1.A.B.C.D, where A.B.C.D is IP address.
+ * IPADDR starts at offset 10.
+ */
+#define IP_ROUTENAME_LENGTH 14
+#define IP_ROUTEADDR_OFF 10
+ oid current[IP_ROUTENAME_LENGTH],
+ lowest[IP_ROUTENAME_LENGTH];
+ u_char *cp;
+ oid *op;
+ mib2_ipRouteEntry_t Lowentry, Nextentry, entry;
+ int Found = 0;
+ req_e req_type;
+ static in_addr_t addr_ret;
+
+ *write_method = NULL; /* write_rte; XXX: SET support not really implemented */
+
+ /*
+ * fill in object part of name for current (less sizeof instance part)
+ */
+
+ memcpy((char *) current, (char *) vp->name, vp->namelen * sizeof(oid));
+ if (*length == IP_ROUTENAME_LENGTH) /* Assume that the input name is the lowest */
+ memcpy((char *) lowest, (char *) name,
+ IP_ROUTENAME_LENGTH * sizeof(oid));
+ else {
+ name[IP_ROUTEADDR_OFF] = (oid) - 1; /* Grhhh: to prevent accidental comparison :-( */
+ lowest[0] = 0xff;
+ }
+ for (Nextentry.ipRouteDest = (u_long) - 2, req_type = GET_FIRST;;
+ Nextentry = entry, req_type = GET_NEXT) {
+ if (getMibstat(MIB_IP_ROUTE, &entry, sizeof(mib2_ipRouteEntry_t),
+ req_type, &IP_Cmp_Route, &Nextentry) != 0)
+ break;
+ COPY_IPADDR(cp, (u_char *) & entry.ipRouteDest, op,
+ current + IP_ROUTEADDR_OFF);
+ if (exact) {
+ if (snmp_oid_compare
+ (current, IP_ROUTENAME_LENGTH, name, *length) == 0) {
+ memcpy((char *) lowest, (char *) current,
+ IP_ROUTENAME_LENGTH * sizeof(oid));
+ Lowentry = entry;
+ Found++;
+ break; /* no need to search further */
+ }
+ } else {
+ if ((snmp_oid_compare
+ (current, IP_ROUTENAME_LENGTH, name, *length) > 0)
+ && ((Nextentry.ipRouteDest == (u_long) - 2)
+ ||
+ (snmp_oid_compare
+ (current, IP_ROUTENAME_LENGTH, lowest,
+ IP_ROUTENAME_LENGTH) < 0)
+ ||
+ (snmp_oid_compare
+ (name, IP_ROUTENAME_LENGTH, lowest,
+ IP_ROUTENAME_LENGTH) == 0))) {
+
+ /*
+ * if new one is greater than input and closer to input than
+ * * previous lowest, and is not equal to it, save this one as the "next" one.
+ */
+ memcpy((char *) lowest, (char *) current,
+ IP_ROUTENAME_LENGTH * sizeof(oid));
+ Lowentry = entry;
+ Found++;
+ }
+ }
+ }
+ if (Found == 0)
+ return (NULL);
+ memcpy((char *) name, (char *) lowest,
+ IP_ROUTENAME_LENGTH * sizeof(oid));
+ *length = IP_ROUTENAME_LENGTH;
+ *var_len = sizeof(long_return);
+
+ switch (vp->magic) {
+ case IPROUTEDEST:
+ *var_len = sizeof(addr_ret);
+ addr_ret = Lowentry.ipRouteDest;
+ return (u_char *) & addr_ret;
+ case IPROUTEIFINDEX:
+#ifdef NETSNMP_INCLUDE_IFTABLE_REWRITES
+ Lowentry.ipRouteIfIndex.o_bytes[Lowentry.ipRouteIfIndex.o_length] = '\0';
+ long_return =
+ netsnmp_access_interface_index_find(
+ Lowentry.ipRouteIfIndex.o_bytes);
+#else
+ long_return =
+ Interface_Index_By_Name(Lowentry.ipRouteIfIndex.o_bytes,
+ Lowentry.ipRouteIfIndex.o_length);
+#endif
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC1:
+ long_return = Lowentry.ipRouteMetric1;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC2:
+ long_return = Lowentry.ipRouteMetric2;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC3:
+ long_return = Lowentry.ipRouteMetric3;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC4:
+ long_return = Lowentry.ipRouteMetric4;
+ return (u_char *) & long_return;
+ case IPROUTENEXTHOP:
+ *var_len = sizeof(addr_ret);
+ addr_ret = Lowentry.ipRouteNextHop;
+ return (u_char *) & addr_ret;
+ case IPROUTETYPE:
+ long_return = Lowentry.ipRouteType;
+ return (u_char *) & long_return;
+ case IPROUTEPROTO:
+ long_return = Lowentry.ipRouteProto;
+ if (long_return == -1)
+ long_return = 1;
+ return (u_char *) & long_return;
+ case IPROUTEAGE:
+ long_return = Lowentry.ipRouteAge;
+ return (u_char *) & long_return;
+ case IPROUTEMASK:
+ *var_len = sizeof(addr_ret);
+ addr_ret = Lowentry.ipRouteMask;
+ return (u_char *) & addr_ret;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipRouteEntry\n",
+ vp->magic));
+ };
+ return NULL;
+}
+
+#endif /* solaris2 - var_IProute */
+
+#ifndef solaris2
+static int qsort_compare(const void *, const void *);
+#endif
+
+#if defined(RTENTRY_4_4) || defined(RTENTRY_RT_NEXT) || defined(hpux11)
+
+#if defined(RTENTRY_4_4) && !defined(hpux11)
+void
+load_rtentries(struct radix_node *pt)
+{
+ struct radix_node node;
+ RTENTRY rt;
+ struct ifnet ifnet;
+ char name[16], temp[16];
+#if !STRUCT_IFNET_HAS_IF_XNAME
+ register char *cp;
+#endif
+
+ if (!NETSNMP_KLOOKUP(pt, (char *) &node, sizeof(struct radix_node))) {
+ DEBUGMSGTL(("mibII/var_route", "klookup failed\n"));
+ return;
+ }
+ if (node.rn_b >= 0) {
+ load_rtentries(node.rn_r);
+ load_rtentries(node.rn_l);
+ } else {
+ if (node.rn_flags & RNF_ROOT) {
+ /*
+ * root node
+ */
+ if (node.rn_dupedkey)
+ load_rtentries(node.rn_dupedkey);
+ return;
+ }
+ /*
+ * get the route
+ */
+ if (!NETSNMP_KLOOKUP(pt, (char *) &rt, sizeof(RTENTRY))) {
+ DEBUGMSGTL(("mibII/var_route", "klookup failed\n"));
+ return;
+ }
+
+ if (rt.rt_ifp != 0) {
+ if (!NETSNMP_KLOOKUP(rt.rt_ifp, (char *) &ifnet, sizeof(ifnet))) {
+ DEBUGMSGTL(("mibII/var_route", "klookup failed\n"));
+ return;
+ }
+#if STRUCT_IFNET_HAS_IF_XNAME
+#if defined(netbsd1) || defined(openbsd2)
+ strncpy(name, ifnet.if_xname, sizeof name);
+#else
+ if (!NETSNMP_KLOOKUP(ifnet.if_xname, name, sizeof name)) {
+ DEBUGMSGTL(("mibII/var_route", "klookup failed\n"));
+ return;
+ }
+#endif
+ name[sizeof(name) - 1] = '\0';
+#else
+ if (!NETSNMP_KLOOKUP(ifnet.if_name, name, sizeof name)) {
+ DEBUGMSGTL(("mibII/var_route", "klookup failed\n"));
+ return;
+ }
+ name[sizeof(name) - 1] = '\0';
+ cp = (char *) strchr(name, '\0');
+ string_append_int(cp, ifnet.if_unit);
+#endif
+ Interface_Scan_Init();
+ rt.rt_unit = 0;
+ while (Interface_Scan_Next
+ ((short *) &(rt.rt_unit), temp, NULL, NULL) != 0) {
+ if (strcmp(name, temp) == 0)
+ break;
+ }
+ }
+#if CHECK_RT_FLAGS
+ if (((rt.rt_flags & RTF_CLONING) != RTF_CLONING)
+ && ((rt.rt_flags & RTF_LLINFO) != RTF_LLINFO)) {
+#endif
+ /*
+ * check for space and malloc
+ */
+ if (rtsize >= rtallocate) {
+ rthead =
+ (RTENTRY **) realloc((char *) rthead,
+ 2 * rtallocate *
+ sizeof(RTENTRY *));
+ memset((char *) &rthead[rtallocate], (0),
+ rtallocate * sizeof(RTENTRY *));
+
+ rtallocate *= 2;
+ }
+ if (!rthead[rtsize])
+ rthead[rtsize] = (RTENTRY *) malloc(sizeof(RTENTRY));
+ /*
+ * Add this to the database
+ */
+ memcpy((char *) rthead[rtsize], (char *) &rt, sizeof(RTENTRY));
+ rtsize++;
+#if CHECK_RT_FLAGS
+ }
+#endif
+
+ if (node.rn_dupedkey)
+ load_rtentries(node.rn_dupedkey);
+ }
+}
+#endif /* RTENTRY_4_4 && !hpux11 */
+
+static void
+Route_Scan_Reload(void)
+{
+#ifdef hpux11
+
+ int fd;
+ struct nmparms p;
+ int val;
+ unsigned int ulen;
+ int ret;
+
+ if (rt)
+ free(rt);
+ rt = (mib_ipRouteEnt *) 0;
+ rtsize = 0;
+
+ if ((fd = open_mib("/dev/ip", O_RDONLY, 0, NM_ASYNC_OFF)) >= 0) {
+ p.objid = ID_ipRouteNumEnt;
+ p.buffer = (void *) &val;
+ ulen = sizeof(int);
+ p.len = &ulen;
+ if ((ret = get_mib_info(fd, &p)) == 0)
+ rtsize = val;
+
+ if (rtsize > 0) {
+ ulen = (unsigned) rtsize *sizeof(mib_ipRouteEnt);
+ rt = (mib_ipRouteEnt *) malloc(ulen);
+ p.objid = ID_ipRouteTable;
+ p.buffer = (void *) rt;
+ p.len = &ulen;
+ if ((ret = get_mib_info(fd, &p)) < 0)
+ rtsize = 0;
+ }
+
+ close_mib(fd);
+ }
+
+ /*
+ * Sort it!
+ */
+ qsort((char *) rt, rtsize, sizeof(rt[0]),
+#ifdef __STDC__
+ (int (*)(const void *, const void *)) qsort_compare
+#else
+ qsort_compare
+#endif
+ );
+
+#else /* hpux11 */
+#if defined(RTENTRY_4_4)
+ struct radix_node_head head, *rt_table[AF_MAX + 1];
+ int i;
+#else
+ RTENTRY **routehash, mb;
+ register RTENTRY *m;
+ RTENTRY *rt;
+ struct ifnet ifnet;
+ int i, table;
+ register char *cp;
+ char name[16], temp[16];
+ int hashsize;
+#endif
+ static int Time_Of_Last_Reload = 0;
+ struct timeval now;
+
+ gettimeofday(&now, (struct timezone *) 0);
+ if (Time_Of_Last_Reload + CACHE_TIME > now.tv_sec)
+ return;
+ Time_Of_Last_Reload = now.tv_sec;
+
+ /*
+ * * Makes sure we have SOME space allocated for new routing entries
+ */
+ if (!rthead) {
+ rthead = (RTENTRY **) malloc(100 * sizeof(RTENTRY *));
+ if (!rthead) {
+ snmp_log(LOG_ERR, "route table malloc fail\n");
+ return;
+ }
+ memset((char *) rthead, (0), 100 * sizeof(RTENTRY *));
+ rtallocate = 100;
+ }
+
+ /*
+ * reset the routing table size to zero -- was a CMU memory leak
+ */
+ rtsize = 0;
+
+#ifdef RTENTRY_4_4
+ /*
+ * rtentry is a BSD 4.4 compat
+ */
+
+#if !defined(AF_UNSPEC)
+#define AF_UNSPEC AF_INET
+#endif
+
+ auto_nlist(RTTABLES_SYMBOL, (char *) rt_table, sizeof(rt_table));
+ for (i = 0; i <= AF_MAX; i++) {
+ if (rt_table[i] == 0)
+ continue;
+ if (NETSNMP_KLOOKUP(rt_table[i], (char *) &head, sizeof(head))) {
+ load_rtentries(head.rnh_treetop);
+ }
+ }
+
+#else /* rtentry is a BSD 4.3 compat */
+ for (table = 0; table < NUM_ROUTE_SYMBOLS; table++) {
+ auto_nlist(RTHASHSIZE_SYMBOL, (char *) &hashsize,
+ sizeof(hashsize));
+ routehash = (RTENTRY **) malloc(hashsize * sizeof(struct mbuf *));
+ auto_nlist(route_symbols[table], (char *) routehash,
+ hashsize * sizeof(struct mbuf *));
+ for (i = 0; i < hashsize; i++) {
+ if (routehash[i] == 0)
+ continue;
+ m = routehash[i];
+ while (m) {
+ /*
+ * Dig the route out of the kernel...
+ */
+ if (!NETSNMP_KLOOKUP(m, (char *) &mb, sizeof(mb))) {
+ DEBUGMSGTL(("mibII/var_route", "klookup failed\n"));
+ return;
+ }
+ m = mb.rt_next;
+
+ rt = &mb;
+ if (rt->rt_ifp != 0) {
+ if (!NETSNMP_KLOOKUP(rt->rt_ifp, (char *) &ifnet, sizeof(ifnet))) {
+ DEBUGMSGTL(("mibII/var_route", "klookup failed\n"));
+ return;
+ }
+ if (!NETSNMP_KLOOKUP(ifnet.if_name, name, 16)) {
+ DEBUGMSGTL(("mibII/var_route", "klookup failed\n"));
+ return;
+ }
+ name[15] = '\0';
+ cp = (char *) strchr(name, '\0');
+ string_append_int(cp, ifnet.if_unit);
+
+ Interface_Scan_Init();
+ while (Interface_Scan_Next
+ ((short *) &rt->rt_unit, temp, NULL,
+ NULL) != 0) {
+ if (strcmp(name, temp) == 0)
+ break;
+ }
+ }
+ /*
+ * Allocate a block to hold it and add it to the database
+ */
+ if (rtsize >= rtallocate) {
+ rthead =
+ (RTENTRY **) realloc((char *) rthead,
+ 2 * rtallocate *
+ sizeof(RTENTRY *));
+ memset((char *) &rthead[rtallocate], (0),
+ rtallocate * sizeof(RTENTRY *));
+
+ rtallocate *= 2;
+ }
+ if (!rthead[rtsize])
+ rthead[rtsize] = (RTENTRY *) malloc(sizeof(RTENTRY));
+ /*
+ * Add this to the database
+ */
+ memcpy((char *) rthead[rtsize], (char *) rt,
+ sizeof(RTENTRY));
+ rtsize++;
+ }
+ }
+ free(routehash);
+ }
+#endif
+ /*
+ * Sort it!
+ */
+ qsort((char *) rthead, rtsize, sizeof(rthead[0]),
+#ifdef __STDC__
+ (int (*)(const void *, const void *)) qsort_compare
+#else
+ qsort_compare
+#endif
+ );
+#endif /* hpux11 */
+}
+
+#else
+
+#if HAVE_SYS_MBUF_H
+static void
+Route_Scan_Reload(void)
+{
+ struct mbuf **routehash, mb;
+ register struct mbuf *m;
+ struct ifnet ifnet;
+ RTENTRY *rt;
+ int i, table;
+ register char *cp;
+ char name[16], temp[16];
+ static int Time_Of_Last_Reload = 0;
+ struct timeval now;
+ int hashsize;
+
+ gettimeofday(&now, (struct timezone *) 0);
+ if (Time_Of_Last_Reload + CACHE_TIME > now.tv_sec)
+ return;
+ Time_Of_Last_Reload = now.tv_sec;
+
+ /*
+ * Makes sure we have SOME space allocated for new routing entries
+ */
+ if (!rthead) {
+ rthead = (RTENTRY **) malloc(100 * sizeof(RTENTRY *));
+ if (!rthead) {
+ snmp_log(LOG_ERR, "route table malloc fail\n");
+ return;
+ }
+ memset((char *) rthead, (0), 100 * sizeof(RTENTRY *));
+ rtallocate = 100;
+ }
+
+ /*
+ * reset the routing table size to zero -- was a CMU memory leak
+ */
+ rtsize = 0;
+
+ for (table = 0; table < NUM_ROUTE_SYMBOLS; table++) {
+#ifdef sunV3
+ hashsize = RTHASHSIZ;
+#else
+ auto_nlist(RTHASHSIZE_SYMBOL, (char *) &hashsize,
+ sizeof(hashsize));
+#endif
+ routehash =
+ (struct mbuf **) malloc(hashsize * sizeof(struct mbuf *));
+ auto_nlist(route_symbols[table], (char *) routehash,
+ hashsize * sizeof(struct mbuf *));
+ for (i = 0; i < hashsize; i++) {
+ if (routehash[i] == 0)
+ continue;
+ m = routehash[i];
+ while (m) {
+ /*
+ * Dig the route out of the kernel...
+ */
+ if (!NETSNMP_KLOOKUP(m, (char *) &mb, sizeof(mb))) {
+ DEBUGMSGTL(("mibII/var_route", "klookup failed\n"));
+ return;
+ }
+ m = mb.m_next;
+ rt = mtod(&mb, RTENTRY *);
+
+ if (rt->rt_ifp != 0) {
+
+ if (!NETSNMP_KLOOKUP(rt->rt_ifp, (char *) &ifnet, sizeof(ifnet))) {
+ DEBUGMSGTL(("mibII/var_route", "klookup failed\n"));
+ return;
+ }
+ if (!NETSNMP_KLOOKUP(ifnet.if_name, name, 16)) {
+ DEBUGMSGTL(("mibII/var_route", "klookup failed\n"));
+ return;
+ }
+ name[15] = '\0';
+ cp = (char *) strchr(name, '\0');
+ string_append_int(cp, ifnet.if_unit);
+ if (strcmp(name, "lo0") == 0)
+ continue;
+
+ Interface_Scan_Init();
+ while (Interface_Scan_Next
+ ((short *) &rt->rt_unit, temp, NULL,
+ NULL) != 0) {
+ if (strcmp(name, temp) == 0)
+ break;
+ }
+ }
+ /*
+ * Allocate a block to hold it and add it to the database
+ */
+ if (rtsize >= rtallocate) {
+ rthead =
+ (RTENTRY **) realloc((char *) rthead,
+ 2 * rtallocate *
+ sizeof(RTENTRY *));
+ memset((char *) &rthead[rtallocate], (0),
+ rtallocate * sizeof(RTENTRY *));
+
+ rtallocate *= 2;
+ }
+ if (!rthead[rtsize])
+ rthead[rtsize] = (RTENTRY *) malloc(sizeof(RTENTRY));
+ /*
+ * * Add this to the database
+ */
+ memcpy((char *) rthead[rtsize], (char *) rt,
+ sizeof(RTENTRY));
+ rtsize++;
+ }
+ }
+ free(routehash);
+ }
+ /*
+ * Sort it!
+ */
+ qsort((char *) rthead, rtsize, sizeof(rthead[0]), qsort_compare);
+}
+#else
+#ifdef linux
+static void
+Route_Scan_Reload(void)
+{
+ FILE *in;
+ char line[256];
+ struct rtentry *rt;
+ char name[16];
+ static int Time_Of_Last_Reload = 0;
+ struct timeval now;
+
+ gettimeofday(&now, (struct timezone *) 0);
+ if (Time_Of_Last_Reload + CACHE_TIME > now.tv_sec)
+ return;
+ Time_Of_Last_Reload = now.tv_sec;
+
+ /*
+ * Makes sure we have SOME space allocated for new routing entries
+ */
+ if (!rthead) {
+ rthead = (struct rtentry **) calloc(100, sizeof(struct rtentry *));
+ if (!rthead) {
+ snmp_log(LOG_ERR, "route table malloc fail\n");
+ return;
+ }
+ rtallocate = 100;
+ }
+
+ /*
+ * fetch routes from the proc file-system:
+ */
+
+ rtsize = 0;
+
+ if (!(in = fopen("/proc/net/route", "r"))) {
+ snmp_log(LOG_ERR, "cannot open /proc/net/route - burps\n");
+ return;
+ }
+
+ while (fgets(line, sizeof(line), in)) {
+ struct rtentry rtent;
+ char rtent_name[32];
+ int refcnt, flags, metric;
+ unsigned use;
+
+ rt = &rtent;
+ memset((char *) rt, (0), sizeof(*rt));
+ rt->rt_dev = rtent_name;
+
+ /*
+ * as with 1.99.14:
+ * Iface Dest GW Flags RefCnt Use Metric Mask MTU Win IRTT
+ * eth0 0A0A0A0A 00000000 05 0 0 0 FFFFFFFF 1500 0 0
+ */
+ if (8 != sscanf(line, "%s %x %x %x %u %d %d %x %*d %*d %*d\n",
+ rt->rt_dev,
+ &(((struct sockaddr_in *) &(rtent.rt_dst))->
+ sin_addr.s_addr),
+ &(((struct sockaddr_in *) &(rtent.rt_gateway))->
+ sin_addr.s_addr),
+ /*
+ * XXX: fix type of the args
+ */
+ &flags, &refcnt, &use, &metric,
+ &(((struct sockaddr_in *) &(rtent.rt_genmask))->
+ sin_addr.s_addr)))
+ continue;
+
+ strncpy(name, rt->rt_dev, sizeof(name));
+ name[ sizeof(name)-1 ] = 0;
+
+ rt->rt_flags = flags, rt->rt_refcnt = refcnt;
+ rt->rt_use = use, rt->rt_metric = metric;
+
+ rt->rt_unit = netsnmp_access_interface_index_find(name);
+
+ /*
+ * Allocate a block to hold it and add it to the database
+ */
+ if (rtsize >= rtallocate) {
+ rthead = (struct rtentry **) realloc((char *) rthead,
+ 2 * rtallocate *
+ sizeof(struct rtentry *));
+ memset(&rthead[rtallocate], 0,
+ rtallocate * sizeof(struct rtentry *));
+ rtallocate *= 2;
+ }
+ if (!rthead[rtsize])
+ rthead[rtsize] =
+ (struct rtentry *) malloc(sizeof(struct rtentry));
+ /*
+ * Add this to the database
+ */
+ memcpy((char *) rthead[rtsize], (char *) rt,
+ sizeof(struct rtentry));
+ rtsize++;
+ }
+
+ fclose(in);
+
+ /*
+ * Sort it!
+ */
+ qsort((char *) rthead, rtsize, sizeof(rthead[0]), qsort_compare);
+}
+#endif
+#endif
+#endif
+
+
+#ifndef solaris2
+/*
+ * Create a host table
+ */
+#ifdef hpux11
+static int
+qsort_compare(const void *v1, const void *v2)
+{
+ const mib_ipRouteEnt *r1 = (const mib_ipRouteEnt *) v1;
+ const mib_ipRouteEnt *r2 = (const mib_ipRouteEnt *) v2;
+ /*
+ * Do the comparison
+ */
+ if (r1->Dest == r2->Dest)
+ return (0);
+ if (r1->Dest > r2->Dest)
+ return (1);
+ return (-1);
+}
+#else
+static int
+qsort_compare(const void *v1, const void *v2)
+{
+ RTENTRY * const *r1 = (RTENTRY * const *) v1;
+ RTENTRY * const *r2 = (RTENTRY * const *) v2;
+#if NEED_KLGETSA
+ register u_long dst1 =
+ ntohl(klgetsa((const struct sockaddr_in *) (*r1)->rt_dst)->
+ sin_addr.s_addr);
+ register u_long dst2 =
+ ntohl(klgetsa((const struct sockaddr_in *) (*r2)->rt_dst)->
+ sin_addr.s_addr);
+#else
+ register u_long dst1 =
+ ntohl(((const struct sockaddr_in *) &((*r1)->rt_dst))->sin_addr.
+ s_addr);
+ register u_long dst2 =
+ ntohl(((const struct sockaddr_in *) &((*r2)->rt_dst))->sin_addr.
+ s_addr);
+#endif /* NEED_KLGETSA */
+
+ /*
+ * Do the comparison
+ */
+ if (dst1 == dst2)
+ return (0);
+ if (dst1 > dst2)
+ return (1);
+ return (-1);
+}
+#endif /* hpux11 */
+#endif /* not USE_SYSCTL_ROUTE_DUMP */
+
+#endif /* solaris2 */
+
+#else /* WIN32 cygwin */
+#include <iphlpapi.h>
+#ifndef MIB_IPPROTO_NETMGMT
+#define MIB_IPPROTO_NETMGMT 3
+#endif
+
+PMIB_IPFORWARDROW route_row;
+int create_flag;
+void
+init_var_route(void)
+{
+}
+
+u_char *
+var_ipRouteEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * object identifier is of form:
+ * 1.3.6.1.2.1.4.21.1.?.A.B.C.D, where A.B.C.D is IP address.
+ * IPADDR starts at offset 10.
+ */
+ register int Save_Valid, result, RtIndex;
+ static int saveNameLen = 0, saveExact = 0, saveRtIndex =
+ 0, rtsize = 0;
+ static oid saveName[MAX_OID_LEN], Current[MAX_OID_LEN];
+ u_char *cp;
+ oid *op;
+ DWORD status = NO_ERROR;
+ DWORD dwActualSize = 0;
+ static PMIB_IPFORWARDTABLE pIpRtrTable = NULL;
+ struct timeval now;
+ static long Time_Of_Last_Reload = 0;
+ u_char dest_addr[4];
+ MIB_IPFORWARDROW temp_row;
+ static in_addr_t addr_ret;
+
+
+ /**
+ ** this optimisation fails, if there is only a single route avail.
+ ** it is a very special case, but better leave it out ...
+ **/
+#if NETSNMP_NO_DUMMY_VALUES
+ saveNameLen = 0;
+#endif
+ if (route_row == NULL) {
+ /*
+ * Free allocated memory in case of SET request's FREE phase
+ */
+ route_row = (PMIB_IPFORWARDROW) malloc(sizeof(MIB_IPFORWARDROW));
+ }
+ gettimeofday(&now, (struct timezone *) 0);
+ if ((rtsize <= 1) || (Time_Of_Last_Reload + 5 <= now.tv_sec))
+ Save_Valid = 0;
+ else
+ /*
+ * OPTIMIZATION:
+ *
+ * If the name was the same as the last name, with the possible
+ * exception of the [9]th token, then don't read the routing table
+ *
+ */
+
+ if ((saveNameLen == (int) *length) && (saveExact == exact)) {
+ register int temp = name[9];
+ name[9] = 0;
+ Save_Valid =
+ (snmp_oid_compare(name, *length, saveName, saveNameLen) == 0);
+ name[9] = temp;
+ } else
+ Save_Valid = 0;
+
+ if (Save_Valid) {
+ register int temp = name[9]; /* Fix up 'lowest' found entry */
+ memcpy((char *) name, (char *) Current, 14 * sizeof(oid));
+ name[9] = temp;
+ *length = 14;
+ RtIndex = saveRtIndex;
+ } else {
+ /*
+ * fill in object part of name for current(less sizeof instance part)
+ */
+
+ memcpy((char *) Current, (char *) vp->name,
+ (int) (vp->namelen) * sizeof(oid));
+
+
+ if ((Time_Of_Last_Reload + 5 <= now.tv_sec)
+ || (pIpRtrTable == NULL)) {
+ if (pIpRtrTable != NULL)
+ free(pIpRtrTable);
+ Time_Of_Last_Reload = now.tv_sec;
+ /*
+ * query for buffer size needed
+ */
+ status = GetIpForwardTable(pIpRtrTable, &dwActualSize, TRUE);
+ if (status == ERROR_INSUFFICIENT_BUFFER) {
+ pIpRtrTable = (PMIB_IPFORWARDTABLE) malloc(dwActualSize);
+ if (pIpRtrTable != NULL) {
+ /*
+ * Get the sorted IP Route Table
+ */
+ status =
+ GetIpForwardTable(pIpRtrTable, &dwActualSize,
+ TRUE);
+ }
+ }
+ }
+ if (status == NO_ERROR) {
+ rtsize = pIpRtrTable->dwNumEntries;
+ for (RtIndex = 0; RtIndex < rtsize; RtIndex++) {
+ cp = (u_char *) & pIpRtrTable->table[RtIndex].
+ dwForwardDest;
+ op = Current + 10;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+
+ result = snmp_oid_compare(name, *length, Current, 14);
+ if ((exact && (result == 0)) || (!exact && (result < 0)))
+ break;
+ }
+ }
+ if (RtIndex >= rtsize) {
+ /*
+ * for creation of new row, only ipNetToMediaTable case is considered
+ */
+ if (*length == 14) {
+ create_flag = 1;
+ *write_method = write_rte;
+ dest_addr[0] = (u_char) name[10];
+ dest_addr[1] = (u_char) name[11];
+ dest_addr[2] = (u_char) name[12];
+ dest_addr[3] = (u_char) name[13];
+ temp_row.dwForwardDest = *((DWORD *) dest_addr);
+ temp_row.dwForwardPolicy = 0;
+ temp_row.dwForwardProto = MIB_IPPROTO_NETMGMT;
+ *route_row = temp_row;
+ }
+ free(pIpRtrTable);
+ pIpRtrTable = NULL;
+ rtsize = 0;
+ return (NULL);
+ }
+ create_flag = 0;
+ /*
+ * Save in the 'cache'
+ */
+ memcpy((char *) saveName, (char *) name,
+ SNMP_MIN(*length, MAX_OID_LEN) * sizeof(oid));
+ saveName[9] = 0;
+ saveNameLen = *length;
+ saveExact = exact;
+ saveRtIndex = RtIndex;
+
+ /*
+ * Return the name
+ */
+ memcpy((char *) name, (char *) Current, 14 * sizeof(oid));
+ *length = 14;
+ }
+ *var_len = sizeof(long_return);
+ *route_row = pIpRtrTable->table[RtIndex];
+
+ switch (vp->magic) {
+ case IPROUTEDEST:
+ *var_len = sizeof(addr_ret);
+ *write_method = write_rte;
+ addr_ret = pIpRtrTable->table[RtIndex].dwForwardDest;
+ return (u_char *) & addr_ret;
+ case IPROUTEIFINDEX:
+ *write_method = write_rte;
+ long_return = pIpRtrTable->table[RtIndex].dwForwardIfIndex;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC1:
+ *write_method = write_rte;
+ long_return = pIpRtrTable->table[RtIndex].dwForwardMetric1;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC2:
+ *write_method = write_rte;
+ long_return = pIpRtrTable->table[RtIndex].dwForwardMetric2;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC3:
+ *write_method = write_rte;
+ long_return = pIpRtrTable->table[RtIndex].dwForwardMetric3;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC4:
+ *write_method = write_rte;
+ long_return = pIpRtrTable->table[RtIndex].dwForwardMetric4;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC5:
+ *write_method = write_rte;
+ long_return = pIpRtrTable->table[RtIndex].dwForwardMetric5;
+ return (u_char *) & long_return;
+ case IPROUTENEXTHOP:
+ *var_len = sizeof(addr_ret);
+ *write_method = write_rte;
+ addr_ret = pIpRtrTable->table[RtIndex].dwForwardNextHop;
+ return (u_char *) & addr_ret;
+ case IPROUTETYPE:
+ *write_method = write_rte;
+ long_return = pIpRtrTable->table[RtIndex].dwForwardType;
+ return (u_char *) & long_return;
+ case IPROUTEPROTO:
+ long_return = pIpRtrTable->table[RtIndex].dwForwardProto;
+ return (u_char *) & long_return;
+ case IPROUTEAGE:
+ *write_method = write_rte;
+ long_return = pIpRtrTable->table[RtIndex].dwForwardAge;
+ return (u_char *) & long_return;
+ case IPROUTEMASK:
+ *write_method = write_rte;
+ *var_len = sizeof(addr_ret);
+ addr_ret = pIpRtrTable->table[RtIndex].dwForwardMask;
+ return (u_char *) & addr_ret;
+ case IPROUTEINFO:
+ *var_len = nullOidLen;
+ return (u_char *) nullOid;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipRouteEntry\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+#endif /* WIN32 cygwin */
+
+#else /* NETSNMP_CAN_USE_SYSCTL */
+
+static
+TAILQ_HEAD(, snmprt)
+ rthead;
+ static char *rtbuf;
+ static size_t rtbuflen;
+ static time_t lasttime;
+
+ struct snmprt {
+ TAILQ_ENTRY(snmprt) link;
+ struct rt_msghdr *hdr;
+ struct in_addr dest;
+ struct in_addr gateway;
+ struct in_addr netmask;
+ int index;
+ struct in_addr ifa;
+ };
+
+ static void
+ rtmsg(struct rt_msghdr *rtm)
+{
+ struct snmprt *rt;
+ struct sockaddr *sa;
+ int bit, gotdest, gotmask;
+
+ rt = malloc(sizeof *rt);
+ if (rt == 0)
+ return;
+ rt->hdr = rtm;
+ rt->ifa.s_addr = 0;
+ rt->dest = rt->gateway = rt->netmask = rt->ifa;
+ rt->index = rtm->rtm_index;
+
+ gotdest = gotmask = 0;
+ sa = (struct sockaddr *) (rtm + 1);
+ for (bit = 1; ((char *) sa < (char *) rtm + rtm->rtm_msglen) && bit;
+ bit <<= 1) {
+ if ((rtm->rtm_addrs & bit) == 0)
+ continue;
+ switch (bit) {
+ case RTA_DST:
+#define satosin(sa) ((struct sockaddr_in *)(sa))
+ rt->dest = satosin(sa)->sin_addr;
+ gotdest = 1;
+ break;
+ case RTA_GATEWAY:
+ if (sa->sa_family == AF_INET)
+ rt->gateway = satosin(sa)->sin_addr;
+ break;
+ case RTA_NETMASK:
+ if (sa->sa_len >= offsetof(struct sockaddr_in, sin_addr))
+ rt->netmask = satosin(sa)->sin_addr;
+ gotmask = 1;
+ break;
+ case RTA_IFA:
+ if (sa->sa_family == AF_INET)
+ rt->ifa = satosin(sa)->sin_addr;
+ break;
+ }
+ /*
+ * from rtsock.c
+ */
+#define ROUNDUP(a) \
+ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
+ sa = (struct sockaddr *) ((char *) sa + ROUNDUP(sa->sa_len));
+ }
+ if (!gotdest) {
+ /*
+ * XXX can't happen if code above is correct
+ */
+ snmp_log(LOG_ERR, "route no dest?\n");
+ free(rt);
+ } else {
+ /*
+ * If no mask provided, it was a host route.
+ */
+ if (!gotmask)
+ rt->netmask.s_addr = ~0;
+ TAILQ_INSERT_TAIL(&rthead, rt, link);
+ }
+}
+
+static int
+suck_krt(int force)
+{
+ time_t now;
+ struct snmprt *rt, *next;
+ size_t len;
+ static int name[6] =
+ { CTL_NET, PF_ROUTE, 0, AF_INET, NET_RT_DUMP, 0 };
+ char *cp;
+ struct rt_msghdr *rtm;
+
+ time(&now);
+ if (now < (lasttime + CACHE_TIME) && !force)
+ return 0;
+ lasttime = now;
+
+ for (rt = rthead.tqh_first; rt; rt = next) {
+ next = rt->link.tqe_next;
+ free(rt);
+ }
+ TAILQ_INIT(&rthead);
+
+ if (sysctl(name, 6, 0, &len, 0, 0) < 0) {
+ syslog(LOG_WARNING, "sysctl net-route-dump: %m");
+ return -1;
+ }
+
+ if (len > rtbuflen) {
+ char *newbuf;
+ newbuf = realloc(rtbuf, len);
+ if (newbuf == 0)
+ return -1;
+ rtbuf = newbuf;
+ rtbuflen = len;
+ }
+
+ if (sysctl(name, 6, rtbuf, &len, 0, 0) < 0) {
+ syslog(LOG_WARNING, "sysctl net-route-dump: %m");
+ return -1;
+ }
+
+ cp = rtbuf;
+ while (cp < rtbuf + len) {
+ rtm = (struct rt_msghdr *) cp;
+ /*
+ * NB:
+ * You might want to exclude routes with RTF_WASCLONED
+ * set. This keeps the cloned host routes (and thus also
+ * ARP entries) out of the routing table. Thus, it also
+ * presents management stations with an incomplete view.
+ * I believe that it should be possible for a management
+ * station to examine (and perhaps delete) such routes.
+ */
+ if (rtm->rtm_version == RTM_VERSION && rtm->rtm_type == RTM_GET)
+ rtmsg(rtm);
+ cp += rtm->rtm_msglen;
+ }
+ return 0;
+}
+
+u_char *
+var_ipRouteEntry(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * object identifier is of form:
+ * 1.3.6.1.2.1.4.21.1.1.A.B.C.D, where A.B.C.D is IP address.
+ * IPADDR starts at offset 10.
+ */
+ int Save_Valid, result;
+ u_char *cp;
+ oid *op;
+ struct snmprt *rt;
+ static struct snmprt *savert;
+ static int saveNameLen, saveExact;
+ static oid saveName[14], Current[14];
+ static in_addr_t addr_ret;
+
+ *write_method = NULL; /* write_rte; XXX: SET support not really implemented */
+
+#if 0
+ /*
+ * OPTIMIZATION:
+ *
+ * If the name was the same as the last name, with the possible
+ * exception of the [9]th token, then don't read the routing table
+ *
+ */
+
+ if ((saveNameLen == *length) && (saveExact == exact)) {
+ int temp = name[9];
+ name[9] = 0;
+ Save_Valid =
+ !snmp_oid_compare(name, *length, saveName, saveNameLen);
+ name[9] = temp;
+ } else {
+ Save_Valid = 0;
+ }
+#else
+ Save_Valid = 0;
+#endif
+
+ if (Save_Valid) {
+ int temp = name[9];
+ memcpy(name, Current, 14 * sizeof(oid));
+ name[9] = temp;
+ *length = 14;
+ rt = savert;
+ } else {
+ /*
+ * fill in object part of name for current
+ * (less sizeof instance part)
+ */
+
+ memcpy(Current, vp->name, SNMP_MIN(sizeof(Current), (int)(vp->namelen) * sizeof(oid)));
+
+ suck_krt(0);
+
+ for (rt = rthead.tqh_first; rt; rt = rt->link.tqe_next) {
+ op = Current + 10;
+ cp = (u_char *) & rt->dest;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ *op++ = *cp++;
+ result = snmp_oid_compare(name, *length, Current, 14);
+ if ((exact && (result == 0))
+ || (!exact && (result < 0)))
+ break;
+ }
+ if (rt == NULL)
+ return NULL;
+
+ /*
+ * Save in the 'cache'
+ */
+ memcpy(saveName, name, SNMP_MIN(sizeof(saveName), *length * sizeof(oid)));
+ saveName[9] = 0;
+ saveNameLen = *length;
+ saveExact = exact;
+ savert = rt;
+
+ /*
+ * Return the name
+ */
+ memcpy(name, Current, 14 * sizeof(oid));
+ *length = 14;
+ }
+
+ *var_len = sizeof(long_return);
+
+ switch (vp->magic) {
+ case IPROUTEDEST:
+ addr_ret = rt->dest.s_addr;
+ *var_len = sizeof(addr_ret);
+ return (u_char *) & addr_ret;
+
+ case IPROUTEIFINDEX:
+ long_return = rt->index;
+ return (u_char *) & long_return;
+
+ case IPROUTEMETRIC1:
+ long_return = (rt->hdr->rtm_flags & RTF_GATEWAY) ? 1 : 0;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC2:
+ long_return = rt->hdr->rtm_rmx.rmx_rtt;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC3:
+ long_return = rt->hdr->rtm_rmx.rmx_rttvar;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC4:
+ long_return = rt->hdr->rtm_rmx.rmx_ssthresh;
+ return (u_char *) & long_return;
+ case IPROUTEMETRIC5:
+ long_return = rt->hdr->rtm_rmx.rmx_mtu;
+ return (u_char *) & long_return;
+
+ case IPROUTENEXTHOP:
+ *var_len = sizeof(addr_ret);
+ if (rt->gateway.s_addr == 0 && rt->ifa.s_addr == 0)
+ addr_ret = 0;
+ else if (rt->gateway.s_addr == 0)
+ addr_ret = rt->ifa.s_addr;
+ else
+ addr_ret = rt->gateway.s_addr;
+ return (u_char *) & addr_ret;
+
+ case IPROUTETYPE:
+ if (rt->hdr->rtm_flags & RTF_UP) {
+ if (rt->hdr->rtm_flags & RTF_GATEWAY) {
+ long_return = 4; /* indirect(4) */
+ } else {
+ long_return = 3; /* direct(3) */
+ }
+ } else {
+ long_return = 2; /* invalid(2) */
+ }
+ return (u_char *) & long_return;
+
+ case IPROUTEPROTO:
+ long_return = (rt->hdr->rtm_flags & RTF_DYNAMIC) ? 4 : 2;
+ return (u_char *) & long_return;
+
+ case IPROUTEAGE:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_return = 0;
+ return (u_char *) & long_return;
+
+ case IPROUTEMASK:
+ addr_ret = rt->netmask.s_addr;
+ *var_len = sizeof(addr_ret);
+ return (u_char *) & addr_ret;
+
+ case IPROUTEINFO:
+ *var_len = nullOidLen;
+ return (u_char *) nullOid;
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_ipRouteEntry\n",
+ vp->magic));
+ }
+ return NULL;
+}
+
+void
+init_var_route(void)
+{
+ ;
+}
+
+#endif /* NETSNMP_CAN_USE_SYSCTL */
+
+#if defined(HAVE_SYS_SYSCTL_H) && !defined(linux)
+/*
+ * get_address()
+ *
+ * Traverse the address structures after a routing socket message and
+ * extract a specific one.
+ *
+ * Some of this is peculiar to IRIX 6.2, which doesn't have sa_len in
+ * the sockaddr structure yet. With sa_len, skipping an address entry
+ * would be much easier.
+ */
+#include <sys/un.h>
+
+/*
+ * returns the length of a socket structure
+ */
+
+size_t
+snmp_socket_length(int family)
+{
+ size_t length;
+
+ switch (family) {
+#ifndef cygwin
+#if !defined (WIN32) && !defined (cygwin)
+#ifdef AF_UNIX
+ case AF_UNIX:
+ length = sizeof(struct sockaddr_un);
+ break;
+#endif /* AF_UNIX */
+#endif
+#endif
+
+#ifndef aix3
+#ifdef AF_LINK
+ case AF_LINK:
+#ifdef _MAX_SA_LEN
+ length = _MAX_SA_LEN;
+#elif SOCK_MAXADDRLEN
+ length = SOCK_MAXADDRLEN;
+#else
+ length = sizeof(struct sockaddr_dl);
+#endif
+ break;
+#endif /* AF_LINK */
+#endif
+
+ case AF_INET:
+ length = sizeof(struct sockaddr_in);
+ break;
+ default:
+ length = sizeof(struct sockaddr);
+ break;
+ }
+
+ return length;
+}
+
+const struct sockaddr *
+get_address(const void *_ap, int addresses, int wanted)
+{
+ const struct sockaddr *ap = (const struct sockaddr *) _ap;
+ int iindex;
+ int bitmask;
+
+ for (iindex = 0, bitmask = 1;
+ iindex < RTAX_MAX; ++iindex, bitmask <<= 1) {
+ if (bitmask == wanted) {
+ if (bitmask & addresses) {
+ return ap;
+ } else {
+ return 0;
+ }
+ } else if (bitmask & addresses) {
+ unsigned length =
+ (unsigned) snmp_socket_length(ap->sa_family);
+ while (length % sizeof(long) != 0)
+ ++length;
+ ap = (const struct sockaddr *) ((const char *) ap + length);
+ }
+ }
+ return 0;
+}
+
+/*
+ * get_in_address()
+ *
+ * Convenience function for the special case of get_address where an
+ * AF_INET address is desired, and we're only interested in the in_addr
+ * part.
+ */
+const struct in_addr *
+get_in_address(const void *ap, int addresses, int wanted)
+{
+ const struct sockaddr_in *a;
+
+ a = (const struct sockaddr_in *) get_address(ap, addresses, wanted);
+ if (a == NULL)
+ return NULL;
+
+ if (a->sin_family != AF_INET) {
+ DEBUGMSGTL(("snmpd",
+ "unknown socket family %d [AF_INET expected] in var_ipRouteEntry.\n",
+ a->sin_family));
+ }
+ return &a->sin_addr;
+}
+#endif /* HAVE_SYS_SYSCTL_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/var_route.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/var_route.h
new file mode 100644
index 0000000000..91ecee8d71
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibII/var_route.h
@@ -0,0 +1,26 @@
+/*
+ * Template MIB group interface - var_route.h
+ *
+ */
+#ifndef _MIBGROUP_VAR_ROUTE_H
+#define _MIBGROUP_VAR_ROUTE_H
+
+config_require(mibII/ip util_funcs)
+config_arch_require(solaris2, kernel_sunos5)
+
+ void init_var_route(void);
+#if defined(RTENTRY_4_4) && !defined(hpux11)
+ struct radix_node;
+ void load_rtentries(struct radix_node *);
+#endif
+#if defined(freebsd2) || defined(netbsd1) || defined(bsdi2) || defined(openbsd2)
+ struct sockaddr_in *klgetsa(struct sockaddr_in *);
+#endif
+
+ extern FindVarMethod var_ipRouteEntry;
+
+#if !defined(hpux11) && !defined(solaris2)
+ RTENTRY **netsnmp_get_routes(size_t *out_numroutes);
+#endif
+
+#endif /* _MIBGROUP_VAR_ROUTE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibdefs.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibdefs.h
new file mode 100644
index 0000000000..260cae1379
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibdefs.h
@@ -0,0 +1,14 @@
+/*
+ * 2 global mib defs:
+ * ERRORFLAG: A binary flag to signal an error condition.
+ * Also used as exit code.
+ * ERRORMSG: A text message describing what caused the above condition,
+ * Also used as the single line return message from programs
+ */
+
+#define MIBINDEX 1
+#define ERRORNAME 2
+#define ERRORFLAG 100
+#define ERRORMSG 101
+#define ERRORFIX 102
+#define ERRORFIXCMD 103
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mibincl.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibincl.h
new file mode 100644
index 0000000000..28ed599cc6
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mibincl.h
@@ -0,0 +1,52 @@
+/*
+ * mibincl.h
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#include <net-snmp/agent/mib_module_config.h>
+
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/library/snmp_api.h>
+#include <net-snmp/library/snmp_impl.h>
+#include <net-snmp/library/snmp_client.h>
+
+#include <net-snmp/agent/snmp_vars.h>
+#include <net-snmp/agent/agent_read_config.h>
+#include <net-snmp/agent/agent_handler.h>
+#include <net-snmp/agent/agent_registry.h>
+#include <net-snmp/agent/var_struct.h>
+
+#include <net-snmp/library/snmp.h>
+#include <net-snmp/library/mib.h>
+#include <net-snmp/library/snmp_debug.h>
+#include <net-snmp/library/snmp_logging.h>
+#include <net-snmp/library/snmp_alarm.h>
+#include <net-snmp/library/read_config.h>
+#include <net-snmp/library/tools.h>
+#include <net-snmp/agent/agent_trap.h>
+#include <net-snmp/library/callback.h>
+#define u_char unsigned char
+#define u_short unsigned short
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/misc/ipfwacc.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/misc/ipfwacc.c
new file mode 100644
index 0000000000..d4fe67d468
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/misc/ipfwacc.c
@@ -0,0 +1,347 @@
+/****************************************************************************
+ * Module for ucd-snmpd reading IP Firewall accounting rules. *
+ * It reads "/proc/net/ip_acct". If the file has a wrong format it silently *
+ * returns erroneous data but doesn't do anything harmfull. Based (on the *
+ * output of) mib2c, wombat.c, proc.c and the Linux kernel. *
+ * Author: Cristian.Estan@net.utcluj.ro *
+ ***************************************************************************/
+
+#include <net-snmp/net-snmp-config.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+#include "ipfwacc.h"
+
+/*
+ * According to the 2.0.33 Linux kernel, assuming we use ipv4 any line from
+ * * "/proc/net/ip_acct should fit into
+ * * 8+1+8+2+8+1+8+1+16+1+8+1+4+1+2+1+2+1+20+20+10*(1+5)+2+2+2+2=182
+ * * characters+ newline.
+ */
+#define IPFWRULELEN 200
+
+#define IP_FW_F_ALL 0x0000 /* This is a universal packet firewall */
+#define IP_FW_F_TCP 0x0001 /* This is a TCP packet firewall */
+#define IP_FW_F_UDP 0x0002 /* This is a UDP packet firewall */
+#define IP_FW_F_ICMP 0x0003 /* This is a ICMP packet firewall */
+#define IP_FW_F_KIND 0x0003 /* Mask to isolate firewall kind */
+#define IP_FW_F_SRNG 0x0008 /* The first two src ports are a min *
+ * and max range (stored in host byte *
+ * order). */
+#define IP_FW_F_DRNG 0x0010 /* The first two dst ports are a min *
+ * and max range (stored in host byte *
+ * order). *
+ * (ports[0] <= port <= ports[1]) */
+#define IP_FW_F_BIDIR 0x0040 /* For bidirectional firewalls */
+#define IP_FW_F_ACCTIN 0x1000 /* Account incoming packets only. */
+#define IP_FW_F_ACCTOUT 0x2000 /* Account outgoing packets only. */
+
+static unsigned char rule[IPFWRULELEN]; /*Buffer for reading a line from
+ * /proc/net/ip_acct. Care has been taken
+ * not to read beyond the end of this
+ * buffer, even if rules are in an
+ * unexpected format
+ */
+
+/*
+ * This function reads the rule with the given number into the buffer. It
+ * * returns the number of rule read or 0 if the number is invalid or other
+ * * problems occur. If the argument is 0 it returns the number of accounting
+ * * rules. No caching of rules is done.
+ */
+
+static int
+readrule(unsigned int number)
+{
+ int i;
+ FILE *f = fopen("/proc/net/ip_acct", "rt");
+
+ if (!f)
+ return 0;
+ /*
+ * get rid of "IP accounting rules" line
+ */
+ if (!fgets(rule, sizeof(rule), f)) {
+ fclose(f);
+ return 0;
+ }
+ for (i = 1; i != number; i++)
+ if (!fgets(rule, sizeof(rule), f)) {
+ fclose(f);
+ return (number ? 0 : (i - 1));
+ }
+ if (!fgets(rule, sizeof(rule), f)) {
+ fclose(f);
+ return 0;
+ }
+ fclose(f);
+ return i;
+}
+
+static unsigned long ret_val; /* Used by var_ipfwacc to return ulongs */
+
+/*
+ * This function converts the hexadecimal representation of an IP address from
+ * * the rule buffer to an unsigned long. The result is stored in the ret_val
+ * * variable. The parameter indicates the position where the address starts. It
+ * * only works with uppercase letters and assumes input is correct. Had to use
+ * * this because stol returns a signed long.
+ */
+
+static inline void
+atoip(int pos)
+{
+ int i;
+
+ ret_val = 0;
+ for (i = 0; i < 32; i += 8) {
+ unsigned long value = (((rule[pos]) >= '0' && rule[pos] <= '9') ?
+ rule[pos] - '0' : rule[pos] - 'A' + 10);
+ pos++;
+ value = (value << 4) + (((rule[pos]) >= '0' && rule[pos] <= '9') ?
+ rule[pos] - '0' : rule[pos] - 'A' + 10);
+ pos++;
+ ret_val |= (value << i);
+ }
+}
+
+/*
+ * This function parses the flags field from the line in the buffer
+ */
+
+static unsigned long int
+getflags(void)
+{
+ unsigned long int flags;
+ int i = 37; /* position in the rule */
+
+ /*
+ * skipping via name
+ */
+ while (rule[i] != ' ' && i < IPFWRULELEN - 12)
+ i++;
+ /*
+ * skipping via address
+ */
+ i += 10;
+ for (flags = 0; rule[i] != ' ' && i < IPFWRULELEN - 1; i++) {
+ int value = (((rule[i]) >= '0' && rule[i] <= '9') ?
+ rule[i] - '0' : rule[i] - 'A' + 10);
+ flags = (flags << 4) + value;
+ }
+ return flags;
+}
+
+/*
+ * This function reads into ret_val a field from the rule buffer. The field
+ * * is a base 10 long integer and the parameter skip tells us how many fields
+ * * to skip after the "via addrress" field (including the flag field)
+ */
+
+static void
+getnumeric(int skip)
+{
+ int i = 37; /* position in the rule */
+
+ /*
+ * skipping via name
+ */
+ while (rule[i] != ' ' && i < IPFWRULELEN - 12)
+ i++;
+ /*
+ * skipping via address
+ */
+ i += 10;
+ while (skip > 0) {
+ skip--;
+ /*
+ * skipping field, than subsequent spaces
+ */
+ while (rule[i] != ' ' && i < IPFWRULELEN - 2)
+ i++;
+ while (rule[i] == ' ' && i < IPFWRULELEN - 1)
+ i++;
+ }
+ for (ret_val = 0; rule[i] != ' ' && i < IPFWRULELEN - 1; i++)
+ ret_val = ret_val * 10 + rule[i] - '0';
+}
+
+/*
+ * this variable defines function callbacks and type return information
+ * for the ipfwaccounting mib
+ */
+
+struct variable2 ipfwacc_variables[] = {
+ {IPFWACCINDEX, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCINDEX}},
+ {IPFWACCSRCADDR, ASN_IPADDRESS, RONLY, var_ipfwacc, 1,
+ {IPFWACCSRCADDR}},
+ {IPFWACCSRCNM, ASN_IPADDRESS, RONLY, var_ipfwacc, 1, {IPFWACCSRCNM}},
+ {IPFWACCDSTADDR, ASN_IPADDRESS, RONLY, var_ipfwacc, 1,
+ {IPFWACCDSTADDR}},
+ {IPFWACCDSTNM, ASN_IPADDRESS, RONLY, var_ipfwacc, 1, {IPFWACCDSTNM}},
+ {IPFWACCVIANAME, ASN_OCTET_STR, RONLY, var_ipfwacc, 1,
+ {IPFWACCVIANAME}},
+ {IPFWACCVIAADDR, ASN_IPADDRESS, RONLY, var_ipfwacc, 1,
+ {IPFWACCVIAADDR}},
+ {IPFWACCPROTO, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPROTO}},
+ {IPFWACCBIDIR, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCBIDIR}},
+ {IPFWACCDIR, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCDIR}},
+ {IPFWACCBYTES, ASN_COUNTER, RONLY, var_ipfwacc, 1, {IPFWACCBYTES}},
+ {IPFWACCPACKETS, ASN_COUNTER, RONLY, var_ipfwacc, 1, {IPFWACCPACKETS}},
+ {IPFWACCNSRCPRTS, ASN_INTEGER, RONLY, var_ipfwacc, 1,
+ {IPFWACCNSRCPRTS}},
+ {IPFWACCNDSTPRTS, ASN_INTEGER, RONLY, var_ipfwacc, 1,
+ {IPFWACCNDSTPRTS}},
+ {IPFWACCSRCISRNG, ASN_INTEGER, RONLY, var_ipfwacc, 1,
+ {IPFWACCSRCISRNG}},
+ {IPFWACCDSTISRNG, ASN_INTEGER, RONLY, var_ipfwacc, 1,
+ {IPFWACCDSTISRNG}},
+ {IPFWACCPORT1, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT1}},
+ {IPFWACCPORT2, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT2}},
+ {IPFWACCPORT3, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT3}},
+ {IPFWACCPORT4, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT4}},
+ {IPFWACCPORT5, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT5}},
+ {IPFWACCPORT6, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT6}},
+ {IPFWACCPORT7, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT7}},
+ {IPFWACCPORT8, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT8}},
+ {IPFWACCPORT9, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT9}},
+ {IPFWACCPORT10, ASN_INTEGER, RONLY, var_ipfwacc, 1, {IPFWACCPORT10}}
+};
+
+oid ipfwacc_variables_oid[] =
+ { 1, 3, 6, 1, 4, 1, 2021, 13, 1, 1, 1 };
+
+void
+init_ipfwacc(void)
+{
+ REGISTER_MIB("misc/ipfwacc", ipfwacc_variables, variable2,
+ ipfwacc_variables_oid);
+}
+
+
+u_char *
+var_ipfwacc(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ *write_method = 0; /* assume it isnt writable for the time being */
+ *var_len = sizeof(ret_val); /* assume an integer and change later if not */
+
+ if (header_simple_table
+ (vp, name, length, exact, var_len, write_method, readrule(0)))
+ return (NULL);
+
+ if (readrule(name[*length - 1])) {
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+ case IPFWACCINDEX:
+ ret_val = name[*length - 1];
+ return ((u_char *) (&ret_val));
+ case IPFWACCSRCADDR:
+ atoip(0);
+ return ((u_char *) (&ret_val));
+ case IPFWACCSRCNM:
+ atoip(9);
+ return ((u_char *) (&ret_val));
+ case IPFWACCDSTADDR:
+ atoip(19);
+ return ((u_char *) (&ret_val));
+ case IPFWACCDSTNM:
+ atoip(28);
+ return ((u_char *) (&ret_val));
+ case IPFWACCVIANAME:
+ {
+ int i = 37; /* position in the rule */
+ while (rule[i] != ' ' && i < IPFWRULELEN - 1)
+ i++;
+ rule[i] = 0;
+ return (rule + 37);
+ }
+ case IPFWACCVIAADDR:
+ {
+ int i = 37; /* position in the rule */
+ while (rule[i] != ' ' && i < IPFWRULELEN - 9)
+ i++;
+ atoip(i + 1);
+ return ((u_char *) (&ret_val));
+ }
+ case IPFWACCPROTO:
+ switch (getflags() & IP_FW_F_KIND) {
+ case IP_FW_F_ALL:
+ ret_val = 2;
+ return ((u_char *) (&ret_val));
+ case IP_FW_F_TCP:
+ ret_val = 3;
+ return ((u_char *) (&ret_val));
+ case IP_FW_F_UDP:
+ ret_val = 4;
+ return ((u_char *) (&ret_val));
+ case IP_FW_F_ICMP:
+ ret_val = 5;
+ return ((u_char *) (&ret_val));
+ default:
+ ret_val = 1;
+ return ((u_char *) (&ret_val));
+ }
+ case IPFWACCBIDIR:
+ ret_val = ((getflags() & IP_FW_F_BIDIR) ? 2 : 1);
+ return ((u_char *) (&ret_val));
+ case IPFWACCDIR:
+ ret_val = (getflags() & (IP_FW_F_ACCTIN | IP_FW_F_ACCTOUT));
+ if (ret_val == IP_FW_F_ACCTIN)
+ ret_val = 2;
+ else if (ret_val == IP_FW_F_ACCTOUT)
+ ret_val = 3;
+ else
+ ret_val = 1;
+ return ((u_char *) (&ret_val));
+ case IPFWACCBYTES:
+ getnumeric(4);
+ return ((u_char *) (&ret_val));
+ case IPFWACCPACKETS:
+ getnumeric(3);
+ return ((u_char *) (&ret_val));
+ case IPFWACCNSRCPRTS:
+ getnumeric(1);
+ return ((u_char *) (&ret_val));
+ case IPFWACCNDSTPRTS:
+ getnumeric(2);
+ return ((u_char *) (&ret_val));
+ case IPFWACCSRCISRNG:
+ ret_val = ((getflags() & IP_FW_F_SRNG) ? 1 : 2);
+ return ((u_char *) (&ret_val));
+ case IPFWACCDSTISRNG:
+ ret_val = ((getflags() & IP_FW_F_DRNG) ? 1 : 2);
+ return ((u_char *) (&ret_val));
+ case IPFWACCPORT1:
+ case IPFWACCPORT2:
+ case IPFWACCPORT3:
+ case IPFWACCPORT4:
+ case IPFWACCPORT5:
+ case IPFWACCPORT6:
+ case IPFWACCPORT7:
+ case IPFWACCPORT8:
+ case IPFWACCPORT9:
+ case IPFWACCPORT10:
+ getnumeric(5 + (vp->magic) - IPFWACCPORT1);
+ return ((u_char *) (&ret_val));
+ }
+ }
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/misc/ipfwacc.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/misc/ipfwacc.h
new file mode 100644
index 0000000000..d9b6e61f26
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/misc/ipfwacc.h
@@ -0,0 +1,54 @@
+/*
+ * MIB group interface - ipfwacc.h
+ * IP accounting through firewall rules
+ */
+#ifndef _MIBGROUP_IPFWACC_H
+#define _MIBGROUP_IPFWACC_H
+
+/*
+ * we use checkmib from the util_funcs module
+ */
+
+config_require(util_funcs)
+
+ /*
+ * add the mib we implement to the list of default mibs to load
+ */
+config_add_mib(UCD-IPFWACC-MIB)
+
+ /*
+ * Magic number definitions:
+ */
+#define IPFWACCINDEX 1
+#define IPFWACCSRCADDR 2
+#define IPFWACCSRCNM 3
+#define IPFWACCDSTADDR 4
+#define IPFWACCDSTNM 5
+#define IPFWACCVIANAME 6
+#define IPFWACCVIAADDR 7
+#define IPFWACCPROTO 8
+#define IPFWACCBIDIR 9
+#define IPFWACCDIR 10
+#define IPFWACCBYTES 11
+#define IPFWACCPACKETS 12
+#define IPFWACCNSRCPRTS 13
+#define IPFWACCNDSTPRTS 14
+#define IPFWACCSRCISRNG 15
+#define IPFWACCDSTISRNG 16
+#define IPFWACCPORT1 17
+#define IPFWACCPORT2 18
+#define IPFWACCPORT3 19
+#define IPFWACCPORT4 20
+#define IPFWACCPORT5 21
+#define IPFWACCPORT6 22
+#define IPFWACCPORT7 23
+#define IPFWACCPORT8 24
+#define IPFWACCPORT9 25
+#define IPFWACCPORT10 26
+ /*
+ * function definitions
+ */
+ extern void init_ipfwacc(void);
+ extern FindVarMethod var_ipfwacc;
+
+#endif /* _MIBGROUP_IPFWACC_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/notification-log-mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/notification-log-mib.h
new file mode 100644
index 0000000000..925190dfaa
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/notification-log-mib.h
@@ -0,0 +1,2 @@
+config_require(notification-log-mib/notification_log)
+config_require(notification/snmpNotifyTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/notification-log-mib/notification_log.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/notification-log-mib/notification_log.c
new file mode 100644
index 0000000000..61be6170d4
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/notification-log-mib/notification_log.c
@@ -0,0 +1,758 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <net-snmp/agent/ds_agent.h>
+#include <net-snmp/agent/instance.h>
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/table_data.h>
+#include <net-snmp/agent/table_dataset.h>
+#include "notification_log.h"
+
+/*
+ * column number definitions for table nlmLogTable
+ */
+
+#define COLUMN_NLMLOGINDEX 1
+#define COLUMN_NLMLOGTIME 2
+#define COLUMN_NLMLOGDATEANDTIME 3
+#define COLUMN_NLMLOGENGINEID 4
+#define COLUMN_NLMLOGENGINETADDRESS 5
+#define COLUMN_NLMLOGENGINETDOMAIN 6
+#define COLUMN_NLMLOGCONTEXTENGINEID 7
+#define COLUMN_NLMLOGCONTEXTNAME 8
+#define COLUMN_NLMLOGNOTIFICATIONID 9
+
+/*
+ * column number definitions for table nlmLogVariableTable
+ */
+#define COLUMN_NLMLOGVARIABLEINDEX 1
+#define COLUMN_NLMLOGVARIABLEID 2
+#define COLUMN_NLMLOGVARIABLEVALUETYPE 3
+#define COLUMN_NLMLOGVARIABLECOUNTER32VAL 4
+#define COLUMN_NLMLOGVARIABLEUNSIGNED32VAL 5
+#define COLUMN_NLMLOGVARIABLETIMETICKSVAL 6
+#define COLUMN_NLMLOGVARIABLEINTEGER32VAL 7
+#define COLUMN_NLMLOGVARIABLEOCTETSTRINGVAL 8
+#define COLUMN_NLMLOGVARIABLEIPADDRESSVAL 9
+#define COLUMN_NLMLOGVARIABLEOIDVAL 10
+#define COLUMN_NLMLOGVARIABLECOUNTER64VAL 11
+#define COLUMN_NLMLOGVARIABLEOPAQUEVAL 12
+
+static u_long num_received = 0;
+static u_long num_deleted = 0;
+
+static u_long max_logged = 1000; /* goes against the mib default of infinite */
+static u_long max_age = 1440; /* 1440 = 24 hours, which is the mib default */
+
+static netsnmp_table_data_set *nlmLogTable;
+static netsnmp_table_data_set *nlmLogVarTable;
+
+static void
+netsnmp_notif_log_remove_oldest(int count)
+{
+ netsnmp_table_row *deleterow, *tmprow, *deletevarrow;
+
+ DEBUGMSGTL(("notification_log", "deleting %d log entry(s)\n", count));
+
+ deleterow = netsnmp_table_data_set_get_first_row(nlmLogTable);
+ for (; count && deleterow; deleterow = tmprow, --count) {
+ /*
+ * delete contained varbinds
+ * xxx-rks: note that this assumes that only the default
+ * log is used (ie for the first nlmLogTable row, the
+ * first nlmLogVarTable rows will be the right ones).
+ * the right thing to do would be to do a find based on
+ * the nlmLogTable oid.
+ */
+ DEBUGMSGTL(("9:notification_log", " deleting notification\n"));
+ DEBUGIF("9:notification_log") {
+ DEBUGMSGTL(("9:notification_log",
+ " base oid:"));
+ DEBUGMSGOID(("9:notification_log", deleterow->index_oid,
+ deleterow->index_oid_len));
+ DEBUGMSG(("9:notification_log", "\n"));
+ }
+ deletevarrow = netsnmp_table_data_set_get_first_row(nlmLogVarTable);
+ for (; deletevarrow; deletevarrow = tmprow) {
+
+ tmprow = netsnmp_table_data_set_get_next_row(nlmLogVarTable,
+ deletevarrow);
+
+ DEBUGIF("9:notification_log") {
+ DEBUGMSGTL(("9:notification_log",
+ " :"));
+ DEBUGMSGOID(("9:notification_log", deletevarrow->index_oid,
+ deletevarrow->index_oid_len));
+ DEBUGMSG(("9:notification_log", "\n"));
+ }
+ if ((deleterow->index_oid_len == deletevarrow->index_oid_len - 1) &&
+ snmp_oid_compare(deleterow->index_oid,
+ deleterow->index_oid_len,
+ deletevarrow->index_oid,
+ deleterow->index_oid_len) == 0) {
+ DEBUGMSGTL(("9:notification_log", " deleting varbind\n"));
+ netsnmp_table_dataset_remove_and_delete_row(nlmLogVarTable,
+ deletevarrow);
+ }
+ else
+ break;
+ }
+
+ /*
+ * delete the master row
+ */
+ tmprow = netsnmp_table_data_set_get_next_row(nlmLogTable, deleterow);
+ netsnmp_table_dataset_remove_and_delete_row(nlmLogTable,
+ deleterow);
+ num_deleted++;
+ }
+ /** should have deleted all of them */
+ netsnmp_assert(0 == count);
+}
+
+static void
+check_log_size(unsigned int clientreg, void *clientarg)
+{
+ netsnmp_table_row *row;
+ netsnmp_table_data_set_storage *data;
+ u_long count = 0;
+ struct timeval now;
+ u_long uptime;
+
+ gettimeofday(&now, NULL);
+ uptime = netsnmp_timeval_uptime(&now);
+
+ if (!nlmLogTable || !nlmLogTable->table ) {
+ DEBUGMSGTL(("notification_log", "missing log table\n"));
+ return;
+ }
+
+ /*
+ * check max allowed count
+ */
+ count = netsnmp_table_set_num_rows(nlmLogTable);
+ DEBUGMSGTL(("notification_log",
+ "logged notifications %d; max %d\n",
+ count, max_logged));
+ if (count > max_logged) {
+ count = count - max_logged;
+ DEBUGMSGTL(("notification_log", "removing %d extra notifications\n",
+ count));
+ netsnmp_notif_log_remove_oldest(count);
+ }
+
+ /*
+ * check max age
+ */
+ if (0 == max_age)
+ return;
+ count = 0;
+ for (row = netsnmp_table_data_set_get_first_row(nlmLogTable);
+ row;
+ row = netsnmp_table_data_set_get_next_row(nlmLogTable, row)) {
+
+ data = (netsnmp_table_data_set_storage *) row->data;
+ data = netsnmp_table_data_set_find_column(data, COLUMN_NLMLOGTIME);
+
+ if (uptime < ((long)(*(data->data.integer) + max_age * 100 * 60)))
+ break;
+ ++count;
+ }
+
+ if (count) {
+ DEBUGMSGTL(("notification_log", "removing %d expired notifications\n",
+ count));
+ netsnmp_notif_log_remove_oldest(count);
+ }
+}
+
+
+/** Initialize the nlmLogVariableTable table by defining its contents and how it's structured */
+static void
+initialize_table_nlmLogVariableTable(const char * context)
+{
+ static oid nlmLogVariableTable_oid[] =
+ { 1, 3, 6, 1, 2, 1, 92, 1, 3, 2 };
+ size_t nlmLogVariableTable_oid_len =
+ OID_LENGTH(nlmLogVariableTable_oid);
+ netsnmp_table_data_set *table_set;
+ netsnmp_handler_registration *reginfo;
+
+ /*
+ * create the table structure itself
+ */
+ table_set = netsnmp_create_table_data_set("nlmLogVariableTable");
+ nlmLogVarTable = table_set;
+ nlmLogVarTable->table->store_indexes = 1;
+
+ /***************************************************
+ * Adding indexes
+ */
+ /*
+ * declaring the nlmLogName index
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+ "adding index nlmLogName of type ASN_OCTET_STR to table nlmLogVariableTable\n"));
+ netsnmp_table_dataset_add_index(table_set, ASN_OCTET_STR);
+ /*
+ * declaring the nlmLogIndex index
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+ "adding index nlmLogIndex of type ASN_UNSIGNED to table nlmLogVariableTable\n"));
+ netsnmp_table_dataset_add_index(table_set, ASN_UNSIGNED);
+ /*
+ * declaring the nlmLogVariableIndex index
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+ "adding index nlmLogVariableIndex of type ASN_UNSIGNED to table nlmLogVariableTable\n"));
+ netsnmp_table_dataset_add_index(table_set, ASN_UNSIGNED);
+
+ /*
+ * adding column nlmLogVariableIndex of type ASN_UNSIGNED and access
+ * of NoAccess
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+ "adding column nlmLogVariableIndex (#1) of type ASN_UNSIGNED to table nlmLogVariableTable\n"));
+ netsnmp_table_set_add_default_row(table_set,
+ COLUMN_NLMLOGVARIABLEINDEX,
+ ASN_UNSIGNED, 0, NULL, 0);
+ /*
+ * adding column nlmLogVariableID of type ASN_OBJECT_ID and access of
+ * ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+ "adding column nlmLogVariableID (#2) of type ASN_OBJECT_ID to table nlmLogVariableTable\n"));
+ netsnmp_table_set_add_default_row(table_set, COLUMN_NLMLOGVARIABLEID,
+ ASN_OBJECT_ID, 0, NULL, 0);
+ /*
+ * adding column nlmLogVariableValueType of type ASN_INTEGER and
+ * access of ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+ "adding column nlmLogVariableValueType (#3) of type ASN_INTEGER to table nlmLogVariableTable\n"));
+ netsnmp_table_set_add_default_row(table_set,
+ COLUMN_NLMLOGVARIABLEVALUETYPE,
+ ASN_INTEGER, 0, NULL, 0);
+ /*
+ * adding column nlmLogVariableCounter32Val of type ASN_COUNTER and
+ * access of ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+ "adding column nlmLogVariableCounter32Val (#4) of type ASN_COUNTER to table nlmLogVariableTable\n"));
+ netsnmp_table_set_add_default_row(table_set,
+ COLUMN_NLMLOGVARIABLECOUNTER32VAL,
+ ASN_COUNTER, 0, NULL, 0);
+ /*
+ * adding column nlmLogVariableUnsigned32Val of type ASN_UNSIGNED and
+ * access of ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+ "adding column nlmLogVariableUnsigned32Val (#5) of type ASN_UNSIGNED to table nlmLogVariableTable\n"));
+ netsnmp_table_set_add_default_row(table_set,
+ COLUMN_NLMLOGVARIABLEUNSIGNED32VAL,
+ ASN_UNSIGNED, 0, NULL, 0);
+ /*
+ * adding column nlmLogVariableTimeTicksVal of type ASN_TIMETICKS and
+ * access of ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+ "adding column nlmLogVariableTimeTicksVal (#6) of type ASN_TIMETICKS to table nlmLogVariableTable\n"));
+ netsnmp_table_set_add_default_row(table_set,
+ COLUMN_NLMLOGVARIABLETIMETICKSVAL,
+ ASN_TIMETICKS, 0, NULL, 0);
+ /*
+ * adding column nlmLogVariableInteger32Val of type ASN_INTEGER and
+ * access of ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+ "adding column nlmLogVariableInteger32Val (#7) of type ASN_INTEGER to table nlmLogVariableTable\n"));
+ netsnmp_table_set_add_default_row(table_set,
+ COLUMN_NLMLOGVARIABLEINTEGER32VAL,
+ ASN_INTEGER, 0, NULL, 0);
+ /*
+ * adding column nlmLogVariableOctetStringVal of type ASN_OCTET_STR
+ * and access of ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+ "adding column nlmLogVariableOctetStringVal (#8) of type ASN_OCTET_STR to table nlmLogVariableTable\n"));
+ netsnmp_table_set_add_default_row(table_set,
+ COLUMN_NLMLOGVARIABLEOCTETSTRINGVAL,
+ ASN_OCTET_STR, 0, NULL, 0);
+ /*
+ * adding column nlmLogVariableIpAddressVal of type ASN_IPADDRESS and
+ * access of ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+ "adding column nlmLogVariableIpAddressVal (#9) of type ASN_IPADDRESS to table nlmLogVariableTable\n"));
+ netsnmp_table_set_add_default_row(table_set,
+ COLUMN_NLMLOGVARIABLEIPADDRESSVAL,
+ ASN_IPADDRESS, 0, NULL, 0);
+ /*
+ * adding column nlmLogVariableOidVal of type ASN_OBJECT_ID and access
+ * of ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+ "adding column nlmLogVariableOidVal (#10) of type ASN_OBJECT_ID to table nlmLogVariableTable\n"));
+ netsnmp_table_set_add_default_row(table_set,
+ COLUMN_NLMLOGVARIABLEOIDVAL,
+ ASN_OBJECT_ID, 0, NULL, 0);
+ /*
+ * adding column nlmLogVariableCounter64Val of type ASN_COUNTER64 and
+ * access of ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+ "adding column nlmLogVariableCounter64Val (#11) of type ASN_COUNTER64 to table nlmLogVariableTable\n"));
+ netsnmp_table_set_add_default_row(table_set,
+ COLUMN_NLMLOGVARIABLECOUNTER64VAL,
+ ASN_COUNTER64, 0, NULL, 0);
+ /*
+ * adding column nlmLogVariableOpaqueVal of type ASN_OPAQUE and access
+ * of ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogVariableTable",
+ "adding column nlmLogVariableOpaqueVal (#12) of type ASN_OPAQUE to table nlmLogVariableTable\n"));
+ netsnmp_table_set_add_default_row(table_set,
+ COLUMN_NLMLOGVARIABLEOPAQUEVAL,
+ ASN_OPAQUE, 0, NULL, 0);
+
+ /*
+ * registering the table with the master agent
+ */
+ /*
+ * note: if you don't need a subhandler to deal with any aspects of
+ * the request, change nlmLogVariableTable_handler to "NULL"
+ */
+ reginfo =
+ netsnmp_create_handler_registration ("nlmLogVariableTable",
+ NULL,
+ nlmLogVariableTable_oid,
+ nlmLogVariableTable_oid_len,
+ HANDLER_CAN_RWRITE);
+ if (NULL != context)
+ reginfo->contextName = strdup(context);
+ netsnmp_register_table_data_set(reginfo, table_set, NULL);
+}
+
+/** Initialize the nlmLogTable table by defining its contents and how it's structured */
+static void
+initialize_table_nlmLogTable(const char * context)
+{
+ static oid nlmLogTable_oid[] = { 1, 3, 6, 1, 2, 1, 92, 1, 3, 1 };
+ size_t nlmLogTable_oid_len = OID_LENGTH(nlmLogTable_oid);
+ netsnmp_handler_registration *reginfo;
+
+ /*
+ * create the table structure itself
+ */
+ nlmLogTable = netsnmp_create_table_data_set("nlmLogTable");
+
+ /***************************************************
+ * Adding indexes
+ */
+ /*
+ * declaring the nlmLogIndex index
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogTable",
+ "adding index nlmLogName of type ASN_OCTET_STR to table nlmLogTable\n"));
+ netsnmp_table_dataset_add_index(nlmLogTable, ASN_OCTET_STR);
+
+ DEBUGMSGTL(("initialize_table_nlmLogTable",
+ "adding index nlmLogIndex of type ASN_UNSIGNED to table nlmLogTable\n"));
+ netsnmp_table_dataset_add_index(nlmLogTable, ASN_UNSIGNED);
+
+ /*
+ * adding column nlmLogTime of type ASN_TIMETICKS and access of
+ * ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogTable",
+ "adding column nlmLogTime (#2) of type ASN_TIMETICKS to table nlmLogTable\n"));
+ netsnmp_table_set_add_default_row(nlmLogTable, COLUMN_NLMLOGTIME,
+ ASN_TIMETICKS, 0, NULL, 0);
+ /*
+ * adding column nlmLogDateAndTime of type ASN_OCTET_STR and access of
+ * ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogTable",
+ "adding column nlmLogDateAndTime (#3) of type ASN_OCTET_STR to table nlmLogTable\n"));
+ netsnmp_table_set_add_default_row(nlmLogTable,
+ COLUMN_NLMLOGDATEANDTIME,
+ ASN_OCTET_STR, 0, NULL, 0);
+ /*
+ * adding column nlmLogEngineID of type ASN_OCTET_STR and access of
+ * ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogTable",
+ "adding column nlmLogEngineID (#4) of type ASN_OCTET_STR to table nlmLogTable\n"));
+ netsnmp_table_set_add_default_row(nlmLogTable, COLUMN_NLMLOGENGINEID,
+ ASN_OCTET_STR, 0, NULL, 0);
+ /*
+ * adding column nlmLogEngineTAddress of type ASN_OCTET_STR and access
+ * of ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogTable",
+ "adding column nlmLogEngineTAddress (#5) of type ASN_OCTET_STR to table nlmLogTable\n"));
+ netsnmp_table_set_add_default_row(nlmLogTable,
+ COLUMN_NLMLOGENGINETADDRESS,
+ ASN_OCTET_STR, 0, NULL, 0);
+ /*
+ * adding column nlmLogEngineTDomain of type ASN_OBJECT_ID and access
+ * of ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogTable",
+ "adding column nlmLogEngineTDomain (#6) of type ASN_OBJECT_ID to table nlmLogTable\n"));
+ netsnmp_table_set_add_default_row(nlmLogTable,
+ COLUMN_NLMLOGENGINETDOMAIN,
+ ASN_OBJECT_ID, 0, NULL, 0);
+ /*
+ * adding column nlmLogContextEngineID of type ASN_OCTET_STR and
+ * access of ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogTable",
+ "adding column nlmLogContextEngineID (#7) of type ASN_OCTET_STR to table nlmLogTable\n"));
+ netsnmp_table_set_add_default_row(nlmLogTable,
+ COLUMN_NLMLOGCONTEXTENGINEID,
+ ASN_OCTET_STR, 0, NULL, 0);
+ /*
+ * adding column nlmLogContextName of type ASN_OCTET_STR and access of
+ * ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogTable",
+ "adding column nlmLogContextName (#8) of type ASN_OCTET_STR to table nlmLogTable\n"));
+ netsnmp_table_set_add_default_row(nlmLogTable,
+ COLUMN_NLMLOGCONTEXTNAME,
+ ASN_OCTET_STR, 0, NULL, 0);
+ /*
+ * adding column nlmLogNotificationID of type ASN_OBJECT_ID and access
+ * of ReadOnly
+ */
+ DEBUGMSGTL(("initialize_table_nlmLogTable",
+ "adding column nlmLogNotificationID (#9) of type ASN_OBJECT_ID to table nlmLogTable\n"));
+ netsnmp_table_set_add_default_row(nlmLogTable,
+ COLUMN_NLMLOGNOTIFICATIONID,
+ ASN_OBJECT_ID, 0, NULL, 0);
+
+ /*
+ * registering the table with the master agent
+ */
+ /*
+ * note: if you don't need a subhandler to deal with any aspects of
+ * the request, change nlmLogTable_handler to "NULL"
+ */
+ reginfo =
+ netsnmp_create_handler_registration("nlmLogTable", NULL,
+ nlmLogTable_oid,
+ nlmLogTable_oid_len,
+ HANDLER_CAN_RWRITE);
+ if (NULL != context)
+ reginfo->contextName = strdup(context);
+ netsnmp_register_table_data_set(reginfo, nlmLogTable, NULL);
+
+ /*
+ * hmm... 5 minutes seems like a reasonable time to check for out
+ * dated notification logs right?
+ */
+ snmp_alarm_register(300, SA_REPEAT, check_log_size, NULL);
+}
+
+static int
+notification_log_config_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ /*
+ *this handler exists only to act as a trigger when the
+ * configuration variables get set to a value and thus
+ * notifications must be possibly deleted from our archives.
+ */
+ if (reqinfo->mode == MODE_SET_COMMIT)
+ check_log_size(0, NULL);
+ return SNMP_ERR_NOERROR;
+}
+
+void
+init_notification_log(void)
+{
+ static oid my_nlmStatsGlobalNotificationsLogged_oid[] =
+ { 1, 3, 6, 1, 2, 1, 92, 1, 2, 1, 0 };
+ static oid my_nlmStatsGlobalNotificationsBumped_oid[] =
+ { 1, 3, 6, 1, 2, 1, 92, 1, 2, 2, 0 };
+ static oid my_nlmConfigGlobalEntryLimit_oid[] =
+ { 1, 3, 6, 1, 2, 1, 92, 1, 1, 1, 0 };
+ static oid my_nlmConfigGlobalAgeOut_oid[] =
+ { 1, 3, 6, 1, 2, 1, 92, 1, 1, 2, 0 };
+ char * context;
+ char * apptype;
+
+ context = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_NOTIF_LOG_CTX);
+
+ DEBUGMSGTL(("notification_log", "registering with '%s' context\n",
+ SNMP_STRORNULL(context)));
+
+ /*
+ * static variables
+ */
+ netsnmp_register_read_only_counter32_instance_context
+ ("nlmStatsGlobalNotificationsLogged",
+ my_nlmStatsGlobalNotificationsLogged_oid,
+ OID_LENGTH(my_nlmStatsGlobalNotificationsLogged_oid),
+ &num_received, NULL, context);
+
+ netsnmp_register_read_only_counter32_instance_context
+ ("nlmStatsGlobalNotificationsBumped",
+ my_nlmStatsGlobalNotificationsBumped_oid,
+ OID_LENGTH(my_nlmStatsGlobalNotificationsBumped_oid),
+ &num_deleted, NULL, context);
+
+ netsnmp_register_ulong_instance_context("nlmConfigGlobalEntryLimit",
+ my_nlmConfigGlobalEntryLimit_oid,
+ OID_LENGTH
+ (my_nlmConfigGlobalEntryLimit_oid),
+ &max_logged,
+ notification_log_config_handler,
+ context);
+
+ netsnmp_register_ulong_instance_context("nlmConfigGlobalAgeOut",
+ my_nlmConfigGlobalAgeOut_oid,
+ OID_LENGTH
+ (my_nlmConfigGlobalAgeOut_oid),
+ &max_age,
+ notification_log_config_handler,
+ context);
+
+ /*
+ * tables
+ */
+ initialize_table_nlmLogVariableTable(context);
+ initialize_table_nlmLogTable(context);
+
+ /*
+ * disable flag
+ */
+ apptype = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_APPTYPE);
+ netsnmp_ds_register_config(ASN_BOOLEAN, apptype, "dontRetainLogs",
+ NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_DONT_RETAIN_NOTIFICATIONS);
+ netsnmp_ds_register_config(ASN_BOOLEAN, apptype, "doNotRetainNotificationLogs",
+ NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_DONT_RETAIN_NOTIFICATIONS);
+#if 0
+ /* xxx-rks: config for max size; should be peristent too, & tied to mib */
+ netsnmp_ds_register_config(ASN_INTEGER,
+ netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_APPTYPE),
+ "notificationLogMax",
+ NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_NOTIF_LOG_MAX);
+#endif
+}
+
+void
+shutdown_notification_log(void)
+{
+ max_logged = 0;
+ check_log_size(0, NULL);
+}
+
+void
+log_notification(netsnmp_pdu *pdu, netsnmp_transport *transport)
+{
+ long tmpl;
+ struct timeval now;
+ netsnmp_table_row *row;
+
+ static u_long default_num = 0;
+
+ static oid snmptrapoid[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
+ size_t snmptrapoid_len = OID_LENGTH(snmptrapoid);
+ netsnmp_variable_list *vptr;
+ u_char *logdate;
+ size_t logdate_size;
+ time_t timetnow;
+
+ u_long vbcount = 0;
+ u_long tmpul;
+ int col;
+
+ if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_APP_DONT_LOG)) {
+ return;
+ }
+
+ DEBUGMSGTL(("notification_log", "logging something\n"));
+ row = netsnmp_create_table_data_row();
+
+ ++num_received;
+ default_num++;
+
+ /*
+ * indexes to the table
+ */
+ netsnmp_table_row_add_index(row, ASN_OCTET_STR, "default",
+ strlen("default"));
+ netsnmp_table_row_add_index(row, ASN_UNSIGNED, &default_num,
+ sizeof(default_num));
+
+ /*
+ * add the data
+ */
+ gettimeofday(&now, NULL);
+ tmpl = netsnmp_timeval_uptime(&now);
+ netsnmp_set_row_column(row, COLUMN_NLMLOGTIME, ASN_TIMETICKS,
+ (u_char *) & tmpl, sizeof(tmpl));
+ time(&timetnow);
+ logdate = date_n_time(&timetnow, &logdate_size);
+ netsnmp_set_row_column(row, COLUMN_NLMLOGDATEANDTIME, ASN_OCTET_STR,
+ logdate, logdate_size);
+ netsnmp_set_row_column(row, COLUMN_NLMLOGENGINEID, ASN_OCTET_STR,
+ pdu->securityEngineID,
+ pdu->securityEngineIDLen);
+ if (transport && transport->domain == netsnmpUDPDomain) {
+ /*
+ * check for the udp domain
+ */
+ struct sockaddr_in *addr =
+ (struct sockaddr_in *) pdu->transport_data;
+ if (addr) {
+ char buf[sizeof(in_addr_t) +
+ sizeof(addr->sin_port)];
+ in_addr_t locaddr = htonl(addr->sin_addr.s_addr);
+ u_short portnum = htons(addr->sin_port);
+ memcpy(buf, &locaddr, sizeof(in_addr_t));
+ memcpy(buf + sizeof(in_addr_t), &portnum,
+ sizeof(addr->sin_port));
+ netsnmp_set_row_column(row, COLUMN_NLMLOGENGINETADDRESS,
+ ASN_OCTET_STR, buf,
+ sizeof(in_addr_t) +
+ sizeof(addr->sin_port));
+ }
+ }
+ if (transport)
+ netsnmp_set_row_column(row, COLUMN_NLMLOGENGINETDOMAIN,
+ ASN_OBJECT_ID,
+ (const u_char *) transport->domain,
+ sizeof(oid) * transport->domain_length);
+ netsnmp_set_row_column(row, COLUMN_NLMLOGCONTEXTENGINEID,
+ ASN_OCTET_STR, pdu->contextEngineID,
+ pdu->contextEngineIDLen);
+ netsnmp_set_row_column(row, COLUMN_NLMLOGCONTEXTNAME, ASN_OCTET_STR,
+ pdu->contextName, pdu->contextNameLen);
+
+ for (vptr = pdu->variables; vptr; vptr = vptr->next_variable) {
+ if (snmp_oid_compare(snmptrapoid, snmptrapoid_len,
+ vptr->name, vptr->name_length) == 0) {
+ netsnmp_set_row_column(row, COLUMN_NLMLOGNOTIFICATIONID,
+ ASN_OBJECT_ID, vptr->val.string,
+ vptr->val_len);
+
+ } else {
+ netsnmp_table_row *myrow;
+ myrow = netsnmp_create_table_data_row();
+
+ /*
+ * indexes to the table
+ */
+ netsnmp_table_row_add_index(myrow, ASN_OCTET_STR, "default",
+ strlen("default"));
+ netsnmp_table_row_add_index(myrow, ASN_UNSIGNED, &default_num,
+ sizeof(default_num));
+ vbcount++;
+ netsnmp_table_row_add_index(myrow, ASN_UNSIGNED, &vbcount,
+ sizeof(vbcount));
+
+ /*
+ * OID
+ */
+ netsnmp_set_row_column(myrow, COLUMN_NLMLOGVARIABLEID,
+ ASN_OBJECT_ID, (u_char *) vptr->name,
+ vptr->name_length * sizeof(oid));
+
+ /*
+ * value
+ */
+ switch (vptr->type) {
+ case ASN_OBJECT_ID:
+ tmpul = 7;
+ col = COLUMN_NLMLOGVARIABLEOIDVAL;
+ break;
+
+ case ASN_INTEGER:
+ tmpul = 4;
+ col = COLUMN_NLMLOGVARIABLEINTEGER32VAL;
+ break;
+
+ case ASN_UNSIGNED:
+ tmpul = 2;
+ col = COLUMN_NLMLOGVARIABLEUNSIGNED32VAL;
+ break;
+
+ case ASN_COUNTER:
+ tmpul = 1;
+ col = COLUMN_NLMLOGVARIABLECOUNTER32VAL;
+ break;
+
+ case ASN_TIMETICKS:
+ tmpul = 3;
+ col = COLUMN_NLMLOGVARIABLETIMETICKSVAL;
+ break;
+
+ case ASN_OCTET_STR:
+ tmpul = 6;
+ col = COLUMN_NLMLOGVARIABLEOCTETSTRINGVAL;
+ break;
+
+ case ASN_IPADDRESS:
+ tmpul = 5;
+ col = COLUMN_NLMLOGVARIABLEIPADDRESSVAL;
+ break;
+
+ case ASN_COUNTER64:
+ tmpul = 8;
+ col = COLUMN_NLMLOGVARIABLECOUNTER64VAL;
+ break;
+
+ case ASN_OPAQUE:
+ tmpul = 9;
+ col = COLUMN_NLMLOGVARIABLEOPAQUEVAL;
+ break;
+
+ default:
+ /*
+ * unsupported
+ */
+ DEBUGMSGTL(("notification_log",
+ "skipping type %d\n", vptr->type));
+ (void)netsnmp_table_dataset_delete_row(myrow);
+ continue;
+ }
+ netsnmp_set_row_column(myrow, COLUMN_NLMLOGVARIABLEVALUETYPE,
+ ASN_INTEGER, (u_char *) & tmpul,
+ sizeof(tmpul));
+ netsnmp_set_row_column(myrow, col, vptr->type,
+ vptr->val.string, vptr->val_len);
+ DEBUGMSGTL(("notification_log",
+ "adding a row to the variables table\n"));
+ netsnmp_table_dataset_add_row(nlmLogVarTable, myrow);
+ }
+ }
+
+ /*
+ * store the row
+ */
+ netsnmp_table_dataset_add_row(nlmLogTable, row);
+
+ check_log_size(0, NULL);
+ DEBUGMSGTL(("notification_log", "done logging something\n"));
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/notification-log-mib/notification_log.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/notification-log-mib/notification_log.h
new file mode 100644
index 0000000000..9de7c7b758
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/notification-log-mib/notification_log.h
@@ -0,0 +1,20 @@
+#ifndef NOTIFICATION_LOG_H
+#define NOTIFICATION_LOG_H
+#include <net-snmp/agent/agent_handler.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * function declarations
+ */
+void init_notification_log(void);
+void shutdown_notification_log(void);
+
+void log_notification(netsnmp_pdu *pdu, netsnmp_transport *transport);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NOTIFICATION_LOG_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/notification.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/notification.h
new file mode 100644
index 0000000000..ff3a3ea57a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/notification.h
@@ -0,0 +1,4 @@
+
+config_require(notification/snmpNotifyTable)
+config_require(snmp-notification-mib/snmpNotifyFilterTable)
+config_require(notification/snmpNotifyFilterProfileTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/notification/snmpNotifyFilterProfileTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/notification/snmpNotifyFilterProfileTable.c
new file mode 100644
index 0000000000..461526c0be
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/notification/snmpNotifyFilterProfileTable.c
@@ -0,0 +1,828 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent.
+ */
+
+
+/*
+ * This should always be included first before anything else
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+
+/*
+ * minimal include directives
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "snmpNotifyFilterProfileTable.h"
+
+
+/*
+ * snmpNotifyFilterProfileTable_variables_oid:
+ * this is the top level oid that we want to register under. This
+ * is essentially a prefix, with the suffix appearing in the
+ * variable below.
+ */
+
+
+oid snmpNotifyFilterProfileTable_variables_oid[] =
+ { 1, 3, 6, 1, 6, 3, 13, 1, 2 };
+
+
+/*
+ * variable2 snmpNotifyFilterProfileTable_variables:
+ * this variable defines function callbacks and type return information
+ * for the snmpNotifyFilterProfileTable mib section
+ */
+
+
+struct variable2 snmpNotifyFilterProfileTable_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+#define SNMPNOTIFYFILTERPROFILENAME 3
+ {SNMPNOTIFYFILTERPROFILENAME, ASN_OCTET_STR, RWRITE,
+ var_snmpNotifyFilterProfileTable, 2, {1, 1}},
+#define SNMPNOTIFYFILTERPROFILESTORTYPE 4
+ {SNMPNOTIFYFILTERPROFILESTORTYPE, ASN_INTEGER, RWRITE,
+ var_snmpNotifyFilterProfileTable, 2, {1, 2}},
+#define SNMPNOTIFYFILTERPROFILEROWSTATUS 5
+ {SNMPNOTIFYFILTERPROFILEROWSTATUS, ASN_INTEGER, RWRITE,
+ var_snmpNotifyFilterProfileTable, 2, {1, 3}},
+
+};
+/*
+ * (L = length of the oidsuffix)
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+static struct header_complex_index *snmpNotifyFilterProfileTableStorage =
+ NULL;
+
+
+
+
+/*
+ * init_snmpNotifyFilterProfileTable():
+ * Initialization routine. This is called when the agent starts up.
+ * At a minimum, registration of your variables should take place here.
+ */
+void
+init_snmpNotifyFilterProfileTable(void)
+{
+ DEBUGMSGTL(("snmpNotifyFilterProfileTable", "initializing... "));
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("snmpNotifyFilterProfileTable",
+ snmpNotifyFilterProfileTable_variables, variable2,
+ snmpNotifyFilterProfileTable_variables_oid);
+
+
+ /*
+ * register our config handler(s) to deal with registrations
+ */
+ snmpd_register_config_handler("snmpNotifyFilterProfileTable",
+ parse_snmpNotifyFilterProfileTable, NULL,
+ NULL);
+
+
+
+
+ /*
+ * we need to be called back later to store our data
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_snmpNotifyFilterProfileTable, NULL);
+
+
+ /*
+ * place any other initialization junk you need here
+ */
+
+
+ DEBUGMSGTL(("snmpNotifyFilterProfileTable", "done.\n"));
+}
+
+
+/*
+ * snmpNotifyFilterProfileTable_add(): adds a structure node to our data set
+ */
+int
+snmpNotifyFilterProfileTable_add(struct snmpNotifyFilterProfileTable_data
+ *thedata)
+{
+ netsnmp_variable_list *vars = NULL;
+
+
+ DEBUGMSGTL(("snmpNotifyFilterProfileTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR,
+ (u_char *) thedata->snmpTargetParamsName,
+ thedata->snmpTargetParamsNameLen);
+
+ header_complex_add_data(&snmpNotifyFilterProfileTableStorage, vars,
+ thedata);
+ DEBUGMSGTL(("snmpNotifyFilterProfileTable", "registered an entry\n"));
+
+
+ DEBUGMSGTL(("snmpNotifyFilterProfileTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+/*
+ * parse_snmpNotifyFilterProfileTable():
+ * parses .conf file entries needed to configure the mib.
+ */
+void
+parse_snmpNotifyFilterProfileTable(const char *token, char *line)
+{
+ size_t tmpint;
+ struct snmpNotifyFilterProfileTable_data *StorageTmp =
+ SNMP_MALLOC_STRUCT(snmpNotifyFilterProfileTable_data);
+
+ DEBUGMSGTL(("snmpNotifyFilterProfileTable", "parsing config... "));
+
+ if (StorageTmp == NULL) {
+ config_perror("malloc failure");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->snmpTargetParamsName,
+ &StorageTmp->snmpTargetParamsNameLen);
+ if (StorageTmp->snmpTargetParamsName == NULL) {
+ config_perror("invalid specification for snmpTargetParamsName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->snmpNotifyFilterProfileName,
+ &StorageTmp->snmpNotifyFilterProfileNameLen);
+ if (StorageTmp->snmpNotifyFilterProfileName == NULL) {
+ config_perror("invalid specification for snmpNotifyFilterProfileName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->snmpNotifyFilterProfileStorType,
+ &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->
+ snmpNotifyFilterProfileRowStatus, &tmpint);
+
+ snmpNotifyFilterProfileTable_add(StorageTmp);
+
+ DEBUGMSGTL(("snmpNotifyFilterProfileTable", "done.\n"));
+}
+
+
+
+
+/*
+ * store_snmpNotifyFilterProfileTable():
+ * stores .conf file entries needed to configure the mib.
+ */
+int
+store_snmpNotifyFilterProfileTable(int majorID, int minorID,
+ void *serverarg, void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr;
+ size_t tmpint;
+ struct snmpNotifyFilterProfileTable_data *StorageTmp;
+ struct header_complex_index *hcindex;
+
+
+ DEBUGMSGTL(("snmpNotifyFilterProfileTable", "storing data... "));
+
+ for (hcindex = snmpNotifyFilterProfileTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ StorageTmp =
+ (struct snmpNotifyFilterProfileTable_data *) hcindex->data;
+
+ if ((StorageTmp->snmpNotifyFilterProfileStorType == ST_NONVOLATILE) ||
+ (StorageTmp->snmpNotifyFilterProfileStorType == ST_PERMANENT)) {
+
+ memset(line, 0, sizeof(line));
+ strcat(line, "snmpNotifyFilterProfileTable ");
+ cptr = line + strlen(line);
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->snmpTargetParamsName,
+ &StorageTmp->
+ snmpTargetParamsNameLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->
+ snmpNotifyFilterProfileName,
+ &StorageTmp->
+ snmpNotifyFilterProfileNameLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ snmpNotifyFilterProfileStorType,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->
+ snmpNotifyFilterProfileRowStatus,
+ &tmpint);
+
+ snmpd_store_config(line);
+ }
+ }
+ DEBUGMSGTL(("snmpNotifyFilterProfileTable", "done.\n"));
+ return 0;
+}
+
+
+
+
+/*
+ * var_snmpNotifyFilterProfileTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_snmpNotifyFilterProfileTable above.
+ */
+unsigned char *
+var_snmpNotifyFilterProfileTable(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len,
+ WriteMethod ** write_method)
+{
+
+
+ struct snmpNotifyFilterProfileTable_data *StorageTmp = NULL;
+ int found = 1;
+
+
+ DEBUGMSGTL(("snmpNotifyFilterProfileTable",
+ "var_snmpNotifyFilterProfileTable: Entering... \n"));
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp = (struct snmpNotifyFilterProfileTable_data *)
+ header_complex((struct header_complex_index *)
+ snmpNotifyFilterProfileTableStorage, vp, name,
+ length, exact, var_len, write_method)) == NULL) {
+ found = 0;
+ }
+
+ switch (vp->magic) {
+ case SNMPNOTIFYFILTERPROFILENAME:
+ *write_method = write_snmpNotifyFilterProfileName;
+ break;
+
+ case SNMPNOTIFYFILTERPROFILESTORTYPE:
+ *write_method = write_snmpNotifyFilterProfileStorType;
+ break;
+
+ case SNMPNOTIFYFILTERPROFILEROWSTATUS:
+ *write_method = write_snmpNotifyFilterProfileRowStatus;
+ break;
+
+ default:
+ *write_method = NULL;
+ }
+
+ if (!found) {
+ return NULL;
+ }
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+
+ case SNMPNOTIFYFILTERPROFILENAME:
+ *var_len = StorageTmp->snmpNotifyFilterProfileNameLen;
+ return (u_char *) StorageTmp->snmpNotifyFilterProfileName;
+
+ case SNMPNOTIFYFILTERPROFILESTORTYPE:
+ *var_len = sizeof(StorageTmp->snmpNotifyFilterProfileStorType);
+ return (u_char *) & StorageTmp->snmpNotifyFilterProfileStorType;
+
+ case SNMPNOTIFYFILTERPROFILEROWSTATUS:
+ *var_len = sizeof(StorageTmp->snmpNotifyFilterProfileRowStatus);
+ return (u_char *) & StorageTmp->snmpNotifyFilterProfileRowStatus;
+
+
+ default:
+ ERROR_MSG("");
+ }
+ return NULL;
+}
+
+
+
+static struct snmpNotifyFilterProfileTable_data *StorageNew;
+
+int
+write_snmpNotifyFilterProfileName(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct snmpNotifyFilterProfileTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len -
+ (sizeof(snmpNotifyFilterProfileTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("snmpNotifyFilterProfileTable",
+ "write_snmpNotifyFilterProfileName entering action=%d... \n",
+ action));
+ if (action != RESERVE1 &&
+ (StorageTmp = (struct snmpNotifyFilterProfileTable_data *)
+ header_complex((struct header_complex_index *)
+ snmpNotifyFilterProfileTableStorage, NULL,
+ &name[sizeof
+ (snmpNotifyFilterProfileTable_variables_oid)
+ / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL) {
+ if ((StorageTmp = StorageNew) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+ }
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len < 1 || var_val_len > 32) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ tmpvar = StorageTmp->snmpNotifyFilterProfileName;
+ tmplen = StorageTmp->snmpNotifyFilterProfileNameLen;
+ StorageTmp->snmpNotifyFilterProfileName = calloc(1, var_val_len + 1);
+ if (NULL == StorageTmp->snmpNotifyFilterProfileName)
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in string for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ memcpy(StorageTmp->snmpNotifyFilterProfileName, var_val, var_val_len);
+ StorageTmp->snmpNotifyFilterProfileNameLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->snmpNotifyFilterProfileName);
+ StorageTmp->snmpNotifyFilterProfileName = tmpvar;
+ StorageTmp->snmpNotifyFilterProfileNameLen = tmplen;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_snmpNotifyFilterProfileStorType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static int tmpvar;
+ long value = *((long *) var_val);
+ struct snmpNotifyFilterProfileTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len -
+ (sizeof(snmpNotifyFilterProfileTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("snmpNotifyFilterProfileTable",
+ "write_snmpNotifyFilterProfileStorType entering action=%d... \n",
+ action));
+ if (action != RESERVE1 &&
+ (StorageTmp = (struct snmpNotifyFilterProfileTable_data *)
+ header_complex((struct header_complex_index *)
+ snmpNotifyFilterProfileTableStorage, NULL,
+ &name[sizeof
+ (snmpNotifyFilterProfileTable_variables_oid)
+ / sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL) {
+ if ((StorageTmp = StorageNew) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long)) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (value != SNMP_STORAGE_OTHER && value != SNMP_STORAGE_VOLATILE
+ && value != SNMP_STORAGE_NONVOLATILE) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in long_ret for
+ * you to use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in the UNDO case
+ */
+ tmpvar = StorageTmp->snmpNotifyFilterProfileStorType;
+ StorageTmp->snmpNotifyFilterProfileStorType = *((long *) var_val);
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->snmpNotifyFilterProfileStorType = tmpvar;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+
+
+
+int
+write_snmpNotifyFilterProfileRowStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ struct snmpNotifyFilterProfileTable_data *StorageTmp = NULL;
+ static struct snmpNotifyFilterProfileTable_data *StorageDel;
+ size_t newlen =
+ name_len -
+ (sizeof(snmpNotifyFilterProfileTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+ static int old_value;
+ int set_value = *((long *) var_val);
+ netsnmp_variable_list *vars;
+ struct header_complex_index *hciptr;
+
+
+ DEBUGMSGTL(("snmpNotifyFilterProfileTable",
+ "write_snmpNotifyFilterProfileRowStatus entering action=%d... \n",
+ action));
+ StorageTmp = (struct snmpNotifyFilterProfileTable_data *)
+ header_complex((struct header_complex_index *)
+ snmpNotifyFilterProfileTableStorage, NULL,
+ &name[sizeof
+ (snmpNotifyFilterProfileTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL);
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER || var_val == NULL) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long)) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (set_value < 1 || set_value > 6 || set_value == RS_NOTREADY) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+ /*
+ * stage one: test validity
+ */
+ if (StorageTmp == NULL) {
+ /*
+ * create the row now?
+ */
+
+
+ /*
+ * ditch illegal values now
+ */
+ if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else {
+ /*
+ * row exists. Check for a valid state change
+ */
+ if (set_value == RS_CREATEANDGO
+ || set_value == RS_CREATEANDWAIT) {
+ /*
+ * can't create a row that exists
+ */
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if ((set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) &&
+ StorageTmp->snmpNotifyFilterProfileNameLen == 0) {
+ /*
+ * can't activate row without a profile name
+ */
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ /*
+ * XXX: interaction with row storage type needed
+ */
+ }
+
+ /*
+ * memory reseveration, final preparation...
+ */
+ if (StorageTmp == NULL &&
+ (set_value == RS_CREATEANDGO
+ || set_value == RS_CREATEANDWAIT)) {
+ /*
+ * creation
+ */
+ vars = NULL;
+
+ snmp_varlist_add_variable(&vars, NULL, 0,
+ ASN_PRIV_IMPLIED_OCTET_STR, NULL, 0);
+
+ if (header_complex_parse_oid
+ (&
+ (name
+ [sizeof(snmpNotifyFilterProfileTable_variables_oid) /
+ sizeof(oid) + 2]), newlen, vars) != SNMPERR_SUCCESS) {
+ snmp_free_var(vars);
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+
+ StorageNew =
+ SNMP_MALLOC_STRUCT(snmpNotifyFilterProfileTable_data);
+ memdup((u_char **) & (StorageNew->snmpTargetParamsName),
+ vars->val.string, vars->val_len);
+ StorageNew->snmpTargetParamsNameLen = vars->val_len;
+ StorageNew->snmpNotifyFilterProfileStorType = ST_NONVOLATILE;
+
+ StorageNew->snmpNotifyFilterProfileRowStatus = RS_NOTREADY;
+ snmp_free_var(vars);
+ }
+
+
+ break;
+
+ case RESERVE2:
+ break;
+
+ case FREE:
+ /*
+ * XXX: free, zero vars
+ */
+ /*
+ * Release any resources that have been allocated
+ */
+ if (StorageNew != NULL) {
+ SNMP_FREE(StorageNew->snmpTargetParamsName);
+ SNMP_FREE(StorageNew->snmpNotifyFilterProfileName);
+ free(StorageNew);
+ StorageNew = NULL;
+ }
+ break;
+
+
+
+
+ case ACTION:
+ /*
+ * The variable has been stored in set_value for you to
+ * use, and you have just been asked to do something with
+ * it. Note that anything done here must be reversable in
+ * the UNDO case
+ */
+
+ if (StorageTmp == NULL &&
+ (set_value == RS_CREATEANDGO ||
+ set_value == RS_CREATEANDWAIT)) {
+ /*
+ * row creation, so add it
+ */
+ if (StorageNew != NULL)
+ snmpNotifyFilterProfileTable_add(StorageNew);
+ /*
+ * XXX: ack, and if it is NULL?
+ */
+ } else if (set_value != RS_DESTROY) {
+ /*
+ * set the flag?
+ */
+ if (StorageTmp == NULL)
+ return SNMP_ERR_GENERR; /* should never ever get here */
+
+ old_value = StorageTmp->snmpNotifyFilterProfileRowStatus;
+ StorageTmp->snmpNotifyFilterProfileRowStatus =
+ *((long *) var_val);
+ } else {
+ /*
+ * destroy... extract it for now
+ */
+ if (StorageTmp) {
+ hciptr =
+ header_complex_find_entry
+ (snmpNotifyFilterProfileTableStorage, StorageTmp);
+ StorageDel = (struct snmpNotifyFilterProfileTable_data *)
+ header_complex_extract_entry((struct
+ header_complex_index **)
+ &snmpNotifyFilterProfileTableStorage,
+ hciptr);
+ }
+
+ }
+ break;
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ if (StorageTmp == NULL &&
+ (set_value == RS_CREATEANDGO ||
+ set_value == RS_CREATEANDWAIT)) {
+ /*
+ * row creation, so remove it again
+ */
+ hciptr =
+ header_complex_find_entry
+ (snmpNotifyFilterProfileTableStorage, StorageNew);
+ StorageDel = (struct snmpNotifyFilterProfileTable_data *)
+ header_complex_extract_entry((struct header_complex_index
+ **)
+ &snmpNotifyFilterProfileTableStorage,
+ hciptr);
+ /*
+ * XXX: free it
+ */
+ } else if (StorageDel != NULL) {
+ /*
+ * row deletion, so add it again
+ */
+ snmpNotifyFilterProfileTable_add(StorageDel);
+ StorageDel = NULL;
+ } else if (set_value != RS_DESTROY) {
+ if (StorageTmp)
+ StorageTmp->snmpNotifyFilterProfileRowStatus = old_value;
+ }
+ break;
+
+
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ if (StorageDel != NULL) {
+ SNMP_FREE(StorageDel->snmpTargetParamsName);
+ SNMP_FREE(StorageDel->snmpNotifyFilterProfileName);
+ free(StorageDel);
+ StorageDel = NULL;
+ }
+ if (StorageTmp && set_value == RS_CREATEANDGO) {
+ if (StorageTmp->snmpNotifyFilterProfileNameLen)
+ StorageTmp->snmpNotifyFilterProfileRowStatus = RS_ACTIVE;
+ StorageNew = NULL;
+ } else if (StorageTmp && set_value == RS_CREATEANDWAIT) {
+ if (StorageTmp->snmpNotifyFilterProfileNameLen)
+ StorageTmp->snmpNotifyFilterProfileRowStatus = RS_NOTINSERVICE;
+ StorageNew = NULL;
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+char *
+get_FilterProfileName(const char *paramName, size_t paramName_len,
+ size_t * profileName_len)
+{
+ netsnmp_variable_list *vars = NULL;
+ struct snmpNotifyFilterProfileTable_data *data;
+
+ /*
+ * put requested info into var structure
+ */
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR,
+ (u_char *) paramName, paramName_len);
+
+ /*
+ * get the data from the header_complex storage
+ */
+ data = (struct snmpNotifyFilterProfileTable_data *)
+ header_complex_get(snmpNotifyFilterProfileTableStorage, vars);
+
+ /*
+ * free search index
+ */
+ snmp_free_var(vars);
+
+ /*
+ * return the requested information (if this row is active)
+ */
+ if (data && data->snmpNotifyFilterProfileRowStatus == RS_ACTIVE) {
+ *profileName_len = data->snmpNotifyFilterProfileNameLen;
+ return data->snmpNotifyFilterProfileName;
+ }
+
+ *profileName_len = 0;
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/notification/snmpNotifyFilterProfileTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/notification/snmpNotifyFilterProfileTable.h
new file mode 100644
index 0000000000..9734cbe7be
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/notification/snmpNotifyFilterProfileTable.h
@@ -0,0 +1,67 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+
+#ifndef _MIBGROUP_SNMPNOTIFYFILTERPROFILETABLE_H
+#define _MIBGROUP_SNMPNOTIFYFILTERPROFILETABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module
+ */
+
+
+config_require(header_complex)
+
+
+ /*
+ * our storage structure(s)
+ */
+ struct snmpNotifyFilterProfileTable_data {
+
+ char *snmpTargetParamsName;
+ size_t snmpTargetParamsNameLen;
+ char *snmpNotifyFilterProfileName;
+ size_t snmpNotifyFilterProfileNameLen;
+ long snmpNotifyFilterProfileStorType;
+ long snmpNotifyFilterProfileRowStatus;
+
+ };
+
+
+
+
+/*
+ * enum definitions from the covered mib sections
+ */
+
+
+
+
+
+
+
+
+/*
+ * function prototypes
+ */
+
+
+ void init_snmpNotifyFilterProfileTable(void);
+ FindVarMethod var_snmpNotifyFilterProfileTable;
+ void parse_snmpNotifyFilterProfileTable(const char *,
+ char *);
+ SNMPCallback store_snmpNotifyFilterProfileTable;
+
+ WriteMethod write_snmpNotifyFilterProfileName;
+ WriteMethod write_snmpNotifyFilterProfileStorType;
+ WriteMethod write_snmpNotifyFilterProfileRowStatus;
+
+ char *get_FilterProfileName(const char *paramName,
+ size_t paramName_len,
+ size_t * profileName_len);
+
+
+#endif /* _MIBGROUP_SNMPNOTIFYFILTERPROFILETABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/notification/snmpNotifyTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/notification/snmpNotifyTable.c
new file mode 100644
index 0000000000..66845ba5cf
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/notification/snmpNotifyTable.c
@@ -0,0 +1,1141 @@
+/*
+ * This file was generated by mib2c and is intended for use as
+ * a mib module for the ucd-snmp snmpd agent.
+ */
+
+
+/*
+ * This should always be included first before anything else
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+/*
+ * minimal include directives
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "header_complex.h"
+#include "snmpNotifyTable.h"
+#include "snmpNotifyFilterProfileTable.h"
+#include "target/snmpTargetParamsEntry.h"
+#include "target/snmpTargetAddrEntry.h"
+#include "target/target.h"
+#include "snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.h"
+#include <net-snmp/agent/agent_callbacks.h>
+#include <net-snmp/agent/agent_trap.h>
+#include <net-snmp/agent/mib_module_config.h>
+
+#ifdef USING_NOTIFICATION_LOG_MIB_NOTIFICATION_LOG_MODULE
+# include "notification-log-mib/notification_log.h"
+#endif
+
+SNMPCallback store_snmpNotifyTable;
+
+/*
+ * snmpNotifyTable_variables_oid:
+ * this is the top level oid that we want to register under. This
+ * is essentially a prefix, with the suffix appearing in the
+ * variable below.
+ */
+
+
+oid snmpNotifyTable_variables_oid[] =
+ { 1, 3, 6, 1, 6, 3, 13, 1, 1 };
+
+
+/*
+ * variable2 snmpNotifyTable_variables:
+ * this variable defines function callbacks and type return information
+ * for the snmpNotifyTable mib section
+ */
+
+
+struct variable2 snmpNotifyTable_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+#define SNMPNOTIFYTAG 4
+ {SNMPNOTIFYTAG, ASN_OCTET_STR, RWRITE, var_snmpNotifyTable, 2, {1, 2}},
+#define SNMPNOTIFYTYPE 5
+ {SNMPNOTIFYTYPE, ASN_INTEGER, RWRITE, var_snmpNotifyTable, 2, {1, 3}},
+#define SNMPNOTIFYSTORAGETYPE 6
+ {SNMPNOTIFYSTORAGETYPE, ASN_INTEGER, RWRITE, var_snmpNotifyTable, 2,
+ {1, 4}},
+#define SNMPNOTIFYROWSTATUS 7
+ {SNMPNOTIFYROWSTATUS, ASN_INTEGER, RWRITE, var_snmpNotifyTable, 2,
+ {1, 5}},
+
+};
+/*
+ * (L = length of the oidsuffix)
+ */
+
+
+/*
+ * global storage of our data, saved in and configured by header_complex()
+ */
+static struct header_complex_index *snmpNotifyTableStorage = NULL;
+
+static int
+_checkFilter(const char* paramName, netsnmp_pdu *pdu)
+{
+ /*
+ * find appropriate filterProfileEntry
+ */
+ netsnmp_variable_list *var, *trap_var;
+ char *profileName;
+ size_t profileNameLen;
+ struct vacm_viewEntry *vp, *head;
+ int vb_oid_excluded = 0;
+ extern oid snmptrap_oid[];
+ extern size_t snmptrap_oid_len;
+
+ netsnmp_assert(NULL != paramName);
+ netsnmp_assert(NULL != pdu);
+
+ DEBUGMSGTL(("send_notifications", "checking filters...\n"));
+
+ /*
+ A notification originator uses the snmpNotifyFilterTable to filter
+ notifications. A notification filter profile may be associated with
+ a particular entry in the snmpTargetParamsTable. The associated
+ filter profile is identified by an entry in the
+ snmpNotifyFilterProfileTable whose index is equal to the index of the
+ entry in the snmpTargetParamsTable. If no such entry exists in the
+ snmpNotifyFilterProfileTable, no filtering is performed for that
+ management target.
+ */
+ profileName = get_FilterProfileName(paramName, strlen(paramName),
+ &profileNameLen);
+ if (NULL == profileName) {
+ DEBUGMSGTL(("send_notifications", " no matching profile\n"));
+ return 0;
+ }
+
+ /*
+ If such an entry does exist, the value of snmpNotifyFilterProfileName
+ of the entry is compared with the corresponding portion of the index
+ of all active entries in the snmpNotifyFilterTable. All such entries
+ for which this comparison results in an exact match are used for
+ filtering a notification generated using the associated
+ snmpTargetParamsEntry. If no such entries exist, no filtering is
+ performed, and a notification may be sent to the management target.
+ */
+ head = snmpNotifyFilterTable_vacm_view_subtree(profileName);
+ if (NULL == head) {
+ DEBUGMSGTL(("send_notifications", " no matching filters\n"));
+ return 0;
+ }
+
+ /*
+ Otherwise, if matching entries do exist, a notification may be sent
+ if the NOTIFICATION-TYPE OBJECT IDENTIFIER of the notification (this
+ is the value of the element of the variable bindings whose name is
+ snmpTrapOID.0, i.e., the second variable binding) is specifically
+ included, and none of the object instances to be included in the
+ variable-bindings of the notification are specifically excluded by
+ the matching entries.
+ */
+ trap_var = find_varbind_in_list( pdu->variables,
+ snmptrap_oid,
+ snmptrap_oid_len);
+ if (NULL != trap_var) {
+ /*
+ For a notification name, if none match,
+ then the notification name is considered excluded, and the
+ notification should not be sent to this management target.
+ */
+ vp = netsnmp_view_get(head, profileName, trap_var->val.objid,
+ trap_var->val_len / sizeof(oid), VACM_MODE_FIND);
+ if ((NULL == vp) || (SNMP_VIEW_INCLUDED != vp->viewType)) {
+ DEBUGMSGTL(("send_notifications", " filtered (snmpTrapOID.0 "));
+ DEBUGMSGOID(("send_notifications",trap_var->val.objid,
+ trap_var->val_len / sizeof(oid)));
+ DEBUGMSG(("send_notifications", " not included)\n"));
+ free(head);
+ return 1;
+ }
+ }
+
+ /*
+ * check varbinds
+ */
+ for(var = pdu->variables; var; var = var->next_variable) {
+ /*
+ For an
+ object instance, if none match, the object instance is considered
+ included, and the notification may be sent to this management target.
+ */
+
+ if (var == trap_var) {
+ continue;
+ }
+
+ vp = netsnmp_view_get(head, profileName, var->name,
+ var->name_length, VACM_MODE_FIND);
+ if ((NULL != vp) && (SNMP_VIEW_EXCLUDED == vp->viewType)) {
+ DEBUGMSGTL(("send_notifications"," filtered (varbind "));
+ DEBUGMSGOID(("send_notifications",var->name, var->name_length));
+ DEBUGMSG(("send_notifications", " excluded)\n"));
+ vb_oid_excluded = 1;
+ break;
+ }
+ }
+
+ free(head);
+
+ return vb_oid_excluded;
+}
+
+int
+send_notifications(int major, int minor, void *serverarg, void *clientarg)
+{
+ struct header_complex_index *hptr;
+ struct snmpNotifyTable_data *nptr;
+ netsnmp_session *sess, *sptr;
+ netsnmp_pdu *template_pdu = (netsnmp_pdu *) serverarg;
+ int count = 0, send = 0;
+
+ DEBUGMSGTL(("send_notifications", "starting: pdu=%x, vars=%x\n",
+ template_pdu, template_pdu->variables));
+
+ for (hptr = snmpNotifyTableStorage; hptr; hptr = hptr->next) {
+ nptr = (struct snmpNotifyTable_data *) hptr->data;
+ if (nptr->snmpNotifyRowStatus != RS_ACTIVE)
+ continue;
+ if (!nptr->snmpNotifyTag)
+ continue;
+
+ sess = get_target_sessions(nptr->snmpNotifyTag, NULL, NULL);
+
+ /*
+ * filter appropriately, per section 6 of RFC 3413
+ */
+
+ for (sptr = sess; sptr; sptr = sptr->next) {
+ send = 0;
+#ifndef NETSNMP_DISABLE_SNMPV1
+ if (sptr->version == SNMP_VERSION_1 &&
+ minor == SNMPD_CALLBACK_SEND_TRAP1) {
+ send = 1;
+ } else
+#endif
+ if ((sptr->version == SNMP_VERSION_3
+#ifndef NETSNMP_DISABLE_SNMPV2C
+ || sptr->version == SNMP_VERSION_2c
+#endif
+ ) && minor == SNMPD_CALLBACK_SEND_TRAP2) {
+ if (nptr->snmpNotifyType == SNMPNOTIFYTYPE_INFORM) {
+ template_pdu->command = SNMP_MSG_INFORM;
+ } else {
+ template_pdu->command = SNMP_MSG_TRAP2;
+ }
+ send = 1;
+ }
+ if (send && sess->paramName) {
+ int filter = _checkFilter(sess->paramName, template_pdu);
+ if (filter)
+ send = 0;
+ }
+ if (send) {
+ send_trap_to_sess(sptr, template_pdu);
+ ++count;
+ } /* session to send to */
+ } /* for(sptr) */
+ } /* for(hptr) */
+
+ DEBUGMSGTL(("send_notifications", "sent %d notifications\n", count));
+
+#ifdef USING_NOTIFICATION_LOG_MIB_NOTIFICATION_LOG_MODULE
+ if (count)
+ log_notification(template_pdu, NULL);
+#endif
+
+ return 0;
+}
+
+#define MAX_ENTRIES 1024
+
+int
+notifyTable_register_notifications(int major, int minor,
+ void *serverarg, void *clientarg)
+{
+ struct targetAddrTable_struct *ptr;
+ struct targetParamTable_struct *pptr;
+ struct snmpNotifyTable_data *nptr;
+ int confirm, i;
+ char buf[SNMP_MAXBUF_SMALL];
+ netsnmp_transport *t = NULL;
+ struct agent_add_trap_args *args =
+ (struct agent_add_trap_args *) serverarg;
+ netsnmp_session *ss;
+
+ if (!args || !(args->ss)) {
+ return (0);
+ }
+ confirm = args->confirm;
+ ss = args->ss;
+
+ /*
+ * XXX: START move target creation to target code
+ */
+ for (i = 0; i < MAX_ENTRIES; i++) {
+ sprintf(buf, "internal%d", i);
+ if (get_addrForName(buf) == NULL && get_paramEntry(buf) == NULL)
+ break;
+ }
+ if (i == MAX_ENTRIES) {
+ snmp_log(LOG_ERR,
+ "Can't register new trap destination: max limit reached: %d",
+ MAX_ENTRIES);
+ snmp_sess_close(ss);
+ return (0);
+ }
+
+ /*
+ * address
+ */
+ ptr = snmpTargetAddrTable_create();
+ ptr->name = strdup(buf);
+ t = snmp_sess_transport(snmp_sess_pointer(ss));
+ memcpy(ptr->tDomain, t->domain, t->domain_length * sizeof(oid));
+ ptr->tDomainLen = t->domain_length;
+ ptr->tAddressLen = t->remote_length;
+ ptr->tAddress = t->remote;
+
+ ptr->timeout = ss->timeout / 1000;
+ ptr->retryCount = ss->retries;
+ SNMP_FREE(ptr->tagList);
+ ptr->tagList = strdup(ptr->name);
+ ptr->params = strdup(ptr->name);
+ ptr->storageType = ST_READONLY;
+ ptr->rowStatus = RS_ACTIVE;
+ ptr->sess = ss;
+ DEBUGMSGTL(("trapsess", "adding to trap table\n"));
+ snmpTargetAddrTable_add(ptr);
+
+ /*
+ * param
+ */
+ pptr = snmpTargetParamTable_create();
+ pptr->paramName = strdup(buf);
+ pptr->mpModel = ss->version;
+ if (ss->version == SNMP_VERSION_3) {
+ pptr->secModel = ss->securityModel;
+ pptr->secLevel = ss->securityLevel;
+ pptr->secName = (char *) malloc(ss->securityNameLen + 1);
+ memcpy((void *) pptr->secName, (void *) ss->securityName,
+ ss->securityNameLen);
+ pptr->secName[ss->securityNameLen] = 0;
+ }
+#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
+ else {
+ pptr->secModel =
+#ifndef NETSNMP_DISABLE_SNMPV1
+ ss->version == SNMP_VERSION_1 ? SNMP_SEC_MODEL_SNMPv1 :
+#endif
+ SNMP_SEC_MODEL_SNMPv2c;
+ pptr->secLevel = SNMP_SEC_LEVEL_NOAUTH;
+ pptr->secName = NULL;
+ if (ss->community && (ss->community_len > 0)) {
+ pptr->secName = (char *) malloc(ss->community_len + 1);
+ memcpy((void *) pptr->secName, (void *) ss->community,
+ ss->community_len);
+ pptr->secName[ss->community_len] = 0;
+ }
+ }
+#endif
+ pptr->storageType = ST_READONLY;
+ pptr->rowStatus = RS_ACTIVE;
+ snmpTargetParamTable_add(pptr);
+ /*
+ * XXX: END move target creation to target code
+ */
+
+ /*
+ * notify table
+ */
+ nptr = SNMP_MALLOC_STRUCT(snmpNotifyTable_data);
+ nptr->snmpNotifyName = strdup(buf);
+ nptr->snmpNotifyNameLen = strlen(buf);
+ nptr->snmpNotifyTag = strdup(buf);
+ nptr->snmpNotifyTagLen = strlen(buf);
+ nptr->snmpNotifyType = confirm ?
+ SNMPNOTIFYTYPE_INFORM : SNMPNOTIFYTYPE_TRAP;
+ nptr->snmpNotifyStorageType = ST_READONLY;
+ nptr->snmpNotifyRowStatus = RS_ACTIVE;
+
+ snmpNotifyTable_add(nptr);
+ return 0;
+}
+
+
+/*
+ * XXX: this really needs to be done for the target mib entries too.
+ * But we can only trust that we've added stuff here and we don't want
+ * to destroy other valid entries in the target tables, so... Don't
+ * do too many kill -HUPs to your agent as re reading the config file
+ * will be a slow memory leak in the target mib.
+ */
+int
+notifyTable_unregister_notifications(int major, int minor,
+ void *serverarg, void *clientarg)
+{
+ struct header_complex_index *hptr, *nhptr;
+ struct snmpNotifyTable_data *nptr;
+
+ for (hptr = snmpNotifyTableStorage; hptr; hptr = nhptr) {
+ nptr = (struct snmpNotifyTable_data *) hptr->data;
+ nhptr = hptr->next;
+ if (nptr->snmpNotifyStorageType == ST_READONLY) {
+ header_complex_extract_entry(&snmpNotifyTableStorage, hptr);
+ SNMP_FREE(nptr->snmpNotifyName);
+ SNMP_FREE(nptr->snmpNotifyTag);
+ SNMP_FREE(nptr);
+ }
+ }
+ return (0);
+}
+
+/*
+ * init_snmpNotifyTable():
+ * Initialization routine. This is called when the agent starts up.
+ * At a minimum, registration of your variables should take place here.
+ */
+void
+init_snmpNotifyTable(void)
+{
+ DEBUGMSGTL(("snmpNotifyTable", "initializing... "));
+
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("snmpNotifyTable", snmpNotifyTable_variables, variable2,
+ snmpNotifyTable_variables_oid);
+
+
+ /*
+ * register our config handler(s) to deal with registrations
+ */
+ snmpd_register_config_handler("snmpNotifyTable", parse_snmpNotifyTable,
+ NULL, NULL);
+
+
+ /*
+ * we need to be called back later to store our data
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_snmpNotifyTable, NULL);
+
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_SEND_TRAP1, send_notifications,
+ NULL);
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_SEND_TRAP2, send_notifications,
+ NULL);
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_REGISTER_NOTIFICATIONS,
+ notifyTable_register_notifications, NULL);
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_PRE_UPDATE_CONFIG,
+ notifyTable_unregister_notifications, NULL);
+
+ /*
+ * place any other initialization junk you need here
+ */
+
+
+ DEBUGMSGTL(("snmpNotifyTable", "done.\n"));
+}
+
+
+/*
+ * snmpNotifyTable_add(): adds a structure node to our data set
+ */
+int
+snmpNotifyTable_add(struct snmpNotifyTable_data *thedata)
+{
+ netsnmp_variable_list *vars = NULL;
+
+
+ DEBUGMSGTL(("snmpNotifyTable", "adding data... "));
+ /*
+ * add the index variables to the varbind list, which is
+ * used by header_complex to index the data
+ */
+
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR, (u_char *) thedata->snmpNotifyName, thedata->snmpNotifyNameLen); /* snmpNotifyName */
+
+
+
+ header_complex_add_data(&snmpNotifyTableStorage, vars, thedata);
+ DEBUGMSGTL(("snmpNotifyTable", "registered an entry\n"));
+
+
+ DEBUGMSGTL(("snmpNotifyTable", "done.\n"));
+ return SNMPERR_SUCCESS;
+}
+
+
+/*
+ * parse_snmpNotifyTable():
+ * parses .conf file entries needed to configure the mib.
+ */
+void
+parse_snmpNotifyTable(const char *token, char *line)
+{
+ size_t tmpint;
+ struct snmpNotifyTable_data *StorageTmp =
+ SNMP_MALLOC_STRUCT(snmpNotifyTable_data);
+
+
+ DEBUGMSGTL(("snmpNotifyTable", "parsing config... "));
+
+
+ if (StorageTmp == NULL) {
+ config_perror("malloc failure");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->snmpNotifyName,
+ &StorageTmp->snmpNotifyNameLen);
+ if (StorageTmp->snmpNotifyName == NULL) {
+ config_perror("invalid specification for snmpNotifyName");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_OCTET_STR, line,
+ &StorageTmp->snmpNotifyTag,
+ &StorageTmp->snmpNotifyTagLen);
+ if (StorageTmp->snmpNotifyTag == NULL) {
+ config_perror("invalid specification for snmpNotifyTag");
+ return;
+ }
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->snmpNotifyType, &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->snmpNotifyStorageType, &tmpint);
+
+ line =
+ read_config_read_data(ASN_INTEGER, line,
+ &StorageTmp->snmpNotifyRowStatus, &tmpint);
+
+
+
+
+ snmpNotifyTable_add(StorageTmp);
+
+
+ DEBUGMSGTL(("snmpNotifyTable", "done.\n"));
+}
+
+
+
+
+/*
+ * store_snmpNotifyTable():
+ * stores .conf file entries needed to configure the mib.
+ */
+int
+store_snmpNotifyTable(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ char line[SNMP_MAXBUF];
+ char *cptr;
+ size_t tmpint;
+ struct snmpNotifyTable_data *StorageTmp;
+ struct header_complex_index *hcindex;
+
+
+ DEBUGMSGTL(("snmpNotifyTable", "storing data... "));
+
+
+ for (hcindex = snmpNotifyTableStorage; hcindex != NULL;
+ hcindex = hcindex->next) {
+ StorageTmp = (struct snmpNotifyTable_data *) hcindex->data;
+
+ /*
+ * store permanent and nonvolatile rows.
+ * XXX should there be a qualification on RowStatus??
+ */
+ if ((StorageTmp->snmpNotifyStorageType == ST_NONVOLATILE) ||
+ (StorageTmp->snmpNotifyStorageType == ST_PERMANENT) ){
+
+ memset(line, 0, sizeof(line));
+ strcat(line, "snmpNotifyTable ");
+ cptr = line + strlen(line);
+
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->snmpNotifyName,
+ &StorageTmp->snmpNotifyNameLen);
+ cptr =
+ read_config_store_data(ASN_OCTET_STR, cptr,
+ &StorageTmp->snmpNotifyTag,
+ &StorageTmp->snmpNotifyTagLen);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->snmpNotifyType,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->snmpNotifyStorageType,
+ &tmpint);
+ cptr =
+ read_config_store_data(ASN_INTEGER, cptr,
+ &StorageTmp->snmpNotifyRowStatus,
+ &tmpint);
+
+ snmpd_store_config(line);
+ }
+ }
+ DEBUGMSGTL(("snmpNotifyTable", "done.\n"));
+ return 0;
+}
+
+
+
+
+/*
+ * var_snmpNotifyTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_snmpNotifyTable above.
+ */
+unsigned char *
+var_snmpNotifyTable(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ struct snmpNotifyTable_data *StorageTmp = NULL;
+ int found = 1;
+
+ DEBUGMSGTL(("snmpNotifyTable",
+ "var_snmpNotifyTable: Entering... \n"));
+ /*
+ * this assumes you have registered all your data properly
+ */
+ if ((StorageTmp = (struct snmpNotifyTable_data *)
+ header_complex((struct header_complex_index *)
+ snmpNotifyTableStorage, vp, name, length, exact,
+ var_len, write_method)) == NULL) {
+ found = 0;
+ }
+
+ switch (vp->magic) {
+ case SNMPNOTIFYTAG:
+ *write_method = write_snmpNotifyTag;
+ break;
+ case SNMPNOTIFYTYPE:
+ *write_method = write_snmpNotifyType;
+ break;
+ case SNMPNOTIFYSTORAGETYPE:
+ *write_method = write_snmpNotifyStorageType;
+ break;
+ case SNMPNOTIFYROWSTATUS:
+ *write_method = write_snmpNotifyRowStatus;
+ break;
+ default:
+ *write_method = NULL;
+ }
+
+ if (!found) {
+ return NULL;
+ }
+
+ switch (vp->magic) {
+ case SNMPNOTIFYTAG:
+ *var_len = StorageTmp->snmpNotifyTagLen;
+ return (u_char *) StorageTmp->snmpNotifyTag;
+
+ case SNMPNOTIFYTYPE:
+ *var_len = sizeof(StorageTmp->snmpNotifyType);
+ return (u_char *) & StorageTmp->snmpNotifyType;
+
+ case SNMPNOTIFYSTORAGETYPE:
+ *var_len = sizeof(StorageTmp->snmpNotifyStorageType);
+ return (u_char *) & StorageTmp->snmpNotifyStorageType;
+
+ case SNMPNOTIFYROWSTATUS:
+ *var_len = sizeof(StorageTmp->snmpNotifyRowStatus);
+ return (u_char *) & StorageTmp->snmpNotifyRowStatus;
+
+ default:
+ ERROR_MSG("");
+ }
+ return NULL;
+}
+
+static int
+is_delim(const char c)
+{
+ return (c == 0x020 || c == 0x09 || c == 0x0d || c == 0x0b);
+}
+
+int
+snmpTagValid(const char *tag, const size_t tagLen)
+{
+ size_t i = 0;
+
+
+ for (i = 0; i < tagLen; i++) {
+ if (is_delim(tag[i])) {
+ /*
+ * Delimeters aren't allowed.
+ */
+ return 0;
+ }
+ }
+ return 1;
+}
+
+static struct snmpNotifyTable_data *StorageNew;
+
+int
+write_snmpNotifyTag(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *tmpvar;
+ struct snmpNotifyTable_data *StorageTmp = NULL;
+ static size_t tmplen;
+ size_t newlen =
+ name_len - (sizeof(snmpNotifyTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("snmpNotifyTable",
+ "write_snmpNotifyTag entering action=%d... \n", action));
+ if (action != RESERVE1 &&
+ (StorageTmp = (struct snmpNotifyTable_data *)
+ header_complex((struct header_complex_index *)
+ snmpNotifyTableStorage, NULL,
+ &name[sizeof(snmpNotifyTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL) {
+ if ((StorageTmp = StorageNew) == NULL)
+ return SNMP_ERR_NOSUCHNAME; /* remove if you support creation here */
+ }
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_OCTET_STR) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len < 0 || var_val_len > 255) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (!snmpTagValid(var_val, var_val_len)) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+
+
+ case RESERVE2:
+ /*
+ * memory reseveration, final preparation...
+ */
+ tmpvar = StorageTmp->snmpNotifyTag;
+ tmplen = StorageTmp->snmpNotifyTagLen;
+ StorageTmp->snmpNotifyTag = calloc(1, var_val_len + 1);
+ if (NULL == StorageTmp->snmpNotifyTag)
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ break;
+
+
+ case FREE:
+ /*
+ * Release any resources that have been allocated
+ */
+ break;
+
+
+ case ACTION:
+ memcpy(StorageTmp->snmpNotifyTag, var_val, var_val_len);
+ StorageTmp->snmpNotifyTagLen = var_val_len;
+ break;
+
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ SNMP_FREE(StorageTmp->snmpNotifyTag);
+ StorageTmp->snmpNotifyTag = tmpvar;
+ StorageTmp->snmpNotifyTagLen = tmplen;
+ tmpvar = NULL;
+ break;
+
+
+ case COMMIT:
+ /*
+ * Things are working well, so it's now safe to make the change
+ * permanently. Make sure that anything done here can't fail!
+ */
+ SNMP_FREE(tmpvar);
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_snmpNotifyType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static int tmpvar;
+ struct snmpNotifyTable_data *StorageTmp = NULL;
+ long value = *((long *) var_val);
+ size_t newlen =
+ name_len - (sizeof(snmpNotifyTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("snmpNotifyTable",
+ "write_snmpNotifyType entering action=%d... \n", action));
+ if (action != RESERVE1 &&
+ (StorageTmp = (struct snmpNotifyTable_data *)
+ header_complex((struct header_complex_index *)
+ snmpNotifyTableStorage, NULL,
+ &name[sizeof(snmpNotifyTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL) {
+ if ((StorageTmp = StorageNew) == NULL)
+ return SNMP_ERR_NOSUCHNAME;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long)) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (value < 1 || value > 2) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+
+ case ACTION:
+ tmpvar = StorageTmp->snmpNotifyType;
+ StorageTmp->snmpNotifyType = value;
+ break;
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ StorageTmp->snmpNotifyType = tmpvar;
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_snmpNotifyStorageType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static int tmpvar;
+ long value = *((long *) var_val);
+ struct snmpNotifyTable_data *StorageTmp = NULL;
+ size_t newlen =
+ name_len - (sizeof(snmpNotifyTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+
+
+ DEBUGMSGTL(("snmpNotifyTable",
+ "write_snmpNotifyStorageType entering action=%d... \n",
+ action));
+ if (action != RESERVE1 &&
+ (StorageTmp = (struct snmpNotifyTable_data *)
+ header_complex((struct header_complex_index *)
+ snmpNotifyTableStorage, NULL,
+ &name[sizeof(snmpNotifyTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL,
+ NULL)) == NULL) {
+ if ((StorageTmp = StorageNew) == NULL)
+ return SNMP_ERR_NOSUCHNAME;
+ }
+
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long)) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (value != SNMP_STORAGE_OTHER && value != SNMP_STORAGE_VOLATILE
+ && value != SNMP_STORAGE_NONVOLATILE) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+ break;
+
+ case ACTION:
+ tmpvar = StorageTmp->snmpNotifyStorageType;
+ StorageTmp->snmpNotifyStorageType = value;
+ break;
+
+ case UNDO:
+ StorageTmp->snmpNotifyStorageType = tmpvar;
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+write_snmpNotifyRowStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ struct snmpNotifyTable_data *StorageTmp = NULL;
+ static struct snmpNotifyTable_data *StorageDel;
+ size_t newlen =
+ name_len - (sizeof(snmpNotifyTable_variables_oid) / sizeof(oid) +
+ 3 - 1);
+ static int old_value;
+ int set_value = *((long *) var_val);
+ static netsnmp_variable_list *vars, *vp;
+ struct header_complex_index *hciptr;
+
+
+ DEBUGMSGTL(("snmpNotifyTable",
+ "write_snmpNotifyRowStatus entering action=%d... \n",
+ action));
+ StorageTmp = (struct snmpNotifyTable_data *)
+ header_complex((struct header_complex_index *)
+ snmpNotifyTableStorage, NULL,
+ &name[sizeof(snmpNotifyTable_variables_oid) /
+ sizeof(oid) + 3 - 1], &newlen, 1, NULL, NULL);
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER || var_val == NULL) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long)) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (set_value < 1 || set_value > 6 || set_value == RS_NOTREADY) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+ if (StorageTmp == NULL) {
+ /*
+ * create the row now?
+ */
+ /*
+ * ditch illegal values now
+ */
+ if (set_value == RS_ACTIVE || set_value == RS_NOTINSERVICE) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else {
+ /*
+ * row exists. Check for a valid state change
+ */
+ if (set_value == RS_CREATEANDGO
+ || set_value == RS_CREATEANDWAIT) {
+ /*
+ * can't create a row that exists
+ */
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ /*
+ * XXX: interaction with row storage type needed
+ */
+ }
+
+ /*
+ * memory reseveration, final preparation...
+ */
+ if (StorageTmp == NULL &&
+ (set_value == RS_CREATEANDGO
+ || set_value == RS_CREATEANDWAIT)) {
+ /*
+ * creation
+ */
+ vars = NULL;
+
+ snmp_varlist_add_variable(&vars, NULL, 0, ASN_PRIV_IMPLIED_OCTET_STR, NULL, 0); /* snmpNotifyName */
+
+ if (header_complex_parse_oid
+ (&
+ (name
+ [sizeof(snmpNotifyTable_variables_oid) / sizeof(oid) +
+ 2]), newlen, vars) != SNMPERR_SUCCESS) {
+ /*
+ * XXX: free, zero vars
+ */
+ snmp_free_var(vars);
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+ vp = vars;
+
+
+ StorageNew = SNMP_MALLOC_STRUCT(snmpNotifyTable_data);
+ if (StorageNew == NULL) {
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ StorageNew->snmpNotifyName = calloc( 1, vp->val_len + 1 );
+ if (StorageNew->snmpNotifyName == NULL) {
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ memcpy(StorageNew->snmpNotifyName, vp->val.string, vp->val_len);
+ StorageNew->snmpNotifyNameLen = vp->val_len;
+ vp = vp->next_variable;
+
+ /*
+ * default values
+ */
+ StorageNew->snmpNotifyStorageType = ST_NONVOLATILE;
+ StorageNew->snmpNotifyType = SNMPNOTIFYTYPE_TRAP;
+ StorageNew->snmpNotifyTagLen = 0;
+ StorageNew->snmpNotifyTag = (char *) calloc(sizeof(char), 1);
+ if (StorageNew->snmpNotifyTag == NULL) {
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+
+ StorageNew->snmpNotifyRowStatus = set_value;
+ snmp_free_var(vars);
+ }
+ break;
+
+ case RESERVE2:
+ break;
+
+ case FREE:
+ if (StorageNew != NULL) {
+ SNMP_FREE(StorageNew->snmpNotifyTag);
+ SNMP_FREE(StorageNew->snmpNotifyName);
+ free(StorageNew);
+ StorageNew = NULL;
+ }
+ break;
+
+ case ACTION:
+ if (StorageTmp == NULL && (set_value == RS_CREATEANDGO ||
+ set_value == RS_CREATEANDWAIT)) {
+ /*
+ * row creation, so add it
+ */
+ if (StorageNew != NULL) {
+ snmpNotifyTable_add(StorageNew);
+ }
+ } else if (set_value != RS_DESTROY) {
+ /*
+ * set the flag?
+ */
+ if (StorageTmp == NULL)
+ return SNMP_ERR_GENERR; /* should never ever get here */
+
+ old_value = StorageTmp->snmpNotifyRowStatus;
+ StorageTmp->snmpNotifyRowStatus = *((long *) var_val);
+ } else {
+ /*
+ * destroy... extract it for now
+ */
+ if (StorageTmp) {
+ hciptr = header_complex_find_entry(snmpNotifyTableStorage,
+ StorageTmp);
+ StorageDel = (struct snmpNotifyTable_data *)
+ header_complex_extract_entry((struct
+ header_complex_index **)
+ &snmpNotifyTableStorage,
+ hciptr);
+ }
+ }
+ break;
+
+ case UNDO:
+ /*
+ * Back out any changes made in the ACTION case
+ */
+ if (StorageTmp == NULL && (set_value == RS_CREATEANDGO ||
+ set_value == RS_CREATEANDWAIT)) {
+ /*
+ * row creation, so remove it again
+ */
+ hciptr = header_complex_find_entry(snmpNotifyTableStorage,
+ StorageNew);
+ StorageDel = (struct snmpNotifyTable_data *)
+ header_complex_extract_entry((struct header_complex_index
+ **) &snmpNotifyTableStorage,
+ hciptr);
+ /*
+ * XXX: free it
+ */
+ } else if (StorageDel != NULL) {
+ /*
+ * row deletion, so add it again
+ */
+ snmpNotifyTable_add(StorageDel);
+ } else if (set_value != RS_DESTROY) {
+ if (StorageTmp)
+ StorageTmp->snmpNotifyRowStatus = old_value;
+ }
+ break;
+
+ case COMMIT:
+ if (StorageDel != NULL) {
+ SNMP_FREE(StorageDel->snmpNotifyTag);
+ SNMP_FREE(StorageDel->snmpNotifyName);
+ free(StorageDel);
+ StorageDel = NULL;
+ }
+ if (StorageTmp
+ && StorageTmp->snmpNotifyRowStatus == RS_CREATEANDGO) {
+ StorageTmp->snmpNotifyRowStatus = RS_ACTIVE;
+ StorageNew = NULL;
+ } else if (StorageTmp &&
+ StorageTmp->snmpNotifyRowStatus == RS_CREATEANDWAIT) {
+ StorageTmp->snmpNotifyRowStatus = RS_NOTINSERVICE;
+ StorageNew = NULL;
+ }
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/notification/snmpNotifyTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/notification/snmpNotifyTable.h
new file mode 100644
index 0000000000..241c7ce5ea
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/notification/snmpNotifyTable.h
@@ -0,0 +1,73 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+
+#ifndef _MIBGROUP_SNMPNOTIFYTABLE_H
+#define _MIBGROUP_SNMPNOTIFYTABLE_H
+
+
+/*
+ * we may use header_complex from the header_complex module
+ */
+
+
+config_require(header_complex)
+config_require(target)
+config_add_mib(SNMP-NOTIFICATION-MIB)
+
+
+ /*
+ * our storage structure(s)
+ */
+ struct snmpNotifyTable_data {
+
+ char *snmpNotifyName;
+ size_t snmpNotifyNameLen;
+ char *snmpNotifyTag;
+ size_t snmpNotifyTagLen;
+ long snmpNotifyType;
+ long snmpNotifyStorageType;
+ long snmpNotifyRowStatus;
+
+ };
+
+
+
+
+/*
+ * enum definitions from the covered mib sections
+ */
+
+
+
+
+
+
+#define SNMPNOTIFYTYPE_TRAP 1
+#define SNMPNOTIFYTYPE_INFORM 2
+
+
+
+
+/*
+ * function prototypes
+ */
+
+
+ void init_snmpNotifyTable(void);
+ FindVarMethod var_snmpNotifyTable;
+ void parse_snmpNotifyTable(const char *, char *);
+
+ int snmpNotifyTable_add(struct snmpNotifyTable_data
+ *thedata);
+
+ WriteMethod write_snmpNotifyTag;
+ WriteMethod write_snmpNotifyType;
+ WriteMethod write_snmpNotifyStorageType;
+ WriteMethod write_snmpNotifyRowStatus;
+
+
+
+#endif /* _MIBGROUP_SNMPNOTIFYTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib.h
new file mode 100644
index 0000000000..d2844fb9f5
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib.h
@@ -0,0 +1,3 @@
+config_require(sctp-mib/sctpScalars)
+config_require(sctp-mib/sctpTables)
+config_add_mib(SCTP-MIB)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocLocalAddrTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocLocalAddrTable.c
new file mode 100644
index 0000000000..e1e0f16ce8
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocLocalAddrTable.c
@@ -0,0 +1,286 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/table_container.h>
+#include "sctpAssocLocalAddrTable.h"
+
+/*
+ * content of the sctpAssocLocalAddrTable
+ */
+static netsnmp_container *sctpAssocLocalAddrTable_container;
+
+/** Initializes the sctpAssocLocalAddrTable module */
+void
+init_sctpAssocLocalAddrTable(void)
+{
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ initialize_table_sctpAssocLocalAddrTable();
+}
+
+void
+shutdown_sctpAssocLocalAddrTable(void)
+{
+ sctpAssocLocalAddrTable_container_clear
+ (sctpAssocLocalAddrTable_container);
+}
+
+/** Initialize the sctpAssocLocalAddrTable table by defining its contents and how it's structured */
+void
+initialize_table_sctpAssocLocalAddrTable(void)
+{
+ static oid sctpAssocLocalAddrTable_oid[] =
+ { 1, 3, 6, 1, 2, 1, 104, 1, 4 };
+ size_t sctpAssocLocalAddrTable_oid_len =
+ OID_LENGTH(sctpAssocLocalAddrTable_oid);
+ netsnmp_handler_registration *reg = NULL;
+ netsnmp_mib_handler *handler = NULL;
+ netsnmp_container *container = NULL;
+ netsnmp_table_registration_info *table_info = NULL;
+
+ reg =
+ netsnmp_create_handler_registration("sctpAssocLocalAddrTable",
+ sctpAssocLocalAddrTable_handler,
+ sctpAssocLocalAddrTable_oid,
+ sctpAssocLocalAddrTable_oid_len,
+ HANDLER_CAN_RONLY);
+ if (NULL == reg) {
+ snmp_log(LOG_ERR,
+ "error creating handler registration for sctpAssocLocalAddrTable\n");
+ goto bail;
+ }
+
+ container =
+ netsnmp_container_find("sctpAssocLocalAddrTable:table_container");
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "error creating container for sctpAssocLocalAddrTable\n");
+ goto bail;
+ }
+ sctpAssocLocalAddrTable_container = container;
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ if (NULL == table_info) {
+ snmp_log(LOG_ERR,
+ "error allocating table registration for sctpAssocLocalAddrTable\n");
+ goto bail;
+ }
+ netsnmp_table_helper_add_indexes(table_info, ASN_UNSIGNED, /* index: sctpAssocId */
+ ASN_INTEGER, /* index: sctpAssocLocalAddrType */
+ ASN_OCTET_STR, /* index: sctpAssocLocalAddr */
+ 0);
+ table_info->min_column = COLUMN_SCTPASSOCLOCALADDRSTARTTIME;
+ table_info->max_column = COLUMN_SCTPASSOCLOCALADDRSTARTTIME;
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler = netsnmp_container_table_handler_get(table_info, container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ if (NULL == handler) {
+ snmp_log(LOG_ERR,
+ "error allocating table registration for sctpAssocLocalAddrTable\n");
+ goto bail;
+ }
+ if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
+ snmp_log(LOG_ERR,
+ "error injecting container_table handler for sctpAssocLocalAddrTable\n");
+ goto bail;
+ }
+ handler = NULL; /* reg has it, will reuse below */
+
+
+ /*
+ * register the table
+ */
+ if (SNMPERR_SUCCESS != netsnmp_register_table(reg, table_info)) {
+ snmp_log(LOG_ERR,
+ "error registering table handler for sctpAssocLocalAddrTable\n");
+ goto bail;
+ }
+
+ /*
+ * Initialise the contents of the table here
+ */
+
+
+ return; /* ok */
+
+ /*
+ * Some error occurred during registration. Clean up and bail.
+ */
+ bail: /* not ok */
+
+ if (handler)
+ netsnmp_handler_free(handler);
+
+ if (table_info)
+ netsnmp_table_registration_info_free(table_info);
+
+ if (container)
+ CONTAINER_FREE(container);
+
+ if (reg)
+ netsnmp_handler_registration_free(reg);
+}
+
+/** handles requests for the sctpAssocLocalAddrTable table */
+int
+sctpAssocLocalAddrTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ sctpAssocLocalAddrTable_entry *table_entry;
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ if (request->processed)
+ continue;
+ table_entry = (sctpAssocLocalAddrTable_entry *)
+ netsnmp_container_table_extract_context(request);
+ table_info = netsnmp_extract_table_info(request);
+ if ((NULL == table_entry) || (NULL == table_info)) {
+ snmp_log(LOG_ERR,
+ "could not extract table entry or info for sctpAssocLocalAddrTable\n");
+ snmp_set_var_typed_value(request->requestvb,
+ SNMP_ERR_GENERR, NULL, 0);
+ continue;
+ }
+
+ switch (table_info->colnum) {
+ case COLUMN_SCTPASSOCLOCALADDRSTARTTIME:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_TIMETICKS,
+ table_entry->sctpAssocLocalAddrStartTime);
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHOBJECT);
+ break;
+ }
+ }
+ break;
+
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+sctpAssocLocalAddrTable_entry *
+sctpAssocLocalAddrTable_entry_create(void)
+{
+ sctpAssocLocalAddrTable_entry *entry =
+ SNMP_MALLOC_TYPEDEF(sctpAssocLocalAddrTable_entry);
+ if (entry != NULL) {
+ entry->oid_index.len = SCTP_ASSOC_LOCAL_ADDR_TABLE_INDEX_SIZE;
+ entry->oid_index.oids = entry->oid_tmp;
+ }
+
+ return entry;
+}
+
+int
+sctpAssocLocalAddrTable_entry_update_index(sctpAssocLocalAddrTable_entry *
+ entry)
+{
+ int err = 0;
+
+ netsnmp_variable_list var_sctpAssocId;
+ netsnmp_variable_list var_sctpAssocLocalAddrType;
+ netsnmp_variable_list var_sctpAssocLocalAddr;
+
+ /*
+ * prepare the values to be converted
+ */
+ memset(&var_sctpAssocId, 0, sizeof(var_sctpAssocId));
+ var_sctpAssocId.type = ASN_UNSIGNED;
+ memset(&var_sctpAssocLocalAddrType, 0,
+ sizeof(var_sctpAssocLocalAddrType));
+ var_sctpAssocLocalAddrType.type = ASN_INTEGER;
+ memset(&var_sctpAssocLocalAddr, 0, sizeof(var_sctpAssocLocalAddr));
+ var_sctpAssocLocalAddr.type = ASN_OCTET_STR;
+
+ var_sctpAssocId.next_variable = &var_sctpAssocLocalAddrType;
+ var_sctpAssocLocalAddrType.next_variable = &var_sctpAssocLocalAddr;
+ var_sctpAssocLocalAddr.next_variable = NULL;
+
+ snmp_set_var_value(&var_sctpAssocId, (u_char *) & entry->sctpAssocId,
+ sizeof(entry->sctpAssocId));
+ snmp_set_var_value(&var_sctpAssocLocalAddrType,
+ (u_char *) & entry->sctpAssocLocalAddrType,
+ sizeof(entry->sctpAssocLocalAddrType));
+ snmp_set_var_value(&var_sctpAssocLocalAddr,
+ (u_char *) & entry->sctpAssocLocalAddr,
+ entry->sctpAssocLocalAddr_len *
+ sizeof(entry->sctpAssocLocalAddr[0]));
+
+ /*
+ * convert it
+ */
+ err =
+ build_oid_noalloc(entry->oid_index.oids, entry->oid_index.len,
+ &entry->oid_index.len, NULL, 0,
+ &var_sctpAssocId);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * release any memory allocated during the conversion
+ */
+ snmp_reset_var_buffers(&var_sctpAssocId);
+
+ return err;
+
+}
+
+void
+sctpAssocLocalAddrTable_entry_copy(sctpAssocLocalAddrTable_entry * from,
+ sctpAssocLocalAddrTable_entry * to)
+{
+ memcpy(to, from, sizeof(sctpAssocLocalAddrTable_entry));
+ to->oid_index.oids = to->oid_tmp;
+}
+
+void
+sctpAssocLocalAddrTable_entry_free(sctpAssocLocalAddrTable_entry * entry)
+{
+ if (entry != NULL)
+ SNMP_FREE(entry);
+}
+
+netsnmp_container *
+sctpAssocLocalAddrTable_get_container(void)
+{
+ return sctpAssocLocalAddrTable_container;
+}
+
+static void
+sctpAssocLocalAddrTable_entry_clear(void *what, void *magic)
+{
+ sctpAssocLocalAddrTable_entry_free(what);
+}
+
+void
+sctpAssocLocalAddrTable_container_clear(netsnmp_container *container)
+{
+ CONTAINER_CLEAR(container, sctpAssocLocalAddrTable_entry_clear, NULL);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocLocalAddrTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocLocalAddrTable.h
new file mode 100644
index 0000000000..c2cc0559bb
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocLocalAddrTable.h
@@ -0,0 +1,60 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * $
+ */
+#ifndef SCTPASSOCLOCALADDRTABLE_H
+#define SCTPASSOCLOCALADDRTABLE_H
+
+#include "sctpTables_common.h"
+
+/*
+ * function declarations
+ */
+void init_sctpAssocLocalAddrTable(void);
+void shutdown_sctpAssocLocalAddrTable(void);
+void initialize_table_sctpAssocLocalAddrTable(void);
+Netsnmp_Node_Handler sctpAssocLocalAddrTable_handler;
+
+/*
+ * column number definitions for table sctpAssocLocalAddrTable
+ */
+#define COLUMN_SCTPASSOCLOCALADDRTYPE 1
+#define COLUMN_SCTPASSOCLOCALADDR 2
+#define COLUMN_SCTPASSOCLOCALADDRSTARTTIME 3
+
+#define SCTP_ASSOC_LOCAL_ADDR_TABLE_INDEX_SIZE 100
+/** Typical data structure for a row entry */
+struct sctpAssocLocalAddrTable_entry_s {
+ netsnmp_index oid_index;
+ oid oid_tmp[SCTP_ASSOC_LOCAL_ADDR_TABLE_INDEX_SIZE];
+
+ /*
+ * Index values
+ */
+ u_long sctpAssocId;
+ u_long sctpAssocLocalAddrType;
+ char sctpAssocLocalAddr[SCTP_IPADDRESS_SIZE];
+ u_long sctpAssocLocalAddr_len;
+
+ /*
+ * Column values
+ */
+ u_long sctpAssocLocalAddrStartTime;
+
+ int valid;
+};
+
+sctpAssocLocalAddrTable_entry *sctpAssocLocalAddrTable_entry_create(void);
+int
+sctpAssocLocalAddrTable_entry_update_index(sctpAssocLocalAddrTable_entry *
+ entry);
+void
+sctpAssocLocalAddrTable_entry_copy(sctpAssocLocalAddrTable_entry * from,
+ sctpAssocLocalAddrTable_entry * to);
+void
+ sctpAssocLocalAddrTable_entry_free(sctpAssocLocalAddrTable_entry * entry);
+
+void sctpAssocLocalAddrTable_container_clear(netsnmp_container
+ *container);
+
+#endif /* SCTPASSOCLOCALADDRTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocRemAddrTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocRemAddrTable.c
new file mode 100644
index 0000000000..4c14ce6c50
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocRemAddrTable.c
@@ -0,0 +1,333 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/table_container.h>
+#include "sctpAssocRemAddrTable.h"
+
+/*
+ * content of the sctpAssocRemAddrTable
+ */
+static netsnmp_container *sctpAssocRemAddrTable_container;
+
+/** Initializes the sctpAssocRemAddrTable module */
+void
+init_sctpAssocRemAddrTable(void)
+{
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ initialize_table_sctpAssocRemAddrTable();
+}
+
+void
+shutdown_sctpAssocRemAddrTable(void)
+{
+ sctpAssocRemAddrTable_container_clear(sctpAssocRemAddrTable_container);
+}
+
+/** Initialize the sctpAssocRemAddrTable table by defining its contents and how it's structured */
+void
+initialize_table_sctpAssocRemAddrTable(void)
+{
+ static oid sctpAssocRemAddrTable_oid[] =
+ { 1, 3, 6, 1, 2, 1, 104, 1, 5 };
+ size_t sctpAssocRemAddrTable_oid_len =
+ OID_LENGTH(sctpAssocRemAddrTable_oid);
+ netsnmp_handler_registration *reg = NULL;
+ netsnmp_mib_handler *handler = NULL;
+ netsnmp_container *container = NULL;
+ netsnmp_table_registration_info *table_info = NULL;
+
+ reg =
+ netsnmp_create_handler_registration("sctpAssocRemAddrTable",
+ sctpAssocRemAddrTable_handler,
+ sctpAssocRemAddrTable_oid,
+ sctpAssocRemAddrTable_oid_len,
+ HANDLER_CAN_RONLY);
+ if (NULL == reg) {
+ snmp_log(LOG_ERR,
+ "error creating handler registration for sctpAssocRemAddrTable\n");
+ goto bail;
+ }
+
+ container =
+ netsnmp_container_find("sctpAssocRemAddrTable:table_container");
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "error creating container for sctpAssocRemAddrTable\n");
+ goto bail;
+ }
+ sctpAssocRemAddrTable_container = container;
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ if (NULL == table_info) {
+ snmp_log(LOG_ERR,
+ "error allocating table registration for sctpAssocRemAddrTable\n");
+ goto bail;
+ }
+ netsnmp_table_helper_add_indexes(table_info, ASN_UNSIGNED, /* index: sctpAssocId */
+ ASN_INTEGER, /* index: sctpAssocRemAddrType */
+ ASN_OCTET_STR, /* index: sctpAssocRemAddr */
+ 0);
+ table_info->min_column = COLUMN_SCTPASSOCREMADDRACTIVE;
+ table_info->max_column = COLUMN_SCTPASSOCREMADDRSTARTTIME;
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler = netsnmp_container_table_handler_get(table_info, container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ if (NULL == handler) {
+ snmp_log(LOG_ERR,
+ "error allocating table registration for sctpAssocRemAddrTable\n");
+ goto bail;
+ }
+ if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
+ snmp_log(LOG_ERR,
+ "error injecting container_table handler for sctpAssocRemAddrTable\n");
+ goto bail;
+ }
+ handler = NULL; /* reg has it, will reuse below */
+
+ /*
+ * register the table
+ */
+ if (SNMPERR_SUCCESS != netsnmp_register_table(reg, table_info)) {
+ snmp_log(LOG_ERR,
+ "error registering table handler for sctpAssocRemAddrTable\n");
+ goto bail;
+ }
+
+ /*
+ * Initialise the contents of the table here
+ */
+
+
+ return; /* ok */
+
+ /*
+ * Some error occurred during registration. Clean up and bail.
+ */
+ bail: /* not ok */
+
+ if (handler)
+ netsnmp_handler_free(handler);
+
+ if (table_info)
+ netsnmp_table_registration_info_free(table_info);
+
+ if (container)
+ CONTAINER_FREE(container);
+
+ if (reg)
+ netsnmp_handler_registration_free(reg);
+}
+
+
+/** handles requests for the sctpAssocRemAddrTable table */
+int
+sctpAssocRemAddrTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ sctpAssocRemAddrTable_entry *table_entry;
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ if (request->processed)
+ continue;
+ table_entry = (sctpAssocRemAddrTable_entry *)
+ netsnmp_container_table_extract_context(request);
+ table_info = netsnmp_extract_table_info(request);
+ if ((NULL == table_entry) || (NULL == table_info)) {
+ snmp_log(LOG_ERR,
+ "could not extract table entry or info for sctpAssocRemAddrTable\n");
+ snmp_set_var_typed_value(request->requestvb,
+ SNMP_ERR_GENERR, NULL, 0);
+ continue;
+ }
+
+ switch (table_info->colnum) {
+ case COLUMN_SCTPASSOCREMADDRACTIVE:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ table_entry->sctpAssocRemAddrActive);
+ break;
+ case COLUMN_SCTPASSOCREMADDRHBACTIVE:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ table_entry->sctpAssocRemAddrHBActive);
+ break;
+ case COLUMN_SCTPASSOCREMADDRRTO:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_UNSIGNED,
+ table_entry->sctpAssocRemAddrRTO);
+ break;
+ case COLUMN_SCTPASSOCREMADDRMAXPATHRTX:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_UNSIGNED,
+ table_entry->sctpAssocRemAddrMaxPathRtx);
+ break;
+ case COLUMN_SCTPASSOCREMADDRRTX:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb, ASN_COUNTER,
+ table_entry->sctpAssocRemAddrRtx);
+ break;
+ case COLUMN_SCTPASSOCREMADDRSTARTTIME:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_TIMETICKS,
+ table_entry->sctpAssocRemAddrStartTime);
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHOBJECT);
+ break;
+ }
+ }
+ break;
+
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+sctpAssocRemAddrTable_entry *
+sctpAssocRemAddrTable_entry_create(void)
+{
+ sctpAssocRemAddrTable_entry *entry =
+ SNMP_MALLOC_TYPEDEF(sctpAssocRemAddrTable_entry);
+ if (entry != NULL) {
+ entry->oid_index.len = SCTP_ASSOC_REM_ADDR_TABLE_INDEX_SIZE;
+ entry->oid_index.oids = entry->oid_tmp;
+ }
+
+ return entry;
+}
+
+int
+sctpAssocRemAddrTable_entry_update_index(sctpAssocRemAddrTable_entry *
+ entry)
+{
+ int err = 0;
+
+ netsnmp_variable_list var_sctpAssocId;
+ netsnmp_variable_list var_sctpAssocRemAddrType;
+ netsnmp_variable_list var_sctpAssocRemAddr;
+
+ /*
+ * prepare the values to be converted
+ */
+ memset(&var_sctpAssocId, 0, sizeof(var_sctpAssocId));
+ var_sctpAssocId.type = ASN_UNSIGNED;
+ memset(&var_sctpAssocRemAddrType, 0, sizeof(var_sctpAssocRemAddrType));
+ var_sctpAssocRemAddrType.type = ASN_INTEGER;
+ memset(&var_sctpAssocRemAddr, 0, sizeof(var_sctpAssocRemAddr));
+ var_sctpAssocRemAddr.type = ASN_OCTET_STR;
+
+ var_sctpAssocId.next_variable = &var_sctpAssocRemAddrType;
+ var_sctpAssocRemAddrType.next_variable = &var_sctpAssocRemAddr;
+ var_sctpAssocRemAddr.next_variable = NULL;
+
+ snmp_set_var_value(&var_sctpAssocId, (u_char *) & entry->sctpAssocId,
+ sizeof(entry->sctpAssocId));
+ snmp_set_var_value(&var_sctpAssocRemAddrType,
+ (u_char *) & entry->sctpAssocRemAddrType,
+ sizeof(entry->sctpAssocRemAddrType));
+ snmp_set_var_value(&var_sctpAssocRemAddr,
+ (u_char *) & entry->sctpAssocRemAddr,
+ entry->sctpAssocRemAddr_len *
+ sizeof(entry->sctpAssocRemAddr[0]));
+
+ /*
+ * convert it
+ */
+ err =
+ build_oid_noalloc(entry->oid_index.oids, entry->oid_index.len,
+ &entry->oid_index.len, NULL, 0,
+ &var_sctpAssocId);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * release any memory allocated during the conversion
+ */
+ snmp_reset_var_buffers(&var_sctpAssocId);
+
+ return err;
+
+}
+
+void
+sctpAssocRemAddrTable_entry_copy(sctpAssocRemAddrTable_entry * from,
+ sctpAssocRemAddrTable_entry * to)
+{
+ memcpy(to, from, sizeof(sctpAssocRemAddrTable_entry));
+ to->oid_index.oids = to->oid_tmp;
+}
+
+void
+sctpAssocRemAddrTable_entry_free(sctpAssocRemAddrTable_entry * entry)
+{
+ if (entry != NULL)
+ SNMP_FREE(entry);
+}
+
+netsnmp_container *
+sctpAssocRemAddrTable_get_container(void)
+{
+ return sctpAssocRemAddrTable_container;
+}
+
+
+static void
+sctpAssocRemAddrTable_entry_clear(void *what, void *magic)
+{
+ sctpAssocRemAddrTable_entry_free(what);
+}
+
+void
+sctpAssocRemAddrTable_container_clear(netsnmp_container *container)
+{
+ CONTAINER_CLEAR(container, sctpAssocRemAddrTable_entry_clear, NULL);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocRemAddrTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocRemAddrTable.h
new file mode 100644
index 0000000000..cc65c7e415
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocRemAddrTable.h
@@ -0,0 +1,71 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * $
+ */
+#ifndef SCTPASSOCREMADDRTABLE_H
+#define SCTPASSOCREMADDRTABLE_H
+
+#include "sctpTables_common.h"
+
+/*
+ * function declarations
+ */
+void init_sctpAssocRemAddrTable(void);
+void shutdown_sctpAssocRemAddrTable(void);
+void initialize_table_sctpAssocRemAddrTable(void);
+Netsnmp_Node_Handler sctpAssocRemAddrTable_handler;
+
+/*
+ * column number definitions for table sctpAssocRemAddrTable
+ */
+#define COLUMN_SCTPASSOCREMADDRTYPE 1
+#define COLUMN_SCTPASSOCREMADDR 2
+#define COLUMN_SCTPASSOCREMADDRACTIVE 3
+#define COLUMN_SCTPASSOCREMADDRHBACTIVE 4
+#define COLUMN_SCTPASSOCREMADDRRTO 5
+#define COLUMN_SCTPASSOCREMADDRMAXPATHRTX 6
+#define COLUMN_SCTPASSOCREMADDRRTX 7
+#define COLUMN_SCTPASSOCREMADDRSTARTTIME 8
+
+
+#define SCTP_ASSOC_REM_ADDR_TABLE_INDEX_SIZE 100
+/** Typical data structure for a row entry */
+struct sctpAssocRemAddrTable_entry_s {
+ netsnmp_index oid_index;
+ oid oid_tmp[SCTP_ASSOC_REM_ADDR_TABLE_INDEX_SIZE];
+
+ /*
+ * Index values
+ */
+ u_long sctpAssocId;
+ u_long sctpAssocRemAddrType;
+ char sctpAssocRemAddr[SCTP_IPADDRESS_SIZE];
+ u_long sctpAssocRemAddr_len;
+
+ /*
+ * Column values
+ */
+ long sctpAssocRemAddrActive;
+ long sctpAssocRemAddrHBActive;
+ u_long sctpAssocRemAddrRTO;
+ u_long sctpAssocRemAddrMaxPathRtx;
+ u_long sctpAssocRemAddrRtx;
+ u_long sctpAssocRemAddrStartTime;
+
+ int valid;
+};
+
+sctpAssocRemAddrTable_entry *sctpAssocRemAddrTable_entry_create(void);
+int
+sctpAssocRemAddrTable_entry_update_index(sctpAssocRemAddrTable_entry *
+ entry);
+void
+sctpAssocRemAddrTable_entry_copy(sctpAssocRemAddrTable_entry * from,
+ sctpAssocRemAddrTable_entry * to);
+void
+sctpAssocRemAddrTable_entry_free(sctpAssocRemAddrTable_entry * entry);
+
+void
+sctpAssocRemAddrTable_container_clear(netsnmp_container *container);
+
+#endif /* SCTPASSOCREMADDRTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocTable.c
new file mode 100644
index 0000000000..b5d4dee60c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocTable.c
@@ -0,0 +1,517 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * mib2c -c mib2c.container.conf
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/table_container.h>
+#include "sctpAssocTable.h"
+
+static void _cache_free(netsnmp_cache * cache, void *magic);
+static int _cache_load(netsnmp_cache * cache, void *vmagic);
+
+/*
+ * content of the sctpAssocTable
+ */
+static netsnmp_container *sctpAssocTable_container;
+
+/** Initializes the sctpAssocTable module */
+void
+init_sctpAssocTable(void)
+{
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ initialize_table_sctpAssocTable();
+}
+
+void
+shutdown_sctpAssocTable(void)
+{
+ sctpAssocTable_container_clear(sctpAssocTable_container);
+}
+
+/** Initialize the sctpAssocTable table by defining its contents and how it's structured */
+void
+initialize_table_sctpAssocTable(void)
+{
+ static oid sctpAssocTable_oid[] = { 1, 3, 6, 1, 2, 1, 104, 1, 3 };
+ size_t sctpAssocTable_oid_len =
+ OID_LENGTH(sctpAssocTable_oid);
+ netsnmp_handler_registration *reg = NULL;
+ netsnmp_mib_handler *handler = NULL;
+ netsnmp_container *container = NULL;
+ netsnmp_table_registration_info *table_info = NULL;
+ netsnmp_cache *cache = NULL;
+
+ reg =
+ netsnmp_create_handler_registration("sctpAssocTable",
+ sctpAssocTable_handler,
+ sctpAssocTable_oid,
+ sctpAssocTable_oid_len,
+ HANDLER_CAN_RWRITE);
+ if (NULL == reg) {
+ snmp_log(LOG_ERR,
+ "error creating handler registration for sctpAssocTable\n");
+ goto bail;
+ }
+ /** should a set on a non-existent row create a new one? */
+ /** reg->modes |= HANDLER_CAN_NOT_CREATE; */
+
+ container = netsnmp_container_find("sctpAssocTable:table_container");
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "error creating container for sctpAssocTable\n");
+ goto bail;
+ }
+ sctpAssocTable_container = container;
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ if (NULL == table_info) {
+ snmp_log(LOG_ERR,
+ "error allocating table registration for sctpAssocTable\n");
+ goto bail;
+ }
+ netsnmp_table_helper_add_indexes(table_info, ASN_UNSIGNED, /* index: sctpAssocId */
+ 0);
+ table_info->min_column = COLUMN_SCTPASSOCREMHOSTNAME;
+ table_info->max_column = COLUMN_SCTPASSOCDISCONTINUITYTIME;
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler = netsnmp_container_table_handler_get(table_info, container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ if (NULL == handler) {
+ snmp_log(LOG_ERR,
+ "error allocating table registration for sctpAssocTable\n");
+ goto bail;
+ }
+ if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
+ snmp_log(LOG_ERR,
+ "error injecting container_table handler for sctpAssocTable\n");
+ goto bail;
+ }
+ handler = NULL; /* reg has it, will reuse below */
+
+ /*************************************************
+ *
+ * inject cache helper
+ */
+ cache = netsnmp_cache_create(SCTP_TABLES_CACHE_TIMEOUT, /* timeout in seconds */
+ _cache_load, _cache_free,
+ sctpAssocTable_oid,
+ sctpAssocTable_oid_len);
+
+ if (NULL == cache) {
+ snmp_log(LOG_ERR, "error creating cache for sctpAssocTable\n");
+ goto bail;
+ }
+ cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET
+ | NETSNMP_CACHE_AUTO_RELOAD | NETSNMP_CACHE_PRELOAD;
+ cache->magic = container;
+
+ handler = netsnmp_cache_handler_get(cache);
+ if (NULL == handler) {
+ snmp_log(LOG_ERR,
+ "error creating cache handler for sctpAssocTable\n");
+ goto bail;
+ }
+
+ if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
+ snmp_log(LOG_ERR,
+ "error injecting cache handler for sctpAssocTable\n");
+ goto bail;
+ }
+ handler = NULL; /* reg has it */
+
+ /*
+ * register the table
+ */
+ if (SNMPERR_SUCCESS != netsnmp_register_table(reg, table_info)) {
+ snmp_log(LOG_ERR,
+ "error registering table handler for sctpAssocTable\n");
+ goto bail;
+ }
+
+ /*
+ * Initialise the contents of the table here
+ */
+
+
+ return; /* ok */
+
+ /*
+ * Some error occurred during registration. Clean up and bail.
+ */
+ bail: /* not ok */
+
+ if (handler)
+ netsnmp_handler_free(handler);
+
+ if (cache)
+ netsnmp_cache_free(cache);
+
+ if (table_info)
+ netsnmp_table_registration_info_free(table_info);
+
+ if (container)
+ CONTAINER_FREE(container);
+
+ if (reg)
+ netsnmp_handler_registration_free(reg);
+}
+
+
+/** handles requests for the sctpAssocTable table */
+int
+sctpAssocTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ sctpAssocTable_entry *table_entry;
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ if (request->processed)
+ continue;
+ table_entry = (sctpAssocTable_entry *)
+ netsnmp_container_table_extract_context(request);
+ table_info = netsnmp_extract_table_info(request);
+ if ((NULL == table_entry) || (NULL == table_info)) {
+ snmp_log(LOG_ERR,
+ "could not extract table entry or info for sctpAssocTable\n");
+ snmp_set_var_typed_value(request->requestvb,
+ SNMP_ERR_GENERR, NULL, 0);
+ continue;
+ }
+
+ switch (table_info->colnum) {
+ case COLUMN_SCTPASSOCREMHOSTNAME:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *)
+ table_entry->sctpAssocRemHostName,
+ table_entry->sctpAssocRemHostName_len);
+ break;
+ case COLUMN_SCTPASSOCLOCALPORT:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_UNSIGNED,
+ table_entry->sctpAssocLocalPort);
+ break;
+ case COLUMN_SCTPASSOCREMPORT:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_UNSIGNED,
+ table_entry->sctpAssocRemPort);
+ break;
+ case COLUMN_SCTPASSOCREMPRIMADDRTYPE:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ table_entry->sctpAssocRemPrimAddrType);
+ break;
+ case COLUMN_SCTPASSOCREMPRIMADDR:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
+ (u_char *)
+ table_entry->sctpAssocRemPrimAddr,
+ table_entry->sctpAssocRemPrimAddr_len);
+ break;
+ case COLUMN_SCTPASSOCHEARTBEATINTERVAL:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_UNSIGNED,
+ table_entry->sctpAssocHeartBeatInterval);
+ break;
+ case COLUMN_SCTPASSOCSTATE:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb, ASN_INTEGER,
+ table_entry->sctpAssocState);
+ break;
+ case COLUMN_SCTPASSOCINSTREAMS:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_UNSIGNED,
+ table_entry->sctpAssocInStreams);
+ break;
+ case COLUMN_SCTPASSOCOUTSTREAMS:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_UNSIGNED,
+ table_entry->sctpAssocOutStreams);
+ break;
+ case COLUMN_SCTPASSOCMAXRETR:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_UNSIGNED,
+ table_entry->sctpAssocMaxRetr);
+ break;
+ case COLUMN_SCTPASSOCPRIMPROCESS:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_UNSIGNED,
+ table_entry->sctpAssocPrimProcess);
+ break;
+ case COLUMN_SCTPASSOCT1EXPIREDS:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb, ASN_COUNTER,
+ table_entry->sctpAssocT1expireds);
+ break;
+ case COLUMN_SCTPASSOCT2EXPIREDS:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb, ASN_COUNTER,
+ table_entry->sctpAssocT2expireds);
+ break;
+ case COLUMN_SCTPASSOCRTXCHUNKS:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb, ASN_COUNTER,
+ table_entry->sctpAssocRtxChunks);
+ break;
+ case COLUMN_SCTPASSOCSTARTTIME:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_TIMETICKS,
+ table_entry->sctpAssocStartTime);
+ break;
+ case COLUMN_SCTPASSOCDISCONTINUITYTIME:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_TIMETICKS,
+ table_entry->sctpAssocDiscontinuityTime);
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHOBJECT);
+ break;
+ }
+ }
+ break;
+
+ /*
+ * Write-support
+ */
+ case MODE_SET_RESERVE1:
+ for (request = requests; request; request = request->next) {
+ if (request->processed)
+ continue;
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_ERR_NOTWRITABLE);
+ }
+ break;
+
+ case MODE_SET_RESERVE2:
+ case MODE_SET_FREE:
+ case MODE_SET_ACTION:
+ case MODE_SET_UNDO:
+ case MODE_SET_COMMIT:
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+/**
+ * @internal
+ */
+static int
+_cache_load(netsnmp_cache * cache, void *vmagic)
+{
+ DEBUGMSGTL(("internal:sctpAssocTable:_cache_load", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR, "invalid cache for sctpAssocTable_cache_load\n");
+ return -1;
+ }
+ /** should only be called for an invalid or expired cache */
+ netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
+
+ return sctpTables_load();
+} /* _cache_load */
+
+/**
+ * @Internal
+ */
+/** remove a row from the table */
+static void
+sctpAssocTable_freeEntry_cb(sctpAssocTable_entry * entry, void *magic)
+{
+
+ sctpAssocTable_entry_free(entry);
+}
+
+/**
+ * @internal
+ */
+static void
+_cache_free(netsnmp_cache * cache, void *magic)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("internal:sctpAssocTable:_cache_free", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR, "invalid cache in sctpAssocTable_cache_free\n");
+ return;
+ }
+ container = (netsnmp_container *) cache->magic;
+
+ /*
+ * empty (but don't free) cache here
+ */
+ CONTAINER_CLEAR(container, (netsnmp_container_obj_func *)
+ sctpAssocTable_freeEntry_cb, NULL);
+} /* _cache_free */
+
+sctpAssocTable_entry *
+sctpAssocTable_entry_create(void)
+{
+ sctpAssocTable_entry *entry =
+ SNMP_MALLOC_TYPEDEF(sctpAssocTable_entry);
+ if (entry != NULL) {
+ entry->oid_index.len = SCTP_ASSOC_TABLE_INDEX_SIZE;
+ entry->oid_index.oids = entry->oid_tmp;
+ }
+
+ return entry;
+}
+
+int
+sctpAssocTable_entry_update_index(sctpAssocTable_entry * entry)
+{
+ netsnmp_variable_list var_sctpAssocId;
+ int err = 0;
+
+ /*
+ * prepare the value to be converted
+ */
+ memset(&var_sctpAssocId, 0, sizeof(var_sctpAssocId));
+ var_sctpAssocId.type = ASN_UNSIGNED;
+ var_sctpAssocId.next_variable = NULL;
+ snmp_set_var_value(&var_sctpAssocId, (u_char *) & entry->sctpAssocId,
+ sizeof(entry->sctpAssocId));
+
+ /*
+ * convert it
+ */
+ err =
+ build_oid_noalloc(entry->oid_index.oids, entry->oid_index.len,
+ &entry->oid_index.len, NULL, 0,
+ &var_sctpAssocId);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * release any memory allocated during the conversion
+ */
+ snmp_reset_var_buffers(&var_sctpAssocId);
+
+ return err;
+}
+
+void
+sctpAssocTable_entry_copy(sctpAssocTable_entry * from,
+ sctpAssocTable_entry * to)
+{
+ memcpy(to, from, sizeof(sctpAssocTable_entry));
+ to->oid_index.oids = to->oid_tmp;
+}
+
+
+void
+sctpAssocTable_entry_free(sctpAssocTable_entry * entry)
+{
+ if (entry != NULL)
+ SNMP_FREE(entry);
+}
+
+netsnmp_container *
+sctpAssocTable_get_container(void)
+{
+ return sctpAssocTable_container;
+}
+
+static void
+sctpAssocTable_entry_clear(void *what, void *magic)
+{
+ sctpAssocTable_entry_free(what);
+}
+
+void
+sctpAssocTable_container_clear(netsnmp_container *container)
+{
+ CONTAINER_CLEAR(container, sctpAssocTable_entry_clear, NULL);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocTable.h
new file mode 100644
index 0000000000..a6a9f3c58b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpAssocTable.h
@@ -0,0 +1,99 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * $
+ */
+#ifndef SCTPASSOCTABLE_H
+#define SCTPASSOCTABLE_H
+
+#include "sctpTables_common.h"
+
+/*
+ * function declarations
+ */
+void init_sctpAssocTable(void);
+void shutdown_sctpAssocTable(void);
+void initialize_table_sctpAssocTable(void);
+Netsnmp_Node_Handler sctpAssocTable_handler;
+
+/*
+ * SCTP association states
+ */
+#define SCTPASSOCSTATE_CLOSED 1
+#define SCTPASSOCSTATE_COOKIEWAIT 2
+#define SCTPASSOCSTATE_COOKIEECHOED 3
+#define SCTPASSOCSTATE_ESTABLISHED 4
+#define SCTPASSOCSTATE_SHUTDOWNPENDING 5
+#define SCTPASSOCSTATE_SHUTDOWNSENT 6
+#define SCTPASSOCSTATE_SHUTDOWNRECEIVED 7
+#define SCTPASSOCSTATE_SHUTDOWNACKSENT 8
+#define SCTPASSOCSTATE_DELETETCB 9
+
+/*
+ * column number definitions for table sctpAssocTable
+ */
+#define COLUMN_SCTPASSOCID 1
+#define COLUMN_SCTPASSOCREMHOSTNAME 2
+#define COLUMN_SCTPASSOCLOCALPORT 3
+#define COLUMN_SCTPASSOCREMPORT 4
+#define COLUMN_SCTPASSOCREMPRIMADDRTYPE 5
+#define COLUMN_SCTPASSOCREMPRIMADDR 6
+#define COLUMN_SCTPASSOCHEARTBEATINTERVAL 7
+#define COLUMN_SCTPASSOCSTATE 8
+#define COLUMN_SCTPASSOCINSTREAMS 9
+#define COLUMN_SCTPASSOCOUTSTREAMS 10
+#define COLUMN_SCTPASSOCMAXRETR 11
+#define COLUMN_SCTPASSOCPRIMPROCESS 12
+#define COLUMN_SCTPASSOCT1EXPIREDS 13
+#define COLUMN_SCTPASSOCT2EXPIREDS 14
+#define COLUMN_SCTPASSOCRTXCHUNKS 15
+#define COLUMN_SCTPASSOCSTARTTIME 16
+#define COLUMN_SCTPASSOCDISCONTINUITYTIME 17
+
+#define SCTP_ASSOC_TABLE_INDEX_SIZE 100
+/** Data structure for a sctpAssocTable row entry */
+struct sctpAssocTable_entry_s {
+ netsnmp_index oid_index;
+ oid oid_tmp[SCTP_ASSOC_TABLE_INDEX_SIZE];
+
+ /*
+ * Index values
+ */
+ u_long sctpAssocId;
+
+ /*
+ * Column values
+ */
+ char sctpAssocRemHostName[SCTP_HOSTNAME_SIZE];
+ u_long sctpAssocRemHostName_len;
+ u_long sctpAssocLocalPort;
+ u_long sctpAssocRemPort;
+ u_long sctpAssocRemPrimAddrType;
+ char sctpAssocRemPrimAddr[SCTP_IPADDRESS_SIZE];
+ u_long sctpAssocRemPrimAddr_len;
+ u_long sctpAssocHeartBeatInterval;
+ long sctpAssocState;
+ long old_sctpAssocState;
+ u_long sctpAssocInStreams;
+ u_long sctpAssocOutStreams;
+ u_long sctpAssocMaxRetr;
+ u_long sctpAssocPrimProcess;
+ u_long sctpAssocT1expireds;
+ u_long sctpAssocT2expireds;
+ u_long sctpAssocRtxChunks;
+ u_long sctpAssocStartTime;
+ u_long sctpAssocDiscontinuityTime;
+
+ int valid;
+};
+
+sctpAssocTable_entry *sctpAssocTable_entry_create(void);
+int sctpAssocTable_entry_update_index(sctpAssocTable_entry *
+ entry);
+void sctpAssocTable_entry_copy(sctpAssocTable_entry * from,
+ sctpAssocTable_entry * to);
+void sctpAssocTable_entry_free(sctpAssocTable_entry * entry);
+
+void sctpAssocTable_container_clear(netsnmp_container
+ *container);
+
+#endif /* SCTPASSOCTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupLocalPortTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupLocalPortTable.c
new file mode 100644
index 0000000000..5802b4815a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupLocalPortTable.c
@@ -0,0 +1,273 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/table_container.h>
+#include "sctpLookupLocalPortTable.h"
+
+static netsnmp_container *sctpLookupLocalPortTable_container;
+
+/** Initializes the sctpLookupLocalPortTable module */
+void
+init_sctpLookupLocalPortTable(void)
+{
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ initialize_table_sctpLookupLocalPortTable();
+}
+
+void
+shutdown_sctpLookupLocalPortTable(void)
+{
+ sctpLookupLocalPortTable_container_clear
+ (sctpLookupLocalPortTable_container);
+}
+
+/** Initialize the sctpLookupLocalPortTable table by defining its contents and how it's structured */
+void
+initialize_table_sctpLookupLocalPortTable(void)
+{
+ static oid sctpLookupLocalPortTable_oid[] =
+ { 1, 3, 6, 1, 2, 1, 104, 1, 6 };
+ size_t sctpLookupLocalPortTable_oid_len =
+ OID_LENGTH(sctpLookupLocalPortTable_oid);
+ netsnmp_handler_registration *reg = NULL;
+ netsnmp_mib_handler *handler = NULL;
+ netsnmp_container *container = NULL;
+ netsnmp_table_registration_info *table_info = NULL;
+
+ reg =
+ netsnmp_create_handler_registration("sctpLookupLocalPortTable",
+ sctpLookupLocalPortTable_handler,
+ sctpLookupLocalPortTable_oid,
+ sctpLookupLocalPortTable_oid_len,
+ HANDLER_CAN_RONLY);
+ if (NULL == reg) {
+ snmp_log(LOG_ERR,
+ "error creating handler registration for sctpLookupLocalPortTable\n");
+ goto bail;
+ }
+
+ container =
+ netsnmp_container_find("sctpLookupLocalPortTable:table_container");
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "error creating container for sctpLookupLocalPortTable\n");
+ goto bail;
+ }
+ sctpLookupLocalPortTable_container = container;
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ if (NULL == table_info) {
+ snmp_log(LOG_ERR,
+ "error allocating table registration for sctpLookupLocalPortTable\n");
+ goto bail;
+ }
+ netsnmp_table_helper_add_indexes(table_info, ASN_UNSIGNED, /* index: sctpAssocLocalPort */
+ ASN_UNSIGNED, /* index: sctpAssocId */
+ 0);
+ table_info->min_column = COLUMN_SCTPLOOKUPLOCALPORTSTARTTIME;
+ table_info->max_column = COLUMN_SCTPLOOKUPLOCALPORTSTARTTIME;
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler = netsnmp_container_table_handler_get(table_info, container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ if (NULL == handler) {
+ snmp_log(LOG_ERR,
+ "error allocating table registration for sctpLookupLocalPortTable\n");
+ goto bail;
+ }
+ if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
+ snmp_log(LOG_ERR,
+ "error injecting container_table handler for sctpLookupLocalPortTable\n");
+ goto bail;
+ }
+ handler = NULL; /* reg has it, will reuse below */
+
+ /*
+ * register the table
+ */
+ if (SNMPERR_SUCCESS != netsnmp_register_table(reg, table_info)) {
+ snmp_log(LOG_ERR,
+ "error registering table handler for sctpLookupLocalPortTable\n");
+ goto bail;
+ }
+
+ /*
+ * Initialise the contents of the table here
+ */
+
+
+ return; /* ok */
+
+ /*
+ * Some error occurred during registration. Clean up and bail.
+ */
+ bail: /* not ok */
+
+ if (handler)
+ netsnmp_handler_free(handler);
+
+ if (table_info)
+ netsnmp_table_registration_info_free(table_info);
+
+ if (container)
+ CONTAINER_FREE(container);
+
+ if (reg)
+ netsnmp_handler_registration_free(reg);
+}
+
+
+/** handles requests for the sctpLookupLocalPortTable table */
+int
+sctpLookupLocalPortTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ sctpLookupLocalPortTable_entry *table_entry;
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ if (request->processed)
+ continue;
+ table_entry = (sctpLookupLocalPortTable_entry *)
+ netsnmp_container_table_extract_context(request);
+ table_info = netsnmp_extract_table_info(request);
+ if ((NULL == table_entry) || (NULL == table_info)) {
+ snmp_log(LOG_ERR,
+ "could not extract table entry or info for sctpLookupLocalPortTable\n");
+ snmp_set_var_typed_value(request->requestvb,
+ SNMP_ERR_GENERR, NULL, 0);
+ continue;
+ }
+
+ switch (table_info->colnum) {
+ case COLUMN_SCTPLOOKUPLOCALPORTSTARTTIME:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_TIMETICKS,
+ table_entry->sctpLookupLocalPortStartTime);
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHOBJECT);
+ break;
+ }
+ }
+ break;
+
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+sctpLookupLocalPortTable_entry *
+sctpLookupLocalPortTable_entry_create(void)
+{
+ sctpLookupLocalPortTable_entry *entry =
+ SNMP_MALLOC_TYPEDEF(sctpLookupLocalPortTable_entry);
+ if (entry != NULL) {
+ entry->oid_index.len = SCTP_LOOKUP_LOCAL_PORT_TABLE_INDEX_SIZE;
+ entry->oid_index.oids = entry->oid_tmp;
+ }
+
+ return entry;
+}
+
+int
+sctpLookupLocalPortTable_entry_update_index(sctpLookupLocalPortTable_entry
+ * entry)
+{
+ netsnmp_variable_list var_sctpAssocLocalPort;
+ netsnmp_variable_list var_sctpAssocId;
+ int err = 0;
+
+ /*
+ * prepare the value to be converted
+ */
+ memset(&var_sctpAssocLocalPort, 0, sizeof(var_sctpAssocLocalPort));
+ var_sctpAssocLocalPort.type = ASN_UNSIGNED;
+ var_sctpAssocLocalPort.next_variable = &var_sctpAssocId;
+ snmp_set_var_value(&var_sctpAssocLocalPort,
+ (u_char *) & entry->sctpAssocLocalPort,
+ sizeof(entry->sctpAssocLocalPort));
+
+ memset(&var_sctpAssocId, 0, sizeof(var_sctpAssocId));
+ var_sctpAssocId.type = ASN_UNSIGNED;
+ var_sctpAssocId.next_variable = NULL;
+ snmp_set_var_value(&var_sctpAssocId, (u_char *) & entry->sctpAssocId,
+ sizeof(entry->sctpAssocId));
+
+ /*
+ * convert it
+ */
+ err =
+ build_oid_noalloc(entry->oid_index.oids, entry->oid_index.len,
+ &entry->oid_index.len, NULL, 0,
+ &var_sctpAssocLocalPort);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * release any memory allocated during the conversion
+ */
+ snmp_reset_var_buffers(&var_sctpAssocLocalPort);
+
+ return err;
+}
+
+void
+sctpLookupLocalPortTable_entry_copy(sctpLookupLocalPortTable_entry * from,
+ sctpLookupLocalPortTable_entry * to)
+{
+ memcpy(to, from, sizeof(sctpLookupLocalPortTable_entry));
+ to->oid_index.oids = to->oid_tmp;
+}
+
+
+void
+sctpLookupLocalPortTable_entry_free(sctpLookupLocalPortTable_entry * entry)
+{
+ if (entry != NULL)
+ SNMP_FREE(entry);
+}
+
+netsnmp_container *
+sctpLookupLocalPortTable_get_container(void)
+{
+ return sctpLookupLocalPortTable_container;
+}
+
+
+static void
+sctpLookupLocalPortTable_entry_clear(void *what, void *magic)
+{
+ sctpLookupLocalPortTable_entry_free(what);
+}
+
+void
+sctpLookupLocalPortTable_container_clear(netsnmp_container *container)
+{
+ CONTAINER_CLEAR(container, sctpLookupLocalPortTable_entry_clear, NULL);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupLocalPortTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupLocalPortTable.h
new file mode 100644
index 0000000000..9da6cd94ff
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupLocalPortTable.h
@@ -0,0 +1,59 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * $
+ */
+#ifndef SCTPLOOKUPLOCALPORTTABLE_H
+#define SCTPLOOKUPLOCALPORTTABLE_H
+
+#include "sctpTables_common.h"
+
+/*
+ * function declarations
+ */
+void init_sctpLookupLocalPortTable(void);
+void shutdown_sctpLookupLocalPortTable(void);
+void initialize_table_sctpLookupLocalPortTable(void);
+Netsnmp_Node_Handler sctpLookupLocalPortTable_handler;
+
+/*
+ * column number definitions for table sctpLookupLocalPortTable
+ */
+#define COLUMN_SCTPLOOKUPLOCALPORTSTARTTIME 1
+
+/** Typical data structure for a row entry */
+#define SCTP_LOOKUP_LOCAL_PORT_TABLE_INDEX_SIZE 100
+struct sctpLookupLocalPortTable_entry_s {
+ netsnmp_index oid_index;
+ oid oid_tmp[SCTP_LOOKUP_LOCAL_PORT_TABLE_INDEX_SIZE];
+
+ /*
+ * Index values
+ */
+ u_long sctpAssocLocalPort;
+ u_long sctpAssocId;
+
+ /*
+ * Column values
+ */
+ u_long sctpLookupLocalPortStartTime;
+
+ int valid;
+};
+
+sctpLookupLocalPortTable_entry*
+sctpLookupLocalPortTable_entry_create(void);
+
+int
+sctpLookupLocalPortTable_entry_update_index(sctpLookupLocalPortTable_entry
+ * entry);
+void
+sctpLookupLocalPortTable_entry_copy(sctpLookupLocalPortTable_entry * from,
+ sctpLookupLocalPortTable_entry * to);
+void
+sctpLookupLocalPortTable_entry_free(sctpLookupLocalPortTable_entry *
+ entry);
+
+void
+sctpLookupLocalPortTable_container_clear(netsnmp_container *container);
+
+#endif /* SCTPLOOKUPLOCALPORTTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemHostNameTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemHostNameTable.c
new file mode 100644
index 0000000000..147993cb4d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemHostNameTable.c
@@ -0,0 +1,278 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/table_container.h>
+#include "sctpLookupRemHostNameTable.h"
+
+static netsnmp_container *sctpLookupRemHostNameTable_container;
+
+/** Initializes the sctpLookupRemHostNameTable module */
+void
+init_sctpLookupRemHostNameTable(void)
+{
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ initialize_table_sctpLookupRemHostNameTable();
+}
+
+void
+shutdown_sctpLookupRemHostNameTable(void)
+{
+ sctpLookupRemHostNameTable_container_clear
+ (sctpLookupRemHostNameTable_container);
+}
+
+/** Initialize the sctpLookupRemHostNameTable table by defining its contents and how it's structured */
+void
+initialize_table_sctpLookupRemHostNameTable(void)
+{
+ static oid sctpLookupRemHostNameTable_oid[] =
+ { 1, 3, 6, 1, 2, 1, 104, 1, 8 };
+ size_t sctpLookupRemHostNameTable_oid_len =
+ OID_LENGTH(sctpLookupRemHostNameTable_oid);
+ netsnmp_handler_registration *reg = NULL;
+ netsnmp_mib_handler *handler = NULL;
+ netsnmp_container *container = NULL;
+ netsnmp_table_registration_info *table_info = NULL;
+
+ reg =
+ netsnmp_create_handler_registration("sctpLookupRemHostNameTable",
+ sctpLookupRemHostNameTable_handler,
+ sctpLookupRemHostNameTable_oid,
+ sctpLookupRemHostNameTable_oid_len,
+ HANDLER_CAN_RONLY);
+ if (NULL == reg) {
+ snmp_log(LOG_ERR,
+ "error creating handler registration for sctpLookupRemHostNameTable\n");
+ goto bail;
+ }
+
+ container =
+ netsnmp_container_find
+ ("sctpLookupRemHostNameTable:table_container");
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "error creating container for sctpLookupRemHostNameTable\n");
+ goto bail;
+ }
+ sctpLookupRemHostNameTable_container = container;
+
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ if (NULL == table_info) {
+ snmp_log(LOG_ERR,
+ "error allocating table registration for sctpLookupRemHostNameTable\n");
+ goto bail;
+ }
+ netsnmp_table_helper_add_indexes(table_info, ASN_OCTET_STR, /* index: sctpAssocRemHostName */
+ ASN_UNSIGNED, /* index: sctpAssocId */
+ 0);
+ table_info->min_column = COLUMN_SCTPLOOKUPREMHOSTNAMESTARTTIME;
+ table_info->max_column = COLUMN_SCTPLOOKUPREMHOSTNAMESTARTTIME;
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler = netsnmp_container_table_handler_get(table_info, container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ if (NULL == handler) {
+ snmp_log(LOG_ERR,
+ "error allocating table registration for sctpLookupRemHostNameTable\n");
+ goto bail;
+ }
+ if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
+ snmp_log(LOG_ERR,
+ "error injecting container_table handler for sctpLookupRemHostNameTable\n");
+ goto bail;
+ }
+ handler = NULL; /* reg has it, will reuse below */
+
+ /*
+ * register the table
+ */
+ if (SNMPERR_SUCCESS != netsnmp_register_table(reg, table_info)) {
+ snmp_log(LOG_ERR,
+ "error registering table handler for sctpLookupRemHostNameTable\n");
+ goto bail;
+ }
+
+ /*
+ * Initialise the contents of the table here
+ */
+
+
+ return; /* ok */
+
+ /*
+ * Some error occurred during registration. Clean up and bail.
+ */
+ bail: /* not ok */
+
+ if (handler)
+ netsnmp_handler_free(handler);
+
+ if (table_info)
+ netsnmp_table_registration_info_free(table_info);
+
+ if (container)
+ CONTAINER_FREE(container);
+
+ if (reg)
+ netsnmp_handler_registration_free(reg);
+}
+
+/** handles requests for the sctpLookupRemHostNameTable table */
+int
+sctpLookupRemHostNameTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ sctpLookupRemHostNameTable_entry *table_entry;
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ if (request->processed)
+ continue;
+ table_entry = (sctpLookupRemHostNameTable_entry *)
+ netsnmp_container_table_extract_context(request);
+ table_info = netsnmp_extract_table_info(request);
+ if ((NULL == table_entry) || (NULL == table_info)) {
+ snmp_log(LOG_ERR,
+ "could not extract table entry or info for sctpLookupRemHostNameTable\n");
+ snmp_set_var_typed_value(request->requestvb,
+ SNMP_ERR_GENERR, NULL, 0);
+ continue;
+ }
+
+ switch (table_info->colnum) {
+ case COLUMN_SCTPLOOKUPREMHOSTNAMESTARTTIME:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_TIMETICKS,
+ table_entry->sctpLookupRemHostNameStartTime);
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHOBJECT);
+ break;
+ }
+ }
+ break;
+
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+sctpLookupRemHostNameTable_entry *
+sctpLookupRemHostNameTable_entry_create(void)
+{
+ sctpLookupRemHostNameTable_entry *entry =
+ SNMP_MALLOC_TYPEDEF(sctpLookupRemHostNameTable_entry);
+ if (entry != NULL) {
+ entry->oid_index.len = SCTP_LOOKUP_REM_HOST_NAME_TABLE_INDEX_SIZE;
+ entry->oid_index.oids = entry->oid_tmp;
+ }
+
+ return entry;
+}
+
+int
+sctpLookupRemHostNameTable_entry_update_index
+ (sctpLookupRemHostNameTable_entry * entry)
+{
+ netsnmp_variable_list var_sctpAssocRemHostName;
+ netsnmp_variable_list var_sctpAssocId;
+ int err = 0;
+
+ /*
+ * prepare the value to be converted
+ */
+ memset(&var_sctpAssocRemHostName, 0, sizeof(var_sctpAssocRemHostName));
+ var_sctpAssocRemHostName.type = ASN_OCTET_STR;
+ var_sctpAssocRemHostName.next_variable = &var_sctpAssocId;
+ snmp_set_var_value(&var_sctpAssocRemHostName,
+ (u_char *) & entry->sctpAssocRemHostName,
+ entry->sctpAssocRemHostName_len);
+
+ memset(&var_sctpAssocId, 0, sizeof(var_sctpAssocId));
+ var_sctpAssocId.type = ASN_UNSIGNED;
+ var_sctpAssocId.next_variable = NULL;
+ snmp_set_var_value(&var_sctpAssocId, (u_char *) & entry->sctpAssocId,
+ sizeof(entry->sctpAssocId));
+
+ /*
+ * convert it
+ */
+ err =
+ build_oid_noalloc(entry->oid_index.oids, entry->oid_index.len,
+ &entry->oid_index.len, NULL, 0,
+ &var_sctpAssocRemHostName);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * release any memory allocated during the conversion
+ */
+ snmp_reset_var_buffers(&var_sctpAssocRemHostName);
+
+ return err;
+}
+
+void
+sctpLookupRemHostNameTable_entry_copy(sctpLookupRemHostNameTable_entry *
+ from,
+ sctpLookupRemHostNameTable_entry *
+ to)
+{
+ memcpy(to, from, sizeof(sctpLookupRemHostNameTable_entry));
+ to->oid_index.oids = to->oid_tmp;
+}
+
+
+void
+sctpLookupRemHostNameTable_entry_free(sctpLookupRemHostNameTable_entry *
+ entry)
+{
+ if (entry != NULL)
+ SNMP_FREE(entry);
+}
+
+netsnmp_container *
+sctpLookupRemHostNameTable_get_container(void)
+{
+ return sctpLookupRemHostNameTable_container;
+}
+
+
+static void
+sctpLookupRemHostNameTable_entry_clear(void *what, void *magic)
+{
+ sctpLookupRemHostNameTable_entry_free(what);
+}
+
+void
+sctpLookupRemHostNameTable_container_clear(netsnmp_container *container)
+{
+ CONTAINER_CLEAR(container, sctpLookupRemHostNameTable_entry_clear,
+ NULL);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemHostNameTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemHostNameTable.h
new file mode 100644
index 0000000000..484cb580d6
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemHostNameTable.h
@@ -0,0 +1,64 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * $
+ */
+#ifndef SCTPLOOKUPREMHOSTNAMETABLE_H
+#define SCTPLOOKUPREMHOSTNAMETABLE_H
+
+#include "sctpTables_common.h"
+
+/*
+ * function declarations
+ */
+void init_sctpLookupRemHostNameTable(void);
+void shutdown_sctpLookupRemHostNameTable(void);
+void initialize_table_sctpLookupRemHostNameTable(void);
+Netsnmp_Node_Handler sctpLookupRemHostNameTable_handler;
+
+/*
+ * column number definitions for table sctpLookupRemHostNameTable
+ */
+#define COLUMN_SCTPLOOKUPREMHOSTNAMESTARTTIME 1
+
+#define SCTP_LOOKUP_REM_HOST_NAME_TABLE_INDEX_SIZE 270
+/** Typical data structure for a row entry */
+struct sctpLookupRemHostNameTable_entry_s {
+ netsnmp_index oid_index;
+ oid oid_tmp[SCTP_LOOKUP_REM_HOST_NAME_TABLE_INDEX_SIZE];
+
+ /*
+ * Index values
+ */
+ char sctpAssocRemHostName[SCTP_HOSTNAME_SIZE];
+ u_long sctpAssocRemHostName_len;
+ u_long sctpAssocId;
+
+ /*
+ * Column values
+ */
+ u_long sctpLookupRemHostNameStartTime;
+
+ int valid;
+};
+
+sctpLookupRemHostNameTable_entry*
+sctpLookupRemHostNameTable_entry_create(void);
+
+int
+sctpLookupRemHostNameTable_entry_update_index(sctpLookupRemHostNameTable_entry *
+ entry);
+
+void
+sctpLookupRemHostNameTable_entry_copy(sctpLookupRemHostNameTable_entry *
+ from,
+ sctpLookupRemHostNameTable_entry *
+ to);
+
+void
+sctpLookupRemHostNameTable_entry_free(sctpLookupRemHostNameTable_entry *
+ entry);
+
+void
+sctpLookupRemHostNameTable_container_clear(netsnmp_container *container);
+
+#endif /* SCTPLOOKUPREMHOSTNAMETABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemIPAddrTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemIPAddrTable.c
new file mode 100644
index 0000000000..7c4766d88b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemIPAddrTable.c
@@ -0,0 +1,277 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/table_container.h>
+#include "sctpLookupRemIPAddrTable.h"
+
+static netsnmp_container *sctpLookupRemIPAddrTable_container;
+
+/** Initializes the sctpLookupRemIPAddrTable module */
+void
+init_sctpLookupRemIPAddrTable(void)
+{
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ initialize_table_sctpLookupRemIPAddrTable();
+}
+
+void
+shutdown_sctpLookupRemIPAddrTable(void)
+{
+ sctpLookupRemIPAddrTable_container_clear
+ (sctpLookupRemIPAddrTable_container);
+}
+
+/** Initialize the sctpLookupRemIPAddrTable table by defining its contents and how it's structured */
+void
+initialize_table_sctpLookupRemIPAddrTable(void)
+{
+ static oid sctpLookupRemIPAddrTable_oid[] =
+ { 1, 3, 6, 1, 2, 1, 104, 1, 10 };
+ size_t sctpLookupRemIPAddrTable_oid_len =
+ OID_LENGTH(sctpLookupRemIPAddrTable_oid);
+ netsnmp_handler_registration *reg = NULL;
+ netsnmp_mib_handler *handler = NULL;
+ netsnmp_container *container = NULL;
+ netsnmp_table_registration_info *table_info = NULL;
+
+ reg =
+ netsnmp_create_handler_registration("sctpLookupRemIPAddrTable",
+ sctpLookupRemIPAddrTable_handler,
+ sctpLookupRemIPAddrTable_oid,
+ sctpLookupRemIPAddrTable_oid_len,
+ HANDLER_CAN_RONLY);
+ if (NULL == reg) {
+ snmp_log(LOG_ERR,
+ "error creating handler registration for sctpLookupRemIPAddrTable\n");
+ goto bail;
+ }
+
+ container =
+ netsnmp_container_find("sctpLookupRemIPAddrTable:table_container");
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "error creating container for sctpLookupRemIPAddrTable\n");
+ goto bail;
+ }
+ sctpLookupRemIPAddrTable_container = container;
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ if (NULL == table_info) {
+ snmp_log(LOG_ERR,
+ "error allocating table registration for sctpLookupRemIPAddrTable\n");
+ goto bail;
+ }
+ netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER, /* index: sctpLookupRemIPAddrType */
+ ASN_OCTET_STR, /* index: sctpLookupRemIPAddr */
+ ASN_UNSIGNED, /* index: sctpAssocId */
+ 0);
+ table_info->min_column = COLUMN_SCTPLOOKUPREMIPADDRSTARTTIME;
+ table_info->max_column = COLUMN_SCTPLOOKUPREMIPADDRSTARTTIME;
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler = netsnmp_container_table_handler_get(table_info, container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ if (NULL == handler) {
+ snmp_log(LOG_ERR,
+ "error allocating table registration for sctpLookupRemIPAddrTable\n");
+ goto bail;
+ }
+ if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
+ snmp_log(LOG_ERR,
+ "error injecting container_table handler for sctpLookupRemIPAddrTable\n");
+ goto bail;
+ }
+ handler = NULL; /* reg has it, will reuse below */
+
+ /*
+ * register the table
+ */
+ if (SNMPERR_SUCCESS != netsnmp_register_table(reg, table_info)) {
+ snmp_log(LOG_ERR,
+ "error registering table handler for sctpLookupRemIPAddrTable\n");
+ goto bail;
+ }
+
+ return; /* ok */
+
+ /*
+ * Some error occurred during registration. Clean up and bail.
+ */
+ bail: /* not ok */
+
+ if (handler)
+ netsnmp_handler_free(handler);
+
+ if (table_info)
+ netsnmp_table_registration_info_free(table_info);
+
+ if (container)
+ CONTAINER_FREE(container);
+
+ if (reg)
+ netsnmp_handler_registration_free(reg);
+}
+
+/** handles requests for the sctpLookupRemIPAddrTable table */
+int
+sctpLookupRemIPAddrTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ sctpLookupRemIPAddrTable_entry *table_entry;
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ if (request->processed)
+ continue;
+ table_entry = (sctpLookupRemIPAddrTable_entry *)
+ netsnmp_container_table_extract_context(request);
+ table_info = netsnmp_extract_table_info(request);
+ if ((NULL == table_entry) || (NULL == table_info)) {
+ snmp_log(LOG_ERR,
+ "could not extract table entry or info for sctpLookupRemIPAddrTable\n");
+ snmp_set_var_typed_value(request->requestvb,
+ SNMP_ERR_GENERR, NULL, 0);
+ continue;
+ }
+
+ switch (table_info->colnum) {
+ case COLUMN_SCTPLOOKUPREMIPADDRSTARTTIME:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_TIMETICKS,
+ table_entry->sctpLookupRemIPAddrStartTime);
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHOBJECT);
+ break;
+ }
+ }
+ break;
+
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+sctpLookupRemIPAddrTable_entry *
+sctpLookupRemIPAddrTable_entry_create(void)
+{
+ sctpLookupRemIPAddrTable_entry *entry =
+ SNMP_MALLOC_TYPEDEF(sctpLookupRemIPAddrTable_entry);
+ if (entry != NULL) {
+ entry->oid_index.len = SCTP_LOOKUP_REM_IP_ADDR_TABLE_INDEX_SIZE;
+ entry->oid_index.oids = entry->oid_tmp;
+ }
+
+ return entry;
+}
+
+int
+sctpLookupRemIPAddrTable_entry_update_index(sctpLookupRemIPAddrTable_entry
+ * entry)
+{
+ netsnmp_variable_list var_sctpAssocRemIPAddrType;
+ netsnmp_variable_list var_sctpAssocRemIPAddr;
+ netsnmp_variable_list var_sctpAssocId;
+ int err = 0;
+
+ /*
+ * prepare the value to be converted
+ */
+ memset(&var_sctpAssocRemIPAddrType, 0,
+ sizeof(var_sctpAssocRemIPAddrType));
+ var_sctpAssocRemIPAddrType.type = ASN_UNSIGNED;
+ var_sctpAssocRemIPAddrType.next_variable = &var_sctpAssocRemIPAddr;
+ snmp_set_var_value(&var_sctpAssocRemIPAddrType,
+ (u_char *) & entry->sctpAssocRemAddrType,
+ sizeof(entry->sctpAssocRemAddrType));
+
+ memset(&var_sctpAssocRemIPAddr, 0, sizeof(var_sctpAssocRemIPAddr));
+ var_sctpAssocRemIPAddr.type = ASN_OCTET_STR;
+ var_sctpAssocRemIPAddr.next_variable = &var_sctpAssocId;
+ snmp_set_var_value(&var_sctpAssocRemIPAddr,
+ (u_char *) & entry->sctpAssocRemAddr,
+ entry->sctpAssocRemAddr_len);
+
+ memset(&var_sctpAssocId, 0, sizeof(var_sctpAssocId));
+ var_sctpAssocId.type = ASN_UNSIGNED;
+ var_sctpAssocId.next_variable = NULL;
+ snmp_set_var_value(&var_sctpAssocId, (u_char *) & entry->sctpAssocId,
+ sizeof(entry->sctpAssocId));
+
+ /*
+ * convert it
+ */
+ err =
+ build_oid_noalloc(entry->oid_index.oids, entry->oid_index.len,
+ &entry->oid_index.len, NULL, 0,
+ &var_sctpAssocRemIPAddrType);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * release any memory allocated during the conversion
+ */
+ snmp_reset_var_buffers(&var_sctpAssocRemIPAddrType);
+
+ return err;
+}
+
+void
+sctpLookupRemIPAddrTable_entry_copy(sctpLookupRemIPAddrTable_entry * from,
+ sctpLookupRemIPAddrTable_entry * to)
+{
+ memcpy(to, from, sizeof(sctpLookupRemIPAddrTable_entry));
+ to->oid_index.oids = to->oid_tmp;
+}
+
+
+void
+sctpLookupRemIPAddrTable_entry_free(sctpLookupRemIPAddrTable_entry * entry)
+{
+ if (entry != NULL)
+ SNMP_FREE(entry);
+}
+
+netsnmp_container *
+sctpLookupRemIPAddrTable_get_container(void)
+{
+ return sctpLookupRemIPAddrTable_container;
+}
+
+
+static void
+sctpLookupRemIPAddrTable_entry_clear(void *what, void *magic)
+{
+ sctpLookupRemIPAddrTable_entry_free(what);
+}
+
+void
+sctpLookupRemIPAddrTable_container_clear(netsnmp_container *container)
+{
+ CONTAINER_CLEAR(container, sctpLookupRemIPAddrTable_entry_clear, NULL);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemIPAddrTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemIPAddrTable.h
new file mode 100644
index 0000000000..e315d6d001
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemIPAddrTable.h
@@ -0,0 +1,63 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * $
+ */
+#ifndef SCTPLOOKUPREMIPADDRTABLE_H
+#define SCTPLOOKUPREMIPADDRTABLE_H
+
+#include "sctpTables_common.h"
+
+/*
+ * function declarations
+ */
+void init_sctpLookupRemIPAddrTable(void);
+void shutdown_sctpLookupRemIPAddrTable(void);
+void initialize_table_sctpLookupRemIPAddrTable(void);
+Netsnmp_Node_Handler sctpLookupRemIPAddrTable_handler;
+
+/*
+ * column number definitions for table sctpLookupRemIPAddrTable
+ */
+#define COLUMN_SCTPLOOKUPREMIPADDRSTARTTIME 1
+
+/** Typical data structure for a row entry */
+#define SCTP_LOOKUP_REM_IP_ADDR_TABLE_INDEX_SIZE 100
+struct sctpLookupRemIPAddrTable_entry_s {
+ netsnmp_index oid_index;
+ oid oid_tmp[SCTP_LOOKUP_REM_IP_ADDR_TABLE_INDEX_SIZE];
+
+ /*
+ * Index values
+ */
+ u_long sctpAssocRemAddrType;
+ char sctpAssocRemAddr[SCTP_IPADDRESS_SIZE];
+ u_long sctpAssocRemAddr_len;
+ u_long sctpAssocId;
+
+ /*
+ * Column values
+ */
+ u_long sctpLookupRemIPAddrStartTime;
+
+ int valid;
+};
+
+sctpLookupRemIPAddrTable_entry *
+sctpLookupRemIPAddrTable_entry_create(void);
+
+int
+sctpLookupRemIPAddrTable_entry_update_index(sctpLookupRemIPAddrTable_entry
+ * entry);
+
+void
+sctpLookupRemIPAddrTable_entry_copy(sctpLookupRemIPAddrTable_entry * from,
+ sctpLookupRemIPAddrTable_entry * to);
+
+void
+sctpLookupRemIPAddrTable_entry_free(sctpLookupRemIPAddrTable_entry *
+ entry);
+
+void
+sctpLookupRemIPAddrTable_container_clear(netsnmp_container *container);
+
+#endif /* SCTPLOOKUPREMIPADDRTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemPortTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemPortTable.c
new file mode 100644
index 0000000000..cf4a0402f4
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemPortTable.c
@@ -0,0 +1,267 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/table_container.h>
+#include "sctpLookupRemPortTable.h"
+
+static netsnmp_container *sctpLookupRemPortTable_container;
+
+/** Initializes the sctpLookupRemPortTable module */
+void
+init_sctpLookupRemPortTable(void)
+{
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ initialize_table_sctpLookupRemPortTable();
+}
+
+void
+shutdown_sctpLookupRemPortTable(void)
+{
+ sctpLookupRemPortTable_container_clear
+ (sctpLookupRemPortTable_container);
+}
+
+/** Initialize the sctpLookupRemPortTable table by defining its contents and how it's structured */
+void
+initialize_table_sctpLookupRemPortTable(void)
+{
+ static oid sctpLookupRemPortTable_oid[] =
+ { 1, 3, 6, 1, 2, 1, 104, 1, 7 };
+ size_t sctpLookupRemPortTable_oid_len =
+ OID_LENGTH(sctpLookupRemPortTable_oid);
+ netsnmp_handler_registration *reg = NULL;
+ netsnmp_mib_handler *handler = NULL;
+ netsnmp_container *container = NULL;
+ netsnmp_table_registration_info *table_info = NULL;
+
+ reg =
+ netsnmp_create_handler_registration("sctpLookupRemPortTable",
+ sctpLookupRemPortTable_handler,
+ sctpLookupRemPortTable_oid,
+ sctpLookupRemPortTable_oid_len,
+ HANDLER_CAN_RONLY);
+ if (NULL == reg) {
+ snmp_log(LOG_ERR,
+ "error creating handler registration for sctpLookupRemPortTable\n");
+ goto bail;
+ }
+
+ container =
+ netsnmp_container_find("sctpLookupRemPortTable:table_container");
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "error creating container for sctpLookupRemPortTable\n");
+ goto bail;
+ }
+ sctpLookupRemPortTable_container = container;
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ if (NULL == table_info) {
+ snmp_log(LOG_ERR,
+ "error allocating table registration for sctpLookupRemPortTable\n");
+ goto bail;
+ }
+ netsnmp_table_helper_add_indexes(table_info, ASN_UNSIGNED, /* index: sctpAssocRemPort */
+ ASN_UNSIGNED, /* index: sctpAssocId */
+ 0);
+ table_info->min_column = COLUMN_SCTPLOOKUPREMPORTSTARTTIME;
+ table_info->max_column = COLUMN_SCTPLOOKUPREMPORTSTARTTIME;
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler = netsnmp_container_table_handler_get(table_info, container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ if (NULL == handler) {
+ snmp_log(LOG_ERR,
+ "error allocating table registration for sctpLookupRemPortTable\n");
+ goto bail;
+ }
+ if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
+ snmp_log(LOG_ERR,
+ "error injecting container_table handler for sctpLookupRemPortTable\n");
+ goto bail;
+ }
+ handler = NULL; /* reg has it, will reuse below */
+
+ /*
+ * register the table
+ */
+ if (SNMPERR_SUCCESS != netsnmp_register_table(reg, table_info)) {
+ snmp_log(LOG_ERR,
+ "error registering table handler for sctpLookupRemPortTable\n");
+ goto bail;
+ }
+
+ return; /* ok */
+
+ /*
+ * Some error occurred during registration. Clean up and bail.
+ */
+ bail: /* not ok */
+
+ if (handler)
+ netsnmp_handler_free(handler);
+
+ if (table_info)
+ netsnmp_table_registration_info_free(table_info);
+
+ if (container)
+ CONTAINER_FREE(container);
+
+ if (reg)
+ netsnmp_handler_registration_free(reg);
+}
+
+/** handles requests for the sctpLookupRemPortTable table */
+int
+sctpLookupRemPortTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ sctpLookupRemPortTable_entry *table_entry;
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ if (request->processed)
+ continue;
+ table_entry = (sctpLookupRemPortTable_entry *)
+ netsnmp_container_table_extract_context(request);
+ table_info = netsnmp_extract_table_info(request);
+ if ((NULL == table_entry) || (NULL == table_info)) {
+ snmp_log(LOG_ERR,
+ "could not extract table entry or info for sctpLookupRemPortTable\n");
+ snmp_set_var_typed_value(request->requestvb,
+ SNMP_ERR_GENERR, NULL, 0);
+ continue;
+ }
+
+ switch (table_info->colnum) {
+ case COLUMN_SCTPLOOKUPREMPORTSTARTTIME:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_TIMETICKS,
+ table_entry->sctpLookupRemPortStartTime);
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHOBJECT);
+ break;
+ }
+ }
+ break;
+
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+sctpLookupRemPortTable_entry *
+sctpLookupRemPortTable_entry_create(void)
+{
+ sctpLookupRemPortTable_entry *entry =
+ SNMP_MALLOC_TYPEDEF(sctpLookupRemPortTable_entry);
+ if (entry != NULL) {
+ entry->oid_index.len = SCTP_LOOKUP_REM_PORT_TABLE_INDEX_SIZE;
+ entry->oid_index.oids = entry->oid_tmp;
+ }
+
+ return entry;
+}
+
+int
+sctpLookupRemPortTable_entry_update_index(sctpLookupRemPortTable_entry *
+ entry)
+{
+ netsnmp_variable_list var_sctpAssocRemPort;
+ netsnmp_variable_list var_sctpAssocId;
+ int err = 0;
+
+ /*
+ * prepare the value to be converted
+ */
+ memset(&var_sctpAssocRemPort, 0, sizeof(var_sctpAssocRemPort));
+ var_sctpAssocRemPort.type = ASN_UNSIGNED;
+ var_sctpAssocRemPort.next_variable = &var_sctpAssocId;
+ snmp_set_var_value(&var_sctpAssocRemPort,
+ (u_char *) & entry->sctpAssocRemPort,
+ sizeof(entry->sctpAssocRemPort));
+
+ memset(&var_sctpAssocId, 0, sizeof(var_sctpAssocId));
+ var_sctpAssocId.type = ASN_UNSIGNED;
+ var_sctpAssocId.next_variable = NULL;
+ snmp_set_var_value(&var_sctpAssocId, (u_char *) & entry->sctpAssocId,
+ sizeof(entry->sctpAssocId));
+
+ /*
+ * convert it
+ */
+ err =
+ build_oid_noalloc(entry->oid_index.oids, entry->oid_index.len,
+ &entry->oid_index.len, NULL, 0,
+ &var_sctpAssocRemPort);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * release any memory allocated during the conversion
+ */
+ snmp_reset_var_buffers(&var_sctpAssocRemPort);
+
+ return err;
+}
+
+void
+sctpLookupRemPortTable_entry_copy(sctpLookupRemPortTable_entry * from,
+ sctpLookupRemPortTable_entry * to)
+{
+ memcpy(to, from, sizeof(sctpLookupRemPortTable_entry));
+ to->oid_index.oids = to->oid_tmp;
+}
+
+
+void
+sctpLookupRemPortTable_entry_free(sctpLookupRemPortTable_entry * entry)
+{
+ if (entry != NULL)
+ SNMP_FREE(entry);
+}
+
+netsnmp_container *
+sctpLookupRemPortTable_get_container(void)
+{
+ return sctpLookupRemPortTable_container;
+}
+
+
+static void
+sctpLookupRemPortTable_entry_clear(void *what, void *magic)
+{
+ sctpLookupRemPortTable_entry_free(what);
+}
+
+void
+sctpLookupRemPortTable_container_clear(netsnmp_container *container)
+{
+ CONTAINER_CLEAR(container, sctpLookupRemPortTable_entry_clear, NULL);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemPortTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemPortTable.h
new file mode 100644
index 0000000000..96d49cebe6
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemPortTable.h
@@ -0,0 +1,57 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * $
+ */
+#ifndef SCTPLOOKUPREMPORTTABLE_H
+#define SCTPLOOKUPREMPORTTABLE_H
+
+#include "sctpTables_common.h"
+
+/*
+ * function declarations
+ */
+void init_sctpLookupRemPortTable(void);
+void shutdown_sctpLookupRemPortTable(void);
+void initialize_table_sctpLookupRemPortTable(void);
+Netsnmp_Node_Handler sctpLookupRemPortTable_handler;
+
+/*
+ * column number definitions for table sctpLookupRemPortTable
+ */
+#define COLUMN_SCTPLOOKUPREMPORTSTARTTIME 1
+
+/** Typical data structure for a row entry */
+#define SCTP_LOOKUP_REM_PORT_TABLE_INDEX_SIZE 100
+struct sctpLookupRemPortTable_entry_s {
+ netsnmp_index oid_index;
+ oid oid_tmp[SCTP_LOOKUP_REM_PORT_TABLE_INDEX_SIZE];
+
+ /*
+ * Index values
+ */
+ u_long sctpAssocRemPort;
+ u_long sctpAssocId;
+
+ /*
+ * Column values
+ */
+ u_long sctpLookupRemPortStartTime;
+
+ int valid;
+};
+
+sctpLookupRemPortTable_entry *sctpLookupRemPortTable_entry_create(void);
+
+int
+sctpLookupRemPortTable_entry_update_index(sctpLookupRemPortTable_entry *
+ entry);
+void
+sctpLookupRemPortTable_entry_copy(sctpLookupRemPortTable_entry * from,
+ sctpLookupRemPortTable_entry * to);
+void
+sctpLookupRemPortTable_entry_free(sctpLookupRemPortTable_entry * entry);
+
+void
+sctpLookupRemPortTable_container_clear(netsnmp_container *container);
+
+#endif /* SCTPLOOKUPREMPORTTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemPrimIPAddrTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemPrimIPAddrTable.c
new file mode 100644
index 0000000000..42f634f438
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemPrimIPAddrTable.c
@@ -0,0 +1,283 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/table_container.h>
+#include "sctpLookupRemPrimIPAddrTable.h"
+
+static netsnmp_container *sctpLookupRemPrimIPAddrTable_container;
+
+/** Initializes the sctpLookupRemPrimIPAddrTable module */
+void
+init_sctpLookupRemPrimIPAddrTable(void)
+{
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ initialize_table_sctpLookupRemPrimIPAddrTable();
+}
+
+void
+shutdown_sctpLookupRemPrimIPAddrTable(void)
+{
+ sctpLookupRemPrimIPAddrTable_container_clear
+ (sctpLookupRemPrimIPAddrTable_container);
+}
+
+/** Initialize the sctpLookupRemPrimIPAddrTable table by defining its contents and how it's structured */
+void
+initialize_table_sctpLookupRemPrimIPAddrTable(void)
+{
+ static oid sctpLookupRemPrimIPAddrTable_oid[] =
+ { 1, 3, 6, 1, 2, 1, 104, 1, 9 };
+ size_t sctpLookupRemPrimIPAddrTable_oid_len =
+ OID_LENGTH(sctpLookupRemPrimIPAddrTable_oid);
+ netsnmp_handler_registration *reg = NULL;
+ netsnmp_mib_handler *handler = NULL;
+ netsnmp_container *container = NULL;
+ netsnmp_table_registration_info *table_info = NULL;
+
+ reg =
+ netsnmp_create_handler_registration("sctpLookupRemPrimIPAddrTable",
+ sctpLookupRemPrimIPAddrTable_handler,
+ sctpLookupRemPrimIPAddrTable_oid,
+ sctpLookupRemPrimIPAddrTable_oid_len,
+ HANDLER_CAN_RONLY);
+ if (NULL == reg) {
+ snmp_log(LOG_ERR,
+ "error creating handler registration for sctpLookupRemPrimIPAddrTable\n");
+ goto bail;
+ }
+
+ container =
+ netsnmp_container_find
+ ("sctpLookupRemPrimIPAddrTable:table_container");
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "error creating container for sctpLookupRemPrimIPAddrTable\n");
+ goto bail;
+ }
+ sctpLookupRemPrimIPAddrTable_container = container;
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+ if (NULL == table_info) {
+ snmp_log(LOG_ERR,
+ "error allocating table registration for sctpLookupRemPrimIPAddrTable\n");
+ goto bail;
+ }
+ netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER, /* index: sctpAssocRemPrimAddrType */
+ ASN_OCTET_STR, /* index: sctpAssocRemPrimAddr */
+ ASN_UNSIGNED, /* index: sctpAssocId */
+ 0);
+ table_info->min_column = COLUMN_SCTPLOOKUPREMPRIMIPADDRSTARTTIME;
+ table_info->max_column = COLUMN_SCTPLOOKUPREMPRIMIPADDRSTARTTIME;
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler = netsnmp_container_table_handler_get(table_info, container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ if (NULL == handler) {
+ snmp_log(LOG_ERR,
+ "error allocating table registration for sctpLookupRemPrimIPAddrTable\n");
+ goto bail;
+ }
+ if (SNMPERR_SUCCESS != netsnmp_inject_handler(reg, handler)) {
+ snmp_log(LOG_ERR,
+ "error injecting container_table handler for sctpLookupRemPrimIPAddrTable\n");
+ goto bail;
+ }
+ handler = NULL; /* reg has it, will reuse below */
+
+ /*
+ * register the table
+ */
+ if (SNMPERR_SUCCESS != netsnmp_register_table(reg, table_info)) {
+ snmp_log(LOG_ERR,
+ "error registering table handler for sctpLookupRemPrimIPAddrTable\n");
+ goto bail;
+ }
+
+ return; /* ok */
+
+ /*
+ * Some error occurred during registration. Clean up and bail.
+ */
+ bail: /* not ok */
+
+ if (handler)
+ netsnmp_handler_free(handler);
+
+ if (table_info)
+ netsnmp_table_registration_info_free(table_info);
+
+ if (container)
+ CONTAINER_FREE(container);
+
+ if (reg)
+ netsnmp_handler_registration_free(reg);
+}
+
+/** handles requests for the sctpLookupRemPrimIPAddrTable table */
+int
+sctpLookupRemPrimIPAddrTable_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request;
+ netsnmp_table_request_info *table_info;
+ sctpLookupRemPrimIPAddrTable_entry *table_entry;
+
+ switch (reqinfo->mode) {
+ /*
+ * Read-support (also covers GetNext requests)
+ */
+ case MODE_GET:
+ for (request = requests; request; request = request->next) {
+ if (request->processed)
+ continue;
+ table_entry = (sctpLookupRemPrimIPAddrTable_entry *)
+ netsnmp_container_table_extract_context(request);
+ table_info = netsnmp_extract_table_info(request);
+ if ((NULL == table_entry) || (NULL == table_info)) {
+ snmp_log(LOG_ERR,
+ "could not extract table entry or info for sctpLookupRemPrimIPAddrTable\n");
+ snmp_set_var_typed_value(request->requestvb,
+ SNMP_ERR_GENERR, NULL, 0);
+ continue;
+ }
+
+ switch (table_info->colnum) {
+ case COLUMN_SCTPLOOKUPREMPRIMIPADDRSTARTTIME:
+ if (!table_entry) {
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHINSTANCE);
+ continue;
+ }
+ snmp_set_var_typed_integer(request->requestvb,
+ ASN_TIMETICKS,
+ table_entry->sctpLookupRemPrimIPAddrStartTime);
+ break;
+ default:
+ netsnmp_set_request_error(reqinfo, request,
+ SNMP_NOSUCHOBJECT);
+ break;
+ }
+ }
+ break;
+
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+sctpLookupRemPrimIPAddrTable_entry *
+sctpLookupRemPrimIPAddrTable_entry_create(void)
+{
+ sctpLookupRemPrimIPAddrTable_entry *entry =
+ SNMP_MALLOC_TYPEDEF(sctpLookupRemPrimIPAddrTable_entry);
+ if (entry != NULL) {
+ entry->oid_index.len =
+ SCTP_LOOKUP_REM_PRIM_IP_ADDR_TABLE_INDEX_SIZE;
+ entry->oid_index.oids = entry->oid_tmp;
+ }
+
+ return entry;
+}
+
+int
+sctpLookupRemPrimIPAddrTable_entry_update_index
+ (sctpLookupRemPrimIPAddrTable_entry * entry)
+{
+ netsnmp_variable_list var_sctpAssocRemPrimAddrType;
+ netsnmp_variable_list var_sctpAssocRemPrimAddr;
+ netsnmp_variable_list var_sctpAssocId;
+ int err = 0;
+
+ /*
+ * prepare the value to be converted
+ */
+ memset(&var_sctpAssocRemPrimAddrType, 0,
+ sizeof(var_sctpAssocRemPrimAddrType));
+ var_sctpAssocRemPrimAddrType.type = ASN_UNSIGNED;
+ var_sctpAssocRemPrimAddrType.next_variable = &var_sctpAssocRemPrimAddr;
+ snmp_set_var_value(&var_sctpAssocRemPrimAddrType,
+ (u_char *) & entry->sctpAssocRemPrimAddrType,
+ sizeof(entry->sctpAssocRemPrimAddrType));
+
+ memset(&var_sctpAssocRemPrimAddr, 0, sizeof(var_sctpAssocRemPrimAddr));
+ var_sctpAssocRemPrimAddr.type = ASN_OCTET_STR;
+ var_sctpAssocRemPrimAddr.next_variable = &var_sctpAssocId;
+ snmp_set_var_value(&var_sctpAssocRemPrimAddr,
+ (u_char *) & entry->sctpAssocRemPrimAddr,
+ entry->sctpAssocRemPrimAddr_len);
+
+ memset(&var_sctpAssocId, 0, sizeof(var_sctpAssocId));
+ var_sctpAssocId.type = ASN_UNSIGNED;
+ var_sctpAssocId.next_variable = NULL;
+ snmp_set_var_value(&var_sctpAssocId, (u_char *) & entry->sctpAssocId,
+ sizeof(entry->sctpAssocId));
+
+ /*
+ * convert it
+ */
+ err =
+ build_oid_noalloc(entry->oid_index.oids, entry->oid_index.len,
+ &entry->oid_index.len, NULL, 0,
+ &var_sctpAssocRemPrimAddrType);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * release any memory allocated during the conversion
+ */
+ snmp_reset_var_buffers(&var_sctpAssocRemPrimAddrType);
+
+ return err;
+}
+
+void
+sctpLookupRemPrimIPAddrTable_entry_copy(sctpLookupRemPrimIPAddrTable_entry
+ * from,
+ sctpLookupRemPrimIPAddrTable_entry
+ * to)
+{
+ memcpy(to, from, sizeof(sctpLookupRemPrimIPAddrTable_entry));
+ to->oid_index.oids = to->oid_tmp;
+}
+
+
+void
+sctpLookupRemPrimIPAddrTable_entry_free(sctpLookupRemPrimIPAddrTable_entry
+ * entry)
+{
+ if (entry != NULL)
+ SNMP_FREE(entry);
+}
+
+netsnmp_container *
+sctpLookupRemPrimIPAddrTable_get_container(void)
+{
+ return sctpLookupRemPrimIPAddrTable_container;
+}
+
+
+static void
+sctpLookupRemPrimIPAddrTable_entry_clear(void *what, void *magic)
+{
+ sctpLookupRemPrimIPAddrTable_entry_free(what);
+}
+
+void
+sctpLookupRemPrimIPAddrTable_container_clear(netsnmp_container *container)
+{
+ CONTAINER_CLEAR(container, sctpLookupRemPrimIPAddrTable_entry_clear,
+ NULL);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemPrimIPAddrTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemPrimIPAddrTable.h
new file mode 100644
index 0000000000..aaa5a0bc18
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpLookupRemPrimIPAddrTable.h
@@ -0,0 +1,65 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * $
+ */
+#ifndef SCTPLOOKUPREMPRIMIPADDRTABLE_H
+#define SCTPLOOKUPREMPRIMIPADDRTABLE_H
+
+#include "sctpTables_common.h"
+
+/*
+ * function declarations
+ */
+void init_sctpLookupRemPrimIPAddrTable(void);
+void shutdown_sctpLookupRemPrimIPAddrTable(void);
+void initialize_table_sctpLookupRemPrimIPAddrTable(void);
+Netsnmp_Node_Handler sctpLookupRemPrimIPAddrTable_handler;
+
+/*
+ * column number definitions for table sctpLookupRemPrimIPAddrTable
+ */
+#define COLUMN_SCTPLOOKUPREMPRIMIPADDRSTARTTIME 1
+
+/** Typical data structure for a row entry */
+#define SCTP_LOOKUP_REM_PRIM_IP_ADDR_TABLE_INDEX_SIZE 100
+struct sctpLookupRemPrimIPAddrTable_entry_s {
+ netsnmp_index oid_index;
+ oid oid_tmp[SCTP_LOOKUP_REM_PRIM_IP_ADDR_TABLE_INDEX_SIZE];
+
+ /*
+ * Index values
+ */
+ u_long sctpAssocRemPrimAddrType;
+ char sctpAssocRemPrimAddr[SCTP_IPADDRESS_SIZE];
+ u_long sctpAssocRemPrimAddr_len;
+ u_long sctpAssocId;
+
+ /*
+ * Column values
+ */
+ u_long sctpLookupRemPrimIPAddrStartTime;
+
+ int valid;
+};
+
+sctpLookupRemPrimIPAddrTable_entry *
+sctpLookupRemPrimIPAddrTable_entry_create(void);
+
+int
+sctpLookupRemPrimIPAddrTable_entry_update_index (sctpLookupRemPrimIPAddrTable_entry
+ * entry);
+
+void
+sctpLookupRemPrimIPAddrTable_entry_copy(sctpLookupRemPrimIPAddrTable_entry
+ * from,
+ sctpLookupRemPrimIPAddrTable_entry
+ * to);
+
+void
+sctpLookupRemPrimIPAddrTable_entry_free(sctpLookupRemPrimIPAddrTable_entry
+ * entry);
+
+void
+sctpLookupRemPrimIPAddrTable_container_clear(netsnmp_container *container);
+
+#endif /* SCTPLOOKUPREMPRIMIPADDRTABLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars.c
new file mode 100644
index 0000000000..1e26d11107
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars.c
@@ -0,0 +1,314 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "sctpScalars.h"
+#include "sctpScalars_common.h"
+
+oid sctp_stats_oid[] = { 1, 3, 6, 1, 2, 1, 104, 1, 1 };
+oid sctp_params_oid[] = { 1, 3, 6, 1, 2, 1, 104, 1, 2 };
+
+/** Initializes the sctp_scalars module */
+void
+init_sctpScalars(void)
+{
+ netsnmp_handler_registration *reginfo_stats;
+ netsnmp_handler_registration *reginfo_params;
+
+ DEBUGMSGTL(("sctp:scalars:init", "Initializing\n"));
+
+ reginfo_stats =
+ netsnmp_create_handler_registration("sctpStats",
+ sctp_stats_handler,
+ sctp_stats_oid,
+ OID_LENGTH(sctp_stats_oid),
+ HANDLER_CAN_RONLY);
+ netsnmp_register_scalar_group(reginfo_stats, SCTP_CURRESTAB,
+ SCTP_DISCONTINUITYTIME);
+ netsnmp_inject_handler(reginfo_stats,
+ netsnmp_get_cache_handler
+ (SCTP_STATS_CACHE_TIMEOUT,
+ netsnmp_access_sctp_stats_load,
+ netsnmp_access_sctp_stats_free, sctp_stats_oid,
+ OID_LENGTH(sctp_stats_oid)));
+
+
+ reginfo_params =
+ netsnmp_create_handler_registration("sctpParams",
+ sctp_params_handler,
+ sctp_params_oid,
+ OID_LENGTH(sctp_params_oid),
+ HANDLER_CAN_RONLY);
+ netsnmp_register_scalar_group(reginfo_params, SCTP_RTOALGORITHM,
+ SCTP_MAXINITRETR);
+ netsnmp_inject_handler(reginfo_params,
+ netsnmp_get_cache_handler
+ (SCTP_PARAMS_CACHE_TIMEOUT,
+ netsnmp_access_sctp_params_load,
+ netsnmp_access_sctp_params_free,
+ sctp_params_oid, OID_LENGTH(sctp_params_oid)));
+}
+
+/**
+ * Handle request for sctpStats.
+ * Handles only one request at a time, serialize_handler is automatically added by netsnmp_register_scalar_group.
+ */
+int
+sctp_stats_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *request)
+{
+ netsnmp_variable_list *requestvb;
+ int subid;
+ int ret;
+
+ DEBUGMSGTL(("sctp:scalars:stats", "Handler - mode %s\n",
+ se_find_label_in_slist("agent_mode", reqinfo->mode)));
+ if (reqinfo->mode != MODE_GET) {
+ snmp_log(LOG_WARNING, "sctp/stats: Unsupported mode (%d)\n",
+ reqinfo->mode);
+ return SNMP_ERR_NOERROR;
+ }
+
+ requestvb = request->requestvb;
+ subid = requestvb->name[OID_LENGTH(sctp_stats_oid)];
+ DEBUGMSGTL(("sctp:scalars:stats", "oid: "));
+ DEBUGMSGOID(("sctp:scalars:stats", requestvb->name,
+ requestvb->name_length));
+ DEBUGMSG(("sctp:scalars:stats", "\n"));
+
+
+ /*
+ * Load the cache if it was not loaded before
+ */
+ if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) {
+ DEBUGMSGTL(("sctp:scalars:stats", "cache is not valid!\n"));
+ ret = netsnmp_access_sctp_stats_load(NULL, NULL);
+ if (ret < 0) {
+ DEBUGMSGTL(("sctp:scalars:stats",
+ "could not load sctp stats!\n"));
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ return SNMP_ERR_NOERROR;
+ }
+ }
+
+ switch (subid) {
+
+ case SCTP_CURRESTAB:
+ snmp_set_var_typed_value(request->requestvb, ASN_GAUGE,
+ (u_char *) & sctp_stats.curr_estab,
+ sizeof(sctp_stats.curr_estab));
+ break;
+
+ case SCTP_ACTIVEESTABS:
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER,
+ (u_char *) & sctp_stats.active_estabs,
+ sizeof(sctp_stats.active_estabs));
+ break;
+
+ case SCTP_PASSIVEESTABS:
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER,
+ (u_char *) & sctp_stats.passive_estabs,
+ sizeof(sctp_stats.passive_estabs));
+ break;
+
+ case SCTP_ABORTEDS:
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER,
+ (u_char *) & sctp_stats.aborteds,
+ sizeof(sctp_stats.aborteds));
+ break;
+
+ case SCTP_SHUTDOWNS:
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER,
+ (u_char *) & sctp_stats.shutdowns,
+ sizeof(sctp_stats.shutdowns));
+ break;
+
+ case SCTP_OUTOFBLUES:
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER,
+ (u_char *) & sctp_stats.out_of_blues,
+ sizeof(sctp_stats.out_of_blues));
+ break;
+
+ case SCTP_CHECKSUMERRORS:
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER,
+ (u_char *) & sctp_stats.checksum_errors,
+ sizeof(sctp_stats.checksum_errors));
+ break;
+
+ case SCTP_OUTCTRLCHUNKS:
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
+ (u_char *) & sctp_stats.out_ctrl_chunks,
+ sizeof(sctp_stats.out_ctrl_chunks));
+ break;
+
+ case SCTP_OUTORDERCHUNKS:
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
+ (u_char *) & sctp_stats.out_order_chunks,
+ sizeof(sctp_stats.out_order_chunks));
+ break;
+
+ case SCTP_OUTUNORDERCHUNKS:
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
+ (u_char *) &
+ sctp_stats.out_unorder_chunks,
+ sizeof(sctp_stats.out_unorder_chunks));
+ break;
+
+ case SCTP_INCTRLCHUNKS:
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
+ (u_char *) & sctp_stats.in_ctrl_chunks,
+ sizeof(sctp_stats.in_ctrl_chunks));
+ break;
+
+ case SCTP_INORDERCHUNKS:
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
+ (u_char *) & sctp_stats.in_order_chunks,
+ sizeof(sctp_stats.in_order_chunks));
+ break;
+
+ case SCTP_INUNORDERCHUNKS:
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
+ (u_char *) & sctp_stats.in_unorder_chunks,
+ sizeof(sctp_stats.in_unorder_chunks));
+ break;
+
+ case SCTP_FRAGUSRMSGS:
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
+ (u_char *) & sctp_stats.frag_usr_msgs,
+ sizeof(sctp_stats.frag_usr_msgs));
+ break;
+
+ case SCTP_REASMUSRMSGS:
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
+ (u_char *) & sctp_stats.reasm_usr_msgs,
+ sizeof(sctp_stats.reasm_usr_msgs));
+ break;
+
+ case SCTP_OUTSCTPPACKS:
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
+ (u_char *) & sctp_stats.out_sctp_packs,
+ sizeof(sctp_stats.out_sctp_packs));
+ break;
+
+ case SCTP_INSCTPPACKS:
+ snmp_set_var_typed_value(request->requestvb, ASN_COUNTER64,
+ (u_char *) & sctp_stats.in_sctp_packs,
+ sizeof(sctp_stats.in_sctp_packs));
+ break;
+
+ case SCTP_DISCONTINUITYTIME:
+ snmp_set_var_typed_value(request->requestvb, ASN_TIMETICKS,
+ (u_char *) &
+ sctp_stats.discontinuity_time,
+ sizeof(sctp_stats.discontinuity_time));
+ break;
+
+ default:
+ snmp_log(LOG_WARNING, "sctp/stats: Unsupported subid (%d)\n",
+ subid);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+/**
+ * Handle request for sctpParams.
+ * Handles only one request at a time, serialize_handler is automatically added by netsnmp_register_scalar_group.
+ */
+int
+sctp_params_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *request)
+{
+ netsnmp_variable_list *requestvb;
+ int subid;
+ int ret;
+
+ DEBUGMSGTL(("sctp:scalars:params", "Handler - mode %s\n",
+ se_find_label_in_slist("agent_mode", reqinfo->mode)));
+ if (reqinfo->mode != MODE_GET) {
+ snmp_log(LOG_WARNING, "sctp/params: Unsupported mode (%d)\n",
+ reqinfo->mode);
+ return SNMP_ERR_NOERROR;
+ }
+
+ requestvb = request->requestvb;
+ subid = requestvb->name[OID_LENGTH(sctp_stats_oid)];
+ DEBUGMSGTL(("sctp:scalars:params", "oid: "));
+ DEBUGMSGOID(("sctp:scalars:params", requestvb->name,
+ requestvb->name_length));
+ DEBUGMSG(("sctp:scalars:params", "\n"));
+
+ /*
+ * Load the cache if it was not loaded before
+ */
+ if (!netsnmp_cache_is_valid(reqinfo, reginfo->handlerName)) {
+ DEBUGMSGTL(("sctp:scalars:params", "cache is not valid!\n"));
+ ret = netsnmp_access_sctp_params_load(NULL, NULL);
+ if (ret < 0) {
+ DEBUGMSGTL(("sctp:scalars:params",
+ "could not load sctp stats!\n"));
+ netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT);
+ return SNMP_ERR_NOERROR;
+ }
+ }
+
+ switch (subid) {
+
+ case SCTP_RTOALGORITHM:
+ snmp_set_var_typed_value(request->requestvb, ASN_INTEGER,
+ (u_char *) & sctp_params.rto_algorithm,
+ sizeof(sctp_params.rto_algorithm));
+ break;
+
+ case SCTP_RTOMIN:
+ snmp_set_var_typed_value(request->requestvb, ASN_UNSIGNED,
+ (u_char *) & sctp_params.rto_min,
+ sizeof(sctp_params.rto_min));
+ break;
+
+ case SCTP_RTOMAX:
+ snmp_set_var_typed_value(request->requestvb, ASN_UNSIGNED,
+ (u_char *) & sctp_params.rto_max,
+ sizeof(sctp_params.rto_max));
+ break;
+
+ case SCTP_RTOINITIAL:
+ snmp_set_var_typed_value(request->requestvb, ASN_UNSIGNED,
+ (u_char *) & sctp_params.rto_initial,
+ sizeof(sctp_params.rto_initial));
+ break;
+
+ case SCTP_MAXASSOCS:
+ snmp_set_var_typed_value(request->requestvb, ASN_INTEGER,
+ (u_char *) & sctp_params.max_assocs,
+ sizeof(sctp_params.max_assocs));
+ break;
+
+ case SCTP_VALCOOKIELIFE:
+ snmp_set_var_typed_value(request->requestvb, ASN_UNSIGNED,
+ (u_char *) & sctp_params.val_cookie_life,
+ sizeof(sctp_params.val_cookie_life));
+ break;
+
+ case SCTP_MAXINITRETR:
+ snmp_set_var_typed_value(request->requestvb, ASN_UNSIGNED,
+ (u_char *) & sctp_params.max_init_retr,
+ sizeof(sctp_params.max_init_retr));
+ break;
+
+ default:
+ snmp_log(LOG_WARNING, "sctp/params: Unsupported subid (%d)\n",
+ subid);
+ break;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars.h
new file mode 100644
index 0000000000..25b187adb9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars.h
@@ -0,0 +1,23 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf 11805 2005-01-07 09:37:18Z dts12 $
+ */
+#ifndef SCTP_SCALARS_H
+#define SCTP_SCALARS_H
+config_require(sctp-mib/sctpScalars_common)
+#if defined( linux )
+config_require(sctp-mib/sctpScalars_linux)
+#else
+/*
+ * couldn't determine the correct file!
+ * require a bogus file to generate an error.
+ */
+config_require(sctp-mib/scalars-unknown-arch)
+#endif
+/*
+ * Initialize and register the sctpStats and sctpParams handlers.
+ */
+extern void init_sctpScalars(void);
+
+
+#endif /* SCTP_SCALARS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars_common.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars_common.c
new file mode 100644
index 0000000000..5a9ee34aa6
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars_common.c
@@ -0,0 +1,141 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "sctpScalars_common.h"
+
+netsnmp_sctp_stats sctp_stats;
+static netsnmp_sctp_stats prev_sctp_stats;
+
+netsnmp_sctp_params sctp_params;
+static netsnmp_sctp_params prev_sctp_params;
+
+static int need_wrap_check = 1;
+
+void
+netsnmp_access_sctp_stats_init()
+{
+ netsnmp_access_sctp_stats_arch_init();
+}
+
+int
+netsnmp_access_sctp_stats_load(netsnmp_cache * cache, void *magic)
+{
+ netsnmp_sctp_stats new_stats;
+ int ret;
+
+ DEBUGMSGTL(("sctp:scalars:stats:load", "called\n"));
+
+ ret = netsnmp_access_sctp_stats_arch_load(&new_stats);
+ if (ret < 0) {
+ DEBUGMSGTL(("sctp:scalars:stats:load", "arch load failed\n"));
+ return ret;
+ }
+
+ /*
+ * If we've determined that we have 64 bit counters, just copy them.
+ */
+ if (0 == need_wrap_check) {
+ memcpy(&sctp_stats, &new_stats, sizeof(new_stats));
+ return 0;
+ }
+
+ /*
+ * Update 32 bit counters
+ */
+ sctp_stats.curr_estab = new_stats.curr_estab;
+ sctp_stats.active_estabs = new_stats.active_estabs;
+ sctp_stats.passive_estabs = new_stats.passive_estabs;
+ sctp_stats.aborteds = new_stats.aborteds;
+ sctp_stats.shutdowns = new_stats.shutdowns;
+ sctp_stats.out_of_blues = new_stats.out_of_blues;
+ sctp_stats.checksum_errors = new_stats.checksum_errors;
+ sctp_stats.discontinuity_time = new_stats.discontinuity_time;
+
+ /*
+ * Update 64 bit counters
+ */
+ netsnmp_c64_check32_and_update(&sctp_stats.out_ctrl_chunks,
+ &new_stats.out_ctrl_chunks,
+ &prev_sctp_stats.out_ctrl_chunks,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&sctp_stats.out_order_chunks,
+ &new_stats.out_order_chunks,
+ &prev_sctp_stats.out_order_chunks,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&sctp_stats.out_unorder_chunks,
+ &new_stats.out_unorder_chunks,
+ &prev_sctp_stats.out_unorder_chunks,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&sctp_stats.in_ctrl_chunks,
+ &new_stats.in_ctrl_chunks,
+ &prev_sctp_stats.in_ctrl_chunks,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&sctp_stats.in_order_chunks,
+ &new_stats.in_order_chunks,
+ &prev_sctp_stats.in_order_chunks,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&sctp_stats.in_unorder_chunks,
+ &new_stats.in_unorder_chunks,
+ &prev_sctp_stats.in_unorder_chunks,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&sctp_stats.frag_usr_msgs,
+ &new_stats.frag_usr_msgs,
+ &prev_sctp_stats.frag_usr_msgs,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&sctp_stats.reasm_usr_msgs,
+ &new_stats.reasm_usr_msgs,
+ &prev_sctp_stats.reasm_usr_msgs,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&sctp_stats.out_sctp_packs,
+ &new_stats.out_sctp_packs,
+ &prev_sctp_stats.out_sctp_packs,
+ &need_wrap_check);
+ netsnmp_c64_check32_and_update(&sctp_stats.in_sctp_packs,
+ &new_stats.in_sctp_packs,
+ &prev_sctp_stats.in_sctp_packs,
+ &need_wrap_check);
+
+ /*
+ * Update prev_stats for next computation.
+ */
+ memcpy(&prev_sctp_stats, &new_stats, sizeof(new_stats));
+ return 0;
+}
+
+void
+netsnmp_access_sctp_stats_free(netsnmp_cache * cache, void *magic)
+{
+ /*
+ * Do nothing
+ */
+}
+
+void
+netsnmp_access_sctp_params_init()
+{
+ netsnmp_access_sctp_params_arch_init();
+}
+
+int
+netsnmp_access_sctp_params_load(netsnmp_cache * cache, void *magic)
+{
+ int ret;
+
+ DEBUGMSGTL(("sctp:scalars:params:load", "called\n"));
+
+ ret = netsnmp_access_sctp_params_arch_load(&sctp_params);
+ if (ret < 0) {
+ DEBUGMSGTL(("sctp:scalars:params:load", "arch load failed\n"));
+ return ret;
+ }
+ return 0;
+}
+
+void
+netsnmp_access_sctp_params_free(netsnmp_cache * cache, void *magic)
+{
+ /*
+ * Do nothing
+ */
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars_common.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars_common.h
new file mode 100644
index 0000000000..7e5ceb5c94
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars_common.h
@@ -0,0 +1,148 @@
+#ifndef SCTP_SCALARS_COMMON_H
+#define SCTP_SCALARS_COMMON_H
+
+/*
+ * Define OIDs
+ */
+#define SCTP_CURRESTAB 1
+#define SCTP_ACTIVEESTABS 2
+#define SCTP_PASSIVEESTABS 3
+#define SCTP_ABORTEDS 4
+#define SCTP_SHUTDOWNS 5
+#define SCTP_OUTOFBLUES 6
+#define SCTP_CHECKSUMERRORS 7
+#define SCTP_OUTCTRLCHUNKS 8
+#define SCTP_OUTORDERCHUNKS 9
+#define SCTP_OUTUNORDERCHUNKS 10
+#define SCTP_INCTRLCHUNKS 11
+#define SCTP_INORDERCHUNKS 12
+#define SCTP_INUNORDERCHUNKS 13
+#define SCTP_FRAGUSRMSGS 14
+#define SCTP_REASMUSRMSGS 15
+#define SCTP_OUTSCTPPACKS 16
+#define SCTP_INSCTPPACKS 17
+#define SCTP_DISCONTINUITYTIME 18
+
+#define SCTP_RTOALGORITHM 1
+#define SCTP_RTOMIN 2
+#define SCTP_RTOMAX 3
+#define SCTP_RTOINITIAL 4
+#define SCTP_MAXASSOCS 5
+#define SCTP_VALCOOKIELIFE 6
+#define SCTP_MAXINITRETR 7
+
+/*
+ * Define cache timeouts
+ */
+#define SCTP_STATS_CACHE_TIMEOUT 30
+#define SCTP_PARAMS_CACHE_TIMEOUT 30
+
+/*
+ * Structure to hold sctpStats
+ */
+typedef struct netsnmp_sctp_stats_s {
+ u_int curr_estab;
+ u_int active_estabs;
+ u_int passive_estabs;
+ u_int aborteds;
+ u_int shutdowns;
+ u_int out_of_blues;
+ u_int checksum_errors;
+ struct counter64 out_ctrl_chunks;
+ struct counter64 out_order_chunks;
+ struct counter64 out_unorder_chunks;
+ struct counter64 in_ctrl_chunks;
+ struct counter64 in_order_chunks;
+ struct counter64 in_unorder_chunks;
+ struct counter64 frag_usr_msgs;
+ struct counter64 reasm_usr_msgs;
+ struct counter64 out_sctp_packs;
+ struct counter64 in_sctp_packs;
+ u_long discontinuity_time;
+} netsnmp_sctp_stats;
+
+/*
+ * Enums for sctpParams
+ */
+#define NETSNMP_SCTP_ALGORITHM_OTHER 1
+#define NETSNMP_SCTP_ALGORITHM_VANJ 2
+
+/*
+ * Structure to hold sctpParams
+ */
+typedef struct netsnmp_sctp_params_s {
+ u_int rto_algorithm;
+ u_int rto_min;
+ u_int rto_max;
+ u_int rto_initial;
+ int max_assocs;
+ u_int val_cookie_life;
+ u_int max_init_retr;
+} netsnmp_sctp_params;
+
+
+/*
+ * sctpStats cached values.
+ * Will be used to reconstruct 64-bit counters when the underlying platform
+ * provides only 32-bit ones.
+ */
+extern netsnmp_sctp_stats sctp_stats;
+
+/*
+ * sctpParams cached values.
+ */
+extern netsnmp_sctp_params sctp_params;
+
+Netsnmp_Node_Handler sctp_stats_handler;
+Netsnmp_Node_Handler sctp_params_handler;
+
+/*
+ * function declarations
+ */
+
+
+/*
+ * =======================================================
+ * Platform independent functions.
+ * Mostly just wrappers around the platform dependent ones.
+ * =======================================================
+ */
+extern void netsnmp_access_sctp_stats_init(void);
+extern NetsnmpCacheLoad netsnmp_access_sctp_stats_load;
+extern NetsnmpCacheFree netsnmp_access_sctp_stats_free;
+
+extern void netsnmp_access_sctp_params_init(void);
+extern NetsnmpCacheLoad netsnmp_access_sctp_params_load;
+extern NetsnmpCacheFree netsnmp_access_sctp_params_free;
+
+/*
+ * =======================================================
+ * Platform dependent functions.
+ * These do the real work.
+ * =======================================================
+ */
+
+/*
+ * Initialize patform dependent part of sctpStats.
+ */
+extern void netsnmp_access_sctp_stats_arch_init(void);
+
+/*
+ * Load the sctpStats from underlying platform. The caller will reconstruct
+ * 64-bit counters if the platform provided 32-bit ones only.
+ */
+extern int netsnmp_access_sctp_stats_arch_load(netsnmp_sctp_stats *
+ sctp_stats);
+
+/*
+ * Initialize patform dependent part of sctpParams.
+ */
+extern void netsnmp_access_sctp_params_arch_init(void);
+
+/*
+ * Load the sctpParams.
+ */
+extern int netsnmp_access_sctp_params_arch_load(netsnmp_sctp_params *
+ sctp_params);
+
+#endif /* SCTP_SCALARS_COMMON_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars_linux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars_linux.c
new file mode 100644
index 0000000000..42c7050e05
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpScalars_linux.c
@@ -0,0 +1,185 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "sctpScalars_common.h"
+
+#include <stdio.h>
+#include <errno.h>
+
+#define PROC_PREFIX "/proc"
+#define PROC_RTO_MIN PROC_PREFIX "/sys/net/sctp/rto_min"
+#define PROC_RTO_MAX PROC_PREFIX "/sys/net/sctp/rto_max"
+#define PROC_RTO_INITIAL PROC_PREFIX "/sys/net/sctp/rto_initial"
+#define PROC_VAL_COOKIE_LIFE PROC_PREFIX "/sys/net/sctp/valid_cookie_life"
+#define PROC_MAX_INIT_RETR PROC_PREFIX "/sys/net/sctp/max_init_retransmits"
+#define PROC_STATS PROC_PREFIX "/net/sctp/snmp"
+
+/**
+ * Reads one integer value from a file.
+ */
+static int
+load_uint_file(const char *filename, u_int * value)
+{
+ FILE *f;
+ int ret;
+
+ f = fopen(filename, "r");
+ if (f == NULL) {
+ DEBUGMSGTL(("sctp:scalars:arch:load", "Cannot read file %s\n",
+ filename));
+ return -1;
+ }
+
+ ret = fscanf(f, "%u", value);
+ if (ret != 1) {
+ DEBUGMSGTL(("sctp:scalars:arch:load", "Malformed file %s\n",
+ filename));
+ return -2;
+ }
+
+ fclose(f);
+ return 0;
+}
+
+void
+netsnmp_access_sctp_stats_arch_init()
+{
+}
+
+int
+netsnmp_access_sctp_stats_arch_load(netsnmp_sctp_stats * sctp_stats)
+{
+ FILE *f;
+ char line[100];
+ u_long value;
+ char *delimiter;
+ int ret = 0;
+
+ DEBUGMSGTL(("sctp:scalars:stats:arch_load",
+ "netsnmp_access_sctp_stats_arch_load called"));
+
+ memset(sctp_stats, 0, sizeof(netsnmp_sctp_stats));
+ f = fopen(PROC_STATS, "r");
+ if (f == NULL)
+ return -1;
+
+ while (fgets(line, sizeof(line), f) != NULL) {
+ DEBUGMSGTL(("sctp:scalars:stats:arch_load", "read: %s", line));
+
+ delimiter = strchr(line, '\t');
+ if (delimiter == NULL) {
+ DEBUGMSGTL(("sctp:scalars:stats:arch_load",
+ "Malformed line, cannot find '\\t'!\n"));
+ return -1;
+ }
+ errno = 0;
+ value = strtoul(delimiter + 1, NULL, 10);
+ if (errno != 0) {
+ DEBUGMSGTL(("sctp:scalars:stats:arch_load",
+ "Malformed value!'\n"));
+ return -1;
+ }
+
+ if (line[6] == 'r')
+ sctp_stats->curr_estab = value;
+ else if (line[5] == 'c')
+ sctp_stats->active_estabs = value;
+ else if (line[4] == 'P')
+ sctp_stats->passive_estabs = value;
+ else if (line[5] == 'b')
+ sctp_stats->aborteds = value;
+ else if (line[4] == 'S')
+ sctp_stats->shutdowns = value;
+ else if (line[8] == 'f')
+ sctp_stats->out_of_blues = value;
+ else if (line[6] == 'e')
+ sctp_stats->checksum_errors = value;
+ else if (line[4] == 'O') {
+ if (line[7] == 'C') {
+ sctp_stats->out_ctrl_chunks.low = value & 0xffffffff;
+ sctp_stats->out_ctrl_chunks.high = value >> 32;
+ } else if (line[7] == 'O') {
+ sctp_stats->out_order_chunks.low = value & 0xffffffff;
+ sctp_stats->out_order_chunks.high = value >> 32;
+ } else if (line[7] == 'U') {
+ sctp_stats->out_unorder_chunks.low = value & 0xffffffff;
+ sctp_stats->out_unorder_chunks.high = value >> 32;
+ } else if (line[7] == 'S') {
+ sctp_stats->out_sctp_packs.low = value & 0xffffffff;
+ sctp_stats->out_sctp_packs.high = value >> 32;
+ } else
+ ret = -1;
+ } else {
+ if (line[6] == 'C') {
+ sctp_stats->in_ctrl_chunks.low = value & 0xffffffff;
+ sctp_stats->in_ctrl_chunks.high = value >> 32;
+ } else if (line[6] == 'O') {
+ sctp_stats->in_order_chunks.low = value & 0xffffffff;
+ sctp_stats->in_order_chunks.high = value >> 32;
+ } else if (line[6] == 'U') {
+ sctp_stats->in_unorder_chunks.low = value & 0xffffffff;
+ sctp_stats->in_unorder_chunks.high = value >> 32;
+ } else if (line[4] == 'F') {
+ sctp_stats->frag_usr_msgs.low = value & 0xffffffff;
+ sctp_stats->frag_usr_msgs.high = value >> 32;
+ } else if (line[4] == 'R') {
+ sctp_stats->reasm_usr_msgs.low = value & 0xffffffff;
+ sctp_stats->reasm_usr_msgs.high = value >> 32;
+ } else if (line[6] == 'S') {
+ sctp_stats->in_sctp_packs.low = value & 0xffffffff;
+ sctp_stats->in_sctp_packs.high = value >> 32;
+ } else
+ ret = -1;
+ }
+
+ if (ret < 0) {
+ DEBUGMSGTL(("sctp:scalars:stats:arch_load",
+ "Unknown entry!'\n"));
+ return ret;
+ }
+ }
+
+ sctp_stats->discontinuity_time = 0;
+ return 0;
+}
+
+void
+netsnmp_access_sctp_params_arch_init()
+{
+}
+
+int
+netsnmp_access_sctp_params_arch_load(netsnmp_sctp_params * sctp_params)
+{
+ int ret;
+ DEBUGMSGTL(("sctp:scalars:params:arch_load",
+ "netsnmp_access_sctp_params_arch_load called"));
+
+ sctp_params->rto_algorithm = NETSNMP_SCTP_ALGORITHM_OTHER;
+
+ ret = load_uint_file(PROC_RTO_MIN, &sctp_params->rto_min);
+ if (ret < 0)
+ return ret;
+
+ ret = load_uint_file(PROC_RTO_MAX, &sctp_params->rto_max);
+ if (ret < 0)
+ return ret;
+
+ ret = load_uint_file(PROC_RTO_INITIAL, &sctp_params->rto_initial);
+ if (ret < 0)
+ return ret;
+
+ sctp_params->max_assocs = -1; /* dynamic allocation of associations */
+
+ ret = load_uint_file(PROC_VAL_COOKIE_LIFE,
+ &sctp_params->val_cookie_life);
+ if (ret < 0)
+ return ret;
+
+ ret = load_uint_file(PROC_MAX_INIT_RETR, &sctp_params->max_init_retr);
+ if (ret < 0)
+ return ret;
+
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpTables.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpTables.h
new file mode 100644
index 0000000000..544144a9fb
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpTables.h
@@ -0,0 +1,24 @@
+#ifndef SCTP_TABLES_H
+#define SCTP_TABLES_H
+config_require(sctp-mib/sctpTables_common)
+config_require(sctp-mib/sctpAssocRemAddrTable)
+config_require(sctp-mib/sctpAssocLocalAddrTable)
+config_require(sctp-mib/sctpLookupLocalPortTable)
+config_require(sctp-mib/sctpLookupRemPortTable)
+config_require(sctp-mib/sctpLookupRemHostNameTable)
+config_require(sctp-mib/sctpLookupRemPrimIPAddrTable)
+config_require(sctp-mib/sctpLookupRemIPAddrTable)
+/*
+ * this one must be last to ensure proper initialization ordering
+ */
+config_require(sctp-mib/sctpAssocTable)
+#if defined( linux )
+config_require(sctp-mib/sctpTables_linux)
+#else
+/*
+* couldn't determine the correct file!
+* require a bogus file to generate an error.
+*/
+config_require(sctp-mib/tables-unknown-arch)
+#endif
+#endif /* SCTP_TABLES_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpTables_common.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpTables_common.c
new file mode 100644
index 0000000000..0deb942640
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpTables_common.c
@@ -0,0 +1,441 @@
+#include "sctpTables_common.h"
+#include "sctpAssocTable.h"
+#include "sctpAssocRemAddrTable.h"
+#include "sctpAssocLocalAddrTable.h"
+#include "sctpLookupLocalPortTable.h"
+#include "sctpLookupRemPortTable.h"
+#include "sctpLookupRemHostNameTable.h"
+#include "sctpLookupRemPrimIPAddrTable.h"
+#include "sctpLookupRemIPAddrTable.h"
+
+static void
+sctpAssocTable_collect_invalid(void *what, void *magic)
+{
+ sctpAssocTable_entry *entry = what;
+ netsnmp_container *to_delete = magic;
+
+ if (entry->valid)
+ entry->valid = 0;
+ else
+ CONTAINER_INSERT(to_delete, entry);
+}
+
+/*
+ * Remove all entries from sctpAssocTable, which are not marked as valid.
+ * All valid entries are then marked as invalid (to delete them in next cache
+ * load, if the entry is not updated).
+ */
+void
+sctpAssocTable_delete_invalid(netsnmp_container *assocTable)
+{
+ netsnmp_container *to_delete = netsnmp_container_find("lifo");
+
+ CONTAINER_FOR_EACH(assocTable, sctpAssocTable_collect_invalid,
+ to_delete);
+
+ while (CONTAINER_SIZE(to_delete)) {
+ sctpAssocTable_entry *entry = CONTAINER_FIRST(to_delete);
+ CONTAINER_REMOVE(assocTable, entry);
+ sctpAssocTable_entry_free(entry);
+ CONTAINER_REMOVE(to_delete, NULL);
+ }
+}
+
+static void
+sctpAssocRemAddrTable_collect_invalid(void *what, void *magic)
+{
+ sctpAssocRemAddrTable_entry *entry = what;
+ netsnmp_container *to_delete = magic;
+
+ if (entry->valid)
+ entry->valid = 0;
+ else
+ CONTAINER_INSERT(to_delete, entry);
+}
+
+/*
+ * Remove all entries from sctpAssocRemAddrTable, which are not marked as valid.
+ * All valid entries are then marked as invalid (to delete them in next cache
+ * load, if the entry is not updated).
+ */
+void
+sctpAssocRemAddrTable_delete_invalid(netsnmp_container *remAddrTable)
+{
+ netsnmp_container *to_delete = netsnmp_container_find("lifo");
+
+ CONTAINER_FOR_EACH(remAddrTable, sctpAssocRemAddrTable_collect_invalid,
+ to_delete);
+
+ while (CONTAINER_SIZE(to_delete)) {
+ sctpAssocRemAddrTable_entry *entry = CONTAINER_FIRST(to_delete);
+ CONTAINER_REMOVE(remAddrTable, entry);
+ sctpAssocRemAddrTable_entry_free(entry);
+ CONTAINER_REMOVE(to_delete, NULL);
+ }
+}
+
+static void
+sctpAssocLocalAddrTable_collect_invalid(void *what, void *magic)
+{
+ sctpAssocLocalAddrTable_entry *entry = what;
+ netsnmp_container *to_delete = magic;
+
+ if (entry->valid)
+ entry->valid = 0;
+ else
+ CONTAINER_INSERT(to_delete, entry);
+}
+
+/*
+ * Remove all entries from sctpAssocLocalAddrTable, which are not marked as valid.
+ * All valid entries are then marked as invalid (to delete them in next cache
+ * load, if the entry is not updated).
+ */
+void
+sctpAssocLocalAddrTable_delete_invalid(netsnmp_container *localAddrTable)
+{
+ netsnmp_container *to_delete = netsnmp_container_find("lifo");
+
+ CONTAINER_FOR_EACH(localAddrTable,
+ sctpAssocLocalAddrTable_collect_invalid, to_delete);
+
+ while (CONTAINER_SIZE(to_delete)) {
+ sctpAssocLocalAddrTable_entry *entry = CONTAINER_FIRST(to_delete);
+ CONTAINER_REMOVE(localAddrTable, entry);
+ sctpAssocLocalAddrTable_entry_free(entry);
+ CONTAINER_REMOVE(to_delete, NULL);
+ }
+}
+
+
+int
+sctpAssocRemAddrTable_add_or_update(netsnmp_container *remAddrTable,
+ sctpAssocRemAddrTable_entry * entry)
+{
+ /*
+ * we have full sctpAssocLocalAddrTable entry, update or add it in the container
+ */
+ sctpAssocRemAddrTable_entry *old;
+
+ entry->valid = 1;
+
+ /*
+ * try to find it in the container
+ */
+ sctpAssocRemAddrTable_entry_update_index(entry);
+ old = CONTAINER_FIND(remAddrTable, entry);
+
+ if (old != NULL) {
+ /*
+ * update existing entry, don't overwrite the timestamp
+ */
+ time_t timestamp = old->sctpAssocRemAddrStartTime;
+ if (timestamp == 0 && entry->sctpAssocRemAddrStartTime == 0)
+ timestamp = netsnmp_get_agent_uptime(); /* set the timestamp if it was not set before */
+ sctpAssocRemAddrTable_entry_copy(entry, old);
+ old->sctpAssocRemAddrStartTime = timestamp;
+ sctpAssocRemAddrTable_entry_free(entry);
+
+ } else {
+ /*
+ * the entry is new, add it there
+ */
+ if (entry->sctpAssocRemAddrStartTime == 0) {
+ entry->sctpAssocRemAddrStartTime = netsnmp_get_agent_uptime();
+ }
+ CONTAINER_INSERT(remAddrTable, entry);
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+sctpAssocLocalAddrTable_add_or_update(netsnmp_container *localAddrTable,
+ sctpAssocLocalAddrTable_entry *
+ entry)
+{
+ /*
+ * we have full sctpAssocLocalAddrTable entry, update or add it in the container
+ */
+ sctpAssocLocalAddrTable_entry *old;
+
+ entry->valid = 1;
+
+ /*
+ * try to find it in the container
+ */
+ sctpAssocLocalAddrTable_entry_update_index(entry);
+ old = CONTAINER_FIND(localAddrTable, entry);
+
+ if (old != NULL) {
+ /*
+ * update existing entry, don't overwrite the timestamp
+ */
+ time_t timestamp = old->sctpAssocLocalAddrStartTime;
+ if (timestamp == 0 && entry->sctpAssocLocalAddrStartTime == 0)
+ timestamp = netsnmp_get_agent_uptime(); /* set the timestamp if it was not set before */
+ sctpAssocLocalAddrTable_entry_copy(entry, old);
+ old->sctpAssocLocalAddrStartTime = timestamp;
+ sctpAssocLocalAddrTable_entry_free(entry);
+
+ } else {
+ /*
+ * the entry is new, add it there
+ */
+ if (entry->sctpAssocLocalAddrStartTime == 0) {
+ entry->sctpAssocLocalAddrStartTime =
+ netsnmp_get_agent_uptime();
+ }
+ CONTAINER_INSERT(localAddrTable, entry);
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+sctpAssocTable_add_or_update(netsnmp_container *assocTable,
+ sctpAssocTable_entry * entry)
+{
+ /*
+ * we have full sctpAssocTable entry, update or add it in the container
+ */
+ sctpAssocTable_entry *old;
+
+ entry->valid = 1;
+
+ /*
+ * try to find it in the container
+ */
+ sctpAssocTable_entry_update_index(entry);
+ old = CONTAINER_FIND(assocTable, entry);
+
+ if (old != NULL) {
+ /*
+ * update existing entry, don't overwrite the timestamp
+ */
+ time_t timestamp = old->sctpAssocStartTime;
+ if (timestamp == 0 && entry->sctpAssocStartTime == 0
+ && entry->sctpAssocState >= SCTPASSOCSTATE_ESTABLISHED)
+ timestamp = netsnmp_get_agent_uptime(); /* set the timestamp if it was not set before and entry reaches the right state */
+ sctpAssocTable_entry_copy(entry, old);
+ old->sctpAssocStartTime = timestamp;
+ sctpAssocTable_entry_free(entry);
+
+ } else {
+ /*
+ * the entry is new, add it there
+ */
+ if (entry->sctpAssocStartTime == 0
+ && entry->sctpAssocState >= SCTPASSOCSTATE_ESTABLISHED) {
+ entry->sctpAssocStartTime = netsnmp_get_agent_uptime();
+ }
+ CONTAINER_INSERT(assocTable, entry);
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+static void
+sctpTables_add_local_port(sctpAssocTable_entry * assoc,
+ sctpTables_containers * containers)
+{
+ sctpLookupLocalPortTable_entry *entry;
+
+ entry = sctpLookupLocalPortTable_entry_create();
+ if (entry == NULL) {
+ DEBUGMSGTL(("sctp:tables:fill_lookup",
+ "cannot create sctpLookupLocalPortTable_entry"));
+ return;
+ }
+
+ entry->sctpAssocId = assoc->sctpAssocId;
+ entry->sctpAssocLocalPort = assoc->sctpAssocLocalPort;
+ entry->sctpLookupLocalPortStartTime = assoc->sctpAssocStartTime;
+ sctpLookupLocalPortTable_entry_update_index(entry);
+ CONTAINER_INSERT(containers->sctpLookupLocalPortTable, entry);
+}
+
+static void
+sctpTables_add_rem_port(sctpAssocTable_entry * assoc,
+ sctpTables_containers * containers)
+{
+ sctpLookupRemPortTable_entry *entry;
+
+ entry = sctpLookupRemPortTable_entry_create();
+ if (entry == NULL) {
+ DEBUGMSGTL(("sctp:tables:fill_lookup",
+ "cannot create sctpLookupRemPortTable_entry"));
+ return;
+ }
+
+ entry->sctpAssocId = assoc->sctpAssocId;
+ entry->sctpAssocRemPort = assoc->sctpAssocRemPort;
+ entry->sctpLookupRemPortStartTime = assoc->sctpAssocStartTime;
+ sctpLookupRemPortTable_entry_update_index(entry);
+ CONTAINER_INSERT(containers->sctpLookupRemPortTable, entry);
+}
+
+static void
+sctpTables_add_rem_hostname(sctpAssocTable_entry * assoc,
+ sctpTables_containers * containers)
+{
+ sctpLookupRemHostNameTable_entry *entry;
+
+ if (assoc->sctpAssocRemHostName_len == 0)
+ return; /* the association does not know its hostname */
+
+ entry = sctpLookupRemHostNameTable_entry_create();
+ if (entry == NULL) {
+ DEBUGMSGTL(("sctp:tables:fill_lookup",
+ "cannot create sctpLookupRemHostNameTable_entry"));
+ return;
+ }
+
+ entry->sctpAssocId = assoc->sctpAssocId;
+ entry->sctpAssocRemHostName_len = assoc->sctpAssocRemHostName_len;
+ memcpy(entry->sctpAssocRemHostName, assoc->sctpAssocRemHostName,
+ assoc->sctpAssocRemHostName_len);
+ entry->sctpLookupRemHostNameStartTime = assoc->sctpAssocStartTime;
+
+ sctpLookupRemHostNameTable_entry_update_index(entry);
+ CONTAINER_INSERT(containers->sctpLookupRemHostNameTable, entry);
+}
+
+static void
+sctpTables_add_rem_prim_ip_addr(sctpAssocTable_entry * assoc,
+ sctpTables_containers * containers)
+{
+ sctpLookupRemPrimIPAddrTable_entry *entry;
+
+ entry = sctpLookupRemPrimIPAddrTable_entry_create();
+ if (entry == NULL) {
+ DEBUGMSGTL(("sctp:tables:fill_lookup",
+ "cannot create sctpLookupRemPrimIPAddrTable_entry"));
+ return;
+ }
+
+ entry->sctpAssocId = assoc->sctpAssocId;
+ entry->sctpAssocRemPrimAddrType = assoc->sctpAssocRemPrimAddrType;
+ entry->sctpAssocRemPrimAddr_len = assoc->sctpAssocRemPrimAddr_len;
+ memcpy(entry->sctpAssocRemPrimAddr, assoc->sctpAssocRemPrimAddr,
+ assoc->sctpAssocRemPrimAddr_len);
+ entry->sctpLookupRemPrimIPAddrStartTime = assoc->sctpAssocStartTime;
+
+ sctpLookupRemPrimIPAddrTable_entry_update_index(entry);
+ CONTAINER_INSERT(containers->sctpLookupRemPrimIPAddrTable, entry);
+}
+
+static void
+sctpTables_fill_lookup_assoc(void *what, void *magic)
+{
+ sctpAssocTable_entry *entry = what;
+ sctpTables_containers *containers = magic;
+
+ sctpTables_add_local_port(entry, containers);
+ sctpTables_add_rem_port(entry, containers);
+ sctpTables_add_rem_hostname(entry, containers);
+ sctpTables_add_rem_prim_ip_addr(entry, containers);
+}
+
+static void
+sctpTables_add_rem_ip_addr(sctpAssocRemAddrTable_entry * rem_addr,
+ sctpTables_containers * containers)
+{
+ sctpLookupRemIPAddrTable_entry *entry;
+
+ entry = sctpLookupRemIPAddrTable_entry_create();
+ if (entry == NULL) {
+ DEBUGMSGTL(("sctp:tables:fill_lookup",
+ "cannot create sctpLookupRemIPAddrTable_entry"));
+ return;
+ }
+
+ entry->sctpAssocId = rem_addr->sctpAssocId;
+ entry->sctpAssocRemAddrType = rem_addr->sctpAssocRemAddrType;
+ entry->sctpAssocRemAddr_len = rem_addr->sctpAssocRemAddr_len;
+ memcpy(entry->sctpAssocRemAddr, rem_addr->sctpAssocRemAddr,
+ rem_addr->sctpAssocRemAddr_len);
+ entry->sctpLookupRemIPAddrStartTime =
+ rem_addr->sctpAssocRemAddrStartTime;
+
+ sctpLookupRemIPAddrTable_entry_update_index(entry);
+ CONTAINER_INSERT(containers->sctpLookupRemIPAddrTable, entry);
+}
+
+static void
+sctpTables_fill_lookup_rem_addr(void *what, void *magic)
+{
+ sctpAssocRemAddrTable_entry *entry = what;
+ sctpTables_containers *containers = magic;
+ sctpTables_add_rem_ip_addr(entry, containers);
+}
+
+int
+sctpTables_fill_lookup(sctpTables_containers * containers)
+{
+ /*
+ * clear all the lookup tables
+ */
+ sctpLookupLocalPortTable_container_clear(containers->
+ sctpLookupLocalPortTable);
+ sctpLookupRemPortTable_container_clear(containers->
+ sctpLookupRemPortTable);
+ sctpLookupRemHostNameTable_container_clear(containers->
+ sctpLookupRemHostNameTable);
+ sctpLookupRemPrimIPAddrTable_container_clear(containers->
+ sctpLookupRemPrimIPAddrTable);
+ sctpLookupRemIPAddrTable_container_clear(containers->
+ sctpLookupRemIPAddrTable);
+
+ /*
+ * fill the lookup tables
+ */
+ CONTAINER_FOR_EACH(containers->sctpAssocTable,
+ sctpTables_fill_lookup_assoc, containers);
+ CONTAINER_FOR_EACH(containers->sctpAssocRemAddrTable,
+ sctpTables_fill_lookup_rem_addr, containers);
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+int
+sctpTables_load(void)
+{
+ sctpTables_containers containers;
+ int ret;
+ u_long flags = 0;
+
+ containers.sctpAssocTable = sctpAssocTable_get_container();
+ containers.sctpAssocRemAddrTable =
+ sctpAssocRemAddrTable_get_container();
+ containers.sctpAssocLocalAddrTable =
+ sctpAssocLocalAddrTable_get_container();
+ containers.sctpLookupLocalPortTable =
+ sctpLookupLocalPortTable_get_container();
+ containers.sctpLookupRemPortTable =
+ sctpLookupRemPortTable_get_container();
+ containers.sctpLookupRemHostNameTable =
+ sctpLookupRemHostNameTable_get_container();
+ containers.sctpLookupRemPrimIPAddrTable =
+ sctpLookupRemPrimIPAddrTable_get_container();
+ containers.sctpLookupRemIPAddrTable =
+ sctpLookupRemIPAddrTable_get_container();
+
+ ret = sctpTables_arch_load(&containers, &flags);
+
+ if (flags | SCTP_TABLES_LOAD_FLAG_DELETE_INVALID) {
+ sctpAssocTable_delete_invalid(containers.sctpAssocTable);
+ sctpAssocRemAddrTable_delete_invalid(containers.
+ sctpAssocRemAddrTable);
+ sctpAssocLocalAddrTable_delete_invalid(containers.
+ sctpAssocLocalAddrTable);
+ }
+
+ if (flags | SCTP_TABLES_LOAD_FLAG_AUTO_LOOKUP) {
+ ret = sctpTables_fill_lookup(&containers);
+ }
+
+ return ret;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpTables_common.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpTables_common.h
new file mode 100644
index 0000000000..e0595c554e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpTables_common.h
@@ -0,0 +1,112 @@
+#ifndef SCTP_TABLES_COMMON_H
+#define SCTP_TABLES_COMMON_H
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#define SCTP_IPADDRESS_SIZE 16
+#define SCTP_HOSTNAME_SIZE 255
+
+#define INETADDRESSTYPE_IPV4 1
+#define INETADDRESSTYPE_IPV6 2
+
+#define TRUTHVALUE_TRUE 1
+#define TRUTHVALUE_FALSE 2
+
+#define SCTP_TABLES_CACHE_TIMEOUT 30
+
+/*
+ * Let the platform independent part delete all entries with valid==0.
+ */
+#define SCTP_TABLES_LOAD_FLAG_DELETE_INVALID 1
+/*
+ * Let the platform independent part automatically calculate the lookup tables.
+ */
+#define SCTP_TABLES_LOAD_FLAG_AUTO_LOOKUP 1
+
+typedef struct sctpTables_containers_s {
+ netsnmp_container *sctpAssocTable;
+ netsnmp_container *sctpAssocRemAddrTable;
+ netsnmp_container *sctpAssocLocalAddrTable;
+ netsnmp_container *sctpLookupLocalPortTable;
+ netsnmp_container *sctpLookupRemPortTable;
+ netsnmp_container *sctpLookupRemHostNameTable;
+ netsnmp_container *sctpLookupRemPrimIPAddrTable;
+ netsnmp_container *sctpLookupRemIPAddrTable;
+} sctpTables_containers;
+
+/*
+ * Forward declaration of some types.
+ */
+typedef struct sctpAssocTable_entry_s sctpAssocTable_entry;
+typedef struct sctpAssocRemAddrTable_entry_s sctpAssocRemAddrTable_entry;
+typedef struct sctpAssocLocalAddrTable_entry_s
+ sctpAssocLocalAddrTable_entry;
+typedef struct sctpLookupLocalPortTable_entry_s
+ sctpLookupLocalPortTable_entry;
+typedef struct sctpLookupRemPortTable_entry_s sctpLookupRemPortTable_entry;
+typedef struct sctpLookupRemHostNameTable_entry_s
+ sctpLookupRemHostNameTable_entry;
+typedef struct sctpLookupRemPrimIPAddrTable_entry_s
+ sctpLookupRemPrimIPAddrTable_entry;
+typedef struct sctpLookupRemIPAddrTable_entry_s
+ sctpLookupRemIPAddrTable_entry;
+
+extern netsnmp_container *sctpAssocTable_get_container(void);
+extern netsnmp_container *sctpAssocRemAddrTable_get_container(void);
+extern netsnmp_container *sctpAssocLocalAddrTable_get_container(void);
+extern netsnmp_container *sctpLookupLocalPortTable_get_container(void);
+extern netsnmp_container *sctpLookupRemPortTable_get_container(void);
+extern netsnmp_container *sctpLookupRemHostNameTable_get_container(void);
+extern netsnmp_container *sctpLookupRemPrimIPAddrTable_get_container(void);
+extern netsnmp_container *sctpLookupRemIPAddrTable_get_container(void);
+
+/*
+ * Platform independent helper. Reloads all sctp table containers, uses sctpTables_arch_load internally.
+ */
+extern int sctpTables_load(void);
+
+
+/*
+ * Platform dependent loader of sctp tables. It gets the containers with 'old' values and it must update these containers to reflect actual state. It does not matter if it decides to clear the containers and fill them from scratch or just update the entries.
+ * If the function wants to use automatic removal of entries with valid==0, it must set the SCTP_TABLES_LOAD_FLAG_DELETE_INVALID flag and mark all valid entries (all 'old' entries are invalid by default).
+ */
+extern int sctpTables_arch_load(sctpTables_containers * containers,
+ u_long * flags);
+
+/*
+ * Add the entry to the table or overwrite it if it already exists.
+ * Don't overwrite timestamp. If the timestamp is not set and it should be,
+ * then set it.
+ *
+ * Caller must not use the entry after calling the function, it may be freed.
+ */
+extern int sctpAssocTable_add_or_update(netsnmp_container *assocTable,
+ sctpAssocTable_entry * entry);
+
+/*
+ * Add the entry to the table or overwrite it if it already exists.
+ * Don't overwrite timestamp. If the timestamp is not set and it should be,
+ * then set it.
+ *
+ * Caller must not use the entry after calling the function, it may be freed.
+ */
+extern int sctpAssocRemAddrTable_add_or_update(netsnmp_container
+ *remAddrTable,
+ sctpAssocRemAddrTable_entry
+ * entry);
+
+/*
+ * Add the entry to the table or overwrite it if it already exists.
+ * Don't overwrite timestamp. If the timestamp is not set and it should be,
+ * then set it.
+ *
+ * Caller must not use the entry after calling the function, it may be freed.
+ */
+extern int sctpAssocLocalAddrTable_add_or_update(netsnmp_container
+ *localAddrTable,
+ sctpAssocLocalAddrTable_entry
+ * entry);
+
+#endif /* SCTP_TABLES_COMMON_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpTables_linux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpTables_linux.c
new file mode 100644
index 0000000000..0fe2d24715
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/sctp-mib/sctpTables_linux.c
@@ -0,0 +1,442 @@
+#include "sctpAssocTable.h"
+#include "sctpAssocLocalAddrTable.h"
+#include "sctpAssocRemAddrTable.h"
+#include "sctpTables_common.h"
+
+#include <util_funcs.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+
+/*
+ * Linux provides sctp statistics in /proc/net/sctp/assoc and
+ * /proc/net/sctp/remaddr. The 'assoc' file covers sctpAssocTable and
+ * sctpAssocLocalAddrTable, the later one contains sctpAssocRemAddrTable.
+ *
+ * Linux does *not* provide *StartTime timestamps. This implementation tries
+ * to guess these timestamps.
+ */
+
+
+#define PROC_PREFIX "/proc"
+#define ASSOC_FILE PROC_PREFIX "/net/sctp/assocs"
+#define REMADDR_FILE PROC_PREFIX "/net/sctp/remaddr"
+
+/*
+ * Convert string with ipv4 or ipv6 address to provided buffer.
+ */
+static int
+convert_address(char *token, char *addr_buffer, u_long * addr_type,
+ u_long * addr_len)
+{
+ int family;
+ int ret;
+
+ if (strchr(token, ':') != NULL) {
+ family = AF_INET6;
+ *addr_type = INETADDRESSTYPE_IPV6;
+ *addr_len = 16;
+ } else {
+ family = AF_INET;
+ *addr_type = INETADDRESSTYPE_IPV4;
+ *addr_len = 4;
+ }
+ ret = inet_pton(family, token, addr_buffer);
+
+ if (ret <= 0)
+ return SNMP_ERR_GENERR;
+ return SNMP_ERR_NOERROR;
+}
+
+
+/*
+ * Parse local address part from assoc file. It assumes that strtok will return
+ * these addresses. The addresses are separated by space and the list ends
+ * with "<->".
+ */
+static int
+parse_assoc_local_addresses(sctpAssocTable_entry * entry,
+ sctpTables_containers * containers)
+{
+ char *token;
+ int ret;
+ /*
+ * parse all local addresses
+ */
+
+ while ((token = strtok(NULL, " "))) {
+ sctpAssocLocalAddrTable_entry *localAddr;
+ char *ip = token;
+
+ if (token[0] == '<')
+ break; /* local addresses finished */
+
+ if (token[0] == '*')
+ ip = token + 1;
+
+ localAddr = sctpAssocLocalAddrTable_entry_create();
+ if (localAddr == NULL)
+ return SNMP_ERR_GENERR;
+
+ localAddr->sctpAssocId = entry->sctpAssocId;
+ ret =
+ convert_address(ip, localAddr->sctpAssocLocalAddr,
+ &localAddr->sctpAssocLocalAddrType,
+ &localAddr->sctpAssocLocalAddr_len);
+ if (ret != SNMP_ERR_NOERROR) {
+ sctpAssocLocalAddrTable_entry_free(localAddr);
+ return SNMP_ERR_GENERR;
+ }
+
+ ret =
+ sctpAssocLocalAddrTable_add_or_update(containers->
+ sctpAssocLocalAddrTable,
+ localAddr);
+ if (ret != SNMP_ERR_NOERROR)
+ return SNMP_ERR_GENERR;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+/*
+ * Parse primary remote address part from assoc file. It assumes that strtok will return
+ * all remote addresses. The addresses are separated by space and the list ends with \t .
+ */
+static int
+parse_assoc_remote_addresses(sctpAssocTable_entry * entry)
+{
+ char *token;
+ int ret = SNMP_ERR_GENERR;
+
+ while ((token = strtok(NULL, " ")) && (token[0] != '\t')) {
+ if (token[0] == '*') {
+ /*
+ * that's the primary address
+ */
+ ret =
+ convert_address(token + 1, entry->sctpAssocRemPrimAddr,
+ &entry->sctpAssocRemPrimAddrType,
+ &entry->sctpAssocRemPrimAddr_len);
+ }
+ }
+ return ret;
+}
+
+static int
+parse_assoc_line(char *line, sctpTables_containers * containers)
+{
+ long inode;
+ char *token;
+ int ret;
+ sctpAssocTable_entry *entry;
+
+ entry = sctpAssocTable_entry_create();
+ if (entry == NULL)
+ return SNMP_ERR_GENERR;
+
+ token = strtok(line, " "); /* ASSOC, ignore */
+ token = strtok(NULL, " "); /* SOCK, ignore */
+ token = strtok(NULL, " "); /* STY, ignore */
+ token = strtok(NULL, " "); /* SST, ignore */
+ token = strtok(NULL, " "); /* ST */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ entry->sctpAssocState = strtol(token, NULL, 10);
+
+ token = strtok(NULL, " "); /* HBKT */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ entry->sctpAssocHeartBeatInterval = strtol(token, NULL, 10);
+
+ token = strtok(NULL, " "); /* ASSOC-ID, store */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ entry->sctpAssocId = strtol(token, NULL, 10);
+
+ token = strtok(NULL, " "); /* TX_QUEUE, ignore */
+ token = strtok(NULL, " "); /* RX_QUEUE, ignore */
+ token = strtok(NULL, " "); /* UID, ignore */
+
+ token = strtok(NULL, " "); /* INODE */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ inode = strtol(token, NULL, 10);
+ entry->sctpAssocPrimProcess = get_pid_from_inode(inode);
+
+ token = strtok(NULL, " "); /* LPORT */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ entry->sctpAssocLocalPort = strtol(token, NULL, 10);
+
+ token = strtok(NULL, " "); /* RPORT */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ entry->sctpAssocRemPort = strtol(token, NULL, 10);
+
+ ret = parse_assoc_local_addresses(entry, containers);
+ if (ret != SNMP_ERR_NOERROR)
+ goto error;
+
+ ret = parse_assoc_remote_addresses(entry);
+ if (ret != SNMP_ERR_NOERROR)
+ goto error;
+
+ token = strtok(NULL, " "); /* HBINT */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ entry->sctpAssocHeartBeatInterval = strtol(token, NULL, 10);
+
+ token = strtok(NULL, " "); /* INS */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ entry->sctpAssocInStreams = strtol(token, NULL, 10);
+
+ token = strtok(NULL, " "); /* OUTS */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ entry->sctpAssocOutStreams = strtol(token, NULL, 10);
+
+ token = strtok(NULL, " "); /* MAXRT */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ entry->sctpAssocMaxRetr = strtol(token, NULL, 10);
+
+ token = strtok(NULL, " "); /* T1X */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ entry->sctpAssocT1expireds = strtol(token, NULL, 10);
+
+ token = strtok(NULL, " "); /* T2X */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ entry->sctpAssocT2expireds = strtol(token, NULL, 10);
+
+ token = strtok(NULL, " "); /* RXTC */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ entry->sctpAssocRtxChunks = strtol(token, NULL, 10);
+
+ entry->sctpAssocRemHostName[0] = 0;
+ entry->sctpAssocRemHostName_len = 0;
+ entry->sctpAssocDiscontinuityTime = 0;
+
+ ret = sctpAssocTable_add_or_update(containers->sctpAssocTable, entry);
+ if (ret != SNMP_ERR_NOERROR) {
+ DEBUGMSGTL(("sctp:tables:load:assoc",
+ "error adding/updating the entry in container\n"));
+ return ret;
+ }
+
+ return SNMP_ERR_NOERROR;
+
+ error:
+ if (entry != NULL)
+ sctpAssocTable_entry_free(entry);
+ return ret;
+}
+
+
+/*
+ * Load assocTable and localAddrTable from /proc/net/sctp/assoc. Mark all added
+ * or updated entries as valid (so the missing, i.e. invalid, can be deleted).
+ */
+static int
+load_assoc(sctpTables_containers * containers)
+{
+ FILE *f;
+ char line[1024];
+ int ret = SNMP_ERR_NOERROR;
+
+ DEBUGMSGTL(("sctp:tables:load:assoc", "arch load(linux)\n"));
+
+ f = fopen(ASSOC_FILE, "r");
+ if (f == NULL) {
+ DEBUGMSGTL(("sctp:tables:load:assoc",
+ "arch load failed: can't open" ASSOC_FILE "\n"));
+ return SNMP_ERR_GENERR;
+ }
+
+ /*
+ * ignore the header.
+ */
+ fgets(line, sizeof(line), f);
+
+ while (fgets(line, sizeof(line), f) != NULL) {
+ DEBUGMSGTL(("sctp:tables:load:assoc", "processing line: %s\n",
+ line));
+
+ ret = parse_assoc_line(line, containers);
+ if (ret != SNMP_ERR_NOERROR) {
+ DEBUGMSGTL(("sctp:tables:load:assoc",
+ "error parsing the line\n"));
+ }
+ }
+ fclose(f);
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+static int
+parse_remaddr_line(char *line, sctpTables_containers * containers)
+{
+ char *token;
+ int ret;
+ sctpAssocRemAddrTable_entry *entry;
+
+ entry = sctpAssocRemAddrTable_entry_create();
+ if (entry == NULL)
+ return SNMP_ERR_GENERR;
+
+ token = strtok(line, " "); /* rem. address */
+ ret =
+ convert_address(token, entry->sctpAssocRemAddr,
+ &entry->sctpAssocRemAddrType,
+ &entry->sctpAssocRemAddr_len);
+ if (ret < 0) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+
+ token = strtok(NULL, " "); /* assoc id */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ entry->sctpAssocId = strtol(token, NULL, 10);
+
+ token = strtok(NULL, " "); /* hb act */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ if (token[0] == '1')
+ entry->sctpAssocRemAddrHBActive = TRUTHVALUE_TRUE;
+ else
+ entry->sctpAssocRemAddrHBActive = TRUTHVALUE_FALSE;
+
+ token = strtok(NULL, " "); /* rto */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ entry->sctpAssocRemAddrRTO = strtol(token, NULL, 10);
+
+ token = strtok(NULL, " "); /* max path rtx */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ entry->sctpAssocRemAddrMaxPathRtx = strtol(token, NULL, 10);
+
+ token = strtok(NULL, " "); /* rem addr rtx */
+ if (token == NULL) {
+ ret = SNMP_ERR_GENERR;
+ goto error;
+ }
+ entry->sctpAssocRemAddrRtx = strtol(token, NULL, 10);
+
+ entry->sctpAssocRemAddrStartTime = 0;
+ entry->sctpAssocRemAddrActive = TRUTHVALUE_TRUE;
+
+ ret =
+ sctpAssocRemAddrTable_add_or_update(containers->
+ sctpAssocRemAddrTable, entry);
+ if (ret != SNMP_ERR_NOERROR) {
+ DEBUGMSGTL(("sctp:load:remaddr",
+ "error adding/updating the entry in container\n"));
+ return ret;
+ }
+
+ return SNMP_ERR_NOERROR;
+
+ error:
+ if (entry != NULL)
+ sctpAssocRemAddrTable_entry_free(entry);
+ return ret;
+}
+
+/*
+ * Load sctpAssocRemAddrTable from /proc/net/sctp/remaddr. Mark all added
+ * or updated entries as valid (so the missing, i.e. invalid, can be deleted).
+ */
+static int
+load_remaddr(sctpTables_containers * containers)
+{
+ FILE *f;
+ char line[1024];
+ int ret = SNMP_ERR_NOERROR;
+
+ DEBUGMSGTL(("sctp:load:remaddr", "arch load(linux)\n"));
+
+ f = fopen(REMADDR_FILE, "r");
+ if (f == NULL) {
+ DEBUGMSGTL(("sctp:load:remaddr",
+ "arch load failed: can't open" REMADDR_FILE "\n"));
+ return SNMP_ERR_GENERR;
+ }
+
+ /*
+ * ignore the header.
+ */
+ fgets(line, sizeof(line), f);
+
+ while (fgets(line, sizeof(line), f) != NULL) {
+ DEBUGMSGTL(("sctp:load:remaddr", "processing line: %s\n", line));
+
+ ret = parse_remaddr_line(line, containers);
+ if (ret != SNMP_ERR_NOERROR) {
+ DEBUGMSGTL(("sctp:load:remaddr", "error parsing the line\n"));
+ }
+ }
+ fclose(f);
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+sctpTables_arch_load(sctpTables_containers * containers, u_long * flags)
+{
+ int ret = SNMP_ERR_NOERROR;
+
+ *flags |= SCTP_TABLES_LOAD_FLAG_DELETE_INVALID;
+ *flags |= SCTP_TABLES_LOAD_FLAG_AUTO_LOOKUP;
+
+ ret = load_assoc(containers);
+ if (ret != SNMP_ERR_NOERROR)
+ return ret;
+
+ ret = load_remaddr(containers);
+ if (ret != SNMP_ERR_NOERROR)
+ return ret;
+
+ return ret;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/smux.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux.h
new file mode 100644
index 0000000000..bc76929f1d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux.h
@@ -0,0 +1,4 @@
+/*
+ * smux.h: top level .h file to merely include the sub-module.
+ */
+config_require(smux/smux)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/smux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/smux.c
new file mode 100644
index 0000000000..7d84432d7a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/smux.c
@@ -0,0 +1,2077 @@
+/*
+ * Smux module authored by Rohit Dube.
+ * Rewritten by Nick Amato <naamato@merit.net>.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <sys/types.h>
+#include <ctype.h>
+
+#if HAVE_IO_H /* win32 */
+#include <io.h>
+#endif
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_ERR_H
+#include <err.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#include <errno.h>
+#if HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#include <sys/stat.h>
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#elif HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_SYS_FILIO_H
+#include <sys/filio.h>
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#if HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#if HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/library/tools.h>
+
+#include "smux.h"
+#include "util_funcs.h"
+#include "mibdefs.h"
+#include "snmpd.h"
+
+long smux_long;
+u_long smux_ulong;
+struct sockaddr_in smux_sa;
+struct counter64 smux_counter64;
+oid smux_objid[MAX_OID_LEN];
+u_char smux_str[SMUXMAXSTRLEN];
+int smux_listen_sd = -1;
+
+static struct timeval smux_rcv_timeout;
+static long smux_reqid;
+
+void init_smux(void);
+static u_char *smux_open_process(int, u_char *, size_t *, int *);
+static u_char *smux_rreq_process(int, u_char *, size_t *);
+static u_char *smux_close_process(int, u_char *, size_t *);
+static u_char *smux_trap_process(u_char *, size_t *);
+static u_char *smux_parse(u_char *, oid *, size_t *, size_t *, u_char *);
+static u_char *smux_parse_var(u_char *, size_t *, oid *, size_t *,
+ size_t *, u_char *);
+static void smux_send_close(int, int);
+static void smux_list_detach(smux_reg **, smux_reg **);
+static void smux_replace_active(smux_reg *, smux_reg *);
+static void smux_peer_cleanup(int);
+static int smux_auth_peer(oid *, size_t, char *, int);
+static int smux_build(u_char, long, oid *,
+ size_t *, u_char, u_char *, size_t, u_char *,
+ size_t *);
+static int smux_list_add(smux_reg **, smux_reg *);
+static int smux_pdu_process(int, u_char *, size_t);
+static int smux_send_rrsp(int, int);
+static smux_reg *smux_find_match(smux_reg *, int, oid *, size_t, long);
+static smux_reg *smux_find_replacement(oid *, size_t);
+u_char *var_smux(struct variable *, oid *, size_t *, int, size_t *,
+ WriteMethod ** write_method);
+int var_smux_write(int, u_char *, u_char, size_t, u_char *,
+ oid *, size_t);
+
+static smux_reg *ActiveRegs; /* Active registrations */
+static smux_reg *PassiveRegs; /* Currently unused registrations */
+
+static smux_peer_auth *Auths[SMUX_MAX_PEERS]; /* Configured peers */
+static int nauths, npeers = 0;
+
+struct variable2 smux_variables[] = {
+ /*
+ * bogus entry, as in pass.c
+ */
+ {MIBINDEX, ASN_INTEGER, RWRITE, var_smux, 0, {MIBINDEX}},
+};
+
+
+
+void
+smux_parse_smux_socket(const char *token, char *cptr)
+{
+ DEBUGMSGTL(("smux", "port spec: %s\n", cptr));
+ netsnmp_ds_set_string(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_SMUX_SOCKET, cptr);
+}
+
+void
+smux_parse_peer_auth(const char *token, char *cptr)
+{
+ smux_peer_auth *aptr;
+ char *password_cptr;
+ int cptr_len;
+
+ if ((aptr =
+ (smux_peer_auth *) calloc(1, sizeof(smux_peer_auth))) == NULL) {
+ snmp_log_perror("smux_parse_peer_auth: malloc");
+ return;
+ }
+ if (nauths == SMUX_MAX_PEERS) {
+ config_perror("Too many smuxpeers");
+ return;
+ }
+
+ /*
+ * oid
+ */
+ aptr->sa_active_fd = -1;
+ aptr->sa_oid_len = MAX_OID_LEN;
+ read_objid( cptr, aptr->sa_oid, &aptr->sa_oid_len );
+ DEBUGMSGTL(("smux_conf", "parsing registration for: %s\n", cptr));
+
+ password_cptr = strchr(cptr, ' ');
+ cptr_len = strlen(cptr);
+
+ if (password_cptr != NULL) { /* Do we have a password or not? */
+ *password_cptr = 0x0;
+ if ((&password_cptr - &cptr + 1) < cptr_len) {
+ cptr = ++password_cptr;
+ DEBUGMSGTL(("smux_conf", "password is: %s\n",
+ SNMP_STRORNULL(cptr)));
+ }
+
+ /*
+ * password
+ */
+ if (cptr)
+ strcpy(aptr->sa_passwd, cptr);
+ } else {
+ /*
+ * null passwords OK
+ */
+ DEBUGMSGTL(("smux_conf", "null password\n"));
+ }
+
+ Auths[nauths++] = aptr;
+ return;
+}
+
+void
+smux_free_peer_auth(void)
+{
+ int i;
+
+ for (i = 0; i < nauths; i++) {
+ free(Auths[i]);
+ Auths[i] = NULL;
+ }
+ nauths = 0;
+}
+
+void
+init_smux(void)
+{
+ snmpd_register_config_handler("smuxpeer", smux_parse_peer_auth,
+ smux_free_peer_auth,
+ "OID-IDENTITY PASSWORD");
+ snmpd_register_config_handler("smuxsocket",
+ smux_parse_smux_socket, NULL,
+ "SMUX bind address");
+}
+
+void
+real_init_smux(void)
+{
+ struct sockaddr_in lo_socket;
+ char *smux_socket;
+ int one = 1;
+
+ if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE) == SUB_AGENT) {
+ smux_listen_sd = -1;
+ return;
+ }
+
+ /*
+ * Reqid
+ */
+ smux_reqid = 0;
+ smux_listen_sd = -1;
+
+ /*
+ * Receive timeout
+ */
+ smux_rcv_timeout.tv_sec = 0;
+ smux_rcv_timeout.tv_usec = 500000;
+
+ /*
+ * Get ready to listen on the SMUX port
+ */
+ memset(&lo_socket, (0), sizeof(lo_socket));
+ lo_socket.sin_family = AF_INET;
+
+ smux_socket = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_SMUX_SOCKET);
+#ifdef NETSNMP_ENABLE_LOCAL_SMUX
+ if (!smux_socket)
+ smux_socket = "127.0.0.1"; /* By default, listen on localhost only */
+#endif
+ netsnmp_sockaddr_in( &lo_socket, smux_socket, SMUXPORT );
+
+ if ((smux_listen_sd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+ snmp_log_perror("[init_smux] socket failed");
+ return;
+ }
+#ifdef SO_REUSEADDR
+ /*
+ * At least on Linux, when the master agent terminates, any
+ * TCP connections for SMUX peers are put in the TIME_WAIT
+ * state for about 60 seconds. If the master agent is started
+ * during this time, the bind for the listening socket will
+ * fail because the SMUX port is in use.
+ */
+ if (setsockopt(smux_listen_sd, SOL_SOCKET, SO_REUSEADDR, (char *) &one,
+ sizeof(one)) < 0) {
+ snmp_log_perror("[init_smux] setsockopt(SO_REUSEADDR) failed");
+ }
+#endif /* SO_REUSEADDR */
+
+ if (bind(smux_listen_sd, (struct sockaddr *) &lo_socket,
+ sizeof(lo_socket)) < 0) {
+ snmp_log_perror("[init_smux] bind failed");
+ close(smux_listen_sd);
+ smux_listen_sd = -1;
+ return;
+ }
+#ifdef SO_KEEPALIVE
+ if (setsockopt(smux_listen_sd, SOL_SOCKET, SO_KEEPALIVE, (char *) &one,
+ sizeof(one)) < 0) {
+ snmp_log_perror("[init_smux] setsockopt(SO_KEEPALIVE) failed");
+ close(smux_listen_sd);
+ smux_listen_sd = -1;
+ return;
+ }
+#endif /* SO_KEEPALIVE */
+
+ if (listen(smux_listen_sd, SOMAXCONN) == -1) {
+ snmp_log_perror("[init_smux] listen failed");
+ close(smux_listen_sd);
+ smux_listen_sd = -1;
+ return;
+ }
+
+ DEBUGMSGTL(("smux_init",
+ "[smux_init] done; smux listen sd is %d, smux port is %d\n",
+ smux_listen_sd, ntohs(lo_socket.sin_port)));
+}
+
+u_char *
+var_smux(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ u_char *valptr, val_type;
+ smux_reg *rptr;
+
+ *write_method = var_smux_write;
+ /*
+ * search the active registration list
+ */
+ for (rptr = ActiveRegs; rptr; rptr = rptr->sr_next) {
+ if (0 >= snmp_oidtree_compare(vp->name, vp->namelen, rptr->sr_name,
+ rptr->sr_name_len))
+ break;
+ }
+ if (rptr == NULL)
+ return NULL;
+ else if (exact && (*length < rptr->sr_name_len))
+ return NULL;
+
+ valptr = smux_snmp_process(exact, name, length,
+ var_len, &val_type, rptr->sr_fd);
+
+ if (valptr == NULL)
+ return NULL;
+
+ if ((snmp_oidtree_compare(name, *length, rptr->sr_name,
+ rptr->sr_name_len)) != 0) {
+ /*
+ * the peer has returned a value outside
+ * * of the registered tree
+ */
+ return NULL;
+ } else {
+ /*
+ * set the type and return the value
+ */
+ vp->type = val_type;
+ return valptr;
+ }
+}
+
+int
+var_smux_write(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ smux_reg *rptr;
+ u_char buf[SMUXMAXPKTSIZE], *ptr, sout[3], type;
+ int reterr;
+ size_t var_len, datalen, name_length, packet_len;
+ ssize_t len, tmp_len;
+ long reqid, errsts, erridx;
+ u_char var_type, *dataptr;
+
+ DEBUGMSGTL(("smux", "[var_smux_write] entering var_smux_write\n"));
+
+ len = SMUXMAXPKTSIZE;
+ reterr = SNMP_ERR_NOERROR;
+ var_len = var_val_len;
+ var_type = var_val_type;
+ name_length = name_len;
+
+ /*
+ * XXX find the descriptor again
+ */
+ for (rptr = ActiveRegs; rptr; rptr = rptr->sr_next) {
+ if (!snmp_oidtree_compare(name, name_len, rptr->sr_name,
+ rptr->sr_name_len))
+ break;
+ }
+
+ switch (action) {
+ case RESERVE1:
+ DEBUGMSGTL(("smux", "[var_smux_write] entering RESERVE1\n"));
+
+ /*
+ * length might be long
+ */
+ var_len += (*(var_val + 1) & ASN_LONG_LEN) ?
+ var_len + ((*(var_val + 1) & 0x7F) + 2) : 2;
+
+ switch (var_val_type) {
+ case ASN_INTEGER:
+ case ASN_OCTET_STR:
+ case ASN_COUNTER:
+ case ASN_GAUGE:
+ case ASN_TIMETICKS:
+ case ASN_UINTEGER:
+ case ASN_COUNTER64:
+ case ASN_IPADDRESS:
+ case ASN_OPAQUE:
+ case ASN_NSAP:
+ case ASN_OBJECT_ID:
+ case ASN_BIT_STR:
+ datalen = var_val_len;
+ dataptr = var_val;
+ break;
+ case SNMP_NOSUCHOBJECT:
+ case SNMP_NOSUCHINSTANCE:
+ case SNMP_ENDOFMIBVIEW:
+ case ASN_NULL:
+ default:
+ DEBUGMSGTL(("smux",
+ "[var_smux_write] variable not supported\n"));
+ return SNMP_ERR_GENERR;
+ break;
+ }
+
+ if ((smux_build((u_char) SMUX_SET, smux_reqid,
+ name, &name_length, var_val_type, dataptr,
+ datalen, buf, &len)) < 0) {
+ DEBUGMSGTL(("smux", "[var_smux_write] smux build failed\n"));
+ return SNMP_ERR_GENERR;
+ }
+
+ if (sendto(rptr->sr_fd, buf, len, 0, NULL, 0) < 0) {
+ DEBUGMSGTL(("smux", "[var_smux_write] send failed\n"));
+ return SNMP_ERR_GENERR;
+ }
+
+ while (1) {
+ /*
+ * peek at what's received
+ */
+ if ((len = recvfrom(rptr->sr_fd, buf,
+ SMUXMAXPKTSIZE, MSG_PEEK, NULL, 0)) <= 0) {
+ if ((len == -1) && ((errno == EINTR) || (errno == EAGAIN)))
+ {
+ continue;
+ }
+ DEBUGMSGTL(("smux",
+ "[var_smux_write] peek failed or timed out\n"));
+ /*
+ * do we need to do a peer cleanup in this case??
+ */
+ smux_peer_cleanup(rptr->sr_fd);
+ smux_snmp_select_list_del(rptr->sr_fd);
+ return SNMP_ERR_GENERR;
+ }
+
+ DEBUGMSGTL(("smux", "[var_smux_write] Peeked at %d bytes\n",
+ len));
+ DEBUGDUMPSETUP("var_smux_write", buf, len);
+
+ /*
+ * determine if we received more than one packet
+ */
+ packet_len = len;
+ ptr = asn_parse_header(buf, &packet_len, &type);
+ packet_len += (ptr - buf);
+ if (len > (ssize_t)packet_len) {
+ /*
+ * set length to receive only the first packet
+ */
+ len = packet_len;
+ }
+
+ /*
+ * receive the first packet
+ */
+ tmp_len = len;
+ do
+ {
+ len = tmp_len;
+ len = recvfrom(rptr->sr_fd, buf, len, 0, NULL, 0);
+ }
+ while((len == -1) && ((errno == EINTR) || (errno == EAGAIN)));
+
+ if (len <= 0) {
+ DEBUGMSGTL(("smux",
+ "[var_smux_write] recv failed or timed out\n"));
+ smux_peer_cleanup(rptr->sr_fd);
+ smux_snmp_select_list_del(rptr->sr_fd);
+ return SNMP_ERR_GENERR;
+ }
+
+ DEBUGMSGTL(("smux", "[var_smux_write] Received %d bytes\n",
+ len));
+
+ if (buf[0] == SMUX_TRAP) {
+ DEBUGMSGTL(("smux", "[var_smux_write] Received trap\n"));
+ snmp_log(LOG_INFO, "Got trap from peer on fd %d\n",
+ rptr->sr_fd);
+ ptr = asn_parse_header(buf, &len, &type);
+ smux_trap_process(ptr, &len);
+
+
+ /*
+ * go and peek at received data again
+ */
+ /*
+ * we could receive the reply or another trap
+ */
+ } else {
+ ptr = buf;
+ ptr = asn_parse_header(ptr, &len, &type);
+ if ((ptr == NULL) || type != SNMP_MSG_RESPONSE)
+ return SNMP_ERR_GENERR;
+
+ ptr =
+ asn_parse_int(ptr, &len, &type, &reqid, sizeof(reqid));
+ if ((ptr == NULL) || type != ASN_INTEGER)
+ return SNMP_ERR_GENERR;
+
+ ptr =
+ asn_parse_int(ptr, &len, &type, &errsts,
+ sizeof(errsts));
+ if ((ptr == NULL) || type != ASN_INTEGER)
+ return SNMP_ERR_GENERR;
+
+ if (errsts) {
+ DEBUGMSGTL(("smux",
+ "[var_smux_write] errsts returned\n"));
+ return (errsts);
+ }
+
+ ptr =
+ asn_parse_int(ptr, &len, &type, &erridx,
+ sizeof(erridx));
+ if ((ptr == NULL) || type != ASN_INTEGER)
+ return SNMP_ERR_GENERR;
+
+ reterr = SNMP_ERR_NOERROR;
+ break;
+ }
+ } /* while (1) */
+ break; /* case Action == RESERVE1 */
+
+ case RESERVE2:
+ DEBUGMSGTL(("smux", "[var_smux_write] entering RESERVE2\n"));
+ reterr = SNMP_ERR_NOERROR;
+ break; /* case Action == RESERVE2 */
+
+ case FREE:
+ case COMMIT:
+ ptr = sout;
+ *(ptr++) = (u_char) SMUX_SOUT;
+ *(ptr++) = (u_char) 1;
+ if (action == FREE) {
+ *ptr = (u_char) 1; /* rollback */
+ DEBUGMSGTL(("smux",
+ "[var_smux_write] entering FREE - sending RollBack \n"));
+ } else {
+ *ptr = (u_char) 0; /* commit */
+ DEBUGMSGTL(("smux",
+ "[var_smux_write] entering FREE - sending Commit \n"));
+ }
+
+ if ((sendto(rptr->sr_fd, sout, 3, 0, NULL, 0)) < 0) {
+ DEBUGMSGTL(("smux",
+ "[var_smux_write] send rollback/commit failed\n"));
+ return SNMP_ERR_GENERR;
+ }
+
+ reterr = SNMP_ERR_NOERROR;
+ break; /* case Action == COMMIT */
+
+ default:
+ break;
+ }
+ return reterr;
+}
+
+
+int
+smux_accept(int sd)
+{
+ u_char data[SMUXMAXPKTSIZE], *ptr, type;
+ struct sockaddr_in in_socket;
+ struct timeval tv;
+ int fail, fd, alen;
+ int length;
+ ssize_t len;
+
+ alen = sizeof(struct sockaddr_in);
+ /*
+ * this may be too high
+ */
+ tv.tv_sec = 5;
+ tv.tv_usec = 0;
+
+ /*
+ * connection request
+ */
+ DEBUGMSGTL(("smux", "[smux_accept] Calling accept()\n"));
+ errno = 0;
+ if ((fd = accept(sd, (struct sockaddr *) &in_socket, &alen)) < 0) {
+ snmp_log_perror("[smux_accept] accept failed");
+ return -1;
+ } else {
+ snmp_log(LOG_INFO, "[smux_accept] accepted fd %d from %s:%d\n",
+ fd, inet_ntoa(in_socket.sin_addr),
+ ntohs(in_socket.sin_port));
+ if (npeers + 1 == SMUXMAXPEERS) {
+ snmp_log(LOG_ERR,
+ "[smux_accept] denied peer on fd %d, limit %d reached",
+ fd, SMUXMAXPEERS);
+ close(sd);
+ return -1;
+ }
+
+ /*
+ * now block for an OpenPDU
+ */
+ do
+ {
+ length = recvfrom(fd, (char *) data, SMUXMAXPKTSIZE, 0, NULL, 0);
+ }
+ while((length == -1) && ((errno == EINTR) || (errno == EAGAIN)));
+
+ if (length <= 0) {
+ DEBUGMSGTL(("smux",
+ "[smux_accept] peer on fd %d died or timed out\n",
+ fd));
+ close(fd);
+ return -1;
+ }
+ /*
+ * try to authorize him
+ */
+ ptr = data;
+ len = length;
+ if ((ptr = asn_parse_header(ptr, &len, &type)) == NULL) {
+ smux_send_close(fd, SMUXC_PACKETFORMAT);
+ close(fd);
+ DEBUGMSGTL(("smux", "[smux_accept] peer on %d sent bad open", fd));
+ return -1;
+ } else if (type != (u_char) SMUX_OPEN) {
+ smux_send_close(fd, SMUXC_PROTOCOLERROR);
+ close(fd);
+ DEBUGMSGTL(("smux",
+ "[smux_accept] peer on %d did not send open: (%d)\n",
+ fd, type));
+ return -1;
+ }
+ ptr = smux_open_process(fd, ptr, &len, &fail);
+ if (fail) {
+ smux_send_close(fd, SMUXC_AUTHENTICATIONFAILURE);
+ close(fd);
+ DEBUGMSGTL(("smux",
+ "[smux_accept] peer on %d failed authentication\n",
+ fd));
+ return -1;
+ }
+
+ /*
+ * he's OK
+ */
+#ifdef SO_RCVTIMEO
+ if (setsockopt
+ (fd, SOL_SOCKET, SO_RCVTIMEO, (void *) &tv, sizeof(tv)) < 0) {
+ DEBUGMSGTL(("smux",
+ "[smux_accept] setsockopt(SO_RCVTIMEO) failed fd %d\n",
+ fd));
+ snmp_log_perror("smux_accept: setsockopt SO_RCVTIMEO");
+ }
+#endif
+ npeers++;
+ DEBUGMSGTL(("smux", "[smux_accept] fd %d\n", fd));
+
+ /*
+ * Process other PDUs already read, e.g. a registerRequest.
+ */
+ len = length - (ptr - data);
+ if (smux_pdu_process(fd, ptr, len) < 0) {
+ /*
+ * Easy come, easy go. Clean-up is already done.
+ */
+ return -1;
+ }
+ }
+ return fd;
+}
+
+int
+smux_process(int fd)
+{
+ int length, tmp_length;
+ u_char data[SMUXMAXPKTSIZE];
+ u_char type, *ptr;
+ size_t packet_len;
+
+ do
+ {
+ length = recvfrom(fd, (char *) data, SMUXMAXPKTSIZE, MSG_PEEK, NULL, 0);
+ }
+ while((length == -1) && ((errno == EINTR) || (errno == EAGAIN)));
+
+ if (length <= 0)
+ {
+ snmp_log_perror("[smux_process] peek failed");
+ smux_peer_cleanup(fd);
+ return -1;
+ }
+
+ /*
+ * determine if we received more than one packet
+ */
+ packet_len = length;
+ ptr = asn_parse_header(data, &packet_len, &type);
+ packet_len += (ptr - data);
+ if (length > packet_len) {
+ /*
+ * set length to receive only the first packet
+ */
+ length = packet_len;
+ }
+
+ tmp_length = length;
+ do
+ {
+ length = tmp_length;
+ length = recvfrom(fd, (char *) data, length, 0, NULL, 0);
+ }
+ while((length == -1) && ((errno == EINTR) || (errno == EAGAIN)));
+
+ if (length <= 0) {
+ /*
+ * the peer went away, close this descriptor
+ * * and delete it from the list
+ */
+ DEBUGMSGTL(("smux",
+ "[smux_process] peer on fd %d died or timed out\n",
+ fd));
+ smux_peer_cleanup(fd);
+ return -1;
+ }
+
+ return smux_pdu_process(fd, data, length);
+}
+
+static int
+smux_pdu_process(int fd, u_char * data, size_t length)
+{
+ int error;
+ size_t len;
+ u_char *ptr, type;
+
+ DEBUGMSGTL(("smux", "[smux_pdu_process] Processing %d bytes\n",
+ length));
+
+ error = 0;
+ ptr = data;
+ while (error == 0 && ptr != NULL && ptr < data + length) {
+ len = length - (ptr - data);
+ ptr = asn_parse_header(ptr, &len, &type);
+ DEBUGMSGTL(("smux", "[smux_pdu_process] type is %d\n",
+ (int) type));
+ switch (type) {
+ case SMUX_OPEN:
+ smux_send_close(fd, SMUXC_PROTOCOLERROR);
+ DEBUGMSGTL(("smux",
+ "[smux_pdu_process] peer on fd %d sent duplicate open?\n",
+ fd));
+ smux_peer_cleanup(fd);
+ error = -1;
+ break;
+ case SMUX_CLOSE:
+ ptr = smux_close_process(fd, ptr, &len);
+ smux_peer_cleanup(fd);
+ error = -1;
+ break;
+ case SMUX_RREQ:
+ ptr = smux_rreq_process(fd, ptr, &len);
+ break;
+ case SMUX_RRSP:
+ error = -1;
+ smux_send_close(fd, SMUXC_PROTOCOLERROR);
+ smux_peer_cleanup(fd);
+ DEBUGMSGTL(("smux",
+ "[smux_pdu_process] peer on fd %d sent RRSP!\n",
+ fd));
+ break;
+ case SMUX_SOUT:
+ error = -1;
+ smux_send_close(fd, SMUXC_PROTOCOLERROR);
+ smux_peer_cleanup(fd);
+ DEBUGMSGTL(("smux", "This shouldn't have happened!\n"));
+ break;
+ case SMUX_TRAP:
+ snmp_log(LOG_INFO, "Got trap from peer on fd %d\n", fd);
+ if (ptr != 0)
+ {
+ DEBUGMSGTL(("smux", "[smux_pdu_process] call smux_trap_process.\n"));
+ ptr = smux_trap_process(ptr, &len);
+ }
+ else
+ {
+ DEBUGMSGTL(("smux", "[smux_pdu_process] smux_trap_process not called: ptr=NULL.\n"));
+ DEBUGMSGTL(("smux", "[smux_pdu_process] Error: \n%s\n", snmp_api_errstring(0)));
+ }
+ /*
+ * watch out for close on top of this...should return correct end
+ */
+ break;
+ default:
+ smux_send_close(fd, SMUXC_PACKETFORMAT);
+ smux_peer_cleanup(fd);
+ DEBUGMSGTL(("smux", "[smux_pdu_process] Wrong type %d\n",
+ (int) type));
+ error = -1;
+ break;
+ }
+ }
+ return error;
+}
+
+static u_char *
+smux_open_process(int fd, u_char * ptr, size_t * len, int *fail)
+{
+ u_char type;
+ long version;
+ oid oid_name[MAX_OID_LEN];
+ char passwd[SMUXMAXSTRLEN];
+ char descr[SMUXMAXSTRLEN];
+ char oid_print[SMUXMAXSTRLEN];
+ int i;
+ size_t oid_name_len, string_len;
+
+ if (!(ptr = asn_parse_int(ptr, len, &type, &version, sizeof(version)))) {
+ DEBUGMSGTL(("smux", "[smux_open_process] version parse failed\n"));
+ *fail = TRUE;
+ return ((ptr += *len));
+ }
+ DEBUGMSGTL(("smux",
+ "[smux_open_process] version %d, len %d, type %d\n",
+ version, *len, (int) type));
+
+ oid_name_len = MAX_OID_LEN;
+ if ((ptr = asn_parse_objid(ptr, len, &type, oid_name,
+ &oid_name_len)) == NULL) {
+ DEBUGMSGTL(("smux", "[smux_open_process] oid parse failed\n"));
+ *fail = TRUE;
+ return ((ptr += *len));
+ }
+ snprint_objid(oid_print, sizeof(oid_print), oid_name, oid_name_len);
+
+ if (snmp_get_do_debugging()) {
+ DEBUGMSGTL(("smux", "[smux_open_process] smux peer: %s\n",
+ oid_print));
+ DEBUGMSGTL(("smux", "[smux_open_process] len %d, type %d\n", *len,
+ (int) type));
+ }
+
+ string_len = SMUXMAXSTRLEN;
+ if ((ptr = asn_parse_string(ptr, len, &type, (u_char *) descr,
+ &string_len)) == NULL) {
+ DEBUGMSGTL(("smux", "[smux_open_process] descr parse failed\n"));
+ *fail = TRUE;
+ return ((ptr += *len));
+ }
+
+ if (snmp_get_do_debugging()) {
+ DEBUGMSGTL(("smux", "[smux_open_process] smux peer descr: "));
+ for (i = 0; i < (int) string_len; i++)
+ DEBUGMSG(("smux", "%c", descr[i]));
+ DEBUGMSG(("smux", "\n"));
+ DEBUGMSGTL(("smux", "[smux_open_process] len %d, type %d\n", *len,
+ (int) type));
+ }
+ descr[string_len] = 0;
+
+ string_len = SMUXMAXSTRLEN;
+ if ((ptr = asn_parse_string(ptr, len, &type, (u_char *) passwd,
+ &string_len)) == NULL) {
+ DEBUGMSGTL(("smux", "[smux_open_process] passwd parse failed\n"));
+ *fail = TRUE;
+ return ((ptr += *len));
+ }
+
+ if (snmp_get_do_debugging()) {
+ DEBUGMSGTL(("smux", "[smux_open_process] smux peer passwd: "));
+ for (i = 0; i < (int) string_len; i++)
+ DEBUGMSG(("smux", "%c", passwd[i]));
+ DEBUGMSG(("smux", "\n"));
+ DEBUGMSGTL(("smux", "[smux_open_process] len %d, type %d\n", *len,
+ (int) type));
+ }
+ passwd[string_len] = '\0';
+ if (!smux_auth_peer(oid_name, oid_name_len, passwd, fd)) {
+ snmp_log(LOG_WARNING,
+ "refused smux peer: oid %s, descr %s\n",
+ oid_print, descr);
+ *fail = TRUE;
+ return ptr;
+ }
+ snmp_log(LOG_INFO,
+ "accepted smux peer: oid %s, descr %s\n",
+ oid_print, descr);
+ *fail = FALSE;
+ return ptr;
+}
+
+static void
+smux_send_close(int fd, int reason)
+{
+ u_char outpacket[3], *ptr;
+
+ ptr = outpacket;
+
+ *(ptr++) = (u_char) SMUX_CLOSE;
+ *(ptr++) = (u_char) 1;
+ *ptr = (u_char) (reason & 0xFF);
+
+ if (snmp_get_do_debugging())
+ DEBUGMSGTL(("smux",
+ "[smux_close] sending close to fd %d, reason %d\n", fd,
+ reason));
+
+ /*
+ * send a response back
+ */
+ if (sendto(fd, (char *) outpacket, 3, 0, NULL, 0) < 0) {
+ snmp_log_perror("[smux_snmp_close] send failed");
+ }
+}
+
+
+static int
+smux_auth_peer(oid * name, size_t namelen, char *passwd, int fd)
+{
+ int i;
+
+ for (i = 0; i < nauths; i++) {
+ if (snmp_oid_compare(Auths[i]->sa_oid, Auths[i]->sa_oid_len,
+ name, namelen) == 0) {
+ if (!(strcmp(Auths[i]->sa_passwd, passwd)) &&
+ (Auths[i]->sa_active_fd == -1)) {
+ /*
+ * matched, mark the auth
+ */
+ Auths[i]->sa_active_fd = fd;
+ return 1;
+ }
+ }
+ }
+ /*
+ * did not match oid and passwd
+ */
+ return 0;
+}
+
+
+/*
+ * XXX - Bells and Whistles:
+ * Need to catch signal when snmpd goes down and send close pdu to gated
+ */
+static u_char *
+smux_close_process(int fd, u_char * ptr, size_t * len)
+{
+ long down = 0;
+ int length = *len;
+
+ /*
+ * This is the integer part of the close pdu
+ */
+ while (length--) {
+ down = (down << 8) | (long) *ptr;
+ ptr++;
+ }
+
+ DEBUGMSGTL(("smux",
+ "[smux_close_process] close from peer on fd %d reason %d\n",
+ fd, down));
+ smux_peer_cleanup(fd);
+
+ return NULL;
+}
+
+static u_char *
+smux_rreq_process(int sd, u_char * ptr, size_t * len)
+{
+ long priority, rpriority;
+ long operation;
+ oid oid_name[MAX_OID_LEN];
+ size_t oid_name_len;
+ int i, result;
+ u_char type;
+ smux_reg *rptr, *nrptr;
+
+ oid_name_len = MAX_OID_LEN;
+ ptr = asn_parse_objid(ptr, len, &type, oid_name, &oid_name_len);
+
+ DEBUGMSGTL(("smux", "[smux_rreq_process] smux subtree: "));
+ DEBUGMSGOID(("smux", oid_name, oid_name_len));
+ DEBUGMSG(("smux", "\n"));
+
+ if ((ptr = asn_parse_int(ptr, len, &type, &priority,
+ sizeof(priority))) == NULL) {
+ DEBUGMSGTL(("smux",
+ "[smux_rreq_process] priority parse failed\n"));
+ smux_send_rrsp(sd, -1);
+ return NULL;
+ }
+ DEBUGMSGTL(("smux", "[smux_rreq_process] priority %d\n", priority));
+
+ if ((ptr = asn_parse_int(ptr, len, &type, &operation,
+ sizeof(operation))) == NULL) {
+ DEBUGMSGTL(("smux",
+ "[smux_rreq_process] operation parse failed\n"));
+ smux_send_rrsp(sd, -1);
+ return NULL;
+ }
+ DEBUGMSGTL(("smux", "[smux_rreq_process] operation %d\n", operation));
+
+ if (operation == SMUX_REGOP_DELETE) {
+ /*
+ * search the active list for this registration
+ */
+ rptr =
+ smux_find_match(ActiveRegs, sd, oid_name, oid_name_len,
+ priority);
+ if (rptr) {
+ rpriority = rptr->sr_priority;
+ /*
+ * unregister the mib
+ */
+ unregister_mib(rptr->sr_name, rptr->sr_name_len);
+ /*
+ * find a replacement
+ */
+ nrptr =
+ smux_find_replacement(rptr->sr_name, rptr->sr_name_len);
+ if (nrptr) {
+ /*
+ * found one
+ */
+ smux_replace_active(rptr, nrptr);
+ } else {
+ /*
+ * no replacement found
+ */
+ smux_list_detach(&ActiveRegs, &rptr);
+ free(rptr);
+ }
+ smux_send_rrsp(sd, rpriority);
+ return ptr;
+ }
+ /*
+ * search the passive list for this registration
+ */
+ rptr =
+ smux_find_match(PassiveRegs, sd, oid_name, oid_name_len,
+ priority);
+ if (rptr) {
+ rpriority = rptr->sr_priority;
+ smux_list_detach(&PassiveRegs, &rptr);
+ free(rptr);
+ smux_send_rrsp(sd, rpriority);
+ return ptr;
+ }
+ /*
+ * This peer cannot unregister the tree, it does not
+ * * belong to him. Send him an error.
+ */
+ smux_send_rrsp(sd, -1);
+ return ptr;
+
+ } else if ((operation == SMUX_REGOP_REGISTER_RO) ||
+ (operation == SMUX_REGOP_REGISTER_RW)) {
+ if (priority < -1) {
+ DEBUGMSGTL(("smux",
+ "[smux_rreq_process] peer fd %d invalid priority %ld",
+ sd, priority));
+ smux_send_rrsp(sd, -1);
+ return NULL;
+ }
+ if ((nrptr = malloc(sizeof(smux_reg))) == NULL) {
+ snmp_log_perror("[smux_rreq_process] malloc");
+ smux_send_rrsp(sd, -1);
+ return NULL;
+ }
+ nrptr->sr_priority = priority;
+ nrptr->sr_name_len = oid_name_len;
+ nrptr->sr_fd = sd;
+ for (i = 0; i < (int) oid_name_len; i++)
+ nrptr->sr_name[i] = oid_name[i];
+
+ /*
+ * See if this tree matches or scopes any of the
+ * * active trees.
+ */
+ for (rptr = ActiveRegs; rptr; rptr = rptr->sr_next) {
+ result =
+ snmp_oid_compare(oid_name, oid_name_len, rptr->sr_name,
+ rptr->sr_name_len);
+ if (result == 0) {
+ if ((oid_name_len == rptr->sr_name_len)) {
+ if ((nrptr->sr_priority == -1)) {
+ nrptr->sr_priority = rptr->sr_priority;
+ do {
+ nrptr->sr_priority++;
+ } while (smux_list_add(&PassiveRegs, nrptr));
+ goto done;
+ } else if (nrptr->sr_priority < rptr->sr_priority) {
+ /*
+ * Better priority. There are no better
+ * * priorities for this tree in the passive list,
+ * * so replace the current active tree.
+ */
+ smux_replace_active(rptr, nrptr);
+ goto done;
+ } else {
+ /*
+ * Equal or worse priority
+ */
+ do {
+ nrptr->sr_priority++;
+ } while (smux_list_add(&PassiveRegs, nrptr) == -1);
+ goto done;
+ }
+ } else if (oid_name_len < rptr->sr_name_len) {
+ /*
+ * This tree scopes a current active
+ * * tree. Replace the current active tree.
+ */
+ smux_replace_active(rptr, nrptr);
+ goto done;
+ } else { /* oid_name_len > rptr->sr_name_len */
+ /*
+ * This tree is scoped by a current
+ * * active tree.
+ */
+ do {
+ nrptr->sr_priority++;
+ } while (smux_list_add(&PassiveRegs, nrptr) == -1);
+ goto done;
+ }
+ }
+ }
+ /*
+ * We didn't find it in the active list. Add it at
+ * * the requested priority.
+ */
+ if (nrptr->sr_priority == -1)
+ nrptr->sr_priority = 0;
+ smux_list_add(&ActiveRegs, nrptr);
+ register_mib("smux", (struct variable *)
+ smux_variables, sizeof(struct variable2),
+ 1, nrptr->sr_name, nrptr->sr_name_len);
+ done:
+ smux_send_rrsp(sd, nrptr->sr_priority);
+ return ptr;
+ } else {
+ DEBUGMSGTL(("smux", "[smux_rreq_process] unknown operation\n"));
+ smux_send_rrsp(sd, -1);
+ return NULL;
+ }
+}
+
+/*
+ * Find the registration with a matching descriptor, OID and priority. If
+ * the priority is -1 then find a registration with a matching descriptor,
+ * a matching OID, and the highest priority.
+ */
+static smux_reg *
+smux_find_match(smux_reg * regs, int sd, oid * oid_name,
+ size_t oid_name_len, long priority)
+{
+ smux_reg *rptr, *bestrptr;
+
+ bestrptr = NULL;
+ for (rptr = regs; rptr; rptr = rptr->sr_next) {
+ if (rptr->sr_fd != sd)
+ continue;
+ if (snmp_oid_compare
+ (rptr->sr_name, rptr->sr_name_len, oid_name, oid_name_len))
+ continue;
+ if (rptr->sr_priority == priority)
+ return rptr;
+ if (priority != -1)
+ continue;
+ if (bestrptr) {
+ if (bestrptr->sr_priority > rptr->sr_priority)
+ bestrptr = rptr;
+ } else {
+ bestrptr = rptr;
+ }
+ }
+ return bestrptr;
+}
+
+static void
+smux_replace_active(smux_reg * actptr, smux_reg * pasptr)
+{
+ smux_list_detach(&ActiveRegs, &actptr);
+ unregister_mib(actptr->sr_name, actptr->sr_name_len);
+
+ smux_list_detach(&PassiveRegs, &pasptr);
+ (void) smux_list_add(&ActiveRegs, pasptr);
+
+ register_mib("smux", (struct variable *) smux_variables,
+ sizeof(struct variable2), 1, pasptr->sr_name,
+ pasptr->sr_name_len);
+ free(actptr);
+}
+
+static void
+smux_list_detach(smux_reg ** head, smux_reg ** m_remove)
+{
+ smux_reg *rptr, *rptr2;
+
+ if (*head == NULL) {
+ DEBUGMSGTL(("smux", "[smux_list_detach] Ouch!"));
+ return;
+ }
+ if (*head == *m_remove) {
+ *m_remove = *head;
+ *head = (*head)->sr_next;
+ return;
+ }
+ for (rptr = *head, rptr2 = rptr->sr_next; rptr2;
+ rptr2 = rptr2->sr_next, rptr = rptr->sr_next) {
+ if (rptr2 == *m_remove) {
+ *m_remove = rptr2;
+ rptr->sr_next = rptr2->sr_next;
+ return;
+ }
+ }
+}
+
+/*
+ * Attempt to add a registration (in order) to a list. If the
+ * add fails (because of an existing registration with equal
+ * priority) return -1.
+ */
+static int
+smux_list_add(smux_reg ** head, smux_reg * add)
+{
+ smux_reg *rptr, *prev;
+ int result;
+
+ if (*head == NULL) {
+ *head = add;
+ (*head)->sr_next = NULL;
+ return 0;
+ }
+ prev = NULL;
+ for (rptr = *head; rptr->sr_next; rptr = rptr->sr_next) {
+ result = snmp_oid_compare(add->sr_name, add->sr_name_len,
+ rptr->sr_name, rptr->sr_name_len);
+ if ((result == 0) && (add->sr_priority == rptr->sr_priority)) {
+ /*
+ * same tree, same pri, nope
+ */
+ return -1;
+ } else if (result < 0) {
+ /*
+ * this can only happen if we go before the head
+ */
+ add->sr_next = *head;
+ *head = add;
+ return 0;
+ } else if ((snmp_oid_compare(add->sr_name, add->sr_name_len,
+ rptr->sr_next->sr_name,
+ rptr->sr_next->sr_name_len)) < 0) {
+ /*
+ * insert here
+ */
+ add->sr_next = rptr->sr_next;
+ rptr->sr_next = add;
+ return 0;
+ }
+ prev = rptr;
+ }
+ /*
+ * compare the last one
+ */
+ result = snmp_oid_compare(add->sr_name, add->sr_name_len, rptr->sr_name, rptr->sr_name_len);
+ if ((result == 0) && add->sr_priority == rptr->sr_priority)
+ return -1;
+ else if (result < 0 ) {
+ add->sr_next = rptr;
+ if ( prev ) {
+ prev->sr_next = add;
+ } else {
+ *head = add;
+ }
+ } else {
+ rptr->sr_next = add;
+ add->sr_next = NULL;
+ }
+ return 0;
+}
+
+/*
+ * Find a replacement for this registration. In order
+ * of preference:
+ *
+ * - Least difference in subtree length
+ * - Best (lowest) priority
+ *
+ * For example, if we need to replace .1.3.6.1.69,
+ * we would pick .1.3.6.1.69.1 instead of .1.3.6.69.1.1
+ *
+ */
+static smux_reg *
+smux_find_replacement(oid * name, size_t name_len)
+{
+ smux_reg *rptr, *bestptr;
+ int bestlen, difflen;
+
+ bestlen = SMUX_MAX_PRIORITY;
+ bestptr = NULL;
+
+ for (rptr = PassiveRegs; rptr; rptr = rptr->sr_next) {
+ if (!snmp_oidtree_compare(rptr->sr_name, rptr->sr_name_len,
+ name, name_len)) {
+ if ((difflen = rptr->sr_name_len - name_len)
+ < bestlen) {
+ bestlen = difflen;
+ bestptr = rptr;
+ } else if ((difflen == bestlen) &&
+ (rptr->sr_priority < bestptr->sr_priority))
+ bestptr = rptr;
+ }
+ }
+ return bestptr;
+}
+
+u_char *
+smux_snmp_process(int exact,
+ oid * objid,
+ size_t * len,
+ size_t * return_len, u_char * return_type, int sd)
+{
+ u_char packet[SMUXMAXPKTSIZE], *ptr, result[SMUXMAXPKTSIZE];
+ int length = SMUXMAXPKTSIZE;
+ int tmp_length;
+ u_char type;
+ size_t packet_len;
+
+ /*
+ * Send the query to the peer
+ */
+ smux_reqid++;
+
+ if (exact)
+ type = SMUX_GET;
+ else
+ type = SMUX_GETNEXT;
+
+ if (smux_build(type, smux_reqid, objid, len, 0, NULL,
+ *len, packet, &length) < 0) {
+ snmp_log(LOG_ERR, "[smux_snmp_process]: smux_build failed\n");
+ return NULL;
+ }
+ DEBUGMSGTL(("smux", "[smux_snmp_process] oid from build: "));
+ DEBUGMSGOID(("smux", objid, *len));
+ DEBUGMSG(("smux", "\n"));
+
+ if (sendto(sd, (char *) packet, length, 0, NULL, 0) < 0) {
+ snmp_log_perror("[smux_snmp_process] send failed");
+ }
+
+ DEBUGMSGTL(("smux",
+ "[smux_snmp_process] Sent %d request to peer; %d bytes\n",
+ (int) type, length));
+
+ while (1) {
+ /*
+ * peek at what's received
+ */
+ length = recvfrom(sd, (char *) result, SMUXMAXPKTSIZE, MSG_PEEK, NULL, 0);
+ if (length <= 0) {
+ if ((length == -1) && ((errno == EINTR) || (errno == EAGAIN)))
+ {
+ continue;
+ }
+ else
+ {
+ snmp_log_perror("[smux_snmp_process] peek failed");
+ smux_peer_cleanup(sd);
+ smux_snmp_select_list_del(sd);
+ return NULL;
+ }
+ }
+
+ DEBUGMSGTL(("smux", "[smux_snmp_process] Peeked at %d bytes\n",
+ length));
+ DEBUGDUMPSETUP("smux_snmp_process", result, length);
+
+ /*
+ * determine if we received more than one packet
+ */
+ packet_len = length;
+ ptr = asn_parse_header(result, &packet_len, &type);
+ packet_len += (ptr - result);
+ if (length > packet_len) {
+ /*
+ * set length to receive only the first packet
+ */
+ length = packet_len;
+ }
+
+ /*
+ * receive the first packet
+ */
+ tmp_length = length;
+ do
+ {
+ length = tmp_length;
+ length = recvfrom(sd, (char *) result, length, 0, NULL, 0);
+ }
+ while((length == -1) && ((errno == EINTR) || (errno == EAGAIN)));
+
+ if (length <= 0) {
+ snmp_log_perror("[smux_snmp_process] recv failed");
+ smux_peer_cleanup(sd);
+ smux_snmp_select_list_del(sd);
+ return NULL;
+ }
+
+ DEBUGMSGTL(("smux", "[smux_snmp_process] Received %d bytes\n",
+ length));
+
+ if (result[0] == SMUX_TRAP) {
+ DEBUGMSGTL(("smux", "[smux_snmp_process] Received trap\n"));
+ snmp_log(LOG_INFO, "Got trap from peer on fd %d\n", sd);
+ ptr = asn_parse_header(result, &length, &type);
+ smux_trap_process(ptr, &length);
+
+ /*
+ * go and peek at received data again
+ */
+ /*
+ * we could receive the reply or another trap
+ */
+ } else {
+ /*
+ * Interpret reply
+ */
+ ptr = smux_parse(result, objid, len, return_len, return_type);
+ /*
+ * ptr will point to query result or NULL if error
+ */
+ break;
+ }
+ } /* while (1) */
+
+ return ptr;
+}
+
+static u_char *
+smux_parse(u_char * rsp,
+ oid * objid,
+ size_t * oidlen, size_t * return_len, u_char * return_type)
+{
+ size_t length = SMUXMAXPKTSIZE;
+ u_char *ptr, type;
+ long reqid, errstat, errindex;
+
+ ptr = rsp;
+
+ /*
+ * Return pointer to the snmp/smux return value.
+ * return_len should contain the number of bytes in the value
+ * returned above.
+ * objid is the next object, with len for GETNEXT.
+ * objid and len are not changed for GET
+ */
+ ptr = asn_parse_header(ptr, &length, &type);
+ if (ptr == NULL || type != SNMP_MSG_RESPONSE)
+ return NULL;
+
+ if ((ptr = asn_parse_int(ptr, &length, &type, &reqid,
+ sizeof(reqid))) == NULL) {
+ DEBUGMSGTL(("smux", "[smux_parse] parse of reqid failed\n"));
+ return NULL;
+ }
+ if ((ptr = asn_parse_int(ptr, &length, &type, &errstat,
+ sizeof(errstat))) == NULL) {
+ DEBUGMSGTL(("smux",
+ "[smux_parse] parse of error status failed\n"));
+ return NULL;
+ }
+ if ((ptr = asn_parse_int(ptr, &length, &type, &errindex,
+ sizeof(errindex))) == NULL) {
+ DEBUGMSGTL(("smux", "[smux_parse] parse of error index failed\n"));
+ return NULL;
+ }
+
+ /*
+ * XXX How to send something intelligent back in case of an error
+ */
+ DEBUGMSGTL(("smux",
+ "[smux_parse] Message type %d, reqid %d, errstat %d, \n\terrindex %d\n",
+ (int) type, reqid, errstat, errindex));
+ if (ptr == NULL || errstat != SNMP_ERR_NOERROR)
+ return NULL;
+
+ /*
+ * stuff to return
+ */
+ return (smux_parse_var
+ (ptr, &length, objid, oidlen, return_len, return_type));
+}
+
+
+static u_char *
+smux_parse_var(u_char * varbind,
+ size_t * varbindlength,
+ oid * objid,
+ size_t * oidlen, size_t * varlength, u_char * vartype)
+{
+ oid var_name[MAX_OID_LEN];
+ size_t var_name_len;
+ size_t var_val_len;
+ u_char *var_val;
+ size_t str_len, objid_len;
+ size_t len;
+ u_char *ptr;
+ u_char type;
+
+ ptr = varbind;
+ len = *varbindlength;
+
+ DEBUGMSGTL(("smux", "[smux_parse_var] before any processing: "));
+ DEBUGMSGOID(("smux", objid, *oidlen));
+ DEBUGMSG(("smux", "\n"));
+
+ ptr = asn_parse_header(ptr, &len, &type);
+ if (ptr == NULL || type != (ASN_SEQUENCE | ASN_CONSTRUCTOR)) {
+ snmp_log(LOG_NOTICE, "[smux_parse_var] Panic: type %d\n",
+ (int) type);
+ return NULL;
+ }
+
+ /*
+ * get hold of the objid and the asn1 coded value
+ */
+ var_name_len = MAX_OID_LEN;
+ ptr = snmp_parse_var_op(ptr, var_name, &var_name_len, vartype,
+ &var_val_len, &var_val, &len);
+
+ *oidlen = var_name_len;
+ memcpy(objid, var_name, var_name_len * sizeof(oid));
+
+ DEBUGMSGTL(("smux", "[smux_parse_var] returning oid : "));
+ DEBUGMSGOID(("smux", objid, *oidlen));
+ DEBUGMSG(("smux", "\n"));
+ /*
+ * XXX
+ */
+ len = SMUXMAXPKTSIZE;
+ DEBUGMSGTL(("smux",
+ "[smux_parse_var] Asn coded len of var %d, type %d\n",
+ var_val_len, (int) *vartype));
+
+ switch ((short) *vartype) {
+ case ASN_INTEGER:
+ *varlength = sizeof(long);
+ asn_parse_int(var_val, &len, vartype,
+ (long *) &smux_long, *varlength);
+ return (u_char *) & smux_long;
+ break;
+ case ASN_COUNTER:
+ case ASN_GAUGE:
+ case ASN_TIMETICKS:
+ case ASN_UINTEGER:
+ *varlength = sizeof(u_long);
+ asn_parse_unsigned_int(var_val, &len, vartype,
+ (u_long *) & smux_ulong, *varlength);
+ return (u_char *) & smux_ulong;
+ break;
+ case ASN_COUNTER64:
+ *varlength = sizeof(smux_counter64);
+ asn_parse_unsigned_int64(var_val, &len, vartype,
+ (struct counter64 *) &smux_counter64,
+ *varlength);
+ return (u_char *) & smux_counter64;
+ break;
+ case ASN_IPADDRESS:
+ *varlength = 4;
+ /*
+ * consume the tag and length, but just copy here
+ * because we know it is an ip address
+ */
+ if ((var_val = asn_parse_header(var_val, &len, &type)) == NULL)
+ return NULL;
+ memcpy((u_char *) & (smux_sa.sin_addr.s_addr), var_val,
+ *varlength);
+ return (u_char *) & (smux_sa.sin_addr.s_addr);
+ break;
+ case ASN_OCTET_STR:
+ /*
+ * XXX
+ */
+ if (len == 0)
+ return NULL;
+ str_len = SMUXMAXSTRLEN;
+ asn_parse_string(var_val, &len, vartype, smux_str, &str_len);
+ *varlength = str_len;
+ return smux_str;
+ break;
+ case ASN_OPAQUE:
+ case ASN_NSAP:
+ case ASN_OBJECT_ID:
+ objid_len = MAX_OID_LEN;
+ asn_parse_objid(var_val, &len, vartype, smux_objid, &objid_len);
+ *varlength = objid_len * sizeof(oid);
+ return (u_char *) smux_objid;
+ break;
+ case SNMP_NOSUCHOBJECT:
+ case SNMP_NOSUCHINSTANCE:
+ case SNMP_ENDOFMIBVIEW:
+ case ASN_NULL:
+ return NULL;
+ break;
+ case ASN_BIT_STR:
+ /*
+ * XXX
+ */
+ if (len == 0)
+ return NULL;
+ str_len = SMUXMAXSTRLEN;
+ asn_parse_bitstring(var_val, &len, vartype, smux_str, &str_len);
+ *varlength = str_len;
+ return (u_char *) smux_str;
+ break;
+ default:
+ snmp_log(LOG_ERR, "bad type returned (%x)\n", *vartype);
+ return NULL;
+ break;
+ }
+}
+
+/*
+ * XXX This is a bad hack - do not want to muck with ucd code
+ */
+static int
+smux_build(u_char type,
+ long reqid,
+ oid * objid,
+ size_t * oidlen,
+ u_char val_type,
+ u_char * val, size_t val_len, u_char * packet, size_t * length)
+{
+ u_char *ptr, *save1, *save2;
+ size_t len;
+ long errstat = 0;
+ long errindex = 0;
+
+ /*
+ * leave space for Seq and length
+ */
+ save1 = packet;
+ ptr = packet + 4;
+ len = *length - 4;
+
+ /*
+ * build reqid
+ */
+ ptr = asn_build_int(ptr, &len,
+ (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+ ASN_INTEGER), &reqid,
+ sizeof(reqid));
+ if (ptr == NULL) {
+ return -1;
+ }
+
+ /*
+ * build err stat
+ */
+ ptr = asn_build_int(ptr, &len,
+ (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+ ASN_INTEGER), &errstat, sizeof(errstat));
+ if (ptr == NULL) {
+ return -1;
+ }
+
+ /*
+ * build err index
+ */
+ ptr = asn_build_int(ptr, &len,
+ (u_char) (ASN_UNIVERSAL | ASN_PRIMITIVE |
+ ASN_INTEGER), &errindex,
+ sizeof(errindex));
+ if (ptr == NULL) {
+ return -1;
+ }
+
+ save2 = ptr;
+ ptr += 4;
+ len -= 4;
+
+ if (type != SMUX_SET) {
+ val_type = ASN_NULL;
+ val_len = 0;
+ }
+
+ /*
+ * build var list : snmp_build_var_op not liked by gated XXX
+ */
+ ptr = snmp_build_var_op(ptr, objid, oidlen, val_type, val_len,
+ val, &len);
+ if (ptr == NULL) {
+ return -1;
+ }
+
+ len = ptr - save1;
+ asn_build_sequence(save1, &len, type, (ptr - save1 - 4));
+
+ len = ptr - save2;
+ asn_build_sequence(save2, &len,
+ (ASN_SEQUENCE | ASN_CONSTRUCTOR),
+ (ptr - save2 - 4));
+
+ *length = ptr - packet;
+
+ return 0;
+}
+
+static void
+smux_peer_cleanup(int sd)
+{
+ smux_reg *nrptr, *rptr, *rptr2;
+ int nfound, i;
+
+ nfound = 0;
+
+ /*
+ * close the descriptor
+ */
+ close(sd);
+
+ /*
+ * delete all of the passive registrations that this peer owns
+ */
+ for (rptr = PassiveRegs; rptr; rptr = nrptr) {
+ nrptr = rptr->sr_next;
+ if (rptr->sr_fd == sd) {
+ smux_list_detach(&PassiveRegs, &rptr);
+ free(rptr);
+ }
+ rptr = nrptr;
+ }
+ /*
+ * find replacements for all of the active registrations found
+ */
+ for (rptr = ActiveRegs; rptr; rptr = rptr2) {
+ rptr2 = rptr->sr_next;
+ if (rptr->sr_fd == sd) {
+ smux_list_detach(&ActiveRegs, &rptr);
+ unregister_mib(rptr->sr_name, rptr->sr_name_len);
+ if ((nrptr = smux_find_replacement(rptr->sr_name,
+ rptr->sr_name_len)) !=
+ NULL) {
+ smux_list_detach(&PassiveRegs, &nrptr);
+ smux_list_add(&ActiveRegs, nrptr);
+ register_mib("smux", (struct variable *)
+ smux_variables, sizeof(struct variable2),
+ 1, nrptr->sr_name, nrptr->sr_name_len);
+ }
+ free(rptr);
+ }
+ }
+
+ /*
+ * decrement the peer count
+ */
+ npeers--;
+
+ /*
+ * make his auth available again
+ */
+ for (i = 0; i < nauths; i++) {
+ if (Auths[i]->sa_active_fd == sd) {
+ char oid_name[128];
+ Auths[i]->sa_active_fd = -1;
+ snprint_objid(oid_name, sizeof(oid_name), Auths[i]->sa_oid,
+ Auths[i]->sa_oid_len);
+ snmp_log(LOG_INFO, "peer disconnected: %s\n", oid_name);
+ }
+ }
+}
+
+int
+smux_send_rrsp(int sd, int pri)
+{
+ u_char outdata[2 + sizeof(int)];
+ u_char *ptr = outdata;
+ int intsize = sizeof(int);
+ u_int mask = ((u_int) 0xFF) << (8 * (sizeof(int) - 1));
+ /*
+ * e.g. mask is 0xFF000000 on a 32-bit machine
+ */
+ int sent;
+
+ /*
+ * This is kind of like calling asn_build_int(), but the
+ * encoding will always be the size of an integer on this
+ * machine, never shorter.
+ */
+ *ptr++ = (u_char) SMUX_RRSP;
+ *ptr++ = (u_char) intsize;
+
+ /*
+ * Copy each byte, most significant first.
+ */
+ while (intsize--) {
+ *ptr++ = (u_char) ((pri & mask) >> (8 * (sizeof(int) - 1)));
+ pri <<= 8;
+ }
+
+ sent = sendto(sd, (char *) outdata, sizeof outdata, 0, NULL, 0);
+ if (sent < 0) {
+ DEBUGMSGTL(("smux", "[smux_send_rrsp] send failed\n"));
+ }
+ return (sent);
+}
+
+static u_char *
+smux_trap_process(u_char * rsp, size_t * len)
+{
+ oid sa_enterpriseoid[MAX_OID_LEN], var_name[MAX_OID_LEN];
+ size_t datalen, var_name_len, var_val_len, maxlen;
+ size_t sa_enterpriseoid_len;
+ u_char vartype, *ptr, *var_val;
+
+ long trap, specific;
+ u_long timestamp;
+
+ netsnmp_variable_list *snmptrap_head, *snmptrap_ptr, *snmptrap_tmp;
+ snmptrap_head = NULL;
+ snmptrap_ptr = NULL;
+
+ ptr = rsp;
+
+ /*
+ * parse the sub-agent enterprise oid
+ */
+ sa_enterpriseoid_len = MAX_OID_LEN;
+ if ((ptr = asn_parse_objid(ptr, len,
+ &vartype, (oid *) & sa_enterpriseoid,
+ &sa_enterpriseoid_len)) == NULL) {
+ DEBUGMSGTL(("smux",
+ "[smux_trap_process] asn_parse_objid failed\n"));
+ return NULL;
+ }
+
+ /*
+ * parse the agent-addr ipAddress
+ */
+ datalen = SMUXMAXSTRLEN;
+ if (((ptr = asn_parse_string(ptr, len,
+ &vartype, smux_str,
+ &datalen)) == NULL) ||
+ (vartype != (u_char) ASN_IPADDRESS)) {
+ DEBUGMSGTL(("smux",
+ "[smux_trap_process] asn_parse_string failed\n"));
+ return NULL;
+ }
+
+ /*
+ * parse the generic trap int
+ */
+ datalen = sizeof(long);
+ if ((ptr = asn_parse_int(ptr, len, &vartype, &trap, datalen)) == NULL) {
+ DEBUGMSGTL(("smux",
+ "[smux_trap_process] asn_parse_int generic failed\n"));
+ return NULL;
+ }
+
+ /*
+ * parse the specific trap int
+ */
+ datalen = sizeof(long);
+ if ((ptr = asn_parse_int(ptr, len,
+ &vartype, &specific, datalen)) == NULL) {
+ DEBUGMSGTL(("smux",
+ "[smux_trap_process] asn_parse_int specific failed\n"));
+ return NULL;
+ }
+
+ /*
+ * parse the timeticks timestamp
+ */
+ datalen = sizeof(u_long);
+ if (((ptr = asn_parse_unsigned_int(ptr, len,
+ &vartype, (u_long *) & timestamp,
+ datalen)) == NULL) ||
+ (vartype != (u_char) ASN_TIMETICKS)) {
+ DEBUGMSGTL(("smux",
+ "[smux_trap_process] asn_parse_unsigned_int (timestamp) failed\n"));
+ return NULL;
+ }
+
+ /*
+ * parse out the overall sequence
+ */
+ ptr = asn_parse_header(ptr, len, &vartype);
+ if (ptr == NULL || vartype != (ASN_SEQUENCE | ASN_CONSTRUCTOR)) {
+ return NULL;
+ }
+
+ /*
+ * parse the variable bindings
+ */
+ while (ptr && *len) {
+
+ /*
+ * get the objid and the asn1 coded value
+ */
+ var_name_len = MAX_OID_LEN;
+ ptr = snmp_parse_var_op(ptr, var_name, &var_name_len, &vartype,
+ &var_val_len, (u_char **) & var_val, len);
+
+ if (ptr == NULL) {
+ return NULL;
+ }
+
+ maxlen = SMUXMAXPKTSIZE;
+ switch ((short) vartype) {
+ case ASN_INTEGER:
+ var_val_len = sizeof(long);
+ asn_parse_int(var_val, &maxlen, &vartype,
+ (long *) &smux_long, var_val_len);
+ var_val = (u_char *) & smux_long;
+ break;
+ case ASN_COUNTER:
+ case ASN_GAUGE:
+ case ASN_TIMETICKS:
+ case ASN_UINTEGER:
+ var_val_len = sizeof(u_long);
+ asn_parse_unsigned_int(var_val, &maxlen, &vartype,
+ (u_long *) & smux_ulong, var_val_len);
+ var_val = (u_char *) & smux_ulong;
+ break;
+ case ASN_COUNTER64:
+ var_val_len = sizeof(smux_counter64);
+ asn_parse_unsigned_int64(var_val, &maxlen, &vartype,
+ (struct counter64 *) &smux_counter64,
+ var_val_len);
+ var_val = (u_char *) & smux_counter64;
+ break;
+ case ASN_IPADDRESS:
+ var_val_len = 4;
+ /*
+ * consume the tag and length, but just copy here
+ * because we know it is an ip address
+ */
+ if ((var_val =
+ asn_parse_header(var_val, &maxlen, &vartype)) == NULL)
+ return NULL;
+ memcpy((u_char *) & (smux_sa.sin_addr.s_addr), var_val,
+ var_val_len);
+ var_val = (u_char *) & (smux_sa.sin_addr.s_addr);
+ break;
+ case ASN_OPAQUE:
+ case ASN_OCTET_STR:
+ /*
+ * XXX
+ */
+ if (len == 0)
+ return NULL;
+ var_val_len = SMUXMAXSTRLEN;
+ asn_parse_string(var_val, &maxlen, &vartype,
+ smux_str, &var_val_len);
+ var_val = smux_str;
+ break;
+ case ASN_OBJECT_ID:
+ var_val_len = MAX_OID_LEN;
+ asn_parse_objid(var_val, &maxlen, &vartype,
+ smux_objid, &var_val_len);
+ var_val_len *= sizeof(oid);
+ var_val = (u_char *) smux_objid;
+ break;
+ case SNMP_NOSUCHOBJECT:
+ case SNMP_NOSUCHINSTANCE:
+ case SNMP_ENDOFMIBVIEW:
+ case ASN_NULL:
+ var_val = NULL;
+ break;
+ case ASN_BIT_STR:
+ /*
+ * XXX
+ */
+ if (len == 0)
+ return NULL;
+ var_val_len = SMUXMAXSTRLEN;
+ asn_parse_bitstring(var_val, &maxlen, &vartype,
+ smux_str, &var_val_len);
+ var_val = (u_char *) smux_str;
+ break;
+ case ASN_NSAP:
+ default:
+ snmp_log(LOG_ERR, "bad type returned (%x)\n", vartype);
+ var_val = NULL;
+ break;
+ }
+
+ snmptrap_tmp =
+ (netsnmp_variable_list *)
+ malloc(sizeof(netsnmp_variable_list));
+ if (snmptrap_tmp == NULL)
+ return NULL;
+ memset(snmptrap_tmp, 0, sizeof(netsnmp_variable_list));
+ if (snmptrap_head == NULL) {
+ snmptrap_head = snmptrap_tmp;
+ snmptrap_ptr = snmptrap_head;
+ } else {
+ snmptrap_ptr->next_variable = snmptrap_tmp;
+ snmptrap_ptr = snmptrap_ptr->next_variable;
+ }
+
+ snmptrap_ptr->type = vartype;
+ snmptrap_ptr->next_variable = NULL;
+ snmp_set_var_objid(snmptrap_ptr, var_name, var_name_len);
+ snmp_set_var_value(snmptrap_ptr, (char *) var_val, var_val_len);
+
+ }
+
+ /*
+ * send the traps
+ */
+ send_enterprise_trap_vars(trap, specific, (oid *) & sa_enterpriseoid,
+ sa_enterpriseoid_len, snmptrap_head);
+
+ /*
+ * free trap variables
+ */
+ snmp_free_varbind(snmptrap_head);
+
+ return ptr;
+
+}
+
+#define NUM_SOCKETS 32
+static int sdlist[NUM_SOCKETS], sdlen = 0;
+
+int smux_snmp_select_list_add(int sd)
+{
+ if (sdlen < NUM_SOCKETS)
+ {
+ sdlist[sdlen++] = sd;
+ return(1);
+ }
+ return(0);
+}
+
+int smux_snmp_select_list_del(int sd)
+{
+ int i, found=0;
+
+ for (i = 0; i < (sdlen); i++) {
+ if (sdlist[i] == sd)
+ {
+ sdlist[i] = 0;
+ found = 1;
+ }
+ if ((found) &&(i < (sdlen - 1)))
+ sdlist[i] = sdlist[i + 1];
+ }
+ if (found)
+ {
+ sdlen--;
+ return(1);
+ }
+ return(0);
+}
+
+int smux_snmp_select_list_get_length()
+{
+ return(sdlen);
+}
+
+int smux_snmp_select_list_get_SD_from_List(int pos)
+{
+ if (pos < NUM_SOCKETS)
+ {
+ return(sdlist[pos]);
+ }
+ return(0);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/smux.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/smux.h
new file mode 100644
index 0000000000..d151f7db74
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/smux.h
@@ -0,0 +1,82 @@
+/*
+ * Smux module authored by Rohit Dube.
+ * Rewritten by Nick Amato <naamato@merit.net>.
+ */
+config_belongs_in(agent_module)
+
+#define SMUXPORT 199
+
+#define SMUXMAXPKTSIZE 1500
+#define SMUXMAXSTRLEN 1024
+#define SMUXMAXPEERS 10
+
+#define SMUX_OPEN (ASN_APPLICATION | ASN_CONSTRUCTOR | 0)
+#define SMUX_CLOSE (ASN_APPLICATION | ASN_PRIMITIVE | 1)
+#define SMUX_RREQ (ASN_APPLICATION | ASN_CONSTRUCTOR | 2)
+#define SMUX_RRSP (ASN_APPLICATION | ASN_PRIMITIVE | 3)
+#define SMUX_SOUT (ASN_APPLICATION | ASN_PRIMITIVE | 4)
+
+#define SMUX_GET (ASN_CONTEXT | ASN_CONSTRUCTOR | 0)
+#define SMUX_GETNEXT (ASN_CONTEXT | ASN_CONSTRUCTOR | 1)
+#define SMUX_GETRSP (ASN_CONTEXT | ASN_CONSTRUCTOR | 2)
+#define SMUX_SET (ASN_CONTEXT | ASN_CONSTRUCTOR | 3)
+#define SMUX_TRAP (ASN_CONTEXT | ASN_CONSTRUCTOR | 4)
+
+#define SMUXC_GOINGDOWN 0
+#define SMUXC_UNSUPPORTEDVERSION 1
+#define SMUXC_PACKETFORMAT 2
+#define SMUXC_PROTOCOLERROR 3
+#define SMUXC_INTERNALERROR 4
+#define SMUXC_AUTHENTICATIONFAILURE 5
+
+#define SMUX_MAX_PEERS 10
+#define SMUX_MAX_PRIORITY 2147483647
+
+#define SMUX_REGOP_DELETE 0
+#define SMUX_REGOP_REGISTER_RO 1
+#define SMUX_REGOP_REGISTER_RW 2
+
+/*
+ * Authorized peers read from the config file
+ */
+typedef struct _smux_peer_auth {
+ oid sa_oid[MAX_OID_LEN]; /* name of peer */
+ size_t sa_oid_len; /* length of peer name */
+ char sa_passwd[SMUXMAXSTRLEN]; /* configured passwd */
+ int sa_active_fd; /* the peer using this auth */
+} smux_peer_auth;
+
+/*
+ * Registrations
+ */
+typedef struct _smux_reg {
+ oid sr_name[MAX_OID_LEN]; /* name of subtree */
+ size_t sr_name_len; /* length of subtree name */
+ int sr_priority; /* priority of registration */
+ int sr_fd; /* descriptor of owner */
+ struct _smux_reg *sr_next; /* next one */
+} smux_reg;
+
+extern void init_smux(void);
+extern void real_init_smux(void);
+extern int smux_accept(int);
+extern u_char *smux_snmp_process(int, oid *, size_t *, size_t *, u_char *,
+ int);
+extern int smux_process(int);
+extern void smux_parse_peer_auth(const char *, char *);
+extern void smux_free_peer_auth(void);
+extern void send_enterprise_trap_vars(int, int, oid *, int,
+ netsnmp_variable_list *);
+
+/* Add socket-fd to list */
+int smux_snmp_select_list_add(int sd);
+
+/* Remove socket-fd from list */
+int smux_snmp_select_list_del(int sd);
+
+/* Returns the count of added socket-fd's in the list */
+int smux_snmp_select_list_get_length(void);
+
+/* Returns the socket-fd number from the position of the list */
+int smux_snmp_select_list_get_SD_from_List(int pos);
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_bgp.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_bgp.c
new file mode 100644
index 0000000000..aef3b3c528
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_bgp.c
@@ -0,0 +1,187 @@
+/*
+ * $Id: snmp_bgp.c 6918 2002-04-20 07:30:29Z hardaker $
+ */
+
+/*
+ * Smux module authored by Rohit Dube.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_ERR_H
+#include <err.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#include <errno.h>
+#include <netdb.h>
+
+#include <sys/stat.h>
+#include <sys/socket.h>
+#if HAVE_SYS_FILIO_H
+#include <sys/filio.h>
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "smux.h"
+#include "snmp_bgp.h"
+
+struct variable13 bgp_variables[] = {
+ {BGPVERSION, ASN_OCTET_STR, RONLY, var_bgp, 1, {1}},
+ {BGPLOCALAS, ASN_INTEGER, RONLY, var_bgp, 1, {2}},
+ {BGPIDENTIFIER, ASN_IPADDRESS, RONLY, var_bgp, 1, {4}},
+ {BGPPEERIDENTIFIER, ASN_IPADDRESS, RONLY, var_bgp, 3, {3, 1, 1}},
+ {BGPPEERSTATE, ASN_INTEGER, RONLY, var_bgp, 3, {3, 1, 2}},
+ {BGPPEERADMINSTATUS, ASN_INTEGER, RONLY, var_bgp, 3, {3, 1, 3}},
+ {BGPPEERNEGOTIATEDVERSION, ASN_INTEGER, RONLY, var_bgp, 3, {3, 1, 4}},
+ {BGPPEERLOCALADDR, ASN_IPADDRESS, RONLY, var_bgp, 3, {3, 1, 5}},
+ {BGPPEERLOCALPORT, ASN_INTEGER, RONLY, var_bgp, 3, {3, 1, 6}},
+ {BGPPEERREMOTEADDR, ASN_IPADDRESS, RONLY, var_bgp, 3, {3, 1, 7}},
+ {BGPPEERREMOTEPORT, ASN_INTEGER, RONLY, var_bgp, 3, {3, 1, 8}},
+ {BGPPEERREMOTEAS, ASN_INTEGER, RONLY, var_bgp, 3, {3, 1, 9}},
+ {BGPPEERINUPDATES, ASN_COUNTER, RONLY, var_bgp, 3, {3, 1, 10}},
+ {BGPPEEROUTUPDATES, ASN_COUNTER, RONLY, var_bgp, 3, {3, 1, 11}},
+ {BGPPEERINTOTALMESSAGES, ASN_COUNTER, RONLY, var_bgp, 3, {3, 1, 12}},
+ {BGPPEEROUTTOTALMESSAGES, ASN_COUNTER, RONLY, var_bgp, 3, {3, 1, 13}},
+ {BGPPEERLASTERROR, ASN_OCTET_STR, RONLY, var_bgp, 3, {3, 1, 14}},
+ {BGPPATHATTRPEER, ASN_IPADDRESS, RONLY, var_bgp, 3, {5, 1, 1}},
+ {BGPPATHATTRDESTNETWORK, ASN_IPADDRESS, RONLY, var_bgp, 3, {5, 1, 2}},
+ {BGPPATHATTRORIGIN, ASN_INTEGER, RONLY, var_bgp, 3, {5, 1, 3}},
+ {BGPPATHATTRASPATH, ASN_OCTET_STR, RONLY, var_bgp, 3, {5, 1, 4}},
+ {BGPPATHATTRNEXTHOP, ASN_INTEGER, RONLY, var_bgp, 3, {5, 1, 5}},
+ {BGPPATHATTRINTERASMETRIC, ASN_OCTET_STR, RONLY, var_bgp, 3, {5, 1, 6}}
+};
+
+oid bgp_variables_oid[] = { MIB, 15 };
+
+void
+init_snmp_bdp(void)
+{
+ REGISTER_MIB("smux/snmp_bgp", bgp_variables, variable13,
+ bgp_variables_oid);
+}
+
+
+#endif
+static oid max_bgp_mib[] =
+ { 1, 3, 6, 1, 2, 1, 15, 5, 1, 6, 255, 255, 255, 255 };
+static oid min_bgp_mib[] = { 1, 3, 6, 1, 2, 1, 15, 1, 0 };
+extern u_char smux_type;
+
+u_char *
+var_bgp(struct variable *vp,
+ oid * name,
+ int *length, int exact, int *var_len, WriteMethod ** write_method)
+{
+ u_char *var;
+ int result;
+
+ DEBUGMSGTL(("smux/snmp_bgp",
+ "[var_bgp] var len %d, oid requested Len %d-", *var_len,
+ *length));
+ DEBUGMSGOID(("smux/snmp_bgp", name, *length));
+ DEBUGMSG(("smux/snmp_bgp", "\n"));
+
+ /*
+ * Pass on the request to Gated.
+ * If the request sent out was a get next, check to see if
+ * it lies in the bgp range. If it doesn't, return NULL.
+ * In either case, make sure that errors are checked on the
+ * returned packets.
+ */
+
+ /*
+ * No writes for now
+ */
+ *write_method = NULL;
+
+ /*
+ * Donot allow access to the peer stuff as it crashes gated.
+ * However A GetNext on the last 23.3.1.9 variable will force gated into
+ * the peer stuff and cause it to crash.
+ * The only way to fix this is to either solve the Gated problem, or
+ * remove the peer variables from Gated itself and cause it to return
+ * NULL at the crossing. Currently doing the later.
+ */
+
+ /*
+ * Reject GET and GETNEXT for anything above bgpifconf range
+ */
+ result = snmp_oid_compare(name, *length, max_bgp_mib,
+ sizeof(max_bgp_mib) / sizeof(u_int));
+
+ if (result >= 0) {
+ DEBUGMSGTL(("smux/snmp_bgp", "Over shot\n"));
+ return NULL;
+ }
+
+ /*
+ * for GETs we need to be in the bgp range so reject anything below
+ */
+ result = snmp_oid_compare(name, *length, min_bgp_mib,
+ sizeof(min_bgp_mib) / sizeof(u_int));
+ if (exact && (result < 0)) {
+ DEBUGMSGTL(("smux/snmp_bgp",
+ "Exact but doesn't match length %d, size %d\n",
+ *length, sizeof(min_bgp_mib)));
+ return NULL;
+ }
+
+ /*
+ * On return, 'var' points to the value returned which is of length
+ * '*var_len'. 'name' points to the new (same as the one passed in for
+ * GETs) oid which has 'length' suboids.
+ * 'smux_type' contains the type of the variable.
+ */
+ var = smux_snmp_process(exact, name, length, var_len);
+
+ DEBUGMSGTL(("smux/snmp_bgp",
+ "[var_bgp] var len %d, oid obtained Len %d-", *var_len,
+ *length));
+ DEBUGMSGOID(("smux/snmp_bgp", name, *length));
+ DEBUGMSG(("smux/snmp_bgp", "\n"));
+
+ vp->type = smux_type;
+
+ /*
+ * XXX Need a mechanism to return errors in gated's responses
+ */
+
+ if (var == NULL)
+ return NULL;
+
+ /*
+ * Any resullt returned should be within the bgp tree.
+ * bgp_mib - static u_int bgp_mib[] = {1, 3, 6, 1, 2, 1, 15};
+ */
+ if (memcmp(bgp_mib, name, sizeof(bgp_mib)) != 0) {
+ return NULL;
+ } else {
+ return var;
+ }
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_bgp.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_bgp.h
new file mode 100644
index 0000000000..74ee6ec2f9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_bgp.h
@@ -0,0 +1,38 @@
+/*
+ * snmp_bgp.h
+ *
+ */
+#ifndef _MIBGROUP_SNMP_BGP_H
+#define _MIBGROUP_SNMP_BGP_H
+
+config_require(smux/smux)
+
+ extern FindVarMethod var_bgp;
+ extern void init_snmp_bgp(void);
+
+
+#define BGPVERSION 0
+#define BGPLOCALAS 1
+#define BGPIDENTIFIER 2
+#define BGPPEERIDENTIFIER 3
+#define BGPPEERSTATE 4
+#define BGPPEERADMINSTATUS 5
+#define BGPPEERNEGOTIATEDVERSION 6
+#define BGPPEERLOCALADDR 7
+#define BGPPEERLOCALPORT 8
+#define BGPPEERREMOTEADDR 9
+#define BGPPEERREMOTEPORT 10
+#define BGPPEERREMOTEAS 11
+#define BGPPEERINUPDATES 12
+#define BGPPEEROUTUPDATES 13
+#define BGPPEERINTOTALMESSAGES 14
+#define BGPPEEROUTTOTALMESSAGES 15
+#define BGPPEERLASTERROR 16
+#define BGPPATHATTRPEER 17
+#define BGPPATHATTRDESTNETWORK 18
+#define BGPPATHATTRORIGIN 19
+#define BGPPATHATTRASPATH 20
+#define BGPPATHATTRNEXTHOP 21
+#define BGPPATHATTRINTERASMETRIC 22
+
+#endif /* _MIBGROUP_SNMP_BGP_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_ospf.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_ospf.c
new file mode 100644
index 0000000000..38c87b8837
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_ospf.c
@@ -0,0 +1,282 @@
+/*
+ * $Id: snmp_ospf.c 6918 2002-04-20 07:30:29Z hardaker $
+ */
+
+/*
+ * Smux module authored by Rohit Dube.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_ERR_H
+#include <err.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#include <errno.h>
+#include <netdb.h>
+
+#include <sys/stat.h>
+#include <sys/socket.h>
+#if HAVE_SYS_FILIO_H
+#include <sys/filio.h>
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "smux.h"
+#include "snmp_ospf.h"
+
+static oid max_ospf_mib[] = { 1, 3, 6, 1, 2, 1, 14, 14, 1, 6, 0 };
+static oid min_ospf_mib[] =
+ { 1, 3, 6, 1, 2, 1, 14, 1, 1, 0, 0, 0, 0 };
+extern u_char smux_type;
+
+struct variable13 ospf_variables[] = {
+ {ospfRouterId, ASN_IPADDRESS, RWRITE, var_ospf, 3, {1, 1, 1}},
+ {ospfAdminStat, ASN_INTEGER, RWRITE, var_ospf, 3, {1, 1, 2}},
+ {ospfVersionNumber, ASN_INTEGER, RONLY, var_ospf, 3, {1, 1, 3}},
+ {ospfAreaBdrRtrStatus, ASN_INTEGER, RONLY, var_ospf, 3, {1, 1, 4}},
+ {ospfASBdrRtrStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {1, 1, 5}},
+ {ospfExternLsaCount, ASN_GAUGE, RONLY, var_ospf, 3, {1, 1, 6}},
+ {ospfExternLsaCksumSum, ASN_INTEGER, RONLY, var_ospf, 3, {1, 1, 7}},
+ {ospfTOSSupport, ASN_INTEGER, RWRITE, var_ospf, 3, {1, 1, 8}},
+ {ospfOriginateNewLsas, ASN_COUNTER, RONLY, var_ospf, 3, {1, 1, 9}},
+ {ospfRxNewLsas, ASN_COUNTER, RONLY, var_ospf, 3, {1, 1, 10, 0}},
+ {ospfExtLsdbLimit, ASN_INTEGER, RWRITE, var_ospf, 3, {1, 1, 11}},
+ {ospfMulticastExtensions, ASN_INTEGER, RWRITE, var_ospf, 3,
+ {1, 1, 12}},
+ {ospfAreaId, ASN_IPADDRESS, RONLY, var_ospf, 3, {2, 1, 1}},
+ {ospfAuthType, ASN_INTEGER, RWRITE, var_ospf, 3, {2, 1, 2}},
+ {ospfImportAsExtern, ASN_INTEGER, RWRITE, var_ospf, 3, {2, 1, 3}},
+ {ospfSpfRuns, ASN_COUNTER, RONLY, var_ospf, 3, {2, 1, 4}},
+ {ospfAreaBdrRtrCount, ASN_GAUGE, RONLY, var_ospf, 3, {2, 1, 5}},
+ {ospfAsBdrRtrCount, ASN_GAUGE, RONLY, var_ospf, 3, {2, 1, 6}},
+ {ospfAreaLsaCount, ASN_GAUGE, RONLY, var_ospf, 3, {2, 1, 7}},
+ {ospfAreaLsaCksumSum, ASN_INTEGER, RONLY, var_ospf, 3, {2, 1, 8}},
+ {ospfAreaSummary, ASN_INTEGER, RWRITE, var_ospf, 3, {2, 1, 9}},
+ {ospfAreaStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {2, 1, 10}},
+ {ospfStubAreaId, ASN_IPADDRESS, RONLY, var_ospf, 3, {3, 1, 1}},
+ {ospfStubTOS, ASN_INTEGER, RONLY, var_ospf, 3, {3, 1, 2}},
+ {ospfStubMetric, ASN_INTEGER, RWRITE, var_ospf, 3, {3, 1, 3}},
+ {ospfStubStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {3, 1, 4}},
+ {ospfStubMetricType, ASN_INTEGER, RWRITE, var_ospf, 3, {3, 1, 5}},
+ {ospfLsdbAreaId, ASN_IPADDRESS, RONLY, var_ospf, 3, {4, 1, 1}},
+ {ospfLsdbType, ASN_INTEGER, RONLY, var_ospf, 3, {4, 1, 2}},
+ {ospfLsdbLsid, ASN_IPADDRESS, RONLY, var_ospf, 3, {4, 1, 3}},
+ {ospfLsdbRouterId, ASN_IPADDRESS, RONLY, var_ospf, 3, {4, 1, 4}},
+ {ospfLsdbSequence, ASN_INTEGER, RONLY, var_ospf, 3, {4, 1, 5}},
+ {ospfLsdbAge, ASN_INTEGER, RONLY, var_ospf, 3, {4, 1, 6}},
+ {ospfLsdbChecksum, ASN_INTEGER, RONLY, var_ospf, 3, {4, 1, 7}},
+ {ospfLsdbAdvertisement, ASN_OCTET_STR, RONLY, var_ospf, 3, {4, 1, 8}},
+ {ospfAreaRangeAreaId, ASN_IPADDRESS, RONLY, var_ospf, 3, {5, 1, 1}},
+ {ospfAreaRangeNet, ASN_IPADDRESS, RONLY, var_ospf, 3, {5, 1, 2}},
+ {ospfAreaRangeMask, ASN_IPADDRESS, RWRITE, var_ospf, 3, {5, 1, 3}},
+ {ospfAreaRangeStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {5, 1, 4}},
+ {ospfAreaRangeEffect, ASN_INTEGER, RWRITE, var_ospf, 3, {5, 1, 5}},
+ {ospfHostIpAddress, ASN_IPADDRESS, RONLY, var_ospf, 3, {6, 1, 1}},
+ {ospfHostTOS, ASN_INTEGER, RONLY, var_ospf, 3, {6, 1, 2}},
+ {ospfHostMetric, ASN_INTEGER, RWRITE, var_ospf, 3, {6, 1, 3}},
+ {ospfHostStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {6, 1, 4}},
+ {ospfHostAreaID, ASN_IPADDRESS, RONLY, var_ospf, 3, {6, 1, 5}},
+ {ospfIfIpAddress, ASN_IPADDRESS, RONLY, var_ospf, 3, {7, 1, 1}},
+ {ospfAddressLessIf, ASN_INTEGER, RONLY, var_ospf, 3, {7, 1, 2}},
+ {ospfIfAreaId, ASN_IPADDRESS, RWRITE, var_ospf, 3, {7, 1, 3}},
+ {ospfIfType, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 4}},
+ {ospfIfAdminStat, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 5}},
+ {ospfIfRtrPriority, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 6}},
+ {ospfIfTransitDelay, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 7}},
+ {ospfIfRetransInterval, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 8}},
+ {ospfIfHelloInterval, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 9}},
+ {ospfIfRtrDeadInterval, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 10}},
+ {ospfIfPollInterval, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 11}},
+ {ospfIfState, ASN_INTEGER, RONLY, var_ospf, 3, {7, 1, 12}},
+ {ospfIfDesignatedRouter, ASN_IPADDRESS, RONLY, var_ospf, 3,
+ {7, 1, 13}},
+ {ospfIfBackupDesignatedRouter, ASN_IPADDRESS, RONLY, var_ospf, 3,
+ {7, 1, 14}},
+ {ospfIfEvents, ASN_COUNTER, RONLY, var_ospf, 3, {7, 1, 15}},
+ {ospfIfAuthKey, ASN_OCTET_STR, RWRITE, var_ospf, 3, {7, 1, 16}},
+ {ospfIfStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {7, 1, 17}},
+ {ospfIfMulticastForwarding, ASN_INTEGER, RWRITE, var_ospf, 3,
+ {7, 1, 18}},
+ {ospfIfMetricIpAddress, ASN_IPADDRESS, RONLY, var_ospf, 3, {8, 1, 1}},
+ {ospfIfMetricAddressLessIf, ASN_INTEGER, RONLY, var_ospf, 3,
+ {8, 1, 2}},
+ {ospfIfMetricTOS, ASN_INTEGER, RONLY, var_ospf, 3, {8, 1, 3}},
+ {ospfIfMetricValue, ASN_INTEGER, RWRITE, var_ospf, 3, {8, 1, 4}},
+ {ospfIfMetricStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {8, 1, 5}},
+ {ospfVirtIfAreaId, ASN_IPADDRESS, RONLY, var_ospf, 3, {9, 1, 1}},
+ {ospfVirtIfNeighbor, ASN_IPADDRESS, RONLY, var_ospf, 3, {9, 1, 2}},
+ {ospfVirtIfTransitDelay, ASN_INTEGER, RWRITE, var_ospf, 3, {9, 1, 3}},
+ {ospfVirtIfRetransInterval, ASN_INTEGER, RWRITE, var_ospf, 3,
+ {9, 1, 4}},
+ {ospfVirtIfHelloInterval, ASN_INTEGER, RWRITE, var_ospf, 3, {9, 1, 5}},
+ {ospfVirtIfRtrDeadInterval, ASN_INTEGER, RWRITE, var_ospf, 3,
+ {9, 1, 6}},
+ {ospfVirtIfState, ASN_INTEGER, RONLY, var_ospf, 3, {9, 1, 7}},
+ {ospfVirtIfEvents, ASN_COUNTER, RONLY, var_ospf, 3, {9, 1, 8}},
+ {ospfVirtIfAuthKey, ASN_OCTET_STR, RWRITE, var_ospf, 3, {9, 1, 9}},
+ {ospfVirtIfStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {9, 1, 10}},
+ {ospfNbrIpAddr, ASN_IPADDRESS, RONLY, var_ospf, 3, {10, 1, 1}},
+ {ospfNbrAddressLessIndex, ASN_INTEGER, RONLY, var_ospf, 3, {10, 1, 2}},
+ {ospfNbrRtrId, ASN_IPADDRESS, RONLY, var_ospf, 3, {10, 1, 3}},
+ {ospfNbrOptions, ASN_INTEGER, RONLY, var_ospf, 3, {10, 1, 4}},
+ {ospfNbrPriority, ASN_INTEGER, RWRITE, var_ospf, 3, {10, 1, 5}},
+ {ospfNbrState, ASN_INTEGER, RONLY, var_ospf, 3, {10, 1, 6}},
+ {ospfNbrEvents, ASN_COUNTER, RONLY, var_ospf, 3, {10, 1, 7}},
+ {ospfNbrLsRetransQLen, ASN_GAUGE, RONLY, var_ospf, 3, {10, 1, 8}},
+ {ospfNbmaNbrStatus, ASN_INTEGER, RWRITE, var_ospf, 3, {10, 1, 9}},
+ {ospfNbmaNbrPermanence, ASN_INTEGER, RWRITE, var_ospf, 3, {10, 1, 10}},
+ {ospfVirtNbrArea, ASN_IPADDRESS, RONLY, var_ospf, 3, {11, 1, 1}},
+ {ospfVirtNbrRtrId, ASN_IPADDRESS, RONLY, var_ospf, 3, {11, 1, 2}},
+ {ospfVirtNbrIpAddr, ASN_IPADDRESS, RONLY, var_ospf, 3, {11, 1, 3}},
+ {ospfVirtNbrOptions, ASN_INTEGER, RONLY, var_ospf, 3, {11, 1, 4}},
+ {ospfVirtNbrState, ASN_INTEGER, RONLY, var_ospf, 3, {11, 1, 5}},
+ {ospfVirtNbrEvents, ASN_COUNTER, RONLY, var_ospf, 3, {11, 1, 6}},
+ {ospfVirtNbrLsRetransQLen, ASN_GAUGE, RONLY, var_ospf, 3, {11, 1, 7}},
+ {ospfExtLsdbType, ASN_INTEGER, RONLY, var_ospf, 3, {12, 1, 1}},
+ {ospfExtLsdbLsid, ASN_IPADDRESS, RONLY, var_ospf, 3, {12, 1, 2}},
+ {ospfExtLsdbRouterId, ASN_IPADDRESS, RONLY, var_ospf, 3, {12, 1, 3}},
+ {ospfExtLsdbSequence, ASN_INTEGER, RONLY, var_ospf, 3, {12, 1, 4}},
+ {ospfExtLsdbAge, ASN_INTEGER, RONLY, var_ospf, 3, {12, 1, 5}},
+ {ospfExtLsdbChecksum, ASN_INTEGER, RONLY, var_ospf, 3, {12, 1, 6}},
+ {ospfExtLsdbAdvertisement, ASN_OCTET_STR, RONLY, var_ospf, 3,
+ {12, 1, 7}},
+ {ospfAreaAggregateAreaID, ASN_IPADDRESS, RONLY, var_ospf, 3,
+ {14, 1, 1}},
+ {ospfAreaAggregateLsdbType, ASN_INTEGER, RONLY, var_ospf, 3,
+ {14, 1, 2}},
+ {ospfAreaAggregateNet, ASN_IPADDRESS, RONLY, var_ospf, 3, {14, 1, 3}},
+ {ospfAreaAggregateMask, ASN_IPADDRESS, RWRITE, var_ospf, 3,
+ {14, 1, 4}},
+ {ospfAreaAggregateStatus, ASN_INTEGER, RWRITE, var_ospf, 3,
+ {14, 1, 5}},
+ {ospfAreaAggregateEffect, ASN_INTEGER, RWRITE, var_ospf, 3, {14, 1, 6}}
+};
+
+oid ospf_variables_oid[] = { MIB, 14 };
+
+void
+init_snmp_ospf(void)
+{
+ REGISTER_MIB("smux/snmp_ospf", ospf_variables, variable13,
+ ospf_variables_oid);
+}
+
+u_char *
+var_ospf(struct variable *vp,
+ oid * name,
+ int *length, int exact, int *var_len, WriteMethod ** write_method)
+{
+ u_char *var;
+ int result;
+
+ DEBUGMSGTL(("smux/snmp_ospf",
+ "[var_ospf] var len %d, oid requested Len %d-", *var_len,
+ *length));
+ DEBUGMSGOID(("smux/snmp_ospf", name, *length));
+ DEBUGMSG(("smux/snmp_ospf", "\n"));
+
+ /*
+ * Pass on the request to Gated.
+ * If the request sent out was a get next, check to see if
+ * it lies in the ospf range. If it doesn't, return NULL.
+ * In either case, make sure that errors are checked on the
+ * returned packets.
+ */
+
+ /*
+ * No writes for now
+ */
+ *write_method = NULL;
+
+ /*
+ * Donot allow access to the peer stuff as it crashes gated.
+ * However A GetNext on the last 23.3.1.9 variable will force gated into
+ * the peer stuff and cause it to crash.
+ * The only way to fix this is to either solve the Gated problem, or
+ * remove the peer variables from Gated itself and cause it to return
+ * NULL at the crossing. Currently doing the later.
+ */
+
+ /*
+ * Reject GET and GETNEXT for anything above ospfifconf range
+ */
+ result = snmp_oid_compare(name, *length, max_ospf_mib,
+ sizeof(max_ospf_mib) / sizeof(u_int));
+
+ if (result >= 0) {
+ DEBUGMSGTL(("smux/snmp_ospf", "Over shot\n"));
+ return NULL;
+ }
+
+ /*
+ * for GETs we need to be in the ospf range so reject anything below
+ */
+ result = snmp_oid_compare(name, *length, min_ospf_mib,
+ sizeof(min_ospf_mib) / sizeof(u_int));
+ if (exact && (result < 0)) {
+ DEBUGMSGTL(("smux/snmp_ospf",
+ "Exact but doesn't match length %d, size %d\n",
+ *length, sizeof(min_ospf_mib)));
+ return NULL;
+ }
+
+ /*
+ * On return, 'var' points to the value returned which is of length
+ * '*var_len'. 'name' points to the new (same as the one passed in for
+ * GETs) oid which has 'length' suboids.
+ * 'smux_type' contains the type of the variable.
+ */
+ var = smux_snmp_process(exact, name, length, var_len);
+
+ DEBUGMSGTL(("smux/snmp_ospf",
+ "[var_ospf] var len %d, oid obtained Len %d-", *var_len,
+ *length));
+ DEBUGMSGOID(("smux/snmp_ospf", name, *length));
+ DEBUGMSG(("smux/snmp_ospf", "\n"));
+
+ vp->type = smux_type;
+
+ /*
+ * XXX Need a mechanism to return errors in gated's responses
+ */
+
+ if (var == NULL)
+ return NULL;
+
+ /*
+ * Any resullt returned should be within the ospf tree.
+ * ospf_mib - static u_int ospf_mib[] = {1, 3, 6, 1, 2, 1, 14};
+ */
+ if (memcmp(ospf_mib, name, sizeof(ospf_mib)) != 0) {
+ return NULL;
+ } else {
+ return var;
+ }
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_ospf.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_ospf.h
new file mode 100644
index 0000000000..4cb50f6803
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_ospf.h
@@ -0,0 +1,123 @@
+/*
+ * snmp_ospf.h
+ *
+ */
+#ifndef _MIBGROUP_SNMP_OSPF_H
+#define _MIBGROUP_SNMP_OSPF_H
+
+config_require(smux/smux)
+
+ extern FindVarMethod var_ospf;
+ extern void init_snmp_ospf(void);
+
+
+#define ospfRouterId 0
+#define ospfAdminStat 1
+#define ospfVersionNumber 2
+#define ospfAreaBdrRtrStatus 3
+#define ospfASBdrRtrStatus 4
+#define ospfExternLsaCount 5
+#define ospfExternLsaCksumSum 6
+#define ospfTOSSupport 7
+#define ospfOriginateNewLsas 8
+#define ospfRxNewLsas 9
+#define ospfExtLsdbLimit 10
+#define ospfMulticastExtensions 11
+#define ospfAreaId 12
+#define ospfAuthType 13
+#define ospfImportAsExtern 14
+#define ospfSpfRuns 15
+#define ospfAreaBdrRtrCount 16
+#define ospfAsBdrRtrCount 17
+#define ospfAreaLsaCount 18
+#define ospfAreaLsaCksumSum 19
+#define ospfAreaSummary 20
+#define ospfAreaStatus 21
+#define ospfStubAreaId 22
+#define ospfStubTOS 23
+#define ospfStubMetric 24
+#define ospfStubStatus 25
+#define ospfStubMetricType 26
+#define ospfLsdbAreaId 27
+#define ospfLsdbType 28
+#define ospfLsdbLsid 29
+#define ospfLsdbRouterId 30
+#define ospfLsdbSequence 31
+#define ospfLsdbAge 32
+#define ospfLsdbChecksum 33
+#define ospfLsdbAdvertisement 34
+#define ospfAreaRangeAreaId 35
+#define ospfAreaRangeNet 36
+#define ospfAreaRangeMask 37
+#define ospfAreaRangeStatus 38
+#define ospfAreaRangeEffect 39
+#define ospfHostIpAddress 40
+#define ospfHostTOS 41
+#define ospfHostMetric 42
+#define ospfHostStatus 43
+#define ospfHostAreaID 44
+#define ospfIfIpAddress 45
+#define ospfAddressLessIf 46
+#define ospfIfAreaId 47
+#define ospfIfType 48
+#define ospfIfAdminStat 49
+#define ospfIfRtrPriority 50
+#define ospfIfTransitDelay 51
+#define ospfIfRetransInterval 52
+#define ospfIfHelloInterval 53
+#define ospfIfRtrDeadInterval 54
+#define ospfIfPollInterval 55
+#define ospfIfState 56
+#define ospfIfDesignatedRouter 57
+#define ospfIfBackupDesignatedRouter 58
+#define ospfIfEvents 59
+#define ospfIfAuthKey 60
+#define ospfIfStatus 61
+#define ospfIfMulticastForwarding 62
+#define ospfIfMetricIpAddress 63
+#define ospfIfMetricAddressLessIf 64
+#define ospfIfMetricTOS 65
+#define ospfIfMetricValue 66
+#define ospfIfMetricStatus 67
+#define ospfVirtIfAreaId 68
+#define ospfVirtIfNeighbor 69
+#define ospfVirtIfTransitDelay 70
+#define ospfVirtIfRetransInterval 71
+#define ospfVirtIfHelloInterval 72
+#define ospfVirtIfRtrDeadInterval 73
+#define ospfVirtIfState 74
+#define ospfVirtIfEvents 75
+#define ospfVirtIfAuthKey 76
+#define ospfVirtIfStatus 77
+#define ospfNbrIpAddr 78
+#define ospfNbrAddressLessIndex 79
+#define ospfNbrRtrId 80
+#define ospfNbrOptions 81
+#define ospfNbrPriority 82
+#define ospfNbrState 83
+#define ospfNbrEvents 84
+#define ospfNbrLsRetransQLen 85
+#define ospfNbmaNbrStatus 86
+#define ospfNbmaNbrPermanence 87
+#define ospfVirtNbrArea 88
+#define ospfVirtNbrRtrId 89
+#define ospfVirtNbrIpAddr 90
+#define ospfVirtNbrOptions 91
+#define ospfVirtNbrState 92
+#define ospfVirtNbrEvents 93
+#define ospfVirtNbrLsRetransQLen 94
+#define ospfExtLsdbType 95
+#define ospfExtLsdbLsid 96
+#define ospfExtLsdbRouterId 97
+#define ospfExtLsdbSequence 98
+#define ospfExtLsdbAge 99
+#define ospfExtLsdbChecksum 100
+#define ospfExtLsdbAdvertisement 101
+#define ospfAreaAggregateAreaID 102
+#define ospfAreaAggregateLsdbType 103
+#define ospfAreaAggregateNet 104
+#define ospfAreaAggregateMask 105
+#define ospfAreaAggregateStatus 106
+#define ospfAreaAggregateEffect 107
+
+#endif /* _MIBGROUP_SNMP_OSPF_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_rip2.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_rip2.c
new file mode 100644
index 0000000000..7e14d13267
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_rip2.c
@@ -0,0 +1,184 @@
+/*
+ * $Id: snmp_rip2.c 6918 2002-04-20 07:30:29Z hardaker $
+ */
+
+/*
+ * Smux module authored by Rohit Dube.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_ERR_H
+#include <err.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#include <errno.h>
+#include <netdb.h>
+
+#include <sys/stat.h>
+#include <sys/socket.h>
+#if HAVE_SYS_FILIO_H
+#include <sys/filio.h>
+#endif
+
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "smux.h"
+#include "snmp_rip2.h"
+
+static oid max_rip_mib[] =
+ { 1, 3, 6, 1, 2, 1, 23, 3, 1, 9, 255, 255, 255, 255 };
+static oid min_rip_mib[] = { 1, 3, 6, 1, 2, 1, 23, 1, 1, 0 };
+extern u_char smux_type;
+
+struct variable13 rip2_variables[] = {
+ {RIP2GLOBALROUTECHANGES, ASN_COUNTER, RONLY, var_rip2, 2, {1, 1}},
+ {RIP2GLOBALQUERIES, ASN_COUNTER, RONLY, var_rip2, 2, {1, 2}},
+ {RIP2IFSTATADDRESS, ASN_IPADDRESS, RONLY, var_rip2, 3, {2, 1, 1}},
+ {RIP2IFSTATRCVBADPKTS, ASN_COUNTER, RONLY, var_rip2, 3, {2, 1, 2}},
+ {RIP2IFSTATRCVBADROUTES, ASN_COUNTER, RONLY, var_rip2, 3, {2, 1, 3}},
+ {RIP2IFSTATSENTUPDATES, ASN_COUNTER, RONLY, var_rip2, 3, {2, 1, 4}},
+ {RIP2IFSTATSTATUS, ASN_INTEGER, RWRITE, var_rip2, 3, {2, 1, 5}},
+ {RIP2IFCONFADDRESS, ASN_IPADDRESS, RONLY, var_rip2, 3, {3, 1, 1}},
+ {RIP2IFCONFDOMAIN, ASN_OCTET_STR, RWRITE, var_rip2, 3, {3, 1, 2}},
+ {RIP2IFCONFAUTHTYPE, ASN_INTEGER, RWRITE, var_rip2, 3, {3, 1, 3}},
+ {RIP2IFCONFAUTHKEY, ASN_OCTET_STR, RWRITE, var_rip2, 3, {3, 1, 4}},
+ {RIP2IFCONFSEND, ASN_INTEGER, RWRITE, var_rip2, 3, {3, 1, 5}},
+ {RIP2IFCONFRECEIVE, ASN_INTEGER, RWRITE, var_rip2, 3, {3, 1, 6}},
+ {RIP2IFCONFDEFAULTMETRIC, ASN_INTEGER, RWRITE, var_rip2, 3, {3, 1, 7}},
+ {RIP2IFCONFSTATUS, ASN_INTEGER, RWRITE, var_rip2, 3, {3, 1, 8}},
+ {RIP2IFCONFSRCADDRESS, ASN_IPADDRESS, RWRITE, var_rip2, 3, {3, 1, 9}},
+ {RIP2PEERADDRESS, ASN_IPADDRESS, RONLY, var_rip2, 3, {4, 1, 1}},
+ {RIP2PEERDOMAIN, ASN_OCTET_STR, RONLY, var_rip2, 3, {4, 1, 2}},
+ {RIP2PEERLASTUPDATE, ASN_TIMETICKS, RONLY, var_rip2, 3, {4, 1, 3}},
+ {RIP2PEERVERSION, ASN_INTEGER, RONLY, var_rip2, 3, {4, 1, 4}},
+ {RIP2PEERRCVBADPKTS, ASN_COUNTER, RONLY, var_rip2, 3, {4, 1, 5}},
+ {RIP2PEERRCVBADROUTES, ASN_COUNTER, RONLY, var_rip2, 3, {4, 1, 6}}
+};
+
+oid rip2_variables_oid[] = { MIB, 23 };
+
+void
+init_snmp_rip2(void)
+{
+ REGISTER_MIB("smux/snmp_rip2", rip2_variables, variable13,
+ rip2_variables_oid);
+}
+
+u_char *
+var_rip2(struct variable *vp,
+ oid * name,
+ int *length, int exact, int *var_len, WriteMethod ** write_method)
+{
+ u_char *var;
+ int result;
+
+ DEBUGMSGTL(("smux/snmp_rip2",
+ "[var_rip2] var len %d, oid requested Len %d-", *var_len,
+ *length));
+ DEBUGMSGOID(("smux/snmp_rip2", name, *length));
+ DEBUGMSG(("smux/snmp_rip2", "\n"));
+
+ /*
+ * Pass on the request to Gated.
+ * If the request sent out was a get next, check to see if
+ * it lies in the rip2 range. If it doesn't, return NULL.
+ * In either case, make sure that errors are checked on the
+ * returned packets.
+ */
+
+ /*
+ * No writes for now
+ */
+ *write_method = NULL;
+
+ /*
+ * Donot allow access to the peer stuff as it crashes gated.
+ * However A GetNext on the last 23.3.1.9 variable will force gated into
+ * the peer stuff and cause it to crash.
+ * The only way to fix this is to either solve the Gated problem, or
+ * remove the peer variables from Gated itself and cause it to return
+ * NULL at the crossing. Currently doing the later.
+ */
+
+ /*
+ * Reject GET and GETNEXT for anything above rip2ifconf range
+ */
+ result = snmp_oid_compare(name, *length, max_rip_mib,
+ sizeof(max_rip_mib) / sizeof(u_int));
+
+ if (result >= 0) {
+ DEBUGMSGTL(("smux/snmp_rip2", "Over shot\n"));
+ return NULL;
+ }
+
+ /*
+ * for GETs we need to be in the rip2 range so reject anything below
+ */
+ result = snmp_oid_compare(name, *length, min_rip_mib,
+ sizeof(min_rip_mib) / sizeof(u_int));
+ if (exact && (result < 0)) {
+ DEBUGMSGTL(("smux/snmp_rip2",
+ "Exact but doesn't match length %d, size %d\n",
+ *length, sizeof(min_rip_mib)));
+ return NULL;
+ }
+
+ /*
+ * On return, 'var' points to the value returned which is of length
+ * '*var_len'. 'name' points to the new (same as the one passed in for
+ * GETs) oid which has 'length' suboids.
+ * 'smux_type' contains the type of the variable.
+ */
+ var = smux_snmp_process(exact, name, length, var_len);
+
+ DEBUGMSGTL(("smux/snmp_rip2",
+ "[var_rip2] var len %d, oid obtained Len %d-", *var_len,
+ *length));
+ DEBUGMSGOID(("smux/snmp_rip2", name, *length));
+ DEBUGMSG(("smux/snmp_rip2", "\n"));
+
+ vp->type = smux_type;
+
+ /*
+ * XXX Need a mechanism to return errors in gated's responses
+ */
+
+ if (var == NULL)
+ return NULL;
+
+ /*
+ * Any resullt returned should be within the rip2 tree.
+ * rip_mib - static u_int rip_mib[] = {1, 3, 6, 1, 2, 1, 23};
+ */
+ if (memcmp(rip_mib, name, sizeof(rip_mib)) != 0) {
+ return NULL;
+ } else {
+ return var;
+ }
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_rip2.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_rip2.h
new file mode 100644
index 0000000000..99652a0f51
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux/snmp_rip2.h
@@ -0,0 +1,37 @@
+/*
+ * snmp_rip2.h
+ *
+ */
+#ifndef _MIBGROUP_SNMP_RIP2_H
+#define _MIBGROUP_SNMP_RIP2_H
+
+config_require(smux/smux)
+
+ extern FindVarMethod var_rip2;;
+ void init_snmp_rip2(void);
+
+
+#define RIP2GLOBALROUTECHANGES 0
+#define RIP2GLOBALQUERIES 1
+#define RIP2IFSTATADDRESS 2
+#define RIP2IFSTATRCVBADPKTS 3
+#define RIP2IFSTATRCVBADROUTES 4
+#define RIP2IFSTATSENTUPDATES 5
+#define RIP2IFSTATSTATUS 6
+#define RIP2IFCONFADDRESS 7
+#define RIP2IFCONFDOMAIN 8
+#define RIP2IFCONFAUTHTYPE 9
+#define RIP2IFCONFAUTHKEY 10
+#define RIP2IFCONFSEND 11
+#define RIP2IFCONFRECEIVE 12
+#define RIP2IFCONFDEFAULTMETRIC 13
+#define RIP2IFCONFSTATUS 14
+#define RIP2IFCONFSRCADDRESS 15
+#define RIP2PEERADDRESS 16
+#define RIP2PEERDOMAIN 17
+#define RIP2PEERLASTUPDATE 18
+#define RIP2PEERVERSION 19
+#define RIP2PEERRCVBADPKTS 20
+#define RIP2PEERRCVBADROUTES 21
+
+#endif /* _MIBGROUP_SNMP_RIP2_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/smux_gated.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux_gated.h
new file mode 100644
index 0000000000..60de796def
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/smux_gated.h
@@ -0,0 +1,6 @@
+/*
+ * dummy module to load parts needed for smux/gated interaction
+ */
+config_require(smux/snmp_ospf)
+config_require(smux/snmp_rip2)
+config_require(smux/snmp_bgp)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib.h
new file mode 100644
index 0000000000..1fb84f7f19
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib.h
@@ -0,0 +1,2 @@
+config_require(notification/snmpNotifyTable)
+config_require(snmp-notification-mib/snmpNotifyFilterTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable.h
new file mode 100644
index 0000000000..f9b6173756
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable.h
@@ -0,0 +1 @@
+config_require(snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.c
new file mode 100644
index 0000000000..a9f0de6615
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.c
@@ -0,0 +1,1927 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: snmpNotifyFilterTable.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** \page MFD helper for snmpNotifyFilterTable
+ *
+ * \section intro Introduction
+ * Introductory text.
+ *
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "snmpNotifyFilterTable.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "snmpNotifyFilterTable_interface.h"
+
+oid snmpNotifyFilterTable_oid[] =
+ { SNMPNOTIFYFILTERTABLE_OID };
+int snmpNotifyFilterTable_oid_size =
+OID_LENGTH(snmpNotifyFilterTable_oid);
+
+snmpNotifyFilterTable_registration snmpNotifyFilterTable_user_context;
+
+void initialize_table_snmpNotifyFilterTable(void);
+void shutdown_table_snmpNotifyFilterTable(void);
+
+
+/**
+ * Initializes the snmpNotifyFilterTable module
+ */
+void
+init_snmpNotifyFilterTable(void)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:init_snmpNotifyFilterTable",
+ "called\n"));
+
+ /*
+ * TODO:300:o: Perform snmpNotifyFilterTable one-time module initialization.
+ */
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ if (should_init("snmpNotifyFilterTable"))
+ initialize_table_snmpNotifyFilterTable();
+
+} /* init_snmpNotifyFilterTable */
+
+/**
+ * Shut-down the snmpNotifyFilterTable module (agent is exiting)
+ */
+void
+shutdown_snmpNotifyFilterTable(void)
+{
+ if (should_init("snmpNotifyFilterTable"))
+ shutdown_table_snmpNotifyFilterTable();
+
+}
+
+/**
+ * Initialize the table snmpNotifyFilterTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_snmpNotifyFilterTable(void)
+{
+ snmpNotifyFilterTable_registration *user_context;
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:initialize_table_snmpNotifyFilterTable", "called\n"));
+
+ /*
+ * TODO:301:o: Perform snmpNotifyFilterTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize snmpNotifyFilterTable user context
+ * if you'd like to pass in a pointer to some data for this
+ * table, allocate or set it up here.
+ */
+ /*
+ * a netsnmp_data_list is a simple way to store void pointers. A simple
+ * string token is used to add, find or remove pointers.
+ */
+ user_context =
+ netsnmp_create_data_list("snmpNotifyFilterTable", NULL, NULL);
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _snmpNotifyFilterTable_initialize_interface(user_context, flags);
+} /* initialize_table_snmpNotifyFilterTable */
+
+/**
+ * Shutdown the table snmpNotifyFilterTable
+ */
+void
+shutdown_table_snmpNotifyFilterTable(void)
+{
+ /*
+ * call interface shutdown code
+ */
+ _snmpNotifyFilterTable_shutdown_interface
+ (&snmpNotifyFilterTable_user_context);
+}
+
+/**
+ * extra context initialization (eg default values)
+ *
+ * @param rowreq_ctx : row request context
+ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
+ *
+ * @retval MFD_SUCCESS : no errors
+ * @retval MFD_ERROR : error (context allocate will fail)
+ */
+int
+snmpNotifyFilterTable_rowreq_ctx_init(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx, void *user_init_ctx)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_rowreq_ctx_init", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:210:o: |-> Perform extra snmpNotifyFilterTable rowreq initialization. (eg DEFVALS)
+ */
+ /*
+ * strings and oids are hard to handle automagically.
+ * so all we've got for you is a hint:
+ *
+ * memcpy(rowreq_ctx->data.snmpNotifyFilterMask, 0,
+ * len(0) * sizeof(snmpNotifyFilterMask[0]);
+ */
+
+ rowreq_ctx->data.snmpNotifyFilterType = SNMPNOTIFYFILTERTYPE_INCLUDED;
+
+ rowreq_ctx->data.snmpNotifyFilterStorageType = STORAGETYPE_NONVOLATILE;
+
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterTable_rowreq_ctx_init */
+
+/**
+ * extra context cleanup
+ * @param rowreq_ctx
+ */
+void
+snmpNotifyFilterTable_rowreq_ctx_cleanup(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_rowreq_ctx_cleanup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:211:o: |-> Perform extra snmpNotifyFilterTable rowreq cleanup.
+ */
+} /* snmpNotifyFilterTable_rowreq_ctx_cleanup */
+
+/************************************************************
+ * the *_should_save routine is called to determine if a row
+ * should be stored persistently.
+ *
+ * Note that this is not a 'dirty' check (i.e. if a row has changed),
+ * but a check for volatile rows that should not be saved between
+ * restarts.
+ * @param rowreq_ctx
+ * @retval 1 if the row should be stored
+ * @retval 0 if the row should not be stored
+ */
+int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_container_should_save
+ (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx) {
+ if (SNMP_STORAGE_VOLATILE ==
+ rowreq_ctx->data.snmpNotifyFilterStorageType)
+ return 0;
+
+ return 1; /* save the row */
+}
+
+/**
+ * pre-request callback
+ *
+ * @param user_context
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+snmpNotifyFilterTable_pre_request(snmpNotifyFilterTable_registration *
+ user_context)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_pre_request", "called\n"));
+
+ /*
+ * TODO:510:o: Perform snmpNotifyFilterTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ * Note:
+ * New rows have been inserted into the container, and
+ * deleted rows have been removed from the container and
+ * released.
+ * @param user_context
+ * @param rc : MFD_SUCCESS if all requests succeeded
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+snmpNotifyFilterTable_post_request(snmpNotifyFilterTable_registration *
+ user_context, int rc)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_post_request", "called\n"));
+
+ /*
+ * TODO:511:o: Perform snmpNotifyFilterTable post-request actions.
+ */
+
+ /*
+ * check to set if any rows were changed.
+ */
+ if (snmpNotifyFilterTable_dirty_get()) {
+ /*
+ * check if request was successful. If so, this would be
+ * a good place to save data to its persistent store.
+ */
+ if (MFD_SUCCESS == rc) {
+ /*
+ * save changed rows, if you haven't already
+ */
+ snmp_store(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_APPTYPE));
+ }
+
+ snmpNotifyFilterTable_dirty_set(0); /* clear table dirty flag */
+ }
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterTable_post_request */
+
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table snmpNotifyFilterTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterTable is subid 3 of snmpNotifyObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.6.3.13.1.3, length: 9
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement snmpNotifyFilterTable data context functions.
+ */
+
+
+/**
+ * set mib index(es)
+ *
+ * @param tbl_idx mib index structure
+ * @param snmpNotifyFilterProfileName_val_ptr
+ * @param snmpNotifyFilterProfileName_val_ptr_len
+ * @param snmpNotifyFilterSubtree_val_ptr
+ * @param snmpNotifyFilterSubtree_val_ptr_len
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This convenience function is useful for setting all the MIB index
+ * components with a single function call. It is assume that the C values
+ * have already been mapped from their native/rawformat to the MIB format.
+ */
+int
+snmpNotifyFilterTable_indexes_set_tbl_idx(snmpNotifyFilterTable_mib_index *
+ tbl_idx, char
+ *snmpNotifyFilterProfileName_val_ptr,
+ size_t
+ snmpNotifyFilterProfileName_val_ptr_len,
+ oid *
+ snmpNotifyFilterSubtree_val_ptr,
+ size_t
+ snmpNotifyFilterSubtree_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_indexes_set_tbl_idx", "called\n"));
+
+ /*
+ * snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ tbl_idx->snmpNotifyFilterProfileName_len = sizeof(tbl_idx->snmpNotifyFilterProfileName) / sizeof(tbl_idx->snmpNotifyFilterProfileName[0]); /* max length */
+ /*
+ * make sure there is enough space for snmpNotifyFilterProfileName data
+ */
+ if ((NULL == tbl_idx->snmpNotifyFilterProfileName) ||
+ (tbl_idx->snmpNotifyFilterProfileName_len <
+ (snmpNotifyFilterProfileName_val_ptr_len))) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->snmpNotifyFilterProfileName_len =
+ snmpNotifyFilterProfileName_val_ptr_len;
+ memcpy(tbl_idx->snmpNotifyFilterProfileName,
+ snmpNotifyFilterProfileName_val_ptr,
+ snmpNotifyFilterProfileName_val_ptr_len *
+ sizeof(snmpNotifyFilterProfileName_val_ptr[0]));
+
+ /*
+ * snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
+ */
+ tbl_idx->snmpNotifyFilterSubtree_len = sizeof(tbl_idx->snmpNotifyFilterSubtree) / sizeof(tbl_idx->snmpNotifyFilterSubtree[0]); /* max length */
+ /*
+ * make sure there is enough space for snmpNotifyFilterSubtree data
+ */
+ if ((NULL == tbl_idx->snmpNotifyFilterSubtree) ||
+ (tbl_idx->snmpNotifyFilterSubtree_len <
+ (snmpNotifyFilterSubtree_val_ptr_len))) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->snmpNotifyFilterSubtree_len =
+ snmpNotifyFilterSubtree_val_ptr_len;
+ memcpy(tbl_idx->snmpNotifyFilterSubtree,
+ snmpNotifyFilterSubtree_val_ptr,
+ snmpNotifyFilterSubtree_val_ptr_len *
+ sizeof(snmpNotifyFilterSubtree_val_ptr[0]));
+
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterTable_indexes_set_tbl_idx */
+
+/**
+ * @internal
+ * set row context indexes
+ *
+ * @param rowreq_ctx the row context that needs updated indexes
+ * @param snmpNotifyFilterProfileName_val_ptr
+ * @param snmpNotifyFilterProfileName_val_ptr_len
+ * @param snmpNotifyFilterSubtree_val_ptr
+ * @param snmpNotifyFilterSubtree_val_ptr_len
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This function sets the mib indexs, then updates the oid indexs
+ * from the mib index.
+ */
+int
+snmpNotifyFilterTable_indexes_set(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx, char
+ *snmpNotifyFilterProfileName_val_ptr,
+ size_t
+ snmpNotifyFilterProfileName_val_ptr_len,
+ oid * snmpNotifyFilterSubtree_val_ptr,
+ size_t
+ snmpNotifyFilterSubtree_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_indexes_set", "called\n"));
+
+ if (MFD_SUCCESS !=
+ snmpNotifyFilterTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
+ snmpNotifyFilterProfileName_val_ptr,
+ snmpNotifyFilterProfileName_val_ptr_len,
+ snmpNotifyFilterSubtree_val_ptr,
+ snmpNotifyFilterSubtree_val_ptr_len))
+ return MFD_ERROR;
+
+ /*
+ * convert mib index to oid index
+ */
+ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
+ if (0 != snmpNotifyFilterTable_index_to_oid(&rowreq_ctx->oid_idx,
+ &rowreq_ctx->tbl_idx)) {
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterTable_indexes_set */
+
+
+/*---------------------------------------------------------------------
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterMask
+ * snmpNotifyFilterMask is subid 2 of snmpNotifyFilterEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.6.3.13.1.3.1.2
+ * Description:
+The bit mask which, in combination with the corresponding
+ instance of snmpNotifyFilterSubtree, defines a family of
+ subtrees which are included in or excluded from the
+ filter profile.
+
+ Each bit of this bit mask corresponds to a
+ sub-identifier of snmpNotifyFilterSubtree, with the
+ most significant bit of the i-th octet of this octet
+ string value (extended if necessary, see below)
+ corresponding to the (8*i - 7)-th sub-identifier, and
+ the least significant bit of the i-th octet of this
+ octet string corresponding to the (8*i)-th
+ sub-identifier, where i is in the range 1 through 16.
+
+ Each bit of this bit mask specifies whether or not
+ the corresponding sub-identifiers must match when
+ determining if an OBJECT IDENTIFIER matches this
+ family of filter subtrees; a '1' indicates that an
+ exact match must occur; a '0' indicates 'wild card',
+ i.e., any sub-identifier value matches.
+
+ Thus, the OBJECT IDENTIFIER X of an object instance
+ is contained in a family of filter subtrees if, for
+ each sub-identifier of the value of
+ snmpNotifyFilterSubtree, either:
+
+ the i-th bit of snmpNotifyFilterMask is 0, or
+
+ the i-th sub-identifier of X is equal to the i-th
+ sub-identifier of the value of
+ snmpNotifyFilterSubtree.
+
+ If the value of this bit mask is M bits long and
+ there are more than M sub-identifiers in the
+ corresponding instance of snmpNotifyFilterSubtree,
+ then the bit mask is extended with 1's to be the
+ required length.
+
+ Note that when the value of this object is the
+ zero-length string, this extension rule results in
+ a mask of all-1's being used (i.e., no 'wild card'),
+ and the family of filter subtrees is the one
+ subtree uniquely identified by the corresponding
+ instance of snmpNotifyFilterSubtree.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 1 hashint 0
+ * settable 1
+ * defval: 0
+ *
+ * Ranges: 0 - 16;
+ *
+ * Its syntax is OCTETSTR (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 16)
+ */
+/**
+ * Extract the current value of the snmpNotifyFilterMask data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param snmpNotifyFilterMask_val_ptr_ptr
+ * Pointer to storage for a char variable
+ * @param snmpNotifyFilterMask_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by snmpNotifyFilterMask.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*snmpNotifyFilterMask_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update snmpNotifyFilterMask_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+snmpNotifyFilterMask_get(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,
+ char **snmpNotifyFilterMask_val_ptr_ptr,
+ size_t * snmpNotifyFilterMask_val_ptr_len_ptr)
+{
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert((NULL != snmpNotifyFilterMask_val_ptr_ptr)
+ && (NULL != *snmpNotifyFilterMask_val_ptr_ptr));
+ netsnmp_assert(NULL != snmpNotifyFilterMask_val_ptr_len_ptr);
+
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterMask_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the snmpNotifyFilterMask data.
+ * copy (* snmpNotifyFilterMask_val_ptr_ptr ) data and (* snmpNotifyFilterMask_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ /*
+ * make sure there is enough space for snmpNotifyFilterMask data
+ */
+ if ((NULL == (*snmpNotifyFilterMask_val_ptr_ptr)) ||
+ ((*snmpNotifyFilterMask_val_ptr_len_ptr) <
+ (rowreq_ctx->data.snmpNotifyFilterMask_len *
+ sizeof(rowreq_ctx->data.snmpNotifyFilterMask[0])))) {
+ /*
+ * allocate space for snmpNotifyFilterMask data
+ */
+ (*snmpNotifyFilterMask_val_ptr_ptr) =
+ malloc(rowreq_ctx->data.snmpNotifyFilterMask_len *
+ sizeof(rowreq_ctx->data.snmpNotifyFilterMask[0]));
+ if (NULL == (*snmpNotifyFilterMask_val_ptr_ptr)) {
+ snmp_log(LOG_ERR, "could not allocate memory\n");
+ return MFD_ERROR;
+ }
+ }
+ (*snmpNotifyFilterMask_val_ptr_len_ptr) =
+ rowreq_ctx->data.snmpNotifyFilterMask_len *
+ sizeof(rowreq_ctx->data.snmpNotifyFilterMask[0]);
+ memcpy((*snmpNotifyFilterMask_val_ptr_ptr),
+ rowreq_ctx->data.snmpNotifyFilterMask,
+ rowreq_ctx->data.snmpNotifyFilterMask_len *
+ sizeof(rowreq_ctx->data.snmpNotifyFilterMask[0]));
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterMask_get */
+
+/*---------------------------------------------------------------------
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterType
+ * snmpNotifyFilterType is subid 3 of snmpNotifyFilterEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.6.3.13.1.3.1.3
+ * Description:
+This object indicates whether the family of filter subtrees
+ defined by this entry are included in or excluded from a
+ filter. A more detailed discussion of the use of this
+ object can be found in section 6. of [SNMP-APPL].
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: included
+ *
+ * Enum range: 2/8. Values: included(1), excluded(2)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the snmpNotifyFilterType data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param snmpNotifyFilterType_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+snmpNotifyFilterType_get(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,
+ u_long * snmpNotifyFilterType_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != snmpNotifyFilterType_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterType_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the snmpNotifyFilterType data.
+ * copy (* snmpNotifyFilterType_val_ptr ) from rowreq_ctx->data
+ */
+ (*snmpNotifyFilterType_val_ptr) =
+ rowreq_ctx->data.snmpNotifyFilterType;
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterType_get */
+
+/*---------------------------------------------------------------------
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterStorageType
+ * snmpNotifyFilterStorageType is subid 4 of snmpNotifyFilterEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.6.3.13.1.3.1.4
+ * Description:
+The storage type for this conceptual row.
+ Conceptual rows having the value 'permanent' need not
+
+ allow write-access to any columnar objects in the row.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: nonVolatile
+ *
+ * Enum range: 4/8. Values: other(1), volatile(2), nonVolatile(3), permanent(4), readOnly(5)
+ *
+ * Its syntax is StorageType (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the snmpNotifyFilterStorageType data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param snmpNotifyFilterStorageType_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+snmpNotifyFilterStorageType_get(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ snmpNotifyFilterStorageType_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != snmpNotifyFilterStorageType_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterStorageType_get", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the snmpNotifyFilterStorageType data.
+ * copy (* snmpNotifyFilterStorageType_val_ptr ) from rowreq_ctx->data
+ */
+ (*snmpNotifyFilterStorageType_val_ptr) =
+ rowreq_ctx->data.snmpNotifyFilterStorageType;
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterStorageType_get */
+
+/*---------------------------------------------------------------------
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterRowStatus
+ * snmpNotifyFilterRowStatus is subid 5 of snmpNotifyFilterEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.6.3.13.1.3.1.5
+ * Description:
+The status of this conceptual row.
+
+ To create a row in this table, a manager must
+ set this object to either createAndGo(4) or
+ createAndWait(5).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
+ *
+ * Its syntax is RowStatus (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the snmpNotifyFilterRowStatus data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param snmpNotifyFilterRowStatus_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+snmpNotifyFilterRowStatus_get(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long * snmpNotifyFilterRowStatus_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != snmpNotifyFilterRowStatus_val_ptr);
+
+ (*snmpNotifyFilterRowStatus_val_ptr) =
+ rowreq_ctx->data.snmpNotifyFilterRowStatus;
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterRowStatus_get */
+
+
+
+/** @} */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table snmpNotifyFilterTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterTable is subid 3 of snmpNotifyObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.6.3.13.1.3, length: 9
+ */
+ /*
+ * NOTE: if you update this chart, please update the versions in
+ * local/mib2c-conf.d/parent-set.m2i
+ * agent/mibgroup/helpers/baby_steps.c
+ * while you're at it.
+ */
+ /*
+ ***********************************************************************
+ * Baby Steps Flow Chart (2004.06.05) *
+ * *
+ * +--------------+ +================+ U = unconditional path *
+ * |optional state| ||required state|| S = path for success *
+ * +--------------+ +================+ E = path for error *
+ ***********************************************************************
+ *
+ * +--------------+
+ * | pre |
+ * | request |
+ * +--------------+
+ * | U
+ * +-------------+ +==============+
+ * | row |f|<-------|| object ||
+ * | create |1| E || lookup ||
+ * +-------------+ +==============+
+ * E | | S | S
+ * | +------------------>|
+ * | +==============+
+ * | E || check ||
+ * |<---------------|| values ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | +<-------|| undo ||
+ * | | E || setup ||
+ * | | +==============+
+ * | | | S
+ * | | +==============+
+ * | | || set ||-------------------------->+
+ * | | || value || E |
+ * | | +==============+ |
+ * | | | S |
+ * | | +--------------+ |
+ * | | | check |-------------------------->|
+ * | | | consistency | E |
+ * | | +--------------+ |
+ * | | | S |
+ * | | +==============+ +==============+ |
+ * | | || commit ||-------->|| undo || |
+ * | | || || E || commit || |
+ * | | +==============+ +==============+ |
+ * | | | S U |<--------+
+ * | | +--------------+ +==============+
+ * | | | irreversible | || undo ||
+ * | | | commit | || set ||
+ * | | +--------------+ +==============+
+ * | | | U U |
+ * | +-------------->|<------------------------+
+ * | +==============+
+ * | || undo ||
+ * | || cleanup ||
+ * | +==============+
+ * +---------------------->| U
+ * |
+ * (err && f1)------------------->+
+ * | |
+ * +--------------+ +--------------+
+ * | post |<--------| row |
+ * | request | U | release |
+ * +--------------+ +--------------+
+ *
+ */
+
+/**
+ * Setup up context with information needed to undo a set request.
+ *
+ * This function will be called before the individual node undo setup
+ * functions are called. If you need to do any undo setup that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that the undo context has been allocated with
+ * snmpNotifyFilterTable_allocate_data(), but may need extra
+ * initialization similar to what you may have done in
+ * snmpNotifyFilterTable_rowreq_ctx_init().
+ * Note that an individual node's undo_setup function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in the node's undo_setup
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+snmpNotifyFilterTable_undo_setup(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_undo_setup", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> Setup snmpNotifyFilterTable undo.
+ * set up snmpNotifyFilterTable undo information, in preparation for a set.
+ * Undo storage is in (* snmpNotifyFilterRowStatus_val_ptr )*
+ */
+
+ return rc;
+} /* snmpNotifyFilterTable_undo_setup */
+
+/**
+ * Undo a set request.
+ *
+ * This function will be called before the individual node undo
+ * functions are called. If you need to do any undo that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that an individual node's undo function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is anything specific to a particular column (e.g. releasing
+ * memory for a string), you should do that setup in the node's undo
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+snmpNotifyFilterTable_undo(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_undo",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> snmpNotifyFilterTable undo.
+ * snmpNotifyFilterTable undo information, in response to a failed set.
+ * Undo storage is in (* snmpNotifyFilterRowStatus_val_ptr )*
+ */
+
+ return rc;
+} /* snmpNotifyFilterTable_undo_setup */
+
+/**
+ * Cleanup up context undo information.
+ *
+ * This function will be called after set/commit processing. If you
+ * allocated any resources in undo_setup, this is the place to release
+ * those resources.
+ *
+ * This function is called regardless of the success or failure of the set
+ * request. If you need to perform different steps for cleanup depending
+ * on success or failure, you can add a flag to the rowreq_ctx.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+snmpNotifyFilterTable_undo_cleanup(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_undo_cleanup", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:452:M: |-> Cleanup snmpNotifyFilterTable undo.
+ * Undo storage is in (* snmpNotifyFilterRowStatus_val_ptr )*
+ */
+
+ return rc;
+} /* snmpNotifyFilterTable_undo_cleanup */
+
+/**
+ * commit new values.
+ *
+ * At this point, you should have done everything you can to ensure that
+ * this commit will not fail.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * snmpNotifyFilterTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+snmpNotifyFilterTable_commit(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_commit", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * commit snmpNotifyFilterTable data
+ */
+
+ /*
+ * if we successfully commited this row, set the dirty flag.
+ */
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY;
+
+ return rc;
+} /* snmpNotifyFilterTable_commit */
+
+/**
+ * undo commit new values.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * snmpNotifyFilterTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+snmpNotifyFilterTable_undo_commit(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_undo_commit", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:485:M: |-> Undo snmpNotifyFilterTable commit.
+ * check the column's flag in rowreq_ctx->column_set_flags to see
+ * if it was set during commit, then undo it.
+ *
+ * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
+ */
+
+
+ /*
+ * if we successfully un-commited this row, clear the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return rc;
+} /* snmpNotifyFilterTable_undo_commit */
+
+/*
+ * TODO:440:M: Implement snmpNotifyFilterTable node value checks.
+ * TODO:450:M: Implement snmpNotifyFilterTable undo functions.
+ * TODO:460:M: Implement snmpNotifyFilterTable set functions.
+ * TODO:480:M: Implement snmpNotifyFilterTable commit functions.
+ */
+/*---------------------------------------------------------------------
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterMask
+ * snmpNotifyFilterMask is subid 2 of snmpNotifyFilterEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.6.3.13.1.3.1.2
+ * Description:
+The bit mask which, in combination with the corresponding
+ instance of snmpNotifyFilterSubtree, defines a family of
+ subtrees which are included in or excluded from the
+ filter profile.
+
+ Each bit of this bit mask corresponds to a
+ sub-identifier of snmpNotifyFilterSubtree, with the
+ most significant bit of the i-th octet of this octet
+ string value (extended if necessary, see below)
+ corresponding to the (8*i - 7)-th sub-identifier, and
+ the least significant bit of the i-th octet of this
+ octet string corresponding to the (8*i)-th
+ sub-identifier, where i is in the range 1 through 16.
+
+ Each bit of this bit mask specifies whether or not
+ the corresponding sub-identifiers must match when
+ determining if an OBJECT IDENTIFIER matches this
+ family of filter subtrees; a '1' indicates that an
+ exact match must occur; a '0' indicates 'wild card',
+ i.e., any sub-identifier value matches.
+
+ Thus, the OBJECT IDENTIFIER X of an object instance
+ is contained in a family of filter subtrees if, for
+ each sub-identifier of the value of
+ snmpNotifyFilterSubtree, either:
+
+ the i-th bit of snmpNotifyFilterMask is 0, or
+
+ the i-th sub-identifier of X is equal to the i-th
+ sub-identifier of the value of
+ snmpNotifyFilterSubtree.
+
+ If the value of this bit mask is M bits long and
+ there are more than M sub-identifiers in the
+ corresponding instance of snmpNotifyFilterSubtree,
+ then the bit mask is extended with 1's to be the
+ required length.
+
+ Note that when the value of this object is the
+ zero-length string, this extension rule results in
+ a mask of all-1's being used (i.e., no 'wild card'),
+ and the family of filter subtrees is the one
+ subtree uniquely identified by the corresponding
+ instance of snmpNotifyFilterSubtree.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 1
+ * readable 1 iscolumn 1 ranges 1 hashint 0
+ * settable 1
+ * defval: 0
+ *
+ * Ranges: 0 - 16;
+ *
+ * Its syntax is OCTETSTR (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 16)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param snmpNotifyFilterMask_val_ptr
+ * A char containing the new value.
+ * @param snmpNotifyFilterMask_val_ptr_len
+ * The size (in bytes) of the data pointed to by snmpNotifyFilterMask_val_ptr
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * snmpNotifyFilterTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_OCTET_STR
+ * The length is < sizeof(rowreq_ctx->data.snmpNotifyFilterMask).
+ * The length is in (one of) the range set(s): 0 - 16
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+snmpNotifyFilterMask_check_value(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ char *snmpNotifyFilterMask_val_ptr,
+ size_t snmpNotifyFilterMask_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterMask_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert(NULL != snmpNotifyFilterMask_val_ptr);
+
+ /*
+ * TODO:441:o: |-> Check for valid snmpNotifyFilterMask value.
+ */
+
+ return MFD_SUCCESS; /* snmpNotifyFilterMask value not illegal */
+} /* snmpNotifyFilterMask_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * snmpNotifyFilterTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+snmpNotifyFilterMask_undo_setup(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterMask_undo_setup", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup snmpNotifyFilterMask undo.
+ */
+ /*
+ * copy snmpNotifyFilterMask and snmpNotifyFilterMask_len data
+ * set rowreq_ctx->undo->snmpNotifyFilterMask from rowreq_ctx->data.snmpNotifyFilterMask
+ */
+ memcpy(rowreq_ctx->undo->snmpNotifyFilterMask,
+ rowreq_ctx->data.snmpNotifyFilterMask,
+ (rowreq_ctx->data.snmpNotifyFilterMask_len *
+ sizeof(rowreq_ctx->undo->snmpNotifyFilterMask[0])));
+ rowreq_ctx->undo->snmpNotifyFilterMask_len =
+ rowreq_ctx->data.snmpNotifyFilterMask_len;
+
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterMask_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param snmpNotifyFilterMask_val_ptr
+ * A char containing the new value.
+ * @param snmpNotifyFilterMask_val_ptr_len
+ * The size (in bytes) of the data pointed to by snmpNotifyFilterMask_val_ptr
+ */
+int
+snmpNotifyFilterMask_set(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,
+ char *snmpNotifyFilterMask_val_ptr,
+ size_t snmpNotifyFilterMask_val_ptr_len)
+{
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterMask_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert(NULL != snmpNotifyFilterMask_val_ptr);
+
+ /*
+ * TODO:461:M: |-> Set snmpNotifyFilterMask value.
+ * set snmpNotifyFilterMask value in rowreq_ctx->data
+ */
+ memcpy(rowreq_ctx->data.snmpNotifyFilterMask,
+ snmpNotifyFilterMask_val_ptr, snmpNotifyFilterMask_val_ptr_len);
+ /** convert bytes to number of char */
+ rowreq_ctx->data.snmpNotifyFilterMask_len =
+ snmpNotifyFilterMask_val_ptr_len /
+ sizeof(snmpNotifyFilterMask_val_ptr[0]);
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterMask_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+snmpNotifyFilterMask_undo(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterMask_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up snmpNotifyFilterMask undo.
+ */
+ /*
+ * copy snmpNotifyFilterMask and snmpNotifyFilterMask_len data
+ * set rowreq_ctx->data.snmpNotifyFilterMask from rowreq_ctx->undo->snmpNotifyFilterMask
+ */
+ memcpy(rowreq_ctx->data.snmpNotifyFilterMask,
+ rowreq_ctx->undo->snmpNotifyFilterMask,
+ (rowreq_ctx->undo->snmpNotifyFilterMask_len *
+ sizeof(rowreq_ctx->data.snmpNotifyFilterMask[0])));
+ rowreq_ctx->data.snmpNotifyFilterMask_len =
+ rowreq_ctx->undo->snmpNotifyFilterMask_len;
+
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterMask_undo */
+
+/*---------------------------------------------------------------------
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterType
+ * snmpNotifyFilterType is subid 3 of snmpNotifyFilterEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.6.3.13.1.3.1.3
+ * Description:
+This object indicates whether the family of filter subtrees
+ defined by this entry are included in or excluded from a
+ filter. A more detailed discussion of the use of this
+ object can be found in section 6. of [SNMP-APPL].
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: included
+ *
+ * Enum range: 2/8. Values: included(1), excluded(2)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param snmpNotifyFilterType_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * snmpNotifyFilterTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of included(1), excluded(2)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+snmpNotifyFilterType_check_value(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long snmpNotifyFilterType_val)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterType_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid snmpNotifyFilterType value.
+ */
+
+ return MFD_SUCCESS; /* snmpNotifyFilterType value not illegal */
+} /* snmpNotifyFilterType_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * snmpNotifyFilterTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+snmpNotifyFilterType_undo_setup(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterType_undo_setup", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup snmpNotifyFilterType undo.
+ */
+ /*
+ * copy snmpNotifyFilterType data
+ * set rowreq_ctx->undo->snmpNotifyFilterType from rowreq_ctx->data.snmpNotifyFilterType
+ */
+ rowreq_ctx->undo->snmpNotifyFilterType =
+ rowreq_ctx->data.snmpNotifyFilterType;
+
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterType_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param snmpNotifyFilterType_val
+ * A long containing the new value.
+ */
+int
+snmpNotifyFilterType_set(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,
+ u_long snmpNotifyFilterType_val)
+{
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterType_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set snmpNotifyFilterType value.
+ * set snmpNotifyFilterType value in rowreq_ctx->data
+ */
+ rowreq_ctx->data.snmpNotifyFilterType = snmpNotifyFilterType_val;
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterType_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+snmpNotifyFilterType_undo(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterType_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up snmpNotifyFilterType undo.
+ */
+ /*
+ * copy snmpNotifyFilterType data
+ * set rowreq_ctx->data.snmpNotifyFilterType from rowreq_ctx->undo->snmpNotifyFilterType
+ */
+ rowreq_ctx->data.snmpNotifyFilterType =
+ rowreq_ctx->undo->snmpNotifyFilterType;
+
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterType_undo */
+
+/*---------------------------------------------------------------------
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterStorageType
+ * snmpNotifyFilterStorageType is subid 4 of snmpNotifyFilterEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.6.3.13.1.3.1.4
+ * Description:
+The storage type for this conceptual row.
+ Conceptual rows having the value 'permanent' need not
+
+ allow write-access to any columnar objects in the row.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 1
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ * defval: nonVolatile
+ *
+ * Enum range: 4/8. Values: other(1), volatile(2), nonVolatile(3), permanent(4), readOnly(5)
+ *
+ * Its syntax is StorageType (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param snmpNotifyFilterStorageType_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * snmpNotifyFilterTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of other(1), volatile(2), nonVolatile(3), permanent(4), readOnly(5)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+snmpNotifyFilterStorageType_check_value(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ snmpNotifyFilterStorageType_val)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterStorageType_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid snmpNotifyFilterStorageType value.
+ */
+
+ return MFD_SUCCESS; /* snmpNotifyFilterStorageType value not illegal */
+} /* snmpNotifyFilterStorageType_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * snmpNotifyFilterTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+snmpNotifyFilterStorageType_undo_setup(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterStorageType_undo_setup", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup snmpNotifyFilterStorageType undo.
+ */
+ /*
+ * copy snmpNotifyFilterStorageType data
+ * set rowreq_ctx->undo->snmpNotifyFilterStorageType from rowreq_ctx->data.snmpNotifyFilterStorageType
+ */
+ rowreq_ctx->undo->snmpNotifyFilterStorageType =
+ rowreq_ctx->data.snmpNotifyFilterStorageType;
+
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterStorageType_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param snmpNotifyFilterStorageType_val
+ * A long containing the new value.
+ */
+int
+snmpNotifyFilterStorageType_set(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long snmpNotifyFilterStorageType_val)
+{
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterStorageType_set", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set snmpNotifyFilterStorageType value.
+ * set snmpNotifyFilterStorageType value in rowreq_ctx->data
+ */
+ rowreq_ctx->data.snmpNotifyFilterStorageType =
+ snmpNotifyFilterStorageType_val;
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterStorageType_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+snmpNotifyFilterStorageType_undo(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterStorageType_undo", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up snmpNotifyFilterStorageType undo.
+ */
+ /*
+ * copy snmpNotifyFilterStorageType data
+ * set rowreq_ctx->data.snmpNotifyFilterStorageType from rowreq_ctx->undo->snmpNotifyFilterStorageType
+ */
+ rowreq_ctx->data.snmpNotifyFilterStorageType =
+ rowreq_ctx->undo->snmpNotifyFilterStorageType;
+
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterStorageType_undo */
+
+/*---------------------------------------------------------------------
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterRowStatus
+ * snmpNotifyFilterRowStatus is subid 5 of snmpNotifyFilterEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.6.3.13.1.3.1.5
+ * Description:
+The status of this conceptual row.
+
+ To create a row in this table, a manager must
+ set this object to either createAndGo(4) or
+ createAndWait(5).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 3/8. Values: active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
+ *
+ * Its syntax is RowStatus (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param snmpNotifyFilterRowStatus_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * snmpNotifyFilterTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of active(1), notInService(2), notReady(3), createAndGo(4), createAndWait(5), destroy(6)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+snmpNotifyFilterRowStatus_check_value(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long snmpNotifyFilterRowStatus_val)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterRowStatus_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid snmpNotifyFilterRowStatus value.
+ */
+
+ return MFD_SUCCESS; /* snmpNotifyFilterRowStatus value not illegal */
+} /* snmpNotifyFilterRowStatus_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (snmpNotifyFilterTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * snmpNotifyFilterTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+snmpNotifyFilterRowStatus_undo_setup(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterRowStatus_undo_setup", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup snmpNotifyFilterRowStatus undo.
+ */
+ /*
+ * copy snmpNotifyFilterRowStatus data
+ * set rowreq_ctx->undo->snmpNotifyFilterRowStatus from rowreq_ctx->data.snmpNotifyFilterRowStatus
+ */
+ rowreq_ctx->undo->snmpNotifyFilterRowStatus =
+ rowreq_ctx->data.snmpNotifyFilterRowStatus;
+
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterRowStatus_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param snmpNotifyFilterRowStatus_val
+ * A long containing the new value.
+ */
+int
+snmpNotifyFilterRowStatus_set(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long snmpNotifyFilterRowStatus_val)
+{
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterRowStatus_set", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set snmpNotifyFilterRowStatus value.
+ * set snmpNotifyFilterRowStatus value in rowreq_ctx->data
+ */
+ rowreq_ctx->data.snmpNotifyFilterRowStatus =
+ snmpNotifyFilterRowStatus_val;
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterRowStatus_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+snmpNotifyFilterRowStatus_undo(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterRowStatus_undo", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up snmpNotifyFilterRowStatus undo.
+ */
+ /*
+ * copy snmpNotifyFilterRowStatus data
+ * set rowreq_ctx->data.snmpNotifyFilterRowStatus from rowreq_ctx->undo->snmpNotifyFilterRowStatus
+ */
+ rowreq_ctx->data.snmpNotifyFilterRowStatus =
+ rowreq_ctx->undo->snmpNotifyFilterRowStatus;
+
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterRowStatus_undo */
+
+/**
+ * check dependencies
+ *
+ * This is useful for for tables which have dependencies between columns
+ * (or rows, or tables). For example, two columns allocating a percentage
+ * of something add up 100%.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * snmpNotifyFilterTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @retval MFD_SUCCESS all the changes to the row are legal
+ * @retval MFD_ERROR one or more changes are not legal
+ *
+ * (see README-table-snmpNotifyFilterTable if you don't have dependencies)
+ */
+int
+snmpNotifyFilterTable_check_dependencies(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:snmpNotifyFilterTable_check_dependencies", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:470:o: Check snmpNotifyFilterTable row dependencies.
+ * check that all new value are legal and consistent with each other
+ */
+ /*
+ * check for valid StorageType transition (old, new)
+ */
+ rc = check_storage_transition(rowreq_ctx->undo->
+ snmpNotifyFilterStorageType,
+ rowreq_ctx->data.
+ snmpNotifyFilterStorageType);
+ if (MFD_SUCCESS != rc)
+ return rc;
+
+ /*
+ * check RowStatus dependencies
+ */
+ if (rowreq_ctx->
+ column_set_flags & COLUMN_SNMPNOTIFYFILTERROWSTATUS_FLAG) {
+ /*
+ * check for valid RowStatus transition (old, new)
+ * (Note: move transition check to
+ * to catch errors earlier)
+ */
+ rc = check_rowstatus_transition(rowreq_ctx->undo->
+ snmpNotifyFilterRowStatus,
+ rowreq_ctx->data.
+ snmpNotifyFilterRowStatus);
+ if (MFD_SUCCESS != rc)
+ return rc;
+
+ /*
+ * row creation requirements
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ if (ROWSTATUS_DESTROY ==
+ rowreq_ctx->data.snmpNotifyFilterRowStatus) {
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED;
+ } else if (ROWSTATUS_CREATEANDGO ==
+ rowreq_ctx->data.snmpNotifyFilterRowStatus) {
+ if ((rowreq_ctx->
+ column_set_flags &
+ SNMPNOTIFYFILTERTABLE_REQUIRED_COLS)
+ != SNMPNOTIFYFILTERTABLE_REQUIRED_COLS) {
+ DEBUGMSGTL(("snmpNotifyFilterTable",
+ "required columns missing (0x%0x != 0x%0x)\n",
+ rowreq_ctx->column_set_flags,
+ SNMPNOTIFYFILTERTABLE_REQUIRED_COLS));
+ return MFD_CANNOT_CREATE_NOW;
+ }
+ rowreq_ctx->data.snmpNotifyFilterRowStatus =
+ ROWSTATUS_ACTIVE;
+ }
+ } /* row creation */
+ else {
+ /*
+ * row change requirements
+ */
+ /*
+ * don't allow a destroy if any other value was changed, since
+ * that might call data access routines with bad info.
+ *
+ * you may or may not require the row be notInService before it
+ * can be destroyed.
+ */
+ if (ROWSTATUS_DESTROY ==
+ rowreq_ctx->data.snmpNotifyFilterRowStatus) {
+ if (rowreq_ctx->
+ column_set_flags &
+ ~COLUMN_SNMPNOTIFYFILTERROWSTATUS_FLAG) {
+ DEBUGMSGTL(("snmpNotifyFilterTable",
+ "destroy must be only varbind for row\n"));
+ return MFD_NOT_VALID_NOW;
+ }
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED;
+
+ } /* row destroy */
+ } /* row change */
+ } else {
+ /*
+ * must have row status to create a row
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ DEBUGMSGTL(("snmpNotifyFilterTable",
+ "must use RowStatus to create rows\n"));
+ return MFD_CANNOT_CREATE_NOW;
+ }
+ } /* row status not set */
+
+ if (MFD_SUCCESS != rc)
+ return rc;
+
+ return rc;
+} /* snmpNotifyFilterTable_check_dependencies */
+
+/** @} */
+/** @{ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.h
new file mode 100644
index 0000000000..e940769f2e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable.h
@@ -0,0 +1,933 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: snmpNotifyFilterTable.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+#ifndef SNMPNOTIFYFILTERTABLE_H
+#define SNMPNOTIFYFILTERTABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @addtogroup misc misc: Miscellaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+
+ /*
+ * other required module components
+ */
+ /* *INDENT-OFF* */
+config_require(snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface)
+config_require(snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access)
+ /* *INDENT-ON* */
+
+ /*
+ * OID, column number and enum definions for snmpNotifyFilterTable
+ */
+#include "snmpNotifyFilterTable_constants.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_snmpNotifyFilterTable(void);
+ void shutdown_snmpNotifyFilterTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table snmpNotifyFilterTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterTable is subid 3 of snmpNotifyObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.6.3.13.1.3, length: 9
+ */
+ /*
+ *********************************************************************
+ * When you register your mib, you get to provide a generic
+ * pointer that will be passed back to you for most of the
+ * functions calls.
+ *
+ * TODO:100:r: Review all context structures
+ */
+ /*
+ * TODO:101:o: |-> Review snmpNotifyFilterTable registration context.
+ */
+ typedef netsnmp_data_list snmpNotifyFilterTable_registration;
+
+/**********************************************************************/
+ /*
+ * TODO:110:r: |-> Review snmpNotifyFilterTable data context structure.
+ * This structure is used to represent the data for snmpNotifyFilterTable.
+ */
+ /*
+ * This structure contains storage for all the columns defined in the
+ * snmpNotifyFilterTable.
+ */
+ typedef struct snmpNotifyFilterTable_data_s {
+
+ /*
+ * snmpNotifyFilterMask(2)/OCTETSTR/ASN_OCTET_STR/char(char)//L/A/W/e/R/D/h
+ */
+ char snmpNotifyFilterMask[16];
+ size_t snmpNotifyFilterMask_len; /* # of char elements, not bytes */
+
+ /*
+ * snmpNotifyFilterType(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ u_long snmpNotifyFilterType;
+
+ /*
+ * snmpNotifyFilterStorageType(4)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ u_long snmpNotifyFilterStorageType;
+
+ /*
+ * snmpNotifyFilterRowStatus(5)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ u_long snmpNotifyFilterRowStatus;
+
+ } snmpNotifyFilterTable_data;
+
+
+ /*
+ *********************************************************************
+ * TODO:115:o: |-> Review snmpNotifyFilterTable undo context.
+ * We're just going to use the same data structure for our
+ * undo_context. If you want to do something more efficent,
+ * define your typedef here.
+ */
+ typedef snmpNotifyFilterTable_data snmpNotifyFilterTable_undo_data;
+
+ /*
+ * TODO:120:r: |-> Review snmpNotifyFilterTable mib index.
+ * This structure is used to represent the index for snmpNotifyFilterTable.
+ */
+ typedef struct snmpNotifyFilterTable_mib_index_s {
+
+ /*
+ * snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ char snmpNotifyFilterProfileName[32];
+ size_t snmpNotifyFilterProfileName_len;
+
+ /*
+ * snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
+ */
+ /** 128 - 1(other indexes) - oid length(11) = 115 */
+ oid snmpNotifyFilterSubtree[115];
+ size_t snmpNotifyFilterSubtree_len;
+
+
+ } snmpNotifyFilterTable_mib_index;
+
+ /*
+ * TODO:121:r: | |-> Review snmpNotifyFilterTable max index length.
+ * If you KNOW that your indexes will never exceed a certain
+ * length, update this macro to that length.
+ *
+ * BE VERY CAREFUL TO TAKE INTO ACCOUNT THE MAXIMUM
+ * POSSIBLE LENGHT FOR EVERY VARIABLE LENGTH INDEX!
+ * Guessing 128 - col/entry(2) - oid len(9)
+ */
+#define MAX_snmpNotifyFilterTable_IDX_LEN 117
+
+
+ /*
+ *********************************************************************
+ * TODO:130:o: |-> Review snmpNotifyFilterTable Row request (rowreq) context.
+ * When your functions are called, you will be passed a
+ * snmpNotifyFilterTable_rowreq_ctx pointer.
+ */
+ typedef struct snmpNotifyFilterTable_rowreq_ctx_s {
+
+ /** this must be first for container compare to work */
+ netsnmp_index oid_idx;
+ oid oid_tmp[MAX_snmpNotifyFilterTable_IDX_LEN];
+
+ snmpNotifyFilterTable_mib_index tbl_idx;
+
+ snmpNotifyFilterTable_data data;
+ snmpNotifyFilterTable_undo_data *undo;
+ unsigned int column_set_flags; /* flags for set columns */
+
+
+ /*
+ * flags per row. Currently, the first (lower) 8 bits are reserved
+ * for the user. See mfd.h for other flags.
+ */
+ u_int rowreq_flags;
+
+ /*
+ * TODO:131:o: | |-> Add useful data to snmpNotifyFilterTable rowreq context.
+ */
+
+ /*
+ * storage for future expansion
+ */
+ netsnmp_data_list *snmpNotifyFilterTable_data_list;
+
+ } snmpNotifyFilterTable_rowreq_ctx;
+
+ typedef struct snmpNotifyFilterTable_ref_rowreq_ctx_s {
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx;
+ } snmpNotifyFilterTable_ref_rowreq_ctx;
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_pre_request
+ (snmpNotifyFilterTable_registration * user_context);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_post_request
+ (snmpNotifyFilterTable_registration * user_context, int rc);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_rowreq_ctx_init
+ (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,
+ void *user_init_ctx);
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_rowreq_ctx_cleanup
+ (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_check_dependencies
+ (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_commit(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_rowreq_ctx
+ * snmpNotifyFilterTable_row_find_by_mib_index
+ (snmpNotifyFilterTable_mib_index * mib_idx);
+
+ extern oid snmpNotifyFilterTable_oid[];
+ extern int snmpNotifyFilterTable_oid_size;
+
+
+#include "snmpNotifyFilterTable_interface.h"
+#include "snmpNotifyFilterTable_data_access.h"
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table snmpNotifyFilterTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterTable is subid 3 of snmpNotifyObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.6.3.13.1.3, length: 9
+ */
+ /*
+ * indexes
+ */
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterMask_get(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ char **snmpNotifyFilterMask_val_ptr_ptr,
+ size_t
+ * snmpNotifyFilterMask_val_ptr_len_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterType_get(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long * snmpNotifyFilterType_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterStorageType_get(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ snmpNotifyFilterStorageType_val_ptr);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterRowStatus_get(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ snmpNotifyFilterRowStatus_val_ptr);
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_indexes_set_tbl_idx
+ (snmpNotifyFilterTable_mib_index * tbl_idx,
+ char *snmpNotifyFilterProfileName_val_ptr,
+ size_t snmpNotifyFilterProfileName_val_ptr_len,
+ oid * snmpNotifyFilterSubtree_val_ptr,
+ size_t snmpNotifyFilterSubtree_val_ptr_len);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_indexes_set(snmpNotifyFilterTable_rowreq_ctx
+ * rowreq_ctx, char
+ *snmpNotifyFilterProfileName_val_ptr,
+ size_t
+ snmpNotifyFilterProfileName_val_ptr_len,
+ oid *
+ snmpNotifyFilterSubtree_val_ptr,
+ size_t
+ snmpNotifyFilterSubtree_val_ptr_len);
+
+
+
+ /*
+ *********************************************************************
+ * SET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * SET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table snmpNotifyFilterTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterTable is subid 3 of snmpNotifyObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.6.3.13.1.3, length: 9
+ */
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_undo_setup(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_undo_cleanup(snmpNotifyFilterTable_rowreq_ctx
+ * rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_undo(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_commit(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_undo_commit(snmpNotifyFilterTable_rowreq_ctx
+ * rowreq_ctx);
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterMask_check_value(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx, char
+ *snmpNotifyFilterMask_val_ptr,
+ size_t
+ snmpNotifyFilterMask_val_ptr_len);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterMask_undo_setup(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterMask_set(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ char *snmpNotifyFilterMask_val_ptr,
+ size_t snmpNotifyFilterMask_val_ptr_len);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterMask_undo(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterType_check_value(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long snmpNotifyFilterType_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterType_undo_setup(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterType_set(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long snmpNotifyFilterType_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterType_undo(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterStorageType_check_value
+ (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,
+ u_long snmpNotifyFilterStorageType_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterStorageType_undo_setup
+ (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterStorageType_set(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ snmpNotifyFilterStorageType_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterStorageType_undo(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterRowStatus_check_value
+ (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,
+ u_long snmpNotifyFilterRowStatus_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterRowStatus_undo_setup
+ (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterRowStatus_set(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ snmpNotifyFilterRowStatus_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterRowStatus_undo(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_check_dependencies
+ (snmpNotifyFilterTable_rowreq_ctx * ctx);
+
+
+ /*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* SNMPNOTIFYFILTERTABLE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_constants.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_constants.h
new file mode 100644
index 0000000000..9fb8e5a7f2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_constants.h
@@ -0,0 +1,131 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $
+ *
+ * $Id: snmpNotifyFilterTable_constants.h 13772 2005-12-01 21:06:00Z rstory $
+ */
+#ifndef SNMPNOTIFYFILTERTABLE_CONSTANTS_H
+#define SNMPNOTIFYFILTERTABLE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ * column number definitions for table snmpNotifyFilterTable
+ */
+#define SNMPNOTIFYFILTERTABLE_OID 1,3,6,1,6,3,13,1,3
+
+#define COLUMN_SNMPNOTIFYFILTERSUBTREE 1
+
+#define COLUMN_SNMPNOTIFYFILTERMASK 2
+#define COLUMN_SNMPNOTIFYFILTERMASK_FLAG (0x1 << 1)
+
+#define COLUMN_SNMPNOTIFYFILTERTYPE 3
+#define COLUMN_SNMPNOTIFYFILTERTYPE_FLAG (0x1 << 2)
+
+#define COLUMN_SNMPNOTIFYFILTERSTORAGETYPE 4
+#define COLUMN_SNMPNOTIFYFILTERSTORAGETYPE_FLAG (0x1 << 3)
+
+#define COLUMN_SNMPNOTIFYFILTERROWSTATUS 5
+#define COLUMN_SNMPNOTIFYFILTERROWSTATUS_FLAG (0x1 << 4)
+
+
+#define SNMPNOTIFYFILTERTABLE_MIN_COL COLUMN_SNMPNOTIFYFILTERMASK
+#define SNMPNOTIFYFILTERTABLE_MAX_COL COLUMN_SNMPNOTIFYFILTERROWSTATUS
+
+
+ /*
+ * TODO:405:r: Review SNMPNOTIFYFILTERTABLE_SETTABLE_COLS macro.
+ * OR together all the writable cols.
+ */
+#define SNMPNOTIFYFILTERTABLE_SETTABLE_COLS (COLUMN_SNMPNOTIFYFILTERMASK_FLAG | COLUMN_SNMPNOTIFYFILTERTYPE_FLAG | COLUMN_SNMPNOTIFYFILTERSTORAGETYPE_FLAG | COLUMN_SNMPNOTIFYFILTERROWSTATUS_FLAG)
+ /*
+ * TODO:405:r: Review SNMPNOTIFYFILTERTABLE_REQUIRED_COLS macro.
+ * OR together all the required rows for row creation.
+ * default is writable cols w/out defaults.
+ */
+#define SNMPNOTIFYFILTERTABLE_REQUIRED_COLS (COLUMN_SNMPNOTIFYFILTERROWSTATUS_FLAG)
+
+ /*
+ * NOTES on enums
+ * ==============
+ *
+ * Value Mapping
+ * -------------
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them
+ * below. For example, a boolean flag (1/0) is usually represented
+ * as a TruthValue in a MIB, which maps to the values (1/2).
+ *
+ */
+/*************************************************************************
+ *************************************************************************
+ *
+ * enum definitions for table snmpNotifyFilterTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * snmpNotifyFilterType (INTEGER / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef SNMPNOTIFYFILTERTYPE_ENUMS
+#define SNMPNOTIFYFILTERTYPE_ENUMS
+
+#define SNMPNOTIFYFILTERTYPE_INCLUDED 1
+#define SNMPNOTIFYFILTERTYPE_EXCLUDED 2
+
+#endif /* SNMPNOTIFYFILTERTYPE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * snmpNotifyFilterStorageType (StorageType / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef STORAGETYPE_ENUMS
+#define STORAGETYPE_ENUMS
+
+#define STORAGETYPE_OTHER 1
+#define STORAGETYPE_VOLATILE 2
+#define STORAGETYPE_NONVOLATILE 3
+#define STORAGETYPE_PERMANENT 4
+#define STORAGETYPE_READONLY 5
+
+#endif /* STORAGETYPE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * snmpNotifyFilterRowStatus (RowStatus / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef ROWSTATUS_ENUMS
+#define ROWSTATUS_ENUMS
+
+#define ROWSTATUS_ACTIVE 1
+#define ROWSTATUS_NOTINSERVICE 2
+#define ROWSTATUS_NOTREADY 3
+#define ROWSTATUS_CREATEANDGO 4
+#define ROWSTATUS_CREATEANDWAIT 5
+#define ROWSTATUS_DESTROY 6
+
+#endif /* ROWSTATUS_ENUMS */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* SNMPNOTIFYFILTERTABLE_OIDS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.c
new file mode 100644
index 0000000000..07ad36c95e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.c
@@ -0,0 +1,587 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: snmpNotifyFilterTable_data_access.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/library/vacm.h>
+
+/*
+ * include our parent header
+ */
+#include "snmpNotifyFilterTable.h"
+
+
+#include "snmpNotifyFilterTable_data_access.h"
+
+/** @ingroup interface
+ * @addtogroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table snmpNotifyFilterTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterTable is subid 3 of snmpNotifyObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.6.3.13.1.3, length: 9
+ */
+
+/**
+ * initialization for snmpNotifyFilterTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param snmpNotifyFilterTable_reg
+ * Pointer to snmpNotifyFilterTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+snmpNotifyFilterTable_init_data(snmpNotifyFilterTable_registration *
+ snmpNotifyFilterTable_reg)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_init_data", "called\n"));
+
+ /*
+ * TODO:303:o: Initialize snmpNotifyFilterTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterTable_init_data */
+
+/**
+ * container overview
+ *
+ */
+
+/**
+ * container initialization
+ *
+ * @param container_ptr_ptr A pointer to a container pointer. If you
+ * create a custom container, use this parameter to return it
+ * to the MFD helper. If set to NULL, the MFD helper will
+ * allocate a container for you.
+ *
+ * This function is called at startup to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases. If no custom
+ * container is allocated, the MFD code will create one for your.
+ *
+ * @remark
+ * This would also be a good place to do any initialization needed
+ * for you data source. For example, opening a connection to another
+ * process that will supply the data, opening a database, etc.
+ */
+void
+snmpNotifyFilterTable_container_init(netsnmp_container **container_ptr_ptr)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_container_init", "called\n"));
+
+ if (NULL == container_ptr_ptr) {
+ snmp_log(LOG_ERR,
+ "bad container param to snmpNotifyFilterTable_container_init\n");
+ return;
+ }
+
+ /*
+ * For advanced users, you can use a custom container. If you
+ * do not create one, one will be created for you.
+ */
+ *container_ptr_ptr = NULL;
+
+} /* snmpNotifyFilterTable_container_init */
+
+/**
+ * container shutdown
+ *
+ * @param container_ptr A pointer to the container.
+ *
+ * This function is called at shutdown to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases.
+ *
+ * This function is called before snmpNotifyFilterTable_container_free().
+ *
+ * @remark
+ * This would also be a good place to do any cleanup needed
+ * for you data source. For example, closing a connection to another
+ * process that supplied the data, closing a database, etc.
+ */
+void
+snmpNotifyFilterTable_container_shutdown(netsnmp_container *container_ptr)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_container_shutdown", "called\n"));
+
+ if (NULL == container_ptr) {
+ snmp_log(LOG_ERR,
+ "bad params to snmpNotifyFilterTable_container_shutdown\n");
+ return;
+ }
+
+} /* snmpNotifyFilterTable_container_shutdown */
+
+/**
+ * load initial data
+ *
+ * TODO:350:M: Implement snmpNotifyFilterTable data load
+ *
+ * @param container container to which items should be inserted
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
+ * @retval MFD_ERROR : other error.
+ *
+ * This function is called to load the index(es) (and data, optionally)
+ * for the every row in the data set.
+ *
+ * @remark
+ * While loading the data, the only important thing is the indexes.
+ * If access to your data is cheap/fast (e.g. you have a pointer to a
+ * structure in memory), it would make sense to update the data here.
+ * If, however, the accessing the data invovles more work (e.g. parsing
+ * some other existing data, or peforming calculations to derive the data),
+ * then you can limit yourself to setting the indexes and saving any
+ * information you will need later. Then use the saved information in
+ * snmpNotifyFilterTable_row_prep() for populating data.
+ *
+ * @note
+ * If you need consistency between rows (like you want statistics
+ * for each row to be from the same time frame), you should set all
+ * data here.
+ *
+ */
+int
+snmpNotifyFilterTable_container_load(netsnmp_container *container)
+{
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx;
+ size_t count = 0;
+
+ /*
+ * temporary storage for index values
+ */
+ /*
+ * snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ char snmpNotifyFilterProfileName[32];
+ size_t snmpNotifyFilterProfileName_len;
+ /*
+ * snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
+ */
+ /** 128 - 1(entry) - 1(col) - 1(other indexes) = 114 */
+ oid snmpNotifyFilterSubtree[114];
+ size_t snmpNotifyFilterSubtree_len;
+
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_container_load", "called\n"));
+
+ /*
+ * TODO:351:M: |-> Load/update data in the snmpNotifyFilterTable container.
+ * loop over your snmpNotifyFilterTable data, allocate a rowreq context,
+ * set the index(es) [and data, optionally] and insert into
+ * the container.
+ */
+ while (1) {
+ /*
+ * check for end of data; bail out if there is no more data
+ */
+ if (1)
+ break;
+
+ /*
+ * TODO:352:M: | |-> set indexes in new snmpNotifyFilterTable rowreq context.
+ * data context will be set from the param (unless NULL,
+ * in which case a new data context will be allocated)
+ */
+ rowreq_ctx = snmpNotifyFilterTable_allocate_rowreq_ctx(NULL);
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "memory allocation failed\n");
+ return MFD_RESOURCE_UNAVAILABLE;
+ }
+ if (MFD_SUCCESS !=
+ snmpNotifyFilterTable_indexes_set(rowreq_ctx,
+ snmpNotifyFilterProfileName,
+ snmpNotifyFilterProfileName_len,
+ snmpNotifyFilterSubtree,
+ snmpNotifyFilterSubtree_len))
+ {
+ snmp_log(LOG_ERR,
+ "error setting index while loading "
+ "snmpNotifyFilterTable data.\n");
+ snmpNotifyFilterTable_release_rowreq_ctx(rowreq_ctx);
+ continue;
+ }
+
+ /*
+ * TODO:352:r: | |-> populate snmpNotifyFilterTable data context.
+ * Populate data context here. (optionally, delay until row prep)
+ */
+ /*
+ * non-TRANSIENT data: no need to copy. set pointer to data
+ */
+
+ /*
+ * insert into table container
+ */
+ CONTAINER_INSERT(container, rowreq_ctx);
+ ++count;
+ }
+
+ DEBUGMSGT(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_container_load", "inserted %d records\n", count));
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterTable_container_load */
+
+/**
+ * container clean up
+ *
+ * @param container container with all current items
+ *
+ * This optional callback is called prior to all
+ * item's being removed from the container. If you
+ * need to do any processing before that, do it here.
+ *
+ * @note
+ * The MFD helper will take care of releasing all the row contexts.
+ *
+ */
+void
+snmpNotifyFilterTable_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_container_free", "called\n"));
+
+ /*
+ * TODO:380:M: Free snmpNotifyFilterTable container data.
+ */
+} /* snmpNotifyFilterTable_container_free */
+
+/**
+ * prepare row for processing.
+ *
+ * When the agent has located the row for a request, this function is
+ * called to prepare the row for processing. If you fully populated
+ * the data context during the index setup phase, you may not need to
+ * do anything.
+ *
+ * @param rowreq_ctx pointer to a context.
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ */
+int
+snmpNotifyFilterTable_row_prep(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_row_prep", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+
+ return MFD_SUCCESS;
+} /* snmpNotifyFilterTable_row_prep */
+
+/*
+ * TODO:420:r: Implement snmpNotifyFilterTable index validation.
+ */
+/*---------------------------------------------------------------------
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterProfileEntry.snmpNotifyFilterProfileName
+ * snmpNotifyFilterProfileName is subid 1 of snmpNotifyFilterProfileEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.6.3.13.1.2.1.1
+ * Description:
+The name of the filter profile to be used when generating
+ notifications using the corresponding entry in the
+ snmpTargetAddrTable.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 1 hashint 1
+ * settable 1
+ * hint: 255t
+ *
+ * Ranges: 1 - 32;
+ *
+ * Its syntax is SnmpAdminString (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length. (Max 32)
+ */
+/**
+ * check validity of snmpNotifyFilterProfileName external index portion
+ *
+ * NOTE: this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * snmpNotifyFilterTable_validate_index() function.
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ */
+int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_snmpNotifyFilterProfileName_check_index
+ (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx) {
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_snmpNotifyFilterProfileName_check_index", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:424:M: |-> Check snmpNotifyFilterTable external index snmpNotifyFilterProfileName.
+ * check that index value in the table context (rowreq_ctx)
+ * for the external index snmpNotifyFilterProfileName is legal.
+ */
+
+ return MFD_SUCCESS; /* external index snmpNotifyFilterProfileName ok */
+} /* snmpNotifyFilterTable_snmpNotifyFilterProfileName_check_index */
+
+/*---------------------------------------------------------------------
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterEntry.snmpNotifyFilterSubtree
+ * snmpNotifyFilterSubtree is subid 1 of snmpNotifyFilterEntry.
+ * Its status is Current, and its access level is NoAccess.
+ * OID: .1.3.6.1.6.3.13.1.3.1.1
+ * Description:
+The MIB subtree which, when combined with the corresponding
+ instance of snmpNotifyFilterMask, defines a family of
+ subtrees which are included in or excluded from the
+ filter profile.
+ *
+ * Attributes:
+ * accessible 0 isscalar 0 enums 0 hasdefval 0
+ * readable 0 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is OBJECTID (based on perltype OBJECTID)
+ * The net-snmp type is ASN_OBJECT_ID. The C type decl is oid (oid)
+ * This data type requires a length.
+ *
+ *
+ *
+ * NOTE: NODE snmpNotifyFilterSubtree IS NOT ACCESSIBLE
+ *
+ *
+ */
+/**
+ * check validity of snmpNotifyFilterSubtree index portion
+ *
+ * @retval MFD_SUCCESS : the incoming value is legal
+ * @retval MFD_ERROR : the incoming value is NOT legal
+ *
+ * @note this is not the place to do any checks for the sanity
+ * of multiple indexes. Those types of checks should be done in the
+ * snmpNotifyFilterTable_validate_index() function.
+ *
+ * @note Also keep in mind that if the index refers to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ * The following checks have already been done for you:
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ */
+int
+snmpNotifyFilterSubtree_check_index(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterSubtree_check_index", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:426:M: |-> Check snmpNotifyFilterTable index snmpNotifyFilterSubtree.
+ * check that index value in the table context is legal.
+ * (rowreq_ctx->tbl_index.snmpNotifyFilterSubtree)
+ */
+
+ return MFD_SUCCESS; /* snmpNotifyFilterSubtree index ok */
+} /* snmpNotifyFilterSubtree_check_index */
+
+/**
+ * verify specified index is valid.
+ *
+ * This check is independent of whether or not the values specified for
+ * the columns of the new row are valid. Column values and row consistency
+ * will be checked later. At this point, only the index values should be
+ * checked.
+ *
+ * All of the individual index validation functions have been called, so this
+ * is the place to make sure they are valid as a whole when combined. If
+ * you only have one index, then you probably don't need to do anything else
+ * here.
+ *
+ * @note Keep in mind that if the indexes refer to a row in this or
+ * some other table, you can't check for that row here to make
+ * decisions, since that row might not be created yet, but may
+ * be created during the processing this request. If you have
+ * such checks, they should be done in the check_dependencies
+ * function, because any new/deleted/changed rows should be
+ * available then.
+ *
+ *
+ * @param snmpNotifyFilterTable_reg
+ * Pointer to the user registration data
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_CANNOT_CREATE_NOW : index not valid right now
+ * @retval MFD_CANNOT_CREATE_EVER : index never valid
+ */
+int
+snmpNotifyFilterTable_validate_index(snmpNotifyFilterTable_registration *
+ snmpNotifyFilterTable_reg,
+ snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_validate_index", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:430:M: |-> Validate potential snmpNotifyFilterTable index.
+ */
+
+ return rc;
+} /* snmpNotifyFilterTable_validate_index */
+
+/** @} */
+
+/*
+ * ugly, inefficient hack: create a dummy viewEntry list from the filter table
+ * entries matching a profile name. This lets us use the existing vacm
+ * routines for matching oids to views.
+ */
+struct vacm_viewEntry *
+snmpNotifyFilterTable_vacm_view_subtree(const char *profile)
+{
+ oid tmp_oid[MAX_OID_LEN];
+ netsnmp_index tmp_idx;
+ int i, j;
+ netsnmp_void_array *s;
+ struct vacm_viewEntry *tmp;
+ snmpNotifyFilterTable_rowreq_ctx *rowreq;
+ netsnmp_container *c;
+
+ tmp_idx.len = 0;
+ tmp_idx.oids = tmp_oid;
+
+ /*
+ * get the container
+ */
+ c = snmpNotifyFilterTable_container_get();
+ if ((NULL == profile) || (NULL == c))
+ return NULL;
+
+ /*
+ * get the profile subset
+ */
+ tmp_idx.oids[0] = strlen(profile);
+ tmp_idx.len = tmp_idx.oids[0] + 1;
+ for (i = 0; i < tmp_idx.len; ++i)
+ tmp_idx.oids[i + 1] = profile[i];
+ s = c->get_subset(c, &tmp_idx);
+ if (NULL == s)
+ return NULL;
+
+ /*
+ * allocate temporary storage
+ */
+ tmp = calloc(sizeof(struct vacm_viewEntry), s->size + 1);
+ if (NULL == tmp) {
+ free(s->array);
+ free(s);
+ return NULL;
+ }
+
+ /*
+ * copy data
+ */
+ for (i = 0, j = 0; i < s->size; ++i) {
+ rowreq = (snmpNotifyFilterTable_rowreq_ctx *) s->array[i];
+
+ /*
+ * must match profile name exactly, and subset will return
+ * longer matches, if they exist.
+ */
+ if (tmp_idx.oids[0] !=
+ rowreq->tbl_idx.snmpNotifyFilterProfileName_len)
+ continue;
+
+ /*
+ * exact match, copy data
+ * vacm_viewEntry viewName and viewSubtree are prefixed with length
+ */
+
+ tmp[j].viewName[0] =
+ rowreq->tbl_idx.snmpNotifyFilterProfileName_len;
+ memcpy(&tmp[j].viewName[1],
+ rowreq->tbl_idx.snmpNotifyFilterProfileName,
+ tmp[j].viewName[0]);
+
+ tmp[j].viewSubtree[0] =
+ rowreq->tbl_idx.snmpNotifyFilterSubtree_len;
+ memcpy(&tmp[j].viewSubtree[1],
+ rowreq->tbl_idx.snmpNotifyFilterSubtree,
+ tmp[j].viewSubtree[0] * sizeof(oid));
+ tmp[j].viewSubtreeLen = tmp[j].viewSubtree[0] + 1;
+
+ tmp[j].viewMaskLen = rowreq->data.snmpNotifyFilterMask_len;
+ memcpy(tmp[j].viewMask, rowreq->data.snmpNotifyFilterMask,
+ tmp[j].viewMaskLen * sizeof(oid));
+
+
+ tmp[j].viewType = rowreq->data.snmpNotifyFilterType;
+
+ tmp[j].next = &tmp[j + 1];
+ ++j;
+ }
+ if (j)
+ tmp[j - 1].next = NULL;
+ else {
+ SNMP_FREE(tmp);
+ }
+
+ free(s->array);
+ free(s);
+
+ return tmp;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.h
new file mode 100644
index 0000000000..b2300a5afd
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_data_access.h
@@ -0,0 +1,133 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: snmpNotifyFilterTable_data_access.h 13772 2005-12-01 21:06:00Z rstory $
+ */
+#ifndef SNMPNOTIFYFILTERTABLE_DATA_ACCESS_H
+#define SNMPNOTIFYFILTERTABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table snmpNotifyFilterTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterTable is subid 3 of snmpNotifyObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.6.3.13.1.3, length: 9
+ */
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_init_data(snmpNotifyFilterTable_registration
+ * snmpNotifyFilterTable_reg);
+
+
+ void snmpNotifyFilterTable_container_init(netsnmp_container
+ **container_ptr_ptr);
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int snmpNotifyFilterTable_container_load(netsnmp_container
+ *container);
+ void snmpNotifyFilterTable_container_free(netsnmp_container
+ *container);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_row_prep(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_validate_index
+ (snmpNotifyFilterTable_registration * snmpNotifyFilterTable_reg,
+ snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx);
+ int snmpNotifyFilterTable_snmpNotifyFilterProfileName_check_index(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx); /* external */
+ int snmpNotifyFilterSubtree_check_index(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx); /* internal */
+
+ struct vacm_viewEntry *snmpNotifyFilterTable_vacm_view_subtree(const
+ char
+ *profile);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* SNMPNOTIFYFILTERTABLE_DATA_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface.c
new file mode 100644
index 0000000000..630c741f6d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface.c
@@ -0,0 +1,2421 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: snmpNotifyFilterTable_interface.c 15989 2007-03-23 09:15:11Z dts12 $
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "snmpNotifyFilterTable.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "snmpNotifyFilterTable_interface.h"
+
+#include <ctype.h>
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table snmpNotifyFilterTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * SNMP-NOTIFICATION-MIB::snmpNotifyFilterTable is subid 3 of snmpNotifyObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.6.3.13.1.3, length: 9
+ */
+typedef struct snmpNotifyFilterTable_interface_ctx_s {
+
+ netsnmp_container *container;
+
+ snmpNotifyFilterTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+ u_int table_dirty;
+
+} snmpNotifyFilterTable_interface_ctx;
+
+static snmpNotifyFilterTable_interface_ctx snmpNotifyFilterTable_if_ctx;
+
+static void
+ _snmpNotifyFilterTable_container_init(snmpNotifyFilterTable_interface_ctx *
+ if_ctx);
+static void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _snmpNotifyFilterTable_container_shutdown
+ (snmpNotifyFilterTable_interface_ctx * if_ctx);
+
+
+netsnmp_container *
+snmpNotifyFilterTable_container_get(void)
+{
+ return snmpNotifyFilterTable_if_ctx.container;
+}
+
+snmpNotifyFilterTable_registration *
+snmpNotifyFilterTable_registration_get(void)
+{
+ return snmpNotifyFilterTable_if_ctx.user_ctx;
+}
+
+snmpNotifyFilterTable_registration *
+snmpNotifyFilterTable_registration_set(snmpNotifyFilterTable_registration *
+ newreg)
+{
+ snmpNotifyFilterTable_registration *old =
+ snmpNotifyFilterTable_if_ctx.user_ctx;
+ snmpNotifyFilterTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+
+int
+snmpNotifyFilterTable_container_size(void)
+{
+ return CONTAINER_SIZE(snmpNotifyFilterTable_if_ctx.container);
+}
+
+u_int
+snmpNotifyFilterTable_dirty_get(void)
+{
+ return snmpNotifyFilterTable_if_ctx.table_dirty;
+}
+
+void
+snmpNotifyFilterTable_dirty_set(u_int status)
+{
+ DEBUGMSGTL(("snmpNotifyFilterTable:snmpNotifyFilterTable_dirty_set",
+ "called. was %d, now %d\n",
+ snmpNotifyFilterTable_if_ctx.table_dirty, status));
+ snmpNotifyFilterTable_if_ctx.table_dirty = status;
+}
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_pre_request;
+static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_post_request;
+static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_get_values;
+static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_check_objects;
+static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_undo_setup;
+static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_set_values;
+static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_undo_cleanup;
+static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_undo_values;
+static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_commit;
+static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_undo_commit;
+static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_irreversible_commit;
+static Netsnmp_Node_Handler _mfd_snmpNotifyFilterTable_check_dependencies;
+
+NETSNMP_STATIC_INLINE int
+ _snmpNotifyFilterTable_undo_column(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ netsnmp_variable_list *
+ var, int column);
+
+NETSNMP_STATIC_INLINE int
+ _snmpNotifyFilterTable_check_indexes(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx);
+
+snmpNotifyFilterTable_data *snmpNotifyFilterTable_allocate_data(void);
+
+/**
+ * @internal
+ * Initialize the table snmpNotifyFilterTable
+ * (Define its contents and how it's structured)
+ */
+void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _snmpNotifyFilterTable_initialize_interface
+ (snmpNotifyFilterTable_registration * reg_ptr, u_long flags) {
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &snmpNotifyFilterTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info =
+ &snmpNotifyFilterTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_initialize_interface", "called\n"));
+
+
+ /*************************************************
+ *
+ * save interface context for snmpNotifyFilterTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_OCTET_STR,
+ /** index: snmpNotifyFilterProfileName */
+ ASN_PRIV_IMPLIED_OBJECT_ID,
+ /** index: snmpNotifyFilterSubtree */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrival.
+ */
+ tbl_info->min_column = SNMPNOTIFYFILTERTABLE_MIN_COL;
+ tbl_info->max_column = SNMPNOTIFYFILTERTABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ snmpNotifyFilterTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ snmpNotifyFilterTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _snmpNotifyFilterTable_container_init(&snmpNotifyFilterTable_if_ctx);
+ if (NULL == snmpNotifyFilterTable_if_ctx.container) {
+ snmp_log(LOG_ERR,
+ "could not initialize container for snmpNotifyFilterTable\n");
+ return;
+ }
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup =
+ _mfd_snmpNotifyFilterTable_object_lookup;
+ access_multiplexer->get_values = _mfd_snmpNotifyFilterTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request =
+ _mfd_snmpNotifyFilterTable_pre_request;
+ access_multiplexer->post_request =
+ _mfd_snmpNotifyFilterTable_post_request;
+
+
+ /*
+ * REQUIRED wrappers for set request handling
+ */
+ access_multiplexer->object_syntax_checks =
+ _mfd_snmpNotifyFilterTable_check_objects;
+ access_multiplexer->undo_setup = _mfd_snmpNotifyFilterTable_undo_setup;
+ access_multiplexer->undo_cleanup =
+ _mfd_snmpNotifyFilterTable_undo_cleanup;
+ access_multiplexer->set_values = _mfd_snmpNotifyFilterTable_set_values;
+ access_multiplexer->undo_sets = _mfd_snmpNotifyFilterTable_undo_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->commit = _mfd_snmpNotifyFilterTable_commit;
+ access_multiplexer->undo_commit =
+ _mfd_snmpNotifyFilterTable_undo_commit;
+ access_multiplexer->irreversible_commit =
+ _mfd_snmpNotifyFilterTable_irreversible_commit;
+
+ /*
+ * REQUIRED for tables with dependencies
+ */
+ access_multiplexer->consistency_checks =
+ _mfd_snmpNotifyFilterTable_check_dependencies;
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("snmpNotifyFilterTable:init_snmpNotifyFilterTable",
+ "Registering snmpNotifyFilterTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("snmpNotifyFilterTable",
+ handler,
+ snmpNotifyFilterTable_oid,
+ snmpNotifyFilterTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RWRITE);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR,
+ "error registering table snmpNotifyFilterTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &snmpNotifyFilterTable_if_ctx;
+
+ /*************************************************
+ *
+ * set up baby steps handler, create it and inject it
+ */
+ if (access_multiplexer->object_lookup)
+ mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
+ if (access_multiplexer->set_values)
+ mfd_modes |= BABY_STEP_SET_VALUES;
+ if (access_multiplexer->irreversible_commit)
+ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
+ if (access_multiplexer->object_syntax_checks)
+ mfd_modes |= BABY_STEP_CHECK_OBJECT;
+
+ if (access_multiplexer->pre_request)
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if (access_multiplexer->post_request)
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+ if (access_multiplexer->undo_setup)
+ mfd_modes |= BABY_STEP_UNDO_SETUP;
+ if (access_multiplexer->undo_cleanup)
+ mfd_modes |= BABY_STEP_UNDO_CLEANUP;
+ if (access_multiplexer->undo_sets)
+ mfd_modes |= BABY_STEP_UNDO_SETS;
+
+ if (access_multiplexer->row_creation)
+ mfd_modes |= BABY_STEP_ROW_CREATE;
+ if (access_multiplexer->consistency_checks)
+ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
+ if (access_multiplexer->commit)
+ mfd_modes |= BABY_STEP_COMMIT;
+ if (access_multiplexer->undo_commit)
+ mfd_modes |= BABY_STEP_UNDO_COMMIT;
+
+ handler = netsnmp_baby_steps_handler_get(mfd_modes);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
+ */
+ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler =
+ netsnmp_container_table_handler_get(tbl_info,
+ snmpNotifyFilterTable_if_ctx.
+ container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+ /*
+ * register config/persistence callbacks
+ */
+ snmpNotifyFilterTable_container_init_persistence
+ (snmpNotifyFilterTable_if_ctx.container);
+
+} /* _snmpNotifyFilterTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table snmpNotifyFilterTable
+ */
+void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _snmpNotifyFilterTable_shutdown_interface
+ (snmpNotifyFilterTable_registration * reg_ptr) {
+ /*
+ * shutdown the container
+ */
+ _snmpNotifyFilterTable_container_shutdown
+ (&snmpNotifyFilterTable_if_ctx);
+}
+
+void
+snmpNotifyFilterTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ snmpNotifyFilterTable_if_ctx.tbl_info.valid_columns = vc;
+} /* snmpNotifyFilterTable_valid_columns_set */
+
+/**
+ * @internal
+ * convert the index component stored in the context to an oid
+ */
+int
+snmpNotifyFilterTable_index_to_oid(netsnmp_index * oid_idx,
+ snmpNotifyFilterTable_mib_index *
+ mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ netsnmp_variable_list var_snmpNotifyFilterProfileName;
+ /*
+ * snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
+ */
+ netsnmp_variable_list var_snmpNotifyFilterSubtree;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_snmpNotifyFilterProfileName, 0x00,
+ sizeof(var_snmpNotifyFilterProfileName));
+ var_snmpNotifyFilterProfileName.type = ASN_OCTET_STR;
+ memset(&var_snmpNotifyFilterSubtree, 0x00,
+ sizeof(var_snmpNotifyFilterSubtree));
+ var_snmpNotifyFilterSubtree.type = ASN_PRIV_IMPLIED_OBJECT_ID;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_snmpNotifyFilterProfileName.next_variable =
+ &var_snmpNotifyFilterSubtree;
+ var_snmpNotifyFilterSubtree.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_index_to_oid", "called\n"));
+
+ /*
+ * snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ snmp_set_var_value(&var_snmpNotifyFilterProfileName,
+ (u_char *) & mib_idx->snmpNotifyFilterProfileName,
+ mib_idx->snmpNotifyFilterProfileName_len *
+ sizeof(mib_idx->snmpNotifyFilterProfileName[0]));
+
+ /*
+ * snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
+ */
+ snmp_set_var_value(&var_snmpNotifyFilterSubtree,
+ (u_char *) & mib_idx->snmpNotifyFilterSubtree,
+ mib_idx->snmpNotifyFilterSubtree_len *
+ sizeof(mib_idx->snmpNotifyFilterSubtree[0]));
+
+
+ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
+ NULL, 0, &var_snmpNotifyFilterProfileName);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_snmpNotifyFilterProfileName);
+
+ return err;
+} /* snmpNotifyFilterTable_index_to_oid */
+
+/**
+ * extract snmpNotifyFilterTable indexes from a netsnmp_index
+ *
+ * @retval SNMP_ERR_NOERROR : no error
+ * @retval SNMP_ERR_GENERR : error
+ */
+int
+snmpNotifyFilterTable_index_from_oid(netsnmp_index * oid_idx,
+ snmpNotifyFilterTable_mib_index *
+ mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ netsnmp_variable_list var_snmpNotifyFilterProfileName;
+ /*
+ * snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
+ */
+ netsnmp_variable_list var_snmpNotifyFilterSubtree;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_snmpNotifyFilterProfileName, 0x00,
+ sizeof(var_snmpNotifyFilterProfileName));
+ var_snmpNotifyFilterProfileName.type = ASN_OCTET_STR;
+ memset(&var_snmpNotifyFilterSubtree, 0x00,
+ sizeof(var_snmpNotifyFilterSubtree));
+ var_snmpNotifyFilterSubtree.type = ASN_PRIV_IMPLIED_OBJECT_ID;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_snmpNotifyFilterProfileName.next_variable =
+ &var_snmpNotifyFilterSubtree;
+ var_snmpNotifyFilterSubtree.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_index_from_oid", "called\n"));
+
+ /*
+ * parse the oid into the individual index components
+ */
+ err = parse_oid_indexes(oid_idx->oids, oid_idx->len,
+ &var_snmpNotifyFilterProfileName);
+ if (err == SNMP_ERR_NOERROR) {
+ /*
+ * copy out values
+ */
+ /*
+ * NOTE: val_len is in bytes, snmpNotifyFilterProfileName_len might not be
+ */
+ if (var_snmpNotifyFilterProfileName.val_len >
+ sizeof(mib_idx->snmpNotifyFilterProfileName))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->snmpNotifyFilterProfileName,
+ var_snmpNotifyFilterProfileName.val.string,
+ var_snmpNotifyFilterProfileName.val_len);
+ mib_idx->snmpNotifyFilterProfileName_len =
+ var_snmpNotifyFilterProfileName.val_len /
+ sizeof(mib_idx->snmpNotifyFilterProfileName[0]);
+ }
+ /*
+ * NOTE: val_len is in bytes, snmpNotifyFilterSubtree_len might not be
+ */
+ if (var_snmpNotifyFilterSubtree.val_len >
+ sizeof(mib_idx->snmpNotifyFilterSubtree))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->snmpNotifyFilterSubtree,
+ var_snmpNotifyFilterSubtree.val.string,
+ var_snmpNotifyFilterSubtree.val_len);
+ mib_idx->snmpNotifyFilterSubtree_len =
+ var_snmpNotifyFilterSubtree.val_len /
+ sizeof(mib_idx->snmpNotifyFilterSubtree[0]);
+ }
+
+
+ }
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_snmpNotifyFilterProfileName);
+
+ return err;
+} /* snmpNotifyFilterTable_index_from_oid */
+
+
+/*
+ * snmpNotifyFilterTable_allocate_data
+ *
+ * Purpose: create new snmpNotifyFilterTable_data.
+ */
+snmpNotifyFilterTable_data *
+snmpNotifyFilterTable_allocate_data(void)
+{
+ snmpNotifyFilterTable_data *rtn =
+ SNMP_MALLOC_TYPEDEF(snmpNotifyFilterTable_data);
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_allocate_data", "called\n"));
+
+ if (NULL == rtn) {
+ snmp_log(LOG_ERR, "unable to malloc memory for new "
+ "snmpNotifyFilterTable_data.\n");
+ }
+
+ return rtn;
+} /* snmpNotifyFilterTable_allocate_data */
+
+/*
+ * snmpNotifyFilterTable_release_data
+ *
+ * Purpose: release snmpNotifyFilterTable data.
+ */
+void
+snmpNotifyFilterTable_release_data(snmpNotifyFilterTable_data * data)
+{
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:snmpNotifyFilterTable_release_data", "called\n"));
+
+ free(data);
+} /* snmpNotifyFilterTable_release_data */
+
+/*
+ *********************************************************************
+ * @internal
+ * allocate resources for a snmpNotifyFilterTable_rowreq_ctx
+ */
+snmpNotifyFilterTable_rowreq_ctx *
+snmpNotifyFilterTable_allocate_rowreq_ctx(void *user_init_ctx)
+{
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx =
+ SNMP_MALLOC_TYPEDEF(snmpNotifyFilterTable_rowreq_ctx);
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:snmpNotifyFilterTable_allocate_rowreq_ctx", "called\n"));
+
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "Couldn't allocate memory for a "
+ "snmpNotifyFilterTable_rowreq_ctx.\n");
+ return NULL;
+ }
+
+ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
+
+ rowreq_ctx->snmpNotifyFilterTable_data_list = NULL;
+
+ /*
+ * if we allocated data, call init routine
+ */
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) {
+ if (SNMPERR_SUCCESS !=
+ snmpNotifyFilterTable_rowreq_ctx_init(rowreq_ctx,
+ user_init_ctx)) {
+ snmpNotifyFilterTable_release_rowreq_ctx(rowreq_ctx);
+ rowreq_ctx = NULL;
+ }
+ }
+
+ return rowreq_ctx;
+} /* snmpNotifyFilterTable_allocate_rowreq_ctx */
+
+/*
+ * @internal
+ * release resources for a snmpNotifyFilterTable_rowreq_ctx
+ */
+void
+snmpNotifyFilterTable_release_rowreq_ctx(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:snmpNotifyFilterTable_release_rowreq_ctx", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ snmpNotifyFilterTable_rowreq_ctx_cleanup(rowreq_ctx);
+
+ if (rowreq_ctx->undo)
+ snmpNotifyFilterTable_release_data(rowreq_ctx->undo);
+
+ /*
+ * free index oid pointer
+ */
+ if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp)
+ free(rowreq_ctx->oid_idx.oids);
+
+ SNMP_FREE(rowreq_ctx);
+} /* snmpNotifyFilterTable_release_rowreq_ctx */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_snmpNotifyFilterTable_pre_request(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_pre_request", "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = snmpNotifyFilterTable_pre_request(snmpNotifyFilterTable_if_ctx.
+ user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("snmpNotifyFilterTable", "error %d from "
+ "snmpNotifyFilterTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_snmpNotifyFilterTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_snmpNotifyFilterTable_post_request(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_post_request", "called\n"));
+
+ /*
+ * release row context, if deleted
+ */
+ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
+ snmpNotifyFilterTable_release_rowreq_ctx(rowreq_ctx);
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ if ((MFD_SUCCESS != packet_rc) && snmpNotifyFilterTable_dirty_get()) {
+ /*
+ * we shouldn't get here. the undo steps should also clear
+ * the dirty flags.
+ */
+ snmp_log(LOG_WARNING,
+ "snmpNotifyFilterTable dirty flag set in post_request "
+ "but status != SUCCESS.\n");
+ }
+
+ rc = snmpNotifyFilterTable_post_request(snmpNotifyFilterTable_if_ctx.
+ user_ctx, packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("snmpNotifyFilterTable", "error %d from "
+ "snmpNotifyFilterTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_snmpNotifyFilterTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static snmpNotifyFilterTable_rowreq_ctx *
+_mfd_snmpNotifyFilterTable_rowreq_from_index(netsnmp_index * oid_idx,
+ int *rc_ptr)
+{
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx;
+ snmpNotifyFilterTable_mib_index mib_idx;
+ int rc;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_rowreq_from_index", "called\n"));
+
+ if (NULL == rc_ptr)
+ rc_ptr = &rc;
+ *rc_ptr = MFD_SUCCESS;
+
+ memset(&mib_idx, 0x0, sizeof(mib_idx));
+
+ /*
+ * try to parse oid
+ */
+ *rc_ptr = snmpNotifyFilterTable_index_from_oid(oid_idx, &mib_idx);
+ if (MFD_SUCCESS != *rc_ptr) {
+ DEBUGMSGT(("snmpNotifyFilterTable", "error parsing index\n"));
+ return NULL;
+ }
+
+ /*
+ * allocate new context
+ */
+ rowreq_ctx = snmpNotifyFilterTable_allocate_rowreq_ctx(NULL);
+ if (NULL == rowreq_ctx) {
+ *rc_ptr = MFD_ERROR;
+ return NULL; /* msg already logged */
+ }
+
+ memcpy(&rowreq_ctx->tbl_idx, &mib_idx, sizeof(mib_idx));
+
+ /*
+ * check indexes
+ */
+ *rc_ptr = _snmpNotifyFilterTable_check_indexes(rowreq_ctx);
+ if (MFD_SUCCESS != *rc_ptr) {
+ netsnmp_assert((*rc_ptr == SNMP_ERR_NOCREATION) ||
+ (*rc_ptr == SNMP_ERR_INCONSISTENTNAME));
+ snmpNotifyFilterTable_release_rowreq_ctx(rowreq_ctx);
+ return NULL;
+ }
+
+ /*
+ * copy indexes
+ */
+ rowreq_ctx->oid_idx.len = oid_idx->len;
+ memcpy(rowreq_ctx->oid_idx.oids, oid_idx->oids,
+ oid_idx->len * sizeof(oid));
+
+ return rowreq_ctx;
+} /* _mfd_snmpNotifyFilterTable_rowreq_from_index */
+
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_snmpNotifyFilterTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = SNMP_ERR_NOERROR;
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_object_lookup", "called\n"));
+
+ /*
+ * get our context from mfd
+ * snmpNotifyFilterTable_interface_ctx *if_ctx =
+ * (snmpNotifyFilterTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if (NULL == rowreq_ctx) {
+ netsnmp_table_request_info *tblreq_info;
+ netsnmp_index oid_idx;
+
+ tblreq_info = netsnmp_extract_table_info(requests);
+ if (NULL == tblreq_info) {
+ snmp_log(LOG_ERR, "request had no table info\n");
+ return MFD_ERROR;
+ }
+
+ /*
+ * try create rowreq
+ */
+ oid_idx.oids = tblreq_info->index_oid;
+ oid_idx.len = tblreq_info->index_oid_len;
+
+ rowreq_ctx =
+ _mfd_snmpNotifyFilterTable_rowreq_from_index(&oid_idx, &rc);
+ if (MFD_SUCCESS == rc) {
+ netsnmp_assert(NULL != rowreq_ctx);
+ rowreq_ctx->rowreq_flags |= MFD_ROW_CREATED;
+ /*
+ * add rowreq_ctx to request data lists
+ */
+ netsnmp_container_table_row_insert(requests, (netsnmp_index *)
+ rowreq_ctx);
+ }
+ }
+
+ if (MFD_SUCCESS != rc)
+ netsnmp_request_set_error_all(requests, rc);
+ else
+ snmpNotifyFilterTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_snmpNotifyFilterTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_snmpNotifyFilterTable_get_column(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx, netsnmp_variable_list * var,
+ int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_get_column", "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * snmpNotifyFilterMask(2)/OCTETSTR/ASN_OCTET_STR/char(char)//L/A/W/e/R/D/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERMASK:
+ var->type = ASN_OCTET_STR;
+ rc = snmpNotifyFilterMask_get(rowreq_ctx,
+ (char **) &var->val.string,
+ &var->val_len);
+ break;
+
+ /*
+ * snmpNotifyFilterType(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERTYPE:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = snmpNotifyFilterType_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * snmpNotifyFilterStorageType(4)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERSTORAGETYPE:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = snmpNotifyFilterStorageType_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * snmpNotifyFilterRowStatus(5)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERROWSTATUS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = snmpNotifyFilterRowStatus_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _snmpNotifyFilterTable_get_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _snmpNotifyFilterTable_get_column */
+
+int
+_mfd_snmpNotifyFilterTable_get_values(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ u_char *old_string;
+ void (*dataFreeHook) (void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_get_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+ /*
+ * save old pointer, so we can free it if replaced
+ */
+ old_string = requests->requestvb->val.string;
+ dataFreeHook = requests->requestvb->dataFreeHook;
+ if (NULL == requests->requestvb->val.string) {
+ requests->requestvb->val.string = requests->requestvb->buf;
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ } else if (requests->requestvb->buf ==
+ requests->requestvb->val.string) {
+ if (requests->requestvb->val_len !=
+ sizeof(requests->requestvb->buf))
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ }
+
+ /*
+ * get column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _snmpNotifyFilterTable_get_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ if (MFD_SKIP == rc) {
+ requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+ rc = SNMP_ERR_NOERROR;
+ }
+ } else if (NULL == requests->requestvb->val.string) {
+ snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
+ rc = SNMP_ERR_GENERR;
+ }
+ if (rc)
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+
+ /*
+ * if the buffer wasn't used previously for the old data (i.e. it
+ * was allcoated memory) and the get routine replaced the pointer,
+ * we need to free the previous pointer.
+ */
+ if (old_string && (old_string != requests->requestvb->buf) &&
+ (requests->requestvb->val.string != old_string)) {
+ if (dataFreeHook)
+ (*dataFreeHook) (old_string);
+ else
+ free(old_string);
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_snmpNotifyFilterTable_get_values */
+
+NETSNMP_STATIC_INLINE int
+_snmpNotifyFilterTable_check_indexes(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_check_indexes", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * check that the corresponding EXTERNAL row exists
+ */
+
+ /*
+ * (INDEX) snmpNotifyFilterProfileName(1)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/A/W/e/R/d/H
+ */
+ rc = snmpNotifyFilterTable_snmpNotifyFilterProfileName_check_index
+ (rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+
+ /*
+ * (INDEX) snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
+ */
+ if (MFD_SUCCESS != rc)
+ return rc;
+ rc = snmpNotifyFilterSubtree_check_index(rowreq_ctx);
+ if (MFD_SUCCESS != rc)
+ return SNMP_ERR_NOCREATION;
+
+ /*
+ * if individual parts look ok, check them as a whole
+ */
+ return
+ snmpNotifyFilterTable_validate_index(snmpNotifyFilterTable_if_ctx.
+ user_ctx, rowreq_ctx);
+} /* _snmpNotifyFilterTable_check_indexes */
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Syntax checks
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check the syntax for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_snmpNotifyFilterTable_check_column(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx,
+ netsnmp_variable_list * var,
+ int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_check_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+ /*
+ * (INDEX) snmpNotifyFilterSubtree(1)/OBJECTID/ASN_OBJECT_ID/oid(oid)//L/a/w/e/r/d/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERSUBTREE:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+
+ /*
+ * snmpNotifyFilterMask(2)/OCTETSTR/ASN_OCTET_STR/char(char)//L/A/W/e/R/D/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERMASK:
+ rc = netsnmp_check_vb_type_and_max_size(var, ASN_OCTET_STR,
+ sizeof(rowreq_ctx->data.
+ snmpNotifyFilterMask));
+ /*
+ * check defined range(s).
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && ((var->val_len < 0) || (var->val_len > 16))
+ ) {
+ rc = SNMP_ERR_WRONGLENGTH;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("snmpNotifyFilterTable:_snmpNotifyFilterTable_check_column:snmpNotifyFilterMask", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = snmpNotifyFilterMask_check_value(rowreq_ctx,
+ (char *) var->val.string,
+ var->val_len);
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from snmpNotifyFilterMask_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * snmpNotifyFilterType(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERTYPE:
+ rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
+ sizeof(rowreq_ctx->data.
+ snmpNotifyFilterType));
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (*var->val.integer != SNMPNOTIFYFILTERTYPE_INCLUDED)
+ && (*var->val.integer != SNMPNOTIFYFILTERTYPE_EXCLUDED)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("snmpNotifyFilterTable:_snmpNotifyFilterTable_check_column:snmpNotifyFilterType", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = snmpNotifyFilterType_check_value(rowreq_ctx,
+ *((u_long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from snmpNotifyFilterType_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * snmpNotifyFilterStorageType(4)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERSTORAGETYPE:
+ rc = netsnmp_check_vb_type_and_size(var, ASN_INTEGER,
+ sizeof(rowreq_ctx->data.
+ snmpNotifyFilterStorageType));
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (*var->val.integer != STORAGETYPE_OTHER)
+ && (*var->val.integer != STORAGETYPE_VOLATILE)
+ && (*var->val.integer != STORAGETYPE_NONVOLATILE)
+ && (*var->val.integer != STORAGETYPE_PERMANENT)
+ && (*var->val.integer != STORAGETYPE_READONLY)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("snmpNotifyFilterTable:_snmpNotifyFilterTable_check_column:snmpNotifyFilterStorageType", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = snmpNotifyFilterStorageType_check_value(rowreq_ctx,
+ *((u_long *) var->
+ val.string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from snmpNotifyFilterStorageType_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * snmpNotifyFilterRowStatus(5)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERROWSTATUS:
+ rc = netsnmp_check_vb_rowstatus_value(var);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("snmpNotifyFilterTable:_snmpNotifyFilterTable_check_column:snmpNotifyFilterRowStatus", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = snmpNotifyFilterRowStatus_check_value(rowreq_ctx,
+ *((u_long *) var->
+ val.string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from snmpNotifyFilterRowStatus_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ default: /** We shouldn't get here */
+ rc = SNMP_ERR_GENERR;
+ snmp_log(LOG_ERR,
+ "unknown column %d in _snmpNotifyFilterTable_check_column\n",
+ column);
+ }
+
+ return rc;
+} /* _snmpNotifyFilterTable_check_column */
+
+int
+_mfd_snmpNotifyFilterTable_check_objects(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_check_objects", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+
+ /*
+ * get column number from table request info, and check that column
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _snmpNotifyFilterTable_check_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+ break;
+ }
+
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_snmpNotifyFilterTable_check_objects */
+
+
+/*----------------------------------------------------------------------
+ *
+ * SET: check dependencies
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check dependencies wrapper
+ */
+static int
+_mfd_snmpNotifyFilterTable_check_dependencies(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info, netsnmp_request_info
+ *requests)
+{
+ int rc;
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_check_dependencies", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = snmpNotifyFilterTable_check_dependencies(rowreq_ctx);
+ if (rc) {
+ DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from "
+ "snmpNotifyFilterTable_check_dependencies\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_snmpNotifyFilterTable_check_dependencies */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo setup
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_snmpNotifyFilterTable_undo_setup_column(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_undo_setup_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * snmpNotifyFilterMask(2)/OCTETSTR/ASN_OCTET_STR/char(char)//L/A/W/e/R/D/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERMASK:
+ rowreq_ctx->column_set_flags |= COLUMN_SNMPNOTIFYFILTERMASK_FLAG;
+ rc = snmpNotifyFilterMask_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * snmpNotifyFilterType(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERTYPE:
+ rowreq_ctx->column_set_flags |= COLUMN_SNMPNOTIFYFILTERTYPE_FLAG;
+ rc = snmpNotifyFilterType_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * snmpNotifyFilterStorageType(4)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERSTORAGETYPE:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_SNMPNOTIFYFILTERSTORAGETYPE_FLAG;
+ rc = snmpNotifyFilterStorageType_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * snmpNotifyFilterRowStatus(5)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERROWSTATUS:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_SNMPNOTIFYFILTERROWSTATUS_FLAG;
+ rc = snmpNotifyFilterRowStatus_undo_setup(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _snmpNotifyFilterTable_undo_setup_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _snmpNotifyFilterTable_undo_setup_column */
+
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_snmpNotifyFilterTable_undo_setup(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_undo_setup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * allocate undo context
+ */
+ rowreq_ctx->undo = snmpNotifyFilterTable_allocate_data();
+ if (NULL == rowreq_ctx->undo) {
+ /** msg already logged */
+ netsnmp_request_set_error_all(requests,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * row undo setup
+ */
+ rowreq_ctx->column_set_flags = 0;
+ rc = snmpNotifyFilterTable_undo_setup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from "
+ "snmpNotifyFilterTable_undo_setup\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ } else {
+ /*
+ * column undo setup
+ */
+ netsnmp_table_request_info *tri;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _snmpNotifyFilterTable_undo_setup_column(rowreq_ctx,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from "
+ "snmpNotifyFilterTable_undo_setup_column\n",
+ rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_snmpNotifyFilterTable_undo_setup */
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_snmpNotifyFilterTable_undo_cleanup(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_undo_cleanup", "called\n"));
+
+ /*
+ * failed row create in early stages has no rowreq_ctx
+ */
+ if (NULL == rowreq_ctx)
+ return MFD_SUCCESS;
+
+ /*
+ * call user cleanup
+ */
+ rc = snmpNotifyFilterTable_undo_cleanup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from "
+ "snmpNotifyFilterTable_undo_cleanup\n", rc));
+ }
+
+ /*
+ * release undo context, if needed
+ */
+ if (rowreq_ctx->undo) {
+ snmpNotifyFilterTable_release_data(rowreq_ctx->undo);
+ rowreq_ctx->undo = NULL;
+ }
+
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_snmpNotifyFilterTable_undo_cleanup */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Set values
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_snmpNotifyFilterTable_set_column(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx, netsnmp_variable_list * var,
+ int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_set_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * snmpNotifyFilterMask(2)/OCTETSTR/ASN_OCTET_STR/char(char)//L/A/W/e/R/D/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERMASK:
+ rowreq_ctx->column_set_flags |= COLUMN_SNMPNOTIFYFILTERMASK_FLAG;
+ rc = snmpNotifyFilterMask_set(rowreq_ctx, (char *) var->val.string,
+ var->val_len);
+ break;
+
+ /*
+ * snmpNotifyFilterType(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERTYPE:
+ rowreq_ctx->column_set_flags |= COLUMN_SNMPNOTIFYFILTERTYPE_FLAG;
+ rc = snmpNotifyFilterType_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ /*
+ * snmpNotifyFilterStorageType(4)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERSTORAGETYPE:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_SNMPNOTIFYFILTERSTORAGETYPE_FLAG;
+ rc = snmpNotifyFilterStorageType_set(rowreq_ctx,
+ *((u_long *) var->val.
+ string));
+ break;
+
+ /*
+ * snmpNotifyFilterRowStatus(5)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERROWSTATUS:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_SNMPNOTIFYFILTERROWSTATUS_FLAG;
+ rc = snmpNotifyFilterRowStatus_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _snmpNotifyFilterTable_set_column\n",
+ column);
+ rc = SNMP_ERR_GENERR;
+ break;
+ }
+
+ return rc;
+} /* _snmpNotifyFilterTable_set_column */
+
+int
+_mfd_snmpNotifyFilterTable_set_values(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc = SNMP_ERR_NOERROR;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_set_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rowreq_ctx->column_set_flags = 0;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _snmpNotifyFilterTable_set_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from "
+ "snmpNotifyFilterTable_set_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_snmpNotifyFilterTable_set_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit the values
+ */
+int
+_mfd_snmpNotifyFilterTable_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = snmpNotifyFilterTable_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from "
+ "snmpNotifyFilterTable_commit\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ /*
+ * if we successfully commited this row, set the dirty flag. Use the
+ * current value + 1 (i.e. dirty = # rows changed).
+ * this is checked in post_request...
+ */
+ snmpNotifyFilterTable_dirty_set(snmpNotifyFilterTable_dirty_get() + 1); /* set table dirty flag */
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+_mfd_snmpNotifyFilterTable_undo_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_undo_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ u_int d = snmpNotifyFilterTable_dirty_get();
+
+ netsnmp_assert(d != 0);
+ if (d)
+ snmpNotifyFilterTable_dirty_set(d - 1);
+ }
+
+ rc = snmpNotifyFilterTable_undo_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from "
+ "snmpNotifyFilterTable_undo_commit\n", rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ snmp_log(LOG_WARNING,
+ "snmpNotifyFilterTable row dirty flag still set after undo_commit\n");
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_snmpNotifyFilterTable_commit */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * undo the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_snmpNotifyFilterTable_undo_column(snmpNotifyFilterTable_rowreq_ctx *
+ rowreq_ctx, netsnmp_variable_list * var,
+ int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_undo_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * snmpNotifyFilterMask(2)/OCTETSTR/ASN_OCTET_STR/char(char)//L/A/W/e/R/D/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERMASK:
+ rc = snmpNotifyFilterMask_undo(rowreq_ctx);
+ break;
+
+ /*
+ * snmpNotifyFilterType(3)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERTYPE:
+ rc = snmpNotifyFilterType_undo(rowreq_ctx);
+ break;
+
+ /*
+ * snmpNotifyFilterStorageType(4)/StorageType/ASN_INTEGER/long(u_long)//l/A/W/E/r/D/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERSTORAGETYPE:
+ rc = snmpNotifyFilterStorageType_undo(rowreq_ctx);
+ break;
+
+ /*
+ * snmpNotifyFilterRowStatus(5)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_SNMPNOTIFYFILTERROWSTATUS:
+ rc = snmpNotifyFilterRowStatus_undo(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _snmpNotifyFilterTable_undo_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _snmpNotifyFilterTable_undo_column */
+
+int
+_mfd_snmpNotifyFilterTable_undo_values(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_undo_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = snmpNotifyFilterTable_undo(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from "
+ "snmpNotifyFilterTable_undo\n", rc));
+ }
+
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _snmpNotifyFilterTable_undo_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("snmpNotifyFilterTable:mfd", "error %d from "
+ "snmpNotifyFilterTable_undo_column\n", rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_snmpNotifyFilterTable_undo_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: irreversible commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit irreversible actions
+ */
+int
+_mfd_snmpNotifyFilterTable_irreversible_commit(netsnmp_mib_handler
+ *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info, netsnmp_request_info
+ *requests)
+{
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_mfd_snmpNotifyFilterTable_irreversible:commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * check for and handle row creation/deletion
+ * and update column exist flags...
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) {
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_CREATED))
+ CONTAINER_REMOVE(snmpNotifyFilterTable_if_ctx.container,
+ rowreq_ctx);
+ } else {
+ if (rowreq_ctx->column_set_flags) {
+ rowreq_ctx->column_set_flags = 0;
+ }
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_CREATED;
+ CONTAINER_INSERT(snmpNotifyFilterTable_if_ctx.container,
+ rowreq_ctx);
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_snmpNotifyFilterTable_irreversible_commit */
+
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+/**
+ * @internal
+ */
+static void
+_container_item_free(snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx,
+ void *context)
+{
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_container_item_free",
+ "called\n"));
+
+ if (NULL == rowreq_ctx)
+ return;
+
+ snmpNotifyFilterTable_release_rowreq_ctx(rowreq_ctx);
+} /* _container_item_free */
+
+/**
+ * @internal
+ */
+static void
+_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_container_free",
+ "called\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container in snmpNotifyFilterTable_container_free\n");
+ return;
+ }
+
+ /*
+ * call user code
+ */
+ snmpNotifyFilterTable_container_free(container);
+
+ /*
+ * free all items. inefficient, but easy.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func *) _container_item_free,
+ NULL);
+} /* _container_free */
+
+/**
+ * @internal
+ * initialize the container with functions or wrappers
+ */
+void
+_snmpNotifyFilterTable_container_init(snmpNotifyFilterTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_container_init", "called\n"));
+
+ /*
+ * container init
+ */
+ snmpNotifyFilterTable_container_init(&if_ctx->container);
+ if (NULL == if_ctx->container)
+ if_ctx->container =
+ netsnmp_container_find
+ ("snmpNotifyFilterTable:table_container");
+ if (NULL == if_ctx->container) {
+ snmp_log(LOG_ERR, "error creating container in "
+ "snmpNotifyFilterTable_container_init\n");
+ return;
+ }
+
+} /* _snmpNotifyFilterTable_container_init */
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _snmpNotifyFilterTable_container_shutdown
+ (snmpNotifyFilterTable_interface_ctx * if_ctx) {
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_container_shutdown", "called\n"));
+
+ snmpNotifyFilterTable_container_shutdown(if_ctx->container);
+
+ _container_free(if_ctx->container);
+
+} /* _snmpNotifyFilterTable_container_shutdown */
+
+/***********************************************************************
+ *
+ * PERSISTENCE
+ *
+ ***********************************************************************/
+
+static int _snmpNotifyFilterTable_container_save_rows(int majorID,
+ int minorID,
+ void *serverarg,
+ void
+ *clientarg);
+static void _snmpNotifyFilterTable_container_row_restore(const char
+ *token,
+ char *buf);
+static int
+ _snmpNotifyFilterTable_container_row_save(snmpNotifyFilterTable_rowreq_ctx
+ * rowreq_ctx,
+ void *type);
+static char
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ *_snmpNotifyFilterTable_container_col_restore
+ (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx, u_int col, char *buf);
+static char
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ *_snmpNotifyFilterTable_container_col_save
+ (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx, u_int col, char *buf);
+
+static char row_token[] = "snmpNotifyFilterTable";
+
+/************************************************************
+ * *_init_persistence should be called from the main table
+ * init routine.
+ *
+ * If your table depends on rows in another table,
+ * you should register your callback after the other table,
+ * which should ensure the rows on which you depend are saved
+ * (and re-created) before the dependent rows.
+ */
+void
+snmpNotifyFilterTable_container_init_persistence(netsnmp_container
+ *container)
+{
+ int rc;
+
+ register_config_handler(NULL, row_token,
+ _snmpNotifyFilterTable_container_row_restore,
+ NULL, NULL);
+ rc = snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+ SNMP_CALLBACK_STORE_DATA,
+ _snmpNotifyFilterTable_container_save_rows,
+ container);
+
+ if (rc != SNMP_ERR_NOERROR)
+ snmp_log(LOG_ERR, "error registering for STORE_DATA callback "
+ "in _snmpNotifyFilterTable_container_init_persistence\n");
+}
+
+static int
+_snmpNotifyFilterTable_container_save_rows(int majorID, int minorID,
+ void *serverarg,
+ void *clientarg)
+{
+ char sep[] =
+ "##############################################################";
+ char buf[] =
+ "#\n" "# snmpNotifyFilterTable persistent data\n" "#";
+ char *type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_APPTYPE);
+ netsnmp_container *c = (netsnmp_container *) clientarg;
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_container_save_rows", "saving %d rows\n", CONTAINER_SIZE(c)));
+
+ read_config_store((char *) type, sep);
+ read_config_store((char *) type, buf);
+
+ /*
+ * save all rows
+ */
+ CONTAINER_FOR_EACH(c, (netsnmp_container_obj_func *)
+ _snmpNotifyFilterTable_container_row_save, type);
+
+ read_config_store((char *) type, sep);
+ read_config_store((char *) type, "\n");
+
+ /*
+ * never fails
+ */
+ return SNMPERR_SUCCESS;
+}
+
+
+
+/************************************************************
+ * _snmpNotifyFilterTable_container_row_save
+ */
+static int
+_snmpNotifyFilterTable_container_row_save(snmpNotifyFilterTable_rowreq_ctx
+ * rowreq_ctx, void *type)
+{
+ /*
+ * Allocate space for a line with all data for a row. An
+ * attempt is made to come up with a default maximum size, but
+ * there is no guarantee it will be enough. It probably will be,
+ * unless you are dealing with large values or you have external
+ * indexes.
+ *
+ * 1) allocate space for each column. Comment out columns you don't
+ * intend to save. You may also need to add room for any non-
+ * column data you want to store. Remeber, data will be stored in
+ * ASCII form, so you need to allow for that. Here are some
+ * general guidelines:
+ *
+ * Object ID : 12 * len [ASCII len of max int + 1 for .]
+ * Octet String: (2 * len) + 2 [2 ASCII chars per byte + "0x"]
+ * Integers : 12 [ASCII len for smallest negative number]
+ *
+ * 2) You also need to allocate space for the row index. This will
+ * be stored as an OID, which means that Octet Strings need to
+ * be treated a little differently. Specifically, you will need
+ * (4 * len) + 4 [3 ASCII chars per byte + 1 for ., + 4 for len].
+ *
+ * 3) Also, remeber to add space for the identifier and seperator
+ * characters (for example, each column is prefixed by the
+ * column number and a semicolon. To allow for the maximum
+ * column values, 12 bytes [11 for oid + 1 for ':'] per
+ * column are added).
+ */
+
+#define MAX_ROW_SIZE (sizeof(row_token) + 1 + \
+ ( 12 * 128 ) + /* ASN_OBJECT_ID snmpNotifyFilterSubtree and */ \
+ /* ASN_OCTET_STR snmpNotifyFilterProfileName indices */ \
+ ( ( 2 * sizeof(rowreq_ctx->data.snmpNotifyFilterMask) ) + 3 ) + /* ASN_OCTET_STR */ \
+ ( 12 ) + /* ASN_INTEGER snmpNotifyFilterType */ \
+ ( 12 ) + /* ASN_INTEGER snmpNotifyFilterStorageType */ \
+ ( 12 ) + /* ASN_INTEGER snmpNotifyFilterRowStatus */ \
+ ( SNMPNOTIFYFILTERTABLE_MAX_COL * 12 ) + /* column num prefix + : */ \
+ 2 /* LINE_TERM_CHAR + \n */ )
+
+ char buf[MAX_ROW_SIZE], *pos = buf, *max =
+ &buf[MAX_ROW_SIZE - 1];
+ char *tmp;
+ int i;
+
+ if (snmpNotifyFilterTable_container_should_save(rowreq_ctx) == 0) {
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * build the line
+ */
+ pos += sprintf(pos, "%s ", row_token);
+ pos = read_config_save_objid(pos, rowreq_ctx->oid_idx.oids,
+ rowreq_ctx->oid_idx.len);
+ if (NULL == pos) {
+ snmp_log(LOG_ERR, "error saving snmpNotifyFilterTable row "
+ "to persistent file\n");
+ return SNMP_ERR_GENERR;
+ }
+ *pos++ = ' ';
+ if (pos > max) {
+ snmp_log(LOG_ERR, "error saving snmpNotifyFilterTable row "
+ "to persistent file (too long)\n");
+ return SNMP_ERR_GENERR;
+ }
+
+ /*
+ * add each column
+ */
+ for (i = SNMPNOTIFYFILTERTABLE_MIN_COL;
+ i <= SNMPNOTIFYFILTERTABLE_MAX_COL; ++i) {
+
+ if ((0x1 << (i - 1)) & ~SNMPNOTIFYFILTERTABLE_SETTABLE_COLS)
+ continue;
+
+ tmp = pos;
+ pos =
+ _snmpNotifyFilterTable_container_col_save(rowreq_ctx, i, pos);
+ if (NULL == pos)
+ pos = tmp;
+ else
+ *pos++ = ' ';
+ if (pos > max) {
+ snmp_log(LOG_ERR, "error saving snmpNotifyFilterTable row "
+ "to persistent file (too long)\n");
+ return SNMP_ERR_GENERR;
+ }
+ }
+
+ /*
+ * if you have non-column data, add it here
+ */
+
+
+ /*
+ * store the line
+ */
+ pos += sprintf(pos, "%c", LINE_TERM_CHAR);
+ if (pos > max) {
+ snmp_log(LOG_ERR, "error saving snmpNotifyFilterTable row "
+ "to persistent file (too long)\n");
+ return SNMP_ERR_GENERR;
+ }
+ read_config_store((char *) type, buf);
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_container_row_save", "saving line '%s'\n", buf));
+
+ return SNMP_ERR_NOERROR;
+}
+
+static void
+_snmpNotifyFilterTable_container_row_restore(const char *token, char *buf)
+{
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx;
+ netsnmp_index index;
+ oid tmp_oid[MAX_snmpNotifyFilterTable_IDX_LEN];
+ u_int col = 0, found = 0;
+
+
+ if (strncmp(token, row_token, sizeof(row_token)) != 0) {
+ snmp_log(LOG_ERR,
+ "unknown token in _snmpNotifyFilterTable_container_row_restore\n");
+ return;
+ }
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_container_row_restore", "parsing line '%s'\n", buf));
+
+ /*
+ * pull out index and create default row
+ */
+ index.oids = tmp_oid;
+ index.len = OID_LENGTH(tmp_oid);
+ buf = read_config_read_objid(buf, &index.oids, &index.len);
+ if (NULL == buf) {
+ snmp_log(LOG_ERR, "error reading row index in "
+ "_snmpNotifyFilterTable_container_row_restore\n");
+ return;
+ }
+ rowreq_ctx =
+ _mfd_snmpNotifyFilterTable_rowreq_from_index(&index, NULL);
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "error creating row index in "
+ "_snmpNotifyFilterTable_container_row_restore\n");
+ return;
+ }
+
+ /*
+ * loop through and get each column
+ */
+ buf = skip_white(buf);
+ while ((NULL != buf) && isdigit(*buf)) {
+ /*
+ * extract column, skip ':'
+ */
+ col = (u_int) strtol(buf, &buf, 10);
+ if (NULL == buf)
+ break;
+ if (*buf != ':') {
+ buf = NULL;
+ break;
+ }
+ ++buf; /* skip : */
+
+ /*
+ * parse value
+ */
+ DEBUGMSGTL(("_snmpNotifyFilterTable_container_row_restore",
+ "parsing column %d\n", col));
+ buf =
+ _snmpNotifyFilterTable_container_col_restore(rowreq_ctx, col,
+ buf);
+ ++found;
+ }
+ if (0 == found) {
+ snmp_log(LOG_ERR,
+ "error parsing snmpNotifyFilterTable row; no columns found");
+ snmpNotifyFilterTable_release_rowreq_ctx(rowreq_ctx);
+ return;
+ }
+
+ /*
+ * if you added any non-column data, this is where
+ * you should handle it.
+ */
+
+ /*
+ * if the pointer is NULL and we didn't reach the
+ * end of the line, something went wrong. Log message,
+ * delete the row and bail.
+ */
+ if ((buf == NULL) || (*buf != LINE_TERM_CHAR)) {
+ snmp_log(LOG_ERR,
+ "error parsing snmpNotifyFilterTable row around column %d",
+ col);
+ snmpNotifyFilterTable_release_rowreq_ctx(rowreq_ctx);
+ return;
+ }
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_container_row_restore", "inserting row\n"));
+
+ /*
+ * copy oid index and insert row
+ */
+ rowreq_ctx->oid_idx.len = index.len;
+ memcpy(rowreq_ctx->oid_idx.oids, index.oids, index.len * sizeof(oid));
+
+ CONTAINER_INSERT(snmpNotifyFilterTable_if_ctx.container, rowreq_ctx);
+}
+
+/************************************************************
+ * _snmpNotifyFilterTable_container_col_save
+ */
+static char *
+_snmpNotifyFilterTable_container_col_save(snmpNotifyFilterTable_rowreq_ctx
+ * rowreq_ctx, u_int col,
+ char *buf)
+{
+ if ((NULL == rowreq_ctx) || (NULL == buf)) {
+ snmp_log(LOG_ERR, "bad parameter in "
+ "_snmpNotifyFilterTable_container_col_save\n");
+ return NULL;
+ }
+
+ DEBUGMSGTL(("internal:snmpNotifyFilterTable:_snmpNotifyFilterTable_container_col_save", "processing column %d\n", col));
+
+ /*
+ * prefix with column number, so we don't ever depend on
+ * order saved.
+ */
+ buf += sprintf(buf, "%u:", col);
+
+ /*
+ * save data for the column
+ */
+ switch (col) {
+
+ case COLUMN_SNMPNOTIFYFILTERMASK: /** OCTETSTR = ASN_OCTET_STR */
+ buf =
+ read_config_save_octet_string(buf,
+ rowreq_ctx->data.
+ snmpNotifyFilterMask,
+ rowreq_ctx->data.
+ snmpNotifyFilterMask_len);
+ break;
+
+ case COLUMN_SNMPNOTIFYFILTERTYPE: /** INTEGER = ASN_INTEGER */
+ buf += sprintf(buf, "%ld", rowreq_ctx->data.snmpNotifyFilterType);
+ break;
+
+ case COLUMN_SNMPNOTIFYFILTERSTORAGETYPE: /** StorageType = ASN_INTEGER */
+ buf +=
+ sprintf(buf, "%ld",
+ rowreq_ctx->data.snmpNotifyFilterStorageType);
+ break;
+
+ case COLUMN_SNMPNOTIFYFILTERROWSTATUS: /** RowStatus = ASN_INTEGER */
+ buf +=
+ sprintf(buf, "%ld",
+ rowreq_ctx->data.snmpNotifyFilterRowStatus);
+ break;
+
+ default:
+ /** We shouldn't get here */
+ snmp_log(LOG_ERR, "unknown column %d in "
+ "_snmpNotifyFilterTable_container_col_save\n", col);
+ return NULL;
+ }
+
+ return buf;
+}
+
+/************************************************************
+ * _snmpNotifyFilterTable_container_col_restore
+ */
+static char *_snmpNotifyFilterTable_container_col_restore
+ (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx, u_int col, char *buf) {
+ size_t len;
+ if ((NULL == rowreq_ctx) || (NULL == buf)) {
+ snmp_log(LOG_ERR, "bad parameter in "
+ "_snmpNotifyFilterTable_container_col_restore\n");
+ return NULL;
+ }
+
+ DEBUGMSGTL(("verbose:snmpNotifyFilterTable:_snmpNotifyFilterTable_container_col_restore", "processing column %d\n", col));
+
+ /*
+ * restore data for the column
+ */
+ switch (col) {
+
+ case COLUMN_SNMPNOTIFYFILTERMASK: /** OCTETSTR = ASN_OCTET_STR */
+ rowreq_ctx->data.snmpNotifyFilterMask_len =
+ sizeof(rowreq_ctx->data.snmpNotifyFilterMask);
+ buf =
+ read_config_read_memory(ASN_OCTET_STR, buf,
+ (char *) &rowreq_ctx->data.
+ snmpNotifyFilterMask,
+ (size_t *) & rowreq_ctx->data.
+ snmpNotifyFilterMask_len);
+ break;
+
+ case COLUMN_SNMPNOTIFYFILTERTYPE: /** INTEGER = ASN_INTEGER */
+ len = sizeof(rowreq_ctx->data.snmpNotifyFilterType);
+ buf = read_config_read_memory(ASN_INTEGER, buf,
+ (char *) &rowreq_ctx->data.
+ snmpNotifyFilterType, &len);
+ break;
+
+ case COLUMN_SNMPNOTIFYFILTERSTORAGETYPE: /** StorageType = ASN_INTEGER */
+ len = sizeof(rowreq_ctx->data.snmpNotifyFilterStorageType);
+ buf = read_config_read_memory(ASN_INTEGER, buf,
+ (char *) &rowreq_ctx->data.
+ snmpNotifyFilterStorageType, &len);
+ break;
+
+ case COLUMN_SNMPNOTIFYFILTERROWSTATUS: /** RowStatus = ASN_INTEGER */
+ len = sizeof(rowreq_ctx->data.snmpNotifyFilterRowStatus);
+ buf = read_config_read_memory(ASN_INTEGER, buf,
+ (char *) &rowreq_ctx->data.
+ snmpNotifyFilterRowStatus, &len);
+ break;
+
+ default:
+ /** We shouldn't get here */
+ snmp_log(LOG_ERR, "unknown column %d in "
+ "_snmpNotifyFilterTable_container_col_restore\n", col);
+ return NULL;
+ }
+
+ return buf;
+}
+
+
+snmpNotifyFilterTable_rowreq_ctx *
+snmpNotifyFilterTable_row_find_by_mib_index(snmpNotifyFilterTable_mib_index
+ * mib_idx)
+{
+ snmpNotifyFilterTable_rowreq_ctx *rowreq_ctx;
+ oid oid_tmp[MAX_OID_LEN];
+ netsnmp_index oid_idx;
+ int rc;
+
+ /*
+ * set up storage for OID
+ */
+ oid_idx.oids = oid_tmp;
+ oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
+
+ /*
+ * convert
+ */
+ rc = snmpNotifyFilterTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx =
+ CONTAINER_FIND(snmpNotifyFilterTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface.h
new file mode 100644
index 0000000000..c73fce8141
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-notification-mib/snmpNotifyFilterTable/snmpNotifyFilterTable_interface.h
@@ -0,0 +1,210 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: snmpNotifyFilterTable_interface.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** @ingroup interface Routines to interface to Net-SNMP
+ *
+ * \warning This code should not be modified, called directly,
+ * or used to interpret functionality. It is subject to
+ * change at any time.
+ *
+ * @{
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+#ifndef SNMPNOTIFYFILTERTABLE_INTERFACE_H
+#define SNMPNOTIFYFILTERTABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "snmpNotifyFilterTable.h"
+
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _snmpNotifyFilterTable_initialize_interface
+ (snmpNotifyFilterTable_registration * user_ctx, u_long flags);
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _snmpNotifyFilterTable_shutdown_interface
+ (snmpNotifyFilterTable_registration * user_ctx);
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_registration
+ * snmpNotifyFilterTable_registration_get(void);
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_registration
+ * snmpNotifyFilterTable_registration_set
+ (snmpNotifyFilterTable_registration * newreg);
+
+ netsnmp_container *snmpNotifyFilterTable_container_get(void);
+ int snmpNotifyFilterTable_container_size(void);
+
+ u_int snmpNotifyFilterTable_dirty_get(void);
+ void snmpNotifyFilterTable_dirty_set(u_int status);
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_rowreq_ctx
+ * snmpNotifyFilterTable_allocate_rowreq_ctx(void *);
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_release_rowreq_ctx
+ (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx);
+
+ int snmpNotifyFilterTable_index_to_oid(netsnmp_index *
+ oid_idx,
+ snmpNotifyFilterTable_mib_index
+ * mib_idx);
+ int snmpNotifyFilterTable_index_from_oid(netsnmp_index *
+ oid_idx,
+ snmpNotifyFilterTable_mib_index
+ * mib_idx);
+
+ /*
+ *********************************************************************
+ * Persistent declarations
+ */
+ /*
+ * persistence
+ */
+#define LINE_TERM_CHAR '$'
+
+ void
+ snmpNotifyFilterTable_container_init_persistence(netsnmp_container
+ *container);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_container_should_save
+ (snmpNotifyFilterTable_rowreq_ctx * rowreq_ctx);
+
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+ snmpNotifyFilterTable_valid_columns_set(netsnmp_column_info *vc);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* SNMPNOTIFYFILTERTABLE_INTERFACE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib.h
new file mode 100644
index 0000000000..3aacf43b99
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib.h
@@ -0,0 +1,8 @@
+#ifndef SNMP_USM_DH_OBJECTS_MIB_H
+#define SNMP_USM_DH_OBJECTS_MIB_H
+
+config_add_mib(SNMP-USM-DH-OBJECTS-MIB);
+config_require(snmp-usm-dh-objects-mib/usmDHUserKeyTable)
+config_require(snmp-usm-dh-objects-mib/usmDHParameters)
+
+#endif /* SNMP_USM_DH_OBJECTS_MIB_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHParameters.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHParameters.h
new file mode 100644
index 0000000000..c277ab0793
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHParameters.h
@@ -0,0 +1,6 @@
+#ifndef USMDHPARAMETERS_H
+#define USMDHPARAMETERS_H
+
+config_require(snmp-usm-dh-objects-mib/usmDHParameters/usmDHParameters)
+
+#endif /* USMDHPARAMETERS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHParameters/usmDHParameters.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHParameters/usmDHParameters.c
new file mode 100644
index 0000000000..6cb8c2a7fc
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHParameters/usmDHParameters.c
@@ -0,0 +1,136 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.7 2003/04/08 14:57:04 dts12 Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "usmDHParameters.h"
+
+#include <openssl/dh.h>
+
+static DH *dh_params = NULL;
+
+DH *
+get_dh_params(void)
+{
+ return dh_params;
+}
+
+/** Initializes the usmDHParameters module */
+void
+init_usmDHParameters(void)
+{
+ static oid usmDHParameters_oid[] =
+ { 1, 3, 6, 1, 3, 101, 1, 1, 1 };
+
+ DEBUGMSGTL(("usmDHParameters", "Initializing\n"));
+
+ netsnmp_register_scalar(netsnmp_create_handler_registration
+ ("usmDHParameters", handle_usmDHParameters,
+ usmDHParameters_oid,
+ OID_LENGTH(usmDHParameters_oid),
+ HANDLER_CAN_RWRITE));
+
+ /* currently hard coded to the oakly group 2 set. */
+ /* these values are modifiable via SNMP SETs if needed by
+ management apps though */
+ if (!dh_params) {
+ dh_params = DH_new();
+ dh_params->g = BN_new();
+ BN_hex2bn(&dh_params->g, "02");
+ BN_hex2bn(&dh_params->p, "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff");
+ }
+}
+
+int
+handle_usmDHParameters(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ /*
+ * We are never called for a GETNEXT if it's registered as a
+ * "instance", as it's "magically" handled for us.
+ */
+
+ static unsigned char *cp = NULL;
+ static DH *dh_tmpp = NULL;
+ int cp_len;
+
+ /*
+ * a instance handler also only hands us one request at a time, so
+ * we don't need to loop over a list of requests; we'll only get one.
+ */
+
+ switch (reqinfo->mode) {
+
+ case MODE_GET:
+ if(cp) {
+ free(cp);
+ cp = NULL;
+ }
+ cp_len = i2d_DHparams(dh_params, &cp);
+ if (cp_len > 0)
+ snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
+ (u_char *) cp, cp_len);
+ break;
+
+ /*
+ * SET REQUEST
+ *
+ * multiple states in the transaction. See:
+ * http://www.net-snmp.org/tutorial-5/toolkit/mib_module/set-actions.jpg
+ */
+ case MODE_SET_RESERVE1:
+ break;
+
+ case MODE_SET_RESERVE2:
+ cp = requests->requestvb->val.string;
+ dh_tmpp = d2i_DHparams(NULL, (const unsigned char **) &cp,
+ requests->requestvb->val_len);
+ if ( !dh_tmpp) {
+ netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_WRONGVALUE);
+ }
+ if (cp - requests->requestvb->val.string !=
+ requests->requestvb->val_len) {
+ /* value too long; we didn't parse the whole thing */
+ netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_WRONGVALUE);
+ DH_free(dh_tmpp);
+ dh_tmpp = NULL;
+ }
+ break;
+
+ case MODE_SET_FREE:
+ case MODE_SET_COMMIT:
+ DH_free(dh_tmpp);
+ dh_tmpp = NULL;
+ break;
+
+ case MODE_SET_ACTION:
+ {
+ DH *tmpp;
+ tmpp = dh_params;
+ dh_params = dh_tmpp;
+ dh_tmpp = tmpp;
+ break;
+ }
+
+ case MODE_SET_UNDO:
+ {
+ DH_free(dh_params); /* free new value */
+ dh_params = dh_tmpp; /* restore old value */
+ dh_tmpp = NULL;
+ break;
+ }
+
+ default:
+ /*
+ * we should never get here, so this is a really bad error
+ */
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHParameters/usmDHParameters.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHParameters/usmDHParameters.h
new file mode 100644
index 0000000000..37ac528770
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHParameters/usmDHParameters.h
@@ -0,0 +1,17 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.7 2003/04/08 14:57:04 dts12 Exp $
+ */
+#ifndef USMDHPARAMETERS_H
+#define USMDHPARAMETERS_H
+
+#include <openssl/dh.h>
+
+/*
+ * function declarations
+ */
+DH * get_dh_params(void);
+void init_usmDHParameters(void);
+Netsnmp_Node_Handler handle_usmDHParameters;
+
+#endif /* USMDHPARAMETERS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable.h
new file mode 100644
index 0000000000..84f2169d0c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable.h
@@ -0,0 +1,6 @@
+#ifndef SNMP_USM_DH_OBJECTS_MIB_H
+#define SNMP_USM_DH_OBJECTS_MIB_H
+
+config_require(snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable)
+
+#endif /* SNMP_USM_DH_OBJECTS_MIB_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable.c
new file mode 100644
index 0000000000..b2e3f201aa
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable.c
@@ -0,0 +1,225 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: usmDHUserKeyTable.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** \page MFD helper for usmDHUserKeyTable
+ *
+ * \section intro Introduction
+ * Introductory text.
+ *
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "usmDHUserKeyTable.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "usmDHUserKeyTable_interface.h"
+
+oid usmDHUserKeyTable_oid[] = { USMDHUSERKEYTABLE_OID };
+int usmDHUserKeyTable_oid_size =
+OID_LENGTH(usmDHUserKeyTable_oid);
+
+usmDHUserKeyTable_registration usmDHUserKeyTable_user_context;
+
+void initialize_table_usmDHUserKeyTable(void);
+void shutdown_table_usmDHUserKeyTable(void);
+
+
+/**
+ * Initializes the usmDHUserKeyTable module
+ */
+void
+init_usmDHUserKeyTable(void)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:init_usmDHUserKeyTable",
+ "called\n"));
+
+ /*
+ * TODO:300:o: Perform usmDHUserKeyTable one-time module initialization.
+ */
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ if (should_init("usmDHUserKeyTable")) {
+ initialize_table_usmDHUserKeyTable();
+ }
+} /* init_usmDHUserKeyTable */
+
+/**
+ * Shut-down the usmDHUserKeyTable module (agent is exiting)
+ */
+void
+shutdown_usmDHUserKeyTable(void)
+{
+ if (should_init("usmDHUserKeyTable"))
+ shutdown_table_usmDHUserKeyTable();
+
+}
+
+/**
+ * Initialize the table usmDHUserKeyTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_usmDHUserKeyTable(void)
+{
+ usmDHUserKeyTable_registration *user_context;
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:initialize_table_usmDHUserKeyTable", "called\n"));
+
+ /*
+ * TODO:301:o: Perform usmDHUserKeyTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize usmDHUserKeyTable user context
+ * if you'd like to pass in a pointer to some data for this
+ * table, allocate or set it up here.
+ */
+ user_context = &usmDHUserKeyTable_user_context;
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _usmDHUserKeyTable_initialize_interface(user_context, flags);
+} /* initialize_table_usmDHUserKeyTable */
+
+/**
+ * Shutdown the table usmDHUserKeyTable
+ */
+void
+shutdown_table_usmDHUserKeyTable(void)
+{
+ /*
+ * call interface shutdown code
+ */
+ _usmDHUserKeyTable_shutdown_interface(&usmDHUserKeyTable_user_context);
+}
+
+/**
+ * extra context initialization (eg default values)
+ *
+ * @param rowreq_ctx : row request context
+ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
+ *
+ * @retval MFD_SUCCESS : no errors
+ * @retval MFD_ERROR : error (context allocate will fail)
+ */
+int
+usmDHUserKeyTable_rowreq_ctx_init(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx, void *user_init_ctx)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_rowreq_ctx_init", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:210:o: |-> Perform extra usmDHUserKeyTable rowreq initialization. (eg DEFVALS)
+ */
+
+ return MFD_SUCCESS;
+} /* usmDHUserKeyTable_rowreq_ctx_init */
+
+/**
+ * extra context cleanup
+ * @param rowreq_ctx
+ */
+void
+usmDHUserKeyTable_rowreq_ctx_cleanup(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_rowreq_ctx_cleanup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:211:o: |-> Perform extra usmDHUserKeyTable rowreq cleanup.
+ */
+} /* usmDHUserKeyTable_rowreq_ctx_cleanup */
+
+/**
+ * pre-request callback
+ *
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+usmDHUserKeyTable_pre_request(usmDHUserKeyTable_registration *
+ user_context)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_pre_request",
+ "called\n"));
+
+ /*
+ * TODO:510:o: Perform usmDHUserKeyTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* usmDHUserKeyTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ * Note:
+ * New rows have been inserted into the container, and
+ * deleted rows have been removed from the container and
+ * released.
+ * @param user_context
+ * @param rc : MFD_SUCCESS if all requests succeeded
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+usmDHUserKeyTable_post_request(usmDHUserKeyTable_registration *
+ user_context, int rc)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_post_request",
+ "called\n"));
+
+ /*
+ * TODO:511:o: Perform usmDHUserKeyTable post-request actions.
+ */
+
+ /*
+ * check to set if any rows were changed.
+ */
+ if (usmDHUserKeyTable_dirty_get()) {
+ /*
+ * check if request was successful. If so, this would be
+ * a good place to save data to its persistent store.
+ */
+ if (MFD_SUCCESS == rc) {
+ /*
+ * save changed rows, if you haven't already
+ */
+ }
+
+ usmDHUserKeyTable_dirty_set(0); /* clear table dirty flag */
+ }
+
+ return MFD_SUCCESS;
+} /* usmDHUserKeyTable_post_request */
+
+
+/** @{ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable.h
new file mode 100644
index 0000000000..0548441a02
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable.h
@@ -0,0 +1,226 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: usmDHUserKeyTable.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+#ifndef USMDHUSERKEYTABLE_H
+#define USMDHUSERKEYTABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @addtogroup misc misc: Miscellaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+
+ /*
+ * other required module components
+ */
+ /* *INDENT-OFF* */
+config_require(snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_interface)
+config_require(snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_access)
+config_require(snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_get)
+config_require(snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_set)
+ /* *INDENT-ON* */
+
+ /*
+ * OID and column number definitions for usmDHUserKeyTable
+ */
+#include "usmDHUserKeyTable_oids.h"
+
+ /*
+ * enum definions
+ */
+#include "usmDHUserKeyTable_enums.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_usmDHUserKeyTable(void);
+ void shutdown_usmDHUserKeyTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table usmDHUserKeyTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyTable is subid 2 of usmDHPublicObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.3.101.1.1.2, length: 9
+ */
+ /*
+ *********************************************************************
+ * When you register your mib, you get to provide a generic
+ * pointer that will be passed back to you for most of the
+ * functions calls.
+ *
+ * TODO:100:r: Review all context structures
+ */
+ /*
+ * TODO:101:o: |-> Review usmDHUserKeyTable registration context.
+ */
+ typedef struct usmUser *usmDHUserKeyTable_registration;
+
+/**********************************************************************/
+ /*
+ * TODO:110:r: |-> Review usmDHUserKeyTable data context structure.
+ * This structure is used to represent the data for usmDHUserKeyTable.
+ */
+ typedef struct usmUser usmDHUserKeyTable_data;
+
+
+ /*
+ *********************************************************************
+ * TODO:115:o: |-> Review usmDHUserKeyTable undo context.
+ * We're just going to use the same data structure for our
+ * undo_context. If you want to do something more efficent,
+ * define your typedef here.
+ */
+ typedef usmDHUserKeyTable_data usmDHUserKeyTable_undo_data;
+
+ /*
+ * TODO:120:r: |-> Review usmDHUserKeyTable mib index.
+ * This structure is used to represent the index for usmDHUserKeyTable.
+ */
+ typedef struct usmDHUserKeyTable_mib_index_s {
+
+ /*
+ * usmUserEngineID(1)/SnmpEngineID/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ char usmUserEngineID[32];
+ size_t usmUserEngineID_len;
+
+ /*
+ * usmUserName(2)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H
+ */
+ char usmUserName[32];
+ size_t usmUserName_len;
+
+
+ } usmDHUserKeyTable_mib_index;
+
+ /*
+ * TODO:121:r: | |-> Review usmDHUserKeyTable max index length.
+ * If you KNOW that your indexes will never exceed a certain
+ * length, update this macro to that length.
+ *
+ * BE VERY CAREFUL TO TAKE INTO ACCOUNT THE MAXIMUM
+ * POSSIBLE LENGHT FOR EVERY VARIABLE LENGTH INDEX!
+ * Guessing 128 - col/entry(2) - oid len(9)
+ */
+#define MAX_usmDHUserKeyTable_IDX_LEN 66
+
+
+ /*
+ *********************************************************************
+ * TODO:130:o: |-> Review usmDHUserKeyTable Row request (rowreq) context.
+ * When your functions are called, you will be passed a
+ * usmDHUserKeyTable_rowreq_ctx pointer.
+ */
+ typedef struct usmDHUserKeyTable_rowreq_ctx_s {
+
+ /** this must be first for container compare to work */
+ netsnmp_index oid_idx;
+ oid oid_tmp[MAX_usmDHUserKeyTable_IDX_LEN];
+
+ usmDHUserKeyTable_mib_index tbl_idx;
+
+ usmDHUserKeyTable_data *data;
+ usmDHUserKeyTable_undo_data *undo;
+ unsigned int column_set_flags; /* flags for set columns */
+
+
+ /*
+ * flags per row. Currently, the first (lower) 8 bits are reserved
+ * for the user. See mfd.h for other flags.
+ */
+ u_int rowreq_flags;
+
+ /*
+ * TODO:131:o: | |-> Add useful data to usmDHUserKeyTable rowreq context.
+ */
+
+ /*
+ * storage for future expansion
+ */
+ netsnmp_data_list *usmDHUserKeyTable_data_list;
+
+ } usmDHUserKeyTable_rowreq_ctx;
+
+ typedef struct usmDHUserKeyTable_ref_rowreq_ctx_s {
+ usmDHUserKeyTable_rowreq_ctx *rowreq_ctx;
+ } usmDHUserKeyTable_ref_rowreq_ctx;
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int
+ usmDHUserKeyTable_pre_request(usmDHUserKeyTable_registration *
+ user_context);
+ int
+ usmDHUserKeyTable_post_request(usmDHUserKeyTable_registration *
+ user_context, int rc);
+
+ int
+ usmDHUserKeyTable_rowreq_ctx_init(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx, void *user_init_ctx);
+ void
+ usmDHUserKeyTable_rowreq_ctx_cleanup(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+
+ usmDHUserKeyTable_data *usmDHUserKeyTable_allocate_data(void);
+ void usmDHUserKeyTable_release_data(usmDHUserKeyTable_data *
+ data);
+
+ int
+ usmDHUserKeyTable_check_dependencies(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+ int usmDHUserKeyTable_commit(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+ usmDHUserKeyTable_irreversible_commit(usmDHUserKeyTable_rowreq_ctx
+ * rowreq_ctx);
+
+ usmDHUserKeyTable_rowreq_ctx
+ *usmDHUserKeyTable_row_find_by_mib_index
+ (usmDHUserKeyTable_mib_index * mib_idx);
+
+ extern oid usmDHUserKeyTable_oid[];
+ extern int usmDHUserKeyTable_oid_size;
+
+
+#include "usmDHUserKeyTable_interface.h"
+#include "usmDHUserKeyTable_data_access.h"
+#include "usmDHUserKeyTable_data_get.h"
+#include "usmDHUserKeyTable_data_set.h"
+
+ /*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* USMDHUSERKEYTABLE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_access.c
new file mode 100644
index 0000000000..6ef7727ec6
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_access.c
@@ -0,0 +1,330 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: usmDHUserKeyTable_data_access.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "usmDHUserKeyTable.h"
+
+
+#include "usmDHUserKeyTable_data_access.h"
+
+/** @ingroup interface
+ * @addtogroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table usmDHUserKeyTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyTable is subid 2 of usmDHPublicObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.3.101.1.1.2, length: 9
+ */
+
+/**
+ * initialization for usmDHUserKeyTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param usmDHUserKeyTable_reg
+ * Pointer to usmDHUserKeyTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+usmDHUserKeyTable_init_data(usmDHUserKeyTable_registration *
+ usmDHUserKeyTable_reg)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_init_data",
+ "called\n"));
+
+ /*
+ * TODO:303:o: Initialize usmDHUserKeyTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* usmDHUserKeyTable_init_data */
+
+/**
+ * container overview
+ *
+ */
+
+/**
+ * container initialization
+ *
+ * @param container_ptr_ptr A pointer to a container pointer. If you
+ * create a custom container, use this parameter to return it
+ * to the MFD helper. If set to NULL, the MFD helper will
+ * allocate a container for you.
+ * @param cache A pointer to a cache structure. You can set the timeout
+ * and other cache flags using this pointer.
+ *
+ * This function is called at startup to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases. If no custom
+ * container is allocated, the MFD code will create one for your.
+ *
+ * This is also the place to set up cache behavior. The default, to
+ * simply set the cache timeout, will work well with the default
+ * container. If you are using a custom container, you may want to
+ * look at the cache helper documentation to see if there are any
+ * flags you want to set.
+ *
+ * @remark
+ * This would also be a good place to do any initialization needed
+ * for you data source. For example, opening a connection to another
+ * process that will supply the data, opening a database, etc.
+ */
+void
+usmDHUserKeyTable_container_init(netsnmp_container ** container_ptr_ptr,
+ netsnmp_cache * cache)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_container_init", "called\n"));
+
+ if (NULL == container_ptr_ptr) {
+ snmp_log(LOG_ERR,
+ "bad container param to usmDHUserKeyTable_container_init\n");
+ return;
+ }
+
+ /*
+ * For advanced users, you can use a custom container. If you
+ * do not create one, one will be created for you.
+ */
+ *container_ptr_ptr = NULL;
+
+ if (NULL == cache) {
+ snmp_log(LOG_ERR,
+ "bad cache param to usmDHUserKeyTable_container_init\n");
+ return;
+ }
+
+ /*
+ * TODO:345:A: Set up usmDHUserKeyTable cache properties.
+ *
+ * Also for advanced users, you can set parameters for the
+ * cache. Do not change the magic pointer, as it is used
+ * by the MFD helper. To completely disable caching, set
+ * cache->enabled to 0.
+ *
+ * other tables access our data pool (usm user list), so not caching
+ * is the safest thing to do. The other option would be to add a
+ * callback when the list is changed, or a last changed object to
+ * verify the list hasn't changed. Until then, reload the cache for
+ * every request.
+ */
+ cache->timeout = -1; /* seconds */
+} /* usmDHUserKeyTable_container_init */
+
+/**
+ * container shutdown
+ *
+ * @param container_ptr A pointer to the container.
+ *
+ * This function is called at shutdown to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases.
+ *
+ * This function is called before usmDHUserKeyTable_container_free().
+ *
+ * @remark
+ * This would also be a good place to do any cleanup needed
+ * for you data source. For example, closing a connection to another
+ * process that supplied the data, closing a database, etc.
+ */
+void
+usmDHUserKeyTable_container_shutdown(netsnmp_container * container_ptr)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_container_shutdown", "called\n"));
+
+ if (NULL == container_ptr) {
+ snmp_log(LOG_ERR,
+ "bad params to usmDHUserKeyTable_container_shutdown\n");
+ return;
+ }
+
+} /* usmDHUserKeyTable_container_shutdown */
+
+/**
+ * load initial data
+ *
+ * TODO:350:M: Implement usmDHUserKeyTable data load
+ * This function will also be called by the cache helper to load
+ * the container again (after the container free function has been
+ * called to free the previous contents).
+ *
+ * @param container container to which items should be inserted
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
+ * @retval MFD_ERROR : other error.
+ *
+ * This function is called to load the index(es) (and data, optionally)
+ * for the every row in the data set.
+ *
+ * @remark
+ * While loading the data, the only important thing is the indexes.
+ * If access to your data is cheap/fast (e.g. you have a pointer to a
+ * structure in memory), it would make sense to update the data here.
+ * If, however, the accessing the data invovles more work (e.g. parsing
+ * some other existing data, or peforming calculations to derive the data),
+ * then you can limit yourself to setting the indexes and saving any
+ * information you will need later. Then use the saved information in
+ * usmDHUserKeyTable_row_prep() for populating data.
+ *
+ * @note
+ * If you need consistency between rows (like you want statistics
+ * for each row to be from the same time frame), you should set all
+ * data here.
+ *
+ */
+int
+usmDHUserKeyTable_container_load(netsnmp_container * container)
+{
+ usmDHUserKeyTable_rowreq_ctx *rowreq_ctx;
+ struct usmUser *usmuser;
+ size_t count = 0;
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_container_load", "called\n"));
+
+ /*
+ * TODO:351:M: |-> Load/update data in the usmDHUserKeyTable container.
+ * loop over your usmDHUserKeyTable data, allocate a rowreq context,
+ * set the index(es) [and data, optionally] and insert into
+ * the container.
+ */
+ /*
+ * Retrieve the first user from the USM DB
+ */
+ usmuser = usm_get_userList();
+ if (NULL == usmuser) {
+ return MFD_SUCCESS;
+ }
+
+ for (; usmuser; usmuser = usmuser->next) {
+
+ /*
+ * TODO:352:M: | |-> set indexes in new usmDHUserKeyTable rowreq context.
+ * data context will be set from the first param (unless NULL,
+ * in which case a new data context will be allocated)
+ * the second param will be passed, with the row context, to
+ * usmDHUserKeyTablerowreq_ctx_init.
+ */
+ rowreq_ctx = usmDHUserKeyTable_allocate_rowreq_ctx(usmuser, NULL);
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "memory allocation failed\n");
+ return MFD_RESOURCE_UNAVAILABLE;
+ }
+ if (MFD_SUCCESS !=
+ usmDHUserKeyTable_indexes_set(rowreq_ctx,
+ usmuser->engineID,
+ usmuser->engineIDLen,
+ usmuser->name,
+ strlen(usmuser->name))) {
+ snmp_log(LOG_ERR,
+ "error setting index while loading "
+ "usmDHUserKeyTable data.\n");
+ usmDHUserKeyTable_release_rowreq_ctx(rowreq_ctx);
+ continue;
+ }
+
+ /*
+ * TODO:352:r: | |-> populate usmDHUserKeyTable data context.
+ * Populate data context here. (optionally, delay until row prep)
+ */
+ /*
+ * non-TRANSIENT data: no need to copy. set pointer to data
+ */
+
+ /*
+ * insert into table container
+ */
+ CONTAINER_INSERT(container, rowreq_ctx);
+ ++count;
+ }
+
+ DEBUGMSGT(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_container_load", "inserted %d records\n", count));
+
+ return MFD_SUCCESS;
+} /* usmDHUserKeyTable_container_load */
+
+/**
+ * container clean up
+ *
+ * @param container container with all current items
+ *
+ * This optional callback is called prior to all
+ * item's being removed from the container. If you
+ * need to do any processing before that, do it here.
+ *
+ * @note
+ * The MFD helper will take care of releasing all the row contexts.
+ * If you did not pass a data context pointer when allocating
+ * the rowreq context, the one that was allocated will be deleted.
+ * If you did pass one in, it will not be deleted and that memory
+ * is your responsibility.
+ *
+ */
+void
+usmDHUserKeyTable_container_free(netsnmp_container * container)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_container_free", "called\n"));
+
+ /*
+ * TODO:380:M: Free usmDHUserKeyTable container data.
+ */
+} /* usmDHUserKeyTable_container_free */
+
+/**
+ * prepare row for processing.
+ *
+ * When the agent has located the row for a request, this function is
+ * called to prepare the row for processing. If you fully populated
+ * the data context during the index setup phase, you may not need to
+ * do anything.
+ *
+ * @param rowreq_ctx pointer to a context.
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ */
+int
+usmDHUserKeyTable_row_prep(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_row_prep",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+
+ return MFD_SUCCESS;
+} /* usmDHUserKeyTable_row_prep */
+
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_access.h
new file mode 100644
index 0000000000..2304523fdf
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_access.h
@@ -0,0 +1,74 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: usmDHUserKeyTable_data_access.h 13774 2005-12-01 21:31:52Z rstory $
+ */
+#ifndef USMDHUSERKEYTABLE_DATA_ACCESS_H
+#define USMDHUSERKEYTABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table usmDHUserKeyTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyTable is subid 2 of usmDHPublicObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.3.101.1.1.2, length: 9
+ */
+
+
+ int
+ usmDHUserKeyTable_init_data(usmDHUserKeyTable_registration *
+ usmDHUserKeyTable_reg);
+
+
+ /*
+ * TODO:180:o: Review usmDHUserKeyTable cache timeout.
+ * The number of seconds before the cache times out
+ */
+#define USMDHUSERKEYTABLE_CACHE_TIMEOUT 60
+
+ void usmDHUserKeyTable_container_init(netsnmp_container **
+ container_ptr_ptr,
+ netsnmp_cache *
+ cache);
+ void usmDHUserKeyTable_container_shutdown(netsnmp_container
+ * container_ptr);
+
+ int usmDHUserKeyTable_container_load(netsnmp_container *
+ container);
+ void usmDHUserKeyTable_container_free(netsnmp_container *
+ container);
+
+ int usmDHUserKeyTable_cache_load(netsnmp_container *
+ container);
+ void usmDHUserKeyTable_cache_free(netsnmp_container *
+ container);
+
+ int usmDHUserKeyTable_row_prep(usmDHUserKeyTable_rowreq_ctx
+ * rowreq_ctx);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* USMDHUSERKEYTABLE_DATA_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_get.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_get.c
new file mode 100644
index 0000000000..451b2f5996
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_get.c
@@ -0,0 +1,613 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.20 $ of : mfd-data-get.m2c,v $
+ *
+ * $Id: usmDHUserKeyTable_data_get.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <openssl/dh.h>
+
+/*
+ * include our parent header
+ */
+#define NEED_USMDH_FUNCTIONS
+#include "usmDHUserKeyTable.h"
+
+DH *
+usmDHGetUserDHptr(struct usmUser *user, int for_auth_key)
+{
+ DH *dh, *dh_params;
+ void **theptr;
+
+ if (user == NULL)
+ return NULL;
+
+ if (for_auth_key == 1)
+ theptr = &user->usmDHUserAuthKeyChange;
+ else
+ theptr = &user->usmDHUserPrivKeyChange;
+
+ if (!*theptr) {
+ /*
+ * copy the system parameters to the local ones
+ */
+ dh = DH_new();
+ if (!dh)
+ return NULL;
+ dh_params = get_dh_params();
+ if (!dh_params)
+ return NULL;
+ dh->g = BN_dup(dh_params->g);
+ dh->p = BN_dup(dh_params->p);
+ if (!dh->g || !dh->p)
+ return NULL;
+ DH_generate_key(dh);
+ *theptr = dh;
+ } else {
+ dh = (DH *) * theptr;
+ }
+ return dh;
+}
+
+int
+usmDHGetUserKeyChange(struct usmUser *user, int for_auth_key,
+ char **keyobj, size_t *keyobj_len)
+{
+ DH *dh;
+
+ dh = usmDHGetUserDHptr(user, for_auth_key);
+
+ if (!dh) {
+ snmp_log(LOG_ERR, "ack... shouldn't get here: %x %d\n",
+ user, for_auth_key);
+ return MFD_ERROR;
+ }
+
+ *keyobj_len = BN_num_bytes(dh->pub_key);
+ *keyobj = malloc(*keyobj_len);
+ BN_bn2bin(dh->pub_key, *keyobj);
+
+ return MFD_SUCCESS;
+}
+
+/** @ingroup data_access
+ * @defgroup data_get data_get: Routines to get data
+ *
+ * TODO:230:M: Implement usmDHUserKeyTable get routines.
+ * TODO:240:M: Implement usmDHUserKeyTable mapping routines (if any).
+ *
+ * These routine are used to get the value for individual objects. The
+ * row context is passed, along with a pointer to the memory where the
+ * value should be copied.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table usmDHUserKeyTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyTable is subid 2 of usmDHPublicObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.3.101.1.1.2, length: 9
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement usmDHUserKeyTable data context functions.
+ */
+/*
+ * usmDHUserKeyTable_allocate_data
+ *
+ * Purpose: create new usmDHUserKeyTable_data.
+ */
+usmDHUserKeyTable_data *
+usmDHUserKeyTable_allocate_data(void)
+{
+ /*
+ * TODO:201:r: |-> allocate memory for the usmDHUserKeyTable data context.
+ */
+ usmDHUserKeyTable_data *rtn =
+ SNMP_MALLOC_TYPEDEF(usmDHUserKeyTable_data);
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_allocate_data", "called\n"));
+
+ if (NULL == rtn) {
+ snmp_log(LOG_ERR, "unable to malloc memory for new "
+ "usmDHUserKeyTable_data.\n");
+ }
+ /*
+ * not real user, not in a list. mark for testing
+ */
+ rtn->next = (struct usmUser *) -1;
+ rtn->prev = (struct usmUser *) -1;
+
+ return rtn;
+} /* usmDHUserKeyTable_allocate_data */
+
+/*
+ * usmDHUserKeyTable_release_data
+ *
+ * Purpose: release usmDHUserKeyTable data.
+ */
+void
+usmDHUserKeyTable_release_data(usmDHUserKeyTable_data * data)
+{
+ struct usmUser *user = data;
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_release_data",
+ "called\n"));
+
+ netsnmp_assert(user->next == (struct usmUser *) -1);
+ netsnmp_assert(user->prev == (struct usmUser *) -1);
+
+ /*
+ * TODO:202:r: |-> release memory for the usmDHUserKeyTable data context.
+ */
+ if (user) {
+ SNMP_FREE(user->authKey);
+ SNMP_FREE(user->privKey);
+ }
+
+ free(data);
+} /* usmDHUserKeyTable_release_data */
+
+
+
+/**
+ * set mib index(es)
+ *
+ * @param tbl_idx mib index structure
+ * @param usmUserEngineID_val_ptr
+ * @param usmUserEngineID_val_ptr_len
+ * @param usmUserName_val_ptr
+ * @param usmUserName_val_ptr_len
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This convenience function is useful for setting all the MIB index
+ * components with a single function call. It is assume that the C values
+ * have already been mapped from their native/rawformat to the MIB format.
+ */
+int
+usmDHUserKeyTable_indexes_set_tbl_idx(usmDHUserKeyTable_mib_index *
+ tbl_idx,
+ char *usmUserEngineID_val_ptr,
+ size_t usmUserEngineID_val_ptr_len,
+ char *usmUserName_val_ptr,
+ size_t usmUserName_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_indexes_set_tbl_idx", "called\n"));
+
+ /*
+ * usmUserEngineID(1)/SnmpEngineID/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ tbl_idx->usmUserEngineID_len = sizeof(tbl_idx->usmUserEngineID) / sizeof(tbl_idx->usmUserEngineID[0]); /* max length */
+ /** WARNING: this code might not work for struct usmUser */
+ /*
+ * make sure there is enough space for usmUserEngineID data
+ */
+ if ((NULL == tbl_idx->usmUserEngineID) ||
+ (tbl_idx->usmUserEngineID_len < (usmUserEngineID_val_ptr_len))) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->usmUserEngineID_len = usmUserEngineID_val_ptr_len;
+ memcpy(tbl_idx->usmUserEngineID, usmUserEngineID_val_ptr,
+ usmUserEngineID_val_ptr_len *
+ sizeof(usmUserEngineID_val_ptr[0]));
+
+ /*
+ * usmUserName(2)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H
+ */
+ tbl_idx->usmUserName_len = sizeof(tbl_idx->usmUserName) / sizeof(tbl_idx->usmUserName[0]); /* max length */
+
+ /** WARNING: this code might not work for struct usmUser */
+ /*
+ * make sure there is enough space for usmUserName data
+ */
+ if ((NULL == tbl_idx->usmUserName) ||
+ (tbl_idx->usmUserName_len < (usmUserName_val_ptr_len))) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->usmUserName_len = usmUserName_val_ptr_len;
+ memcpy(tbl_idx->usmUserName, usmUserName_val_ptr,
+ usmUserName_val_ptr_len * sizeof(usmUserName_val_ptr[0]));
+
+
+ return MFD_SUCCESS;
+} /* usmDHUserKeyTable_indexes_set_tbl_idx */
+
+/**
+ * @internal
+ * set row context indexes
+ *
+ * @param reqreq_ctx the row context that needs updated indexes
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This function sets the mib indexs, then updates the oid indexs
+ * from the mib index.
+ */
+int
+usmDHUserKeyTable_indexes_set(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx,
+ char *usmUserEngineID_val_ptr,
+ size_t usmUserEngineID_val_ptr_len,
+ char *usmUserName_val_ptr,
+ size_t usmUserName_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_indexes_set",
+ "called\n"));
+
+ if (MFD_SUCCESS !=
+ usmDHUserKeyTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
+ usmUserEngineID_val_ptr,
+ usmUserEngineID_val_ptr_len,
+ usmUserName_val_ptr,
+ usmUserName_val_ptr_len))
+ return MFD_ERROR;
+
+ /*
+ * convert mib index to oid index
+ */
+ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
+ if (0 != usmDHUserKeyTable_index_to_oid(&rowreq_ctx->oid_idx,
+ &rowreq_ctx->tbl_idx)) {
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS;
+} /* usmDHUserKeyTable_indexes_set */
+
+
+/*---------------------------------------------------------------------
+ * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyEntry.usmDHUserAuthKeyChange
+ * usmDHUserAuthKeyChange is subid 1 of usmDHUserKeyEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.3.101.1.1.2.1.1
+ * Description:
+The object used to change any given user's Authentication Key
+ using a Diffie-Hellman key exchange.
+
+ The right-most n bits of the shared secret 'sk', where 'n' is the
+ number of bits required for the protocol defined by
+ usmUserAuthProtocol, are installed as the operational
+ authentication key for this row after a successful SET.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ *
+ * Its syntax is DHKeyChange (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length.
+ */
+/**
+ * Extract the current value of the usmDHUserAuthKeyChange data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param usmDHUserAuthKeyChange_val_ptr_ptr
+ * Pointer to storage for a char variable
+ * @param usmDHUserAuthKeyChange_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by usmDHUserAuthKeyChange.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*usmDHUserAuthKeyChange_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update usmDHUserAuthKeyChange_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+usmDHUserAuthKeyChange_get(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx,
+ char **usmDHUserAuthKeyChange_val_ptr_ptr,
+ size_t *usmDHUserAuthKeyChange_val_ptr_len_ptr)
+{
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert((NULL != usmDHUserAuthKeyChange_val_ptr_ptr)
+ && (NULL != *usmDHUserAuthKeyChange_val_ptr_ptr));
+ netsnmp_assert(NULL != usmDHUserAuthKeyChange_val_ptr_len_ptr);
+
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserAuthKeyChange_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the usmDHUserAuthKeyChange data.
+ * copy (* usmDHUserAuthKeyChange_val_ptr_ptr ) data and (* usmDHUserAuthKeyChange_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ if (!rowreq_ctx || !usmDHUserAuthKeyChange_val_ptr_len_ptr ||
+ !usmDHUserAuthKeyChange_val_ptr_ptr ||
+ !*usmDHUserAuthKeyChange_val_ptr_ptr) {
+ return MFD_ERROR;
+ }
+
+ return usmDHGetUserKeyChange(rowreq_ctx->data, 1,
+ usmDHUserAuthKeyChange_val_ptr_ptr,
+ usmDHUserAuthKeyChange_val_ptr_len_ptr);
+} /* usmDHUserAuthKeyChange_get */
+
+/*---------------------------------------------------------------------
+ * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyEntry.usmDHUserOwnAuthKeyChange
+ * usmDHUserOwnAuthKeyChange is subid 2 of usmDHUserKeyEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.3.101.1.1.2.1.2
+ * Description:
+The object used to change the agents own Authentication Key
+ using a Diffie-Hellman key exchange.
+
+ The right-most n bits of the shared secret 'sk', where 'n' is the
+ number of bits required for the protocol defined by
+ usmUserAuthProtocol, are installed as the operational
+ authentication key for this row after a successful SET.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ *
+ * Its syntax is DHKeyChange (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length.
+ */
+/**
+ * Extract the current value of the usmDHUserOwnAuthKeyChange data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param usmDHUserOwnAuthKeyChange_val_ptr_ptr
+ * Pointer to storage for a char variable
+ * @param usmDHUserOwnAuthKeyChange_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by usmDHUserOwnAuthKeyChange.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*usmDHUserOwnAuthKeyChange_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update usmDHUserOwnAuthKeyChange_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+usmDHUserOwnAuthKeyChange_get(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx,
+ char **usmDHUserOwnAuthKeyChange_val_ptr_ptr,
+ size_t
+ *usmDHUserOwnAuthKeyChange_val_ptr_len_ptr)
+{
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert((NULL != usmDHUserOwnAuthKeyChange_val_ptr_ptr)
+ && (NULL != *usmDHUserOwnAuthKeyChange_val_ptr_ptr));
+ netsnmp_assert(NULL != usmDHUserOwnAuthKeyChange_val_ptr_len_ptr);
+
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserOwnAuthKeyChange_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the usmDHUserOwnAuthKeyChange data.
+ * copy (* usmDHUserOwnAuthKeyChange_val_ptr_ptr ) data and (* usmDHUserOwnAuthKeyChange_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ if (!rowreq_ctx || !usmDHUserOwnAuthKeyChange_val_ptr_len_ptr ||
+ !usmDHUserOwnAuthKeyChange_val_ptr_ptr ||
+ !*usmDHUserOwnAuthKeyChange_val_ptr_ptr) {
+ return MFD_ERROR;
+ }
+
+ return usmDHGetUserKeyChange(rowreq_ctx->data, 1,
+ usmDHUserOwnAuthKeyChange_val_ptr_ptr,
+ usmDHUserOwnAuthKeyChange_val_ptr_len_ptr);
+} /* usmDHUserOwnAuthKeyChange_get */
+
+/*---------------------------------------------------------------------
+ * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyEntry.usmDHUserPrivKeyChange
+ * usmDHUserPrivKeyChange is subid 3 of usmDHUserKeyEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.3.101.1.1.2.1.3
+ * Description:
+The object used to change any given user's Privacy Key using
+ a Diffie-Hellman key exchange.
+
+ The right-most n bits of the shared secret 'sk', where 'n' is the
+ number of bits required for the protocol defined by
+ usmUserPrivProtocol, are installed as the operational privacy key
+ for this row after a successful SET.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ *
+ * Its syntax is DHKeyChange (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length.
+ */
+/**
+ * Extract the current value of the usmDHUserPrivKeyChange data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param usmDHUserPrivKeyChange_val_ptr_ptr
+ * Pointer to storage for a char variable
+ * @param usmDHUserPrivKeyChange_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by usmDHUserPrivKeyChange.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*usmDHUserPrivKeyChange_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update usmDHUserPrivKeyChange_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+usmDHUserPrivKeyChange_get(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx,
+ char **usmDHUserPrivKeyChange_val_ptr_ptr,
+ size_t *usmDHUserPrivKeyChange_val_ptr_len_ptr)
+{
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert((NULL != usmDHUserPrivKeyChange_val_ptr_ptr)
+ && (NULL != *usmDHUserPrivKeyChange_val_ptr_ptr));
+ netsnmp_assert(NULL != usmDHUserPrivKeyChange_val_ptr_len_ptr);
+
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserPrivKeyChange_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the usmDHUserPrivKeyChange data.
+ * copy (* usmDHUserPrivKeyChange_val_ptr_ptr ) data and (* usmDHUserPrivKeyChange_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ if (!rowreq_ctx || !usmDHUserPrivKeyChange_val_ptr_len_ptr ||
+ !usmDHUserPrivKeyChange_val_ptr_ptr ||
+ !*usmDHUserPrivKeyChange_val_ptr_ptr) {
+ return MFD_ERROR;
+ }
+
+ return usmDHGetUserKeyChange(rowreq_ctx->data, 0,
+ usmDHUserPrivKeyChange_val_ptr_ptr,
+ usmDHUserPrivKeyChange_val_ptr_len_ptr);
+} /* usmDHUserPrivKeyChange_get */
+
+/*---------------------------------------------------------------------
+ * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyEntry.usmDHUserOwnPrivKeyChange
+ * usmDHUserOwnPrivKeyChange is subid 4 of usmDHUserKeyEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.3.101.1.1.2.1.4
+ * Description:
+The object used to change the agent's own Privacy Key using a
+ Diffie-Hellman key exchange.
+
+ The right-most n bits of the shared secret 'sk', where 'n' is the
+ number of bits required for the protocol defined by
+ usmUserPrivProtocol, are installed as the operational privacy key
+ for this row after a successful SET.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ *
+ * Its syntax is DHKeyChange (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length.
+ */
+/**
+ * Extract the current value of the usmDHUserOwnPrivKeyChange data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param usmDHUserOwnPrivKeyChange_val_ptr_ptr
+ * Pointer to storage for a char variable
+ * @param usmDHUserOwnPrivKeyChange_val_ptr_len_ptr
+ * Pointer to a size_t. On entry, it will contain the size (in bytes)
+ * pointed to by usmDHUserOwnPrivKeyChange.
+ * On exit, this value should contain the data size (in bytes).
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+*
+ * @note If you need more than (*usmDHUserOwnPrivKeyChange_val_ptr_len_ptr) bytes of memory,
+ * allocate it using malloc() and update usmDHUserOwnPrivKeyChange_val_ptr_ptr.
+ * <b>DO NOT</b> free the previous pointer.
+ * The MFD helper will release the memory you allocate.
+ *
+ * @remark If you call this function yourself, you are responsible
+ * for checking if the pointer changed, and freeing any
+ * previously allocated memory. (Not necessary if you pass
+ * in a pointer to static memory, obviously.)
+ */
+int
+usmDHUserOwnPrivKeyChange_get(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx,
+ char **usmDHUserOwnPrivKeyChange_val_ptr_ptr,
+ size_t
+ *usmDHUserOwnPrivKeyChange_val_ptr_len_ptr)
+{
+ /** we should have a non-NULL pointer and enough storage */
+ netsnmp_assert((NULL != usmDHUserOwnPrivKeyChange_val_ptr_ptr)
+ && (NULL != *usmDHUserOwnPrivKeyChange_val_ptr_ptr));
+ netsnmp_assert(NULL != usmDHUserOwnPrivKeyChange_val_ptr_len_ptr);
+
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserOwnPrivKeyChange_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the usmDHUserOwnPrivKeyChange data.
+ * copy (* usmDHUserOwnPrivKeyChange_val_ptr_ptr ) data and (* usmDHUserOwnPrivKeyChange_val_ptr_len_ptr ) from rowreq_ctx->data
+ */
+ if (!rowreq_ctx || !usmDHUserOwnPrivKeyChange_val_ptr_len_ptr ||
+ !usmDHUserOwnPrivKeyChange_val_ptr_ptr ||
+ !*usmDHUserOwnPrivKeyChange_val_ptr_ptr) {
+ return MFD_ERROR;
+ }
+
+ return usmDHGetUserKeyChange(rowreq_ctx->data, 0,
+ usmDHUserOwnPrivKeyChange_val_ptr_ptr,
+ usmDHUserOwnPrivKeyChange_val_ptr_len_ptr);
+} /* usmDHUserOwnPrivKeyChange_get */
+
+
+
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_get.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_get.h
new file mode 100644
index 0000000000..bf85bdfa55
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_get.h
@@ -0,0 +1,99 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.20 $ of : mfd-data-get.m2c,v $
+ *
+ * $Id: usmDHUserKeyTable_data_get.h 13774 2005-12-01 21:31:52Z rstory $
+ *
+ * @file usmDHUserKeyTable_data_get.h
+ *
+ * @addtogroup get
+ *
+ * Prototypes for get functions
+ *
+ * @{
+ */
+#ifndef USMDHUSERKEYTABLE_DATA_GET_H
+#define USMDHUSERKEYTABLE_DATA_GET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+#ifdef NEED_USMDH_FUNCTIONS
+ int usmDHGetUserKeyChange(struct usmUser *user,
+ int for_auth_key, char **keyobj,
+ size_t *keyobj_len);
+ DH *usmDHGetUserDHptr(struct usmUser *user,
+ int for_auth_key);
+#endif
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table usmDHUserKeyTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyTable is subid 2 of usmDHPublicObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.3.101.1.1.2, length: 9
+ */
+ /*
+ * indexes
+ */
+
+ int usmDHUserAuthKeyChange_get(usmDHUserKeyTable_rowreq_ctx
+ * rowreq_ctx, char
+ **usmDHUserAuthKeyChange_val_ptr_ptr, size_t
+ *usmDHUserAuthKeyChange_val_ptr_len_ptr);
+ int
+ usmDHUserOwnAuthKeyChange_get(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx, char
+ **usmDHUserOwnAuthKeyChange_val_ptr_ptr, size_t
+ *usmDHUserOwnAuthKeyChange_val_ptr_len_ptr);
+ int usmDHUserPrivKeyChange_get(usmDHUserKeyTable_rowreq_ctx
+ * rowreq_ctx, char
+ **usmDHUserPrivKeyChange_val_ptr_ptr, size_t
+ *usmDHUserPrivKeyChange_val_ptr_len_ptr);
+ int
+ usmDHUserOwnPrivKeyChange_get(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx, char
+ **usmDHUserOwnPrivKeyChange_val_ptr_ptr, size_t
+ *usmDHUserOwnPrivKeyChange_val_ptr_len_ptr);
+
+
+ int
+ usmDHUserKeyTable_indexes_set_tbl_idx(usmDHUserKeyTable_mib_index *
+ tbl_idx, char
+ *usmUserEngineID_val_ptr, size_t
+ usmUserEngineID_val_ptr_len,
+ char *usmUserName_val_ptr,
+ size_t
+ usmUserName_val_ptr_len);
+ int
+ usmDHUserKeyTable_indexes_set(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx,
+ char *usmUserEngineID_val_ptr,
+ size_t usmUserEngineID_val_ptr_len,
+ char *usmUserName_val_ptr,
+ size_t usmUserName_val_ptr_len);
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* USMDHUSERKEYTABLE_DATA_GET_H */
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_set.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_set.c
new file mode 100644
index 0000000000..1940e19071
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_set.c
@@ -0,0 +1,1279 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.19 $ of : mfd-data-set.m2c,v $
+ *
+ * $Id: usmDHUserKeyTable_data_set.c 14169 2006-01-25 16:28:12Z dts12 $
+ *
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include <openssl/dh.h>
+
+/*
+ * include our parent header
+ */
+#define NEED_USMDH_FUNCTIONS
+#include "usmDHUserKeyTable.h"
+
+int
+usmDHUserCheckValue(struct usmUser *user, int for_auth_key,
+ char *val, size_t val_len)
+{
+ /*
+ * The set value must be composed of 2 parts, the first being the
+ * current value
+ */
+ char *current_value;
+ size_t current_value_len;
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserCheckValue",
+ "called\n"));
+ usmDHGetUserKeyChange(user, for_auth_key,
+ &current_value, &current_value_len);
+
+ if (!current_value)
+ return MFD_ERROR;
+
+ if (val_len != current_value_len * 2)
+ return MFD_NOT_VALID_NOW;
+
+ if (memcmp(current_value, val, current_value_len) != 0)
+ return SNMP_ERR_WRONGVALUE; /* mandated error string */
+
+ return MFD_SUCCESS;
+}
+
+int
+usmDHSetKey(struct usmUser *user, int for_auth_key,
+ char *val, size_t val_len)
+{
+ DH *dh;
+ BIGNUM *other_pub;
+ char *key;
+ size_t key_len;
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHSetKey", "called\n"));
+ /*
+ * XXX: mem leaks on errors abound
+ */
+
+ dh = usmDHGetUserDHptr(user, for_auth_key);
+ if (!dh)
+ return MFD_ERROR;
+
+ other_pub = BN_bin2bn(val + val_len / 2, val_len / 2, NULL);
+ if (!other_pub)
+ return MFD_ERROR;
+
+ /*
+ * Set the new key for a user
+ */
+ key_len = DH_size(dh);
+ key = malloc(DH_size(dh));
+ if (!key)
+ return MFD_ERROR;
+
+ if (DH_compute_key(key, other_pub, dh)) {
+ u_char **replkey;
+ size_t replkey_size;
+
+ if (for_auth_key) {
+ replkey_size = user->authKeyLen;
+ replkey = &user->authKey;
+ } else {
+ replkey_size = user->privKeyLen;
+ replkey = &user->privKey;
+ }
+
+ /*
+ * is it large enough?
+ */
+ if (key_len < replkey_size)
+ return MFD_ERROR;
+
+ /*
+ * copy right most bits, per the object requirements
+ */
+ SNMP_FREE(*replkey);
+ memdup(replkey, key + key_len - replkey_size, replkey_size);
+
+ return MFD_SUCCESS;
+ }
+
+ return MFD_ERROR;
+}
+
+/** @ingroup data_access
+ * @defgroup data_set data_set: Routines to set data
+ *
+ * These routines are used to set the value for individual objects. The
+ * row context is passed, along with the new value.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table usmDHUserKeyTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyTable is subid 2 of usmDHPublicObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.3.101.1.1.2, length: 9
+ */
+ /*
+ * NOTE: if you update this chart, please update the versions in
+ * local/mib2c-conf.d/parent-set.m2i
+ * agent/mibgroup/helpers/baby_steps.c
+ * while you're at it.
+ */
+ /*
+ ***********************************************************************
+ * Baby Steps Flow Chart (2004.06.05) *
+ * *
+ * +--------------+ +================+ U = unconditional path *
+ * |optional state| ||required state|| S = path for success *
+ * +--------------+ +================+ E = path for error *
+ ***********************************************************************
+ *
+ * +--------------+
+ * | pre |
+ * | request |
+ * +--------------+
+ * | U
+ * +==============+
+ * +----------------|| object ||
+ * | E || lookup ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | E || check ||
+ * |<---------------|| values ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | +<-------|| undo ||
+ * | | E || setup ||
+ * | | +==============+
+ * | | | S
+ * | | +==============+
+ * | | || set ||-------------------------->+
+ * | | || value || E |
+ * | | +==============+ |
+ * | | | S |
+ * | | +--------------+ |
+ * | | | check |-------------------------->|
+ * | | | consistency | E |
+ * | | +--------------+ |
+ * | | | S |
+ * | | +==============+ +==============+ |
+ * | | || commit ||-------->|| undo || |
+ * | | || || E || commit || |
+ * | | +==============+ +==============+ |
+ * | | | S U |<--------+
+ * | | +--------------+ +==============+
+ * | | | irreversible | || undo ||
+ * | | | commit | || set ||
+ * | | +--------------+ +==============+
+ * | | | U U |
+ * | +-------------->|<------------------------+
+ * | +==============+
+ * | || undo ||
+ * | || cleanup ||
+ * | +==============+
+ * +---------------------->| U
+ * +--------------+
+ * | post |
+ * | request |
+ * +--------------+
+ *
+ */
+
+/**
+ * Setup up context with information needed to undo a set request.
+ *
+ * This function will be called before the individual node undo setup
+ * functions are called. If you need to do any undo setup that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that the undo context has been allocated with
+ * usmDHUserKeyTable_allocate_data(), but may need extra
+ * initialization similar to what you may have done in
+ * usmDHUserKeyTable_rowreq_ctx_init().
+ * Note that an individual node's undo_setup function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in the node's undo_setup
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (usmDHUserKeyTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+usmDHUserKeyTable_undo_setup(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_undo_setup",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ /*
+ * TODO:451:M: |-> Setup usmDHUserKeyTable undo.
+ * set up usmDHUserKeyTable undo information, in preparation for a set.
+ * Undo storage is in (* usmDHUserOwnPrivKeyChange_val_ptr_ptr )*
+ */
+
+ return rc;
+} /* usmDHUserKeyTable_undo_setup */
+
+/**
+ * Undo a set request.
+ *
+ * This function will be called before the individual node undo
+ * functions are called. If you need to do any undo that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that an individual node's undo function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is anything specific to a particular column (e.g. releasing
+ * memory for a string), you should do that setup in the node's undo
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (usmDHUserKeyTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+usmDHUserKeyTable_undo(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_undo",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> usmDHUserKeyTable undo.
+ * usmDHUserKeyTable undo information, in response to a failed set.
+ * Undo storage is in (* usmDHUserOwnPrivKeyChange_val_ptr_ptr )*
+ */
+
+ return rc;
+} /* usmDHUserKeyTable_undo_setup */
+
+/**
+ * Cleanup up context undo information.
+ *
+ * This function will be called after set/commit processing. If you
+ * allocated any resources in undo_setup, this is the place to release
+ * those resources.
+ *
+ * This function is called regardless of the success or failure of the set
+ * request. If you need to perform different steps for cleanup depending
+ * on success or failure, you can add a flag to the rowreq_ctx.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (usmDHUserKeyTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+usmDHUserKeyTable_undo_cleanup(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_undo_cleanup",
+ "called\n"));
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:452:M: |-> Cleanup usmDHUserKeyTable undo.
+ * Undo storage is in (* usmDHUserOwnPrivKeyChange_val_ptr_ptr )*
+ */
+
+ return rc;
+} /* usmDHUserKeyTable_undo_cleanup */
+
+/**
+ * commit new values.
+ *
+ * At this point, you should have done everything you can to ensure that
+ * this commit will not fail.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * usmDHUserKeyTable_oids.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+usmDHUserKeyTable_commit(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+ int save_flags;
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_commit",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * nothing to do; we wait for the irreversible commit
+ */
+
+ /*
+ * if we successfully commited this row, set the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY;
+ }
+
+ return rc;
+} /* usmDHUserKeyTable_commit */
+
+/**
+ * undo commit new values.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * usmDHUserKeyTable_oids.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+usmDHUserKeyTable_undo_commit(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_undo_commit",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:485:M: |-> Undo usmDHUserKeyTable commit.
+ * check the column's flag in rowreq_ctx->column_set_flags to see
+ * if it was set during commit, then undo it.
+ *
+ * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
+ */
+
+
+ /*
+ * if we successfully un-commited this row, clear the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return rc;
+} /* usmDHUserKeyTable_undo_commit */
+
+/**
+ * perform commit actions that are not reversible
+ *
+ * THERE IS NO ATTEMPT AT RECOVERY FOR ERRORS FROM THIS STATE!
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : other error
+ */
+int
+usmDHUserKeyTable_irreversible_commit(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ struct usmUser *user;
+ int flags;
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_irreversible_commit", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:495:o: Irreversible usmDHUserKeyTable commit.
+ */
+ user = rowreq_ctx->data;
+ flags = rowreq_ctx->column_set_flags;
+
+ if (flags & COLUMN_USMDHUSERAUTHKEYCHANGE_FLAG ||
+ flags & COLUMN_USMDHUSEROWNAUTHKEYCHANGE_FLAG) {
+ /*
+ * free the keychange objects so they reset to new values
+ */
+ DH_free(user->usmDHUserAuthKeyChange);
+ user->usmDHUserAuthKeyChange = NULL;
+ }
+
+ if (flags & COLUMN_USMDHUSERPRIVKEYCHANGE_FLAG ||
+ flags & COLUMN_USMDHUSEROWNPRIVKEYCHANGE_FLAG) {
+ /*
+ * free the keychange objects so they reset to new values
+ */
+ DH_free(user->usmDHUserPrivKeyChange);
+ user->usmDHUserPrivKeyChange = NULL;
+ }
+
+ return MFD_SUCCESS;
+} /* usmDHUserKeyTable_irreversible_commit */
+
+/*
+ * TODO:440:M: Implement usmDHUserKeyTable node value checks.
+ * TODO:450:M: Implement usmDHUserKeyTable undo functions.
+ * TODO:460:M: Implement usmDHUserKeyTable set functions.
+ * TODO:480:M: Implement usmDHUserKeyTable commit functions.
+ */
+/*---------------------------------------------------------------------
+ * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyEntry.usmDHUserAuthKeyChange
+ * usmDHUserAuthKeyChange is subid 1 of usmDHUserKeyEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.3.101.1.1.2.1.1
+ * Description:
+The object used to change any given user's Authentication Key
+ using a Diffie-Hellman key exchange.
+
+ The right-most n bits of the shared secret 'sk', where 'n' is the
+ number of bits required for the protocol defined by
+ usmUserAuthProtocol, are installed as the operational
+ authentication key for this row after a successful SET.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ *
+ * Its syntax is DHKeyChange (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length.
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param usmDHUserAuthKeyChange_val_ptr
+ * A char containing the new value.
+ * @param usmDHUserAuthKeyChange_val_ptr_len
+ * The size (in bytes) of the data pointed to by usmDHUserAuthKeyChange_val_ptr
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * Since you aren't using a generated data context, you also need to
+ * check the length, to make sure you don't overflow your storage space.
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * usmDHUserKeyTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_OCTET_STR
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+usmDHUserAuthKeyChange_check_value(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx,
+ char *usmDHUserAuthKeyChange_val_ptr,
+ size_t
+ usmDHUserAuthKeyChange_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserAuthKeyChange_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert(NULL != usmDHUserAuthKeyChange_val_ptr);
+
+ /*
+ * TODO:441:o: |-> Check for valid usmDHUserAuthKeyChange value.
+ */
+ return usmDHUserCheckValue(rowreq_ctx->data, 1,
+ usmDHUserAuthKeyChange_val_ptr,
+ usmDHUserAuthKeyChange_val_ptr_len);
+} /* usmDHUserAuthKeyChange_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (usmDHUserKeyTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * usmDHUserKeyTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+usmDHUserAuthKeyChange_undo_setup(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ struct usmUser *undouser;
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserAuthKeyChange_undo_setup", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup usmDHUserAuthKeyChange undo.
+ */
+ /*
+ * copy usmDHUserAuthKeyChange and usmDHUserAuthKeyChange_len data
+ * set rowreq_ctx->undo->usmDHUserAuthKeyChange from rowreq_ctx->data->usmDHUserAuthKeyChange
+ */
+ undouser = rowreq_ctx->undo;
+
+ undouser->authKeyLen = rowreq_ctx->data->authKeyLen;
+ memdup(&undouser->authKey, rowreq_ctx->data->authKey,
+ rowreq_ctx->data->authKeyLen);
+
+ return MFD_SUCCESS;
+} /* usmDHUserAuthKeyChange_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param usmDHUserAuthKeyChange_val_ptr
+ * A char containing the new value.
+ * @param usmDHUserAuthKeyChange_val_ptr_len
+ * The size (in bytes) of the data pointed to by usmDHUserAuthKeyChange_val_ptr
+ */
+int
+usmDHUserAuthKeyChange_set(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx,
+ char *usmDHUserAuthKeyChange_val_ptr,
+ size_t usmDHUserAuthKeyChange_val_ptr_len)
+{
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserAuthKeyChange_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert(NULL != usmDHUserAuthKeyChange_val_ptr);
+
+ /*
+ * TODO:461:M: |-> Set usmDHUserAuthKeyChange value.
+ * set usmDHUserAuthKeyChange value in rowreq_ctx->data
+ */
+ usmDHSetKey(rowreq_ctx->data, 1,
+ usmDHUserAuthKeyChange_val_ptr,
+ usmDHUserAuthKeyChange_val_ptr_len);
+
+ return MFD_SUCCESS;
+} /* usmDHUserAuthKeyChange_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+usmDHUserAuthKeyChange_undo(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx)
+{
+ struct usmUser *undouser;
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserAuthKeyChange_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up usmDHUserAuthKeyChange undo.
+ */
+ /*
+ * copy usmDHUserAuthKeyChange and usmDHUserAuthKeyChange_len data
+ * set rowreq_ctx->data->usmDHUserAuthKeyChange from rowreq_ctx->undo->usmDHUserAuthKeyChange
+ */
+ undouser = rowreq_ctx->undo;
+
+ undouser->authKeyLen = rowreq_ctx->data->authKeyLen;
+ SNMP_FREE(rowreq_ctx->data->authKey);
+ rowreq_ctx->data->authKey = undouser->authKey;
+ undouser->authKey = NULL;
+
+ return MFD_SUCCESS;
+} /* usmDHUserAuthKeyChange_undo */
+
+/*---------------------------------------------------------------------
+ * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyEntry.usmDHUserOwnAuthKeyChange
+ * usmDHUserOwnAuthKeyChange is subid 2 of usmDHUserKeyEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.3.101.1.1.2.1.2
+ * Description:
+The object used to change the agents own Authentication Key
+ using a Diffie-Hellman key exchange.
+
+ The right-most n bits of the shared secret 'sk', where 'n' is the
+ number of bits required for the protocol defined by
+ usmUserAuthProtocol, are installed as the operational
+ authentication key for this row after a successful SET.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ *
+ * Its syntax is DHKeyChange (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length.
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param usmDHUserOwnAuthKeyChange_val_ptr
+ * A char containing the new value.
+ * @param usmDHUserOwnAuthKeyChange_val_ptr_len
+ * The size (in bytes) of the data pointed to by usmDHUserOwnAuthKeyChange_val_ptr
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * Since you aren't using a generated data context, you also need to
+ * check the length, to make sure you don't overflow your storage space.
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * usmDHUserKeyTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_OCTET_STR
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+usmDHUserOwnAuthKeyChange_check_value(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx, char
+ *usmDHUserOwnAuthKeyChange_val_ptr, size_t
+ usmDHUserOwnAuthKeyChange_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserOwnAuthKeyChange_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert(NULL != usmDHUserOwnAuthKeyChange_val_ptr);
+
+ /*
+ * TODO:441:o: |-> Check for valid usmDHUserOwnAuthKeyChange value.
+ */
+ return
+ usmDHUserAuthKeyChange_check_value(rowreq_ctx,
+ usmDHUserOwnAuthKeyChange_val_ptr,
+ usmDHUserOwnAuthKeyChange_val_ptr_len);
+} /* usmDHUserOwnAuthKeyChange_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (usmDHUserKeyTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * usmDHUserKeyTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+usmDHUserOwnAuthKeyChange_undo_setup(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserOwnAuthKeyChange_undo_setup", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup usmDHUserOwnAuthKeyChange undo.
+ */
+ /*
+ * copy usmDHUserOwnAuthKeyChange and usmDHUserOwnAuthKeyChange_len data
+ * set rowreq_ctx->undo->usmDHUserOwnAuthKeyChange from rowreq_ctx->data->usmDHUserOwnAuthKeyChange
+ */
+ return usmDHUserAuthKeyChange_undo_setup(rowreq_ctx);
+} /* usmDHUserOwnAuthKeyChange_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param usmDHUserOwnAuthKeyChange_val_ptr
+ * A char containing the new value.
+ * @param usmDHUserOwnAuthKeyChange_val_ptr_len
+ * The size (in bytes) of the data pointed to by usmDHUserOwnAuthKeyChange_val_ptr
+ */
+int
+usmDHUserOwnAuthKeyChange_set(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx,
+ char *usmDHUserOwnAuthKeyChange_val_ptr,
+ size_t usmDHUserOwnAuthKeyChange_val_ptr_len)
+{
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserOwnAuthKeyChange_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert(NULL != usmDHUserOwnAuthKeyChange_val_ptr);
+
+ /*
+ * TODO:461:M: |-> Set usmDHUserOwnAuthKeyChange value.
+ * set usmDHUserOwnAuthKeyChange value in rowreq_ctx->data
+ */
+ return usmDHUserAuthKeyChange_set(rowreq_ctx,
+ usmDHUserOwnAuthKeyChange_val_ptr,
+ usmDHUserOwnAuthKeyChange_val_ptr_len);
+} /* usmDHUserOwnAuthKeyChange_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+usmDHUserOwnAuthKeyChange_undo(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserOwnAuthKeyChange_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up usmDHUserOwnAuthKeyChange undo.
+ */
+ /*
+ * copy usmDHUserOwnAuthKeyChange and usmDHUserOwnAuthKeyChange_len data
+ * set rowreq_ctx->data->usmDHUserOwnAuthKeyChange from rowreq_ctx->undo->usmDHUserOwnAuthKeyChange
+ */
+ return usmDHUserAuthKeyChange_undo(rowreq_ctx);
+} /* usmDHUserOwnAuthKeyChange_undo */
+
+/*---------------------------------------------------------------------
+ * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyEntry.usmDHUserPrivKeyChange
+ * usmDHUserPrivKeyChange is subid 3 of usmDHUserKeyEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.3.101.1.1.2.1.3
+ * Description:
+The object used to change any given user's Privacy Key using
+ a Diffie-Hellman key exchange.
+
+ The right-most n bits of the shared secret 'sk', where 'n' is the
+ number of bits required for the protocol defined by
+ usmUserPrivProtocol, are installed as the operational privacy key
+ for this row after a successful SET.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ *
+ * Its syntax is DHKeyChange (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length.
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param usmDHUserPrivKeyChange_val_ptr
+ * A char containing the new value.
+ * @param usmDHUserPrivKeyChange_val_ptr_len
+ * The size (in bytes) of the data pointed to by usmDHUserPrivKeyChange_val_ptr
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * Since you aren't using a generated data context, you also need to
+ * check the length, to make sure you don't overflow your storage space.
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * usmDHUserKeyTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_OCTET_STR
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+usmDHUserPrivKeyChange_check_value(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx,
+ char *usmDHUserPrivKeyChange_val_ptr,
+ size_t
+ usmDHUserPrivKeyChange_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserPrivKeyChange_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert(NULL != usmDHUserPrivKeyChange_val_ptr);
+
+ /*
+ * TODO:441:o: |-> Check for valid usmDHUserPrivKeyChange value.
+ */
+ return usmDHUserCheckValue(rowreq_ctx->data, 0,
+ usmDHUserPrivKeyChange_val_ptr,
+ usmDHUserPrivKeyChange_val_ptr_len);
+} /* usmDHUserPrivKeyChange_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (usmDHUserKeyTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * usmDHUserKeyTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+usmDHUserPrivKeyChange_undo_setup(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ struct usmUser *undouser;
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserPrivKeyChange_undo_setup", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup usmDHUserPrivKeyChange undo.
+ */
+ /*
+ * copy usmDHUserPrivKeyChange and usmDHUserPrivKeyChange_len data
+ * set rowreq_ctx->undo->usmDHUserPrivKeyChange from rowreq_ctx->data->usmDHUserPrivKeyChange
+ */
+ undouser = rowreq_ctx->undo;
+
+ undouser->privKeyLen = rowreq_ctx->data->privKeyLen;
+ memdup(&undouser->privKey, rowreq_ctx->data->privKey,
+ rowreq_ctx->data->privKeyLen);
+
+ return MFD_SUCCESS;
+} /* usmDHUserPrivKeyChange_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param usmDHUserPrivKeyChange_val_ptr
+ * A char containing the new value.
+ * @param usmDHUserPrivKeyChange_val_ptr_len
+ * The size (in bytes) of the data pointed to by usmDHUserPrivKeyChange_val_ptr
+ */
+int
+usmDHUserPrivKeyChange_set(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx,
+ char *usmDHUserPrivKeyChange_val_ptr,
+ size_t usmDHUserPrivKeyChange_val_ptr_len)
+{
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserPrivKeyChange_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert(NULL != usmDHUserPrivKeyChange_val_ptr);
+
+ /*
+ * TODO:461:M: |-> Set usmDHUserPrivKeyChange value.
+ * set usmDHUserPrivKeyChange value in rowreq_ctx->data
+ */
+ usmDHSetKey(rowreq_ctx->data, 0,
+ usmDHUserPrivKeyChange_val_ptr,
+ usmDHUserPrivKeyChange_val_ptr_len);
+
+ return MFD_SUCCESS;
+} /* usmDHUserPrivKeyChange_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+usmDHUserPrivKeyChange_undo(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx)
+{
+ struct usmUser *undouser;
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserPrivKeyChange_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up usmDHUserPrivKeyChange undo.
+ */
+ /*
+ * copy usmDHUserPrivKeyChange and usmDHUserPrivKeyChange_len data
+ * set rowreq_ctx->data->usmDHUserPrivKeyChange from rowreq_ctx->undo->usmDHUserPrivKeyChange
+ */
+ undouser = rowreq_ctx->undo;
+
+ /** uncopy priv key */
+ undouser->privKeyLen = rowreq_ctx->data->privKeyLen;
+ SNMP_FREE(rowreq_ctx->data->privKey);
+ rowreq_ctx->data->privKey = undouser->privKey;
+ undouser->privKey = NULL;
+
+ return MFD_SUCCESS;
+} /* usmDHUserPrivKeyChange_undo */
+
+/*---------------------------------------------------------------------
+ * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyEntry.usmDHUserOwnPrivKeyChange
+ * usmDHUserOwnPrivKeyChange is subid 4 of usmDHUserKeyEntry.
+ * Its status is Current, and its access level is Create.
+ * OID: .1.3.6.1.3.101.1.1.2.1.4
+ * Description:
+The object used to change the agent's own Privacy Key using a
+ Diffie-Hellman key exchange.
+
+ The right-most n bits of the shared secret 'sk', where 'n' is the
+ number of bits required for the protocol defined by
+ usmUserPrivProtocol, are installed as the operational privacy key
+ for this row after a successful SET.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ *
+ * Its syntax is DHKeyChange (based on perltype OCTETSTR)
+ * The net-snmp type is ASN_OCTET_STR. The C type decl is char (char)
+ * This data type requires a length.
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param usmDHUserOwnPrivKeyChange_val_ptr
+ * A char containing the new value.
+ * @param usmDHUserOwnPrivKeyChange_val_ptr_len
+ * The size (in bytes) of the data pointed to by usmDHUserOwnPrivKeyChange_val_ptr
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * Since you aren't using a generated data context, you also need to
+ * check the length, to make sure you don't overflow your storage space.
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * usmDHUserKeyTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_OCTET_STR
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+usmDHUserOwnPrivKeyChange_check_value(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx, char
+ *usmDHUserOwnPrivKeyChange_val_ptr, size_t
+ usmDHUserOwnPrivKeyChange_val_ptr_len)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserOwnPrivKeyChange_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert(NULL != usmDHUserOwnPrivKeyChange_val_ptr);
+
+ /*
+ * TODO:441:o: |-> Check for valid usmDHUserOwnPrivKeyChange value.
+ */
+ return
+ usmDHUserPrivKeyChange_check_value(rowreq_ctx,
+ usmDHUserOwnPrivKeyChange_val_ptr,
+ usmDHUserOwnPrivKeyChange_val_ptr_len);
+} /* usmDHUserOwnPrivKeyChange_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (usmDHUserKeyTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * usmDHUserKeyTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+usmDHUserOwnPrivKeyChange_undo_setup(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserOwnPrivKeyChange_undo_setup", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup usmDHUserOwnPrivKeyChange undo.
+ */
+ /*
+ * copy usmDHUserOwnPrivKeyChange and usmDHUserOwnPrivKeyChange_len data
+ * set rowreq_ctx->undo->usmDHUserOwnPrivKeyChange from rowreq_ctx->data->usmDHUserOwnPrivKeyChange
+ */
+ return usmDHUserPrivKeyChange_undo_setup(rowreq_ctx);
+} /* usmDHUserOwnPrivKeyChange_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param usmDHUserOwnPrivKeyChange_val_ptr
+ * A char containing the new value.
+ * @param usmDHUserOwnPrivKeyChange_val_ptr_len
+ * The size (in bytes) of the data pointed to by usmDHUserOwnPrivKeyChange_val_ptr
+ */
+int
+usmDHUserOwnPrivKeyChange_set(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx,
+ char *usmDHUserOwnPrivKeyChange_val_ptr,
+ size_t usmDHUserOwnPrivKeyChange_val_ptr_len)
+{
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserOwnPrivKeyChange_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert(NULL != usmDHUserOwnPrivKeyChange_val_ptr);
+
+ /*
+ * TODO:461:M: |-> Set usmDHUserOwnPrivKeyChange value.
+ * set usmDHUserOwnPrivKeyChange value in rowreq_ctx->data
+ */
+ return usmDHUserPrivKeyChange_set(rowreq_ctx,
+ usmDHUserOwnPrivKeyChange_val_ptr,
+ usmDHUserOwnPrivKeyChange_val_ptr_len);
+} /* usmDHUserOwnPrivKeyChange_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+usmDHUserOwnPrivKeyChange_undo(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserOwnPrivKeyChange_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up usmDHUserOwnPrivKeyChange undo.
+ */
+ /*
+ * copy usmDHUserOwnPrivKeyChange and usmDHUserOwnPrivKeyChange_len data
+ * set rowreq_ctx->data->usmDHUserOwnPrivKeyChange from rowreq_ctx->undo->usmDHUserOwnPrivKeyChange
+ */
+ return usmDHUserPrivKeyChange_undo(rowreq_ctx);
+} /* usmDHUserOwnPrivKeyChange_undo */
+
+/**
+ * check dependencies
+ *
+ * This is useful for for tables which have dependencies between columns
+ * (or rows, or tables). For example, two columns allocating a percentage
+ * of something add up 100%.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * usmDHUserKeyTable_oids.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @retval MFD_SUCCESS all the changes to the row are legal
+ * @retval MFD_ERROR one or more changes are not legal
+ *
+ * (see README-table-usmDHUserKeyTable if you don't have dependencies)
+ */
+int
+usmDHUserKeyTable_check_dependencies(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+ int flags;
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:usmDHUserKeyTable_check_dependencies", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:470:o: Check usmDHUserKeyTable row dependencies.
+ * check that all new value are legal and consistent with each other
+ */
+ flags = rowreq_ctx->column_set_flags;
+
+ if (flags & COLUMN_USMDHUSERAUTHKEYCHANGE_FLAG &&
+ flags & COLUMN_USMDHUSEROWNAUTHKEYCHANGE_FLAG) {
+ return MFD_ERROR;
+ }
+
+ if (flags & COLUMN_USMDHUSERPRIVKEYCHANGE_FLAG &&
+ flags & COLUMN_USMDHUSEROWNPRIVKEYCHANGE_FLAG) {
+ return MFD_ERROR;
+ }
+
+ return rc;
+} /* usmDHUserKeyTable_check_dependencies */
+
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_set.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_set.h
new file mode 100644
index 0000000000..5ca48bb3b2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_data_set.h
@@ -0,0 +1,130 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.19 $ of : mfd-data-set.m2c,v $
+ *
+ * $Id: usmDHUserKeyTable_data_set.h 13774 2005-12-01 21:31:52Z rstory $
+ */
+#ifndef USMDHUSERKEYTABLE_DATA_SET_H
+#define USMDHUSERKEYTABLE_DATA_SET_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ *********************************************************************
+ * SET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * SET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table usmDHUserKeyTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyTable is subid 2 of usmDHPublicObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.3.101.1.1.2, length: 9
+ */
+
+
+ int
+ usmDHUserKeyTable_undo_setup(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+ usmDHUserKeyTable_undo_cleanup(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+ int usmDHUserKeyTable_undo(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+ int usmDHUserKeyTable_commit(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+ usmDHUserKeyTable_undo_commit(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+ usmDHUserKeyTable_irreversible_commit(usmDHUserKeyTable_rowreq_ctx
+ * rowreq_ctx);
+
+
+ int
+ usmDHUserAuthKeyChange_check_value(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx, char
+ *usmDHUserAuthKeyChange_val_ptr, size_t
+ usmDHUserAuthKeyChange_val_ptr_len);
+ int
+ usmDHUserAuthKeyChange_undo_setup(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+ int usmDHUserAuthKeyChange_set(usmDHUserKeyTable_rowreq_ctx
+ * rowreq_ctx, char
+ *usmDHUserAuthKeyChange_val_ptr, size_t
+ usmDHUserAuthKeyChange_val_ptr_len);
+ int
+ usmDHUserAuthKeyChange_undo(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ usmDHUserOwnAuthKeyChange_check_value(usmDHUserKeyTable_rowreq_ctx
+ * rowreq_ctx, char
+ *usmDHUserOwnAuthKeyChange_val_ptr, size_t
+ usmDHUserOwnAuthKeyChange_val_ptr_len);
+ int
+ usmDHUserOwnAuthKeyChange_undo_setup(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+ usmDHUserOwnAuthKeyChange_set(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx, char
+ *usmDHUserOwnAuthKeyChange_val_ptr, size_t
+ usmDHUserOwnAuthKeyChange_val_ptr_len);
+ int
+ usmDHUserOwnAuthKeyChange_undo(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ usmDHUserPrivKeyChange_check_value(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx, char
+ *usmDHUserPrivKeyChange_val_ptr, size_t
+ usmDHUserPrivKeyChange_val_ptr_len);
+ int
+ usmDHUserPrivKeyChange_undo_setup(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+ int usmDHUserPrivKeyChange_set(usmDHUserKeyTable_rowreq_ctx
+ * rowreq_ctx, char
+ *usmDHUserPrivKeyChange_val_ptr, size_t
+ usmDHUserPrivKeyChange_val_ptr_len);
+ int
+ usmDHUserPrivKeyChange_undo(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+ usmDHUserOwnPrivKeyChange_check_value(usmDHUserKeyTable_rowreq_ctx
+ * rowreq_ctx, char
+ *usmDHUserOwnPrivKeyChange_val_ptr, size_t
+ usmDHUserOwnPrivKeyChange_val_ptr_len);
+ int
+ usmDHUserOwnPrivKeyChange_undo_setup(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+ usmDHUserOwnPrivKeyChange_set(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx, char
+ *usmDHUserOwnPrivKeyChange_val_ptr, size_t
+ usmDHUserOwnPrivKeyChange_val_ptr_len);
+ int
+ usmDHUserOwnPrivKeyChange_undo(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+ int
+ usmDHUserKeyTable_check_dependencies(usmDHUserKeyTable_rowreq_ctx *
+ ctx);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* USMDHUSERKEYTABLE_DATA_SET_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_doxygen.conf b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_doxygen.conf
new file mode 100644
index 0000000000..93d7ef18b8
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_doxygen.conf
@@ -0,0 +1,51 @@
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = usmDHUserKeyTable
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = 0.1
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = docs
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT = .
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+FILE_PATTERNS = *.c *.h
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_enums.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_enums.h
new file mode 100644
index 0000000000..8c2c6d5357
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_enums.h
@@ -0,0 +1,39 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-enums.m2c,v 1.4 2005/07/15 22:41:16 rstory Exp $
+ *
+ * $Id: usmDHUserKeyTable_enums.h 13774 2005-12-01 21:31:52Z rstory $
+ */
+#ifndef USMDHUSERKEYTABLE_ENUMS_H
+#define USMDHUSERKEYTABLE_ENUMS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * NOTES on enums
+ * ==============
+ *
+ * Value Mapping
+ * -------------
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them
+ * below. For example, a boolean flag (1/0) is usually represented
+ * as a TruthValue in a MIB, which maps to the values (1/2).
+ *
+ */
+/*************************************************************************
+ *************************************************************************
+ *
+ * enum definitions for table usmDHUserKeyTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* USMDHUSERKEYTABLE_ENUMS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_interface.c
new file mode 100644
index 0000000000..75e0e850ab
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_interface.c
@@ -0,0 +1,1772 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: usmDHUserKeyTable_interface.c 15015 2006-08-17 15:06:43Z rstory $
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "usmDHUserKeyTable.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "usmDHUserKeyTable_interface.h"
+
+#include <ctype.h>
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table usmDHUserKeyTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * SNMP-USM-DH-OBJECTS-MIB::usmDHUserKeyTable is subid 2 of usmDHPublicObjects.
+ * Its status is Current.
+ * OID: .1.3.6.1.3.101.1.1.2, length: 9
+ */
+typedef struct usmDHUserKeyTable_interface_ctx_s {
+
+ netsnmp_container *container;
+ netsnmp_cache *cache;
+
+ usmDHUserKeyTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+ u_int table_dirty;
+
+} usmDHUserKeyTable_interface_ctx;
+
+static usmDHUserKeyTable_interface_ctx usmDHUserKeyTable_if_ctx;
+
+static void
+_usmDHUserKeyTable_container_init(usmDHUserKeyTable_interface_ctx *
+ if_ctx);
+static void
+_usmDHUserKeyTable_container_shutdown(usmDHUserKeyTable_interface_ctx *
+ if_ctx);
+
+
+netsnmp_container *
+usmDHUserKeyTable_container_get(void)
+{
+ return usmDHUserKeyTable_if_ctx.container;
+}
+
+usmDHUserKeyTable_registration *
+usmDHUserKeyTable_registration_get(void)
+{
+ return usmDHUserKeyTable_if_ctx.user_ctx;
+}
+
+usmDHUserKeyTable_registration *
+usmDHUserKeyTable_registration_set(usmDHUserKeyTable_registration * newreg)
+{
+ usmDHUserKeyTable_registration *old =
+ usmDHUserKeyTable_if_ctx.user_ctx;
+ usmDHUserKeyTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+
+int
+usmDHUserKeyTable_container_size(void)
+{
+ return CONTAINER_SIZE(usmDHUserKeyTable_if_ctx.container);
+}
+
+u_int
+usmDHUserKeyTable_dirty_get(void)
+{
+ return usmDHUserKeyTable_if_ctx.table_dirty;
+}
+
+void
+usmDHUserKeyTable_dirty_set(u_int status)
+{
+ DEBUGMSGTL(("usmDHUserKeyTable:usmDHUserKeyTable_dirty_set",
+ "called. was %d, now %d\n",
+ usmDHUserKeyTable_if_ctx.table_dirty, status));
+ usmDHUserKeyTable_if_ctx.table_dirty = status;
+}
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_usmDHUserKeyTable_pre_request;
+static Netsnmp_Node_Handler _mfd_usmDHUserKeyTable_post_request;
+static Netsnmp_Node_Handler _mfd_usmDHUserKeyTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_usmDHUserKeyTable_get_values;
+static Netsnmp_Node_Handler _mfd_usmDHUserKeyTable_check_objects;
+static Netsnmp_Node_Handler _mfd_usmDHUserKeyTable_undo_setup;
+static Netsnmp_Node_Handler _mfd_usmDHUserKeyTable_set_values;
+static Netsnmp_Node_Handler _mfd_usmDHUserKeyTable_undo_cleanup;
+static Netsnmp_Node_Handler _mfd_usmDHUserKeyTable_undo_values;
+static Netsnmp_Node_Handler _mfd_usmDHUserKeyTable_commit;
+static Netsnmp_Node_Handler _mfd_usmDHUserKeyTable_irreversible_commit;
+static Netsnmp_Node_Handler _mfd_usmDHUserKeyTable_undo_commit;
+static Netsnmp_Node_Handler _mfd_usmDHUserKeyTable_check_dependencies;
+
+NETSNMP_STATIC_INLINE int
+_usmDHUserKeyTable_undo_column(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var,
+ int column);
+
+/**
+ * @internal
+ * Initialize the table usmDHUserKeyTable
+ * (Define its contents and how it's structured)
+ */
+void
+_usmDHUserKeyTable_initialize_interface(usmDHUserKeyTable_registration *
+ reg_ptr, u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &usmDHUserKeyTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info =
+ &usmDHUserKeyTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_usmDHUserKeyTable_initialize_interface", "called\n"));
+
+
+ /*************************************************
+ *
+ * save interface context for usmDHUserKeyTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_OCTET_STR,
+ /** index: usmUserEngineID */
+ ASN_OCTET_STR,
+ /** index: usmUserName */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrival.
+ */
+ tbl_info->min_column = USMDHUSERKEYTABLE_MIN_COL;
+ tbl_info->max_column = USMDHUSERKEYTABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ usmDHUserKeyTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ usmDHUserKeyTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _usmDHUserKeyTable_container_init(&usmDHUserKeyTable_if_ctx);
+ if (NULL == usmDHUserKeyTable_if_ctx.container) {
+ snmp_log(LOG_ERR,
+ "could not initialize container for usmDHUserKeyTable\n");
+ return;
+ }
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup =
+ _mfd_usmDHUserKeyTable_object_lookup;
+ access_multiplexer->get_values = _mfd_usmDHUserKeyTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request = _mfd_usmDHUserKeyTable_pre_request;
+ access_multiplexer->post_request = _mfd_usmDHUserKeyTable_post_request;
+
+
+ /*
+ * REQUIRED wrappers for set request handling
+ */
+ access_multiplexer->object_syntax_checks =
+ _mfd_usmDHUserKeyTable_check_objects;
+ access_multiplexer->undo_setup = _mfd_usmDHUserKeyTable_undo_setup;
+ access_multiplexer->undo_cleanup = _mfd_usmDHUserKeyTable_undo_cleanup;
+ access_multiplexer->set_values = _mfd_usmDHUserKeyTable_set_values;
+ access_multiplexer->undo_sets = _mfd_usmDHUserKeyTable_undo_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->commit = _mfd_usmDHUserKeyTable_commit;
+ access_multiplexer->undo_commit = _mfd_usmDHUserKeyTable_undo_commit;
+ access_multiplexer->irreversible_commit =
+ _mfd_usmDHUserKeyTable_irreversible_commit;
+
+ /*
+ * REQUIRED for tables with dependencies
+ */
+ access_multiplexer->consistency_checks =
+ _mfd_usmDHUserKeyTable_check_dependencies;
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("usmDHUserKeyTable:init_usmDHUserKeyTable",
+ "Registering usmDHUserKeyTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("usmDHUserKeyTable", handler,
+ usmDHUserKeyTable_oid,
+ usmDHUserKeyTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RWRITE);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR, "error registering table usmDHUserKeyTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &usmDHUserKeyTable_if_ctx;
+
+ /*************************************************
+ *
+ * set up baby steps handler, create it and inject it
+ */
+ if (access_multiplexer->object_lookup)
+ mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
+ if (access_multiplexer->set_values)
+ mfd_modes |= BABY_STEP_SET_VALUES;
+ if (access_multiplexer->irreversible_commit)
+ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
+ if (access_multiplexer->object_syntax_checks)
+ mfd_modes |= BABY_STEP_CHECK_OBJECT;
+
+ if (access_multiplexer->pre_request)
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if (access_multiplexer->post_request)
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+ if (access_multiplexer->undo_setup)
+ mfd_modes |= BABY_STEP_UNDO_SETUP;
+ if (access_multiplexer->undo_cleanup)
+ mfd_modes |= BABY_STEP_UNDO_CLEANUP;
+ if (access_multiplexer->undo_sets)
+ mfd_modes |= BABY_STEP_UNDO_SETS;
+
+ if (access_multiplexer->row_creation)
+ mfd_modes |= BABY_STEP_ROW_CREATE;
+ if (access_multiplexer->consistency_checks)
+ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
+ if (access_multiplexer->commit)
+ mfd_modes |= BABY_STEP_COMMIT;
+ if (access_multiplexer->undo_commit)
+ mfd_modes |= BABY_STEP_UNDO_COMMIT;
+
+ handler = netsnmp_baby_steps_handler_get(mfd_modes);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
+ */
+ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler =
+ netsnmp_container_table_handler_get(tbl_info,
+ usmDHUserKeyTable_if_ctx.
+ container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject cache helper
+ */
+ if (NULL != usmDHUserKeyTable_if_ctx.cache) {
+ handler =
+ netsnmp_cache_handler_get(usmDHUserKeyTable_if_ctx.cache);
+ netsnmp_inject_handler(reginfo, handler);
+ }
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+} /* _usmDHUserKeyTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table usmDHUserKeyTable
+ */
+void
+_usmDHUserKeyTable_shutdown_interface(usmDHUserKeyTable_registration *
+ reg_ptr)
+{
+ /*
+ * shutdown the container
+ */
+ _usmDHUserKeyTable_container_shutdown(&usmDHUserKeyTable_if_ctx);
+}
+
+void
+usmDHUserKeyTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ usmDHUserKeyTable_if_ctx.tbl_info.valid_columns = vc;
+} /* usmDHUserKeyTable_valid_columns_set */
+
+/**
+ * @internal
+ * convert the index component stored in the context to an oid
+ */
+int
+usmDHUserKeyTable_index_to_oid(netsnmp_index * oid_idx,
+ usmDHUserKeyTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * usmUserEngineID(1)/SnmpEngineID/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_usmUserEngineID;
+ /*
+ * usmUserName(2)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_usmUserName;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_usmUserEngineID, 0x00, sizeof(var_usmUserEngineID));
+ var_usmUserEngineID.type = ASN_OCTET_STR;
+ memset(&var_usmUserName, 0x00, sizeof(var_usmUserName));
+ var_usmUserName.type = ASN_OCTET_STR;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_usmUserEngineID.next_variable = &var_usmUserName;
+ var_usmUserName.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_index_to_oid",
+ "called\n"));
+
+ /*
+ * usmUserEngineID(1)/SnmpEngineID/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_usmUserEngineID,
+ (u_char *) & mib_idx->usmUserEngineID,
+ mib_idx->usmUserEngineID_len *
+ sizeof(mib_idx->usmUserEngineID[0]));
+
+ /*
+ * usmUserName(2)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H
+ */
+ snmp_set_var_value(&var_usmUserName, (u_char *) & mib_idx->usmUserName,
+ mib_idx->usmUserName_len *
+ sizeof(mib_idx->usmUserName[0]));
+
+
+ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
+ NULL, 0, &var_usmUserEngineID);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_usmUserEngineID);
+
+ return err;
+} /* usmDHUserKeyTable_index_to_oid */
+
+/**
+ * extract usmDHUserKeyTable indexes from a netsnmp_index
+ *
+ * @retval SNMP_ERR_NOERROR : no error
+ * @retval SNMP_ERR_GENERR : error
+ */
+int
+usmDHUserKeyTable_index_from_oid(netsnmp_index * oid_idx,
+ usmDHUserKeyTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * usmUserEngineID(1)/SnmpEngineID/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_usmUserEngineID;
+ /*
+ * usmUserName(2)/SnmpAdminString/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_usmUserName;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_usmUserEngineID, 0x00, sizeof(var_usmUserEngineID));
+ var_usmUserEngineID.type = ASN_OCTET_STR;
+ memset(&var_usmUserName, 0x00, sizeof(var_usmUserName));
+ var_usmUserName.type = ASN_OCTET_STR;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_usmUserEngineID.next_variable = &var_usmUserName;
+ var_usmUserName.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:usmDHUserKeyTable:usmDHUserKeyTable_index_from_oid", "called\n"));
+
+ /*
+ * parse the oid into the individual index components
+ */
+ err = parse_oid_indexes(oid_idx->oids, oid_idx->len,
+ &var_usmUserEngineID);
+ if (err == SNMP_ERR_NOERROR) {
+ /*
+ * copy out values
+ */
+ /*
+ * NOTE: val_len is in bytes, usmUserEngineID_len might not be
+ */
+ if (var_usmUserEngineID.val_len > sizeof(mib_idx->usmUserEngineID))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->usmUserEngineID,
+ var_usmUserEngineID.val.string,
+ var_usmUserEngineID.val_len);
+ mib_idx->usmUserEngineID_len =
+ var_usmUserEngineID.val_len /
+ sizeof(mib_idx->usmUserEngineID[0]);
+ }
+ /*
+ * NOTE: val_len is in bytes, usmUserName_len might not be
+ */
+ if (var_usmUserName.val_len > sizeof(mib_idx->usmUserName))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->usmUserName, var_usmUserName.val.string,
+ var_usmUserName.val_len);
+ mib_idx->usmUserName_len =
+ var_usmUserName.val_len / sizeof(mib_idx->usmUserName[0]);
+ }
+
+
+ }
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_usmUserEngineID);
+
+ return err;
+} /* usmDHUserKeyTable_index_from_oid */
+
+
+/*
+ *********************************************************************
+ * @internal
+ * allocate resources for a usmDHUserKeyTable_rowreq_ctx
+ */
+usmDHUserKeyTable_rowreq_ctx *
+usmDHUserKeyTable_allocate_rowreq_ctx(usmDHUserKeyTable_data * data,
+ void *user_init_ctx)
+{
+ usmDHUserKeyTable_rowreq_ctx *rowreq_ctx =
+ SNMP_MALLOC_TYPEDEF(usmDHUserKeyTable_rowreq_ctx);
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:usmDHUserKeyTable_allocate_rowreq_ctx", "called\n"));
+
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "Couldn't allocate memory for a "
+ "usmDHUserKeyTable_rowreq_ctx.\n");
+ return NULL;
+ } else {
+ if (NULL != data) {
+ /*
+ * track if we got data from user
+ */
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DATA_FROM_USER;
+ rowreq_ctx->data = data;
+ } else if (NULL ==
+ (rowreq_ctx->data =
+ usmDHUserKeyTable_allocate_data())) {
+ SNMP_FREE(rowreq_ctx);
+ return NULL;
+ }
+ }
+
+ /*
+ * undo context will be allocated when needed (in *_undo_setup)
+ */
+
+ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
+
+ rowreq_ctx->usmDHUserKeyTable_data_list = NULL;
+
+ /*
+ * if we allocated data, call init routine
+ */
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) {
+ if (SNMPERR_SUCCESS !=
+ usmDHUserKeyTable_rowreq_ctx_init(rowreq_ctx, user_init_ctx)) {
+ usmDHUserKeyTable_release_rowreq_ctx(rowreq_ctx);
+ rowreq_ctx = NULL;
+ }
+ }
+
+ return rowreq_ctx;
+} /* usmDHUserKeyTable_allocate_rowreq_ctx */
+
+/*
+ * @internal
+ * release resources for a usmDHUserKeyTable_rowreq_ctx
+ */
+void
+usmDHUserKeyTable_release_rowreq_ctx(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:usmDHUserKeyTable_release_rowreq_ctx", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ usmDHUserKeyTable_rowreq_ctx_cleanup(rowreq_ctx);
+
+ /*
+ * for non-transient data, don't free data we got from the user
+ */
+ if ((rowreq_ctx->data) &&
+ !(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER))
+ usmDHUserKeyTable_release_data(rowreq_ctx->data);
+
+ if (rowreq_ctx->undo) {
+ usmDHUserKeyTable_release_data(rowreq_ctx->undo);
+ rowreq_ctx->undo = NULL;
+ }
+
+ /*
+ * free index oid pointer
+ */
+ if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp)
+ free(rowreq_ctx->oid_idx.oids);
+
+ SNMP_FREE(rowreq_ctx);
+} /* usmDHUserKeyTable_release_rowreq_ctx */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_usmDHUserKeyTable_pre_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_mfd_usmDHUserKeyTable_pre_request", "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:usmDHUserKeyTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = usmDHUserKeyTable_pre_request(usmDHUserKeyTable_if_ctx.user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("usmDHUserKeyTable", "error %d from "
+ "usmDHUserKeyTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_usmDHUserKeyTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_usmDHUserKeyTable_post_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ usmDHUserKeyTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_mfd_usmDHUserKeyTable_post_request", "called\n"));
+
+ /*
+ * release row context, if deleted
+ */
+ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
+ usmDHUserKeyTable_release_rowreq_ctx(rowreq_ctx);
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:usmDHUserKeyTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ if ((MFD_SUCCESS != packet_rc) && usmDHUserKeyTable_dirty_get()) {
+ /*
+ * we shouldn't get here. the undo steps should also clear
+ * the dirty flags.
+ */
+ snmp_log(LOG_WARNING,
+ "usmDHUserKeyTable dirty flag set in post_request "
+ "but status != SUCCESS.\n");
+ }
+
+ rc = usmDHUserKeyTable_post_request(usmDHUserKeyTable_if_ctx.user_ctx,
+ packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("usmDHUserKeyTable", "error %d from "
+ "usmDHUserKeyTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_usmDHUserKeyTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_usmDHUserKeyTable_object_lookup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = SNMP_ERR_NOERROR;
+ usmDHUserKeyTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_mfd_usmDHUserKeyTable_object_lookup", "called\n"));
+
+ /*
+ * get our context from mfd
+ * usmDHUserKeyTable_interface_ctx *if_ctx =
+ * (usmDHUserKeyTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if (NULL == rowreq_ctx) {
+ rc = SNMP_ERR_NOCREATION;
+ }
+
+ if (MFD_SUCCESS != rc)
+ netsnmp_request_set_error_all(requests, rc);
+ else
+ usmDHUserKeyTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_usmDHUserKeyTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_usmDHUserKeyTable_get_column(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_mfd_usmDHUserKeyTable_get_column", "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * usmDHUserAuthKeyChange(1)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSERAUTHKEYCHANGE:
+ var->type = ASN_OCTET_STR;
+ rc = usmDHUserAuthKeyChange_get(rowreq_ctx,
+ (char **) &var->val.string,
+ &var->val_len);
+ break;
+
+ /*
+ * usmDHUserOwnAuthKeyChange(2)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSEROWNAUTHKEYCHANGE:
+ var->type = ASN_OCTET_STR;
+ rc = usmDHUserOwnAuthKeyChange_get(rowreq_ctx,
+ (char **) &var->val.string,
+ &var->val_len);
+ break;
+
+ /*
+ * usmDHUserPrivKeyChange(3)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSERPRIVKEYCHANGE:
+ var->type = ASN_OCTET_STR;
+ rc = usmDHUserPrivKeyChange_get(rowreq_ctx,
+ (char **) &var->val.string,
+ &var->val_len);
+ break;
+
+ /*
+ * usmDHUserOwnPrivKeyChange(4)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSEROWNPRIVKEYCHANGE:
+ var->type = ASN_OCTET_STR;
+ rc = usmDHUserOwnPrivKeyChange_get(rowreq_ctx,
+ (char **) &var->val.string,
+ &var->val_len);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _usmDHUserKeyTable_get_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _usmDHUserKeyTable_get_column */
+
+int
+_mfd_usmDHUserKeyTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ usmDHUserKeyTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ u_char *old_string;
+ void (*dataFreeHook) (void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_mfd_usmDHUserKeyTable_get_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+ /*
+ * save old pointer, so we can free it if replaced
+ */
+ old_string = requests->requestvb->val.string;
+ dataFreeHook = requests->requestvb->dataFreeHook;
+ if (NULL == requests->requestvb->val.string) {
+ requests->requestvb->val.string = requests->requestvb->buf;
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ } else if (requests->requestvb->buf ==
+ requests->requestvb->val.string) {
+ if (requests->requestvb->val_len !=
+ sizeof(requests->requestvb->buf))
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ }
+
+ /*
+ * get column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _usmDHUserKeyTable_get_column(rowreq_ctx, requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ if (MFD_SKIP == rc) {
+ requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+ rc = SNMP_ERR_NOERROR;
+ }
+ } else if (NULL == requests->requestvb->val.string) {
+ snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
+ rc = SNMP_ERR_GENERR;
+ }
+ if (rc)
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+
+ /*
+ * if the buffer wasn't used previously for the old data (i.e. it
+ * was allcoated memory) and the get routine replaced the pointer,
+ * we need to free the previous pointer.
+ */
+ if (old_string && (old_string != requests->requestvb->buf) &&
+ (requests->requestvb->val.string != old_string)) {
+ if (dataFreeHook)
+ (*dataFreeHook) (old_string);
+ else
+ free(old_string);
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_usmDHUserKeyTable_get_values */
+
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Syntax checks
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check the syntax for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_usmDHUserKeyTable_check_column(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_usmDHUserKeyTable_check_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * usmDHUserAuthKeyChange(1)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSERAUTHKEYCHANGE:
+ rc = netsnmp_check_vb_type(var, ASN_OCTET_STR);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("usmDHUserKeyTable:_usmDHUserKeyTable_check_column:usmDHUserAuthKeyChange", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = usmDHUserAuthKeyChange_check_value(rowreq_ctx,
+ (char *) var->val.
+ string, var->val_len);
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from usmDHUserAuthKeyChange_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * usmDHUserOwnAuthKeyChange(2)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSEROWNAUTHKEYCHANGE:
+ rc = netsnmp_check_vb_type(var, ASN_OCTET_STR);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("usmDHUserKeyTable:_usmDHUserKeyTable_check_column:usmDHUserOwnAuthKeyChange", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = usmDHUserOwnAuthKeyChange_check_value(rowreq_ctx,
+ (char *) var->val.
+ string,
+ var->val_len);
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from usmDHUserOwnAuthKeyChange_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * usmDHUserPrivKeyChange(3)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSERPRIVKEYCHANGE:
+ rc = netsnmp_check_vb_type(var, ASN_OCTET_STR);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("usmDHUserKeyTable:_usmDHUserKeyTable_check_column:usmDHUserPrivKeyChange", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = usmDHUserPrivKeyChange_check_value(rowreq_ctx,
+ (char *) var->val.
+ string, var->val_len);
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from usmDHUserPrivKeyChange_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * usmDHUserOwnPrivKeyChange(4)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSEROWNPRIVKEYCHANGE:
+ rc = netsnmp_check_vb_type(var, ASN_OCTET_STR);
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("usmDHUserKeyTable:_usmDHUserKeyTable_check_column:usmDHUserOwnPrivKeyChange", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = usmDHUserOwnPrivKeyChange_check_value(rowreq_ctx,
+ (char *) var->val.
+ string,
+ var->val_len);
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from usmDHUserOwnPrivKeyChange_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ default: /** We shouldn't get here */
+ rc = SNMP_ERR_GENERR;
+ snmp_log(LOG_ERR,
+ "unknown column %d in _usmDHUserKeyTable_check_column\n",
+ column);
+ }
+
+ return rc;
+} /* _usmDHUserKeyTable_check_column */
+
+int
+_mfd_usmDHUserKeyTable_check_objects(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ usmDHUserKeyTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc;
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_mfd_usmDHUserKeyTable_check_objects", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+
+ /*
+ * get column number from table request info, and check that column
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _usmDHUserKeyTable_check_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+ break;
+ }
+
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_usmDHUserKeyTable_check_objects */
+
+
+/*----------------------------------------------------------------------
+ *
+ * SET: check dependencies
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check dependencies wrapper
+ */
+static int
+_mfd_usmDHUserKeyTable_check_dependencies(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ usmDHUserKeyTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_mfd_usmDHUserKeyTable_check_dependencies", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = usmDHUserKeyTable_check_dependencies(rowreq_ctx);
+ if (rc) {
+ DEBUGMSGTL(("usmDHUserKeyTable:mfd", "error %d from "
+ "usmDHUserKeyTable_check_dependencies\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_usmDHUserKeyTable_check_dependencies */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo setup
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_usmDHUserKeyTable_undo_setup_column(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_usmDHUserKeyTable_undo_setup_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * usmDHUserAuthKeyChange(1)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSERAUTHKEYCHANGE:
+ rowreq_ctx->column_set_flags |= COLUMN_USMDHUSERAUTHKEYCHANGE_FLAG;
+ rc = usmDHUserAuthKeyChange_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * usmDHUserOwnAuthKeyChange(2)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSEROWNAUTHKEYCHANGE:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_USMDHUSEROWNAUTHKEYCHANGE_FLAG;
+ rc = usmDHUserOwnAuthKeyChange_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * usmDHUserPrivKeyChange(3)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSERPRIVKEYCHANGE:
+ rowreq_ctx->column_set_flags |= COLUMN_USMDHUSERPRIVKEYCHANGE_FLAG;
+ rc = usmDHUserPrivKeyChange_undo_setup(rowreq_ctx);
+ break;
+
+ /*
+ * usmDHUserOwnPrivKeyChange(4)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSEROWNPRIVKEYCHANGE:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_USMDHUSEROWNPRIVKEYCHANGE_FLAG;
+ rc = usmDHUserOwnPrivKeyChange_undo_setup(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _usmDHUserKeyTable_undo_setup_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _usmDHUserKeyTable_undo_setup_column */
+
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_usmDHUserKeyTable_undo_setup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ usmDHUserKeyTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_mfd_usmDHUserKeyTable_undo_setup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * allocate undo context
+ */
+ rowreq_ctx->undo = usmDHUserKeyTable_allocate_data();
+ if (NULL == rowreq_ctx->undo) {
+ /** msg already logged */
+ netsnmp_request_set_error_all(requests,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * row undo setup
+ */
+ rowreq_ctx->column_set_flags = 0;
+ rc = usmDHUserKeyTable_undo_setup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("usmDHUserKeyTable:mfd", "error %d from "
+ "usmDHUserKeyTable_undo_setup\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ } else {
+ /*
+ * column undo setup
+ */
+ netsnmp_table_request_info *tri;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _usmDHUserKeyTable_undo_setup_column(rowreq_ctx,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("usmDHUserKeyTable:mfd", "error %d from "
+ "usmDHUserKeyTable_undo_setup_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_usmDHUserKeyTable_undo_setup */
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_usmDHUserKeyTable_undo_cleanup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ usmDHUserKeyTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc;
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_mfd_usmDHUserKeyTable_undo_cleanup", "called\n"));
+
+ /*
+ * failed row create in early stages has no rowreq_ctx
+ */
+ if (NULL == rowreq_ctx)
+ return MFD_SUCCESS;
+
+ /*
+ * call user cleanup
+ */
+ rc = usmDHUserKeyTable_undo_cleanup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("usmDHUserKeyTable:mfd", "error %d from "
+ "usmDHUserKeyTable_undo_cleanup\n", rc));
+ }
+
+ /*
+ * release undo context, if needed
+ */
+ if (rowreq_ctx->undo) {
+ usmDHUserKeyTable_release_data(rowreq_ctx->undo);
+ rowreq_ctx->undo = NULL;
+ }
+
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_usmDHUserKeyTable_undo_cleanup */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Set values
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_usmDHUserKeyTable_set_column(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_usmDHUserKeyTable_set_column",
+ "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * usmDHUserAuthKeyChange(1)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSERAUTHKEYCHANGE:
+ rowreq_ctx->column_set_flags |= COLUMN_USMDHUSERAUTHKEYCHANGE_FLAG;
+ rc = usmDHUserAuthKeyChange_set(rowreq_ctx,
+ (char *) var->val.string,
+ var->val_len);
+ break;
+
+ /*
+ * usmDHUserOwnAuthKeyChange(2)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSEROWNAUTHKEYCHANGE:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_USMDHUSEROWNAUTHKEYCHANGE_FLAG;
+ rc = usmDHUserOwnAuthKeyChange_set(rowreq_ctx,
+ (char *) var->val.string,
+ var->val_len);
+ break;
+
+ /*
+ * usmDHUserPrivKeyChange(3)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSERPRIVKEYCHANGE:
+ rowreq_ctx->column_set_flags |= COLUMN_USMDHUSERPRIVKEYCHANGE_FLAG;
+ rc = usmDHUserPrivKeyChange_set(rowreq_ctx,
+ (char *) var->val.string,
+ var->val_len);
+ break;
+
+ /*
+ * usmDHUserOwnPrivKeyChange(4)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSEROWNPRIVKEYCHANGE:
+ rowreq_ctx->column_set_flags |=
+ COLUMN_USMDHUSEROWNPRIVKEYCHANGE_FLAG;
+ rc = usmDHUserOwnPrivKeyChange_set(rowreq_ctx,
+ (char *) var->val.string,
+ var->val_len);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _usmDHUserKeyTable_set_column\n",
+ column);
+ rc = SNMP_ERR_GENERR;
+ break;
+ }
+
+ return rc;
+} /* _usmDHUserKeyTable_set_column */
+
+int
+_mfd_usmDHUserKeyTable_set_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ usmDHUserKeyTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc = SNMP_ERR_NOERROR;
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_mfd_usmDHUserKeyTable_set_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rowreq_ctx->column_set_flags = 0;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _usmDHUserKeyTable_set_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("usmDHUserKeyTable:mfd", "error %d from "
+ "usmDHUserKeyTable_set_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_usmDHUserKeyTable_set_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit the values
+ */
+int
+_mfd_usmDHUserKeyTable_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ usmDHUserKeyTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_mfd_usmDHUserKeyTable_commit",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = usmDHUserKeyTable_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("usmDHUserKeyTable:mfd", "error %d from "
+ "usmDHUserKeyTable_commit\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ /*
+ * if we successfully commited this row, set the dirty flag. Use the
+ * current value + 1 (i.e. dirty = # rows changed).
+ * this is checked in post_request...
+ */
+ usmDHUserKeyTable_dirty_set(usmDHUserKeyTable_dirty_get() + 1); /* set table dirty flag */
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+_mfd_usmDHUserKeyTable_undo_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ usmDHUserKeyTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_mfd_usmDHUserKeyTable_undo_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ u_int d = usmDHUserKeyTable_dirty_get();
+
+ netsnmp_assert(d != 0);
+ if (d)
+ usmDHUserKeyTable_dirty_set(d - 1);
+ }
+
+ rc = usmDHUserKeyTable_undo_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("usmDHUserKeyTable:mfd", "error %d from "
+ "usmDHUserKeyTable_undo_commit\n", rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ snmp_log(LOG_WARNING,
+ "usmDHUserKeyTable row dirty flag still set after undo_commit\n");
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_usmDHUserKeyTable_commit */
+
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * undo the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_usmDHUserKeyTable_undo_column(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_usmDHUserKeyTable_undo_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * usmDHUserAuthKeyChange(1)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSERAUTHKEYCHANGE:
+ rc = usmDHUserAuthKeyChange_undo(rowreq_ctx);
+ break;
+
+ /*
+ * usmDHUserOwnAuthKeyChange(2)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSEROWNAUTHKEYCHANGE:
+ rc = usmDHUserOwnAuthKeyChange_undo(rowreq_ctx);
+ break;
+
+ /*
+ * usmDHUserPrivKeyChange(3)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSERPRIVKEYCHANGE:
+ rc = usmDHUserPrivKeyChange_undo(rowreq_ctx);
+ break;
+
+ /*
+ * usmDHUserOwnPrivKeyChange(4)/DHKeyChange/ASN_OCTET_STR/char(char)//L/A/W/e/r/d/h
+ */
+ case COLUMN_USMDHUSEROWNPRIVKEYCHANGE:
+ rc = usmDHUserOwnPrivKeyChange_undo(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _usmDHUserKeyTable_undo_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _usmDHUserKeyTable_undo_column */
+
+int
+_mfd_usmDHUserKeyTable_undo_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ usmDHUserKeyTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_mfd_usmDHUserKeyTable_undo_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = usmDHUserKeyTable_undo(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("usmDHUserKeyTable:mfd", "error %d from "
+ "usmDHUserKeyTable_undo\n", rc));
+ }
+
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _usmDHUserKeyTable_undo_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("usmDHUserKeyTable:mfd", "error %d from "
+ "usmDHUserKeyTable_undo_column\n", rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_usmDHUserKeyTable_undo_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: irreversible commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit irreversible actions
+ */
+int
+_mfd_usmDHUserKeyTable_irreversible_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ usmDHUserKeyTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_mfd_usmDHUserKeyTable_irreversible:commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = usmDHUserKeyTable_irreversible_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ netsnmp_request_set_error_all(requests, SNMP_ERR_COMMITFAILED);
+ DEBUGMSGTL(("usmDHUserKeyTable:mfd", "error %d from "
+ "usmDHUserKeyTable_irreversible_commit\n", rc));
+ }
+
+ /*
+ * check for and handle row creation/deletion
+ * and update column exist flags...
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) {
+ CONTAINER_REMOVE(usmDHUserKeyTable_if_ctx.container, rowreq_ctx);
+ } else {
+ if (rowreq_ctx->column_set_flags) {
+ rowreq_ctx->column_set_flags = 0;
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_usmDHUserKeyTable_irreversible_commit */
+
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+static void _container_free(netsnmp_container * container);
+
+/**
+ * @internal
+ */
+static int
+_cache_load(netsnmp_cache * cache, void *vmagic)
+{
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_cache_load", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache for usmDHUserKeyTable_cache_load\n");
+ return -1;
+ }
+
+ /** should only be called for an invalid or expired cache */
+ netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
+
+ /*
+ * call user code
+ */
+ return usmDHUserKeyTable_container_load((netsnmp_container *) cache->
+ magic);
+} /* _cache_load */
+
+/**
+ * @internal
+ */
+static void
+_cache_free(netsnmp_cache * cache, void *magic)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_cache_free", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache in usmDHUserKeyTable_cache_free\n");
+ return;
+ }
+
+ container = (netsnmp_container *) cache->magic;
+
+ _container_free(container);
+} /* _cache_free */
+
+/**
+ * @internal
+ */
+static void
+_container_item_free(usmDHUserKeyTable_rowreq_ctx * rowreq_ctx,
+ void *context)
+{
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_container_item_free",
+ "called\n"));
+
+ if (NULL == rowreq_ctx)
+ return;
+
+ usmDHUserKeyTable_release_rowreq_ctx(rowreq_ctx);
+} /* _container_item_free */
+
+/**
+ * @internal
+ */
+static void
+_container_free(netsnmp_container * container)
+{
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_container_free", "called\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container in usmDHUserKeyTable_container_free\n");
+ return;
+ }
+
+ /*
+ * call user code
+ */
+ usmDHUserKeyTable_container_free(container);
+
+ /*
+ * free all items. inefficient, but easy.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func *) _container_item_free,
+ NULL);
+} /* _container_free */
+
+/**
+ * @internal
+ * initialize the container with functions or wrappers
+ */
+void
+_usmDHUserKeyTable_container_init(usmDHUserKeyTable_interface_ctx * if_ctx)
+{
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_usmDHUserKeyTable_container_init", "called\n"));
+
+ /*
+ * cache init
+ */
+ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */
+ _cache_load, _cache_free,
+ usmDHUserKeyTable_oid,
+ usmDHUserKeyTable_oid_size);
+
+ if (NULL == if_ctx->cache) {
+ snmp_log(LOG_ERR, "error creating cache for usmDHUserKeyTable\n");
+ return;
+ }
+
+ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
+
+ usmDHUserKeyTable_container_init(&if_ctx->container, if_ctx->cache);
+ if (NULL == if_ctx->container)
+ if_ctx->container =
+ netsnmp_container_find("usmDHUserKeyTable:table_container");
+ if (NULL == if_ctx->container) {
+ snmp_log(LOG_ERR, "error creating container in "
+ "usmDHUserKeyTable_container_init\n");
+ return;
+ }
+
+ if (NULL != if_ctx->cache)
+ if_ctx->cache->magic = (void *) if_ctx->container;
+} /* _usmDHUserKeyTable_container_init */
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+_usmDHUserKeyTable_container_shutdown(usmDHUserKeyTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:usmDHUserKeyTable:_usmDHUserKeyTable_container_shutdown", "called\n"));
+
+ usmDHUserKeyTable_container_shutdown(if_ctx->container);
+
+ _container_free(if_ctx->container);
+
+} /* _usmDHUserKeyTable_container_shutdown */
+
+
+usmDHUserKeyTable_rowreq_ctx *
+usmDHUserKeyTable_row_find_by_mib_index(usmDHUserKeyTable_mib_index *
+ mib_idx)
+{
+ usmDHUserKeyTable_rowreq_ctx *rowreq_ctx;
+ oid oid_tmp[MAX_OID_LEN];
+ netsnmp_index oid_idx;
+ int rc;
+
+ /*
+ * set up storage for OID
+ */
+ oid_idx.oids = oid_tmp;
+ oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
+
+ /*
+ * convert
+ */
+ rc = usmDHUserKeyTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx =
+ CONTAINER_FIND(usmDHUserKeyTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_interface.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_interface.h
new file mode 100644
index 0000000000..e55bce140e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_interface.h
@@ -0,0 +1,102 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: usmDHUserKeyTable_interface.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** @ingroup interface Routines to interface to Net-SNMP
+ *
+ * \warning This code should not be modified, called directly,
+ * or used to interpret functionality. It is subject to
+ * change at any time.
+ *
+ * @{
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+#ifndef USMDHUSERKEYTABLE_INTERFACE_H
+#define USMDHUSERKEYTABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "usmDHUserKeyTable.h"
+
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void
+ _usmDHUserKeyTable_initialize_interface
+ (usmDHUserKeyTable_registration * user_ctx, u_long flags);
+ void
+ _usmDHUserKeyTable_shutdown_interface
+ (usmDHUserKeyTable_registration * user_ctx);
+
+ usmDHUserKeyTable_registration
+ *usmDHUserKeyTable_registration_get(void);
+
+ usmDHUserKeyTable_registration
+ *usmDHUserKeyTable_registration_set(usmDHUserKeyTable_registration
+ * newreg);
+
+ netsnmp_container *usmDHUserKeyTable_container_get(void);
+ int usmDHUserKeyTable_container_size(void);
+
+ u_int usmDHUserKeyTable_dirty_get(void);
+ void usmDHUserKeyTable_dirty_set(u_int status);
+
+ usmDHUserKeyTable_rowreq_ctx
+ *usmDHUserKeyTable_allocate_rowreq_ctx(usmDHUserKeyTable_data *,
+ void *);
+ void
+ usmDHUserKeyTable_release_rowreq_ctx(usmDHUserKeyTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int usmDHUserKeyTable_index_to_oid(netsnmp_index * oid_idx,
+ usmDHUserKeyTable_mib_index
+ * mib_idx);
+ int usmDHUserKeyTable_index_from_oid(netsnmp_index *
+ oid_idx,
+ usmDHUserKeyTable_mib_index
+ * mib_idx);
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void usmDHUserKeyTable_valid_columns_set(netsnmp_column_info
+ *vc);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* USMDHUSERKEYTABLE_INTERFACE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_oids.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_oids.h
new file mode 100644
index 0000000000..48f351f84a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmp-usm-dh-objects-mib/usmDHUserKeyTable/usmDHUserKeyTable_oids.h
@@ -0,0 +1,46 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-oids.m2c,v 1.14 2005/09/27 15:56:08 rstory Exp $
+ *
+ * $Id: usmDHUserKeyTable_oids.h 13774 2005-12-01 21:31:52Z rstory $
+ */
+#ifndef USMDHUSERKEYTABLE_OIDS_H
+#define USMDHUSERKEYTABLE_OIDS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ * column number definitions for table usmDHUserKeyTable
+ */
+#define USMDHUSERKEYTABLE_OID 1,3,6,1,3,101,1,1,2
+
+#define COLUMN_USMDHUSERAUTHKEYCHANGE 1
+#define COLUMN_USMDHUSERAUTHKEYCHANGE_FLAG (0x1 << 0)
+
+#define COLUMN_USMDHUSEROWNAUTHKEYCHANGE 2
+#define COLUMN_USMDHUSEROWNAUTHKEYCHANGE_FLAG (0x1 << 1)
+
+#define COLUMN_USMDHUSERPRIVKEYCHANGE 3
+#define COLUMN_USMDHUSERPRIVKEYCHANGE_FLAG (0x1 << 2)
+
+#define COLUMN_USMDHUSEROWNPRIVKEYCHANGE 4
+#define COLUMN_USMDHUSEROWNPRIVKEYCHANGE_FLAG (0x1 << 3)
+
+
+#define USMDHUSERKEYTABLE_MIN_COL COLUMN_USMDHUSERAUTHKEYCHANGE
+#define USMDHUSERKEYTABLE_MAX_COL COLUMN_USMDHUSEROWNPRIVKEYCHANGE
+
+
+ /*
+ * TODO:405:r: Review USMDHUSERKEYTABLE_SETTABLE_COLS macro.
+ * OR together all the writable cols.
+ */
+#define USMDHUSERKEYTABLE_SETTABLE_COLS (COLUMN_USMDHUSERAUTHKEYCHANGE_FLAG | COLUMN_USMDHUSEROWNAUTHKEYCHANGE_FLAG | COLUMN_USMDHUSERPRIVKEYCHANGE_FLAG | COLUMN_USMDHUSEROWNPRIVKEYCHANGE_FLAG)
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* USMDHUSERKEYTABLE_OIDS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/snmpEngine.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/snmpEngine.c
new file mode 100644
index 0000000000..4ca2987328
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/snmpEngine.c
@@ -0,0 +1,226 @@
+/*
+ * snmpEngine.c: implement's the SNMP-FRAMEWORK-MIB.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+#include "mibII/sysORTable.h"
+#include "snmpEngine.h"
+
+struct variable2 snmpEngine_variables[] = {
+ {SNMPENGINEID, ASN_OCTET_STR, RONLY, var_snmpEngine, 1, {1}},
+#ifdef NETSNMP_ENABLE_TESTING_CODE
+ {SNMPENGINEBOOTS, ASN_INTEGER, RWRITE, var_snmpEngine, 1, {2}},
+ {SNMPENGINETIME, ASN_INTEGER, RWRITE, var_snmpEngine, 1, {3}},
+#else /* !NETSNMP_ENABLE_TESTING_CODE */
+ {SNMPENGINEBOOTS, ASN_INTEGER, RONLY, var_snmpEngine, 1, {2}},
+ {SNMPENGINETIME, ASN_INTEGER, RONLY, var_snmpEngine, 1, {3}},
+#endif /* NETSNMP_ENABLE_TESTING_CODE */
+ {SNMPENGINEMAXMESSAGESIZE, ASN_INTEGER, RONLY, var_snmpEngine, 1, {4}},
+};
+
+/*
+ * now load this mib into the agents mib table
+ */
+oid snmpEngine_variables_oid[] =
+ { 1, 3, 6, 1, 6, 3, 10, 2, 1 };
+
+void
+register_snmpEngine_scalars(void)
+{
+ REGISTER_MIB("snmpv3/snmpEngine", snmpEngine_variables, variable2,
+ snmpEngine_variables_oid);
+}
+
+void
+register_snmpEngine_scalars_context(const char *contextName)
+{
+ register_mib_context("snmpv3/snmpEngine",
+ (struct variable *) snmpEngine_variables,
+ sizeof(struct variable2),
+ sizeof(snmpEngine_variables)/sizeof(struct variable2),
+ snmpEngine_variables_oid,
+ sizeof(snmpEngine_variables_oid)/sizeof(oid),
+ DEFAULT_MIB_PRIORITY, 0, 0, NULL,
+ contextName, -1, 0);
+}
+
+void
+init_snmpEngine(void)
+{
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+ static oid reg[] = { 1, 3, 6, 1, 6, 3, 10, 3, 1, 1 };
+ register_sysORTable(reg, 10, "The SNMP Management Architecture MIB.");
+#endif
+ register_snmpEngine_scalars();
+}
+
+extern struct timeval starttime;
+
+#ifdef NETSNMP_ENABLE_TESTING_CODE
+int write_engineBoots(int, u_char *, u_char, size_t, u_char *,
+ oid *, size_t);
+int write_engineTime(int, u_char *, u_char, size_t, u_char *,
+ oid *, size_t);
+#endif /* NETSNMP_ENABLE_TESTING_CODE */
+
+u_char *
+var_snmpEngine(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+
+ /*
+ * variables we may use later
+ */
+ static long long_ret;
+ static unsigned char engineID[SNMP_MAXBUF];
+
+ *write_method = 0; /* assume it isnt writable for the time being */
+ *var_len = sizeof(long_ret); /* assume an integer and change later if not */
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return 0;
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+
+ case SNMPENGINEID:
+ *var_len = snmpv3_get_engineID(engineID, SNMP_MAXBUF);
+ /*
+ * XXX Set ERROR_MSG() upon error?
+ */
+ return (unsigned char *) engineID;
+
+ case SNMPENGINEBOOTS:
+#ifdef NETSNMP_ENABLE_TESTING_CODE
+ *write_method = write_engineBoots;
+#endif /* NETSNMP_ENABLE_TESTING_CODE */
+ long_ret = snmpv3_local_snmpEngineBoots();
+ return (unsigned char *) &long_ret;
+
+ case SNMPENGINETIME:
+#ifdef NETSNMP_ENABLE_TESTING_CODE
+ *write_method = write_engineTime;
+#endif /* NETSNMP_ENABLE_TESTING_CODE */
+ long_ret = snmpv3_local_snmpEngineTime();
+ return (unsigned char *) &long_ret;
+
+ case SNMPENGINEMAXMESSAGESIZE:
+ long_ret = 1500;
+ return (unsigned char *) &long_ret;
+
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_snmpEngine\n",
+ vp->magic));
+ }
+ return 0;
+}
+
+#ifdef NETSNMP_ENABLE_TESTING_CODE
+/*
+ * write_engineBoots():
+ *
+ * This is technically not writable a writable mib object, but we
+ * allow it so we can run some time synchronization tests.
+ */
+int
+write_engineBoots(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ /*
+ * variables we may use later
+ */
+ static long long_ret;
+ size_t size;
+ int bigsize = SNMP_MAXBUF_MEDIUM;
+ u_char engineIDBuf[SNMP_MAXBUF_MEDIUM];
+ int engineIDBufLen = 0;
+
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("snmpEngine",
+ "write to engineBoots not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(long_ret)) {
+ DEBUGMSGTL(("snmpEngine", "write to engineBoots: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ long_ret = *((long *) var_val);
+ if (action == COMMIT) {
+ engineIDBufLen =
+ snmpv3_get_engineID(engineIDBuf, SNMP_MAXBUF_MEDIUM);
+ /*
+ * set our local engineTime in the LCD timing cache
+ */
+ snmpv3_set_engineBootsAndTime(long_ret,
+ snmpv3_local_snmpEngineTime());
+ set_enginetime(engineIDBuf, engineIDBufLen,
+ snmpv3_local_snmpEngineBoots(),
+ snmpv3_local_snmpEngineTime(), TRUE);
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+/*
+ * write_engineTime():
+ *
+ * This is technically not a writable mib object, but we
+ * allow it so we can run some time synchronization tests.
+ */
+int
+write_engineTime(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ /*
+ * variables we may use later
+ */
+ static long long_ret;
+ size_t size;
+ int bigsize = SNMP_MAXBUF_MEDIUM;
+ u_char engineIDBuf[SNMP_MAXBUF_MEDIUM];
+ int engineIDBufLen = 0;
+
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("snmpEngine",
+ "write to engineTime not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(long_ret)) {
+ DEBUGMSGTL(("snmpEngine", "write to engineTime: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ long_ret = *((long *) var_val);
+ if (action == COMMIT) {
+ engineIDBufLen =
+ snmpv3_get_engineID(engineIDBuf, SNMP_MAXBUF_MEDIUM);
+ /*
+ * set our local engineTime in the LCD timing cache
+ */
+ snmpv3_set_engineBootsAndTime(snmpv3_local_snmpEngineBoots(),
+ long_ret);
+ set_enginetime(engineIDBuf, engineIDBufLen,
+ snmpv3_local_snmpEngineBoots(),
+ snmpv3_local_snmpEngineTime(), TRUE);
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+#endif /* NETSNMP_ENABLE_TESTING_CODE */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/snmpEngine.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/snmpEngine.h
new file mode 100644
index 0000000000..343eeaa184
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/snmpEngine.h
@@ -0,0 +1,33 @@
+/*
+ * snmpEngine.h
+ *
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+
+#ifndef _MIBGROUP_SNMPENGINE_H
+#define _MIBGROUP_SNMPENGINE_H
+
+/*
+ * we use header_generic and checkmib from the util_funcs module
+ */
+
+config_require(util_funcs)
+config_add_mib(SNMP-FRAMEWORK-MIB)
+
+ /*
+ * Magic number definitions:
+ */
+#define SNMPENGINEID 1
+#define SNMPENGINEBOOTS 2
+#define SNMPENGINETIME 3
+#define SNMPENGINEMAXMESSAGESIZE 4
+ /*
+ * function definitions
+ */
+ extern void init_snmpEngine(void);
+ extern void register_snmpEngine_scalars_context(const char *contextName);
+ extern FindVarMethod var_snmpEngine;
+
+#endif /* _MIBGROUP_SNMPENGINE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/snmpMPDStats.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/snmpMPDStats.c
new file mode 100644
index 0000000000..c7efbc8485
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/snmpMPDStats.c
@@ -0,0 +1,75 @@
+/*
+ * snmpMPDStats.c: tallies errors for SNMPv3 message processing.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "mibII/sysORTable.h"
+#include "snmpMPDStats.h"
+#include "util_funcs.h"
+
+
+struct variable2 snmpMPDStats_variables[] = {
+ {SNMPUNKNOWNSECURITYMODELS, ASN_COUNTER, RONLY, var_snmpMPDStats, 1,
+ {1}},
+ {SNMPINVALIDMSGS, ASN_COUNTER, RONLY, var_snmpMPDStats, 1, {2}},
+ {SNMPUNKNOWNPDUHANDLERS, ASN_COUNTER, RONLY, var_snmpMPDStats, 1, {3}},
+};
+
+/*
+ * now load this mib into the agents mib table
+ */
+oid snmpMPDStats_variables_oid[] =
+ { 1, 3, 6, 1, 6, 3, 11, 2, 1 };
+
+void
+init_snmpMPDStats(void)
+{
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+ static oid reg[] = { 1, 3, 6, 1, 6, 3, 11, 3, 1, 1 };
+ register_sysORTable(reg, 10,
+ "The MIB for Message Processing and Dispatching.");
+#endif
+
+ REGISTER_MIB("snmpv3/snmpMPDStats", snmpMPDStats_variables, variable2,
+ snmpMPDStats_variables_oid);
+}
+
+u_char *
+var_snmpMPDStats(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+
+ /*
+ * variables we may use later
+ */
+ static long long_ret;
+ int tmagic;
+
+
+ *write_method = 0; /* assume it isnt writable for the time being */
+ *var_len = sizeof(long_ret); /* assume an integer and change later if not */
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return 0;
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ tmagic = vp->magic;
+ if ((tmagic >= 0)
+ && (tmagic <= (STAT_MPD_STATS_END - STAT_MPD_STATS_START))) {
+ long_ret = snmp_get_statistic(tmagic + STAT_MPD_STATS_START);
+ return (unsigned char *) &long_ret;
+ }
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/snmpMPDStats.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/snmpMPDStats.h
new file mode 100644
index 0000000000..d17c3710a1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/snmpMPDStats.h
@@ -0,0 +1,29 @@
+
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+#ifndef _MIBGROUP_SNMPMPDSTATS_H
+#define _MIBGROUP_SNMPMPDSTATS_H
+
+/*
+ * we use header_generic and checkmib from the util_funcs module
+ */
+
+config_require(util_funcs)
+config_add_mib(SNMP-MPD-MIB)
+
+ /*
+ * Magic number definitions:
+ */
+#define SNMPUNKNOWNSECURITYMODELS 0
+#define SNMPINVALIDMSGS 1
+#define SNMPUNKNOWNPDUHANDLERS 2
+ /*
+ * function definitions
+ */
+ void init_snmpMPDStats(void);
+ extern FindVarMethod var_snmpMPDStats;
+
+#endif /* _MIBGROUP_SNMPMPDSTATS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmConf.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmConf.c
new file mode 100644
index 0000000000..20bcff91f2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmConf.c
@@ -0,0 +1,9 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+void
+init_usmConf(void)
+{
+ init_usm_conf(NULL);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmConf.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmConf.h
new file mode 100644
index 0000000000..d27f12e57e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmConf.h
@@ -0,0 +1,8 @@
+#ifndef _MIBGROUP_USMCONF_H
+#define _MIBGROUP_USMCONF_H
+
+#include <net-snmp/library/snmpusm.h>
+config_belongs_in(agent_module)
+extern void init_usmConf(void);
+
+#endif /* _MIBGROUP_USMCONF_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmStats.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmStats.c
new file mode 100644
index 0000000000..d81e127923
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmStats.c
@@ -0,0 +1,77 @@
+
+/*
+ * usmStats.c: implements the usmStats portion of the SNMP-USER-BASED-SM-MIB
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+#include "mibII/sysORTable.h"
+#include "usmStats.h"
+
+struct variable2 usmStats_variables[] = {
+ {USMSTATSUNSUPPORTEDSECLEVELS, ASN_COUNTER, RONLY, var_usmStats, 1,
+ {1}},
+ {USMSTATSNOTINTIMEWINDOWS, ASN_COUNTER, RONLY, var_usmStats, 1, {2}},
+ {USMSTATSUNKNOWNUSERNAMES, ASN_COUNTER, RONLY, var_usmStats, 1, {3}},
+ {USMSTATSUNKNOWNENGINEIDS, ASN_COUNTER, RONLY, var_usmStats, 1, {4}},
+ {USMSTATSWRONGDIGESTS, ASN_COUNTER, RONLY, var_usmStats, 1, {5}},
+ {USMSTATSDECRYPTIONERRORS, ASN_COUNTER, RONLY, var_usmStats, 1, {6}},
+};
+
+/*
+ * now load this mib into the agents mib table
+ */
+oid usmStats_variables_oid[] = { 1, 3, 6, 1, 6, 3, 15, 1, 1 };
+
+
+void
+init_usmStats(void)
+{
+#ifdef USING_MIBII_SYSORTABLE_MODULE
+ static oid reg[] = { 1, 3, 6, 1, 6, 3, 15, 2, 1, 1 };
+ register_sysORTable(reg, 10,
+ "The management information definitions for the SNMP User-based Security Model.");
+#endif
+
+ REGISTER_MIB("snmpv3/usmStats", usmStats_variables, variable2,
+ usmStats_variables_oid);
+}
+
+u_char *
+var_usmStats(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+
+ /*
+ * variables we may use later
+ */
+ static long long_ret;
+ int tmagic;
+
+ *write_method = 0; /* assume it isnt writable for the time being */
+ *var_len = sizeof(long_ret); /* assume an integer and change later if not */
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return 0;
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ tmagic = vp->magic;
+ if ((tmagic >= 0)
+ && (tmagic <= (STAT_USM_STATS_END - STAT_USM_STATS_START))) {
+ long_ret = snmp_get_statistic(tmagic + STAT_USM_STATS_START);
+ return (unsigned char *) &long_ret;
+ }
+ return 0;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmStats.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmStats.h
new file mode 100644
index 0000000000..7188e1a8fb
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmStats.h
@@ -0,0 +1,34 @@
+/*
+ * usmStats.h
+ *
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+#ifndef _MIBGROUP_USMSTATS_H
+#define _MIBGROUP_USMSTATS_H
+
+/*
+ * we use header_generic and checkmib from the util_funcs module
+ */
+
+config_require(util_funcs)
+config_add_mib(SNMP-USER-BASED-SM-MIB)
+
+ /*
+ * Magic number definitions:
+ */
+#define USMSTATSUNSUPPORTEDSECLEVELS 0
+#define USMSTATSNOTINTIMEWINDOWS 1
+#define USMSTATSUNKNOWNUSERNAMES 2
+#define USMSTATSUNKNOWNENGINEIDS 3
+#define USMSTATSWRONGDIGESTS 4
+#define USMSTATSDECRYPTIONERRORS 5
+ /*
+ * function definitions
+ */
+ extern void init_usmStats(void);
+ extern FindVarMethod var_usmStats;
+
+
+#endif /* _MIBGROUP_USMSTATS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmUser.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmUser.c
new file mode 100644
index 0000000000..25e6fbd999
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmUser.c
@@ -0,0 +1,1589 @@
+/*
+ * usmUser.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <stdlib.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+#include "usmUser.h"
+
+int usmStatusCheck(struct usmUser *uptr);
+
+struct variable4 usmUser_variables[] = {
+ {USMUSERSPINLOCK, ASN_INTEGER, RWRITE, var_usmUser, 1, {1}},
+ {USMUSERSECURITYNAME, ASN_OCTET_STR, RONLY, var_usmUser, 3, {2, 1, 3}},
+ {USMUSERCLONEFROM, ASN_OBJECT_ID, RWRITE, var_usmUser, 3, {2, 1, 4}},
+ {USMUSERAUTHPROTOCOL, ASN_OBJECT_ID, RWRITE, var_usmUser, 3,
+ {2, 1, 5}},
+ {USMUSERAUTHKEYCHANGE, ASN_OCTET_STR, RWRITE, var_usmUser, 3,
+ {2, 1, 6}},
+ {USMUSEROWNAUTHKEYCHANGE, ASN_OCTET_STR, RWRITE, var_usmUser, 3,
+ {2, 1, 7}},
+ {USMUSERPRIVPROTOCOL, ASN_OBJECT_ID, RWRITE, var_usmUser, 3,
+ {2, 1, 8}},
+ {USMUSERPRIVKEYCHANGE, ASN_OCTET_STR, RWRITE, var_usmUser, 3,
+ {2, 1, 9}},
+ {USMUSEROWNPRIVKEYCHANGE, ASN_OCTET_STR, RWRITE, var_usmUser, 3,
+ {2, 1, 10}},
+ {USMUSERPUBLIC, ASN_OCTET_STR, RWRITE, var_usmUser, 3, {2, 1, 11}},
+ {USMUSERSTORAGETYPE, ASN_INTEGER, RWRITE, var_usmUser, 3, {2, 1, 12}},
+ {USMUSERSTATUS, ASN_INTEGER, RWRITE, var_usmUser, 3, {2, 1, 13}},
+
+};
+
+oid usmUser_variables_oid[] = { 1, 3, 6, 1, 6, 3, 15, 1, 2 };
+
+
+/*
+ * needed for the write_ functions to find the start of the index
+ */
+#define USM_MIB_LENGTH 12
+
+static unsigned int usmUserSpinLock = 0;
+
+void
+init_usmUser(void)
+{
+ REGISTER_MIB("snmpv3/usmUser", usmUser_variables, variable4,
+ usmUser_variables_oid);
+}
+
+void
+init_register_usmUser_context(const char *contextName) {
+ register_mib_context("snmpv3/usmUser",
+ (struct variable *) usmUser_variables,
+ sizeof(struct variable4),
+ sizeof(usmUser_variables)/sizeof(struct variable4),
+ usmUser_variables_oid,
+ sizeof(usmUser_variables_oid)/sizeof(oid),
+ DEFAULT_MIB_PRIORITY, 0, 0, NULL,
+ contextName, -1, 0);
+}
+
+/*******************************************************************-o-******
+ * usm_generate_OID
+ *
+ * Parameters:
+ * *prefix (I) OID prefix to the usmUser table entry.
+ * prefixLen (I)
+ * *uptr (I) Pointer to a user in the user list.
+ * *length (O) Length of generated index OID.
+ *
+ * Returns:
+ * Pointer to the OID index for the user (uptr) -OR-
+ * NULL on failure.
+ *
+ *
+ * Generate the index OID for a given usmUser name. 'length' is set to
+ * the length of the index OID.
+ *
+ * Index OID format is:
+ *
+ * <...prefix>.<engineID_length>.<engineID>.<user_name_length>.<user_name>
+ */
+oid *
+usm_generate_OID(oid * prefix, size_t prefixLen, struct usmUser *uptr,
+ size_t * length)
+{
+ oid *indexOid;
+ int i;
+
+ *length = 2 + uptr->engineIDLen + strlen(uptr->name) + prefixLen;
+ indexOid = (oid *) malloc(*length * sizeof(oid));
+ if (indexOid) {
+ memmove(indexOid, prefix, prefixLen * sizeof(oid));
+
+ indexOid[prefixLen] = uptr->engineIDLen;
+ for (i = 0; i < (int) uptr->engineIDLen; i++)
+ indexOid[prefixLen + 1 + i] = (oid) uptr->engineID[i];
+
+ indexOid[prefixLen + uptr->engineIDLen + 1] = strlen(uptr->name);
+ for (i = 0; i < (int) strlen(uptr->name); i++)
+ indexOid[prefixLen + uptr->engineIDLen + 2 + i] =
+ (oid) uptr->name[i];
+ }
+ return indexOid;
+
+} /* end usm_generate_OID() */
+
+/*
+ * usm_parse_oid(): parses an index to the usmTable to break it down into
+ * a engineID component and a name component. The results are stored in:
+ *
+ * **engineID: a newly malloced string.
+ * *engineIDLen: The length of the malloced engineID string above.
+ * **name: a newly malloced string.
+ * *nameLen: The length of the malloced name string above.
+ *
+ * returns 1 if an error is encountered, or 0 if successful.
+ */
+int
+usm_parse_oid(oid * oidIndex, size_t oidLen,
+ unsigned char **engineID, size_t * engineIDLen,
+ unsigned char **name, size_t * nameLen)
+{
+ int nameL;
+ int engineIDL;
+ int i;
+
+ /*
+ * first check the validity of the oid
+ */
+ if ((oidLen <= 0) || (!oidIndex)) {
+ DEBUGMSGTL(("usmUser",
+ "parse_oid: null oid or zero length oid passed in\n"));
+ return 1;
+ }
+ engineIDL = *oidIndex; /* initial engineID length */
+ if ((int) oidLen < engineIDL + 2) {
+ DEBUGMSGTL(("usmUser",
+ "parse_oid: invalid oid length: less than the engineIDLen\n"));
+ return 1;
+ }
+ nameL = oidIndex[engineIDL + 1]; /* the initial name length */
+ if ((int) oidLen != engineIDL + nameL + 2) {
+ DEBUGMSGTL(("usmUser",
+ "parse_oid: invalid oid length: length is not exact\n"));
+ return 1;
+ }
+
+ /*
+ * its valid, malloc the space and store the results
+ */
+ if (engineID == NULL || name == NULL) {
+ DEBUGMSGTL(("usmUser",
+ "parse_oid: null storage pointer passed in.\n"));
+ return 1;
+ }
+
+ *engineID = (unsigned char *) malloc(engineIDL);
+ if (*engineID == NULL) {
+ DEBUGMSGTL(("usmUser",
+ "parse_oid: malloc of the engineID failed\n"));
+ return 1;
+ }
+ *engineIDLen = engineIDL;
+
+ *name = (unsigned char *) malloc(nameL + 1);
+ if (*name == NULL) {
+ DEBUGMSGTL(("usmUser", "parse_oid: malloc of the name failed\n"));
+ free(*engineID);
+ return 1;
+ }
+ *nameLen = nameL;
+
+ for (i = 0; i < engineIDL; i++) {
+ if (oidIndex[i + 1] > 255) {
+ goto UPO_parse_error;
+ }
+ engineID[0][i] = (unsigned char) oidIndex[i + 1];
+ }
+
+ for (i = 0; i < nameL; i++) {
+ if (oidIndex[i + 2 + engineIDL] > 255) {
+ UPO_parse_error:
+ free(*engineID);
+ free(*name);
+ return 1;
+ }
+ name[0][i] = (unsigned char) oidIndex[i + 2 + engineIDL];
+ }
+ name[0][nameL] = 0;
+
+ return 0;
+
+} /* end usm_parse_oid() */
+
+/*******************************************************************-o-******
+ * usm_parse_user
+ *
+ * Parameters:
+ * *name Complete OID indexing a given usmUser entry.
+ * name_length
+ *
+ * Returns:
+ * Pointer to a usmUser -OR-
+ * NULL if name does not convert to a usmUser.
+ *
+ * Convert an (full) OID and return a pointer to a matching user in the
+ * user list if one exists.
+ */
+struct usmUser *
+usm_parse_user(oid * name, size_t name_len)
+{
+ struct usmUser *uptr;
+
+ char *newName;
+ u_char *engineID;
+ size_t nameLen, engineIDLen;
+
+ /*
+ * get the name and engineID out of the incoming oid
+ */
+ if (usm_parse_oid(&name[USM_MIB_LENGTH], name_len - USM_MIB_LENGTH,
+ &engineID, &engineIDLen, (u_char **) & newName,
+ &nameLen))
+ return NULL;
+
+ /*
+ * Now see if a user exists with these index values
+ */
+ uptr = usm_get_user(engineID, engineIDLen, newName);
+ free(engineID);
+ free(newName);
+
+ return uptr;
+
+} /* end usm_parse_user() */
+
+/*******************************************************************-o-******
+ * var_usmUser
+ *
+ * Parameters:
+ * *vp (I) Variable-binding associated with this action.
+ * *name (I/O) Input name requested, output name found.
+ * *length (I/O) Length of input and output oid's.
+ * exact (I) TRUE if an exact match was requested.
+ * *var_len (O) Length of variable or 0 if function returned.
+ * (**write_method) Hook to name a write method (UNUSED).
+ *
+ * Returns:
+ * Pointer to (char *) containing related data of length 'length'
+ * (May be NULL.)
+ *
+ *
+ * Call-back function passed to the agent in order to return information
+ * for the USM MIB tree.
+ *
+ *
+ * If this invocation is not for USMUSERSPINLOCK, lookup user name
+ * in the usmUser list.
+ *
+ * If the name does not match any user and the request
+ * is for an exact match, -or- if the usmUser list is empty, create a
+ * new list entry.
+ *
+ * Finally, service the given USMUSER* var-bind. A NULL user generally
+ * results in a NULL return value.
+ */
+u_char *
+var_usmUser(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ struct usmUser *uptr = NULL, *nptr, *pptr;
+ int i, rtest, result;
+ oid *indexOid;
+ size_t len;
+
+ /*
+ * variables we may use later
+ */
+ static long long_ret;
+ static u_char string[1];
+ static oid objid[2]; /* for .0.0 */
+
+ if (!vp || !name || !length || !var_len)
+ return NULL;
+
+ *write_method = 0; /* assume it isnt writable for the time being */
+ *var_len = sizeof(long_ret); /* assume an integer and change later if not */
+
+ if (vp->magic != USMUSERSPINLOCK) {
+ oid newname[MAX_OID_LEN];
+ len = (*length < vp->namelen) ? *length : vp->namelen;
+ rtest = snmp_oid_compare(name, len, vp->name, len);
+ if (rtest > 0 ||
+ /*
+ * (rtest == 0 && !exact && (int) vp->namelen+1 < (int) *length) ||
+ */
+ (exact == 1 && rtest != 0)) {
+ if (var_len)
+ *var_len = 0;
+ return 0;
+ }
+ memset(newname, 0, sizeof(newname));
+ if (((int) *length) <= (int) vp->namelen || rtest == -1) {
+ /*
+ * oid is not within our range yet
+ */
+ /*
+ * need to fail if not exact
+ */
+ uptr = usm_get_userList();
+
+ } else {
+ for (nptr = usm_get_userList(), pptr = NULL, uptr = NULL;
+ nptr != NULL; pptr = nptr, nptr = nptr->next) {
+ indexOid =
+ usm_generate_OID(vp->name, vp->namelen, nptr, &len);
+ result = snmp_oid_compare(name, *length, indexOid, len);
+ DEBUGMSGTL(("usmUser", "Checking user: %s - ",
+ nptr->name));
+ for (i = 0; i < (int) nptr->engineIDLen; i++) {
+ DEBUGMSG(("usmUser", " %x", nptr->engineID[i]));
+ }
+ DEBUGMSG(("usmUser", " - %d \n -> OID: ", result));
+ DEBUGMSGOID(("usmUser", indexOid, len));
+ DEBUGMSG(("usmUser", "\n"));
+
+ free(indexOid);
+
+ if (exact) {
+ if (result == 0) {
+ uptr = nptr;
+ }
+ } else {
+ if (result == 0) {
+ /*
+ * found an exact match. Need the next one for !exact
+ */
+ uptr = nptr->next;
+ } else if (result == -1) {
+ uptr = nptr;
+ break;
+ }
+ }
+ }
+ } /* endif -- name <= vp->name */
+
+ /*
+ * if uptr is NULL and exact we need to continue for creates
+ */
+ if (uptr == NULL && !exact)
+ return (NULL);
+
+ if (uptr) {
+ indexOid = usm_generate_OID(vp->name, vp->namelen, uptr, &len);
+ *length = len;
+ memmove(name, indexOid, len * sizeof(oid));
+ DEBUGMSGTL(("usmUser", "Found user: %s - ", uptr->name));
+ for (i = 0; i < (int) uptr->engineIDLen; i++) {
+ DEBUGMSG(("usmUser", " %x", uptr->engineID[i]));
+ }
+ DEBUGMSG(("usmUser", "\n -> OID: "));
+ DEBUGMSGOID(("usmUser", indexOid, len));
+ DEBUGMSG(("usmUser", "\n"));
+
+ free(indexOid);
+ }
+ } else {
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return 0;
+ } /* endif -- vp->magic != USMUSERSPINLOCK */
+
+ switch (vp->magic) {
+ case USMUSERSPINLOCK:
+ *write_method = write_usmUserSpinLock;
+ long_ret = usmUserSpinLock;
+ return (unsigned char *) &long_ret;
+
+ case USMUSERSECURITYNAME:
+ if (uptr) {
+ *var_len = strlen(uptr->secName);
+ return (unsigned char *) uptr->secName;
+ }
+ return NULL;
+
+ case USMUSERCLONEFROM:
+ *write_method = write_usmUserCloneFrom;
+ if (uptr) {
+ objid[0] = 0; /* "When this object is read, the ZeroDotZero OID */
+ objid[1] = 0; /* is returned." */
+ *var_len = sizeof(oid) * 2;
+ return (unsigned char *) objid;
+ }
+ return NULL;
+
+ case USMUSERAUTHPROTOCOL:
+ *write_method = write_usmUserAuthProtocol;
+ if (uptr) {
+ *var_len = uptr->authProtocolLen * sizeof(oid);
+ return (u_char *) uptr->authProtocol;
+ }
+ return NULL;
+
+ case USMUSERAUTHKEYCHANGE:
+ case USMUSEROWNAUTHKEYCHANGE:
+ /*
+ * we treat these the same, and let the calling module
+ * distinguish between them
+ */
+ *write_method = write_usmUserAuthKeyChange;
+ if (uptr) {
+ *string = 0; /* always return a NULL string */
+ *var_len = 0;
+ return string;
+ }
+ return NULL;
+
+ case USMUSERPRIVPROTOCOL:
+ *write_method = write_usmUserPrivProtocol;
+ if (uptr) {
+ *var_len = uptr->privProtocolLen * sizeof(oid);
+ return (u_char *) uptr->privProtocol;
+ }
+ return NULL;
+
+ case USMUSERPRIVKEYCHANGE:
+ case USMUSEROWNPRIVKEYCHANGE:
+ /*
+ * we treat these the same, and let the calling module
+ * distinguish between them
+ */
+ *write_method = write_usmUserPrivKeyChange;
+ if (uptr) {
+ *string = 0; /* always return a NULL string */
+ *var_len = 0;
+ return string;
+ }
+ return NULL;
+
+ case USMUSERPUBLIC:
+ *write_method = write_usmUserPublic;
+ if (uptr) {
+ if (uptr->userPublicString) {
+ *var_len = strlen((char *) uptr->userPublicString);
+ return uptr->userPublicString;
+ }
+ *string = 0;
+ *var_len = 0; /* return an empty string if the public
+ * string hasn't been defined yet */
+ return string;
+ }
+ return NULL;
+
+ case USMUSERSTORAGETYPE:
+ *write_method = write_usmUserStorageType;
+ if (uptr) {
+ long_ret = uptr->userStorageType;
+ return (unsigned char *) &long_ret;
+ }
+ return NULL;
+
+ case USMUSERSTATUS:
+ *write_method = write_usmUserStatus;
+ if (uptr) {
+ long_ret = uptr->userStatus;
+ return (unsigned char *) &long_ret;
+ }
+ return NULL;
+
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_usmUser\n",
+ vp->magic));
+ }
+ return 0;
+
+} /* end var_usmUser() */
+
+/*
+ * write_usmUserSpinLock(): called when a set is performed on the
+ * usmUserSpinLock object
+ */
+int
+write_usmUserSpinLock(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ /*
+ * variables we may use later
+ */
+ static long long_ret;
+
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("usmUser",
+ "write to usmUserSpinLock not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(long_ret)) {
+ DEBUGMSGTL(("usmUser", "write to usmUserSpinLock: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ long_ret = *((long *) var_val);
+ if (long_ret != (long) usmUserSpinLock)
+ return SNMP_ERR_INCONSISTENTVALUE;
+ if (action == COMMIT) {
+ if (usmUserSpinLock == 2147483647)
+ usmUserSpinLock = 0;
+ else
+ usmUserSpinLock++;
+ }
+ return SNMP_ERR_NOERROR;
+} /* end write_usmUserSpinLock() */
+
+/*******************************************************************-o-******
+ * write_usmUserCloneFrom
+ *
+ * Parameters:
+ * action
+ * *var_val
+ * var_val_type
+ * var_val_len
+ * *statP (UNUSED)
+ * *name OID of user to clone from.
+ * name_len
+ *
+ * Returns:
+ * SNMP_ERR_NOERROR On success -OR- If user exists
+ * and has already been cloned.
+ * SNMP_ERR_GENERR Local function call failures.
+ * SNMP_ERR_INCONSISTENTNAME 'name' does not exist in user list
+ * -OR- user to clone from != RS_ACTIVE.
+ * SNMP_ERR_WRONGLENGTH OID length > than local buffer size.
+ * SNMP_ERR_WRONGTYPE ASN_OBJECT_ID is wrong.
+ *
+ *
+ * XXX: should handle action=UNDO's.
+ */
+int
+write_usmUserCloneFrom(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ struct usmUser *uptr, *cloneFrom;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_OBJECT_ID) {
+ DEBUGMSGTL(("usmUser",
+ "write to usmUserCloneFrom not ASN_OBJECT_ID\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > USM_LENGTH_OID_MAX * sizeof(oid) ||
+ var_val_len % sizeof(oid) != 0) {
+ DEBUGMSGTL(("usmUser",
+ "write to usmUserCloneFrom: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ } else if (action == RESERVE2) {
+ if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+ /*
+ * We don't allow creations here.
+ */
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+
+ /*
+ * Has the user already been cloned? If so, writes to this variable
+ * are defined to have no effect and to produce no error.
+ */
+ if (uptr->cloneFrom != NULL) {
+ return SNMP_ERR_NOERROR;
+ }
+
+ cloneFrom =
+ usm_parse_user((oid *) var_val, var_val_len / sizeof(oid));
+ if (cloneFrom == NULL || cloneFrom->userStatus != SNMP_ROW_ACTIVE) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+ uptr->cloneFrom = snmp_duplicate_objid((oid *) var_val,
+ var_val_len / sizeof(oid));
+ usm_cloneFrom_user(cloneFrom, uptr);
+
+ if (usmStatusCheck(uptr) && uptr->userStatus == SNMP_ROW_NOTREADY) {
+ uptr->userStatus = SNMP_ROW_NOTINSERVICE;
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+/*******************************************************************-o-******
+ * write_usmUserAuthProtocol
+ *
+ * Parameters:
+ * action
+ * *var_val OID of auth transform to set.
+ * var_val_type
+ * var_val_len
+ * *statP
+ * *name OID of user upon which to perform set operation.
+ * name_len
+ *
+ * Returns:
+ * SNMP_ERR_NOERROR On success.
+ * SNMP_ERR_GENERR
+ * SNMP_ERR_INCONSISTENTVALUE
+ * SNMP_ERR_NOSUCHNAME
+ * SNMP_ERR_WRONGLENGTH
+ * SNMP_ERR_WRONGTYPE
+ */
+int
+write_usmUserAuthProtocol(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static oid *optr;
+ static size_t olen;
+ static int resetOnFail;
+ struct usmUser *uptr;
+
+ if (action == RESERVE1) {
+ resetOnFail = 0;
+ if (var_val_type != ASN_OBJECT_ID) {
+ DEBUGMSGTL(("usmUser",
+ "write to usmUserAuthProtocol not ASN_OBJECT_ID\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > USM_LENGTH_OID_MAX * sizeof(oid) ||
+ var_val_len % sizeof(oid) != 0) {
+ DEBUGMSGTL(("usmUser",
+ "write to usmUserAuthProtocol: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ } else if (action == RESERVE2) {
+ if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+
+ if (uptr->userStatus == RS_ACTIVE
+ || uptr->userStatus == RS_NOTREADY
+ || uptr->userStatus == RS_NOTINSERVICE) {
+ /*
+ * The authProtocol is already set. It is only legal to CHANGE it
+ * to usmNoAuthProtocol...
+ */
+ if (snmp_oid_compare
+ ((oid *) var_val, var_val_len / sizeof(oid),
+ usmNoAuthProtocol,
+ sizeof(usmNoAuthProtocol) / sizeof(oid)) == 0) {
+ /*
+ * ... and then only if the privProtocol is equal to
+ * usmNoPrivProtocol.
+ */
+ if (snmp_oid_compare
+ (uptr->privProtocol, uptr->privProtocolLen,
+ usmNoPrivProtocol,
+ sizeof(usmNoPrivProtocol) / sizeof(oid)) != 0) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ optr = uptr->authProtocol;
+ olen = uptr->authProtocolLen;
+ resetOnFail = 1;
+ uptr->authProtocol = snmp_duplicate_objid((oid *) var_val,
+ var_val_len /
+ sizeof(oid));
+ if (uptr->authProtocol == NULL) {
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ uptr->authProtocolLen = var_val_len / sizeof(oid);
+ } else
+ if (snmp_oid_compare
+ ((oid *) var_val, var_val_len / sizeof(oid),
+ uptr->authProtocol, uptr->authProtocolLen) == 0) {
+ /*
+ * But it's also okay to set it to the same thing as it
+ * currently is.
+ */
+ return SNMP_ERR_NOERROR;
+ } else {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else {
+ /*
+ * This row is under creation. It's okay to set
+ * usmUserAuthProtocol to any valid authProtocol but it will be
+ * overwritten when usmUserCloneFrom is set (so don't write it if
+ * that has already been set).
+ */
+
+ if (snmp_oid_compare
+ ((oid *) var_val, var_val_len / sizeof(oid),
+ usmNoAuthProtocol,
+ sizeof(usmNoAuthProtocol) / sizeof(oid)) == 0
+#ifndef NETSNMP_DISABLE_MD5
+ || snmp_oid_compare((oid *) var_val,
+ var_val_len / sizeof(oid),
+ usmHMACMD5AuthProtocol,
+ sizeof(usmHMACMD5AuthProtocol) /
+ sizeof(oid)) == 0
+#endif
+ || snmp_oid_compare((oid *) var_val,
+ var_val_len / sizeof(oid),
+ usmHMACSHA1AuthProtocol,
+ sizeof(usmHMACSHA1AuthProtocol) /
+ sizeof(oid)) == 0) {
+ if (uptr->cloneFrom != NULL) {
+ optr = uptr->authProtocol;
+ olen = uptr->authProtocolLen;
+ resetOnFail = 1;
+ uptr->authProtocol =
+ snmp_duplicate_objid((oid *) var_val,
+ var_val_len / sizeof(oid));
+ if (uptr->authProtocol == NULL) {
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ uptr->authProtocolLen = var_val_len / sizeof(oid);
+ }
+ } else {
+ /*
+ * Unknown authentication protocol.
+ */
+ return SNMP_ERR_WRONGVALUE;
+ }
+ }
+ } else if (action == COMMIT) {
+ SNMP_FREE(optr);
+ optr = NULL;
+ } else if (action == FREE || action == UNDO) {
+ if ((uptr = usm_parse_user(name, name_len)) != NULL) {
+ if (resetOnFail) {
+ SNMP_FREE(uptr->authProtocol);
+ uptr->authProtocol = optr;
+ uptr->authProtocolLen = olen;
+ }
+ }
+ }
+ return SNMP_ERR_NOERROR;
+} /* end write_usmUserAuthProtocol() */
+
+/*******************************************************************-o-******
+ * write_usmUserAuthKeyChange
+ *
+ * Parameters:
+ * action
+ * *var_val Octet string representing new KeyChange value.
+ * var_val_type
+ * var_val_len
+ * *statP (UNUSED)
+ * *name OID of user upon which to perform set operation.
+ * name_len
+ *
+ * Returns:
+ * SNMP_ERR_NOERR Success.
+ * SNMP_ERR_WRONGTYPE
+ * SNMP_ERR_WRONGLENGTH
+ * SNMP_ERR_NOSUCHNAME
+ * SNMP_ERR_GENERR
+ *
+ * Note: This function handles both the usmUserAuthKeyChange and
+ * usmUserOwnAuthKeyChange objects. We are not passed the name
+ * of the user requseting the keychange, so we leave this to the
+ * calling module to verify when and if we should be called. To
+ * change this would require a change in the mib module API to
+ * pass in the securityName requesting the change.
+ *
+ * XXX: should handle action=UNDO's.
+ */
+int
+write_usmUserAuthKeyChange(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ struct usmUser *uptr;
+ unsigned char buf[SNMP_MAXBUF_SMALL];
+ size_t buflen = SNMP_MAXBUF_SMALL;
+ const char fnAuthKey[] = "write_usmUserAuthKeyChange";
+ const char fnOwnAuthKey[] = "write_usmUserOwnAuthKeyChange";
+ const char *fname;
+ static unsigned char *oldkey;
+ static size_t oldkeylen;
+ static int resetOnFail;
+
+ if (name[USM_MIB_LENGTH - 1] == 6) {
+ fname = fnAuthKey;
+ } else {
+ fname = fnOwnAuthKey;
+ }
+
+ if (action == RESERVE1) {
+ resetOnFail = 0;
+ if (var_val_type != ASN_OCTET_STR) {
+ DEBUGMSGTL(("usmUser", "write to %s not ASN_OCTET_STR\n",
+ fname));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len == 0) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ } else if (action == RESERVE2) {
+ if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+#ifndef NETSNMP_DISABLE_MD5
+ if (snmp_oid_compare(uptr->authProtocol, uptr->authProtocolLen,
+ usmHMACMD5AuthProtocol,
+ sizeof(usmHMACMD5AuthProtocol) /
+ sizeof(oid)) == 0) {
+ if (var_val_len != 0 && var_val_len != 32) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ } else
+#endif
+ if (snmp_oid_compare
+ (uptr->authProtocol, uptr->authProtocolLen,
+ usmHMACSHA1AuthProtocol,
+ sizeof(usmHMACSHA1AuthProtocol) / sizeof(oid)) == 0) {
+ if (var_val_len != 0 && var_val_len != 40) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ }
+ }
+ } else if (action == ACTION) {
+ if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+ if (uptr->cloneFrom == NULL) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+ if (snmp_oid_compare(uptr->authProtocol, uptr->authProtocolLen,
+ usmNoAuthProtocol,
+ sizeof(usmNoAuthProtocol) / sizeof(oid)) ==
+ 0) {
+ /*
+ * "When the value of the corresponding usmUserAuthProtocol is
+ * usmNoAuthProtocol, then a set is successful, but effectively
+ * is a no-op."
+ */
+ DEBUGMSGTL(("usmUser",
+ "%s: noAuthProtocol keyChange... success!\n",
+ fname));
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * Change the key.
+ */
+ DEBUGMSGTL(("usmUser", "%s: changing auth key for user %s\n",
+ fname, uptr->secName));
+
+ if (decode_keychange(uptr->authProtocol, uptr->authProtocolLen,
+ uptr->authKey, uptr->authKeyLen,
+ var_val, var_val_len,
+ buf, &buflen) != SNMPERR_SUCCESS) {
+ DEBUGMSGTL(("usmUser", "%s: ... failed\n", fname));
+ return SNMP_ERR_GENERR;
+ }
+ DEBUGMSGTL(("usmUser", "%s: ... succeeded\n", fname));
+ resetOnFail = 1;
+ oldkey = uptr->authKey;
+ oldkeylen = uptr->authKeyLen;
+ memdup(&uptr->authKey, buf, buflen);
+ if (uptr->authKey == NULL) {
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ uptr->authKeyLen = buflen;
+ } else if (action == COMMIT) {
+ SNMP_FREE(oldkey);
+ oldkey = NULL;
+ } else if (action == UNDO) {
+ if ((uptr = usm_parse_user(name, name_len)) != NULL && resetOnFail) {
+ SNMP_FREE(uptr->authKey);
+ uptr->authKey = oldkey;
+ uptr->authKeyLen = oldkeylen;
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* end write_usmUserAuthKeyChange() */
+
+int
+write_usmUserPrivProtocol(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static oid *optr;
+ static size_t olen;
+ static int resetOnFail;
+ struct usmUser *uptr;
+
+ if (action == RESERVE1) {
+ resetOnFail = 0;
+ if (var_val_type != ASN_OBJECT_ID) {
+ DEBUGMSGTL(("usmUser",
+ "write to usmUserPrivProtocol not ASN_OBJECT_ID\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > USM_LENGTH_OID_MAX * sizeof(oid) ||
+ var_val_len % sizeof(oid) != 0) {
+ DEBUGMSGTL(("usmUser",
+ "write to usmUserPrivProtocol: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ } else if (action == RESERVE2) {
+ if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+
+ if (uptr->userStatus == RS_ACTIVE
+ || uptr->userStatus == RS_NOTREADY
+ || uptr->userStatus == RS_NOTINSERVICE) {
+ /*
+ * The privProtocol is already set. It is only legal to CHANGE it
+ * to usmNoPrivProtocol.
+ */
+ if (snmp_oid_compare
+ ((oid *) var_val, var_val_len / sizeof(oid),
+ usmNoPrivProtocol,
+ sizeof(usmNoPrivProtocol) / sizeof(oid)) == 0) {
+ resetOnFail = 1;
+ optr = uptr->privProtocol;
+ olen = uptr->privProtocolLen;
+ uptr->privProtocol = snmp_duplicate_objid((oid *) var_val,
+ var_val_len /
+ sizeof(oid));
+ if (uptr->privProtocol == NULL) {
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ uptr->privProtocolLen = var_val_len / sizeof(oid);
+ } else
+ if (snmp_oid_compare
+ ((oid *) var_val, var_val_len / sizeof(oid),
+ uptr->privProtocol, uptr->privProtocolLen) == 0) {
+ /*
+ * But it's also okay to set it to the same thing as it
+ * currently is.
+ */
+ return SNMP_ERR_NOERROR;
+ } else {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else {
+ /*
+ * This row is under creation. It's okay to set
+ * usmUserPrivProtocol to any valid privProtocol with the proviso
+ * that if usmUserAuthProtocol is set to usmNoAuthProtocol, it may
+ * only be set to usmNoPrivProtocol. The value will be overwritten
+ * when usmUserCloneFrom is set (so don't write it if that has
+ * already been set).
+ */
+ if (snmp_oid_compare(uptr->authProtocol, uptr->authProtocolLen,
+ usmNoAuthProtocol,
+ sizeof(usmNoAuthProtocol) /
+ sizeof(oid)) == 0) {
+ if (snmp_oid_compare
+ ((oid *) var_val, var_val_len / sizeof(oid),
+ usmNoPrivProtocol,
+ sizeof(usmNoPrivProtocol) / sizeof(oid)) != 0) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else {
+ if (snmp_oid_compare
+ ((oid *) var_val, var_val_len / sizeof(oid),
+ usmNoPrivProtocol,
+ sizeof(usmNoPrivProtocol) / sizeof(oid)) != 0
+#ifndef NETSNMP_DISABLE_DES
+ && snmp_oid_compare((oid *) var_val,
+ var_val_len / sizeof(oid),
+ usmDESPrivProtocol,
+ sizeof(usmDESPrivProtocol) /
+ sizeof(oid) != 0)
+#endif
+ && snmp_oid_compare((oid *) var_val,
+ var_val_len / sizeof(oid),
+ usmAESPrivProtocol,
+ sizeof(usmAESPrivProtocol) /
+ sizeof(oid) != 0)) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+ }
+ resetOnFail = 1;
+ optr = uptr->privProtocol;
+ olen = uptr->privProtocolLen;
+ uptr->privProtocol = snmp_duplicate_objid((oid *) var_val,
+ var_val_len /
+ sizeof(oid));
+ if (uptr->privProtocol == NULL) {
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ uptr->privProtocolLen = var_val_len / sizeof(oid);
+ }
+ } else if (action == COMMIT) {
+ SNMP_FREE(optr);
+ optr = NULL;
+ } else if (action == FREE || action == UNDO) {
+ if ((uptr = usm_parse_user(name, name_len)) != NULL) {
+ if (resetOnFail) {
+ SNMP_FREE(uptr->privProtocol);
+ uptr->privProtocol = optr;
+ uptr->privProtocolLen = olen;
+ }
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* end write_usmUserPrivProtocol() */
+
+/*
+ * Note: This function handles both the usmUserPrivKeyChange and
+ * usmUserOwnPrivKeyChange objects. We are not passed the name
+ * of the user requseting the keychange, so we leave this to the
+ * calling module to verify when and if we should be called. To
+ * change this would require a change in the mib module API to
+ * pass in the securityName requesting the change.
+ *
+ */
+int
+write_usmUserPrivKeyChange(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ struct usmUser *uptr;
+ unsigned char buf[SNMP_MAXBUF_SMALL];
+ size_t buflen = SNMP_MAXBUF_SMALL;
+ const char fnPrivKey[] = "write_usmUserPrivKeyChange";
+ const char fnOwnPrivKey[] = "write_usmUserOwnPrivKeyChange";
+ const char *fname;
+ static unsigned char *oldkey;
+ static size_t oldkeylen;
+ static int resetOnFail;
+
+ if (name[USM_MIB_LENGTH - 1] == 9) {
+ fname = fnPrivKey;
+ } else {
+ fname = fnOwnPrivKey;
+ }
+
+ if (action == RESERVE1) {
+ resetOnFail = 0;
+ if (var_val_type != ASN_OCTET_STR) {
+ DEBUGMSGTL(("usmUser", "write to %s not ASN_OCTET_STR\n",
+ fname));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len == 0) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ } else if (action == RESERVE2) {
+ if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+#ifndef NETSNMP_DISABLE_DES
+ if (snmp_oid_compare(uptr->privProtocol, uptr->privProtocolLen,
+ usmDESPrivProtocol,
+ sizeof(usmDESPrivProtocol) /
+ sizeof(oid)) == 0) {
+ if (var_val_len != 0 && var_val_len != 32) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ }
+#endif
+ if (snmp_oid_compare(uptr->privProtocol, uptr->privProtocolLen,
+ usmAESPrivProtocol,
+ sizeof(usmAESPrivProtocol) /
+ sizeof(oid)) == 0) {
+ if (var_val_len != 0 && var_val_len != 32) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ }
+ }
+ } else if (action == ACTION) {
+ if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+ if (uptr->cloneFrom == NULL) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+ if (snmp_oid_compare(uptr->privProtocol, uptr->privProtocolLen,
+ usmNoPrivProtocol,
+ sizeof(usmNoPrivProtocol) / sizeof(oid)) ==
+ 0) {
+ /*
+ * "When the value of the corresponding usmUserPrivProtocol is
+ * usmNoPrivProtocol, then a set is successful, but effectively
+ * is a no-op."
+ */
+ DEBUGMSGTL(("usmUser",
+ "%s: noPrivProtocol keyChange... success!\n",
+ fname));
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * Change the key.
+ */
+ DEBUGMSGTL(("usmUser", "%s: changing priv key for user %s\n",
+ fname, uptr->secName));
+
+ if (decode_keychange(uptr->authProtocol, uptr->authProtocolLen,
+ uptr->privKey, uptr->privKeyLen,
+ var_val, var_val_len,
+ buf, &buflen) != SNMPERR_SUCCESS) {
+ DEBUGMSGTL(("usmUser", "%s: ... failed\n", fname));
+ return SNMP_ERR_GENERR;
+ }
+ DEBUGMSGTL(("usmUser", "%s: ... succeeded\n", fname));
+ resetOnFail = 1;
+ oldkey = uptr->privKey;
+ oldkeylen = uptr->privKeyLen;
+ memdup(&uptr->privKey, buf, buflen);
+ if (uptr->privKey == NULL) {
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ uptr->privKeyLen = buflen;
+ } else if (action == COMMIT) {
+ SNMP_FREE(oldkey);
+ oldkey = NULL;
+ } else if (action == UNDO) {
+ if ((uptr = usm_parse_user(name, name_len)) != NULL && resetOnFail) {
+ SNMP_FREE(uptr->privKey);
+ uptr->privKey = oldkey;
+ uptr->privKeyLen = oldkeylen;
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* end write_usmUserPrivKeyChange() */
+
+int
+write_usmUserPublic(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ struct usmUser *uptr = NULL;
+
+ if (var_val_type != ASN_OCTET_STR) {
+ DEBUGMSGTL(("usmUser",
+ "write to usmUserPublic not ASN_OCTET_STR\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len < 0 || var_val_len > 32) {
+ DEBUGMSGTL(("usmUser", "write to usmUserPublic: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (action == COMMIT) {
+ /*
+ * don't allow creations here
+ */
+ if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ if (uptr->userPublicString)
+ free(uptr->userPublicString);
+ uptr->userPublicString = (u_char *) malloc(var_val_len + 1);
+ if (uptr->userPublicString == NULL) {
+ return SNMP_ERR_GENERR;
+ }
+ memcpy(uptr->userPublicString, var_val, var_val_len);
+ uptr->userPublicString[var_val_len] = 0;
+ DEBUGMSG(("usmUser", "setting public string: %d - %s\n",
+ var_val_len, uptr->userPublicString));
+ }
+ return SNMP_ERR_NOERROR;
+} /* end write_usmUserPublic() */
+
+int
+write_usmUserStorageType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ long long_ret = *((long *) var_val);
+ static long oldValue;
+ struct usmUser *uptr;
+ static int resetOnFail;
+
+ if (action == RESERVE1) {
+ resetOnFail = 0;
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("usmUser",
+ "write to usmUserStorageType not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long)) {
+ DEBUGMSGTL(("usmUser",
+ "write to usmUserStorageType: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (long_ret < 1 || long_ret > 5) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+ } else if (action == RESERVE2) {
+ if ((uptr = usm_parse_user(name, name_len)) == NULL) {
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+ if ((long_ret == ST_VOLATILE || long_ret == ST_NONVOLATILE) &&
+ (uptr->userStorageType == ST_VOLATILE ||
+ uptr->userStorageType == ST_NONVOLATILE)) {
+ oldValue = uptr->userStorageType;
+ uptr->userStorageType = long_ret;
+ resetOnFail = 1;
+ } else {
+ /*
+ * From RFC2574:
+ *
+ * "Note that any user who employs authentication or privacy must
+ * allow its secret(s) to be updated and thus cannot be 'readOnly'.
+ *
+ * If an initial set operation tries to set the value to 'readOnly'
+ * for a user who employs authentication or privacy, then an
+ * 'inconsistentValue' error must be returned. Note that if the
+ * value has been previously set (implicit or explicit) to any
+ * value, then the rules as defined in the StorageType Textual
+ * Convention apply.
+ */
+ DEBUGMSGTL(("usmUser",
+ "long_ret %d uptr->st %d uptr->status %d\n",
+ long_ret, uptr->userStorageType,
+ uptr->userStatus));
+
+ if (long_ret == ST_READONLY &&
+ uptr->userStorageType != ST_READONLY &&
+ (uptr->userStatus == RS_ACTIVE ||
+ uptr->userStatus == RS_NOTINSERVICE)) {
+ return SNMP_ERR_WRONGVALUE;
+ } else if (long_ret == ST_READONLY &&
+ (snmp_oid_compare
+ (uptr->privProtocol, uptr->privProtocolLen,
+ usmNoPrivProtocol,
+ sizeof(usmNoPrivProtocol) / sizeof(oid)) != 0
+ || snmp_oid_compare(uptr->authProtocol,
+ uptr->authProtocolLen,
+ usmNoAuthProtocol,
+ sizeof(usmNoAuthProtocol) /
+ sizeof(oid)) != 0)) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ } else {
+ return SNMP_ERR_WRONGVALUE;
+ }
+ }
+ } else if (action == UNDO || action == FREE) {
+ if ((uptr = usm_parse_user(name, name_len)) != NULL && resetOnFail) {
+ uptr->userStorageType = oldValue;
+ }
+ }
+ return SNMP_ERR_NOERROR;
+} /* end write_usmUserStorageType() */
+
+/*
+ * Return 1 if enough objects have been set up to transition rowStatus to
+ * notInService(2) or active(1).
+ */
+
+int
+usmStatusCheck(struct usmUser *uptr)
+{
+ if (uptr == NULL) {
+ return 0;
+ } else {
+ if (uptr->cloneFrom == NULL) {
+ return 0;
+ }
+ }
+ return 1;
+}
+
+/*******************************************************************-o-******
+ * write_usmUserStatus
+ *
+ * Parameters:
+ * action
+ * *var_val
+ * var_val_type
+ * var_val_len
+ * *statP
+ * *name
+ * name_len
+ *
+ * Returns:
+ * SNMP_ERR_NOERROR On success.
+ * SNMP_ERR_GENERR
+ * SNMP_ERR_INCONSISTENTNAME
+ * SNMP_ERR_INCONSISTENTVALUE
+ * SNMP_ERR_WRONGLENGTH
+ * SNMP_ERR_WRONGTYPE
+ */
+int
+write_usmUserStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ /*
+ * variables we may use later
+ */
+ static long long_ret;
+ unsigned char *engineID;
+ size_t engineIDLen;
+ char *newName;
+ size_t nameLen;
+ struct usmUser *uptr = NULL;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("usmUser",
+ "write to usmUserStatus not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long_ret)) {
+ DEBUGMSGTL(("usmUser",
+ "write to usmUserStatus: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ long_ret = *((long *) var_val);
+ if (long_ret == RS_NOTREADY || long_ret < 1 || long_ret > 6) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+
+ /*
+ * See if we can parse the oid for engineID/name first.
+ */
+ if (usm_parse_oid(&name[USM_MIB_LENGTH], name_len - USM_MIB_LENGTH,
+ &engineID, &engineIDLen, (u_char **) & newName,
+ &nameLen)) {
+ DEBUGMSGTL(("usmUser",
+ "can't parse the OID for engineID or name\n"));
+ return SNMP_ERR_INCONSISTENTNAME;
+ }
+
+ if (engineIDLen < 5 || engineIDLen > 32 || nameLen < 1
+ || nameLen > 32) {
+ SNMP_FREE(engineID);
+ SNMP_FREE(newName);
+ return SNMP_ERR_NOCREATION;
+ }
+
+ /*
+ * Now see if a user already exists with these index values.
+ */
+ uptr = usm_get_user(engineID, engineIDLen, newName);
+
+ if (uptr != NULL) {
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+ SNMP_FREE(engineID);
+ SNMP_FREE(newName);
+ long_ret = RS_NOTREADY;
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ SNMP_FREE(engineID);
+ SNMP_FREE(newName);
+ } else {
+ if (long_ret == RS_ACTIVE || long_ret == RS_NOTINSERVICE) {
+ SNMP_FREE(engineID);
+ SNMP_FREE(newName);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+ if ((uptr = usm_create_user()) == NULL) {
+ SNMP_FREE(engineID);
+ SNMP_FREE(newName);
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ uptr->engineID = engineID;
+ uptr->name = newName;
+ uptr->secName = strdup(uptr->name);
+ if (uptr->secName == NULL) {
+ usm_free_user(uptr);
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ uptr->engineIDLen = engineIDLen;
+
+ /*
+ * Set status to createAndGo or createAndWait so we can tell
+ * that this row is under creation.
+ */
+
+ uptr->userStatus = long_ret;
+
+ /*
+ * Add to the list of users (we will take it off again
+ * later if something goes wrong).
+ */
+
+ usm_add_user(uptr);
+ } else {
+ SNMP_FREE(engineID);
+ SNMP_FREE(newName);
+ }
+ }
+ } else if (action == ACTION) {
+ usm_parse_oid(&name[USM_MIB_LENGTH], name_len - USM_MIB_LENGTH,
+ &engineID, &engineIDLen, (u_char **) & newName,
+ &nameLen);
+ uptr = usm_get_user(engineID, engineIDLen, newName);
+ SNMP_FREE(engineID);
+ SNMP_FREE(newName);
+
+ if (uptr != NULL) {
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_ACTIVE) {
+ if (usmStatusCheck(uptr)) {
+ uptr->userStatus = RS_ACTIVE;
+ } else {
+ SNMP_FREE(engineID);
+ SNMP_FREE(newName);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else if (long_ret == RS_CREATEANDWAIT) {
+ if (usmStatusCheck(uptr)) {
+ uptr->userStatus = RS_NOTINSERVICE;
+ } else {
+ uptr->userStatus = RS_NOTREADY;
+ }
+ } else if (long_ret == RS_NOTINSERVICE) {
+ if (uptr->userStatus == RS_ACTIVE ||
+ uptr->userStatus == RS_NOTINSERVICE) {
+ uptr->userStatus = RS_NOTINSERVICE;
+ } else {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ }
+ }
+ } else if (action == COMMIT) {
+ usm_parse_oid(&name[USM_MIB_LENGTH], name_len - USM_MIB_LENGTH,
+ &engineID, &engineIDLen, (u_char **) & newName,
+ &nameLen);
+ uptr = usm_get_user(engineID, engineIDLen, newName);
+ SNMP_FREE(engineID);
+ SNMP_FREE(newName);
+
+ if (uptr != NULL) {
+ if (long_ret == RS_DESTROY) {
+ usm_remove_user(uptr);
+ usm_free_user(uptr);
+ }
+ }
+ } else if (action == UNDO || action == FREE) {
+ if (usm_parse_oid(&name[USM_MIB_LENGTH], name_len - USM_MIB_LENGTH,
+ &engineID, &engineIDLen, (u_char **) & newName,
+ &nameLen)) {
+ /* Can't extract engine info from the OID - nothing to undo */
+ return SNMP_ERR_NOERROR;
+ }
+ uptr = usm_get_user(engineID, engineIDLen, newName);
+ SNMP_FREE(engineID);
+ SNMP_FREE(newName);
+
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+ usm_remove_user(uptr);
+ usm_free_user(uptr);
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+#if 0
+
+ /*
+ * see if we can parse the oid for engineID/name first
+ */
+if (usm_parse_oid(&name[USM_MIB_LENGTH], name_len - USM_MIB_LENGTH,
+ &engineID, &engineIDLen, (u_char **) & newName,
+ &nameLen))
+ return SNMP_ERR_INCONSISTENTNAME;
+
+ /*
+ * Now see if a user already exists with these index values
+ */
+uptr = usm_get_user(engineID, engineIDLen, newName);
+
+
+if (uptr) { /* If so, we set the appropriate value... */
+ free(engineID);
+ free(newName);
+ if (long_ret == RS_CREATEANDGO || long_ret == RS_CREATEANDWAIT) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (long_ret == RS_DESTROY) {
+ usm_remove_user(uptr);
+ usm_free_user(uptr);
+ } else {
+ uptr->userStatus = long_ret;
+ }
+
+} else { /* ...else we create a new user */
+ /*
+ * check for a valid status column set
+ */
+ if (long_ret == RS_ACTIVE || long_ret == RS_NOTINSERVICE) {
+ free(engineID);
+ free(newName);
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (long_ret == RS_DESTROY) {
+ /*
+ * destroying a non-existent row is actually legal
+ */
+ free(engineID);
+ free(newName);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * generate a new user
+ */
+ if ((uptr = usm_create_user()) == NULL) {
+ free(engineID);
+ free(newName);
+ return SNMP_ERR_GENERR;
+ }
+
+ /*
+ * copy in the engineID
+ */
+ uptr->engineID = (unsigned char *) malloc(engineIDLen);
+ if (uptr->engineID == NULL) {
+ free(engineID);
+ free(newName);
+ usm_free_user(uptr);
+ return SNMP_ERR_GENERR;
+ }
+ uptr->engineIDLen = engineIDLen;
+ memcpy(uptr->engineID, engineID, engineIDLen);
+ free(engineID);
+
+ /*
+ * copy in the name and secname
+ */
+ if ((uptr->name = strdup(newName)) == NULL) {
+ free(newName);
+ usm_free_user(uptr);
+ return SNMP_ERR_GENERR;
+ }
+ free(newName);
+ if ((uptr->secName = strdup(uptr->name)) == NULL) {
+ usm_free_user(uptr);
+ return SNMP_ERR_GENERR;
+ }
+
+ /*
+ * set the status of the row based on the request
+ */
+ if (long_ret == RS_CREATEANDGO)
+ uptr->userStatus = RS_ACTIVE;
+ else if (long_ret == RS_CREATEANDWAIT)
+ uptr->userStatus = RS_NOTINSERVICE;
+
+ /*
+ * finally, add it to our list of users
+ */
+ usm_add_user(uptr);
+
+} /* endif -- uptr */
+} /* endif -- action==COMMIT */
+
+return SNMP_ERR_NOERROR;
+
+} /* end write_usmUserStatus() */
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmUser.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmUser.h
new file mode 100644
index 0000000000..e920b20a08
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3/usmUser.h
@@ -0,0 +1,67 @@
+/*
+ * usmUser.h
+ *
+ */
+
+#ifndef _MIBGROUP_USMUSER_H
+#define _MIBGROUP_USMUSER_H
+
+#include <net-snmp/library/snmpusm.h>
+
+/*
+ * <...prefix>.<engineID_length>.<engineID>.<user_name_length>.<user_name>
+ * = 1 + 32 + 1 + 32
+ */
+#define USM_LENGTH_OID_MAX 66
+
+/*
+ * we use header_generic and checkmib from the util_funcs module
+ */
+
+config_require(util_funcs)
+config_add_mib(SNMP-USER-BASED-SM-MIB)
+
+ /*
+ * Magic number definitions:
+ */
+#define USMUSERSPINLOCK 1
+#define USMUSERSECURITYNAME 2
+#define USMUSERCLONEFROM 3
+#define USMUSERAUTHPROTOCOL 4
+#define USMUSERAUTHKEYCHANGE 5
+#define USMUSEROWNAUTHKEYCHANGE 6
+#define USMUSERPRIVPROTOCOL 7
+#define USMUSERPRIVKEYCHANGE 8
+#define USMUSEROWNPRIVKEYCHANGE 9
+#define USMUSERPUBLIC 10
+#define USMUSERSTORAGETYPE 11
+#define USMUSERSTATUS 12
+ /*
+ * function definitions
+ */
+ extern void init_usmUser(void);
+ extern FindVarMethod var_usmUser;
+ void init_register_usmUser_context(const char *contextName);
+
+ void shutdown_usmUser(void);
+ int store_usmUser(int majorID, int minorID,
+ void *serverarg, void *clientarg);
+ oid *usm_generate_OID(oid * prefix, size_t prefixLen,
+ struct usmUser *uptr,
+ size_t * length);
+ int usm_parse_oid(oid * oidIndex, size_t oidLen,
+ unsigned char **engineID,
+ size_t * engineIDLen,
+ unsigned char **name, size_t * nameLen);
+
+ WriteMethod write_usmUserSpinLock;
+ WriteMethod write_usmUserCloneFrom;
+ WriteMethod write_usmUserAuthProtocol;
+ WriteMethod write_usmUserAuthKeyChange;
+ WriteMethod write_usmUserPrivProtocol;
+ WriteMethod write_usmUserPrivKeyChange;
+ WriteMethod write_usmUserPublic;
+ WriteMethod write_usmUserStorageType;
+ WriteMethod write_usmUserStatus;
+
+#endif /* _MIBGROUP_USMUSER_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3mibs.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3mibs.h
new file mode 100644
index 0000000000..60f666da23
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/snmpv3mibs.h
@@ -0,0 +1,14 @@
+#ifndef SNMPV3MIBS_H
+#define SNMPV3MIBS_H
+
+/*
+ * snmpv3mibs.h: mib module to include the modules relavent to the
+ * snmpv3 mib(s)
+ */
+
+config_require(snmpv3/snmpEngine)
+config_require(snmpv3/snmpMPDStats)
+config_require(snmpv3/usmStats)
+config_require(snmpv3/usmConf)
+config_require(snmpv3/usmUser)
+#endif /* NSMPV3MIBS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/struct.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/struct.h
new file mode 100644
index 0000000000..b87edc9e8c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/struct.h
@@ -0,0 +1,43 @@
+#ifndef UCD_SNMP_STRUCT
+#define UCD_SNMP_STRUCT
+
+#define STRMAX 1024
+#define SHPROC 1
+#define EXECPROC 2
+#define PASSTHRU 3
+#define PASSTHRU_PERSIST 4
+#define MIBMAX 30
+
+struct extensible {
+ char name[STRMAX];
+ char command[STRMAX];
+ char fixcmd[STRMAX];
+ int type;
+ int result;
+ char output[STRMAX];
+ struct extensible *next;
+ unsigned long miboid[MIBMAX];
+ size_t miblen;
+ int pid;
+ int tid; /* WIN32 thread */
+};
+
+struct myproc {
+ char name[STRMAX];
+ char fixcmd[STRMAX];
+ int min;
+ int max;
+ struct myproc *next;
+};
+
+/*
+ * struct mibinfo
+ * {
+ * int numid;
+ * unsigned long mibid[10];
+ * char *name;
+ * void (*handle) ();
+ * };
+ */
+
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/target.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/target.h
new file mode 100644
index 0000000000..39fadfe72e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/target.h
@@ -0,0 +1,5 @@
+config_require(target/snmpTargetAddrEntry)
+config_require(target/snmpTargetParamsEntry)
+config_require(target/target)
+config_require(target/target_counters)
+config_add_mib(SNMP-TARGET-MIB)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/target/snmpTargetAddrEntry.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/target/snmpTargetAddrEntry.c
new file mode 100644
index 0000000000..2638d20f54
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/target/snmpTargetAddrEntry.c
@@ -0,0 +1,1687 @@
+/*
+ * snmpTargetAddrEntry MIB
+ *
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. Edited by Michael Baer
+ *
+ * last changed 2/2/99.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <stdlib.h>
+#include <ctype.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "snmpTargetAddrEntry.h"
+#include "util_funcs.h"
+
+#define snmpTargetAddrOIDLen 11 /*This is base+column,
+ * i.e. everything but index */
+
+oid snmpTargetAddrOID[snmpTargetAddrOIDLen] =
+ { 1, 3, 6, 1, 6, 3, 12, 1, 2, 1, 0 };
+
+static unsigned long snmpTargetSpinLock = 0;
+static struct targetAddrTable_struct *aAddrTable = 0;
+
+
+/*
+ * Utility routines
+ */
+struct targetAddrTable_struct *
+get_addrTable(void)
+{
+ return aAddrTable;
+}
+
+struct targetAddrTable_struct *
+get_addrForName(char *name)
+{
+ struct targetAddrTable_struct *ptr;
+ for (ptr = aAddrTable; ptr != NULL; ptr = ptr->next) {
+ if (ptr->name && strcmp(ptr->name, name) == 0)
+ return ptr;
+ }
+ return NULL;
+}
+
+
+/*
+ * TargetAddrTable_create creates and returns a pointer
+ * to a targetAddrTable_struct with default values set
+ */
+struct targetAddrTable_struct
+ *
+snmpTargetAddrTable_create(void)
+{
+ struct targetAddrTable_struct *newEntry;
+
+ newEntry = (struct targetAddrTable_struct *)
+ malloc(sizeof(struct targetAddrTable_struct));
+
+ if (newEntry) {
+ newEntry->name = 0;
+
+ newEntry->tDomainLen = 0;
+ newEntry->tAddress = 0;
+
+ newEntry->timeout = 1500;
+ newEntry->retryCount = 3;
+
+ newEntry->tagList = strdup("");
+ newEntry->params = 0;
+
+ newEntry->storageType = SNMP_STORAGE_NONVOLATILE;
+ newEntry->rowStatus = SNMP_ROW_NONEXISTENT;
+ newEntry->sess = (netsnmp_session *) NULL;
+ newEntry->next = 0;
+ }
+
+ return newEntry;
+} /* snmpTargetAddrTable_create */
+
+
+/*
+ * TargetAddrTable_dispose frees the space allocated to a
+ * targetAddrTable_struct
+ */
+void
+snmpTargetAddrTable_dispose(struct targetAddrTable_struct *reaped)
+{
+ if (reaped->sess != NULL) {
+ snmp_close(reaped->sess);
+ }
+ SNMP_FREE(reaped->name);
+ SNMP_FREE(reaped->tAddress);
+ SNMP_FREE(reaped->tagList);
+ SNMP_FREE(reaped->params);
+
+ SNMP_FREE(reaped);
+} /* snmpTargetAddrTable_dispose */
+
+/*
+ * snmpTargetAddrTable_addToList adds a targetAddrTable_struct
+ * to a list passed in. The list is assumed to be in a sorted order,
+ * low to high and this procedure inserts a new struct in the proper
+ * location. Sorting uses OID values based on name. A new equal value
+ * overwrites a current one.
+ */
+void
+snmpTargetAddrTable_addToList(struct targetAddrTable_struct *newEntry,
+ struct targetAddrTable_struct **listPtr)
+{
+ static struct targetAddrTable_struct *curr_struct, *prev_struct;
+ int i;
+ size_t newOIDLen = 0, currOIDLen = 0;
+ oid newOID[128], currOID[128];
+
+ /*
+ * if the list is empty, add the new entry to the top
+ */
+ if ((prev_struct = curr_struct = *listPtr) == 0) {
+ *listPtr = newEntry;
+ return;
+ } else {
+ /*
+ * get the 'OID' value of the new entry
+ */
+ newOIDLen = strlen(newEntry->name);
+ for (i = 0; i < (int) newOIDLen; i++) {
+ newOID[i] = newEntry->name[i];
+ }
+
+ /*
+ * search through the list for an equal or greater OID value
+ */
+ while (curr_struct != 0) {
+ currOIDLen = strlen(curr_struct->name);
+ for (i = 0; i < (int) currOIDLen; i++) {
+ currOID[i] = curr_struct->name[i];
+ }
+
+ i = snmp_oid_compare(newOID, newOIDLen, currOID, currOIDLen);
+ if (i == 0) { /* Exact match, overwrite with new struct */
+ newEntry->next = curr_struct->next;
+ /*
+ * if curr_struct is the top of the list
+ */
+ if (*listPtr == curr_struct)
+ *listPtr = newEntry;
+ else
+ prev_struct->next = newEntry;
+ snmpTargetAddrTable_dispose(curr_struct);
+ return;
+ } else if (i < 0) { /* Found a greater OID, insert struct in front of it. */
+ newEntry->next = curr_struct;
+ /*
+ * if curr_struct is the top of the list
+ */
+ if (*listPtr == curr_struct)
+ *listPtr = newEntry;
+ else
+ prev_struct->next = newEntry;
+ return;
+ }
+ prev_struct = curr_struct;
+ curr_struct = curr_struct->next;
+ }
+ }
+ /*
+ * if we're here, no larger OID was ever found, insert on end of list
+ */
+ prev_struct->next = newEntry;
+} /* snmpTargeAddrTable_addToList */
+
+
+void
+snmpTargetAddrTable_add(struct targetAddrTable_struct *newEntry)
+{
+ snmpTargetAddrTable_addToList(newEntry, &aAddrTable);
+}
+
+
+/*
+ * snmpTargetAddrTable_remFromList removes a targetAddrTable_struct
+ * from the list passed in
+ */
+void
+snmpTargetAddrTable_remFromList(struct targetAddrTable_struct *oldEntry,
+ struct targetAddrTable_struct **listPtr)
+{
+ struct targetAddrTable_struct *tptr;
+
+ if ((tptr = *listPtr) == 0)
+ return;
+ else if (tptr == oldEntry) {
+ *listPtr = (*listPtr)->next;
+ snmpTargetAddrTable_dispose(tptr);
+ return;
+ } else {
+ while (tptr->next != 0) {
+ if (tptr->next == oldEntry) {
+ tptr->next = tptr->next->next;
+ snmpTargetAddrTable_dispose(oldEntry);
+ return;
+ }
+ tptr = tptr->next;
+ }
+ }
+} /* snmpTargetAddrTable_remFromList */
+
+
+/*
+ * lookup OID in the link list of Addr Table Entries
+ */
+struct targetAddrTable_struct *
+search_snmpTargetAddrTable(oid * baseName,
+ size_t baseNameLen,
+ oid * name, size_t * length, int exact)
+{
+ static struct targetAddrTable_struct *temp_struct;
+ int i;
+ size_t myOIDLen = 0;
+ oid newNum[128];
+
+ /*
+ * lookup entry in addrTable linked list, Get Current MIB ID
+ */
+ memcpy(newNum, baseName, baseNameLen * sizeof(oid));
+
+ for (temp_struct = aAddrTable; temp_struct != 0;
+ temp_struct = temp_struct->next) {
+ for (i = 0; i < (int) strlen(temp_struct->name); i++) {
+ newNum[baseNameLen + i] = temp_struct->name[i];
+ }
+ myOIDLen = baseNameLen + strlen(temp_struct->name);
+ i = snmp_oid_compare(name, *length, newNum, myOIDLen);
+ /*
+ * Assumes that the linked list sorted by OID, low to high
+ */
+ if ((i == 0 && exact != 0) || (i < 0 && exact == 0)) {
+ if (exact == 0) {
+ memcpy(name, newNum, myOIDLen * sizeof(oid));
+ *length = myOIDLen;
+ }
+ return temp_struct;
+ }
+ }
+ return (0);
+} /* search_snmpTargetAddrTable */
+
+
+/*
+ * snmpTargetAddr_rowStatusCheck is boolean funciton that checks
+ * the status of a row's values in order to determine whether
+ * the row should be notReady or notInService
+ */
+int
+snmpTargetAddr_rowStatusCheck(struct targetAddrTable_struct *entry)
+{
+ if ((entry->tDomainLen == 0) || (entry->tAddress == 0) ||
+ (entry->params == 0))
+ return 0;
+ else
+ return 1;
+} /* snmtpTargetAddrTable_rowStatusCheck */
+
+
+/*
+ * Init routines
+ */
+
+/*
+ * this variable defines function callbacks and type return information
+ * for the snmpTargetAddrEntry mib
+ */
+
+struct variable2 snmpTargetAddrEntry_variables[] = {
+ {SNMPTARGETADDRTDOMAIN, ASN_OBJECT_ID, RWRITE,
+ var_snmpTargetAddrEntry, 1, {SNMPTARGETADDRTDOMAINCOLUMN}},
+ {SNMPTARGETADDRTADDRESS, ASN_OCTET_STR, RWRITE,
+ var_snmpTargetAddrEntry, 1, {SNMPTARGETADDRTADDRESSCOLUMN}},
+ {SNMPTARGETADDRTIMEOUT, ASN_INTEGER, RWRITE,
+ var_snmpTargetAddrEntry, 1, {SNMPTARGETADDRTIMEOUTCOLUMN}},
+ {SNMPTARGETADDRRETRYCOUNT, ASN_INTEGER, RWRITE,
+ var_snmpTargetAddrEntry, 1, {SNMPTARGETADDRRETRYCOUNTCOLUMN}},
+ {SNMPTARGETADDRTAGLIST, ASN_OCTET_STR, RWRITE,
+ var_snmpTargetAddrEntry, 1, {SNMPTARGETADDRTAGLISTCOLUMN}},
+ {SNMPTARGETADDRPARAMS, ASN_OCTET_STR, RWRITE,
+ var_snmpTargetAddrEntry, 1, {SNMPTARGETADDRPARAMSCOLUMN}},
+ {SNMPTARGETADDRSTORAGETYPE, ASN_INTEGER, RWRITE,
+ var_snmpTargetAddrEntry, 1, {SNMPTARGETADDRSTORAGETYPECOLUMN}},
+ {SNMPTARGETADDRROWSTATUS, ASN_INTEGER, RWRITE,
+ var_snmpTargetAddrEntry, 1, {SNMPTARGETADDRROWSTATUSCOLUMN}},
+
+};
+
+struct variable2 snmpTargetSpinLock_var[] = {
+ {SNMPTARGETSPINLOCK, ASN_INTEGER, RWRITE, var_targetSpinLock, 1, {1}}
+};
+
+static oid snmpTargetSpinLock_oid[] = { 1, 3, 6, 1, 6, 3, 12, 1 };
+
+/*
+ * now load this mib into the agents mib table
+ */
+oid snmpTargetAddrEntry_variables_oid[] =
+ { 1, 3, 6, 1, 6, 3, 12, 1, 2, 1 };
+
+
+void
+init_snmpTargetAddrEntry(void)
+{
+ aAddrTable = 0;
+ DEBUGMSGTL(("snmpTargetAddrEntry", "init\n"));
+ REGISTER_MIB("target/snmpTargetAddrEntry",
+ snmpTargetAddrEntry_variables, variable2,
+ snmpTargetAddrEntry_variables_oid);
+ REGISTER_MIB("target/snmpTargetSpinLock", snmpTargetSpinLock_var,
+ variable2, snmpTargetSpinLock_oid);
+
+ snmpd_register_config_handler("targetAddr",
+ snmpd_parse_config_targetAddr, 0, NULL);
+
+ /*
+ * we need to be called back later
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_snmpTargetAddrEntry, NULL);
+
+} /* init_snmpTargetAddrEntry */
+
+
+int
+snmpTargetAddr_addName(struct targetAddrTable_struct *entry, char *cptr)
+{
+ size_t len;
+ if (cptr == 0) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetAddrEntry: no name in config string\n"));
+ return (0);
+ } else {
+ len = strlen(cptr);
+ /*
+ * spec check for string 1-32
+ */
+ if (len < 1 || len > 32) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetAddrEntry: name out of range in config string\n"));
+ return (0);
+ }
+ entry->name = (char *) malloc(len + 1);
+ strncpy(entry->name, cptr, len);
+ entry->name[len] = '\0';
+ }
+ return (1);
+} /* addName */
+
+
+int
+snmpTargetAddr_addTDomain(struct targetAddrTable_struct *entry, char *cptr)
+{
+ size_t len = 128;
+
+ if (cptr == 0) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetAddrEntry: no tDomain in config string\n"));
+ return (0);
+ }
+
+ if (!read_objid(cptr, entry->tDomain, &len)) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetAddrEntry: tDomain unreadable in config string\n"));
+ return (0);
+ }
+
+ /*
+ * spec check for oid 1-128
+ */
+ if (len < 1 || len > 128) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetAddrEntry: tDomain out of range in config string\n"));
+ return (0);
+ }
+
+ entry->tDomainLen = len;
+ return (1);
+} /* snmpTargetAddr_addTDomain */
+
+
+int
+snmpTargetAddr_addTAddress(struct targetAddrTable_struct *entry,
+ char *cptr, size_t len)
+{
+ if (cptr == 0) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetAddrEntry: no tAddress in config string\n"));
+ return (0);
+ } else {
+ /*
+ * spec check for string 1-32
+ */
+ /*
+ * if (len < 1 || len > 32) {
+ * DEBUGMSGTL(("snmpTargetAddrEntry","ERROR snmpTargetAddrEntry: name out of range in config string\n"));
+ * return(0);
+ * }
+ */
+ SNMP_FREE(entry->tAddress);
+ entry->tAddress = (u_char *) malloc(len);
+ entry->tAddressLen = len;
+ memcpy(entry->tAddress, cptr, len);
+ }
+ return (1);
+} /* snmpTargetAddr_addTAddress */
+
+
+int
+snmpTargetAddr_addTimeout(struct targetAddrTable_struct *entry, char *cptr)
+{
+ if (cptr == 0) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetParamsEntry: no Timeout in config string\n"));
+ return (0);
+ } else if (!(isdigit(*cptr))) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargeParamsEntry: Timeout is not a digit in config string\n"));
+ return (0);
+ }
+ /*
+ * check Timeout >= 0
+ */
+ else if ((entry->timeout = (int) strtol(cptr, (char **) NULL, 0)) < 0) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargeParamsEntry: Timeout out of range in config string\n"));
+ return (0);
+ }
+ return (1);
+} /* snmpTargetAddr_addTimeout */
+
+
+int
+snmpTargetAddr_addRetryCount(struct targetAddrTable_struct *entry,
+ char *cptr)
+{
+ if (cptr == 0) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetParamsEntry: no Retry Count in config string\n"));
+ return (0);
+ } else if (!(isdigit(*cptr))) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargeParamsEntry: Retry Count is not a digit in config string\n"));
+ return (0);
+ }
+ /*
+ * spec check 0..255
+ */
+ else {
+ entry->retryCount = (int) strtol(cptr, (char **) NULL, 0);
+ if ((entry->retryCount < 0) || (entry->retryCount > 255)) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargeParamsEntry: Retry Count is out of range in config string\n"));
+ return (0);
+ }
+ }
+ return (1);
+} /* snmpTargetAddr_addRetryCount */
+
+
+int
+snmpTargetAddr_addTagList(struct targetAddrTable_struct *entry, char *cptr)
+{
+ size_t len;
+ if (cptr == 0) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetAddrEntry: no tag list in config string\n"));
+ return (0);
+ } else {
+ len = strlen(cptr);
+ /*
+ * spec check for string 0-255
+ */
+ if (len < 0 || len > 255) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetAddrEntry: tag list out of range in config string\n"));
+ return (0);
+ }
+ SNMP_FREE(entry->tagList);
+ entry->tagList = (char *) malloc(len + 1);
+ strncpy(entry->tagList, cptr, len);
+ entry->tagList[len] = '\0';
+ }
+ return (1);
+} /* snmpTargetAddr_addTagList */
+
+
+int
+snmpTargetAddr_addParams(struct targetAddrTable_struct *entry, char *cptr)
+{
+ size_t len;
+ if (cptr == 0) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetAddrEntry: no params in config string\n"));
+ return (0);
+ } else {
+ len = strlen(cptr);
+ /*
+ * spec check for string 1-32
+ */
+ if (len < 1 || len > 32) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetAddrEntry: params out of range in config string\n"));
+ return (0);
+ }
+ entry->params = (char *) malloc(len + 1);
+ strncpy(entry->params, cptr, len);
+ entry->params[len] = '\0';
+ }
+ return (1);
+} /* snmpTargetAddr_addParams */
+
+
+int
+snmpTargetAddr_addStorageType(struct targetAddrTable_struct *entry,
+ char *cptr)
+{
+ char buff[1024];
+
+ if (cptr == 0) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetAddrEntry: no storage type in config string\n"));
+ return (0);
+ } else if (!(isdigit(*cptr))) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetAddrEntry: storage type is not a digit in config string\n"));
+ return (0);
+ }
+ /*
+ * check that storage type is a possible value
+ */
+ else if (((entry->storageType = (int) strtol(cptr, (char **) NULL, 0))
+ != SNMP_STORAGE_OTHER) &&
+ (entry->storageType != SNMP_STORAGE_VOLATILE) &&
+ (entry->storageType != SNMP_STORAGE_NONVOLATILE) &&
+ (entry->storageType != SNMP_STORAGE_PERMANENT) &&
+ (entry->storageType != SNMP_STORAGE_READONLY)) {
+ snprintf(buff, sizeof(buff),
+ "ERROR snmpTargetAddrEntry: storage type not a valid value of other(%d), volatile(%d), nonvolatile(%d), permanent(%d), or readonly(%d) in config string.\n",
+ SNMP_STORAGE_OTHER, SNMP_STORAGE_VOLATILE,
+ SNMP_STORAGE_NONVOLATILE, SNMP_STORAGE_PERMANENT,
+ SNMP_STORAGE_READONLY);
+ buff[ sizeof(buff)-1 ] = 0;
+ DEBUGMSGTL(("snmpTargetAddrEntry", buff));
+
+ return (0);
+ }
+ return (1);
+} /* snmpTargetAddr_addStorageType */
+
+
+int
+snmpTargetAddr_addRowStatus(struct targetAddrTable_struct *entry,
+ char *cptr)
+{
+ char buff[1024];
+
+ if (cptr == 0) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetAddrEntry: no Row Status in config string\n"));
+ return (0);
+ } else if (!(isdigit(*cptr))) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetAddrEntry: Row Status is not a digit in config string\n"));
+ return (0);
+ }
+ /*
+ * check that row status is a valid value
+ */
+ else if (((entry->rowStatus = (int) strtol(cptr, (char **) NULL, 0))
+ != SNMP_ROW_ACTIVE) &&
+ (entry->rowStatus != SNMP_ROW_NOTINSERVICE) &&
+ (entry->rowStatus != SNMP_ROW_NOTREADY)) {
+ snprintf(buff, sizeof(buff),
+ "ERROR snmpTargetAddrEntry: Row Status is not a valid value of active(%d), notinservice(%d), or notready(%d) in config string.\n",
+ SNMP_ROW_ACTIVE, SNMP_ROW_NOTINSERVICE, SNMP_ROW_NOTREADY);
+ buff[ sizeof(buff)-1 ] = 0;
+ DEBUGMSGTL(("snmpTargetAddrEntry", buff));
+
+ return (0);
+ }
+ return (1);
+} /* snmpTargetAddr_addRowStatus */
+
+
+void
+snmpd_parse_config_targetAddr(const char *token, char *char_ptr)
+{
+ char *cptr = char_ptr, buff[1024];
+ struct targetAddrTable_struct *newEntry;
+ int i;
+
+ newEntry = snmpTargetAddrTable_create();
+
+ cptr = copy_nword(cptr, buff, sizeof(buff));
+ if (snmpTargetAddr_addName(newEntry, buff) == 0) {
+ snmpTargetAddrTable_dispose(newEntry);
+ return;
+ }
+ cptr = copy_nword(cptr, buff, sizeof(buff));
+ if (snmpTargetAddr_addTDomain(newEntry, buff) == 0) {
+ snmpTargetAddrTable_dispose(newEntry);
+ return;
+ }
+ cptr =
+ read_config_read_octet_string(cptr,
+ (u_char **) & newEntry->tAddress,
+ &newEntry->tAddressLen);
+ if (!cptr || !(newEntry->tAddress)) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "ERROR snmpTargetAddrEntry: no TAddress in config string\n"));
+ snmpTargetAddrTable_dispose(newEntry);
+ return;
+ }
+ cptr = copy_nword(cptr, buff, sizeof(buff));
+ if (snmpTargetAddr_addTimeout(newEntry, buff) == 0) {
+ snmpTargetAddrTable_dispose(newEntry);
+ return;
+ }
+ cptr = copy_nword(cptr, buff, sizeof(buff));
+ if (snmpTargetAddr_addRetryCount(newEntry, buff) == 0) {
+ snmpTargetAddrTable_dispose(newEntry);
+ return;
+ }
+ cptr = copy_nword(cptr, buff, sizeof(buff));
+ if (snmpTargetAddr_addTagList(newEntry, buff) == 0) {
+ snmpTargetAddrTable_dispose(newEntry);
+ return;
+ }
+ cptr = copy_nword(cptr, buff, sizeof(buff));
+ if (snmpTargetAddr_addParams(newEntry, buff) == 0) {
+ snmpTargetAddrTable_dispose(newEntry);
+ return;
+ }
+ cptr = copy_nword(cptr, buff, sizeof(buff));
+ if (snmpTargetAddr_addStorageType(newEntry, buff) == 0) {
+ snmpTargetAddrTable_dispose(newEntry);
+ return;
+ }
+ cptr = copy_nword(cptr, buff, sizeof(buff));
+ if (snmpTargetAddr_addRowStatus(newEntry, buff) == 0) {
+ snmpTargetAddrTable_dispose(newEntry);
+ return;
+ }
+ snprintf(buff, sizeof(buff), "snmp_parse_config_targetAddr, read: %s\n",
+ newEntry->name);
+ buff[ sizeof(buff)-1 ] = 0;
+ for (i = 0; i < newEntry->tDomainLen; i++) {
+ snprintf(&buff[strlen(buff)], sizeof(buff)-strlen(buff)-1,
+ ".%d", (int) newEntry->tDomain[i]);
+ buff[ sizeof(buff)-1 ] = 0;
+ }
+ snprintf(&buff[strlen(buff)], sizeof(buff)-strlen(buff)-1,
+ " %s %d %d %s %s %d %d\n",
+ newEntry->tAddress, newEntry->timeout, newEntry->retryCount,
+ newEntry->tagList, newEntry->params, newEntry->storageType,
+ newEntry->rowStatus);
+ buff[ sizeof(buff)-1 ] = 0;
+ DEBUGMSGTL(("snmpTargetAddrEntry", buff));
+
+ snmpTargetAddrTable_addToList(newEntry, &aAddrTable);
+} /* snmpd_parse_config_target */
+
+
+/*
+ * Shutdown routines
+ */
+
+
+/*
+ * store_snmpTargetAddrEntry handles the persistent storage proccess
+ * for this MIB table. It writes out all the non-volatile rows
+ * to permanent storage on a shutdown
+ */
+int
+store_snmpTargetAddrEntry(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ struct targetAddrTable_struct *curr_struct;
+ char line[1024];
+ int i;
+
+ if ((curr_struct = aAddrTable) != 0) {
+ while (curr_struct != 0) {
+ if ((curr_struct->storageType == SNMP_STORAGE_NONVOLATILE ||
+ curr_struct->storageType == SNMP_STORAGE_PERMANENT)
+ &&
+ (curr_struct->rowStatus == SNMP_ROW_ACTIVE ||
+ curr_struct->rowStatus == SNMP_ROW_NOTINSERVICE)) {
+ snprintf(line, sizeof(line),
+ "targetAddr %s ", curr_struct->name);
+ line[ sizeof(line)-1 ] = 0;
+ for (i = 0; i < curr_struct->tDomainLen; i++) {
+ snprintf(&line[strlen(line)],
+ sizeof(line)-strlen(line)-1, ".%i",
+ (int) curr_struct->tDomain[i]);
+ line[ sizeof(line)-1 ] = 0;
+ }
+ if ( strlen(line)+2 < sizeof(line) ) {
+ line[ strlen(line)+1 ] = 0;
+ line[ strlen(line) ] = ' ';
+ }
+ read_config_save_octet_string(&line[strlen(line)],
+ curr_struct->tAddress,
+ curr_struct->tAddressLen);
+
+ snprintf(&line[strlen(line)], sizeof(line)-strlen(line)-1,
+ " %i %i \"%s\" %s %i %i",
+ curr_struct->timeout,
+ curr_struct->retryCount, curr_struct->tagList,
+ curr_struct->params, curr_struct->storageType,
+ curr_struct->rowStatus);
+ line[ sizeof(line)-1 ] = 0;
+
+ /*
+ * store to file
+ */
+ snmpd_store_config(line);
+ }
+ curr_struct = curr_struct->next;
+ }
+ }
+ return SNMPERR_SUCCESS;
+
+} /* store_snmpTargetAddrEntry */
+
+
+/*
+ * MIB table access routines
+ */
+
+
+u_char *
+var_snmpTargetAddrEntry(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+ /*
+ * variables we may use later
+ */
+ static long long_ret;
+ static char string[1500];
+ static oid objid[128];
+ struct targetAddrTable_struct *temp_struct;
+ int i = 0;
+
+ /*
+ * Set up write_method first, in case we return NULL before getting to the
+ * switch (vp->magic) below. In some of these cases, we still want to call
+ * the appropriate write_method, if only to have it return the appropriate
+ * error.
+ */
+
+ switch (vp->magic) {
+ case SNMPTARGETADDRTDOMAIN:
+ *write_method = write_snmpTargetAddrTDomain;
+ break;
+ case SNMPTARGETADDRTADDRESS:
+ *write_method = write_snmpTargetAddrTAddress;
+ break;
+ case SNMPTARGETADDRRETRYCOUNT:
+ *write_method = write_snmpTargetAddrRetryCount;
+ break;
+ case SNMPTARGETADDRTIMEOUT:
+ *write_method = write_snmpTargetAddrTimeout;
+ break;
+ case SNMPTARGETADDRTAGLIST:
+ *write_method = write_snmpTargetAddrTagList;
+ break;
+ case SNMPTARGETADDRPARAMS:
+ *write_method = write_snmpTargetAddrParams;
+ break;
+ case SNMPTARGETADDRSTORAGETYPE:
+ *write_method = write_snmpTargetAddrStorageType;
+ break;
+ case SNMPTARGETADDRROWSTATUS:
+ *write_method = write_snmpTargetAddrRowStatus;
+ break;
+ default:
+ *write_method = NULL;
+ }
+
+ *var_len = sizeof(long_ret); /* assume an integer and change later if not */
+
+ /*
+ * look for OID in current table
+ */
+ if ((temp_struct = search_snmpTargetAddrTable(vp->name, vp->namelen,
+ name, length,
+ exact)) == 0) {
+ return (0);
+ }
+
+ /*
+ * We found what we were looking for, either the next OID or the exact OID
+ */
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+ case SNMPTARGETADDRTDOMAIN:
+ if (temp_struct->tDomainLen <= 0) {
+ return (0);
+ } else {
+ for (i = 0; i < temp_struct->tDomainLen; i++) {
+ objid[i] = temp_struct->tDomain[i];
+ }
+ *var_len = temp_struct->tDomainLen * sizeof(oid);
+ }
+ return (unsigned char *) objid;
+
+ case SNMPTARGETADDRTADDRESS:
+ if (temp_struct->tAddress == 0)
+ return (0);
+ *var_len = temp_struct->tAddressLen;
+ return (unsigned char *) temp_struct->tAddress;
+
+ case SNMPTARGETADDRTIMEOUT:
+ long_ret = temp_struct->timeout;
+ return (unsigned char *) &long_ret;
+
+ case SNMPTARGETADDRRETRYCOUNT:
+ long_ret = temp_struct->retryCount;
+ return (unsigned char *) &long_ret;
+
+ case SNMPTARGETADDRTAGLIST:
+ if (temp_struct->tagList != NULL) {
+ strcpy(string, temp_struct->tagList);
+ *var_len = strlen(string);
+ return (unsigned char *) string;
+ } else {
+ return NULL;
+ }
+
+ case SNMPTARGETADDRPARAMS:
+ if (temp_struct->params == 0)
+ return (0);
+ strcpy(string, temp_struct->params);
+ *var_len = strlen(string);
+ return (unsigned char *) string;
+
+ case SNMPTARGETADDRSTORAGETYPE:
+ long_ret = temp_struct->storageType;
+ return (unsigned char *) &long_ret;
+
+ case SNMPTARGETADDRROWSTATUS:
+ long_ret = temp_struct->rowStatus;
+ return (unsigned char *) &long_ret;
+
+ default:
+ DEBUGMSGTL(("snmpd",
+ "unknown sub-id %d in var_snmpTargetAddrEntry\n",
+ vp->magic));
+ }
+ return 0;
+} /* var_snmpTargetAddrEntry */
+
+
+int
+write_snmpTargetAddrTDomain(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ struct targetAddrTable_struct *target = NULL;
+ static oid old_oid[MAX_OID_LEN];
+ static size_t old_oid_len;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_OBJECT_ID) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTDomain not ASN_OBJECT_ID\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if ((var_val_len > (MAX_OID_LEN * sizeof(oid))) ||
+ (var_val_len % sizeof(oid) != 0)) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTDomain: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ } else if (action == RESERVE2) {
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRTDOMAINCOLUMN;
+ if ((target =
+ search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen, name,
+ &name_len, 1)) == 0) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTDomain: BAD OID!\n"));
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ if (target->storageType == SNMP_STORAGE_READONLY) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTDomain: row is read only\n"));
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ if (target->rowStatus == SNMP_ROW_ACTIVE) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTDomain: not allowed in active row.\n"));
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ /*
+ * Finally, we're golden, save current value.
+ */
+
+ memcpy(old_oid, target->tDomain,
+ target->tDomainLen * sizeof(oid));
+ old_oid_len = target->tDomainLen;
+
+ memcpy((u_char *) target->tDomain, var_val, var_val_len);
+ target->tDomainLen = var_val_len / sizeof(oid);
+
+ /*
+ * If row is new, check if its status can be updated.
+ */
+ if ((target->rowStatus == SNMP_ROW_NOTREADY) &&
+ (snmpTargetAddr_rowStatusCheck(target) != 0)) {
+ target->rowStatus = SNMP_ROW_NOTINSERVICE;
+ }
+ }
+ } else if (action == FREE || action == UNDO) {
+ /*
+ * Try to undo the SET here (abnormal usage of FREE clause)
+ */
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRTDOMAINCOLUMN;
+ if ((target =
+ search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen, name,
+ &name_len, 1)) != NULL) {
+ if (target->storageType != SNMP_STORAGE_READONLY
+ && target->rowStatus != SNMP_ROW_ACTIVE) {
+ memcpy((u_char *) target->tDomain, (u_char *) old_oid,
+ (old_oid_len * sizeof(oid)));
+ target->tDomainLen = old_oid_len;
+ if (target->rowStatus == SNMP_ROW_NOTINSERVICE &&
+ snmpTargetAddr_rowStatusCheck(target) == 0) {
+ target->rowStatus = SNMP_ROW_NOTREADY;
+ }
+ }
+ }
+ }
+ return SNMP_ERR_NOERROR;
+} /* write_snmpTargetAddrTDomain */
+
+
+int
+write_snmpTargetAddrTAddress(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ struct targetAddrTable_struct *target = NULL;
+ static char *old_addr = NULL;
+ static size_t old_len = 0;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_OCTET_STR) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTAddress not ASN_OCTET_STR\n"));
+ return SNMP_ERR_WRONGTYPE;
+ } else if (var_val_len < 1 || var_val_len > 255) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ } else if (action == RESERVE2) {
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRTADDRESSCOLUMN;
+ if ((target =
+ search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen, name,
+ &name_len, 1)) == 0) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTAddress: BAD OID!\n"));
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ if (target->storageType == SNMP_STORAGE_READONLY) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTAddress: row is read only\n"));
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ if (target->rowStatus == SNMP_ROW_ACTIVE) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTAddress: not allowed in active row.\n"));
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ old_addr = target->tAddress;
+ old_len = target->tAddressLen;
+ target->tAddress = (u_char *) malloc(var_val_len);
+ if (target->tAddress == NULL) {
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ memcpy(target->tAddress, var_val, var_val_len);
+ target->tAddressLen = var_val_len;
+
+ /*
+ * If row is new, check if its status can be updated.
+ */
+ if ((target->rowStatus == SNMP_ROW_NOTREADY) &&
+ (snmpTargetAddr_rowStatusCheck(target) != 0)) {
+ target->rowStatus = SNMP_ROW_NOTINSERVICE;
+ }
+ }
+ } else if (action == COMMIT) {
+ SNMP_FREE(old_addr);
+ old_addr = NULL;
+ } else if (action == FREE || action == UNDO) {
+ /*
+ * Try to undo the SET here (abnormal usage of FREE clause)
+ */
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRTADDRESSCOLUMN;
+ if ((target =
+ search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen, name,
+ &name_len, 1)) != NULL) {
+ if (target->storageType != SNMP_STORAGE_READONLY
+ && target->rowStatus != SNMP_ROW_ACTIVE) {
+ SNMP_FREE(target->tAddress);
+ target->tAddress = old_addr;
+ target->tAddressLen = old_len;
+ if (target->rowStatus == SNMP_ROW_NOTINSERVICE &&
+ snmpTargetAddr_rowStatusCheck(target) == 0) {
+ target->rowStatus = SNMP_ROW_NOTREADY;
+ }
+ }
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* write_snmpTargetAddrTAddress */
+
+
+int
+write_snmpTargetAddrTimeout(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ /*
+ * variables we may use later
+ */
+ static long long_ret;
+ size_t size;
+ struct targetAddrTable_struct *temp_struct;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTimeout not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > (size = sizeof(long_ret))) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTimeout: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ long_ret = *((long *) var_val);
+ } else if (action == RESERVE2) {
+
+ /*
+ * spec check range, no spec check
+ */
+
+ /*
+ * Find row in linked list and check pertinent status...
+ */
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRTIMEOUTCOLUMN;
+ if ((temp_struct =
+ search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen, name, &name_len,
+ 1)) == 0) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTimeout : BAD OID\n"));
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ /*
+ * row exists, check if it is changeable
+ */
+ if (temp_struct->storageType == SNMP_STORAGE_READONLY) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTimeout : row is read only\n"));
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ } else if (action == COMMIT) {
+ /*
+ * Finally, we're golden, should we save value?
+ */
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRTIMEOUTCOLUMN;
+ if ((temp_struct =
+ search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen, name, &name_len,
+ 1)) != 0) {
+ temp_struct->timeout = long_ret;
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* write_snmpTargetAddrTimeout */
+
+
+int
+write_snmpTargetAddrRetryCount(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static long long_ret;
+ struct targetAddrTable_struct *target;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrRetryCount not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long)) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrRetryCount: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ long_ret = *((long *) var_val);
+ if (long_ret < 0 || long_ret > 255) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+ } else if (action == RESERVE2) {
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRRETRYCOUNTCOLUMN;
+ if ((target = search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen,
+ name, &name_len,
+ 1)) == NULL) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTimeout: BAD OID\n"));
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ if (target->storageType == SNMP_STORAGE_READONLY) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrRetryCount: row is read only\n"));
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ }
+ } else if (action == COMMIT) {
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRRETRYCOUNTCOLUMN;
+ if ((target = search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen,
+ name, &name_len,
+ 1)) != NULL) {
+ target->retryCount = long_ret;
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* write_snmpTargetAddrRetryCount */
+
+static int
+is_delim(const char c)
+{
+ return (c == 0x020 || c == 0x09 || c == 0x0d || c == 0x0b);
+}
+
+int
+snmpTagListValid(const char *tagList, const size_t tagListLen)
+{
+ size_t i = 0;
+ int inTag = 0;
+
+
+ for (i = 0; i < tagListLen; i++) {
+ if (is_delim(tagList[i]) && !inTag) {
+ /*
+ * Either a leading delimiter or two consecutive delimiters.
+ */
+ return 0;
+ } else if (is_delim(tagList[i]) && inTag) {
+ inTag = 0;
+ } else if (!is_delim(tagList[i]) && !inTag) {
+ inTag = 1;
+ }
+ }
+ if (!inTag) {
+ /*
+ * Trailing delimiter.
+ */
+ return 0;
+ }
+ return 1;
+}
+
+int
+write_snmpTargetAddrTagList(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ struct targetAddrTable_struct *target = NULL;
+ static char *old_tlist;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_OCTET_STR) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTagList not ASN_OCTET_STR\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > 255) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTagList: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (!snmpTagListValid(var_val, var_val_len)) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+ } else if (action == RESERVE2) {
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRTAGLISTCOLUMN;
+ if ((target =
+ search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen, name,
+ &name_len, 1)) == NULL) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTagList: BAD OID!\n"));
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ if (target->storageType == SNMP_STORAGE_READONLY) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrTagList: row is read only\n"));
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ old_tlist = target->tagList;
+ target->tagList = (char *) malloc(var_val_len + 1);
+ if (target->tagList == NULL) {
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ memcpy(target->tagList, var_val, var_val_len);
+ target->tagList[var_val_len] = '\0';
+ }
+ } else if (action == COMMIT) {
+ SNMP_FREE(old_tlist);
+ old_tlist = NULL;
+ } else if (action == FREE || action == UNDO) {
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRTAGLISTCOLUMN;
+ if ((target =
+ search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen, name,
+ &name_len, 1)) != NULL) {
+ if (target->storageType != SNMP_STORAGE_READONLY) {
+ SNMP_FREE(target->tagList);
+ target->tagList = old_tlist;
+ }
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* write_snmpTargetAddrTagList */
+
+
+int
+write_snmpTargetAddrParams(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ struct targetAddrTable_struct *target = NULL;
+ static char *old_params = NULL;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_OCTET_STR) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrParams not ASN_OCTET_STR\n"));
+ return SNMP_ERR_WRONGTYPE;
+ } else if (var_val_len < 1 || var_val_len > 32) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ } else if (action == RESERVE2) {
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRPARAMSCOLUMN;
+ if ((target =
+ search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen, name,
+ &name_len, 1)) == 0) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrParams: BAD OID!\n"));
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ if (target->storageType == SNMP_STORAGE_READONLY) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrParams: row is read only\n"));
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ if (target->rowStatus == SNMP_ROW_ACTIVE) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrParams: not allowed in active row.\n"));
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ old_params = target->params;
+ target->params = (u_char *) malloc(var_val_len + 1);
+ if (target->params == NULL) {
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ memcpy(target->params, var_val, var_val_len);
+ target->params[var_val_len] = '\0';
+
+ /*
+ * If row is new, check if its status can be updated.
+ */
+ if ((target->rowStatus == SNMP_ROW_NOTREADY) &&
+ (snmpTargetAddr_rowStatusCheck(target) != 0)) {
+ target->rowStatus = SNMP_ROW_NOTINSERVICE;
+ }
+ }
+ } else if (action == COMMIT) {
+ SNMP_FREE(old_params);
+ old_params = NULL;
+ } else if (action == FREE || action == UNDO) {
+ /*
+ * Try to undo the SET here (abnormal usage of FREE clause)
+ */
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRPARAMSCOLUMN;
+ if ((target =
+ search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen, name,
+ &name_len, 1)) != NULL) {
+ if (target->storageType != SNMP_STORAGE_READONLY
+ && target->rowStatus != SNMP_ROW_ACTIVE) {
+ SNMP_FREE(target->params);
+ target->params = old_params;
+ if (target->rowStatus == SNMP_ROW_NOTINSERVICE &&
+ snmpTargetAddr_rowStatusCheck(target) == 0) {
+ target->rowStatus = SNMP_ROW_NOTREADY;
+ }
+ }
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* write_snmpTargetAddrParams */
+
+int
+write_snmpTargetAddrStorageType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ long long_ret = *((long *) var_val);
+ struct targetAddrTable_struct *target;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrStorageType not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long)) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrStorageType: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (long_ret != SNMP_STORAGE_OTHER &&
+ long_ret != SNMP_STORAGE_VOLATILE &&
+ long_ret != SNMP_STORAGE_NONVOLATILE) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrStorageType: attempted storage type not a valid"));
+ DEBUGMSG(("snmpTargetAddrEntry",
+ " value of other(%d), volatile(%d), or nonvolatile(%d)\n",
+ SNMP_STORAGE_OTHER, SNMP_STORAGE_VOLATILE,
+ SNMP_STORAGE_NONVOLATILE));
+ return SNMP_ERR_WRONGVALUE;
+ }
+ } else if (action == RESERVE2) {
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRSTORAGETYPECOLUMN;
+ if ((target = search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen,
+ name, &name_len,
+ 1)) == NULL) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrStorageType: BAD OID\n"));
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ if (target->storageType == SNMP_STORAGE_PERMANENT ||
+ target->storageType == SNMP_STORAGE_READONLY) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrStorageType: row has unchangeable storage status: %d\n",
+ target->storageType));
+ return SNMP_ERR_WRONGVALUE;
+ }
+ }
+ } else if (action == COMMIT) {
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRSTORAGETYPECOLUMN;
+ if ((target = search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen,
+ name, &name_len,
+ 1)) != NULL) {
+ target->storageType = long_ret;
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* write_snmpTargetAddrStorageType */
+
+
+/*
+ * snmpTargeAddr_createNewRow is called from write_snmpTargetAddrRowStatus
+ * when a new row is required. It creates a new row with
+ * the index of the passed in 'name' (i.e. full index OID) and
+ * adds it to the linked list. 'name' should be the full OID of the new index.
+ * It passes back 0 if unsuccessfull.
+ */
+int
+snmpTargetAddr_createNewRow(oid * name, size_t name_len)
+{
+ size_t newNameLen;
+ int i;
+ struct targetAddrTable_struct *temp_struct;
+
+ /*
+ * setup a new snmpTargetAddrTable structure and add it to the list
+ */
+ newNameLen = name_len - snmpTargetAddrOIDLen;
+ if (newNameLen > 0) {
+ temp_struct = snmpTargetAddrTable_create();
+ if (!temp_struct)
+ return SNMP_ERR_GENERR;
+ temp_struct->name = (char *) malloc(newNameLen + 1);
+ if (temp_struct->name == NULL) {
+ SNMP_FREE(temp_struct->tagList);
+ SNMP_FREE(temp_struct);
+ return 0;
+ }
+
+ for (i = 0; i < (int) newNameLen; i++) {
+ temp_struct->name[i] = (char) name[i + snmpTargetAddrOIDLen];
+ }
+
+ temp_struct->name[newNameLen] = '\0';
+ temp_struct->rowStatus = SNMP_ROW_NOTREADY;
+
+ snmpTargetAddrTable_addToList(temp_struct, &aAddrTable);
+
+ return 1;
+ }
+
+ return 0;
+} /* snmpTargetAddr_createNewRow */
+
+
+/*
+ * Assign a value to the Row Status variable
+ */
+int
+write_snmpTargetAddrRowStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static long value;
+ struct targetAddrTable_struct *target = NULL;
+
+ if (action == RESERVE1) {
+ value = *((long *) var_val);
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrRowStatus not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(int)) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "write to snmpTargetAddrRowStatus: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (value == RS_NOTREADY || value < 1 || value > 6) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+
+ /*
+ * Check index value is reasonable.
+ */
+
+ if (name_len < snmpTargetAddrOIDLen + 1 ||
+ name_len > snmpTargetAddrOIDLen + 32) {
+ DEBUGMSGTL(("snmpTargetAddrEntry", "bad index length %d\n",
+ name_len - snmpTargetAddrOIDLen));
+ return SNMP_ERR_NOCREATION;
+ }
+
+ /*
+ * Search for struct in linked list.
+ */
+
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRROWSTATUSCOLUMN;
+ target =
+ search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen, name,
+ &name_len, 1);
+
+ if (target != NULL) {
+ if (value == RS_CREATEANDGO || value == RS_CREATEANDWAIT) {
+ value = RS_NOTREADY;
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (target->storageType == SNMP_STORAGE_READONLY) {
+ DEBUGMSGTL(("snmpTargetAddrEntry", "row is read only\n"));
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ if (target->storageType == SNMP_STORAGE_PERMANENT) {
+ if (value == RS_DESTROY) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "unable to destroy permanent row\n"));
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ }
+ } else {
+ if (value == RS_ACTIVE || value == RS_NOTINSERVICE) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (value == RS_CREATEANDGO || value == RS_CREATEANDWAIT) {
+ if (snmpTargetAddr_createNewRow(name, name_len) == 0) {
+ DEBUGMSGTL(("snmpTargetAddrEntry",
+ "couldn't malloc() new row\n"));
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ }
+ }
+ } else if (action == ACTION) {
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRROWSTATUSCOLUMN;
+ target =
+ search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen, name,
+ &name_len, 1);
+
+ if (target != NULL) {
+ if (value == RS_CREATEANDGO) {
+ /*
+ * Check whether all the required objects have been set.
+ */
+ if (snmpTargetAddr_rowStatusCheck(target)) {
+ target->rowStatus = RS_ACTIVE;
+ } else {
+ target->rowStatus = RS_NOTREADY;
+ }
+ } else if (value == RS_CREATEANDWAIT) {
+ /*
+ * Check whether all the required objects have been set.
+ */
+ if (snmpTargetAddr_rowStatusCheck(target)) {
+ target->rowStatus = RS_NOTINSERVICE;
+ } else {
+ target->rowStatus = RS_NOTREADY;
+ }
+ } else if (value == RS_ACTIVE) {
+ if (target->rowStatus == RS_NOTINSERVICE) {
+ target->rowStatus = RS_ACTIVE;
+ } else if (target->rowStatus == RS_NOTREADY) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else if (value == RS_NOTINSERVICE) {
+ if (target->rowStatus == RS_ACTIVE) {
+ target->rowStatus = RS_NOTINSERVICE;
+ } else if (target->rowStatus == RS_NOTREADY) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ }
+ }
+ } else if (action == COMMIT) {
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRROWSTATUSCOLUMN;
+ target =
+ search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen, name,
+ &name_len, 1);
+ if (target != NULL) {
+ if (value == RS_DESTROY) {
+ snmpTargetAddrTable_remFromList(target, &aAddrTable);
+ }
+ if (value == RS_NOTINSERVICE) {
+ if (target->sess != NULL) {
+ snmp_close(target->sess);
+ target->sess = NULL;
+ }
+ }
+ }
+ } else if (action == UNDO || action == FREE) {
+ snmpTargetAddrOID[snmpTargetAddrOIDLen - 1] =
+ SNMPTARGETADDRROWSTATUSCOLUMN;
+ target =
+ search_snmpTargetAddrTable(snmpTargetAddrOID,
+ snmpTargetAddrOIDLen, name,
+ &name_len, 1);
+ if (value == RS_CREATEANDGO || value == RS_CREATEANDWAIT) {
+ if (target != NULL) {
+ snmpTargetAddrTable_remFromList(target, &aAddrTable);
+ }
+ }
+ }
+ return SNMP_ERR_NOERROR;
+} /* write_snmpTargetAddrRowStatus */
+
+
+
+int
+write_targetSpinLock(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(unsigned long)) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (*((unsigned long *) var_val) != snmpTargetSpinLock) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else if (action == COMMIT) {
+ if (snmpTargetSpinLock == 2147483647) {
+ snmpTargetSpinLock = 0;
+ } else {
+ snmpTargetSpinLock++;
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+u_char *
+var_targetSpinLock(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ if (header_generic(vp, name, length, exact, var_len, write_method) ==
+ MATCH_FAILED) {
+ *write_method = write_targetSpinLock;
+ return NULL;
+ }
+ if (vp->magic == SNMPTARGETSPINLOCK) {
+ *write_method = write_targetSpinLock;
+ *var_len = sizeof(unsigned long);
+ return (u_char *) & (snmpTargetSpinLock);
+ }
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/target/snmpTargetAddrEntry.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/target/snmpTargetAddrEntry.h
new file mode 100644
index 0000000000..53c16f99a7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/target/snmpTargetAddrEntry.h
@@ -0,0 +1,95 @@
+
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. Edited by Michael Baer
+ *
+ * last changed 2/2/99.
+ */
+
+#ifndef _MIBGROUP_SNMPTARGETADDRENTRY_H
+#define _MIBGROUP_SNMPTARGETADDRENTRY_H
+
+/*
+ * we use header_generic and checkmib from the util_funcs module
+ */
+
+config_require(util_funcs)
+
+
+ /*
+ * add the SNMPv2-TM mib into the default list of mibs to load, since
+ * it contains the Domain definitions (EG, netsnmpUDPDomain)
+ */
+config_add_mib(SNMPv2-TM)
+
+ /*
+ * Magic number definitions:
+ */
+#define SNMPTARGETADDRTDOMAIN 1
+#define SNMPTARGETADDRTADDRESS 2
+#define SNMPTARGETADDRTIMEOUT 3
+#define SNMPTARGETADDRRETRYCOUNT 4
+#define SNMPTARGETADDRTAGLIST 5
+#define SNMPTARGETADDRPARAMS 6
+#define SNMPTARGETADDRSTORAGETYPE 7
+#define SNMPTARGETADDRROWSTATUS 8
+#define SNMPTARGETSPINLOCK 99
+#define SNMPTARGETADDRTDOMAINCOLUMN 2
+#define SNMPTARGETADDRTADDRESSCOLUMN 3
+#define SNMPTARGETADDRTIMEOUTCOLUMN 4
+#define SNMPTARGETADDRRETRYCOUNTCOLUMN 5
+#define SNMPTARGETADDRTAGLISTCOLUMN 6
+#define SNMPTARGETADDRPARAMSCOLUMN 7
+#define SNMPTARGETADDRSTORAGETYPECOLUMN 8
+#define SNMPTARGETADDRROWSTATUSCOLUMN 9
+ /*
+ * structure definitions
+ */
+ struct targetAddrTable_struct {
+ char *name;
+ oid tDomain[MAX_OID_LEN];
+ int tDomainLen;
+ unsigned char *tAddress;
+ size_t tAddressLen;
+ int timeout;
+ int retryCount;
+ char *tagList;
+ char *params;
+ int storageType;
+ int rowStatus;
+ struct targetAddrTable_struct *next;
+ netsnmp_session *sess; /* a snmp session to the target host */
+ time_t sessionCreationTime;
+ };
+
+/*
+ * function definitions
+ */
+
+ void init_snmpTargetAddrEntry(void);
+ int store_snmpTargetAddrEntry(int majorID, int minorID,
+ void *serverarg,
+ void *clientarg);
+ FindVarMethod var_snmpTargetAddrEntry;
+
+ struct targetAddrTable_struct *get_addrTable(void);
+ struct targetAddrTable_struct *get_addrForName(char *name);
+ struct targetAddrTable_struct *snmpTargetAddrTable_create(void);
+ void snmpTargetAddrTable_add(struct targetAddrTable_struct
+ *newEntry);
+
+ void snmpd_parse_config_targetAddr(const char *, char *);
+
+ WriteMethod write_snmpTargetAddrTDomain;
+ WriteMethod write_snmpTargetAddrTAddress;
+ WriteMethod write_snmpTargetAddrTimeout;
+ WriteMethod write_snmpTargetAddrRetryCount;
+ WriteMethod write_snmpTargetAddrTagList;
+ WriteMethod write_snmpTargetAddrParams;
+ WriteMethod write_snmpTargetAddrStorageType;
+ WriteMethod write_snmpTargetAddrRowStatus;
+
+ FindVarMethod var_targetSpinLock;
+ WriteMethod write_targetSpinLock;
+
+#endif /* _MIBGROUP_SNMPTARGETADDRENTRY_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/target/snmpTargetParamsEntry.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/target/snmpTargetParamsEntry.c
new file mode 100644
index 0000000000..238bd326ad
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/target/snmpTargetParamsEntry.c
@@ -0,0 +1,1401 @@
+/*
+ * TargetParamTable MIB
+ *
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. Edited by Michael Baer
+ *
+ * last changed 2/2/99.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <stdlib.h>
+#include <ctype.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "snmpTargetParamsEntry.h"
+
+#define snmpTargetParamsOIDLen 11 /*This is base+column,
+ * i.e. everything but index */
+
+oid snmpTargetParamsOID[snmpTargetParamsOIDLen] =
+ { 1, 3, 6, 1, 6, 3, 12, 1, 3, 1, 0 };
+
+static struct targetParamTable_struct *aPTable = 0;
+
+
+/*
+ * Utility routines
+ */
+
+
+/*
+ * TargetParamTable_create creates and returns a pointer
+ * to a targetParamTable_struct with default values set
+ */
+struct targetParamTable_struct
+ *
+snmpTargetParamTable_create(void)
+{
+ struct targetParamTable_struct *newEntry;
+
+ newEntry = (struct targetParamTable_struct *)
+ malloc(sizeof(struct targetParamTable_struct));
+
+ newEntry->paramName = 0;
+ newEntry->mpModel = -1;
+
+ newEntry->secModel = -1;
+ newEntry->secName = 0;
+ newEntry->secLevel = -1;
+
+ newEntry->storageType = SNMP_STORAGE_NONVOLATILE;
+ newEntry->rowStatus = SNMP_ROW_NONEXISTENT;
+ newEntry->next = 0;
+ return newEntry;
+}
+
+
+/*
+ * TargetParamTable_dispose frees the space allocated to a
+ * targetParamTable_struct
+ */
+void
+snmpTargetParamTable_dispose(struct targetParamTable_struct *reaped)
+{
+ free(reaped->paramName);
+ free(reaped->secName);
+
+ free(reaped);
+} /* snmpTargetParamTable_dispose */
+
+
+/*
+ * snmpTargetParamTable_addToList adds a targetParamTable_struct
+ * to a list passed in. The list is assumed to be in a sorted order,
+ * low to high and this procedure inserts a new struct in the proper
+ * location. Sorting uses OID values based on paramName. A new equal value
+ * overwrites a current one.
+ */
+void
+snmpTargetParamTable_addToList(struct targetParamTable_struct *newEntry,
+ struct targetParamTable_struct **listPtr)
+{
+ static struct targetParamTable_struct *curr_struct, *prev_struct;
+ int i;
+ size_t newOIDLen = 0, currOIDLen = 0;
+ oid newOID[128], currOID[128];
+
+ /*
+ * if the list is empty, add the new entry to the top
+ */
+ if ((prev_struct = curr_struct = *listPtr) == 0) {
+ *listPtr = newEntry;
+ return;
+ } else {
+ /*
+ * get the 'OID' value of the new entry
+ */
+ newOIDLen = strlen(newEntry->paramName);
+ for (i = 0; i < (int) newOIDLen; i++) {
+ newOID[i] = newEntry->paramName[i];
+ }
+
+ /*
+ * search through the list for an equal or greater OID value
+ */
+ while (curr_struct != 0) {
+ currOIDLen = strlen(curr_struct->paramName);
+ for (i = 0; i < (int) currOIDLen; i++) {
+ currOID[i] = curr_struct->paramName[i];
+ }
+
+ i = snmp_oid_compare(newOID, newOIDLen, currOID, currOIDLen);
+ if (i == 0) { /* Exact match, overwrite with new struct */
+ newEntry->next = curr_struct->next;
+ /*
+ * if curr_struct is the top of the list
+ */
+ if (*listPtr == curr_struct)
+ *listPtr = newEntry;
+ else
+ prev_struct->next = newEntry;
+ snmpTargetParamTable_dispose(curr_struct);
+ return;
+ } else if (i < 0) { /* Found a greater OID, insert struct in front of it. */
+ newEntry->next = curr_struct;
+ /*
+ * if curr_struct is the top of the list
+ */
+ if (*listPtr == curr_struct)
+ *listPtr = newEntry;
+ else
+ prev_struct->next = newEntry;
+ return;
+ }
+ prev_struct = curr_struct;
+ curr_struct = curr_struct->next;
+ }
+ }
+ /*
+ * if we're here, no larger OID was ever found, insert on end of list
+ */
+ prev_struct->next = newEntry;
+} /* snmpTargeParamTable_addToList */
+
+void
+snmpTargetParamTable_add(struct targetParamTable_struct *newEntry)
+{
+ snmpTargetParamTable_addToList(newEntry, &aPTable);
+}
+
+/*
+ * snmpTargetParamTable_remFromList removes a targetParamTable_struct
+ * from the list passed in
+ */
+void
+snmpTargetParamTable_remFromList(struct targetParamTable_struct *oldEntry,
+ struct targetParamTable_struct **listPtr)
+{
+ struct targetParamTable_struct *tptr;
+
+ if ((tptr = *listPtr) == 0)
+ return;
+ else if (tptr == oldEntry) {
+ *listPtr = (*listPtr)->next;
+ snmpTargetParamTable_dispose(tptr);
+ return;
+ } else {
+ while (tptr->next != 0) {
+ if (tptr->next == oldEntry) {
+ tptr->next = tptr->next->next;
+ snmpTargetParamTable_dispose(oldEntry);
+ return;
+ }
+ tptr = tptr->next;
+ }
+ }
+} /* snmpTargetParamTable_remFromList */
+
+
+/*
+ * lookup OID in the link list of Table Entries
+ */
+struct targetParamTable_struct *
+search_snmpTargetParamsTable(oid * baseName,
+ size_t baseNameLen,
+ oid * name, size_t * length, int exact)
+{
+ static struct targetParamTable_struct *temp_struct;
+ int i;
+ size_t myOIDLen = 0;
+ oid newNum[128];
+
+ /*
+ * lookup entry in p / * Get Current MIB ID
+ */
+ memcpy(newNum, baseName, baseNameLen * sizeof(oid));
+
+ for (temp_struct = aPTable; temp_struct != 0;
+ temp_struct = temp_struct->next) {
+ for (i = 0; i < (int) strlen(temp_struct->paramName); i++) {
+ newNum[baseNameLen + i] = temp_struct->paramName[i];
+ }
+ myOIDLen = baseNameLen + strlen(temp_struct->paramName);
+ i = snmp_oid_compare(name, *length, newNum, myOIDLen);
+ /*
+ * Assumes that the linked list sorted by OID, low to high
+ */
+ if ((i == 0 && exact != 0) || (i < 0 && exact == 0)) {
+ if (exact == 0) {
+ memcpy(name, newNum, myOIDLen * sizeof(oid));
+ *length = myOIDLen;
+ }
+ return temp_struct;
+ }
+ }
+ return (0);
+} /* search_snmpTargetParamsTable */
+
+
+/*
+ * snmpTargetParams_rowStatusCheck is boolean funciton that checks
+ * the status of a row's values in order to determine whether
+ * the row should be notReady or notInService
+ */
+int
+snmpTargetParams_rowStatusCheck(struct targetParamTable_struct *entry)
+{
+ if ((entry->mpModel < 0) || (entry->secModel < 0) ||
+ (entry->secLevel < 0) || (entry->secName == 0))
+ return 0;
+ else
+ return 1;
+} /* snmtpTargetParamTable_rowStatusCheck */
+
+
+/*
+ * initialization routines
+ */
+
+
+/*
+ * this variable defines function callbacks and type return information
+ * for the snmpTargetAddrEntry mib
+ */
+
+struct variable2 snmpTargetParamsEntry_variables[] = {
+ {SNMPTARGETPARAMSMPMODEL, ASN_INTEGER, RWRITE,
+ var_snmpTargetParamsEntry, 1, {SNMPTARGETPARAMSMPMODELCOLUMN}},
+ {SNMPTARGETPARAMSSECURITYMODEL, ASN_INTEGER, RWRITE,
+ var_snmpTargetParamsEntry, 1, {SNMPTARGETPARAMSSECURITYMODELCOLUMN}},
+ {SNMPTARGETPARAMSSECURITYNAME, ASN_OCTET_STR, RWRITE,
+ var_snmpTargetParamsEntry, 1, {SNMPTARGETPARAMSSECURITYNAMECOLUMN}},
+ {SNMPTARGETPARAMSSECURITYLEVEL, ASN_INTEGER, RWRITE,
+ var_snmpTargetParamsEntry, 1, {SNMPTARGETPARAMSSECURITYLEVELCOLUMN}},
+ {SNMPTARGETPARAMSSTORAGETYPE, ASN_INTEGER, RWRITE,
+ var_snmpTargetParamsEntry, 1, {SNMPTARGETPARAMSSTORAGETYPECOLUMN}},
+ {SNMPTARGETPARAMSROWSTATUS, ASN_INTEGER, RWRITE,
+ var_snmpTargetParamsEntry, 1, {SNMPTARGETPARAMSROWSTATUSCOLUMN}}
+};
+
+/*
+ * now load this mib into the agents mib table
+ */
+oid snmpTargetParamsEntry_variables_oid[] =
+ { 1, 3, 6, 1, 6, 3, 12, 1, 3, 1 };
+
+
+void
+init_snmpTargetParamsEntry(void)
+{
+ aPTable = 0;
+
+ REGISTER_MIB("target/snmpTargetParamsEntry",
+ snmpTargetParamsEntry_variables, variable2,
+ snmpTargetParamsEntry_variables_oid);
+
+ snmpd_register_config_handler("targetParams",
+ snmpd_parse_config_targetParams, 0,
+ NULL);
+
+ /*
+ * we need to be called back later
+ */
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA,
+ store_snmpTargetParamsEntry, NULL);
+} /* init_snmpTargetParmsEntry */
+
+
+int
+snmpTargetParams_addParamName(struct targetParamTable_struct *entry,
+ char *cptr)
+{
+ size_t len;
+ if (cptr == 0) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargetParamsEntry: no param name in config string\n"));
+ return (0);
+ } else {
+ len = strlen(cptr);
+ /*
+ * spec check for string 1-32
+ */
+ if (len < 1 || len > 32) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargetParamsEntry: param name out of range in config string\n"));
+ return (0);
+ }
+ entry->paramName = (char *) malloc(len + 1);
+ strncpy(entry->paramName, cptr, len);
+ entry->paramName[len] = '\0';
+ }
+ return (1);
+}
+
+
+int
+snmpTargetParams_addMPModel(struct targetParamTable_struct *entry,
+ char *cptr)
+{
+ if (cptr == 0) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargetParamsEntry: no mp model in config string\n"));
+ return (0);
+ } else if (!(isdigit(*cptr))) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargeParamsEntry: mp model is not digit in config string\n"));
+ return (0);
+ }
+ /*
+ * spec check MP Model >= 0
+ */
+ else if ((entry->mpModel = (int) strtol(cptr, (char **) NULL, 0)) < 0) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargeParamsEntry: mp model out of range in config string\n"));
+ return (0);
+ }
+ return (1);
+} /* snmpTargetParams_addMPModel */
+
+
+int
+snmpTargetParams_addSecModel(struct targetParamTable_struct *entry,
+ char *cptr)
+{
+ if (cptr == 0) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargetParamsEntry: no sec model in config string\n"));
+ return (0);
+ } else if (!(isdigit(*cptr))) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargeParamsEntry: security model is not digit in config string\n"));
+ return (0);
+ }
+ /*
+ * spec check Sec. Model > 0
+ */
+ else if ((entry->secModel =
+ (int) strtol(cptr, (char **) NULL, 0)) <= 0) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargetParamsEntry: security model out of range in config string\n"));
+ return (0);
+ }
+ return (1);
+} /* snmpTargetParams_addSecModel */
+
+
+int
+snmpTargetParams_addSecName(struct targetParamTable_struct *entry,
+ char *cptr)
+{
+ size_t len;
+ if (cptr == 0) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargetParamsEntry: no security name in config string\n"));
+ return (0);
+ } else {
+ len = strlen(cptr);
+ entry->secName = (char *) malloc(len + 1);
+ strncpy(entry->secName, cptr, len);
+ entry->secName[len] = '\0';
+ }
+ return (1);
+} /* snmpTargetParams_addSecName */
+
+
+int
+snmpTargetParams_addSecLevel(struct targetParamTable_struct *entry,
+ char *cptr)
+{
+ if (cptr == 0) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargetParamsEntry: no security level in config string\n"));
+ return (0);
+ } else if (!(isdigit(*cptr))) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargeParamsEntry: security level is not digit in config string\n"));
+ return (0);
+ }
+ /*
+ * no spec range check, but noAuthNoPriv is 1 so...
+ */
+ else if ((entry->secLevel =
+ (int) strtol(cptr, (char **) NULL, 0)) <= 0) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargeParamsEntry: security level is not greater than 0 in config string\n"));
+ return (0);
+ }
+ return (1);
+} /* snmpTargetParams_addSecLevel */
+
+
+int
+snmpTargetParams_addStorageType(struct targetParamTable_struct *entry,
+ char *cptr)
+{
+ if (cptr == 0) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargetParamsEntry: no storage type in config string\n"));
+ return (0);
+ } else if (!(isdigit(*cptr))) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargeParamsEntry: storage type is not digit in config string\n"));
+ return (0);
+ }
+ /*
+ * check that storage type is a possible value
+ */
+ else if (((entry->storageType = (int) strtol(cptr, (char **) NULL, 0))
+ != SNMP_STORAGE_OTHER) &&
+ (entry->storageType != SNMP_STORAGE_VOLATILE) &&
+ (entry->storageType != SNMP_STORAGE_NONVOLATILE) &&
+ (entry->storageType != SNMP_STORAGE_PERMANENT) &&
+ (entry->storageType != SNMP_STORAGE_READONLY)) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargeParamsEntry: storage type is not a valid value of"));
+ DEBUGMSG(("snmpTargetParamsEntry",
+ " other(%d), volatile(%d), nonvolatile(%d), permanent(%d), or ",
+ SNMP_STORAGE_OTHER, SNMP_STORAGE_VOLATILE,
+ SNMP_STORAGE_NONVOLATILE, SNMP_STORAGE_PERMANENT));
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "readonly(%d) in config string.\n",
+ SNMP_STORAGE_READONLY));
+
+ return (0);
+ }
+ return (1);
+} /* snmpTargetParams_addStorageType */
+
+
+int
+snmpTargetParams_addRowStatus(struct targetParamTable_struct *entry,
+ char *cptr)
+{
+ if (cptr == 0) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargetParamsEntry: no row status in config string\n"));
+ return (0);
+ } else if (!(isdigit(*cptr))) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargeParamsEntry: row status is not digit in config string\n"));
+ return (0);
+ }
+ /*
+ * check that row status is a valid value
+ */
+ else if (((entry->rowStatus = (int) strtol(cptr, (char **) NULL, 0))
+ != SNMP_ROW_ACTIVE) &&
+ (entry->rowStatus != SNMP_ROW_NOTINSERVICE) &&
+ (entry->rowStatus != SNMP_ROW_NOTREADY)) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "ERROR snmpTargetParamsEntry: Row Status is not a valid value of "));
+ DEBUGMSG(("snmpTargetParamsEntry",
+ "active(%d), notinservice(%d), or notready(%d) in config string.\n",
+ SNMP_ROW_ACTIVE, SNMP_ROW_NOTINSERVICE,
+ SNMP_ROW_NOTREADY));
+
+ return (0);
+ }
+ return (1);
+} /* snmpTargetParams_addRowStatus */
+
+/*
+ * timestamp the current entry's modification time
+ */
+void
+update_timestamp(struct targetParamTable_struct *temp_struct)
+{
+ temp_struct->updateTime = time(NULL);
+}
+
+void
+snmpd_parse_config_targetParams(const char *token, char *char_ptr)
+{
+ char *cptr = char_ptr, buff[1024];
+ struct targetParamTable_struct *newEntry;
+
+ newEntry = snmpTargetParamTable_create();
+
+ cptr = copy_nword(cptr, buff, sizeof(buff));
+ if (snmpTargetParams_addParamName(newEntry, buff) == 0) {
+ snmpTargetParamTable_dispose(newEntry);
+ return;
+ }
+ cptr = copy_nword(cptr, buff, sizeof(buff));
+ if (snmpTargetParams_addMPModel(newEntry, buff) == 0) {
+ snmpTargetParamTable_dispose(newEntry);
+ return;
+ }
+ cptr = copy_nword(cptr, buff, sizeof(buff));
+ if (snmpTargetParams_addSecModel(newEntry, buff) == 0) {
+ snmpTargetParamTable_dispose(newEntry);
+ return;
+ }
+ cptr = copy_nword(cptr, buff, sizeof(buff));
+ if (snmpTargetParams_addSecName(newEntry, buff) == 0) {
+ snmpTargetParamTable_dispose(newEntry);
+ return;
+ }
+ cptr = copy_nword(cptr, buff, sizeof(buff));
+ if (snmpTargetParams_addSecLevel(newEntry, buff) == 0) {
+ snmpTargetParamTable_dispose(newEntry);
+ return;
+ }
+ cptr = copy_nword(cptr, buff, sizeof(buff));
+ if (snmpTargetParams_addStorageType(newEntry, buff) == 0) {
+ snmpTargetParamTable_dispose(newEntry);
+ return;
+ }
+ cptr = copy_nword(cptr, buff, sizeof(buff));
+ if (snmpTargetParams_addRowStatus(newEntry, buff) == 0) {
+ snmpTargetParamTable_dispose(newEntry);
+ return;
+ }
+ snprintf(buff, sizeof(buff),
+ "snmp_parse_config_targetParams, read: %s %d %d %s %d %d %d\n",
+ newEntry->paramName, newEntry->mpModel, newEntry->secModel,
+ newEntry->secName, newEntry->secLevel, newEntry->storageType,
+ newEntry->rowStatus);
+ buff[ sizeof(buff)-1 ] = 0;
+ DEBUGMSGTL(("snmpTargetParamsEntry", buff));
+
+ update_timestamp(newEntry);
+ snmpTargetParamTable_addToList(newEntry, &aPTable);
+} /* snmpd_parse_config_target */
+
+
+/*
+ * shutdown routines
+ */
+
+
+/*
+ * store_snmpTargetParamsEntry handles the presistent storage proccess
+ * for this MIB table. It writes out all the non-volatile rows
+ * to permanent storage on a shutdown
+ */
+int
+store_snmpTargetParamsEntry(int majorID, int minorID, void *serverarg,
+ void *clientarg)
+{
+ struct targetParamTable_struct *curr_struct;
+ char line[1024];
+
+ strcpy(line, "");
+ if ((curr_struct = aPTable) != 0) {
+ while (curr_struct != 0) {
+ if ((curr_struct->storageType == SNMP_STORAGE_NONVOLATILE ||
+ curr_struct->storageType == SNMP_STORAGE_PERMANENT)
+ &&
+ (curr_struct->rowStatus == SNMP_ROW_ACTIVE ||
+ curr_struct->rowStatus == SNMP_ROW_NOTINSERVICE)) {
+ snprintf(line, sizeof(line),
+ "targetParams %s %i %i %s %i %i %i\n",
+ curr_struct->paramName, curr_struct->mpModel,
+ curr_struct->secModel, curr_struct->secName,
+ curr_struct->secLevel, curr_struct->storageType,
+ curr_struct->rowStatus);
+ line[ sizeof(line)-1 ] = 0;
+
+ /*
+ * store to file
+ */
+ snmpd_store_config(line);
+ }
+ curr_struct = curr_struct->next;
+ }
+ }
+ return SNMPERR_SUCCESS;
+} /* store_snmpTargetParmsEntry */
+
+
+/*
+ * MIB table access routines
+ */
+
+
+u_char *
+var_snmpTargetParamsEntry(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * variables we may use later
+ */
+ static long long_ret;
+ static unsigned char string[1500];
+ struct targetParamTable_struct *temp_struct;
+
+ switch (vp->magic) {
+ case SNMPTARGETPARAMSMPMODEL:
+ *write_method = write_snmpTargetParamsMPModel;
+ break;
+ case SNMPTARGETPARAMSSECURITYMODEL:
+ *write_method = write_snmpTargetParamsSecModel;
+ break;
+ case SNMPTARGETPARAMSSECURITYNAME:
+ *write_method = write_snmpTargetParamsSecName;
+ break;
+ case SNMPTARGETPARAMSSECURITYLEVEL:
+ *write_method = write_snmpTargetParamsSecLevel;
+ break;
+ case SNMPTARGETPARAMSSTORAGETYPE:
+ *write_method = write_snmpTargetParamsStorageType;
+ break;
+ case SNMPTARGETPARAMSROWSTATUS:
+ *write_method = write_snmpTargetParamsRowStatus;
+ break;
+ default:
+ *write_method = NULL;
+ }
+
+ *var_len = sizeof(long_ret); /* assume an integer and change later if not */
+
+ /*
+ * look for OID in current table
+ */
+ if ((temp_struct = search_snmpTargetParamsTable(vp->name, vp->namelen,
+ name, length,
+ exact)) == 0) {
+ return (0);
+ }
+
+ /*
+ * We found what we were looking for, either the next OID or the exact OID
+ */
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+
+ case SNMPTARGETPARAMSMPMODEL:
+ /*
+ * if unset value, (i.e. new row)
+ */
+ if (temp_struct->mpModel == -1)
+ return (0);
+ long_ret = temp_struct->mpModel;
+ return (unsigned char *) &long_ret;
+
+ case SNMPTARGETPARAMSSECURITYMODEL:
+ /*
+ * if unset value, (i.e. new row)
+ */
+ if (temp_struct->secModel == -1)
+ return (0);
+ long_ret = temp_struct->secModel;
+ return (unsigned char *) &long_ret;
+
+ case SNMPTARGETPARAMSSECURITYNAME:
+ /*
+ * if unset value, (i.e. new row)
+ */
+ if (temp_struct->secName == 0)
+ return (0);
+ /*
+ * including null character.
+ */
+ memcpy(string, temp_struct->secName, strlen(temp_struct->secName));
+ string[strlen(temp_struct->secName)] = '\0';
+ *var_len = strlen(temp_struct->secName);
+ return (unsigned char *) string;
+
+ case SNMPTARGETPARAMSSECURITYLEVEL:
+ /*
+ * if unset value, (i.e. new row)
+ */
+ if (temp_struct->secLevel == -1)
+ return (0);
+ long_ret = temp_struct->secLevel;
+ return (unsigned char *) &long_ret;
+
+ case SNMPTARGETPARAMSSTORAGETYPE:
+ long_ret = temp_struct->storageType;
+ return (unsigned char *) &long_ret;
+
+ case SNMPTARGETPARAMSROWSTATUS:
+ long_ret = temp_struct->rowStatus;
+ return (unsigned char *) &long_ret;
+
+ default:
+ DEBUGMSGTL(("snmpd",
+ "unknown sub-id %d in var_snmpTargetParamsEntry\n",
+ vp->magic));
+ }
+ return 0;
+} /* var_snmpTargetParamsEntry */
+
+/*
+ * Assign a value to the mpModel variable.
+ */
+int
+write_snmpTargetParamsMPModel(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ long long_ret = *((long *) var_val);
+ static long old_mp;
+ struct targetParamTable_struct *params = NULL;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsMPModel: not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long)) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsMPModel: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (long_ret < 0) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsMPModel: MP Model out of range\n"));
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else if (action == RESERVE2) {
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSMPMODELCOLUMN;
+ params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len, 1);
+ if (params == NULL) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsMPModel: BAD OID\n"));
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ /*
+ * Row exists, check if it is changeable.
+ */
+ if (params->storageType == SNMP_STORAGE_READONLY) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamMPModel: row is read only\n"));
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ /*
+ * Check if row is active.
+ */
+ if (params->rowStatus == SNMP_ROW_ACTIVE) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsMPModel: this change not allowed in active row.\n"));
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ old_mp = params->mpModel;
+ params->mpModel = long_ret;
+
+ if (params->rowStatus == SNMP_ROW_NOTREADY &&
+ snmpTargetParams_rowStatusCheck(params)) {
+ params->rowStatus = SNMP_ROW_NOTINSERVICE;
+ }
+ }
+ } else if (action == COMMIT) {
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSMPMODELCOLUMN;
+ if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len,
+ 1)) != NULL) {
+ update_timestamp(params);
+ }
+ } else if (action == FREE || action == UNDO) {
+ /*
+ * Try to undo the SET here (abnormal usage of FREE clause)
+ */
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSMPMODELCOLUMN;
+ if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len,
+ 1)) != NULL) {
+ if (params->storageType != SNMP_STORAGE_READONLY
+ && params->rowStatus != SNMP_ROW_ACTIVE) {
+ params->mpModel = old_mp;
+ if (params->rowStatus == SNMP_ROW_NOTINSERVICE &&
+ !snmpTargetParams_rowStatusCheck(params)) {
+ params->rowStatus = SNMP_ROW_NOTREADY;
+ }
+ }
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* write_snmpTargetParamsMPModel */
+
+/*
+ * Assign a value to the secModel variable.
+ */
+int
+write_snmpTargetParamsSecModel(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ long long_ret = *((long *) var_val);
+ static long old_sec;
+ struct targetParamTable_struct *params = NULL;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsSecModel: not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long)) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsSecModel: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (long_ret <= 0) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsSecModel: secModel out of range\n"));
+ return SNMP_ERR_WRONGVALUE;
+ }
+ if (find_sec_mod(long_ret) == NULL && long_ret >= 3) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsSecModel: secModel %d unsupported\n",
+ long_ret));
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ } else if (action == RESERVE2) {
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSSECURITYMODELCOLUMN;
+ params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len, 1);
+ if (params == NULL) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsSecModel: BAD OID\n"));
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ /*
+ * Row exists, check if it is changeable.
+ */
+ if (params->storageType == SNMP_STORAGE_READONLY) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamSecModel: row is read only\n"));
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ /*
+ * Check if row is active.
+ */
+ if (params->rowStatus == SNMP_ROW_ACTIVE) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsSecModel: this change not allowed in active row.\n"));
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ old_sec = params->secModel;
+ params->secModel = long_ret;
+
+ if (params->rowStatus == SNMP_ROW_NOTREADY &&
+ snmpTargetParams_rowStatusCheck(params)) {
+ params->rowStatus = SNMP_ROW_NOTINSERVICE;
+ }
+ }
+ } else if (action == COMMIT) {
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSSECURITYMODELCOLUMN;
+ if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len,
+ 1)) != NULL) {
+ update_timestamp(params);
+ }
+ } else if (action == FREE || action == UNDO) {
+ /*
+ * Try to undo the SET here (abnormal usage of FREE clause)
+ */
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSSECURITYMODELCOLUMN;
+ if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len,
+ 1)) != NULL) {
+ if (params->storageType != SNMP_STORAGE_READONLY
+ && params->rowStatus != SNMP_ROW_ACTIVE) {
+ params->secModel = old_sec;
+ if (params->rowStatus == SNMP_ROW_NOTINSERVICE &&
+ !snmpTargetParams_rowStatusCheck(params)) {
+ params->rowStatus = SNMP_ROW_NOTREADY;
+ }
+ }
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* write_snmpTargetParamsSecModel */
+
+/*
+ * Assign a value to the SecLevel variable.
+ */
+int
+write_snmpTargetParamsSecLevel(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ long long_ret = *((long *) var_val);
+ static long old_level;
+ struct targetParamTable_struct *params = NULL;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsSecLevel: not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long)) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsSecLevel: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (long_ret <= 0 || long_ret > 3) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsSecLevel: security level is not noAuthNoPriv(1), authNopriv(2) or authPriv(3)\n"));
+ return SNMP_ERR_WRONGVALUE;
+ }
+ } else if (action == RESERVE2) {
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSSECURITYLEVELCOLUMN;
+ params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len, 1);
+ if (params == NULL) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsSecLevel: BAD OID\n"));
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ /*
+ * Row exists, check if it is changeable.
+ */
+ if (params->storageType == SNMP_STORAGE_READONLY) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamSecLevel: row is read only\n"));
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ /*
+ * Check if row is active.
+ */
+ if (params->rowStatus == SNMP_ROW_ACTIVE) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsSecLevel: this change not allowed in active row.\n"));
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ old_level = params->secLevel;
+ params->secLevel = long_ret;
+
+ if (params->rowStatus == SNMP_ROW_NOTREADY &&
+ snmpTargetParams_rowStatusCheck(params)) {
+ params->rowStatus = SNMP_ROW_NOTINSERVICE;
+ }
+ }
+ } else if (action == COMMIT) {
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSSECURITYLEVELCOLUMN;
+ if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len,
+ 1)) != NULL) {
+ update_timestamp(params);
+ }
+ } else if (action == FREE || action == UNDO) {
+ /*
+ * Try to undo the SET here (abnormal usage of FREE clause)
+ */
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSSECURITYLEVELCOLUMN;
+ if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len,
+ 1)) != NULL) {
+ if (params->storageType != SNMP_STORAGE_READONLY
+ && params->rowStatus != SNMP_ROW_ACTIVE) {
+ params->secLevel = old_level;
+ if (params->rowStatus == SNMP_ROW_NOTINSERVICE &&
+ !snmpTargetParams_rowStatusCheck(params)) {
+ params->rowStatus = SNMP_ROW_NOTREADY;
+ }
+ }
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* write_snmpTargetParamsSecLevel */
+
+/*
+ * Assign a value to the storageType variable.
+ */
+int
+write_snmpTargetParamsStorageType(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ long long_ret = *((long *) var_val);
+ static long old_st;
+ struct targetParamTable_struct *params = NULL;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsStorageType: not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long)) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsStorageType: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (long_ret != SNMP_STORAGE_OTHER &&
+ long_ret != SNMP_STORAGE_VOLATILE &&
+ long_ret != SNMP_STORAGE_NONVOLATILE) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsStorageType: attempted storage type not a valid"));
+ DEBUGMSG(("snmpTargetParamsEntry",
+ " value of other(%d), volatile(%d), or nonvolatile(%d)\n",
+ SNMP_STORAGE_OTHER, SNMP_STORAGE_VOLATILE,
+ SNMP_STORAGE_NONVOLATILE));
+ return SNMP_ERR_WRONGVALUE;
+ }
+ } else if (action == RESERVE2) {
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSSTORAGETYPECOLUMN;
+ params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len, 1);
+ if (params == NULL) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsStorageType: BAD OID\n"));
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ /*
+ * Row exists, check if it is changeable.
+ */
+ if (params->storageType == SNMP_STORAGE_READONLY ||
+ params->storageType == SNMP_STORAGE_PERMANENT) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsStorageType: row has unchangeable storage status: %d\n",
+ params->storageType));
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ old_st = params->storageType;
+ params->storageType = long_ret;
+ }
+ } else if (action == FREE || action == UNDO) {
+ /*
+ * Try to undo the SET here (abnormal usage of FREE clause)
+ */
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSSTORAGETYPECOLUMN;
+ if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len,
+ 1)) != NULL) {
+ if (params->storageType != SNMP_STORAGE_READONLY
+ && params->storageType != SNMP_STORAGE_PERMANENT) {
+ params->storageType = old_st;
+ }
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* write_snmpTargetParamsStorageType */
+
+/*
+ * Assign a value to the secName variable.
+ */
+int
+write_snmpTargetParamsSecName(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static char *old_name;
+ struct targetParamTable_struct *params = NULL;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_OCTET_STR) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsSecName: not ASN_OCTET_STR\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > 255 || var_val_len < 0) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsSecName: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ } else if (action == RESERVE2) {
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSSECURITYNAMECOLUMN;
+ params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len, 1);
+ if (params == NULL) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsSecName: BAD OID\n"));
+ return SNMP_ERR_INCONSISTENTNAME;
+ } else {
+ /*
+ * Row exists, check if it is changeable.
+ */
+ if (params->storageType == SNMP_STORAGE_READONLY) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamSecName: row is read only\n"));
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ /*
+ * Check if row is active.
+ */
+ if (params->rowStatus == SNMP_ROW_ACTIVE) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsSecName: this change not allowed in active row.\n"));
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+
+ old_name = params->secName;
+ params->secName = (char *) malloc(var_val_len + 1);
+ if (params->secName == NULL) {
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ memcpy(params->secName, var_val, var_val_len);
+ params->secName[var_val_len] = '\0';
+
+ if (params->rowStatus == SNMP_ROW_NOTREADY &&
+ snmpTargetParams_rowStatusCheck(params)) {
+ params->rowStatus = SNMP_ROW_NOTINSERVICE;
+ }
+ }
+ } else if (action == COMMIT) {
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSSECURITYNAMECOLUMN;
+ if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len,
+ 1)) != NULL) {
+ update_timestamp(params);
+ SNMP_FREE(old_name);
+ old_name = NULL;
+ }
+ } else if (action == FREE || action == UNDO) {
+ /*
+ * Try to undo the SET here (abnormal usage of FREE clause)
+ */
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSSECURITYNAMECOLUMN;
+ if ((params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len,
+ 1)) != NULL) {
+ if (params->storageType != SNMP_STORAGE_READONLY
+ && params->rowStatus != SNMP_ROW_ACTIVE) {
+ SNMP_FREE(params->secName);
+ params->secName = old_name;
+ if (params->rowStatus == SNMP_ROW_NOTINSERVICE &&
+ !snmpTargetParams_rowStatusCheck(params)) {
+ params->rowStatus = SNMP_ROW_NOTREADY;
+ }
+ }
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* write_snmpTargetParamsSecName */
+
+/*
+ * snmpTargeParams_createNewRow is called from write_snmpTargetParamsRowStatus
+ * when a new row is required. It creates a new row with
+ * the index of the passed in 'name' (i.e. full index OID) and
+ * adds it to the linked list. 'name' should be the full OID of the new index.
+ * It passes back 0 if unsuccessfull.
+ */
+int
+snmpTargetParams_createNewRow(oid * name, size_t name_len)
+{
+ int pNameLen, i;
+ struct targetParamTable_struct *temp_struct;
+
+ /*
+ * setup a new snmpTargetParamTable structure and add it to the list
+ */
+ pNameLen = name_len - snmpTargetParamsOIDLen;
+ if (pNameLen > 0) {
+ temp_struct = snmpTargetParamTable_create();
+ temp_struct->paramName = (char *) malloc(pNameLen + 1);
+
+ for (i = 0; i < pNameLen; i++) {
+ temp_struct->paramName[i] =
+ (char) name[i + snmpTargetParamsOIDLen];
+ }
+
+ temp_struct->paramName[pNameLen] = '\0';
+ temp_struct->rowStatus = SNMP_ROW_NOTREADY;
+
+ update_timestamp(temp_struct);
+ snmpTargetParamTable_addToList(temp_struct, &aPTable);
+
+ return 1;
+ }
+
+ return 0;
+} /* snmpTargetParams_createNewRow */
+
+/*
+ * Assign a value to the Row Status variable
+ */
+int
+write_snmpTargetParamsRowStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP,
+ oid * name, size_t name_len)
+{
+ static long value;
+ struct targetParamTable_struct *params = NULL;
+
+ if (action == RESERVE1) {
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsRowStatus not ASN_INTEGER\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != sizeof(long)) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "write to snmpTargetParamsRowStatus: bad length\n"));
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ value = *((long *) var_val);
+ if (value == SNMP_ROW_NOTREADY || value < 1 || value > 6) {
+ return SNMP_ERR_WRONGVALUE;
+ }
+
+ /*
+ * Check index value is reasonable.
+ */
+
+ if (name_len < snmpTargetParamsOIDLen + 1 ||
+ name_len > snmpTargetParamsOIDLen + 32) {
+ DEBUGMSGTL(("snmpTargetParamsEntry", "bad index length %d\n",
+ name_len - snmpTargetParamsOIDLen));
+ return SNMP_ERR_NOCREATION;
+ }
+
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSROWSTATUSCOLUMN;
+ params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len, 1);
+ if (params != NULL) {
+ if (value == SNMP_ROW_CREATEANDGO
+ || value == SNMP_ROW_CREATEANDWAIT) {
+ value = SNMP_ROW_NOTREADY;
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (params->storageType == SNMP_STORAGE_READONLY) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "row is read only\n"));
+ return SNMP_ERR_NOTWRITABLE;
+ }
+ if (params->storageType == SNMP_STORAGE_PERMANENT) {
+ if (value == SNMP_ROW_DESTROY) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "unable to destroy permanent row\n"));
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ }
+ } else {
+ if (value == SNMP_ROW_ACTIVE || value == SNMP_ROW_NOTINSERVICE) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ if (value == SNMP_ROW_CREATEANDGO
+ || value == SNMP_ROW_CREATEANDWAIT) {
+ if (snmpTargetParams_createNewRow(name, name_len) == 0) {
+ DEBUGMSGTL(("snmpTargetParamsEntry",
+ "couldn't malloc() new row\n"));
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ }
+ }
+ }
+ } else if (action == ACTION) {
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSROWSTATUSCOLUMN;
+ params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len, 1);
+ if (params != NULL) {
+ if (value == SNMP_ROW_CREATEANDGO) {
+ /*
+ * Check whether all the required objects have been set.
+ */
+ if (snmpTargetParams_rowStatusCheck(params)) {
+ params->rowStatus = SNMP_ROW_ACTIVE;
+ } else {
+ params->rowStatus = SNMP_ROW_NOTREADY;
+ }
+ } else if (value == SNMP_ROW_CREATEANDWAIT) {
+ /*
+ * Check whether all the required objects have been set.
+ */
+ if (snmpTargetParams_rowStatusCheck(params)) {
+ params->rowStatus = SNMP_ROW_NOTINSERVICE;
+ } else {
+ params->rowStatus = SNMP_ROW_NOTREADY;
+ }
+ } else if (value == SNMP_ROW_ACTIVE) {
+ if (params->rowStatus == SNMP_ROW_NOTINSERVICE) {
+ params->rowStatus = SNMP_ROW_ACTIVE;
+ } else if (params->rowStatus == SNMP_ROW_NOTREADY) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ } else if (value == SNMP_ROW_NOTINSERVICE) {
+ if (params->rowStatus == SNMP_ROW_ACTIVE) {
+ params->rowStatus = SNMP_ROW_NOTINSERVICE;
+ } else if (params->rowStatus == SNMP_ROW_NOTREADY) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ }
+ }
+ } else if (action == COMMIT) {
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSROWSTATUSCOLUMN;
+ params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len, 1);
+ if (params != NULL) {
+ if (value == SNMP_ROW_DESTROY) {
+ snmpTargetParamTable_remFromList(params, &aPTable);
+ }
+ if (value == SNMP_ROW_ACTIVE || value == SNMP_ROW_NOTINSERVICE) {
+ update_timestamp(params);
+ }
+ }
+ } else if (action == UNDO || action == FREE) {
+ snmpTargetParamsOID[snmpTargetParamsOIDLen - 1] =
+ SNMPTARGETPARAMSROWSTATUSCOLUMN;
+ params = search_snmpTargetParamsTable(snmpTargetParamsOID,
+ snmpTargetParamsOIDLen,
+ name, &name_len, 1);
+ if (value == SNMP_ROW_CREATEANDGO
+ || value == SNMP_ROW_CREATEANDWAIT) {
+ if (params != NULL) {
+ snmpTargetParamTable_remFromList(params, &aPTable);
+ }
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+struct targetParamTable_struct *
+get_paramEntry(char *name)
+{
+ static struct targetParamTable_struct *ptr;
+ for (ptr = aPTable; ptr; ptr = ptr->next) {
+ if (strcmp(ptr->paramName, name) == 0) {
+ return ptr;
+ }
+ }
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/target/snmpTargetParamsEntry.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/target/snmpTargetParamsEntry.h
new file mode 100644
index 0000000000..9b5ab85864
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/target/snmpTargetParamsEntry.h
@@ -0,0 +1,77 @@
+
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent. Edited by Michael Baer
+ *
+ * last changed 2/2/99.
+ */
+
+#ifndef _MIBGROUP_SNMPTARGETPARAMSENTRY_H
+#define _MIBGROUP_SNMPTARGETPARAMSENTRY_H
+
+/*
+ * we use header_generic and checkmib from the util_funcs module
+ */
+
+config_require(util_funcs)
+
+ /*
+ * Magic number definitions:
+ */
+#define SNMPTARGETPARAMSMPMODEL 1
+#define SNMPTARGETPARAMSSECURITYMODEL 2
+#define SNMPTARGETPARAMSSECURITYNAME 3
+#define SNMPTARGETPARAMSSECURITYLEVEL 4
+#define SNMPTARGETPARAMSSTORAGETYPE 5
+#define SNMPTARGETPARAMSROWSTATUS 6
+#define SNMPTARGETPARAMSMPMODELCOLUMN 2
+#define SNMPTARGETPARAMSSECURITYMODELCOLUMN 3
+#define SNMPTARGETPARAMSSECURITYNAMECOLUMN 4
+#define SNMPTARGETPARAMSSECURITYLEVELCOLUMN 5
+#define SNMPTARGETPARAMSSTORAGETYPECOLUMN 6
+#define SNMPTARGETPARAMSROWSTATUSCOLUMN 7
+ /*
+ * structure definitions
+ */
+ struct targetParamTable_struct {
+ char *paramName;
+ int mpModel;
+ int secModel;
+ char *secName;
+ int secLevel;
+ int storageType;
+ int rowStatus;
+ struct targetParamTable_struct *next;
+ time_t updateTime;
+ };
+
+/*
+ * utility functions
+ */
+ struct targetParamTable_struct *get_paramEntry(char *name);
+ void snmpTargetParamTable_add(struct
+ targetParamTable_struct
+ *newEntry);
+ struct targetParamTable_struct *snmpTargetParamTable_create(void);
+
+/*
+ * function definitions
+ */
+
+ void init_snmpTargetParamsEntry(void);
+ int store_snmpTargetParamsEntry(int majorID, int minorID,
+ void *serverarg,
+ void *clientarg);
+ extern FindVarMethod var_snmpTargetParamsEntry;
+
+ void snmpd_parse_config_targetParams(const char *, char *);
+
+ WriteMethod write_snmpTargetParamsMPModel;
+ WriteMethod write_snmpTargetParamsSecModel;
+ WriteMethod write_snmpTargetParamsSecName;
+ WriteMethod write_snmpTargetParamsSecLevel;
+ WriteMethod write_snmpTargetParamsStorageType;
+ WriteMethod write_snmpTargetParamsRowStatus;
+
+
+#endif /* _MIBGROUP_SNMPTARGETPARAMSENTRY_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/target/target.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/target/target.c
new file mode 100644
index 0000000000..901e99f4dd
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/target/target.c
@@ -0,0 +1,220 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "snmpTargetAddrEntry.h"
+#include "snmpTargetParamsEntry.h"
+#include "target.h"
+
+#define MAX_TAGS 128
+
+netsnmp_session *
+get_target_sessions(char *taglist, TargetFilterFunction * filterfunct,
+ void *filterArg)
+{
+ netsnmp_session *ret = NULL, thissess;
+ struct targetAddrTable_struct *targaddrs;
+ char buf[SPRINT_MAX_LEN];
+ char tags[MAX_TAGS][SPRINT_MAX_LEN], *cp;
+ int numtags = 0, i;
+ static struct targetParamTable_struct *param;
+
+ DEBUGMSGTL(("target_sessions", "looking for: %s\n", taglist));
+ for (cp = taglist; cp && numtags < MAX_TAGS;) {
+ cp = copy_nword(cp, tags[numtags], sizeof(tags[numtags]));
+ DEBUGMSGTL(("target_sessions", " for: %d=%s\n", numtags,
+ tags[numtags]));
+ numtags++;
+ }
+
+ for (targaddrs = get_addrTable(); targaddrs;
+ targaddrs = targaddrs->next) {
+
+ /*
+ * legal row?
+ */
+ if (targaddrs->tDomain == NULL ||
+ targaddrs->tAddress == NULL ||
+ targaddrs->rowStatus != SNMP_ROW_ACTIVE) {
+ DEBUGMSGTL(("target_sessions", " which is not ready yet\n"));
+ continue;
+ }
+
+ if (netsnmp_tdomain_support
+ (targaddrs->tDomain, targaddrs->tDomainLen, NULL, NULL) == 0) {
+ snmp_log(LOG_ERR,
+ "unsupported domain for target address table entry %s\n",
+ targaddrs->name);
+ }
+
+ /*
+ * check tag list to see if we match
+ */
+ if (targaddrs->tagList) {
+ int matched = 0;
+
+ /*
+ * loop through tag list looking for requested tags
+ */
+ for (cp = targaddrs->tagList; cp && !matched;) {
+ cp = copy_nword(cp, buf, sizeof(buf));
+ for (i = 0; i < numtags && !matched; i++) {
+ if (strcmp(buf, tags[i]) == 0) {
+ /*
+ * found a valid target table entry
+ */
+ DEBUGMSGTL(("target_sessions", "found one: %s\n",
+ tags[i]));
+
+ if (targaddrs->params) {
+ param = get_paramEntry(targaddrs->params);
+ if (!param
+ || param->rowStatus != SNMP_ROW_ACTIVE) {
+ /*
+ * parameter entry must exist and be active
+ */
+ continue;
+ }
+ } else {
+ /*
+ * parameter entry must be specified
+ */
+ continue;
+ }
+
+ /*
+ * last chance for caller to opt-out. Call
+ * filtering function
+ */
+ if (filterfunct &&
+ (*(filterfunct)) (targaddrs, param,
+ filterArg)) {
+ continue;
+ }
+
+ /*
+ * Only one notification per TargetAddrEntry,
+ * rather than one per tag
+ */
+ matched = 1;
+
+ if (targaddrs->storageType != ST_READONLY &&
+ targaddrs->sess &&
+ param->updateTime >=
+ targaddrs->sessionCreationTime) {
+ /*
+ * parameters have changed, nuke the old session
+ */
+ snmp_close(targaddrs->sess);
+ targaddrs->sess = NULL;
+ }
+
+ /*
+ * target session already exists?
+ */
+ if (targaddrs->sess == NULL) {
+ /*
+ * create an appropriate snmp session and add
+ * it to our return list
+ */
+ netsnmp_transport *t = NULL;
+
+ t = netsnmp_tdomain_transport_oid(targaddrs->
+ tDomain,
+ targaddrs->
+ tDomainLen,
+ targaddrs->
+ tAddress,
+ targaddrs->
+ tAddressLen,
+ 0);
+ if (t == NULL) {
+ DEBUGMSGTL(("target_sessions",
+ "bad dest \""));
+ DEBUGMSGOID(("target_sessions",
+ targaddrs->tDomain,
+ targaddrs->tDomainLen));
+ DEBUGMSG(("target_sessions", "\", \""));
+ DEBUGMSGHEX(("target_sessions",
+ targaddrs->tAddress,
+ targaddrs->tAddressLen));
+ DEBUGMSG(("target_sessions", "\n"));
+ continue;
+ } else {
+ char *dst_str =
+ t->f_fmtaddr(t, NULL, 0);
+ if (dst_str != NULL) {
+ DEBUGMSGTL(("target_sessions",
+ " to: %s\n", dst_str));
+ free(dst_str);
+ }
+ }
+ memset(&thissess, 0, sizeof(thissess));
+ thissess.timeout = (targaddrs->timeout) * 1000;
+ thissess.retries = targaddrs->retryCount;
+ DEBUGMSGTL(("target_sessions",
+ "timeout: %d -> %d\n",
+ targaddrs->timeout,
+ thissess.timeout));
+
+ if (param->mpModel == SNMP_VERSION_3 &&
+ param->secModel != 3) {
+ snmp_log(LOG_ERR,
+ "unsupported model/secmodel combo for target %s\n",
+ targaddrs->name);
+ /*
+ * XXX: memleak
+ */
+ netsnmp_transport_free(t);
+ continue;
+ }
+ thissess.paramName = strdup(param->paramName);
+ thissess.version = param->mpModel;
+ if (param->mpModel == SNMP_VERSION_3) {
+ thissess.securityName = strdup(param->secName);
+ thissess.securityNameLen =
+ strlen(thissess.securityName);
+ thissess.securityLevel = param->secLevel;
+ thissess.securityModel = param->secModel;
+#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
+ } else {
+ thissess.community =
+ (u_char *) strdup(param->secName);
+ thissess.community_len =
+ strlen((char *) thissess.community);
+#endif
+ }
+
+ thissess.flags |= SNMP_FLAGS_DONT_PROBE;
+ targaddrs->sess = snmp_add(&thissess, t,
+ NULL, NULL);
+ thissess.flags &= ~SNMP_FLAGS_DONT_PROBE;
+ targaddrs->sessionCreationTime = time(NULL);
+ }
+ if (targaddrs->sess) {
+ if (NULL == targaddrs->sess->paramName)
+ targaddrs->sess->paramName =
+ strdup(param->paramName);
+
+ targaddrs->sess->next = ret;
+ ret = targaddrs->sess;
+ } else {
+ snmp_sess_perror("target session", &thissess);
+ }
+ }
+ }
+ }
+ }
+ }
+ return ret;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/target/target.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/target/target.h
new file mode 100644
index 0000000000..a528b2355a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/target/target.h
@@ -0,0 +1,24 @@
+#ifndef SNMP_TARGET_H
+#define SNMP_TARGET_H
+
+/*
+ * optional filtering function. Return either TARGET_SKIP or TARGET_KEEP
+ */
+typedef int (TargetFilterFunction) (struct targetAddrTable_struct *
+ targaddrs,
+ struct targetParamTable_struct *
+ param, void *);
+#define TARGET_KEEP 0
+#define TARGET_SKIP 1
+
+
+/*
+ * utility functions
+ */
+
+netsnmp_session *get_target_sessions(char *taglist, TargetFilterFunction *,
+ void *filterArg);
+
+config_require(target/snmpTargetAddrEntry target/snmpTargetParamsEntry)
+
+#endif /* SNMP_TARGET_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/target/target_counters.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/target/target_counters.c
new file mode 100644
index 0000000000..02ebb72821
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/target/target_counters.c
@@ -0,0 +1,80 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "target_counters.h"
+#include <net-snmp/agent/instance.h>
+
+static oid unavailable_context_oid[] = { 1, 3, 6, 1, 6, 3, 12, 1, 4 };
+static oid unknown_context_oid[] = { 1, 3, 6, 1, 6, 3, 12, 1, 5 };
+
+void
+init_target_counters(void)
+{
+ DEBUGMSGTL(("target_counters", "initializing\n"));
+
+ /*
+ * unknown contexts
+ */
+
+ netsnmp_register_scalar(
+ netsnmp_create_handler_registration("snmpUnknownContexts",
+ get_unknown_context_count,
+ unknown_context_oid,
+ OID_LENGTH(unknown_context_oid),
+ HANDLER_CAN_RONLY));
+
+ /*
+ * unavailable contexts
+ */
+
+ netsnmp_register_scalar(
+ netsnmp_create_handler_registration("snmpUnavailableContexts",
+ get_unavailable_context_count,
+ unavailable_context_oid,
+ OID_LENGTH(unavailable_context_oid),
+ HANDLER_CAN_RONLY));
+
+}
+
+int
+get_unknown_context_count(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ /*
+ * we're only called for GETs of the right node, so this is easy:
+ */
+
+ u_long long_ret =
+ snmp_get_statistic(STAT_SNMPUNKNOWNCONTEXTS);
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) & long_ret, sizeof(long_ret));
+ return SNMP_ERR_NOERROR;
+}
+
+
+int
+get_unavailable_context_count(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ /*
+ * we're only called for GETs of the right node, so this is easy:
+ */
+
+ u_long long_ret =
+ snmp_get_statistic(STAT_SNMPUNAVAILABLECONTEXTS);
+ snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER,
+ (u_char *) & long_ret, sizeof(long_ret));
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/target/target_counters.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/target/target_counters.h
new file mode 100644
index 0000000000..a7dbf0a0b5
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/target/target_counters.h
@@ -0,0 +1,7 @@
+/*
+ * testhandler.h
+ */
+
+void init_target_counters(void);
+Netsnmp_Node_Handler get_unavailable_context_count;
+Netsnmp_Node_Handler get_unknown_context_count;
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib.h
new file mode 100644
index 0000000000..866d1b4d21
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib.h
@@ -0,0 +1,7 @@
+/*
+ * module to include the modules
+ */
+/*config_require(tcp-mib/tcpConnTable)*/
+config_require(tcp-mib/tcpConnectionTable)
+config_require(tcp-mib/tcpListenerTable)
+config_add_mib(TCP-MIB)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/Makefile b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/Makefile
new file mode 100644
index 0000000000..3067611ce7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/Makefile
@@ -0,0 +1,26 @@
+top_srcdir := ../../../..
+
+CC := gcc
+CFLAGS := -g -DNETSNMP_TCPCONN_TEST \
+ -I$(top_srcdir)/agent/mibgroup/ip-mib/data_access \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/agent/mibgroup
+
+OBJS = tcpConn_common.o tcpConn_linux.o
+
+NETSNMPDIR=$(top_srcdir)
+NETSNMPCONFIG=$(NETSNMPDIR)/net-snmp-config
+NETSNMPBASELIBS := $(shell $(NETSNMPCONFIG) --base-agent-libs)
+NETSNMPEXTLIBS := $(shell $(NETSNMPCONFIG) --external-agent-libs)
+NETSNMPLIBDIRS := $(shell $(NETSNMPCONFIG) --build-lib-dirs $(NETSNMPDIR))
+NETSNMPLIBDEPS := $(shell $(NETSNMPCONFIG) --build-lib-deps $(NETSNMPDIR))
+LIB_DEPS=$(NETSNMPLIBDEPS)
+LIBS=$(NETSNMPLIBDIRS) -Wl,-Bstatic $(NETSNMPBASELIBS) -Wl,-Bdynamic $(NETSNMPEXTLIBS)
+
+TARGET := tcpConn_test
+
+test: $(OBJS)
+ $(CC) $(CFLAGS) $(OBJS) -o $(TARGET) $(LIBS)
+
+clean:
+ rm $(OBJS) $(TARGET)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn.h
new file mode 100644
index 0000000000..43f529340c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn.h
@@ -0,0 +1,28 @@
+/*
+ * tcpConn data access header
+ *
+ * $Id: tcpConn.h 15387 2006-10-10 21:13:36Z tanders $
+ */
+/**---------------------------------------------------------------------*/
+/*
+ * configure required files
+ *
+ * Notes:
+ *
+ * 1) prefer functionality over platform, where possible. If a method
+ * is available for multiple platforms, test that first. That way
+ * when a new platform is ported, it won't need a new test here.
+ *
+ * 2) don't do detail requirements here. If, for example,
+ * HPUX11 had different reuirements than other HPUX, that should
+ * be handled in the *_hpux.h header file.
+ */
+config_require(tcp-mib/data_access/tcpConn_common)
+#if defined( linux )
+config_require(tcp-mib/data_access/tcpConn_linux)
+#elif defined( solaris2 )
+config_require(tcp-mib/data_access/tcpConn_solaris2)
+#else
+# define NETSNMP_TCPCONN_COMMON_ONLY
+#endif
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn_common.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn_common.c
new file mode 100644
index 0000000000..5d4e8c083b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn_common.c
@@ -0,0 +1,267 @@
+/*
+ * TcpConn MIB architecture support
+ *
+ * $Id: tcpConn_common.c 16724 2007-10-14 22:10:09Z magfr $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/tcpConn.h>
+
+#include "tcp-mib/tcpConnectionTable/tcpConnectionTable_constants.h"
+#include "tcp-mib/data_access/tcpConn_private.h"
+
+/**---------------------------------------------------------------------*/
+/*
+ * local static prototypes
+ */
+static void _access_tcpconn_entry_release(netsnmp_tcpconn_entry * entry,
+ void *unused);
+
+/**---------------------------------------------------------------------*/
+/*
+ * external per-architecture functions prototypes
+ *
+ * These shouldn't be called by the general public, so they aren't in
+ * the header file.
+ */
+extern int
+netsnmp_arch_tcpconn_container_load(netsnmp_container* container,
+ u_int load_flags);
+extern int
+netsnmp_arch_tcpconn_entry_init(netsnmp_tcpconn_entry *entry);
+extern int
+netsnmp_arch_tcpconn_entry_copy(netsnmp_tcpconn_entry *lhs,
+ netsnmp_tcpconn_entry *rhs);
+extern void
+netsnmp_arch_tcpconn_entry_cleanup(netsnmp_tcpconn_entry *entry);
+
+
+
+/**---------------------------------------------------------------------*/
+/*
+ * container functions
+ */
+/**
+ */
+netsnmp_container *
+netsnmp_access_tcpconn_container_init(u_int flags)
+{
+ netsnmp_container *container1;
+
+ DEBUGMSGTL(("access:tcpconn:container", "init\n"));
+
+ /*
+ * create the container
+ */
+ container1 = netsnmp_container_find("access:tcpconn:table_container");
+ if (NULL == container1) {
+ snmp_log(LOG_ERR, "tcpconn primary container not found\n");
+ return NULL;
+ }
+ container1->container_name = strdup("tcpConnTable");
+
+ return container1;
+}
+
+/**
+ * @retval NULL error
+ * @retval !NULL pointer to container
+ */
+netsnmp_container*
+netsnmp_access_tcpconn_container_load(netsnmp_container* container, u_int load_flags)
+{
+ int rc;
+
+ DEBUGMSGTL(("access:tcpconn:container", "load\n"));
+
+ if (NULL == container)
+ container = netsnmp_access_tcpconn_container_init(load_flags);
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "no container specified/found for access_tcpconn\n");
+ return NULL;
+ }
+
+ rc = netsnmp_arch_tcpconn_container_load(container, load_flags);
+ if (0 != rc) {
+ netsnmp_access_tcpconn_container_free(container,
+ NETSNMP_ACCESS_TCPCONN_FREE_NOFLAGS);
+ container = NULL;
+ }
+
+ return container;
+}
+
+void
+netsnmp_access_tcpconn_container_free(netsnmp_container *container, u_int free_flags)
+{
+ DEBUGMSGTL(("access:tcpconn:container", "free\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "invalid container for netsnmp_access_tcpconn_free\n");
+ return;
+ }
+
+ if(! (free_flags & NETSNMP_ACCESS_TCPCONN_FREE_DONT_CLEAR)) {
+ /*
+ * free all items.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func*)_access_tcpconn_entry_release,
+ NULL);
+ }
+
+ if(! (free_flags & NETSNMP_ACCESS_TCPCONN_FREE_KEEP_CONTAINER))
+ CONTAINER_FREE(container);
+}
+
+/**---------------------------------------------------------------------*/
+/*
+ * tcpconn_entry functions
+ */
+/**
+ */
+/**
+ */
+netsnmp_tcpconn_entry *
+netsnmp_access_tcpconn_entry_create(void)
+{
+ netsnmp_tcpconn_entry *entry =
+ SNMP_MALLOC_TYPEDEF(netsnmp_tcpconn_entry);
+ int rc = 0;
+
+ DEBUGMSGTL(("verbose:access:tcpconn:entry", "create\n"));
+
+ entry->oid_index.len = 1;
+ entry->oid_index.oids = &entry->arbitrary_index;
+
+ /*
+ * init arch data
+ */
+ rc = netsnmp_arch_tcpconn_entry_init(entry);
+ if (SNMP_ERR_NOERROR != rc) {
+ DEBUGMSGT(("access:tcpconn:create","error %d in arch init\n", rc));
+ netsnmp_access_tcpconn_entry_free(entry);
+ }
+
+ return entry;
+}
+
+/**
+ */
+void
+netsnmp_access_tcpconn_entry_free(netsnmp_tcpconn_entry * entry)
+{
+ if (NULL == entry)
+ return;
+
+ DEBUGMSGTL(("verbose:access:tcpconn:entry", "free\n"));
+
+ if (NULL != entry->arch_data)
+ netsnmp_arch_tcpconn_entry_cleanup(entry);
+
+ free(entry);
+}
+
+/**
+ * update underlying data store (kernel) for entry
+ *
+ * @retval 0 : success
+ * @retval -1 : error
+ */
+int
+netsnmp_access_tcpconn_entry_set(netsnmp_tcpconn_entry * entry)
+{
+ int rc = SNMP_ERR_NOERROR;
+
+ if (NULL == entry) {
+ netsnmp_assert(NULL != entry);
+ return -1;
+ }
+
+ DEBUGMSGTL(("access:tcpconn:entry", "set\n"));
+
+
+ /*
+ * only option is delete
+ */
+ if (! (entry->flags & NETSNMP_ACCESS_TCPCONN_DELETE))
+ return -1;
+
+ rc = netsnmp_arch_tcpconn_delete(entry);
+
+ return rc;
+}
+
+/**
+ * update an old tcpconn_entry from a new one
+ *
+ * @note: only mib related items are compared. Internal objects
+ * such as oid_index, ns_ia_index and flags are not compared.
+ *
+ * @retval -1 : error
+ * @retval >=0 : number of fileds updated
+ */
+int
+netsnmp_access_tcpconn_entry_update(netsnmp_tcpconn_entry *lhs,
+ netsnmp_tcpconn_entry *rhs)
+{
+ int rc, changed = 0;
+
+ DEBUGMSGTL(("access:tcpconn:entry", "update\n"));
+
+ if (lhs->tcpConnState != rhs->tcpConnState) {
+ ++changed;
+ lhs->tcpConnState = rhs->tcpConnState;
+ }
+
+ if (lhs->pid != rhs->pid) {
+ ++changed;
+ lhs->pid = rhs->pid;
+ }
+
+ /*
+ * copy arch stuff. we don't care if it changed
+ */
+ rc = netsnmp_arch_tcpconn_entry_copy(lhs,rhs);
+ if (0 != rc) {
+ snmp_log(LOG_ERR,"arch tcpconn copy failed\n");
+ return -1;
+ }
+
+ return changed;
+}
+
+/**---------------------------------------------------------------------*/
+/*
+ * Utility routines
+ */
+
+/**
+ */
+void
+_access_tcpconn_entry_release(netsnmp_tcpconn_entry * entry, void *context)
+{
+ netsnmp_access_tcpconn_entry_free(entry);
+}
+
+
+#ifdef NETSNMP_TCPCONN_TEST
+
+int
+main(int argc, char** argv)
+{
+ netsnmp_container *container;
+
+ netsnmp_config("debugTokens access:tcp,verbose:access:tcp,tcp,verbose:tcp");
+
+ netsnmp_container_init_list();
+
+ dodebug = 1;
+
+ container = netsnmp_access_tcpconn_container_load(NULL, 0);
+
+ netsnmp_access_tcpconn_container_free(container, 0);
+}
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c
new file mode 100644
index 0000000000..7ffebe6834
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c
@@ -0,0 +1,395 @@
+/*
+ * tcpConnTable MIB architecture support
+ *
+ * $Id: tcpConn_linux.c 15654 2006-12-08 14:30:56Z rstory $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/tcpConn.h>
+
+#include "tcp-mib/tcpConnectionTable/tcpConnectionTable_constants.h"
+#include "tcp-mib/data_access/tcpConn_private.h"
+
+static int
+linux_states[12] = { 1, 5, 3, 4, 6, 7, 11, 1, 8, 9, 2, 10 };
+
+static int _load4(netsnmp_container *container, u_int flags);
+#if defined (NETSNMP_ENABLE_IPV6)
+static int _load6(netsnmp_container *container, u_int flags);
+#endif
+
+/*
+ * initialize arch specific storage
+ *
+ * @retval 0: success
+ * @retval <0: error
+ */
+int
+netsnmp_arch_tcpconn_entry_init(netsnmp_tcpconn_entry *entry)
+{
+ /*
+ * init
+ */
+ return 0;
+}
+
+/*
+ * cleanup arch specific storage
+ */
+void
+netsnmp_arch_tcpconn_entry_cleanup(netsnmp_tcpconn_entry *entry)
+{
+ /*
+ * cleanup
+ */
+}
+
+/*
+ * copy arch specific storage
+ */
+int
+netsnmp_arch_tcpconn_entry_copy(netsnmp_tcpconn_entry *lhs,
+ netsnmp_tcpconn_entry *rhs)
+{
+ return 0;
+}
+
+/*
+ * delete an entry
+ */
+int
+netsnmp_arch_tcpconn_delete(netsnmp_tcpconn_entry *entry)
+{
+ if (NULL == entry)
+ return -1;
+ /** xxx-rks:9 tcpConn delete not implemented */
+ return -1;
+}
+
+
+/**
+ *
+ * @retval 0 no errors
+ * @retval !0 errors
+ */
+int
+netsnmp_arch_tcpconn_container_load(netsnmp_container *container,
+ u_int load_flags )
+{
+ int rc = 0;
+
+ DEBUGMSGTL(("access:tcpconn:container",
+ "tcpconn_container_arch_load (flags %p)\n", load_flags));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR, "no container specified/found for access_tcpconn\n");
+ return -1;
+ }
+
+ rc = _load4(container, load_flags);
+
+#if defined (NETSNMP_ENABLE_IPV6)
+ if((0 != rc) || (load_flags & NETSNMP_ACCESS_TCPCONN_LOAD_IPV4_ONLY))
+ return rc;
+
+ /*
+ * load ipv6. ipv6 module might not be loaded,
+ * so ignore -2 err (file not found)
+ */
+ rc = _load6(container, load_flags);
+ if (-2 == rc)
+ rc = 0;
+#endif
+
+ return rc;
+}
+
+/**
+ *
+ * @retval 0 no errors
+ * @retval !0 errors
+ */
+static int
+_load4(netsnmp_container *container, u_int load_flags)
+{
+ int rc = 0;
+ FILE *in;
+ char line[160];
+
+ netsnmp_assert(NULL != container);
+
+#define PROCFILE "/proc/net/tcp"
+ if (!(in = fopen(PROCFILE, "r"))) {
+ snmp_log(LOG_ERR,"could not open " PROCFILE "\n");
+ return -2;
+ }
+
+ fgets(line, sizeof(line), in); /* skip header */
+
+ /*
+ * sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode
+ * 0: 00000000:8000 00000000:0000 0A 00000000:00000000 00:00000000 00000000 29 0 1028 1 df7b1b80 300 0 0 2 -1
+ */
+ while (fgets(line, sizeof(line), in)) {
+ netsnmp_tcpconn_entry *entry;
+ int state, rc, local_port, remote_port, tmp_state;
+ size_t buf_len, offset;
+ u_char local_addr[10], remote_addr[10];
+ u_char *tmp_ptr;
+
+ if (5 != (rc = sscanf(line, "%*d: %8[0-9A-Z]:%x %8[0-9A-Z]:%x %x",
+ local_addr, &local_port,
+ remote_addr, &remote_port, &tmp_state))) {
+ DEBUGMSGT(("access:tcpconn:container",
+ "error parsing line (%d != 5)\n", rc));
+ DEBUGMSGT(("access:tcpconn:container"," line '%s'\n", line));
+ continue;
+ }
+ DEBUGMSGT(("verbose:access:tcpconn:container"," line '%s'\n", line));
+
+ /*
+ * check if we care about listen state
+ */
+ state = (tmp_state & 0xf) < 12 ? linux_states[tmp_state & 0xf] : 2;
+ if (load_flags) {
+ if (TCPCONNECTIONSTATE_LISTEN == state) {
+ if (load_flags & NETSNMP_ACCESS_TCPCONN_LOAD_NOLISTEN) {
+ DEBUGMSGT(("verbose:access:tcpconn:container",
+ " skipping listen\n"));
+ continue;
+ }
+ }
+ else if (load_flags & NETSNMP_ACCESS_TCPCONN_LOAD_ONLYLISTEN) {
+ DEBUGMSGT(("verbose:access:tcpconn:container",
+ " skipping non-listen\n"));
+ continue;
+ }
+ }
+
+ /*
+ */
+ entry = netsnmp_access_tcpconn_entry_create();
+ if(NULL == entry) {
+ rc = -3;
+ break;
+ }
+
+ /** oddly enough, these appear to already be in network order */
+ entry->loc_port = (unsigned short) local_port;
+ entry->rmt_port = (unsigned short) remote_port;
+ entry->tcpConnState = state;
+
+ /** the addr string may need work */
+ buf_len = strlen(local_addr);
+ if ((8 != buf_len) ||
+ (-1 == netsnmp_addrstr_hton(local_addr, 8))) {
+ DEBUGMSGT(("verbose:access:tcpconn:container",
+ " error processing local address\n"));
+ netsnmp_access_tcpconn_entry_free(entry);
+ continue;
+ }
+ offset = 0;
+ tmp_ptr = entry->loc_addr;
+ rc = netsnmp_hex_to_binary(&tmp_ptr, &buf_len,
+ &offset, 0, local_addr, NULL);
+ entry->loc_addr_len = offset;
+ if ( 4 != entry->loc_addr_len ) {
+ DEBUGMSGT(("access:tcpconn:container",
+ "error parsing local addr (%d != 4)\n",
+ entry->loc_addr_len));
+ DEBUGMSGT(("access:tcpconn:container"," line '%s'\n", line));
+ netsnmp_access_tcpconn_entry_free(entry);
+ continue;
+ }
+
+ /** the addr string may need work */
+ buf_len = strlen((char*)remote_addr);
+ if ((8 != buf_len) ||
+ (-1 == netsnmp_addrstr_hton(remote_addr, 8))) {
+ DEBUGMSGT(("verbose:access:tcpconn:container",
+ " error processing remote address\n"));
+ netsnmp_access_tcpconn_entry_free(entry);
+ continue;
+ }
+ offset = 0;
+ tmp_ptr = entry->rmt_addr;
+ rc = netsnmp_hex_to_binary(&tmp_ptr, &buf_len,
+ &offset, 0, remote_addr, NULL);
+ entry->rmt_addr_len = offset;
+ if ( 4 != entry->rmt_addr_len ) {
+ DEBUGMSGT(("access:tcpconn:container",
+ "error parsing remote addr (%d != 4)\n",
+ entry->rmt_addr_len));
+ DEBUGMSGT(("access:tcpconn:container"," line '%s'\n", line));
+ netsnmp_access_tcpconn_entry_free(entry);
+ continue;
+ }
+
+ /*
+ * add entry to container
+ */
+ entry->arbitrary_index = CONTAINER_SIZE(container) + 1;
+ CONTAINER_INSERT(container, entry);
+ }
+
+ fclose(in);
+
+ if(rc<0)
+ return rc;
+
+ return 0;
+}
+
+#if defined (NETSNMP_ENABLE_IPV6)
+/**
+ *
+ * @retval 0 no errors
+ * @retval !0 errors
+ */
+static int
+_load6(netsnmp_container *container, u_int load_flags)
+{
+ int rc = 0;
+ FILE *in;
+ char line[180];
+ static int log_open_err = 1;
+
+ netsnmp_assert(NULL != container);
+
+#undef PROCFILE
+#define PROCFILE "/proc/net/tcp6"
+ if (!(in = fopen(PROCFILE, "r"))) {
+ snmp_log(LOG_ERR,"could not open " PROCFILE "\n");
+ if (1 == log_open_err) {
+ snmp_log(LOG_ERR,"could not open " PROCFILE "\n");
+ log_open_err = 0;
+ }
+ return -2;
+ }
+ /*
+ * if we turned off logging of open errors, turn it back on now that
+ * we have been able to open the file.
+ */
+ if (0 == log_open_err)
+ log_open_err = 1;
+
+ fgets(line, sizeof(line), in); /* skip header */
+
+ /*
+ * Note: PPC (big endian)
+ *
+ * sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode
+ * 0: 00000000000000000000000000000001:1466 00000000000000000000000000000000:0000 0A 00000000:00000000 00:00000000 00000000 500 0 326699 1 efb81580 3000 0 0 2 -1
+ */
+ while (fgets(line, sizeof(line), in)) {
+ netsnmp_tcpconn_entry *entry;
+ int state, rc, local_port, remote_port, tmp_state;
+ size_t buf_len, offset;
+ u_char local_addr[48], remote_addr[48];
+ u_char *tmp_ptr;
+
+ if (5 != (rc = sscanf(line, "%*d: %47[0-9A-Z]:%x %47[0-9A-Z]:%x %x",
+ local_addr, &local_port,
+ remote_addr, &remote_port, &tmp_state))) {
+ DEBUGMSGT(("access:tcpconn:container",
+ "error parsing line (%d != 5)\n", rc));
+ DEBUGMSGT(("access:tcpconn:container"," line '%s'\n", line));
+ continue;
+ }
+ DEBUGMSGT(("verbose:access:tcpconn:container"," line '%s'\n", line));
+
+ /*
+ * check if we care about listen state
+ */
+ state = (tmp_state & 0xf) < 12 ? linux_states[tmp_state & 0xf] : 2;
+ if (load_flags) {
+ if (TCPCONNECTIONSTATE_LISTEN == state) {
+ if (load_flags & NETSNMP_ACCESS_TCPCONN_LOAD_NOLISTEN) {
+ DEBUGMSGT(("verbose:access:tcpconn:container",
+ " skipping listen\n"));
+ continue;
+ }
+ }
+ else if (load_flags & NETSNMP_ACCESS_TCPCONN_LOAD_ONLYLISTEN) {
+ DEBUGMSGT(("verbose:access:tcpconn:container",
+ " skipping non-listen\n"));
+ continue;
+ }
+ }
+
+ /*
+ */
+ entry = netsnmp_access_tcpconn_entry_create();
+ if(NULL == entry) {
+ rc = -3;
+ break;
+ }
+
+ /** oddly enough, these appear to already be in network order */
+ entry->loc_port = (unsigned short) local_port;
+ entry->rmt_port = (unsigned short) remote_port;
+ entry->tcpConnState = state;
+
+ /** the addr string may need work */
+ buf_len = strlen((char*)local_addr);
+ if ((32 != buf_len) ||
+ (-1 == netsnmp_addrstr_hton(local_addr, 32))) {
+ DEBUGMSGT(("verbose:access:tcpconn:container",
+ " error processing local address\n"));
+ netsnmp_access_tcpconn_entry_free(entry);
+ continue;
+ }
+ offset = 0;
+ tmp_ptr = entry->loc_addr;
+ rc = netsnmp_hex_to_binary(&tmp_ptr, &buf_len,
+ &offset, 0, local_addr, NULL);
+ entry->loc_addr_len = offset;
+ if (( 16 != entry->loc_addr_len ) && ( 20 != entry->loc_addr_len )) {
+ DEBUGMSGT(("access:tcpconn:container",
+ "error parsing local addr (%d != 16|20)\n",
+ entry->loc_addr_len));
+ DEBUGMSGT(("access:tcpconn:container"," line '%s'\n", line));
+ netsnmp_access_tcpconn_entry_free(entry);
+ continue;
+ }
+
+ buf_len = strlen((char*)remote_addr);
+ if ((32 != buf_len) ||
+ (-1 == netsnmp_addrstr_hton(remote_addr, 32))) {
+ DEBUGMSGT(("verbose:access:tcpconn:container",
+ " error processing remote address\n"));
+ netsnmp_access_tcpconn_entry_free(entry);
+ continue;
+ }
+ offset = 0;
+ tmp_ptr = entry->rmt_addr;
+ rc = netsnmp_hex_to_binary(&tmp_ptr, &buf_len,
+ &offset, 0, remote_addr, NULL);
+ entry->rmt_addr_len = offset;
+ if (( 16 != entry->rmt_addr_len ) && ( 20 != entry->rmt_addr_len )) {
+ DEBUGMSGT(("access:tcpconn:container",
+ "error parsing remote addr (%d != 16|20)\n",
+ entry->rmt_addr_len));
+ DEBUGMSGT(("access:tcpconn:container"," line '%s'\n", line));
+ netsnmp_access_tcpconn_entry_free(entry);
+ continue;
+ }
+
+
+ /*
+ * add entry to container
+ */
+ entry->arbitrary_index = CONTAINER_SIZE(container) + 1;
+ CONTAINER_INSERT(container, entry);
+ }
+
+ fclose(in);
+
+ if(rc<0)
+ return rc;
+
+ return 0;
+}
+#endif /* NETSNMP_ENABLE_IPV6 */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn_private.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn_private.h
new file mode 100644
index 0000000000..c758f0e1ae
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn_private.h
@@ -0,0 +1,6 @@
+int netsnmp_arch_tcpconn_container_load(netsnmp_container *, u_int);
+int netsnmp_arch_tcpconn_entry_init(netsnmp_tcpconn_entry *);
+void netsnmp_arch_tcpconn_entry_cleanup(netsnmp_tcpconn_entry *);
+int netsnmp_arch_tcpconn_entry_delete(netsnmp_tcpconn_entry *);
+int netsnmp_arch_tcpconn_entry_copy(netsnmp_tcpconn_entry *,
+ netsnmp_tcpconn_entry *);
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn_solaris2.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn_solaris2.c
new file mode 100644
index 0000000000..7c2c6aeaac
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/data_access/tcpConn_solaris2.c
@@ -0,0 +1,182 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/tcpConn.h>
+
+#include "tcp-mib/tcpConnectionTable/tcpConnectionTable_constants.h"
+#include "tcp-mib/data_access/tcpConn_private.h"
+
+#include "kernel_sunos5.h"
+
+static int _load_tcpconn_table_v4(netsnmp_container *, int);
+#if defined(NETSNMP_ENABLE_IPV6) && defined(SOLARIS_HAVE_IPV6_MIB_SUPPORT)
+static int _load_tcpconn_table_v6(netsnmp_container *, int);
+#endif
+
+int
+netsnmp_arch_tcpconn_entry_init(netsnmp_tcpconn_entry *ep)
+{
+ init_kernel_sunos5();
+ return 0;
+}
+
+void
+netsnmp_arch_tcpconn_entry_cleanup(netsnmp_tcpconn_entry *ep)
+{
+ /*
+ * Do nothing
+ */
+}
+
+int
+netsnmp_arch_tcpconn_entry_copy(netsnmp_tcpconn_entry *ep1,
+ netsnmp_tcpconn_entry *ep2)
+{
+ /*
+ * Do nothing
+ */
+ return 0;
+}
+
+int
+netsnmp_arch_tcpconn_delete(netsnmp_tcpconn_entry *ep)
+{
+ /*
+ * Not implemented
+ */
+ return (-1);
+}
+
+int
+netsnmp_arch_tcpconn_container_load(netsnmp_container * container,
+ u_int load_flag)
+{
+ int rc;
+
+ if ((rc = _load_tcpconn_table_v4(container, load_flag)) != 0) {
+ u_int flag = NETSNMP_ACCESS_TCPCONN_FREE_KEEP_CONTAINER;
+ netsnmp_access_tcpconn_container_free(container, flag);
+ return (rc);
+ }
+#if defined(NETSNMP_ENABLE_IPV6) && defined(SOLARIS_HAVE_IPV6_MIB_SUPPORT)
+ if ((rc = _load_tcpconn_table_v6(container, load_flag)) != 0) {
+ u_int flag = NETSNMP_ACCESS_TCPCONN_FREE_KEEP_CONTAINER;
+ netsnmp_access_tcpconn_container_free(container, flag);
+ return (rc);
+ }
+#endif
+ return (0);
+}
+
+static int
+_load_tcpconn_table_v4(netsnmp_container *container, int flag)
+{
+ mib2_tcpConnEntry_t tc;
+ netsnmp_tcpconn_entry *ep;
+ req_e req = GET_FIRST;
+
+ DEBUGMSGT(("access:tcpconn:container", "load v4\n"));
+
+ while (getMibstat(MIB_TCP_CONN, &tc, sizeof(tc), req,
+ &Get_everything, 0)==0) {
+ req = GET_NEXT;
+ if ((flag & NETSNMP_ACCESS_TCPCONN_LOAD_ONLYLISTEN &&
+ tc.tcpConnState != MIB2_TCP_listen) ||
+ (flag & NETSNMP_ACCESS_TCPCONN_LOAD_NOLISTEN &&
+ tc.tcpConnState == MIB2_TCP_listen)) {
+ continue;
+ }
+ ep = netsnmp_access_tcpconn_entry_create();
+ if (ep == NULL)
+ return (-1);
+ DEBUGMSGT(("access:tcpconn:container", "add entry\n"));
+
+ /*
+ * local address/port.
+ */
+ ep->loc_addr_len = sizeof(tc.tcpConnLocalAddress);
+ if (sizeof(ep->loc_addr) < ep->loc_addr_len) {
+ netsnmp_access_tcpconn_entry_free(ep);
+ return (-1);
+ }
+ (void)memcpy(&ep->loc_addr, &tc.tcpConnLocalAddress, ep->loc_addr_len);
+
+ ep->loc_port = tc.tcpConnLocalPort;
+
+ /*
+ * remote address/port. The address length is the same as the
+ * local address, so no check needed.
+ */
+ ep->rmt_addr_len = sizeof(tc.tcpConnRemAddress);
+ (void)memcpy(&ep->rmt_addr, &tc.tcpConnRemAddress, ep->rmt_addr_len);
+
+ ep->rmt_port = tc.tcpConnRemPort;
+
+ /* state/pid */
+ ep->tcpConnState = tc.tcpConnState;
+ ep->pid = 0;
+ ep->arch_data = NULL;
+
+ /* index */
+ ep->arbitrary_index = CONTAINER_SIZE(container) + 1;
+ CONTAINER_INSERT(container, (void *)ep);
+ }
+ return (0);
+}
+
+#if defined(NETSNMP_ENABLE_IPV6) && defined(SOLARIS_HAVE_IPV6_MIB_SUPPORT)
+static int
+_load_tcpconn_table_v6(netsnmp_container *container, int flag)
+{
+ mib2_tcp6ConnEntry_t tc6;
+ netsnmp_tcpconn_entry *ep;
+ req_e req = GET_FIRST;
+
+ DEBUGMSGT(("access:tcpconn:container", "load v6\n"));
+
+ while (getMibstat(MIB_TCP6_CONN, &tc6, sizeof(tc6), req,
+ &Get_everything, 0)==0) {
+ req = GET_NEXT;
+ if ((flag & NETSNMP_ACCESS_TCPCONN_LOAD_ONLYLISTEN &&
+ tc6.tcp6ConnState != MIB2_TCP_listen) ||
+ (flag & NETSNMP_ACCESS_TCPCONN_LOAD_NOLISTEN &&
+ tc6.tcp6ConnState == MIB2_TCP_listen)) {
+ continue;
+ }
+ ep = netsnmp_access_tcpconn_entry_create();
+ if (ep == NULL)
+ return (-1);
+ DEBUGMSGT(("access:tcpconn:container", "add entry\n"));
+
+ /*
+ * local address/port.
+ */
+ ep->loc_addr_len = sizeof(tc6.tcp6ConnLocalAddress);
+ if (sizeof(ep->loc_addr) < ep->loc_addr_len) {
+ netsnmp_access_tcpconn_entry_free(ep);
+ return (-1);
+ }
+ (void)memcpy(&ep->loc_addr, &tc6.tcp6ConnLocalAddress,
+ ep->loc_addr_len);
+
+ ep->loc_port = tc6.tcp6ConnLocalPort;
+
+ /* remote address/port */
+ ep->rmt_addr_len = sizeof(tc6.tcp6ConnRemAddress);
+ (void)memcpy(&ep->rmt_addr, &tc6.tcp6ConnRemAddress, ep->rmt_addr_len);
+
+ ep->rmt_port = tc6.tcp6ConnRemPort;
+
+ /* state/pid */
+ ep->tcpConnState = tc6.tcp6ConnState;
+ ep->pid = 0;
+ ep->arch_data = NULL;
+
+ /* index */
+ ep->arbitrary_index = CONTAINER_SIZE(container) + 1;
+ CONTAINER_INSERT(container, (void *)ep);
+ }
+ return (0);
+}
+#endif /*defined(NETSNMP_ENABLE_IPV6)&&defined(SOLARIS_HAVE_IPV6_MIB_SUPPORT)*/
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnTable.h
new file mode 100644
index 0000000000..f588c1c456
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnTable.h
@@ -0,0 +1,8 @@
+/*
+ * module to include the modules
+ */
+
+config_require(tcp-mib/data_access/tcpConn)
+config_require(tcp-mib/tcpConnTable/tcpConnTable)
+config_require(tcp-mib/tcpConnTable/tcpConnTable_interface)
+config_require(tcp-mib/tcpConnTable/tcpConnTable_data_access)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable.h
new file mode 100644
index 0000000000..c697aaae97
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable.h
@@ -0,0 +1,6 @@
+/*
+ * module to include the modules
+ */
+
+config_require(tcp-mib/data_access/tcpConn)
+config_require(tcp-mib/tcpConnectionTable/tcpConnectionTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable.c
new file mode 100644
index 0000000000..5dc9424e9f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable.c
@@ -0,0 +1,1135 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: tcpConnectionTable.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** \page MFD helper for tcpConnectionTable
+ *
+ * \section intro Introduction
+ * Introductory text.
+ *
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "tcpConnectionTable.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "tcpConnectionTable_interface.h"
+
+oid tcpConnectionTable_oid[] = { TCPCONNECTIONTABLE_OID };
+int tcpConnectionTable_oid_size =
+OID_LENGTH(tcpConnectionTable_oid);
+
+tcpConnectionTable_registration tcpConnectionTable_user_context;
+
+void initialize_table_tcpConnectionTable(void);
+void shutdown_table_tcpConnectionTable(void);
+
+
+/**
+ * Initializes the tcpConnectionTable module
+ */
+void
+init_tcpConnectionTable(void)
+{
+ DEBUGMSGTL(("verbose:tcpConnectionTable:init_tcpConnectionTable",
+ "called\n"));
+
+ /*
+ * TODO:300:o: Perform tcpConnectionTable one-time module initialization.
+ */
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ if (should_init("tcpConnectionTable"))
+ initialize_table_tcpConnectionTable();
+
+} /* init_tcpConnectionTable */
+
+/**
+ * Shut-down the tcpConnectionTable module (agent is exiting)
+ */
+void
+shutdown_tcpConnectionTable(void)
+{
+ if (should_init("tcpConnectionTable"))
+ shutdown_table_tcpConnectionTable();
+
+}
+
+/**
+ * Initialize the table tcpConnectionTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_tcpConnectionTable(void)
+{
+ tcpConnectionTable_registration *user_context;
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:tcpConnectionTable:initialize_table_tcpConnectionTable", "called\n"));
+
+ /*
+ * TODO:301:o: Perform tcpConnectionTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize tcpConnectionTable user context
+ * if you'd like to pass in a pointer to some data for this
+ * table, allocate or set it up here.
+ */
+ user_context = &tcpConnectionTable_user_context;
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _tcpConnectionTable_initialize_interface(user_context, flags);
+} /* initialize_table_tcpConnectionTable */
+
+/**
+ * Shutdown the table tcpConnectionTable
+ */
+void
+shutdown_table_tcpConnectionTable(void)
+{
+ /*
+ * call interface shutdown code
+ */
+ _tcpConnectionTable_shutdown_interface
+ (&tcpConnectionTable_user_context);
+}
+
+/**
+ * extra context initialization (eg default values)
+ *
+ * @param rowreq_ctx : row request context
+ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
+ *
+ * @retval MFD_SUCCESS : no errors
+ * @retval MFD_ERROR : error (context allocate will fail)
+ */
+int
+tcpConnectionTable_rowreq_ctx_init(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx, void *user_init_ctx)
+{
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_rowreq_ctx_init", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:210:o: |-> Perform extra tcpConnectionTable rowreq initialization. (eg DEFVALS)
+ */
+
+ return MFD_SUCCESS;
+} /* tcpConnectionTable_rowreq_ctx_init */
+
+/**
+ * extra context cleanup
+ *
+ */
+void
+tcpConnectionTable_rowreq_ctx_cleanup(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_rowreq_ctx_cleanup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:211:o: |-> Perform extra tcpConnectionTable rowreq cleanup.
+ */
+} /* tcpConnectionTable_rowreq_ctx_cleanup */
+
+/**
+ * pre-request callback
+ *
+ * @param user_context
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+tcpConnectionTable_pre_request(tcpConnectionTable_registration *
+ user_context)
+{
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_pre_request", "called\n"));
+
+ /*
+ * TODO:510:o: Perform tcpConnectionTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* tcpConnectionTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ * Note:
+ * New rows have been inserted into the container, and
+ * deleted rows have been removed from the container and
+ * released.
+ * @param user_context
+ * @param rc : MFD_SUCCESS if all requests succeeded
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+tcpConnectionTable_post_request(tcpConnectionTable_registration *
+ user_context, int rc)
+{
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_post_request", "called\n"));
+
+ /*
+ * TODO:511:o: Perform tcpConnectionTable post-request actions.
+ */
+
+ /*
+ * check to set if any rows were changed.
+ */
+ if (tcpConnectionTable_dirty_get()) {
+ /*
+ * check if request was successful. If so, this would be
+ * a good place to save data to its persistent store.
+ */
+ if (MFD_SUCCESS == rc) {
+ /*
+ * save changed rows, if you haven't already
+ */
+ }
+
+ tcpConnectionTable_dirty_set(0); /* clear table dirty flag */
+ }
+
+ return MFD_SUCCESS;
+} /* tcpConnectionTable_post_request */
+
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table tcpConnectionTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * TCP-MIB::tcpConnectionTable is subid 19 of tcp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.6.19, length: 8
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement tcpConnectionTable data context functions.
+ */
+/*
+ * tcpConnectionTable_allocate_data
+ *
+ * Purpose: create new tcpConnectionTable_data.
+ */
+tcpConnectionTable_data *
+tcpConnectionTable_allocate_data(void)
+{
+ /*
+ * TODO:201:r: |-> allocate memory for the tcpConnectionTable data context.
+ */
+ tcpConnectionTable_data *rtn =
+ SNMP_MALLOC_TYPEDEF(tcpConnectionTable_data);
+
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_allocate_data", "called\n"));
+
+ if (NULL == rtn) {
+ snmp_log(LOG_ERR, "unable to malloc memory for new "
+ "tcpConnectionTable_data.\n");
+ }
+
+ return rtn;
+} /* tcpConnectionTable_allocate_data */
+
+/*
+ * tcpConnectionTable_release_data
+ *
+ * Purpose: release tcpConnectionTable data.
+ */
+void
+tcpConnectionTable_release_data(tcpConnectionTable_data * data)
+{
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_release_data", "called\n"));
+
+ /*
+ * TODO:202:r: |-> release memory for the tcpConnectionTable data context.
+ */
+ free(data);
+} /* tcpConnectionTable_release_data */
+
+
+
+/**
+ * set mib index(es)
+ *
+ * @param tbl_idx mib index structure
+ * @param tcpConnectionLocalAddressType_val
+ * @param tcpConnectionLocalAddress_val_ptr
+ * @param tcpConnectionLocalAddress_val_ptr_len
+ * @param tcpConnectionLocalPort_val
+ * @param tcpConnectionRemAddressType_val
+ * @param tcpConnectionRemAddress_val_ptr
+ * @param tcpConnectionRemAddress_val_ptr_len
+ * @param tcpConnectionRemPort_val
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This convenience function is useful for setting all the MIB index
+ * components with a single function call. It is assume that the C values
+ * have already been mapped from their native/rawformat to the MIB format.
+ */
+int
+tcpConnectionTable_indexes_set_tbl_idx(tcpConnectionTable_mib_index *
+ tbl_idx,
+ u_long
+ tcpConnectionLocalAddressType_val,
+ char
+ *tcpConnectionLocalAddress_val_ptr,
+ size_t
+ tcpConnectionLocalAddress_val_ptr_len,
+ u_long tcpConnectionLocalPort_val,
+ u_long
+ tcpConnectionRemAddressType_val,
+ char
+ *tcpConnectionRemAddress_val_ptr,
+ size_t
+ tcpConnectionRemAddress_val_ptr_len,
+ u_long tcpConnectionRemPort_val)
+{
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_indexes_set_tbl_idx", "called\n"));
+
+ /*
+ * tcpConnectionLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ /** WARNING: this code might not work for netsnmp_tcpconn_entry */
+ /** are cross protocol connections allowed? */
+ netsnmp_assert(tbl_idx->tcpConnectionRemAddressType ==
+ tbl_idx->tcpConnectionLocalAddressType);
+ if (4 == tcpConnectionLocalAddressType_val)
+ tbl_idx->tcpConnectionLocalAddressType = INETADDRESSTYPE_IPV4;
+ else if (16 == tcpConnectionLocalAddressType_val)
+ tbl_idx->tcpConnectionLocalAddressType = INETADDRESSTYPE_IPV6;
+ else
+ tbl_idx->tcpConnectionLocalAddressType = INETADDRESSTYPE_UNKNOWN;
+
+ /*
+ * tcpConnectionLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ tbl_idx->tcpConnectionLocalAddress_len = sizeof(tbl_idx->tcpConnectionLocalAddress) / sizeof(tbl_idx->tcpConnectionLocalAddress[0]); /* max length */
+ /** WARNING: this code might not work for netsnmp_tcpconn_entry */
+ /*
+ * make sure there is enough space for tcpConnectionLocalAddress data
+ */
+ if ((NULL == tbl_idx->tcpConnectionLocalAddress) ||
+ (tbl_idx->tcpConnectionLocalAddress_len <
+ (tcpConnectionLocalAddress_val_ptr_len))) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->tcpConnectionLocalAddress_len =
+ tcpConnectionLocalAddress_val_ptr_len;
+ memcpy(tbl_idx->tcpConnectionLocalAddress,
+ tcpConnectionLocalAddress_val_ptr,
+ tcpConnectionLocalAddress_val_ptr_len *
+ sizeof(tcpConnectionLocalAddress_val_ptr[0]));
+
+ /*
+ * tcpConnectionLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ /** WARNING: this code might not work for netsnmp_tcpconn_entry */
+ tbl_idx->tcpConnectionLocalPort = tcpConnectionLocalPort_val;
+
+ /*
+ * tcpConnectionRemAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ /** WARNING: this code might not work for netsnmp_tcpconn_entry */
+ tbl_idx->tcpConnectionRemAddressType =
+ tbl_idx->tcpConnectionLocalAddressType;
+
+ /*
+ * tcpConnectionRemAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ tbl_idx->tcpConnectionRemAddress_len = sizeof(tbl_idx->tcpConnectionRemAddress) / sizeof(tbl_idx->tcpConnectionRemAddress[0]); /* max length */
+ /** WARNING: this code might not work for netsnmp_tcpconn_entry */
+ /*
+ * make sure there is enough space for tcpConnectionRemAddress data
+ */
+ if ((NULL == tbl_idx->tcpConnectionRemAddress) ||
+ (tbl_idx->tcpConnectionRemAddress_len <
+ (tcpConnectionRemAddress_val_ptr_len))) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->tcpConnectionRemAddress_len =
+ tcpConnectionRemAddress_val_ptr_len;
+ memcpy(tbl_idx->tcpConnectionRemAddress,
+ tcpConnectionRemAddress_val_ptr,
+ tcpConnectionRemAddress_val_ptr_len *
+ sizeof(tcpConnectionRemAddress_val_ptr[0]));
+
+ /*
+ * tcpConnectionRemPort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ /** WARNING: this code might not work for netsnmp_tcpconn_entry */
+ tbl_idx->tcpConnectionRemPort = tcpConnectionRemPort_val;
+
+
+ return MFD_SUCCESS;
+} /* tcpConnectionTable_indexes_set_tbl_idx */
+
+/**
+ * @internal
+ * set row context indexes
+ *
+ * @param reqreq_ctx the row context that needs updated indexes
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This function sets the mib indexs, then updates the oid indexs
+ * from the mib index.
+ */
+int
+tcpConnectionTable_indexes_set(tcpConnectionTable_rowreq_ctx * rowreq_ctx,
+ u_long tcpConnectionLocalAddressType_val,
+ char *tcpConnectionLocalAddress_val_ptr,
+ size_t
+ tcpConnectionLocalAddress_val_ptr_len,
+ u_long tcpConnectionLocalPort_val,
+ u_long tcpConnectionRemAddressType_val,
+ char *tcpConnectionRemAddress_val_ptr,
+ size_t tcpConnectionRemAddress_val_ptr_len,
+ u_long tcpConnectionRemPort_val)
+{
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_indexes_set", "called\n"));
+
+ if (MFD_SUCCESS !=
+ tcpConnectionTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
+ tcpConnectionLocalAddressType_val,
+ tcpConnectionLocalAddress_val_ptr,
+ tcpConnectionLocalAddress_val_ptr_len,
+ tcpConnectionLocalPort_val,
+ tcpConnectionRemAddressType_val,
+ tcpConnectionRemAddress_val_ptr,
+ tcpConnectionRemAddress_val_ptr_len,
+ tcpConnectionRemPort_val))
+ return MFD_ERROR;
+
+ /*
+ * convert mib index to oid index
+ */
+ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
+ if (0 != tcpConnectionTable_index_to_oid(&rowreq_ctx->oid_idx,
+ &rowreq_ctx->tbl_idx)) {
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS;
+} /* tcpConnectionTable_indexes_set */
+
+
+/*---------------------------------------------------------------------
+ * TCP-MIB::tcpConnectionEntry.tcpConnectionState
+ * tcpConnectionState is subid 7 of tcpConnectionEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.6.19.1.7
+ * Description:
+The state of this TCP connection.
+
+ The value listen(2) is included only for parallelism to the
+ old tcpConnTable, and should not be used. A connection in
+ LISTEN state should be present in the tcpListenerTable.
+
+ The only value which may be set by a management station is
+ deleteTCB(12). Accordingly, it is appropriate for an agent
+ to return a `badValue' response if a management station
+ attempts to set this object to any other value.
+
+ If a management station sets this object to the value
+ deleteTCB(12), then this has the effect of deleting the TCB
+ (as defined in RFC 793) of the corresponding connection on
+ the managed node, resulting in immediate termination of the
+ connection.
+
+ As an implementation-specific option, a RST segment may be
+ sent from the managed node to the other TCP endpoint (note
+ however that RST segments are not sent reliably).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 9/16. Values: closed(1), listen(2), synSent(3), synReceived(4), established(5), finWait1(6), finWait2(7), closeWait(8), lastAck(9), closing(10), timeWait(11), deleteTCB(12)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Extract the current value of the tcpConnectionState data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param tcpConnectionState_val_ptr
+ * Pointer to storage for a long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+tcpConnectionState_get(tcpConnectionTable_rowreq_ctx * rowreq_ctx,
+ u_long * tcpConnectionState_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != tcpConnectionState_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionState_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the tcpConnectionState data.
+ * copy (* tcpConnectionState_val_ptr ) from rowreq_ctx->data
+ */
+ (*tcpConnectionState_val_ptr) = rowreq_ctx->data->tcpConnState;
+
+ return MFD_SUCCESS;
+} /* tcpConnectionState_get */
+
+/*---------------------------------------------------------------------
+ * TCP-MIB::tcpConnectionEntry.tcpConnectionProcess
+ * tcpConnectionProcess is subid 8 of tcpConnectionEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.6.19.1.8
+ * Description:
+The system's process ID for the process associated with
+ this connection, or zero if there is no such process. This
+ value is expected to be the same as HOST-RESOURCES-MIB::
+ hrSWRunIndex or SYSAPPL-MIB::sysApplElmtRunIndex for some
+ row in the appropriate tables.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32)
+ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the tcpConnectionProcess data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param tcpConnectionProcess_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+tcpConnectionProcess_get(tcpConnectionTable_rowreq_ctx * rowreq_ctx,
+ u_long * tcpConnectionProcess_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != tcpConnectionProcess_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionProcess_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the tcpConnectionProcess data.
+ * copy (* tcpConnectionProcess_val_ptr ) from rowreq_ctx->data
+ */
+ (*tcpConnectionProcess_val_ptr) = rowreq_ctx->data->pid;
+
+ return MFD_SUCCESS;
+} /* tcpConnectionProcess_get */
+
+
+
+/** @} */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table tcpConnectionTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * TCP-MIB::tcpConnectionTable is subid 19 of tcp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.6.19, length: 8
+ */
+ /*
+ * NOTE: if you update this chart, please update the versions in
+ * local/mib2c-conf.d/parent-set.m2i
+ * agent/mibgroup/helpers/baby_steps.c
+ * while you're at it.
+ */
+ /*
+ ***********************************************************************
+ * Baby Steps Flow Chart (2004.06.05) *
+ * *
+ * +--------------+ +================+ U = unconditional path *
+ * |optional state| ||required state|| S = path for success *
+ * +--------------+ +================+ E = path for error *
+ ***********************************************************************
+ *
+ * +--------------+
+ * | pre |
+ * | request |
+ * +--------------+
+ * | U
+ * +==============+
+ * +----------------|| object ||
+ * | E || lookup ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | E || check ||
+ * |<---------------|| values ||
+ * | +==============+
+ * | | S
+ * | +==============+
+ * | +<-------|| undo ||
+ * | | E || setup ||
+ * | | +==============+
+ * | | | S
+ * | | +==============+
+ * | | || set ||-------------------------->+
+ * | | || value || E |
+ * | | +==============+ |
+ * | | | S |
+ * | | +--------------+ |
+ * | | | check |-------------------------->|
+ * | | | consistency | E |
+ * | | +--------------+ |
+ * | | | S |
+ * | | +==============+ +==============+ |
+ * | | || commit ||-------->|| undo || |
+ * | | || || E || commit || |
+ * | | +==============+ +==============+ |
+ * | | | S U |<--------+
+ * | | +--------------+ +==============+
+ * | | | irreversible | || undo ||
+ * | | | commit | || set ||
+ * | | +--------------+ +==============+
+ * | | | U U |
+ * | +-------------->|<------------------------+
+ * | +==============+
+ * | || undo ||
+ * | || cleanup ||
+ * | +==============+
+ * +---------------------->| U
+ * +--------------+
+ * | post |
+ * | request |
+ * +--------------+
+ *
+ */
+
+/**
+ * Setup up context with information needed to undo a set request.
+ *
+ * This function will be called before the individual node undo setup
+ * functions are called. If you need to do any undo setup that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that the undo context has been allocated with
+ * tcpConnectionTable_allocate_data(), but may need extra
+ * initialization similar to what you may have done in
+ * tcpConnectionTable_rowreq_ctx_init().
+ * Note that an individual node's undo_setup function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in the node's undo_setup
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (tcpConnectionTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+tcpConnectionTable_undo_setup(tcpConnectionTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_undo_setup",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> Setup tcpConnectionTable undo.
+ * set up tcpConnectionTable undo information, in preparation for a set.
+ * Undo storage is in (* tcpConnectionProcess_val_ptr )*
+ */
+
+ return rc;
+} /* tcpConnectionTable_undo_setup */
+
+/**
+ * Undo a set request.
+ *
+ * This function will be called before the individual node undo
+ * functions are called. If you need to do any undo that is not
+ * related to a specific column, you can do it here.
+ *
+ * Note that an individual node's undo function will only be called
+ * if that node is being set to a new value.
+ *
+ * If there is anything specific to a particular column (e.g. releasing
+ * memory for a string), you should do that setup in the node's undo
+ * function, so it won't be done unless it is necessary.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (tcpConnectionTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ */
+int
+tcpConnectionTable_undo(tcpConnectionTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_undo",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:451:M: |-> tcpConnectionTable undo.
+ * tcpConnectionTable undo information, in response to a failed set.
+ * Undo storage is in (* tcpConnectionProcess_val_ptr )*
+ */
+
+ return rc;
+} /* tcpConnectionTable_undo_setup */
+
+/**
+ * Cleanup up context undo information.
+ *
+ * This function will be called after set/commit processing. If you
+ * allocated any resources in undo_setup, this is the place to release
+ * those resources.
+ *
+ * This function is called regardless of the success or failure of the set
+ * request. If you need to perform different steps for cleanup depending
+ * on success or failure, you can add a flag to the rowreq_ctx.
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (tcpConnectionTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+tcpConnectionTable_undo_cleanup(tcpConnectionTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_undo_cleanup", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:452:M: |-> Cleanup tcpConnectionTable undo.
+ * Undo storage is in (* tcpConnectionProcess_val_ptr )*
+ */
+
+ return rc;
+} /* tcpConnectionTable_undo_cleanup */
+
+/**
+ * commit new values.
+ *
+ * At this point, you should have done everything you can to ensure that
+ * this commit will not fail.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * tcpConnectionTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+tcpConnectionTable_commit(tcpConnectionTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+ int save_flags;
+
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_commit",
+ "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * save flags, then clear until we actually do something
+ */
+ save_flags = rowreq_ctx->column_set_flags;
+ rowreq_ctx->column_set_flags = 0;
+
+ /*
+ * commit tcpConnectionTable data
+ * 1) check the column's flag in save_flags to see if it was set.
+ * 2) clear the flag when you handle that column
+ * 3) set the column's flag in column_set_flags if it needs undo
+ * processing in case of a failure.
+ */
+ if (save_flags & COLUMN_TCPCONNECTIONSTATE_FLAG) {
+ save_flags &= ~COLUMN_TCPCONNECTIONSTATE_FLAG; /* clear tcpConnectionState */
+ /*
+ * TODO:482:o: |-> commit column tcpConnectionState.
+ */
+ rc = -1;
+ if (-1 == rc) {
+ snmp_log(LOG_ERR,
+ "tcpConnectionTable column tcpConnectionState commit failed\n");
+ } else {
+ /*
+ * set flag, in case we need to undo tcpConnectionState
+ */
+ rowreq_ctx->column_set_flags |= COLUMN_TCPCONNECTIONSTATE_FLAG;
+ }
+ }
+
+ /*
+ * if we successfully commited this row, set the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DIRTY;
+ }
+
+ if (save_flags) {
+ snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n",
+ save_flags);
+ return MFD_ERROR;
+ }
+
+ return rc;
+} /* tcpConnectionTable_commit */
+
+/**
+ * undo commit new values.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * tcpConnectionTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error
+ */
+int
+tcpConnectionTable_undo_commit(tcpConnectionTable_rowreq_ctx * rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_undo_commit", "called\n"));
+
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:485:M: |-> Undo tcpConnectionTable commit.
+ * check the column's flag in rowreq_ctx->column_set_flags to see
+ * if it was set during commit, then undo it.
+ *
+ * eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
+ */
+
+
+ /*
+ * if we successfully un-commited this row, clear the dirty flag.
+ */
+ if (MFD_SUCCESS == rc) {
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return rc;
+} /* tcpConnectionTable_undo_commit */
+
+/*
+ * TODO:440:M: Implement tcpConnectionTable node value checks.
+ * TODO:450:M: Implement tcpConnectionTable undo functions.
+ * TODO:460:M: Implement tcpConnectionTable set functions.
+ * TODO:480:M: Implement tcpConnectionTable commit functions.
+ */
+/*---------------------------------------------------------------------
+ * TCP-MIB::tcpConnectionEntry.tcpConnectionState
+ * tcpConnectionState is subid 7 of tcpConnectionEntry.
+ * Its status is Current, and its access level is ReadWrite.
+ * OID: .1.3.6.1.2.1.6.19.1.7
+ * Description:
+The state of this TCP connection.
+
+ The value listen(2) is included only for parallelism to the
+ old tcpConnTable, and should not be used. A connection in
+ LISTEN state should be present in the tcpListenerTable.
+
+ The only value which may be set by a management station is
+ deleteTCB(12). Accordingly, it is appropriate for an agent
+ to return a `badValue' response if a management station
+ attempts to set this object to any other value.
+
+ If a management station sets this object to the value
+ deleteTCB(12), then this has the effect of deleting the TCB
+ (as defined in RFC 793) of the corresponding connection on
+ the managed node, resulting in immediate termination of the
+ connection.
+
+ As an implementation-specific option, a RST segment may be
+ sent from the managed node to the other TCP endpoint (note
+ however that RST segments are not sent reliably).
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 1 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 1
+ *
+ * Enum range: 9/16. Values: closed(1), listen(2), synSent(3), synReceived(4), established(5), finWait1(6), finWait2(7), closeWait(8), lastAck(9), closing(10), timeWait(11), deleteTCB(12)
+ *
+ * Its syntax is INTEGER (based on perltype INTEGER)
+ * The net-snmp type is ASN_INTEGER. The C type decl is long (u_long)
+ */
+/**
+ * Check that the proposed new value is potentially valid.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param tcpConnectionState_val
+ * A long containing the new value.
+ *
+ * @retval MFD_SUCCESS : incoming value is legal
+ * @retval MFD_NOT_VALID_NOW : incoming value is not valid now
+ * @retval MFD_NOT_VALID_EVER : incoming value is never valid
+ *
+ * This is the place to check for requirements that are not
+ * expressed in the mib syntax (for example, a requirement that
+ * is detailed in the description for an object).
+ *
+ * You should check that the requested change between the undo value and the
+ * new value is legal (ie, the transistion from one value to another
+ * is legal).
+ *
+ *@note
+ * This check is only to determine if the new value
+ * is \b potentially valid. This is the first check of many, and
+ * is one of the simplest ones.
+ *
+ *@note
+ * this is not the place to do any checks for values
+ * which depend on some other value in the mib. Those
+ * types of checks should be done in the
+ * tcpConnectionTable_check_dependencies() function.
+ *
+ * The following checks have already been done for you:
+ * The syntax is ASN_INTEGER
+ * The value is one of closed(1), listen(2), synSent(3), synReceived(4), established(5), finWait1(6), finWait2(7), closeWait(8), lastAck(9), closing(10), timeWait(11), deleteTCB(12)
+ *
+ * If there a no other checks you need to do, simply return MFD_SUCCESS.
+ *
+ */
+int
+tcpConnectionState_check_value(tcpConnectionTable_rowreq_ctx * rowreq_ctx,
+ u_long tcpConnectionState_val)
+{
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionState_check_value", "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:441:o: |-> Check for valid tcpConnectionState value.
+ */
+
+ return MFD_SUCCESS; /* tcpConnectionState value not illegal */
+} /* tcpConnectionState_check_value */
+
+/**
+ * Save old value information
+ *
+ * @param rowreq_ctx
+ * Pointer to the table context (tcpConnectionTable_rowreq_ctx)
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_ERROR : error. set will fail.
+ *
+ * This function will be called after the table level undo setup function
+ * tcpConnectionTable_undo_setup has been called.
+ *
+ *@note
+ * this function will only be called if a new value is set for this column.
+ *
+ * If there is any setup specific to a particular column (e.g. allocating
+ * memory for a string), you should do that setup in this function, so it
+ * won't be done unless it is necessary.
+ */
+int
+tcpConnectionState_undo_setup(tcpConnectionTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionState_undo_setup",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:455:o: |-> Setup tcpConnectionState undo.
+ */
+ /*
+ * copy tcpConnectionState data
+ * set rowreq_ctx->undo->tcpConnectionState from rowreq_ctx->data->tcpConnectionState
+ */
+
+
+ return MFD_SUCCESS;
+} /* tcpConnectionState_undo_setup */
+
+/**
+ * Set the new value.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context. You should know how to
+ * manipulate the value from this object.
+ * @param tcpConnectionState_val
+ * A long containing the new value.
+ */
+int
+tcpConnectionState_set(tcpConnectionTable_rowreq_ctx * rowreq_ctx,
+ u_long tcpConnectionState_val)
+{
+
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionState_set",
+ "called\n"));
+
+ /** should never get a NULL pointer */
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:461:M: |-> Set tcpConnectionState value.
+ * set tcpConnectionState value in rowreq_ctx->data
+ */
+
+ return MFD_SUCCESS;
+} /* tcpConnectionState_set */
+
+/**
+ * undo the previous set.
+ *
+ * @param rowreq_ctx
+ * Pointer to the users context.
+ */
+int
+tcpConnectionState_undo(tcpConnectionTable_rowreq_ctx * rowreq_ctx)
+{
+
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionState_undo",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:456:o: |-> Clean up tcpConnectionState undo.
+ */
+ /*
+ * copy tcpConnectionState data
+ * set rowreq_ctx->data->tcpConnectionState from rowreq_ctx->undo->tcpConnectionState
+ */
+
+
+ return MFD_SUCCESS;
+} /* tcpConnectionState_undo */
+
+/**
+ * check dependencies
+ *
+ * This is useful for for tables which have dependencies between columns
+ * (or rows, or tables). For example, two columns allocating a percentage
+ * of something add up 100%.
+ *
+ * Should you need different behavior depending on which columns were
+ * set, rowreq_ctx->column_set_flags will indicate which writeable columns were
+ * set. The definitions for the COLUMN_*_FLAG bits can be found in
+ * tcpConnectionTable.h.
+ * A new row will have the MFD_ROW_CREATED bit set in rowreq_flags.
+ *
+ * @retval MFD_SUCCESS all the changes to the row are legal
+ * @retval MFD_ERROR one or more changes are not legal
+ *
+ * (see README-table-tcpConnectionTable if you don't have dependencies)
+ */
+int
+tcpConnectionTable_check_dependencies(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ int rc = MFD_SUCCESS;
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:tcpConnectionTable_check_dependencies", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:470:o: Check tcpConnectionTable row dependencies.
+ * check that all new value are legal and consistent with each other
+ */
+ return rc;
+} /* tcpConnectionTable_check_dependencies */
+
+/** @} */
+/** @{ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable.h
new file mode 100644
index 0000000000..06bdb3cb84
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable.h
@@ -0,0 +1,620 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: tcpConnectionTable.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+#ifndef TCPCONNECTIONTABLE_H
+#define TCPCONNECTIONTABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @addtogroup misc misc: Miscellaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/data_access/tcpConn.h>
+
+ /*
+ * other required module components
+ */
+ /* *INDENT-OFF* */
+config_require(tcp-mib/data_access/tcpConn)
+config_require(tcp-mib/tcpConnectionTable/tcpConnectionTable_interface)
+config_require(tcp-mib/tcpConnectionTable/tcpConnectionTable_data_access)
+ /* *INDENT-ON* */
+
+ /*
+ * OID, column number and enum definions for tcpConnectionTable
+ */
+#include "tcpConnectionTable_constants.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_tcpConnectionTable(void);
+ void shutdown_tcpConnectionTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table tcpConnectionTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * TCP-MIB::tcpConnectionTable is subid 19 of tcp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.6.19, length: 8
+ */
+ /*
+ *********************************************************************
+ * When you register your mib, you get to provide a generic
+ * pointer that will be passed back to you for most of the
+ * functions calls.
+ *
+ * TODO:100:r: Review all context structures
+ */
+ /*
+ * TODO:101:o: |-> Review tcpConnectionTable registration context.
+ */
+ typedef struct tConnectionT_user_ctx {
+
+ void *dummy;
+
+ } tcpConnectionTable_registration;
+
+/**********************************************************************/
+ /*
+ * TODO:110:r: |-> Review tcpConnectionTable data context structure.
+ * This structure is used to represent the data for tcpConnectionTable.
+ */
+ typedef netsnmp_tcpconn_entry tcpConnectionTable_data;
+
+
+ /*
+ *********************************************************************
+ * TODO:115:o: |-> Review tcpConnectionTable undo context.
+ * We're just going to use the same data structure for our
+ * undo_context. If you want to do something more efficent,
+ * define your typedef here.
+ */
+ typedef tcpConnectionTable_data tcpConnectionTable_undo_data;
+
+ /*
+ * TODO:120:r: |-> Review tcpConnectionTable mib index.
+ * This structure is used to represent the index for tcpConnectionTable.
+ */
+ typedef struct tcpConnectionTable_mib_index_s {
+
+ /*
+ * tcpConnectionLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ u_long tcpConnectionLocalAddressType;
+
+ /*
+ * tcpConnectionLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ /** 128 - 5(other indexes) - oid length(10) = 112 */
+ /** but 20 = size of ipv6z address, longest supported type */
+ char tcpConnectionLocalAddress[20];
+ size_t tcpConnectionLocalAddress_len;
+
+ /*
+ * tcpConnectionLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ u_long tcpConnectionLocalPort;
+
+ /*
+ * tcpConnectionRemAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ u_long tcpConnectionRemAddressType;
+
+ /*
+ * tcpConnectionRemAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ /** 128 - 5(other indexes) - oid length(10) = 112 */
+ /** but 20 = size of ipv6z address, longest supported type */
+ char tcpConnectionRemAddress[20];
+ size_t tcpConnectionRemAddress_len;
+
+ /*
+ * tcpConnectionRemPort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ u_long tcpConnectionRemPort;
+
+
+ } tcpConnectionTable_mib_index;
+
+ /*
+ * TODO:121:r: | |-> Review tcpConnectionTable max index length.
+ * If you KNOW that your indexes will never exceed a certain
+ * length, update this macro to that length.
+ *
+ * BE VERY CAREFUL TO TAKE INTO ACCOUNT THE MAXIMUM
+ * POSSIBLE LENGHT FOR EVERY VARIABLE LENGTH INDEX!
+ * Guessing 128 - col/entry(2) - oid len(8)
+ */
+#define MAX_tcpConnectionTable_IDX_LEN 44
+
+
+ /*
+ *********************************************************************
+ * TODO:130:o: |-> Review tcpConnectionTable Row request (rowreq) context.
+ * When your functions are called, you will be passed a
+ * tcpConnectionTable_rowreq_ctx pointer.
+ */
+ typedef struct tcpConnectionTable_rowreq_ctx_s {
+
+ /** this must be first for container compare to work */
+ netsnmp_index oid_idx;
+ oid oid_tmp[MAX_tcpConnectionTable_IDX_LEN];
+
+ tcpConnectionTable_mib_index tbl_idx;
+
+ tcpConnectionTable_data *data;
+ tcpConnectionTable_undo_data *undo;
+ unsigned int column_set_flags; /* flags for set columns */
+
+
+ /*
+ * flags per row. Currently, the first (lower) 8 bits are reserved
+ * for the user. See mfd.h for other flags.
+ */
+ u_int rowreq_flags;
+
+ /*
+ * TODO:131:o: | |-> Add useful data to tcpConnectionTable rowreq context.
+ */
+
+ /*
+ * storage for future expansion
+ */
+ netsnmp_data_list *tcpConnectionTable_data_list;
+
+ } tcpConnectionTable_rowreq_ctx;
+
+ typedef struct tcpConnectionTable_ref_rowreq_ctx_s {
+ tcpConnectionTable_rowreq_ctx *rowreq_ctx;
+ } tcpConnectionTable_ref_rowreq_ctx;
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionTable_pre_request(tcpConnectionTable_registration *
+ user_context);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionTable_post_request(tcpConnectionTable_registration *
+ user_context, int rc);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionTable_rowreq_ctx_init(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx,
+ void *user_init_ctx);
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionTable_rowreq_ctx_cleanup(tcpConnectionTable_rowreq_ctx
+ * rowreq_ctx);
+
+ tcpConnectionTable_data *tcpConnectionTable_allocate_data(void);
+ void tcpConnectionTable_release_data(tcpConnectionTable_data
+ * data);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionTable_check_dependencies(tcpConnectionTable_rowreq_ctx
+ * rowreq_ctx);
+ int tcpConnectionTable_commit(tcpConnectionTable_rowreq_ctx
+ * rowreq_ctx);
+
+
+
+
+
+
+
+ tcpConnectionTable_rowreq_ctx
+ * tcpConnectionTable_row_find_by_mib_index
+ (tcpConnectionTable_mib_index * mib_idx);
+
+ extern oid tcpConnectionTable_oid[];
+ extern int tcpConnectionTable_oid_size;
+
+
+#include "tcpConnectionTable_interface.h"
+#include "tcpConnectionTable_data_access.h"
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table tcpConnectionTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * TCP-MIB::tcpConnectionTable is subid 19 of tcp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.6.19, length: 8
+ */
+ /*
+ * indexes
+ */
+
+ int tcpConnectionState_get(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ tcpConnectionState_val_ptr);
+ int tcpConnectionProcess_get(tcpConnectionTable_rowreq_ctx
+ * rowreq_ctx,
+ u_long *
+ tcpConnectionProcess_val_ptr);
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionTable_indexes_set_tbl_idx(tcpConnectionTable_mib_index
+ * tbl_idx,
+ u_long
+ tcpConnectionLocalAddressType_val,
+ char
+ *tcpConnectionLocalAddress_val_ptr,
+ size_t
+ tcpConnectionLocalAddress_val_ptr_len,
+ u_long
+ tcpConnectionLocalPort_val,
+ u_long
+ tcpConnectionRemAddressType_val,
+ char
+ *tcpConnectionRemAddress_val_ptr,
+ size_t
+ tcpConnectionRemAddress_val_ptr_len,
+ u_long
+ tcpConnectionRemPort_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionTable_indexes_set(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ tcpConnectionLocalAddressType_val,
+ char
+ *tcpConnectionLocalAddress_val_ptr,
+ size_t
+ tcpConnectionLocalAddress_val_ptr_len,
+ u_long tcpConnectionLocalPort_val,
+ u_long
+ tcpConnectionRemAddressType_val,
+ char
+ *tcpConnectionRemAddress_val_ptr,
+ size_t
+ tcpConnectionRemAddress_val_ptr_len,
+ u_long tcpConnectionRemPort_val);
+
+
+
+ /*
+ *********************************************************************
+ * SET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * SET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table tcpConnectionTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * TCP-MIB::tcpConnectionTable is subid 19 of tcp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.6.19, length: 8
+ */
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionTable_undo_setup(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionTable_undo_cleanup(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx);
+ int tcpConnectionTable_undo(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx);
+ int tcpConnectionTable_commit(tcpConnectionTable_rowreq_ctx
+ * rowreq_ctx);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionTable_undo_commit(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionState_check_value(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long tcpConnectionState_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionState_undo_setup(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx);
+ int tcpConnectionState_set(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long tcpConnectionState_val);
+ int tcpConnectionState_undo(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionProcess_check_value(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long tcpConnectionProcess_val);
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionProcess_undo_setup(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx);
+ int tcpConnectionProcess_set(tcpConnectionTable_rowreq_ctx
+ * rowreq_ctx,
+ u_long
+ tcpConnectionProcess_val);
+ int tcpConnectionProcess_undo(tcpConnectionTable_rowreq_ctx
+ * rowreq_ctx);
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionTable_check_dependencies(tcpConnectionTable_rowreq_ctx
+ * ctx);
+
+
+ /*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* TCPCONNECTIONTABLE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_constants.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_constants.h
new file mode 100644
index 0000000000..01f72159c8
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_constants.h
@@ -0,0 +1,138 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $
+ *
+ * $Id: tcpConnectionTable_constants.h 13776 2005-12-01 21:42:04Z rstory $
+ */
+#ifndef TCPCONNECTIONTABLE_CONSTANTS_H
+#define TCPCONNECTIONTABLE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ * column number definitions for table tcpConnectionTable
+ */
+#define TCPCONNECTIONTABLE_OID 1,3,6,1,2,1,6,19
+
+#define COLUMN_TCPCONNECTIONLOCALADDRESSTYPE 1
+
+#define COLUMN_TCPCONNECTIONLOCALADDRESS 2
+
+#define COLUMN_TCPCONNECTIONLOCALPORT 3
+
+#define COLUMN_TCPCONNECTIONREMADDRESSTYPE 4
+
+#define COLUMN_TCPCONNECTIONREMADDRESS 5
+
+#define COLUMN_TCPCONNECTIONREMPORT 6
+
+#define COLUMN_TCPCONNECTIONSTATE 7
+#define COLUMN_TCPCONNECTIONSTATE_FLAG (0x1 << 6)
+
+#define COLUMN_TCPCONNECTIONPROCESS 8
+
+
+#define TCPCONNECTIONTABLE_MIN_COL COLUMN_TCPCONNECTIONSTATE
+#define TCPCONNECTIONTABLE_MAX_COL COLUMN_TCPCONNECTIONPROCESS
+
+
+ /*
+ * TODO:405:r: Review TCPCONNECTIONTABLE_SETTABLE_COLS macro.
+ * OR together all the writable cols.
+ */
+#define TCPCONNECTIONTABLE_SETTABLE_COLS (COLUMN_TCPCONNECTIONSTATE_FLAG)
+ /*
+ * NOTES on enums
+ * ==============
+ *
+ * Value Mapping
+ * -------------
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them
+ * below. For example, a boolean flag (1/0) is usually represented
+ * as a TruthValue in a MIB, which maps to the values (1/2).
+ *
+ */
+/*************************************************************************
+ *************************************************************************
+ *
+ * enum definitions for table tcpConnectionTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * tcpConnectionLocalAddressType (InetAddressType / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef INETADDRESSTYPE_ENUMS
+#define INETADDRESSTYPE_ENUMS
+
+#define INETADDRESSTYPE_UNKNOWN 0
+#define INETADDRESSTYPE_IPV4 1
+#define INETADDRESSTYPE_IPV6 2
+#define INETADDRESSTYPE_IPV4Z 3
+#define INETADDRESSTYPE_IPV6Z 4
+#define INETADDRESSTYPE_DNS 16
+
+#endif /* INETADDRESSTYPE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * tcpConnectionRemAddressType (InetAddressType / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef INETADDRESSTYPE_ENUMS
+#define INETADDRESSTYPE_ENUMS
+
+#define INETADDRESSTYPE_UNKNOWN 0
+#define INETADDRESSTYPE_IPV4 1
+#define INETADDRESSTYPE_IPV6 2
+#define INETADDRESSTYPE_IPV4Z 3
+#define INETADDRESSTYPE_IPV6Z 4
+#define INETADDRESSTYPE_DNS 16
+
+#endif /* INETADDRESSTYPE_ENUMS */
+
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * tcpConnectionState (INTEGER / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef TCPCONNECTIONSTATE_ENUMS
+#define TCPCONNECTIONSTATE_ENUMS
+
+#define TCPCONNECTIONSTATE_CLOSED 1
+#define TCPCONNECTIONSTATE_LISTEN 2
+#define TCPCONNECTIONSTATE_SYNSENT 3
+#define TCPCONNECTIONSTATE_SYNRECEIVED 4
+#define TCPCONNECTIONSTATE_ESTABLISHED 5
+#define TCPCONNECTIONSTATE_FINWAIT1 6
+#define TCPCONNECTIONSTATE_FINWAIT2 7
+#define TCPCONNECTIONSTATE_CLOSEWAIT 8
+#define TCPCONNECTIONSTATE_LASTACK 9
+#define TCPCONNECTIONSTATE_CLOSING 10
+#define TCPCONNECTIONSTATE_TIMEWAIT 11
+#define TCPCONNECTIONSTATE_DELETETCB 12
+
+#endif /* TCPCONNECTIONSTATE_ENUMS */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* TCPCONNECTIONTABLE_OIDS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_data_access.c
new file mode 100644
index 0000000000..a7811e5bcc
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_data_access.c
@@ -0,0 +1,321 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: tcpConnectionTable_data_access.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "tcpConnectionTable.h"
+
+
+#include "tcpConnectionTable_data_access.h"
+
+/** @ingroup interface
+ * @addtogroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table tcpConnectionTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * TCP-MIB::tcpConnectionTable is subid 19 of tcp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.6.19, length: 8
+ */
+
+/**
+ * initialization for tcpConnectionTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param tcpConnectionTable_reg
+ * Pointer to tcpConnectionTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+tcpConnectionTable_init_data(tcpConnectionTable_registration *
+ tcpConnectionTable_reg)
+{
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_init_data",
+ "called\n"));
+
+ /*
+ * TODO:303:o: Initialize tcpConnectionTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* tcpConnectionTable_init_data */
+
+/**
+ * container overview
+ *
+ */
+
+/**
+ * container initialization
+ *
+ * @param container_ptr_ptr A pointer to a container pointer. If you
+ * create a custom container, use this parameter to return it
+ * to the MFD helper. If set to NULL, the MFD helper will
+ * allocate a container for you.
+ * @param cache A pointer to a cache structure. You can set the timeout
+ * and other cache flags using this pointer.
+ *
+ * This function is called at startup to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases. If no custom
+ * container is allocated, the MFD code will create one for your.
+ *
+ * This is also the place to set up cache behavior. The default, to
+ * simply set the cache timeout, will work well with the default
+ * container. If you are using a custom container, you may want to
+ * look at the cache helper documentation to see if there are any
+ * flags you want to set.
+ *
+ * @remark
+ * This would also be a good place to do any initialization needed
+ * for you data source. For example, opening a connection to another
+ * process that will supply the data, opening a database, etc.
+ */
+void
+tcpConnectionTable_container_init(netsnmp_container **container_ptr_ptr,
+ netsnmp_cache * cache)
+{
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_container_init", "called\n"));
+
+ if (NULL == container_ptr_ptr) {
+ snmp_log(LOG_ERR,
+ "bad container param to tcpConnectionTable_container_init\n");
+ return;
+ }
+
+ /*
+ * For advanced users, you can use a custom container. If you
+ * do not create one, one will be created for you.
+ */
+ *container_ptr_ptr = NULL;
+
+ if (NULL == cache) {
+ snmp_log(LOG_ERR,
+ "bad cache param to tcpConnectionTable_container_init\n");
+ return;
+ }
+
+ /*
+ * TODO:345:A: Set up tcpConnectionTable cache properties.
+ *
+ * Also for advanced users, you can set parameters for the
+ * cache. Do not change the magic pointer, as it is used
+ * by the MFD helper. To completely disable caching, set
+ * cache->enabled to 0.
+ */
+ cache->timeout = TCPCONNECTIONTABLE_CACHE_TIMEOUT; /* seconds */
+ cache->flags |= NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
+} /* tcpConnectionTable_container_init */
+
+/**
+ * container shutdown
+ *
+ * @param container_ptr A pointer to the container.
+ *
+ * This function is called at shutdown to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases.
+ *
+ * This function is called before tcpConnectionTable_container_free().
+ *
+ * @remark
+ * This would also be a good place to do any cleanup needed
+ * for you data source. For example, closing a connection to another
+ * process that supplied the data, closing a database, etc.
+ */
+void
+tcpConnectionTable_container_shutdown(netsnmp_container *container_ptr)
+{
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_container_shutdown", "called\n"));
+
+ if (NULL == container_ptr) {
+ snmp_log(LOG_ERR,
+ "bad params to tcpConnectionTable_container_shutdown\n");
+ return;
+ }
+
+} /* tcpConnectionTable_container_shutdown */
+
+/**
+ * add new entry
+ */
+static void
+_add_connection(netsnmp_tcpconn_entry *entry, netsnmp_container *container)
+{
+ tcpConnectionTable_rowreq_ctx *rowreq_ctx;
+
+ DEBUGMSGTL(("tcpConnectionTable:access", "creating new entry\n"));
+
+ /*
+ * allocate an row context and set the index(es), then add it to
+ * the container
+ */
+ rowreq_ctx = tcpConnectionTable_allocate_rowreq_ctx(entry, NULL);
+ if ((NULL != rowreq_ctx) &&
+ (MFD_SUCCESS == tcpConnectionTable_indexes_set(rowreq_ctx,
+ entry->loc_addr_len,
+ entry->loc_addr,
+ entry->loc_addr_len,
+ entry->loc_port,
+ entry->rmt_addr_len,
+ entry->rmt_addr,
+ entry->rmt_addr_len,
+ entry->rmt_port))) {
+ CONTAINER_INSERT(container, rowreq_ctx);
+ } else {
+ if (rowreq_ctx) {
+ snmp_log(LOG_ERR, "error setting index while loading "
+ "tcpConnectionTable cache.\n");
+ tcpConnectionTable_release_rowreq_ctx(rowreq_ctx);
+ } else {
+ snmp_log(LOG_ERR, "memory allocation failed while loading "
+ "tcpConnectionTable cache.\n");
+ netsnmp_access_tcpconn_entry_free(entry);
+ }
+ }
+}
+
+/**
+ * load initial data
+ *
+ * TODO:350:M: Implement tcpConnectionTable data load
+ * This function will also be called by the cache helper to load
+ * the container again (after the container free function has been
+ * called to free the previous contents).
+ *
+ * @param container container to which items should be inserted
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
+ * @retval MFD_ERROR : other error.
+ *
+ * This function is called to load the index(es) (and data, optionally)
+ * for the every row in the data set.
+ *
+ * @remark
+ * While loading the data, the only important thing is the indexes.
+ * If access to your data is cheap/fast (e.g. you have a pointer to a
+ * structure in memory), it would make sense to update the data here.
+ * If, however, the accessing the data invovles more work (e.g. parsing
+ * some other existing data, or peforming calculations to derive the data),
+ * then you can limit yourself to setting the indexes and saving any
+ * information you will need later. Then use the saved information in
+ * tcpConnectionTable_row_prep() for populating data.
+ *
+ * @note
+ * If you need consistency between rows (like you want statistics
+ * for each row to be from the same time frame), you should set all
+ * data here.
+ *
+ */
+int
+tcpConnectionTable_container_load(netsnmp_container *container)
+{
+ netsnmp_container *raw_data =
+ netsnmp_access_tcpconn_container_load(NULL,
+ NETSNMP_ACCESS_TCPCONN_LOAD_NOLISTEN);
+
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_container_load", "called\n"));
+
+ if (NULL == raw_data)
+ return MFD_RESOURCE_UNAVAILABLE; /* msg already logged */
+
+ /*
+ * got all the connections. pull out the active ones.
+ */
+ CONTAINER_FOR_EACH(raw_data, (netsnmp_container_obj_func *)
+ _add_connection, container);
+
+ /*
+ * free the container. we've either claimed each entry, or released it,
+ * so the dal function doesn't need to clear the container.
+ */
+ netsnmp_access_tcpconn_container_free(raw_data,
+ NETSNMP_ACCESS_TCPCONN_FREE_DONT_CLEAR);
+
+ DEBUGMSGT(("verbose:tcpConnectionTable:tcpConnectionTable_cache_load",
+ "%d records\n", CONTAINER_SIZE(container)));
+
+ return MFD_SUCCESS;
+} /* tcpConnectionTable_container_load */
+
+/**
+ * container clean up
+ *
+ * @param container container with all current items
+ *
+ * This optional callback is called prior to all
+ * item's being removed from the container. If you
+ * need to do any processing before that, do it here.
+ *
+ * @note
+ * The MFD helper will take care of releasing all the row contexts.
+ *
+ */
+void
+tcpConnectionTable_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_container_free", "called\n"));
+
+ /*
+ * TODO:380:M: Free tcpConnectionTable container data.
+ */
+} /* tcpConnectionTable_container_free */
+
+/**
+ * prepare row for processing.
+ *
+ * When the agent has located the row for a request, this function is
+ * called to prepare the row for processing. If you fully populated
+ * the data context during the index setup phase, you may not need to
+ * do anything.
+ *
+ * @param rowreq_ctx pointer to a context.
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ */
+int
+tcpConnectionTable_row_prep(tcpConnectionTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_row_prep",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+
+ return MFD_SUCCESS;
+} /* tcpConnectionTable_row_prep */
+
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_data_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_data_access.h
new file mode 100644
index 0000000000..350165aeff
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_data_access.h
@@ -0,0 +1,105 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: tcpConnectionTable_data_access.h 13776 2005-12-01 21:42:04Z rstory $
+ */
+#ifndef TCPCONNECTIONTABLE_DATA_ACCESS_H
+#define TCPCONNECTIONTABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table tcpConnectionTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * TCP-MIB::tcpConnectionTable is subid 19 of tcp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.6.19, length: 8
+ */
+
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionTable_init_data(tcpConnectionTable_registration *
+ tcpConnectionTable_reg);
+
+
+ /*
+ * TODO:180:o: Review tcpConnectionTable cache timeout.
+ * The number of seconds before the cache times out
+ */
+#define TCPCONNECTIONTABLE_CACHE_TIMEOUT 60
+
+ void tcpConnectionTable_container_init(netsnmp_container
+ **container_ptr_ptr,
+ netsnmp_cache *
+ cache);
+ void tcpConnectionTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int tcpConnectionTable_container_load(netsnmp_container
+ *container);
+ void tcpConnectionTable_container_free(netsnmp_container
+ *container);
+
+ int tcpConnectionTable_cache_load(netsnmp_container
+ *container);
+ void tcpConnectionTable_cache_free(netsnmp_container
+ *container);
+
+ int
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionTable_row_prep(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* TCPCONNECTIONTABLE_DATA_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_interface.c
new file mode 100644
index 0000000000..9bd5606adb
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_interface.c
@@ -0,0 +1,1790 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: tcpConnectionTable_interface.c 15015 2006-08-17 15:06:43Z rstory $
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "tcpConnectionTable.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "tcpConnectionTable_interface.h"
+
+#include <ctype.h>
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table tcpConnectionTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * TCP-MIB::tcpConnectionTable is subid 19 of tcp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.6.19, length: 8
+ */
+typedef struct tcpConnectionTable_interface_ctx_s {
+
+ netsnmp_container *container;
+ netsnmp_cache *cache;
+
+ tcpConnectionTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+ u_int table_dirty;
+
+} tcpConnectionTable_interface_ctx;
+
+static tcpConnectionTable_interface_ctx tcpConnectionTable_if_ctx;
+
+static void
+ _tcpConnectionTable_container_init(tcpConnectionTable_interface_ctx *
+ if_ctx);
+static void
+ _tcpConnectionTable_container_shutdown(tcpConnectionTable_interface_ctx *
+ if_ctx);
+
+
+netsnmp_container *
+tcpConnectionTable_container_get(void)
+{
+ return tcpConnectionTable_if_ctx.container;
+}
+
+tcpConnectionTable_registration *
+tcpConnectionTable_registration_get(void)
+{
+ return tcpConnectionTable_if_ctx.user_ctx;
+}
+
+tcpConnectionTable_registration *
+tcpConnectionTable_registration_set(tcpConnectionTable_registration *
+ newreg)
+{
+ tcpConnectionTable_registration *old =
+ tcpConnectionTable_if_ctx.user_ctx;
+ tcpConnectionTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+
+int
+tcpConnectionTable_container_size(void)
+{
+ return CONTAINER_SIZE(tcpConnectionTable_if_ctx.container);
+}
+
+u_int
+tcpConnectionTable_dirty_get(void)
+{
+ return tcpConnectionTable_if_ctx.table_dirty;
+}
+
+void
+tcpConnectionTable_dirty_set(u_int status)
+{
+ DEBUGMSGTL(("tcpConnectionTable:tcpConnectionTable_dirty_set",
+ "called. was %d, now %d\n",
+ tcpConnectionTable_if_ctx.table_dirty, status));
+ tcpConnectionTable_if_ctx.table_dirty = status;
+}
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_tcpConnectionTable_pre_request;
+static Netsnmp_Node_Handler _mfd_tcpConnectionTable_post_request;
+static Netsnmp_Node_Handler _mfd_tcpConnectionTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_tcpConnectionTable_get_values;
+static Netsnmp_Node_Handler _mfd_tcpConnectionTable_check_objects;
+static Netsnmp_Node_Handler _mfd_tcpConnectionTable_undo_setup;
+static Netsnmp_Node_Handler _mfd_tcpConnectionTable_set_values;
+static Netsnmp_Node_Handler _mfd_tcpConnectionTable_undo_cleanup;
+static Netsnmp_Node_Handler _mfd_tcpConnectionTable_undo_values;
+static Netsnmp_Node_Handler _mfd_tcpConnectionTable_commit;
+static Netsnmp_Node_Handler _mfd_tcpConnectionTable_undo_commit;
+static Netsnmp_Node_Handler _mfd_tcpConnectionTable_irreversible_commit;
+static Netsnmp_Node_Handler _mfd_tcpConnectionTable_check_dependencies;
+
+NETSNMP_STATIC_INLINE int
+ _tcpConnectionTable_undo_column(tcpConnectionTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list *
+ var, int column);
+
+/**
+ * @internal
+ * Initialize the table tcpConnectionTable
+ * (Define its contents and how it's structured)
+ */
+void
+_tcpConnectionTable_initialize_interface(tcpConnectionTable_registration *
+ reg_ptr, u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &tcpConnectionTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info =
+ &tcpConnectionTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_tcpConnectionTable_initialize_interface", "called\n"));
+
+
+ /*************************************************
+ *
+ * save interface context for tcpConnectionTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
+ /** index: tcpConnectionLocalAddressType */
+ ASN_OCTET_STR,
+ /** index: tcpConnectionLocalAddress */
+ ASN_UNSIGNED,
+ /** index: tcpConnectionLocalPort */
+ ASN_INTEGER,
+ /** index: tcpConnectionRemAddressType */
+ ASN_OCTET_STR,
+ /** index: tcpConnectionRemAddress */
+ ASN_UNSIGNED,
+ /** index: tcpConnectionRemPort */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrival.
+ */
+ tbl_info->min_column = TCPCONNECTIONTABLE_MIN_COL;
+ tbl_info->max_column = TCPCONNECTIONTABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ tcpConnectionTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ tcpConnectionTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _tcpConnectionTable_container_init(&tcpConnectionTable_if_ctx);
+ if (NULL == tcpConnectionTable_if_ctx.container) {
+ snmp_log(LOG_ERR,
+ "could not initialize container for tcpConnectionTable\n");
+ return;
+ }
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup =
+ _mfd_tcpConnectionTable_object_lookup;
+ access_multiplexer->get_values = _mfd_tcpConnectionTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request = _mfd_tcpConnectionTable_pre_request;
+ access_multiplexer->post_request =
+ _mfd_tcpConnectionTable_post_request;
+
+
+ /*
+ * REQUIRED wrappers for set request handling
+ */
+ access_multiplexer->object_syntax_checks =
+ _mfd_tcpConnectionTable_check_objects;
+ access_multiplexer->undo_setup = _mfd_tcpConnectionTable_undo_setup;
+ access_multiplexer->undo_cleanup =
+ _mfd_tcpConnectionTable_undo_cleanup;
+ access_multiplexer->set_values = _mfd_tcpConnectionTable_set_values;
+ access_multiplexer->undo_sets = _mfd_tcpConnectionTable_undo_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->commit = _mfd_tcpConnectionTable_commit;
+ access_multiplexer->undo_commit = _mfd_tcpConnectionTable_undo_commit;
+ access_multiplexer->irreversible_commit =
+ _mfd_tcpConnectionTable_irreversible_commit;
+
+ /*
+ * REQUIRED for tables with dependencies
+ */
+ access_multiplexer->consistency_checks =
+ _mfd_tcpConnectionTable_check_dependencies;
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("tcpConnectionTable:init_tcpConnectionTable",
+ "Registering tcpConnectionTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("tcpConnectionTable", handler,
+ tcpConnectionTable_oid,
+ tcpConnectionTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RWRITE);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR, "error registering table tcpConnectionTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &tcpConnectionTable_if_ctx;
+
+ /*************************************************
+ *
+ * set up baby steps handler, create it and inject it
+ */
+ if (access_multiplexer->object_lookup)
+ mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
+ if (access_multiplexer->set_values)
+ mfd_modes |= BABY_STEP_SET_VALUES;
+ if (access_multiplexer->irreversible_commit)
+ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
+ if (access_multiplexer->object_syntax_checks)
+ mfd_modes |= BABY_STEP_CHECK_OBJECT;
+
+ if (access_multiplexer->pre_request)
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if (access_multiplexer->post_request)
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+ if (access_multiplexer->undo_setup)
+ mfd_modes |= BABY_STEP_UNDO_SETUP;
+ if (access_multiplexer->undo_cleanup)
+ mfd_modes |= BABY_STEP_UNDO_CLEANUP;
+ if (access_multiplexer->undo_sets)
+ mfd_modes |= BABY_STEP_UNDO_SETS;
+
+ if (access_multiplexer->row_creation)
+ mfd_modes |= BABY_STEP_ROW_CREATE;
+ if (access_multiplexer->consistency_checks)
+ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
+ if (access_multiplexer->commit)
+ mfd_modes |= BABY_STEP_COMMIT;
+ if (access_multiplexer->undo_commit)
+ mfd_modes |= BABY_STEP_UNDO_COMMIT;
+
+ handler = netsnmp_baby_steps_handler_get(mfd_modes);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
+ */
+ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler =
+ netsnmp_container_table_handler_get(tbl_info,
+ tcpConnectionTable_if_ctx.
+ container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject cache helper
+ */
+ if (NULL != tcpConnectionTable_if_ctx.cache) {
+ handler =
+ netsnmp_cache_handler_get(tcpConnectionTable_if_ctx.cache);
+ netsnmp_inject_handler(reginfo, handler);
+ }
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+} /* _tcpConnectionTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table tcpConnectionTable
+ */
+void
+_tcpConnectionTable_shutdown_interface(tcpConnectionTable_registration *
+ reg_ptr)
+{
+ /*
+ * shutdown the container
+ */
+ _tcpConnectionTable_container_shutdown(&tcpConnectionTable_if_ctx);
+}
+
+void
+tcpConnectionTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ tcpConnectionTable_if_ctx.tbl_info.valid_columns = vc;
+} /* tcpConnectionTable_valid_columns_set */
+
+/**
+ * @internal
+ * convert the index component stored in the context to an oid
+ */
+int
+tcpConnectionTable_index_to_oid(netsnmp_index * oid_idx,
+ tcpConnectionTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * tcpConnectionLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_tcpConnectionLocalAddressType;
+ /*
+ * tcpConnectionLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_tcpConnectionLocalAddress;
+ /*
+ * tcpConnectionLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_tcpConnectionLocalPort;
+ /*
+ * tcpConnectionRemAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_tcpConnectionRemAddressType;
+ /*
+ * tcpConnectionRemAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_tcpConnectionRemAddress;
+ /*
+ * tcpConnectionRemPort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_tcpConnectionRemPort;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_tcpConnectionLocalAddressType, 0x00,
+ sizeof(var_tcpConnectionLocalAddressType));
+ var_tcpConnectionLocalAddressType.type = ASN_INTEGER;
+ memset(&var_tcpConnectionLocalAddress, 0x00,
+ sizeof(var_tcpConnectionLocalAddress));
+ var_tcpConnectionLocalAddress.type = ASN_OCTET_STR;
+ memset(&var_tcpConnectionLocalPort, 0x00,
+ sizeof(var_tcpConnectionLocalPort));
+ var_tcpConnectionLocalPort.type = ASN_UNSIGNED;
+ memset(&var_tcpConnectionRemAddressType, 0x00,
+ sizeof(var_tcpConnectionRemAddressType));
+ var_tcpConnectionRemAddressType.type = ASN_INTEGER;
+ memset(&var_tcpConnectionRemAddress, 0x00,
+ sizeof(var_tcpConnectionRemAddress));
+ var_tcpConnectionRemAddress.type = ASN_OCTET_STR;
+ memset(&var_tcpConnectionRemPort, 0x00,
+ sizeof(var_tcpConnectionRemPort));
+ var_tcpConnectionRemPort.type = ASN_UNSIGNED;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_tcpConnectionLocalAddressType.next_variable =
+ &var_tcpConnectionLocalAddress;
+ var_tcpConnectionLocalAddress.next_variable =
+ &var_tcpConnectionLocalPort;
+ var_tcpConnectionLocalPort.next_variable =
+ &var_tcpConnectionRemAddressType;
+ var_tcpConnectionRemAddressType.next_variable =
+ &var_tcpConnectionRemAddress;
+ var_tcpConnectionRemAddress.next_variable = &var_tcpConnectionRemPort;
+ var_tcpConnectionRemPort.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_index_to_oid", "called\n"));
+
+ /*
+ * tcpConnectionLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ snmp_set_var_value(&var_tcpConnectionLocalAddressType,
+ (u_char *) & mib_idx->tcpConnectionLocalAddressType,
+ sizeof(mib_idx->tcpConnectionLocalAddressType));
+
+ /*
+ * tcpConnectionLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_tcpConnectionLocalAddress,
+ (u_char *) & mib_idx->tcpConnectionLocalAddress,
+ mib_idx->tcpConnectionLocalAddress_len *
+ sizeof(mib_idx->tcpConnectionLocalAddress[0]));
+
+ /*
+ * tcpConnectionLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ snmp_set_var_value(&var_tcpConnectionLocalPort,
+ (u_char *) & mib_idx->tcpConnectionLocalPort,
+ sizeof(mib_idx->tcpConnectionLocalPort));
+
+ /*
+ * tcpConnectionRemAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ snmp_set_var_value(&var_tcpConnectionRemAddressType,
+ (u_char *) & mib_idx->tcpConnectionRemAddressType,
+ sizeof(mib_idx->tcpConnectionRemAddressType));
+
+ /*
+ * tcpConnectionRemAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_tcpConnectionRemAddress,
+ (u_char *) & mib_idx->tcpConnectionRemAddress,
+ mib_idx->tcpConnectionRemAddress_len *
+ sizeof(mib_idx->tcpConnectionRemAddress[0]));
+
+ /*
+ * tcpConnectionRemPort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ snmp_set_var_value(&var_tcpConnectionRemPort,
+ (u_char *) & mib_idx->tcpConnectionRemPort,
+ sizeof(mib_idx->tcpConnectionRemPort));
+
+
+ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
+ NULL, 0, &var_tcpConnectionLocalAddressType);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_tcpConnectionLocalAddressType);
+
+ return err;
+} /* tcpConnectionTable_index_to_oid */
+
+/**
+ * extract tcpConnectionTable indexes from a netsnmp_index
+ *
+ * @retval SNMP_ERR_NOERROR : no error
+ * @retval SNMP_ERR_GENERR : error
+ */
+int
+tcpConnectionTable_index_from_oid(netsnmp_index * oid_idx,
+ tcpConnectionTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * tcpConnectionLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_tcpConnectionLocalAddressType;
+ /*
+ * tcpConnectionLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_tcpConnectionLocalAddress;
+ /*
+ * tcpConnectionLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_tcpConnectionLocalPort;
+ /*
+ * tcpConnectionRemAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_tcpConnectionRemAddressType;
+ /*
+ * tcpConnectionRemAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_tcpConnectionRemAddress;
+ /*
+ * tcpConnectionRemPort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_tcpConnectionRemPort;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_tcpConnectionLocalAddressType, 0x00,
+ sizeof(var_tcpConnectionLocalAddressType));
+ var_tcpConnectionLocalAddressType.type = ASN_INTEGER;
+ memset(&var_tcpConnectionLocalAddress, 0x00,
+ sizeof(var_tcpConnectionLocalAddress));
+ var_tcpConnectionLocalAddress.type = ASN_OCTET_STR;
+ memset(&var_tcpConnectionLocalPort, 0x00,
+ sizeof(var_tcpConnectionLocalPort));
+ var_tcpConnectionLocalPort.type = ASN_UNSIGNED;
+ memset(&var_tcpConnectionRemAddressType, 0x00,
+ sizeof(var_tcpConnectionRemAddressType));
+ var_tcpConnectionRemAddressType.type = ASN_INTEGER;
+ memset(&var_tcpConnectionRemAddress, 0x00,
+ sizeof(var_tcpConnectionRemAddress));
+ var_tcpConnectionRemAddress.type = ASN_OCTET_STR;
+ memset(&var_tcpConnectionRemPort, 0x00,
+ sizeof(var_tcpConnectionRemPort));
+ var_tcpConnectionRemPort.type = ASN_UNSIGNED;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_tcpConnectionLocalAddressType.next_variable =
+ &var_tcpConnectionLocalAddress;
+ var_tcpConnectionLocalAddress.next_variable =
+ &var_tcpConnectionLocalPort;
+ var_tcpConnectionLocalPort.next_variable =
+ &var_tcpConnectionRemAddressType;
+ var_tcpConnectionRemAddressType.next_variable =
+ &var_tcpConnectionRemAddress;
+ var_tcpConnectionRemAddress.next_variable = &var_tcpConnectionRemPort;
+ var_tcpConnectionRemPort.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:tcpConnectionTable:tcpConnectionTable_index_from_oid", "called\n"));
+
+ /*
+ * parse the oid into the individual index components
+ */
+ err = parse_oid_indexes(oid_idx->oids, oid_idx->len,
+ &var_tcpConnectionLocalAddressType);
+ if (err == SNMP_ERR_NOERROR) {
+ /*
+ * copy out values
+ */
+ mib_idx->tcpConnectionLocalAddressType =
+ *((u_long *) var_tcpConnectionLocalAddressType.val.string);
+ /*
+ * NOTE: val_len is in bytes, tcpConnectionLocalAddress_len might not be
+ */
+ if (var_tcpConnectionLocalAddress.val_len >
+ sizeof(mib_idx->tcpConnectionLocalAddress))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->tcpConnectionLocalAddress,
+ var_tcpConnectionLocalAddress.val.string,
+ var_tcpConnectionLocalAddress.val_len);
+ mib_idx->tcpConnectionLocalAddress_len =
+ var_tcpConnectionLocalAddress.val_len /
+ sizeof(mib_idx->tcpConnectionLocalAddress[0]);
+ }
+ mib_idx->tcpConnectionLocalPort =
+ *((u_long *) var_tcpConnectionLocalPort.val.string);
+ mib_idx->tcpConnectionRemAddressType =
+ *((u_long *) var_tcpConnectionRemAddressType.val.string);
+ /*
+ * NOTE: val_len is in bytes, tcpConnectionRemAddress_len might not be
+ */
+ if (var_tcpConnectionRemAddress.val_len >
+ sizeof(mib_idx->tcpConnectionRemAddress))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->tcpConnectionRemAddress,
+ var_tcpConnectionRemAddress.val.string,
+ var_tcpConnectionRemAddress.val_len);
+ mib_idx->tcpConnectionRemAddress_len =
+ var_tcpConnectionRemAddress.val_len /
+ sizeof(mib_idx->tcpConnectionRemAddress[0]);
+ }
+ mib_idx->tcpConnectionRemPort =
+ *((u_long *) var_tcpConnectionRemPort.val.string);
+
+
+ }
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_tcpConnectionLocalAddressType);
+
+ return err;
+} /* tcpConnectionTable_index_from_oid */
+
+
+/*
+ *********************************************************************
+ * @internal
+ * allocate resources for a tcpConnectionTable_rowreq_ctx
+ */
+tcpConnectionTable_rowreq_ctx *
+tcpConnectionTable_allocate_rowreq_ctx(tcpConnectionTable_data * data,
+ void *user_init_ctx)
+{
+ tcpConnectionTable_rowreq_ctx *rowreq_ctx =
+ SNMP_MALLOC_TYPEDEF(tcpConnectionTable_rowreq_ctx);
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:tcpConnectionTable_allocate_rowreq_ctx", "called\n"));
+
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "Couldn't allocate memory for a "
+ "tcpConnectionTable_rowreq_ctx.\n");
+ return NULL;
+ } else {
+ if (NULL != data) {
+ /*
+ * track if we got data from user
+ */
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DATA_FROM_USER;
+ rowreq_ctx->data = data;
+ } else if (NULL ==
+ (rowreq_ctx->data =
+ tcpConnectionTable_allocate_data())) {
+ SNMP_FREE(rowreq_ctx);
+ return NULL;
+ }
+ }
+
+ /*
+ * undo context will be allocated when needed (in *_undo_setup)
+ */
+
+ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
+
+ rowreq_ctx->tcpConnectionTable_data_list = NULL;
+
+ /*
+ * if we allocated data, call init routine
+ */
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) {
+ if (SNMPERR_SUCCESS !=
+ tcpConnectionTable_rowreq_ctx_init(rowreq_ctx,
+ user_init_ctx)) {
+ tcpConnectionTable_release_rowreq_ctx(rowreq_ctx);
+ rowreq_ctx = NULL;
+ }
+ }
+
+ return rowreq_ctx;
+} /* tcpConnectionTable_allocate_rowreq_ctx */
+
+/*
+ * @internal
+ * release resources for a tcpConnectionTable_rowreq_ctx
+ */
+void
+tcpConnectionTable_release_rowreq_ctx(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("internal:tcpConnectionTable:tcpConnectionTable_release_rowreq_ctx", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ tcpConnectionTable_rowreq_ctx_cleanup(rowreq_ctx);
+
+ /*
+ * for non-transient data, don't free data we got from the user
+ */
+ if ((rowreq_ctx->data) &&
+ !(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER))
+ tcpConnectionTable_release_data(rowreq_ctx->data);
+
+ if (rowreq_ctx->undo)
+ tcpConnectionTable_release_data(rowreq_ctx->undo);
+
+ /*
+ * free index oid pointer
+ */
+ if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp)
+ free(rowreq_ctx->oid_idx.oids);
+
+ SNMP_FREE(rowreq_ctx);
+} /* tcpConnectionTable_release_rowreq_ctx */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_tcpConnectionTable_pre_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_pre_request", "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:tcpConnectionTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = tcpConnectionTable_pre_request(tcpConnectionTable_if_ctx.
+ user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("tcpConnectionTable", "error %d from "
+ "tcpConnectionTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_tcpConnectionTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_tcpConnectionTable_post_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ tcpConnectionTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_post_request", "called\n"));
+
+ /*
+ * release row context, if deleted
+ */
+ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
+ tcpConnectionTable_release_rowreq_ctx(rowreq_ctx);
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:tcpConnectionTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ if ((MFD_SUCCESS != packet_rc) && tcpConnectionTable_dirty_get()) {
+ /*
+ * we shouldn't get here. the undo steps should also clear
+ * the dirty flags.
+ */
+ snmp_log(LOG_WARNING,
+ "tcpConnectionTable dirty flag set in post_request "
+ "but status != SUCCESS.\n");
+ }
+
+ rc = tcpConnectionTable_post_request(tcpConnectionTable_if_ctx.
+ user_ctx, packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("tcpConnectionTable", "error %d from "
+ "tcpConnectionTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_tcpConnectionTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_tcpConnectionTable_object_lookup(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = SNMP_ERR_NOERROR;
+ tcpConnectionTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_object_lookup", "called\n"));
+
+ /*
+ * get our context from mfd
+ * tcpConnectionTable_interface_ctx *if_ctx =
+ * (tcpConnectionTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if (NULL == rowreq_ctx) {
+ rc = SNMP_ERR_NOCREATION;
+ }
+
+ if (MFD_SUCCESS != rc)
+ netsnmp_request_set_error_all(requests, rc);
+ else
+ tcpConnectionTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_tcpConnectionTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_tcpConnectionTable_get_column(tcpConnectionTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_get_column", "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * tcpConnectionState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_TCPCONNECTIONSTATE:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_INTEGER;
+ rc = tcpConnectionState_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ /*
+ * tcpConnectionProcess(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_TCPCONNECTIONPROCESS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_UNSIGNED;
+ rc = tcpConnectionProcess_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _tcpConnectionTable_get_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _tcpConnectionTable_get_column */
+
+int
+_mfd_tcpConnectionTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ tcpConnectionTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ u_char *old_string;
+ void (*dataFreeHook) (void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_get_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+ /*
+ * save old pointer, so we can free it if replaced
+ */
+ old_string = requests->requestvb->val.string;
+ dataFreeHook = requests->requestvb->dataFreeHook;
+ if (NULL == requests->requestvb->val.string) {
+ requests->requestvb->val.string = requests->requestvb->buf;
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ } else if (requests->requestvb->buf ==
+ requests->requestvb->val.string) {
+ if (requests->requestvb->val_len !=
+ sizeof(requests->requestvb->buf))
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ }
+
+ /*
+ * get column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _tcpConnectionTable_get_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ if (MFD_SKIP == rc) {
+ requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+ rc = SNMP_ERR_NOERROR;
+ }
+ } else if (NULL == requests->requestvb->val.string) {
+ snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
+ rc = SNMP_ERR_GENERR;
+ }
+ if (rc)
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+
+ /*
+ * if the buffer wasn't used previously for the old data (i.e. it
+ * was allcoated memory) and the get routine replaced the pointer,
+ * we need to free the previous pointer.
+ */
+ if (old_string && (old_string != requests->requestvb->buf) &&
+ (requests->requestvb->val.string != old_string)) {
+ if (dataFreeHook)
+ (*dataFreeHook) (old_string);
+ else
+ free(old_string);
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_tcpConnectionTable_get_values */
+
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Syntax checks
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check the syntax for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_tcpConnectionTable_check_column(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx, netsnmp_variable_list * var,
+ int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_tcpConnectionTable_check_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+ /*
+ * (INDEX) tcpConnectionLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ case COLUMN_TCPCONNECTIONLOCALADDRESSTYPE:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+ /*
+ * (INDEX) tcpConnectionLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ case COLUMN_TCPCONNECTIONLOCALADDRESS:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+ /*
+ * (INDEX) tcpConnectionLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ case COLUMN_TCPCONNECTIONLOCALPORT:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+ /*
+ * (INDEX) tcpConnectionRemAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ case COLUMN_TCPCONNECTIONREMADDRESSTYPE:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+ /*
+ * (INDEX) tcpConnectionRemAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ case COLUMN_TCPCONNECTIONREMADDRESS:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+ /*
+ * (INDEX) tcpConnectionRemPort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ case COLUMN_TCPCONNECTIONREMPORT:
+ rc = SNMP_ERR_NOTWRITABLE; /* can not change index of active row */
+ break;
+
+ /*
+ * tcpConnectionState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_TCPCONNECTIONSTATE:
+ rc = netsnmp_check_vb_type(var, ASN_INTEGER);
+ /*
+ * check that the value is one of defined enums
+ */
+ if ((SNMPERR_SUCCESS == rc)
+ && (*var->val.integer != TCPCONNECTIONSTATE_CLOSED)
+ && (*var->val.integer != TCPCONNECTIONSTATE_LISTEN)
+ && (*var->val.integer != TCPCONNECTIONSTATE_SYNSENT)
+ && (*var->val.integer != TCPCONNECTIONSTATE_SYNRECEIVED)
+ && (*var->val.integer != TCPCONNECTIONSTATE_ESTABLISHED)
+ && (*var->val.integer != TCPCONNECTIONSTATE_FINWAIT1)
+ && (*var->val.integer != TCPCONNECTIONSTATE_FINWAIT2)
+ && (*var->val.integer != TCPCONNECTIONSTATE_CLOSEWAIT)
+ && (*var->val.integer != TCPCONNECTIONSTATE_LASTACK)
+ && (*var->val.integer != TCPCONNECTIONSTATE_CLOSING)
+ && (*var->val.integer != TCPCONNECTIONSTATE_TIMEWAIT)
+ && (*var->val.integer != TCPCONNECTIONSTATE_DELETETCB)
+ ) {
+ rc = SNMP_ERR_WRONGVALUE;
+ }
+ if (SNMPERR_SUCCESS != rc) {
+ DEBUGMSGTL(("tcpConnectionTable:_tcpConnectionTable_check_column:tcpConnectionState", "varbind validation failed (eg bad type or size)\n"));
+ } else {
+ rc = tcpConnectionState_check_value(rowreq_ctx,
+ *((u_long *) var->val.
+ string));
+ if ((MFD_SUCCESS != rc) && (MFD_NOT_VALID_EVER != rc)
+ && (MFD_NOT_VALID_NOW != rc)) {
+ snmp_log(LOG_ERR,
+ "bad rc %d from tcpConnectionState_check_value\n",
+ rc);
+ rc = SNMP_ERR_GENERR;
+ }
+ }
+ break;
+
+ /*
+ * tcpConnectionProcess(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_TCPCONNECTIONPROCESS:
+ rc = SNMP_ERR_NOTWRITABLE;
+ break;
+
+ default: /** We shouldn't get here */
+ rc = SNMP_ERR_GENERR;
+ snmp_log(LOG_ERR,
+ "unknown column %d in _tcpConnectionTable_check_column\n",
+ column);
+ }
+
+ return rc;
+} /* _tcpConnectionTable_check_column */
+
+int
+_mfd_tcpConnectionTable_check_objects(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ tcpConnectionTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc;
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_check_objects", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+
+ /*
+ * get column number from table request info, and check that column
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _tcpConnectionTable_check_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+ break;
+ }
+
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_tcpConnectionTable_check_objects */
+
+
+/*----------------------------------------------------------------------
+ *
+ * SET: check dependencies
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Check dependencies wrapper
+ */
+static int
+_mfd_tcpConnectionTable_check_dependencies(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ tcpConnectionTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_check_dependencies", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = tcpConnectionTable_check_dependencies(rowreq_ctx);
+ if (rc) {
+ DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
+ "tcpConnectionTable_check_dependencies\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_tcpConnectionTable_check_dependencies */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo setup
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_tcpConnectionTable_undo_setup_column(tcpConnectionTable_rowreq_ctx *
+ rowreq_ctx, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_tcpConnectionTable_undo_setup_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * tcpConnectionState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_TCPCONNECTIONSTATE:
+ rowreq_ctx->column_set_flags |= COLUMN_TCPCONNECTIONSTATE_FLAG;
+ rc = tcpConnectionState_undo_setup(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _tcpConnectionTable_undo_setup_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _tcpConnectionTable_undo_setup_column */
+
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_tcpConnectionTable_undo_setup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ tcpConnectionTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_undo_setup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * allocate undo context
+ */
+ rowreq_ctx->undo = tcpConnectionTable_allocate_data();
+ if (NULL == rowreq_ctx->undo) {
+ /** msg already logged */
+ netsnmp_request_set_error_all(requests,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * row undo setup
+ */
+ rowreq_ctx->column_set_flags = 0;
+ rc = tcpConnectionTable_undo_setup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
+ "tcpConnectionTable_undo_setup\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ } else {
+ /*
+ * column undo setup
+ */
+ netsnmp_table_request_info *tri;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _tcpConnectionTable_undo_setup_column(rowreq_ctx,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
+ "tcpConnectionTable_undo_setup_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_tcpConnectionTable_undo_setup */
+
+/**
+ * @internal
+ * undo setup
+ */
+int
+_mfd_tcpConnectionTable_undo_cleanup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ tcpConnectionTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc;
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_undo_cleanup", "called\n"));
+
+ /*
+ * failed row create in early stages has no rowreq_ctx
+ */
+ if (NULL == rowreq_ctx)
+ return MFD_SUCCESS;
+
+ /*
+ * call user cleanup
+ */
+ rc = tcpConnectionTable_undo_cleanup(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
+ "tcpConnectionTable_undo_cleanup\n", rc));
+ }
+
+ /*
+ * release undo context, if needed
+ */
+ if (rowreq_ctx->undo) {
+ tcpConnectionTable_release_data(rowreq_ctx->undo);
+ rowreq_ctx->undo = NULL;
+ }
+
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_tcpConnectionTable_undo_cleanup */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Set values
+ *
+ *---------------------------------------------------------------------*/
+/*
+ * @internal
+ * Set the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_tcpConnectionTable_set_column(tcpConnectionTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_tcpConnectionTable_set_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * tcpConnectionState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_TCPCONNECTIONSTATE:
+ rowreq_ctx->column_set_flags |= COLUMN_TCPCONNECTIONSTATE_FLAG;
+ rc = tcpConnectionState_set(rowreq_ctx,
+ *((u_long *) var->val.string));
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _tcpConnectionTable_set_column\n",
+ column);
+ rc = SNMP_ERR_GENERR;
+ break;
+ }
+
+ return rc;
+} /* _tcpConnectionTable_set_column */
+
+int
+_mfd_tcpConnectionTable_set_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ tcpConnectionTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ int rc = SNMP_ERR_NOERROR;
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_set_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rowreq_ctx->column_set_flags = 0;
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _tcpConnectionTable_set_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
+ "tcpConnectionTable_set_column\n", rc));
+ netsnmp_set_request_error(agtreq_info, requests,
+ SNMP_VALIDATE_ERR(rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_tcpConnectionTable_set_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit the values
+ */
+int
+_mfd_tcpConnectionTable_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ tcpConnectionTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = tcpConnectionTable_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
+ "tcpConnectionTable_commit\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ /*
+ * if we successfully commited this row, set the dirty flag. Use the
+ * current value + 1 (i.e. dirty = # rows changed).
+ * this is checked in post_request...
+ */
+ tcpConnectionTable_dirty_set(tcpConnectionTable_dirty_get() + 1); /* set table dirty flag */
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+_mfd_tcpConnectionTable_undo_commit(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ tcpConnectionTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_undo_commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ u_int d = tcpConnectionTable_dirty_get();
+
+ netsnmp_assert(d != 0);
+ if (d)
+ tcpConnectionTable_dirty_set(d - 1);
+ }
+
+ rc = tcpConnectionTable_undo_commit(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
+ "tcpConnectionTable_undo_commit\n", rc));
+ }
+
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DIRTY) {
+ snmp_log(LOG_WARNING,
+ "tcpConnectionTable row dirty flag still set after undo_commit\n");
+ rowreq_ctx->rowreq_flags &= ~MFD_ROW_DIRTY;
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_tcpConnectionTable_commit */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: Undo
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * undo the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_tcpConnectionTable_undo_column(tcpConnectionTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_tcpConnectionTable_undo_column", "called for %d\n", column));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * tcpConnectionState(7)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
+ */
+ case COLUMN_TCPCONNECTIONSTATE:
+ rc = tcpConnectionState_undo(rowreq_ctx);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _tcpConnectionTable_undo_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _tcpConnectionTable_undo_column */
+
+int
+_mfd_tcpConnectionTable_undo_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+ tcpConnectionTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_undo_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ rc = tcpConnectionTable_undo(rowreq_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
+ "tcpConnectionTable_undo\n", rc));
+ }
+
+ for (; requests; requests = requests->next) {
+ /*
+ * set column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _tcpConnectionTable_undo_column(rowreq_ctx,
+ requests->requestvb,
+ tri->colnum);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("tcpConnectionTable:mfd", "error %d from "
+ "tcpConnectionTable_undo_column\n", rc));
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_tcpConnectionTable_undo_values */
+
+/*----------------------------------------------------------------------
+ *
+ * SET: irreversible commit
+ *
+ *---------------------------------------------------------------------*/
+/**
+ * @internal
+ * commit irreversible actions
+ */
+int
+_mfd_tcpConnectionTable_irreversible_commit(netsnmp_mib_handler *handler, netsnmp_handler_registration
+ *reginfo, netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ tcpConnectionTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_mfd_tcpConnectionTable_irreversible:commit", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * check for and handle row creation/deletion
+ * and update column exist flags...
+ */
+ if (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED) {
+ CONTAINER_REMOVE(tcpConnectionTable_if_ctx.container, rowreq_ctx);
+ } else {
+ if (rowreq_ctx->column_set_flags) {
+ rowreq_ctx->column_set_flags = 0;
+ }
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_tcpConnectionTable_irreversible_commit */
+
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+static void _container_free(netsnmp_container *container);
+
+/**
+ * @internal
+ */
+static int
+_cache_load(netsnmp_cache * cache, void *vmagic)
+{
+ DEBUGMSGTL(("internal:tcpConnectionTable:_cache_load", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache for tcpConnectionTable_cache_load\n");
+ return -1;
+ }
+
+ /** should only be called for an invalid or expired cache */
+ netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
+
+ /*
+ * call user code
+ */
+ return tcpConnectionTable_container_load((netsnmp_container *) cache->
+ magic);
+} /* _cache_load */
+
+/**
+ * @internal
+ */
+static void
+_cache_free(netsnmp_cache * cache, void *magic)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("internal:tcpConnectionTable:_cache_free", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache in tcpConnectionTable_cache_free\n");
+ return;
+ }
+
+ container = (netsnmp_container *) cache->magic;
+
+ _container_free(container);
+} /* _cache_free */
+
+/**
+ * @internal
+ */
+static void
+_container_item_free(tcpConnectionTable_rowreq_ctx * rowreq_ctx,
+ void *context)
+{
+ DEBUGMSGTL(("internal:tcpConnectionTable:_container_item_free",
+ "called\n"));
+
+ if (NULL == rowreq_ctx)
+ return;
+
+ tcpConnectionTable_release_rowreq_ctx(rowreq_ctx);
+} /* _container_item_free */
+
+/**
+ * @internal
+ */
+static void
+_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("internal:tcpConnectionTable:_container_free",
+ "called\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container in tcpConnectionTable_container_free\n");
+ return;
+ }
+
+ /*
+ * call user code
+ */
+ tcpConnectionTable_container_free(container);
+
+ /*
+ * free all items. inefficient, but easy.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func *) _container_item_free,
+ NULL);
+} /* _container_free */
+
+/**
+ * @internal
+ * initialize the container with functions or wrappers
+ */
+void
+_tcpConnectionTable_container_init(tcpConnectionTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:tcpConnectionTable:_tcpConnectionTable_container_init", "called\n"));
+
+ /*
+ * cache init
+ */
+ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */
+ _cache_load, _cache_free,
+ tcpConnectionTable_oid,
+ tcpConnectionTable_oid_size);
+
+ if (NULL == if_ctx->cache) {
+ snmp_log(LOG_ERR, "error creating cache for tcpConnectionTable\n");
+ return;
+ }
+
+ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
+
+ tcpConnectionTable_container_init(&if_ctx->container, if_ctx->cache);
+ if (NULL == if_ctx->container)
+ if_ctx->container =
+ netsnmp_container_find("tcpConnectionTable:table_container");
+ if (NULL == if_ctx->container) {
+ snmp_log(LOG_ERR, "error creating container in "
+ "tcpConnectionTable_container_init\n");
+ return;
+ }
+
+ if (NULL != if_ctx->cache)
+ if_ctx->cache->magic = (void *) if_ctx->container;
+} /* _tcpConnectionTable_container_init */
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+_tcpConnectionTable_container_shutdown(tcpConnectionTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:tcpConnectionTable:_tcpConnectionTable_container_shutdown", "called\n"));
+
+ tcpConnectionTable_container_shutdown(if_ctx->container);
+
+ _container_free(if_ctx->container);
+
+} /* _tcpConnectionTable_container_shutdown */
+
+
+tcpConnectionTable_rowreq_ctx *
+tcpConnectionTable_row_find_by_mib_index(tcpConnectionTable_mib_index *
+ mib_idx)
+{
+ tcpConnectionTable_rowreq_ctx *rowreq_ctx;
+ oid oid_tmp[MAX_OID_LEN];
+ netsnmp_index oid_idx;
+ int rc;
+
+ /*
+ * set up storage for OID
+ */
+ oid_idx.oids = oid_tmp;
+ oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
+
+ /*
+ * convert
+ */
+ rc = tcpConnectionTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx =
+ CONTAINER_FIND(tcpConnectionTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_interface.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_interface.h
new file mode 100644
index 0000000000..02500d176a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpConnectionTable/tcpConnectionTable_interface.h
@@ -0,0 +1,176 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: tcpConnectionTable_interface.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** @ingroup interface Routines to interface to Net-SNMP
+ *
+ * \warning This code should not be modified, called directly,
+ * or used to interpret functionality. It is subject to
+ * change at any time.
+ *
+ * @{
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+#ifndef TCPCONNECTIONTABLE_INTERFACE_H
+#define TCPCONNECTIONTABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "tcpConnectionTable.h"
+
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _tcpConnectionTable_initialize_interface
+ (tcpConnectionTable_registration * user_ctx, u_long flags);
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ _tcpConnectionTable_shutdown_interface
+ (tcpConnectionTable_registration * user_ctx);
+
+
+
+
+
+
+
+ tcpConnectionTable_registration
+ * tcpConnectionTable_registration_get(void);
+
+
+
+
+
+
+
+ tcpConnectionTable_registration
+ * tcpConnectionTable_registration_set
+ (tcpConnectionTable_registration * newreg);
+
+ netsnmp_container *tcpConnectionTable_container_get(void);
+ int tcpConnectionTable_container_size(void);
+
+ u_int tcpConnectionTable_dirty_get(void);
+ void tcpConnectionTable_dirty_set(u_int status);
+
+
+
+
+
+
+
+ tcpConnectionTable_rowreq_ctx
+ * tcpConnectionTable_allocate_rowreq_ctx(tcpConnectionTable_data *,
+ void *);
+ void
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionTable_release_rowreq_ctx(tcpConnectionTable_rowreq_ctx
+ * rowreq_ctx);
+
+ int tcpConnectionTable_index_to_oid(netsnmp_index *
+ oid_idx,
+ tcpConnectionTable_mib_index
+ * mib_idx);
+ int tcpConnectionTable_index_from_oid(netsnmp_index *
+ oid_idx,
+ tcpConnectionTable_mib_index
+ * mib_idx);
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void
+
+
+
+
+
+
+
+
+
+
+ tcpConnectionTable_valid_columns_set(netsnmp_column_info *vc);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* TCPCONNECTIONTABLE_INTERFACE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable.h
new file mode 100644
index 0000000000..7024f793d7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable.h
@@ -0,0 +1,5 @@
+/*
+ * module to include the modules
+ */
+
+config_require(tcp-mib/tcpListenerTable/tcpListenerTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable.c
new file mode 100644
index 0000000000..6a141eca32
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable.c
@@ -0,0 +1,443 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: tcpListenerTable.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** \page MFD helper for tcpListenerTable
+ *
+ * \section intro Introduction
+ * Introductory text.
+ *
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "tcpListenerTable.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "tcpListenerTable_interface.h"
+
+oid tcpListenerTable_oid[] = { TCPLISTENERTABLE_OID };
+int tcpListenerTable_oid_size =
+OID_LENGTH(tcpListenerTable_oid);
+
+tcpListenerTable_registration tcpListenerTable_user_context;
+
+void initialize_table_tcpListenerTable(void);
+void shutdown_table_tcpListenerTable(void);
+
+
+/**
+ * Initializes the tcpListenerTable module
+ */
+void
+init_tcpListenerTable(void)
+{
+ DEBUGMSGTL(("verbose:tcpListenerTable:init_tcpListenerTable",
+ "called\n"));
+
+ /*
+ * TODO:300:o: Perform tcpListenerTable one-time module initialization.
+ */
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ if (should_init("tcpListenerTable"))
+ initialize_table_tcpListenerTable();
+
+} /* init_tcpListenerTable */
+
+/**
+ * Shut-down the tcpListenerTable module (agent is exiting)
+ */
+void
+shutdown_tcpListenerTable(void)
+{
+ if (should_init("tcpListenerTable"))
+ shutdown_table_tcpListenerTable();
+
+}
+
+/**
+ * Initialize the table tcpListenerTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_tcpListenerTable(void)
+{
+ tcpListenerTable_registration *user_context;
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:tcpListenerTable:initialize_table_tcpListenerTable", "called\n"));
+
+ /*
+ * TODO:301:o: Perform tcpListenerTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize tcpListenerTable user context
+ * if you'd like to pass in a pointer to some data for this
+ * table, allocate or set it up here.
+ */
+ user_context = &tcpListenerTable_user_context;
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _tcpListenerTable_initialize_interface(user_context, flags);
+} /* initialize_table_tcpListenerTable */
+
+/**
+ * Shutdown the table tcpListenerTable
+ */
+void
+shutdown_table_tcpListenerTable(void)
+{
+ /*
+ * call interface shutdown code
+ */
+ _tcpListenerTable_shutdown_interface(&tcpListenerTable_user_context);
+}
+
+/**
+ * extra context initialization (eg default values)
+ *
+ * @param rowreq_ctx : row request context
+ * @param user_init_ctx : void pointer for user (parameter to rowreq_ctx_allocate)
+ *
+ * @retval MFD_SUCCESS : no errors
+ * @retval MFD_ERROR : error (context allocate will fail)
+ */
+int
+tcpListenerTable_rowreq_ctx_init(tcpListenerTable_rowreq_ctx * rowreq_ctx,
+ void *user_init_ctx)
+{
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_rowreq_ctx_init", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:210:o: |-> Perform extra tcpListenerTable rowreq initialization. (eg DEFVALS)
+ */
+
+ return MFD_SUCCESS;
+} /* tcpListenerTable_rowreq_ctx_init */
+
+/**
+ * extra context cleanup
+ *
+ */
+void
+tcpListenerTable_rowreq_ctx_cleanup(tcpListenerTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_rowreq_ctx_cleanup", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:211:o: |-> Perform extra tcpListenerTable rowreq cleanup.
+ */
+} /* tcpListenerTable_rowreq_ctx_cleanup */
+
+/**
+ * pre-request callback
+ *
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+tcpListenerTable_pre_request(tcpListenerTable_registration * user_context)
+{
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_pre_request",
+ "called\n"));
+
+ /*
+ * TODO:510:o: Perform tcpListenerTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* tcpListenerTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ * Note:
+ * New rows have been inserted into the container, and
+ * deleted rows have been removed from the container and
+ * released.
+ * @param user_context
+ * @param rc : MFD_SUCCESS if all requests succeeded
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+tcpListenerTable_post_request(tcpListenerTable_registration * user_context,
+ int rc)
+{
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_post_request",
+ "called\n"));
+
+ /*
+ * TODO:511:o: Perform tcpListenerTable post-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* tcpListenerTable_post_request */
+
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table tcpListenerTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * TCP-MIB::tcpListenerTable is subid 20 of tcp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.6.20, length: 8
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement tcpListenerTable data context functions.
+ */
+/*
+ * tcpListenerTable_allocate_data
+ *
+ * Purpose: create new tcpListenerTable_data.
+ */
+tcpListenerTable_data *
+tcpListenerTable_allocate_data(void)
+{
+ /*
+ * TODO:201:r: |-> allocate memory for the tcpListenerTable data context.
+ */
+ tcpListenerTable_data *rtn =
+ SNMP_MALLOC_TYPEDEF(tcpListenerTable_data);
+
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_allocate_data",
+ "called\n"));
+
+ if (NULL == rtn) {
+ snmp_log(LOG_ERR, "unable to malloc memory for new "
+ "tcpListenerTable_data.\n");
+ }
+
+ return rtn;
+} /* tcpListenerTable_allocate_data */
+
+/*
+ * tcpListenerTable_release_data
+ *
+ * Purpose: release tcpListenerTable data.
+ */
+void
+tcpListenerTable_release_data(tcpListenerTable_data * data)
+{
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_release_data",
+ "called\n"));
+
+ /*
+ * TODO:202:r: |-> release memory for the tcpListenerTable data context.
+ */
+ free(data);
+} /* tcpListenerTable_release_data */
+
+
+
+/**
+ * set mib index(es)
+ *
+ * @param tbl_idx mib index structure
+ * @param tcpListenerLocalAddressType_val
+ * @param tcpListenerLocalAddress_val_ptr
+ * @param tcpListenerLocalAddress_val_ptr_len
+ * @param tcpListenerLocalPort_val
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This convenience function is useful for setting all the MIB index
+ * components with a single function call. It is assume that the C values
+ * have already been mapped from their native/rawformat to the MIB format.
+ */
+int
+tcpListenerTable_indexes_set_tbl_idx(tcpListenerTable_mib_index * tbl_idx,
+ u_long
+ tcpListenerLocalAddressType_val,
+ char *tcpListenerLocalAddress_val_ptr,
+ size_t
+ tcpListenerLocalAddress_val_ptr_len,
+ u_long tcpListenerLocalPort_val)
+{
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_indexes_set_tbl_idx", "called\n"));
+
+ /*
+ * tcpListenerLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ /** WARNING: this code might not work for netsnmp_tcpconn_entry */
+ if (4 == tcpListenerLocalAddressType_val)
+ tbl_idx->tcpListenerLocalAddressType = INETADDRESSTYPE_IPV4;
+ else if (16 == tcpListenerLocalAddressType_val)
+ tbl_idx->tcpListenerLocalAddressType = INETADDRESSTYPE_IPV6;
+ else
+ tbl_idx->tcpListenerLocalAddressType = INETADDRESSTYPE_UNKNOWN;
+
+ /*
+ * tcpListenerLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ tbl_idx->tcpListenerLocalAddress_len = sizeof(tbl_idx->tcpListenerLocalAddress) / sizeof(tbl_idx->tcpListenerLocalAddress[0]); /* max length */
+ /** WARNING: this code might not work for netsnmp_tcpconn_entry */
+ /*
+ * make sure there is enough space for tcpListenerLocalAddress data
+ */
+ if ((NULL == tbl_idx->tcpListenerLocalAddress) ||
+ (tbl_idx->tcpListenerLocalAddress_len <
+ (tcpListenerLocalAddress_val_ptr_len))) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->tcpListenerLocalAddress_len =
+ tcpListenerLocalAddress_val_ptr_len;
+ memcpy(tbl_idx->tcpListenerLocalAddress,
+ tcpListenerLocalAddress_val_ptr,
+ tcpListenerLocalAddress_val_ptr_len *
+ sizeof(tcpListenerLocalAddress_val_ptr[0]));
+
+ /*
+ * tcpListenerLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ /** WARNING: this code might not work for netsnmp_tcpconn_entry */
+ tbl_idx->tcpListenerLocalPort = tcpListenerLocalPort_val;
+
+
+ return MFD_SUCCESS;
+} /* tcpListenerTable_indexes_set_tbl_idx */
+
+/**
+ * @internal
+ * set row context indexes
+ *
+ * @param reqreq_ctx the row context that needs updated indexes
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This function sets the mib indexs, then updates the oid indexs
+ * from the mib index.
+ */
+int
+tcpListenerTable_indexes_set(tcpListenerTable_rowreq_ctx * rowreq_ctx,
+ u_long tcpListenerLocalAddressType_val,
+ char *tcpListenerLocalAddress_val_ptr,
+ size_t tcpListenerLocalAddress_val_ptr_len,
+ u_long tcpListenerLocalPort_val)
+{
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_indexes_set",
+ "called\n"));
+
+ if (MFD_SUCCESS !=
+ tcpListenerTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
+ tcpListenerLocalAddressType_val,
+ tcpListenerLocalAddress_val_ptr,
+ tcpListenerLocalAddress_val_ptr_len,
+ tcpListenerLocalPort_val))
+ return MFD_ERROR;
+
+ /*
+ * convert mib index to oid index
+ */
+ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
+ if (0 != tcpListenerTable_index_to_oid(&rowreq_ctx->oid_idx,
+ &rowreq_ctx->tbl_idx)) {
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS;
+} /* tcpListenerTable_indexes_set */
+
+
+/*---------------------------------------------------------------------
+ * TCP-MIB::tcpListenerEntry.tcpListenerProcess
+ * tcpListenerProcess is subid 4 of tcpListenerEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.6.20.1.4
+ * Description:
+The system's process ID for the process associated with
+ this listener, or zero if there is no such process. This
+ value is expected to be the same as HOST-RESOURCES-MIB::
+ hrSWRunIndex or SYSAPPL-MIB::sysApplElmtRunIndex for some
+ row in the appropriate tables.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32)
+ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the tcpListenerProcess data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param tcpListenerProcess_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+tcpListenerProcess_get(tcpListenerTable_rowreq_ctx * rowreq_ctx,
+ u_long * tcpListenerProcess_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != tcpListenerProcess_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerProcess_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the tcpListenerProcess data.
+ * copy (* tcpListenerProcess_val_ptr ) from rowreq_ctx->data
+ */
+ (*tcpListenerProcess_val_ptr) = rowreq_ctx->data->pid;
+
+ return MFD_SUCCESS;
+} /* tcpListenerProcess_get */
+
+
+
+/** @} */
+/** @} */
+/** @{ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable.h
new file mode 100644
index 0000000000..9a96a8e7cc
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable.h
@@ -0,0 +1,271 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: tcpListenerTable.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+#ifndef TCPLISTENERTABLE_H
+#define TCPLISTENERTABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @addtogroup misc misc: Miscellaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+#include <net-snmp/data_access/tcpConn.h>
+
+ /*
+ * other required module components
+ */
+ /* *INDENT-OFF* */
+config_require(tcp-mib/data_access/tcpConn)
+config_require(tcp-mib/tcpListenerTable/tcpListenerTable_interface)
+config_require(tcp-mib/tcpListenerTable/tcpListenerTable_data_access)
+ /* *INDENT-ON* */
+
+ /*
+ * OID, column number and enum definions for tcpListenerTable
+ */
+#include "tcpListenerTable_constants.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_tcpListenerTable(void);
+ void shutdown_tcpListenerTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table tcpListenerTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * TCP-MIB::tcpListenerTable is subid 20 of tcp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.6.20, length: 8
+ */
+ /*
+ *********************************************************************
+ * When you register your mib, you get to provide a generic
+ * pointer that will be passed back to you for most of the
+ * functions calls.
+ *
+ * TODO:100:r: Review all context structures
+ */
+ /*
+ * TODO:101:o: |-> Review tcpListenerTable registration context.
+ */
+ typedef struct tListenerT_user_ctx {
+
+ void *dummy;
+
+ } tcpListenerTable_registration;
+
+/**********************************************************************/
+ /*
+ * TODO:110:r: |-> Review tcpListenerTable data context structure.
+ * This structure is used to represent the data for tcpListenerTable.
+ */
+ typedef netsnmp_tcpconn_entry tcpListenerTable_data;
+
+
+ /*
+ * TODO:120:r: |-> Review tcpListenerTable mib index.
+ * This structure is used to represent the index for tcpListenerTable.
+ */
+ typedef struct tcpListenerTable_mib_index_s {
+
+ /*
+ * tcpListenerLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ u_long tcpListenerLocalAddressType;
+
+ /*
+ * tcpListenerLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ /** 128 - 2(other indexes) - oid length(10) = 115 */
+ char tcpListenerLocalAddress[20];
+ size_t tcpListenerLocalAddress_len;
+
+ /*
+ * tcpListenerLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ u_long tcpListenerLocalPort;
+
+
+ } tcpListenerTable_mib_index;
+
+ /*
+ * TODO:121:r: | |-> Review tcpListenerTable max index length.
+ * If you KNOW that your indexes will never exceed a certain
+ * length, update this macro to that length.
+ *
+ * BE VERY CAREFUL TO TAKE INTO ACCOUNT THE MAXIMUM
+ * POSSIBLE LENGHT FOR EVERY VARIABLE LENGTH INDEX!
+ * Guessing 128 - col/entry(2) - oid len(8)
+ */
+#define MAX_tcpListenerTable_IDX_LEN 22
+
+
+ /*
+ *********************************************************************
+ * TODO:130:o: |-> Review tcpListenerTable Row request (rowreq) context.
+ * When your functions are called, you will be passed a
+ * tcpListenerTable_rowreq_ctx pointer.
+ */
+ typedef struct tcpListenerTable_rowreq_ctx_s {
+
+ /** this must be first for container compare to work */
+ netsnmp_index oid_idx;
+ oid oid_tmp[MAX_tcpListenerTable_IDX_LEN];
+
+ tcpListenerTable_mib_index tbl_idx;
+
+ tcpListenerTable_data *data;
+
+ /*
+ * flags per row. Currently, the first (lower) 8 bits are reserved
+ * for the user. See mfd.h for other flags.
+ */
+ u_int rowreq_flags;
+
+ /*
+ * TODO:131:o: | |-> Add useful data to tcpListenerTable rowreq context.
+ */
+
+ /*
+ * storage for future expansion
+ */
+ netsnmp_data_list *tcpListenerTable_data_list;
+
+ } tcpListenerTable_rowreq_ctx;
+
+ typedef struct tcpListenerTable_ref_rowreq_ctx_s {
+ tcpListenerTable_rowreq_ctx *rowreq_ctx;
+ } tcpListenerTable_ref_rowreq_ctx;
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int
+ tcpListenerTable_pre_request(tcpListenerTable_registration *
+ user_context);
+ int
+ tcpListenerTable_post_request(tcpListenerTable_registration *
+ user_context, int rc);
+
+ int
+ tcpListenerTable_rowreq_ctx_init(tcpListenerTable_rowreq_ctx *
+ rowreq_ctx, void *user_init_ctx);
+ void
+ tcpListenerTable_rowreq_ctx_cleanup(tcpListenerTable_rowreq_ctx *
+ rowreq_ctx);
+
+ tcpListenerTable_data *tcpListenerTable_allocate_data(void);
+ void tcpListenerTable_release_data(tcpListenerTable_data *
+ data);
+
+ tcpListenerTable_rowreq_ctx
+ * tcpListenerTable_row_find_by_mib_index(tcpListenerTable_mib_index
+ * mib_idx);
+
+ extern oid tcpListenerTable_oid[];
+ extern int tcpListenerTable_oid_size;
+
+
+#include "tcpListenerTable_interface.h"
+#include "tcpListenerTable_data_access.h"
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table tcpListenerTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * TCP-MIB::tcpListenerTable is subid 20 of tcp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.6.20, length: 8
+ */
+ /*
+ * indexes
+ */
+
+ int tcpListenerProcess_get(tcpListenerTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ tcpListenerProcess_val_ptr);
+
+
+ int
+ tcpListenerTable_indexes_set_tbl_idx(tcpListenerTable_mib_index *
+ tbl_idx,
+ u_long
+ tcpListenerLocalAddressType_val,
+ char
+ *tcpListenerLocalAddress_val_ptr,
+ size_t
+ tcpListenerLocalAddress_val_ptr_len,
+ u_long
+ tcpListenerLocalPort_val);
+ int
+ tcpListenerTable_indexes_set(tcpListenerTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ tcpListenerLocalAddressType_val,
+ char *tcpListenerLocalAddress_val_ptr,
+ size_t
+ tcpListenerLocalAddress_val_ptr_len,
+ u_long tcpListenerLocalPort_val);
+
+
+
+ /*
+ *********************************************************************
+ * SET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * SET Table declarations
+ */
+
+
+ /*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* TCPLISTENERTABLE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_constants.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_constants.h
new file mode 100644
index 0000000000..fd9939ede1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_constants.h
@@ -0,0 +1,78 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $
+ *
+ * $Id: tcpListenerTable_constants.h 13787 2005-12-02 18:05:59Z rstory $
+ */
+#ifndef TCPLISTENERTABLE_CONSTANTS_H
+#define TCPLISTENERTABLE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ * column number definitions for table tcpListenerTable
+ */
+#define TCPLISTENERTABLE_OID 1,3,6,1,2,1,6,20
+
+#define COLUMN_TCPLISTENERLOCALADDRESSTYPE 1
+
+#define COLUMN_TCPLISTENERLOCALADDRESS 2
+
+#define COLUMN_TCPLISTENERLOCALPORT 3
+
+#define COLUMN_TCPLISTENERPROCESS 4
+
+
+#define TCPLISTENERTABLE_MIN_COL COLUMN_TCPLISTENERPROCESS
+#define TCPLISTENERTABLE_MAX_COL COLUMN_TCPLISTENERPROCESS
+
+
+ /*
+ * NOTES on enums
+ * ==============
+ *
+ * Value Mapping
+ * -------------
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them
+ * below. For example, a boolean flag (1/0) is usually represented
+ * as a TruthValue in a MIB, which maps to the values (1/2).
+ *
+ */
+/*************************************************************************
+ *************************************************************************
+ *
+ * enum definitions for table tcpListenerTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * tcpListenerLocalAddressType (InetAddressType / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef INETADDRESSTYPE_ENUMS
+#define INETADDRESSTYPE_ENUMS
+
+#define INETADDRESSTYPE_UNKNOWN 0
+#define INETADDRESSTYPE_IPV4 1
+#define INETADDRESSTYPE_IPV6 2
+#define INETADDRESSTYPE_IPV4Z 3
+#define INETADDRESSTYPE_IPV6Z 4
+#define INETADDRESSTYPE_DNS 16
+
+#endif /* INETADDRESSTYPE_ENUMS */
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* TCPLISTENERTABLE_OIDS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_data_access.c
new file mode 100644
index 0000000000..8dd3f5cda9
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_data_access.c
@@ -0,0 +1,320 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: tcpListenerTable_data_access.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "tcpListenerTable.h"
+
+
+#include "tcpListenerTable_data_access.h"
+
+/** @ingroup interface
+ * @addtogroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table tcpListenerTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * TCP-MIB::tcpListenerTable is subid 20 of tcp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.6.20, length: 8
+ */
+
+/**
+ * initialization for tcpListenerTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param tcpListenerTable_reg
+ * Pointer to tcpListenerTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+tcpListenerTable_init_data(tcpListenerTable_registration *
+ tcpListenerTable_reg)
+{
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_init_data",
+ "called\n"));
+
+ /*
+ * TODO:303:o: Initialize tcpListenerTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* tcpListenerTable_init_data */
+
+/**
+ * container overview
+ *
+ */
+
+/**
+ * container initialization
+ *
+ * @param container_ptr_ptr A pointer to a container pointer. If you
+ * create a custom container, use this parameter to return it
+ * to the MFD helper. If set to NULL, the MFD helper will
+ * allocate a container for you.
+ * @param cache A pointer to a cache structure. You can set the timeout
+ * and other cache flags using this pointer.
+ *
+ * This function is called at startup to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases. If no custom
+ * container is allocated, the MFD code will create one for your.
+ *
+ * This is also the place to set up cache behavior. The default, to
+ * simply set the cache timeout, will work well with the default
+ * container. If you are using a custom container, you may want to
+ * look at the cache helper documentation to see if there are any
+ * flags you want to set.
+ *
+ * @remark
+ * This would also be a good place to do any initialization needed
+ * for you data source. For example, opening a connection to another
+ * process that will supply the data, opening a database, etc.
+ */
+void
+tcpListenerTable_container_init(netsnmp_container **container_ptr_ptr,
+ netsnmp_cache * cache)
+{
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_container_init",
+ "called\n"));
+
+ if (NULL == container_ptr_ptr) {
+ snmp_log(LOG_ERR,
+ "bad container param to tcpListenerTable_container_init\n");
+ return;
+ }
+
+ /*
+ * For advanced users, you can use a custom container. If you
+ * do not create one, one will be created for you.
+ */
+ *container_ptr_ptr = NULL;
+
+ if (NULL == cache) {
+ snmp_log(LOG_ERR,
+ "bad cache param to tcpListenerTable_container_init\n");
+ return;
+ }
+
+ /*
+ * TODO:345:A: Set up tcpListenerTable cache properties.
+ *
+ * Also for advanced users, you can set parameters for the
+ * cache. Do not change the magic pointer, as it is used
+ * by the MFD helper. To completely disable caching, set
+ * cache->enabled to 0.
+ */
+ cache->timeout = TCPLISTENERTABLE_CACHE_TIMEOUT; /* seconds */
+ cache->flags |= NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
+} /* tcpListenerTable_container_init */
+
+/**
+ * container shutdown
+ *
+ * @param container_ptr A pointer to the container.
+ *
+ * This function is called at shutdown to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases.
+ *
+ * This function is called before tcpListenerTable_container_free().
+ *
+ * @remark
+ * This would also be a good place to do any cleanup needed
+ * for you data source. For example, closing a connection to another
+ * process that supplied the data, closing a database, etc.
+ */
+void
+tcpListenerTable_container_shutdown(netsnmp_container *container_ptr)
+{
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_container_shutdown", "called\n"));
+
+ if (NULL == container_ptr) {
+ snmp_log(LOG_ERR,
+ "bad params to tcpListenerTable_container_shutdown\n");
+ return;
+ }
+
+} /* tcpListenerTable_container_shutdown */
+
+/**
+ * add new entry
+ */
+static void
+_add_connection(netsnmp_tcpconn_entry *entry, netsnmp_container *container)
+{
+ tcpListenerTable_rowreq_ctx *rowreq_ctx;
+
+ DEBUGMSGTL(("tcpListenerTable:access", "creating new entry\n"));
+
+ /*
+ * allocate an row context and set the index(es), then add it to
+ * the container
+ */
+ rowreq_ctx = tcpListenerTable_allocate_rowreq_ctx(entry, NULL);
+ if ((NULL != rowreq_ctx) &&
+ (MFD_SUCCESS == tcpListenerTable_indexes_set(rowreq_ctx,
+ entry->loc_addr_len,
+ entry->loc_addr,
+ entry->loc_addr_len,
+ entry->loc_port))) {
+ CONTAINER_INSERT(container, rowreq_ctx);
+ } else {
+ if (rowreq_ctx) {
+ snmp_log(LOG_ERR, "error setting index while loading "
+ "tcpListenerTable cache.\n");
+ tcpListenerTable_release_rowreq_ctx(rowreq_ctx);
+ } else {
+ snmp_log(LOG_ERR, "memory allocation failed while loading "
+ "tcpListenerTable cache.\n");
+ netsnmp_access_tcpconn_entry_free(entry);
+ }
+ }
+}
+
+/**
+ * load initial data
+ *
+ * TODO:350:M: Implement tcpListenerTable data load
+ * This function will also be called by the cache helper to load
+ * the container again (after the container free function has been
+ * called to free the previous contents).
+ *
+ * @param container container to which items should be inserted
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
+ * @retval MFD_ERROR : other error.
+ *
+ * This function is called to load the index(es) (and data, optionally)
+ * for the every row in the data set.
+ *
+ * @remark
+ * While loading the data, the only important thing is the indexes.
+ * If access to your data is cheap/fast (e.g. you have a pointer to a
+ * structure in memory), it would make sense to update the data here.
+ * If, however, the accessing the data invovles more work (e.g. parsing
+ * some other existing data, or peforming calculations to derive the data),
+ * then you can limit yourself to setting the indexes and saving any
+ * information you will need later. Then use the saved information in
+ * tcpListenerTable_row_prep() for populating data.
+ *
+ * @note
+ * If you need consistency between rows (like you want statistics
+ * for each row to be from the same time frame), you should set all
+ * data here.
+ *
+ */
+int
+tcpListenerTable_container_load(netsnmp_container *container)
+{
+ netsnmp_container *raw_data =
+ netsnmp_access_tcpconn_container_load(NULL,
+ NETSNMP_ACCESS_TCPCONN_LOAD_ONLYLISTEN);
+
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_container_load",
+ "called\n"));
+
+ if (NULL == raw_data)
+ return MFD_RESOURCE_UNAVAILABLE; /* msg already logged */
+
+ /*
+ * got all the connections. pull out the active ones.
+ */
+ CONTAINER_FOR_EACH(raw_data, (netsnmp_container_obj_func *)
+ _add_connection, container);
+
+ /*
+ * free the container. we've either claimed each entry, or released it,
+ * so the dal function doesn't need to clear the container.
+ */
+ netsnmp_access_tcpconn_container_free(raw_data,
+ NETSNMP_ACCESS_TCPCONN_FREE_DONT_CLEAR);
+
+ DEBUGMSGT(("verbose:tcpListenerTable:tcpListenerTable_cache_load",
+ "%d records\n", CONTAINER_SIZE(container)));
+
+ return MFD_SUCCESS;
+} /* tcpListenerTable_container_load */
+
+/**
+ * container clean up
+ *
+ * @param container container with all current items
+ *
+ * This optional callback is called prior to all
+ * item's being removed from the container. If you
+ * need to do any processing before that, do it here.
+ *
+ * @note
+ * The MFD helper will take care of releasing all the row contexts.
+ *
+ */
+void
+tcpListenerTable_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_container_free",
+ "called\n"));
+
+ /*
+ * TODO:380:M: Free tcpListenerTable container data.
+ */
+} /* tcpListenerTable_container_free */
+
+/**
+ * prepare row for processing.
+ *
+ * When the agent has located the row for a request, this function is
+ * called to prepare the row for processing. If you fully populated
+ * the data context during the index setup phase, you may not need to
+ * do anything.
+ *
+ * @param rowreq_ctx pointer to a context.
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ */
+int
+tcpListenerTable_row_prep(tcpListenerTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_row_prep",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+
+ return MFD_SUCCESS;
+} /* tcpListenerTable_row_prep */
+
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_data_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_data_access.h
new file mode 100644
index 0000000000..3ec2e4c5a3
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_data_access.h
@@ -0,0 +1,73 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: tcpListenerTable_data_access.h 13787 2005-12-02 18:05:59Z rstory $
+ */
+#ifndef TCPLISTENERTABLE_DATA_ACCESS_H
+#define TCPLISTENERTABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table tcpListenerTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * TCP-MIB::tcpListenerTable is subid 20 of tcp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.6.20, length: 8
+ */
+
+
+ int
+ tcpListenerTable_init_data(tcpListenerTable_registration *
+ tcpListenerTable_reg);
+
+
+ /*
+ * TODO:180:o: Review tcpListenerTable cache timeout.
+ * The number of seconds before the cache times out
+ */
+#define TCPLISTENERTABLE_CACHE_TIMEOUT 60
+
+ void tcpListenerTable_container_init(netsnmp_container
+ **container_ptr_ptr,
+ netsnmp_cache * cache);
+ void tcpListenerTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int tcpListenerTable_container_load(netsnmp_container
+ *container);
+ void tcpListenerTable_container_free(netsnmp_container
+ *container);
+
+ int tcpListenerTable_cache_load(netsnmp_container
+ *container);
+ void tcpListenerTable_cache_free(netsnmp_container
+ *container);
+
+ int tcpListenerTable_row_prep(tcpListenerTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* TCPLISTENERTABLE_DATA_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_interface.c
new file mode 100644
index 0000000000..78c4b6ae9d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_interface.c
@@ -0,0 +1,981 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: tcpListenerTable_interface.c 15015 2006-08-17 15:06:43Z rstory $
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "tcpListenerTable.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "tcpListenerTable_interface.h"
+
+#include <ctype.h>
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table tcpListenerTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * TCP-MIB::tcpListenerTable is subid 20 of tcp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.6.20, length: 8
+ */
+typedef struct tcpListenerTable_interface_ctx_s {
+
+ netsnmp_container *container;
+ netsnmp_cache *cache;
+
+ tcpListenerTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+} tcpListenerTable_interface_ctx;
+
+static tcpListenerTable_interface_ctx tcpListenerTable_if_ctx;
+
+static void
+ _tcpListenerTable_container_init(tcpListenerTable_interface_ctx * if_ctx);
+static void
+ _tcpListenerTable_container_shutdown(tcpListenerTable_interface_ctx *
+ if_ctx);
+
+
+netsnmp_container *
+tcpListenerTable_container_get(void)
+{
+ return tcpListenerTable_if_ctx.container;
+}
+
+tcpListenerTable_registration *
+tcpListenerTable_registration_get(void)
+{
+ return tcpListenerTable_if_ctx.user_ctx;
+}
+
+tcpListenerTable_registration *
+tcpListenerTable_registration_set(tcpListenerTable_registration * newreg)
+{
+ tcpListenerTable_registration *old = tcpListenerTable_if_ctx.user_ctx;
+ tcpListenerTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+
+int
+tcpListenerTable_container_size(void)
+{
+ return CONTAINER_SIZE(tcpListenerTable_if_ctx.container);
+}
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_tcpListenerTable_pre_request;
+static Netsnmp_Node_Handler _mfd_tcpListenerTable_post_request;
+static Netsnmp_Node_Handler _mfd_tcpListenerTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_tcpListenerTable_get_values;
+/**
+ * @internal
+ * Initialize the table tcpListenerTable
+ * (Define its contents and how it's structured)
+ */
+void
+_tcpListenerTable_initialize_interface(tcpListenerTable_registration *
+ reg_ptr, u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &tcpListenerTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info =
+ &tcpListenerTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:tcpListenerTable:_tcpListenerTable_initialize_interface", "called\n"));
+
+
+ /*************************************************
+ *
+ * save interface context for tcpListenerTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
+ /** index: tcpListenerLocalAddressType */
+ ASN_OCTET_STR,
+ /** index: tcpListenerLocalAddress */
+ ASN_UNSIGNED,
+ /** index: tcpListenerLocalPort */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrival.
+ */
+ tbl_info->min_column = TCPLISTENERTABLE_MIN_COL;
+ tbl_info->max_column = TCPLISTENERTABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ tcpListenerTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ tcpListenerTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _tcpListenerTable_container_init(&tcpListenerTable_if_ctx);
+ if (NULL == tcpListenerTable_if_ctx.container) {
+ snmp_log(LOG_ERR,
+ "could not initialize container for tcpListenerTable\n");
+ return;
+ }
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup =
+ _mfd_tcpListenerTable_object_lookup;
+ access_multiplexer->get_values = _mfd_tcpListenerTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request = _mfd_tcpListenerTable_pre_request;
+ access_multiplexer->post_request = _mfd_tcpListenerTable_post_request;
+
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("tcpListenerTable:init_tcpListenerTable",
+ "Registering tcpListenerTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("tcpListenerTable", handler,
+ tcpListenerTable_oid,
+ tcpListenerTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RONLY);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR, "error registering table tcpListenerTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &tcpListenerTable_if_ctx;
+
+ /*************************************************
+ *
+ * set up baby steps handler, create it and inject it
+ */
+ if (access_multiplexer->object_lookup)
+ mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
+ if (access_multiplexer->set_values)
+ mfd_modes |= BABY_STEP_SET_VALUES;
+ if (access_multiplexer->irreversible_commit)
+ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
+ if (access_multiplexer->object_syntax_checks)
+ mfd_modes |= BABY_STEP_CHECK_OBJECT;
+
+ if (access_multiplexer->pre_request)
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if (access_multiplexer->post_request)
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+ if (access_multiplexer->undo_setup)
+ mfd_modes |= BABY_STEP_UNDO_SETUP;
+ if (access_multiplexer->undo_cleanup)
+ mfd_modes |= BABY_STEP_UNDO_CLEANUP;
+ if (access_multiplexer->undo_sets)
+ mfd_modes |= BABY_STEP_UNDO_SETS;
+
+ if (access_multiplexer->row_creation)
+ mfd_modes |= BABY_STEP_ROW_CREATE;
+ if (access_multiplexer->consistency_checks)
+ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
+ if (access_multiplexer->commit)
+ mfd_modes |= BABY_STEP_COMMIT;
+ if (access_multiplexer->undo_commit)
+ mfd_modes |= BABY_STEP_UNDO_COMMIT;
+
+ handler = netsnmp_baby_steps_handler_get(mfd_modes);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
+ */
+ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler =
+ netsnmp_container_table_handler_get(tbl_info,
+ tcpListenerTable_if_ctx.
+ container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject cache helper
+ */
+ if (NULL != tcpListenerTable_if_ctx.cache) {
+ handler = netsnmp_cache_handler_get(tcpListenerTable_if_ctx.cache);
+ netsnmp_inject_handler(reginfo, handler);
+ }
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+} /* _tcpListenerTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table tcpListenerTable
+ */
+void
+_tcpListenerTable_shutdown_interface(tcpListenerTable_registration *
+ reg_ptr)
+{
+ /*
+ * shutdown the container
+ */
+ _tcpListenerTable_container_shutdown(&tcpListenerTable_if_ctx);
+}
+
+void
+tcpListenerTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ tcpListenerTable_if_ctx.tbl_info.valid_columns = vc;
+} /* tcpListenerTable_valid_columns_set */
+
+/**
+ * @internal
+ * convert the index component stored in the context to an oid
+ */
+int
+tcpListenerTable_index_to_oid(netsnmp_index * oid_idx,
+ tcpListenerTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * tcpListenerLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_tcpListenerLocalAddressType;
+ /*
+ * tcpListenerLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_tcpListenerLocalAddress;
+ /*
+ * tcpListenerLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_tcpListenerLocalPort;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_tcpListenerLocalAddressType, 0x00,
+ sizeof(var_tcpListenerLocalAddressType));
+ var_tcpListenerLocalAddressType.type = ASN_INTEGER;
+ memset(&var_tcpListenerLocalAddress, 0x00,
+ sizeof(var_tcpListenerLocalAddress));
+ var_tcpListenerLocalAddress.type = ASN_OCTET_STR;
+ memset(&var_tcpListenerLocalPort, 0x00,
+ sizeof(var_tcpListenerLocalPort));
+ var_tcpListenerLocalPort.type = ASN_UNSIGNED;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_tcpListenerLocalAddressType.next_variable =
+ &var_tcpListenerLocalAddress;
+ var_tcpListenerLocalAddress.next_variable = &var_tcpListenerLocalPort;
+ var_tcpListenerLocalPort.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_index_to_oid",
+ "called\n"));
+
+ /*
+ * tcpListenerLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ snmp_set_var_value(&var_tcpListenerLocalAddressType,
+ (u_char *) & mib_idx->tcpListenerLocalAddressType,
+ sizeof(mib_idx->tcpListenerLocalAddressType));
+
+ /*
+ * tcpListenerLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_tcpListenerLocalAddress,
+ (u_char *) & mib_idx->tcpListenerLocalAddress,
+ mib_idx->tcpListenerLocalAddress_len *
+ sizeof(mib_idx->tcpListenerLocalAddress[0]));
+
+ /*
+ * tcpListenerLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ snmp_set_var_value(&var_tcpListenerLocalPort,
+ (u_char *) & mib_idx->tcpListenerLocalPort,
+ sizeof(mib_idx->tcpListenerLocalPort));
+
+
+ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
+ NULL, 0, &var_tcpListenerLocalAddressType);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_tcpListenerLocalAddressType);
+
+ return err;
+} /* tcpListenerTable_index_to_oid */
+
+/**
+ * extract tcpListenerTable indexes from a netsnmp_index
+ *
+ * @retval SNMP_ERR_NOERROR : no error
+ * @retval SNMP_ERR_GENERR : error
+ */
+int
+tcpListenerTable_index_from_oid(netsnmp_index * oid_idx,
+ tcpListenerTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * tcpListenerLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_tcpListenerLocalAddressType;
+ /*
+ * tcpListenerLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_tcpListenerLocalAddress;
+ /*
+ * tcpListenerLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_tcpListenerLocalPort;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_tcpListenerLocalAddressType, 0x00,
+ sizeof(var_tcpListenerLocalAddressType));
+ var_tcpListenerLocalAddressType.type = ASN_INTEGER;
+ memset(&var_tcpListenerLocalAddress, 0x00,
+ sizeof(var_tcpListenerLocalAddress));
+ var_tcpListenerLocalAddress.type = ASN_OCTET_STR;
+ memset(&var_tcpListenerLocalPort, 0x00,
+ sizeof(var_tcpListenerLocalPort));
+ var_tcpListenerLocalPort.type = ASN_UNSIGNED;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_tcpListenerLocalAddressType.next_variable =
+ &var_tcpListenerLocalAddress;
+ var_tcpListenerLocalAddress.next_variable = &var_tcpListenerLocalPort;
+ var_tcpListenerLocalPort.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:tcpListenerTable:tcpListenerTable_index_from_oid",
+ "called\n"));
+
+ /*
+ * parse the oid into the individual index components
+ */
+ err = parse_oid_indexes(oid_idx->oids, oid_idx->len,
+ &var_tcpListenerLocalAddressType);
+ if (err == SNMP_ERR_NOERROR) {
+ /*
+ * copy out values
+ */
+ mib_idx->tcpListenerLocalAddressType =
+ *((u_long *) var_tcpListenerLocalAddressType.val.string);
+ /*
+ * NOTE: val_len is in bytes, tcpListenerLocalAddress_len might not be
+ */
+ if (var_tcpListenerLocalAddress.val_len >
+ sizeof(mib_idx->tcpListenerLocalAddress))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->tcpListenerLocalAddress,
+ var_tcpListenerLocalAddress.val.string,
+ var_tcpListenerLocalAddress.val_len);
+ mib_idx->tcpListenerLocalAddress_len =
+ var_tcpListenerLocalAddress.val_len /
+ sizeof(mib_idx->tcpListenerLocalAddress[0]);
+ }
+ mib_idx->tcpListenerLocalPort =
+ *((u_long *) var_tcpListenerLocalPort.val.string);
+
+
+ }
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_tcpListenerLocalAddressType);
+
+ return err;
+} /* tcpListenerTable_index_from_oid */
+
+
+/*
+ *********************************************************************
+ * @internal
+ * allocate resources for a tcpListenerTable_rowreq_ctx
+ */
+tcpListenerTable_rowreq_ctx *
+tcpListenerTable_allocate_rowreq_ctx(tcpListenerTable_data * data,
+ void *user_init_ctx)
+{
+ tcpListenerTable_rowreq_ctx *rowreq_ctx =
+ SNMP_MALLOC_TYPEDEF(tcpListenerTable_rowreq_ctx);
+
+ DEBUGMSGTL(("internal:tcpListenerTable:tcpListenerTable_allocate_rowreq_ctx", "called\n"));
+
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "Couldn't allocate memory for a "
+ "tcpListenerTable_rowreq_ctx.\n");
+ return NULL;
+ } else {
+ if (NULL != data) {
+ /*
+ * track if we got data from user
+ */
+ rowreq_ctx->rowreq_flags |= MFD_ROW_DATA_FROM_USER;
+ rowreq_ctx->data = data;
+ } else if (NULL ==
+ (rowreq_ctx->data = tcpListenerTable_allocate_data())) {
+ SNMP_FREE(rowreq_ctx);
+ return NULL;
+ }
+ }
+
+ /*
+ * undo context will be allocated when needed (in *_undo_setup)
+ */
+
+ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
+
+ rowreq_ctx->tcpListenerTable_data_list = NULL;
+
+ /*
+ * if we allocated data, call init routine
+ */
+ if (!(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER)) {
+ if (SNMPERR_SUCCESS !=
+ tcpListenerTable_rowreq_ctx_init(rowreq_ctx, user_init_ctx)) {
+ tcpListenerTable_release_rowreq_ctx(rowreq_ctx);
+ rowreq_ctx = NULL;
+ }
+ }
+
+ return rowreq_ctx;
+} /* tcpListenerTable_allocate_rowreq_ctx */
+
+/*
+ * @internal
+ * release resources for a tcpListenerTable_rowreq_ctx
+ */
+void
+tcpListenerTable_release_rowreq_ctx(tcpListenerTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("internal:tcpListenerTable:tcpListenerTable_release_rowreq_ctx", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ tcpListenerTable_rowreq_ctx_cleanup(rowreq_ctx);
+
+ /*
+ * for non-transient data, don't free data we got from the user
+ */
+ if ((rowreq_ctx->data) &&
+ !(rowreq_ctx->rowreq_flags & MFD_ROW_DATA_FROM_USER))
+ tcpListenerTable_release_data(rowreq_ctx->data);
+
+ /*
+ * free index oid pointer
+ */
+ if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp)
+ free(rowreq_ctx->oid_idx.oids);
+
+ SNMP_FREE(rowreq_ctx);
+} /* tcpListenerTable_release_rowreq_ctx */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_tcpListenerTable_pre_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:tcpListenerTable:_mfd_tcpListenerTable_pre_request", "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:tcpListenerTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = tcpListenerTable_pre_request(tcpListenerTable_if_ctx.user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("tcpListenerTable", "error %d from "
+ "tcpListenerTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_tcpListenerTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_tcpListenerTable_post_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ tcpListenerTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:tcpListenerTable:_mfd_tcpListenerTable_post_request", "called\n"));
+
+ /*
+ * release row context, if deleted
+ */
+ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
+ tcpListenerTable_release_rowreq_ctx(rowreq_ctx);
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:tcpListenerTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ rc = tcpListenerTable_post_request(tcpListenerTable_if_ctx.user_ctx,
+ packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("tcpListenerTable", "error %d from "
+ "tcpListenerTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_tcpListenerTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_tcpListenerTable_object_lookup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = SNMP_ERR_NOERROR;
+ tcpListenerTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:tcpListenerTable:_mfd_tcpListenerTable_object_lookup", "called\n"));
+
+ /*
+ * get our context from mfd
+ * tcpListenerTable_interface_ctx *if_ctx =
+ * (tcpListenerTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if (NULL == rowreq_ctx) {
+ rc = SNMP_ERR_NOCREATION;
+ }
+
+ if (MFD_SUCCESS != rc)
+ netsnmp_request_set_error_all(requests, rc);
+ else
+ tcpListenerTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_tcpListenerTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_tcpListenerTable_get_column(tcpListenerTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:tcpListenerTable:_mfd_tcpListenerTable_get_column", "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * tcpListenerProcess(4)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_TCPLISTENERPROCESS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_UNSIGNED;
+ rc = tcpListenerProcess_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _tcpListenerTable_get_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _tcpListenerTable_get_column */
+
+int
+_mfd_tcpListenerTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ tcpListenerTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ u_char *old_string;
+ void (*dataFreeHook) (void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:tcpListenerTable:_mfd_tcpListenerTable_get_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+ /*
+ * save old pointer, so we can free it if replaced
+ */
+ old_string = requests->requestvb->val.string;
+ dataFreeHook = requests->requestvb->dataFreeHook;
+ if (NULL == requests->requestvb->val.string) {
+ requests->requestvb->val.string = requests->requestvb->buf;
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ } else if (requests->requestvb->buf ==
+ requests->requestvb->val.string) {
+ if (requests->requestvb->val_len !=
+ sizeof(requests->requestvb->buf))
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ }
+
+ /*
+ * get column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _tcpListenerTable_get_column(rowreq_ctx, requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ if (MFD_SKIP == rc) {
+ requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+ rc = SNMP_ERR_NOERROR;
+ }
+ } else if (NULL == requests->requestvb->val.string) {
+ snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
+ rc = SNMP_ERR_GENERR;
+ }
+ if (rc)
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+
+ /*
+ * if the buffer wasn't used previously for the old data (i.e. it
+ * was allcoated memory) and the get routine replaced the pointer,
+ * we need to free the previous pointer.
+ */
+ if (old_string && (old_string != requests->requestvb->buf) &&
+ (requests->requestvb->val.string != old_string)) {
+ if (dataFreeHook)
+ (*dataFreeHook) (old_string);
+ else
+ free(old_string);
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_tcpListenerTable_get_values */
+
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*
+ * SET PROCESSING NOT APPLICABLE (per MIB or user setting)
+ */
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+static void _container_free(netsnmp_container *container);
+
+/**
+ * @internal
+ */
+static int
+_cache_load(netsnmp_cache * cache, void *vmagic)
+{
+ DEBUGMSGTL(("internal:tcpListenerTable:_cache_load", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache for tcpListenerTable_cache_load\n");
+ return -1;
+ }
+
+ /** should only be called for an invalid or expired cache */
+ netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
+
+ /*
+ * call user code
+ */
+ return tcpListenerTable_container_load((netsnmp_container *) cache->
+ magic);
+} /* _cache_load */
+
+/**
+ * @internal
+ */
+static void
+_cache_free(netsnmp_cache * cache, void *magic)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("internal:tcpListenerTable:_cache_free", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache in tcpListenerTable_cache_free\n");
+ return;
+ }
+
+ container = (netsnmp_container *) cache->magic;
+
+ _container_free(container);
+} /* _cache_free */
+
+/**
+ * @internal
+ */
+static void
+_container_item_free(tcpListenerTable_rowreq_ctx * rowreq_ctx,
+ void *context)
+{
+ DEBUGMSGTL(("internal:tcpListenerTable:_container_item_free",
+ "called\n"));
+
+ if (NULL == rowreq_ctx)
+ return;
+
+ tcpListenerTable_release_rowreq_ctx(rowreq_ctx);
+} /* _container_item_free */
+
+/**
+ * @internal
+ */
+static void
+_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("internal:tcpListenerTable:_container_free", "called\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container in tcpListenerTable_container_free\n");
+ return;
+ }
+
+ /*
+ * call user code
+ */
+ tcpListenerTable_container_free(container);
+
+ /*
+ * free all items. inefficient, but easy.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func *) _container_item_free,
+ NULL);
+} /* _container_free */
+
+/**
+ * @internal
+ * initialize the container with functions or wrappers
+ */
+void
+_tcpListenerTable_container_init(tcpListenerTable_interface_ctx * if_ctx)
+{
+ DEBUGMSGTL(("internal:tcpListenerTable:_tcpListenerTable_container_init", "called\n"));
+
+ /*
+ * cache init
+ */
+ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */
+ _cache_load, _cache_free,
+ tcpListenerTable_oid,
+ tcpListenerTable_oid_size);
+
+ if (NULL == if_ctx->cache) {
+ snmp_log(LOG_ERR, "error creating cache for tcpListenerTable\n");
+ return;
+ }
+
+ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
+
+ tcpListenerTable_container_init(&if_ctx->container, if_ctx->cache);
+ if (NULL == if_ctx->container)
+ if_ctx->container =
+ netsnmp_container_find("tcpListenerTable:table_container");
+ if (NULL == if_ctx->container) {
+ snmp_log(LOG_ERR, "error creating container in "
+ "tcpListenerTable_container_init\n");
+ return;
+ }
+
+ if (NULL != if_ctx->cache)
+ if_ctx->cache->magic = (void *) if_ctx->container;
+} /* _tcpListenerTable_container_init */
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+_tcpListenerTable_container_shutdown(tcpListenerTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:tcpListenerTable:_tcpListenerTable_container_shutdown", "called\n"));
+
+ tcpListenerTable_container_shutdown(if_ctx->container);
+
+ _container_free(if_ctx->container);
+
+} /* _tcpListenerTable_container_shutdown */
+
+
+tcpListenerTable_rowreq_ctx *
+tcpListenerTable_row_find_by_mib_index(tcpListenerTable_mib_index *
+ mib_idx)
+{
+ tcpListenerTable_rowreq_ctx *rowreq_ctx;
+ oid oid_tmp[MAX_OID_LEN];
+ netsnmp_index oid_idx;
+ int rc;
+
+ /*
+ * set up storage for OID
+ */
+ oid_idx.oids = oid_tmp;
+ oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
+
+ /*
+ * convert
+ */
+ rc = tcpListenerTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx =
+ CONTAINER_FIND(tcpListenerTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_interface.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_interface.h
new file mode 100644
index 0000000000..dca6996975
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tcp-mib/tcpListenerTable/tcpListenerTable_interface.h
@@ -0,0 +1,98 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: tcpListenerTable_interface.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** @ingroup interface Routines to interface to Net-SNMP
+ *
+ * \warning This code should not be modified, called directly,
+ * or used to interpret functionality. It is subject to
+ * change at any time.
+ *
+ * @{
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+#ifndef TCPLISTENERTABLE_INTERFACE_H
+#define TCPLISTENERTABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "tcpListenerTable.h"
+
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void
+ _tcpListenerTable_initialize_interface
+ (tcpListenerTable_registration * user_ctx, u_long flags);
+ void
+ _tcpListenerTable_shutdown_interface(tcpListenerTable_registration
+ * user_ctx);
+
+ tcpListenerTable_registration *tcpListenerTable_registration_get(void);
+
+ tcpListenerTable_registration
+ * tcpListenerTable_registration_set(tcpListenerTable_registration *
+ newreg);
+
+ netsnmp_container *tcpListenerTable_container_get(void);
+ int tcpListenerTable_container_size(void);
+
+ tcpListenerTable_rowreq_ctx
+ * tcpListenerTable_allocate_rowreq_ctx(tcpListenerTable_data *,
+ void *);
+ void
+ tcpListenerTable_release_rowreq_ctx(tcpListenerTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int tcpListenerTable_index_to_oid(netsnmp_index * oid_idx,
+ tcpListenerTable_mib_index
+ * mib_idx);
+ int tcpListenerTable_index_from_oid(netsnmp_index *
+ oid_idx,
+ tcpListenerTable_mib_index
+ * mib_idx);
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void tcpListenerTable_valid_columns_set(netsnmp_column_info
+ *vc);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* TCPLISTENERTABLE_INTERFACE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/testhandler.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/testhandler.c
new file mode 100644
index 0000000000..8e6d708738
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/testhandler.c
@@ -0,0 +1,427 @@
+#include <net-snmp/net-snmp-config.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "testhandler.h"
+
+#include <net-snmp/agent/table.h>
+#include <net-snmp/agent/instance.h>
+#include <net-snmp/agent/table_data.h>
+#include <net-snmp/agent/table_dataset.h>
+
+static oid my_test_oid[4] = { 1, 2, 3, 4 };
+static oid my_table_oid[4] = { 1, 2, 3, 5 };
+static oid my_instance_oid[5] = { 1, 2, 3, 6, 1 };
+static oid my_data_table_oid[4] = { 1, 2, 3, 7 };
+static oid my_data_table_set_oid[4] = { 1, 2, 3, 8 };
+static oid my_data_ulong_instance[4] = { 1, 2, 3, 9 };
+
+u_long my_ulong = 0;
+
+void
+init_testhandler(void)
+{
+ /*
+ * we're registering at .1.2.3.4
+ */
+ netsnmp_handler_registration *my_test;
+ netsnmp_table_registration_info *table_info;
+ u_long ind1;
+ netsnmp_table_data *table;
+ netsnmp_table_data_set *table_set;
+ netsnmp_table_row *row;
+
+ DEBUGMSGTL(("testhandler", "initializing\n"));
+
+ /*
+ * basic handler test
+ */
+ netsnmp_register_handler(netsnmp_create_handler_registration
+ ("myTest", my_test_handler, my_test_oid, 4,
+ HANDLER_CAN_RONLY));
+
+ /*
+ * instance handler test
+ */
+
+ netsnmp_register_instance(netsnmp_create_handler_registration
+ ("myInstance", my_test_instance_handler,
+ my_instance_oid, 5, HANDLER_CAN_RWRITE));
+
+ netsnmp_register_ulong_instance("myulong",
+ my_data_ulong_instance, 4,
+ &my_ulong, NULL);
+
+ /*
+ * table helper test
+ */
+
+ my_test = netsnmp_create_handler_registration("myTable",
+ my_test_table_handler,
+ my_table_oid, 4,
+ HANDLER_CAN_RONLY);
+ if (!my_test)
+ return;
+
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+
+ netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER, ASN_INTEGER,
+ 0);
+ table_info->min_column = 3;
+ table_info->max_column = 3;
+ netsnmp_register_table(my_test, table_info);
+
+ /*
+ * data table helper test
+ */
+ /*
+ * we'll construct a simple table here with two indexes: an
+ * integer and a string (why not). It'll contain only one
+ * column so the data pointer is merely the data in that
+ * column.
+ */
+
+ table = netsnmp_create_table_data("data_table_test");
+
+ netsnmp_table_data_add_index(table, ASN_INTEGER);
+ netsnmp_table_data_add_index(table, ASN_OCTET_STR);
+
+ /*
+ * 1 partridge in a pear tree
+ */
+ row = netsnmp_create_table_data_row();
+ ind1 = 1;
+ netsnmp_table_row_add_index(row, ASN_INTEGER, &ind1, sizeof(ind1));
+ netsnmp_table_row_add_index(row, ASN_OCTET_STR, "partridge",
+ strlen("partridge"));
+ row->data = (void *) "pear tree";
+ netsnmp_table_data_add_row(table, row);
+
+ /*
+ * 2 turtle doves
+ */
+ row = netsnmp_create_table_data_row();
+ ind1 = 2;
+ netsnmp_table_row_add_index(row, ASN_INTEGER, &ind1, sizeof(ind1));
+ netsnmp_table_row_add_index(row, ASN_OCTET_STR, "turtle",
+ strlen("turtle"));
+ row->data = (void *) "doves";
+ netsnmp_table_data_add_row(table, row);
+
+ /*
+ * we're going to register it as a normal table too, so we get the
+ * automatically parsed column and index information
+ */
+ table_info = SNMP_MALLOC_TYPEDEF(netsnmp_table_registration_info);
+
+ netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER,
+ ASN_OCTET_STR, 0);
+ table_info->min_column = 3;
+ table_info->max_column = 3;
+
+ netsnmp_register_read_only_table_data
+ (netsnmp_create_handler_registration
+ ("12days", my_data_table_handler, my_data_table_oid, 4,
+ HANDLER_CAN_RONLY), table, table_info);
+
+}
+
+int
+my_test_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ oid myoid1[] = { 1, 2, 3, 4, 5, 6 };
+ static u_long accesses = 0;
+
+ DEBUGMSGTL(("testhandler", "Got request:\n"));
+ /*
+ * loop through requests
+ */
+ while (requests) {
+ netsnmp_variable_list *var = requests->requestvb;
+
+ DEBUGMSGTL(("testhandler", " oid:"));
+ DEBUGMSGOID(("testhandler", var->name, var->name_length));
+ DEBUGMSG(("testhandler", "\n"));
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ if (netsnmp_oid_equals(var->name, var->name_length, myoid1, 6)
+ == 0) {
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (u_char *) & accesses,
+ sizeof(accesses));
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+
+ case MODE_GETNEXT:
+ if (snmp_oid_compare(var->name, var->name_length, myoid1, 6)
+ < 0) {
+ snmp_set_var_objid(var, myoid1, 6);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (u_char *) & accesses,
+ sizeof(accesses));
+ return SNMP_ERR_NOERROR;
+ }
+ break;
+
+ default:
+ netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_GENERR);
+ break;
+ }
+
+ requests = requests->next;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+/*
+ * functionally this is a simply a multiplication table for 12x12
+ */
+
+#define MAX_COLONE 12
+#define MAX_COLTWO 12
+#define RESULT_COLUMN 3
+int
+my_test_table_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_table_registration_info
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ *handler_reg_info =
+ (netsnmp_table_registration_info *) handler->prev->myvoid;
+ netsnmp_table_request_info *table_info;
+ u_long result;
+ int x, y;
+
+
+ while (requests) {
+ netsnmp_variable_list *var = requests->requestvb;
+
+ if (requests->processed != 0)
+ continue;
+
+ DEBUGMSGTL(("testhandler_table", "Got request:\n"));
+ DEBUGMSGTL(("testhandler_table", " oid:"));
+ DEBUGMSGOID(("testhandler_table", var->name, var->name_length));
+ DEBUGMSG(("testhandler_table", "\n"));
+
+ table_info = netsnmp_extract_table_info(requests);
+ if (table_info == NULL) {
+ requests = requests->next;
+ continue;
+ }
+
+ switch (reqinfo->mode) {
+ case MODE_GETNEXT:
+ /*
+ * beyond our search range?
+ */
+ if (table_info->colnum > RESULT_COLUMN)
+ break;
+
+ /*
+ * below our minimum column?
+ */
+ if (table_info->colnum < RESULT_COLUMN ||
+ /*
+ * or no index specified
+ */
+ table_info->indexes->val.integer == 0) {
+ table_info->colnum = RESULT_COLUMN;
+ x = 0;
+ y = 0;
+ } else {
+ x = *(table_info->indexes->val.integer);
+ y = *(table_info->indexes->next_variable->val.integer);
+ }
+
+ if (table_info->number_indexes ==
+ handler_reg_info->number_indexes) {
+ y++; /* GETNEXT is basically just y+1 for this table */
+ if (y > MAX_COLTWO) { /* (with wrapping) */
+ y = 0;
+ x++;
+ }
+ }
+ if (x <= MAX_COLONE) {
+ result = x * y;
+
+ *(table_info->indexes->val.integer) = x;
+ *(table_info->indexes->next_variable->val.integer) = y;
+ netsnmp_table_build_result(reginfo, requests,
+ table_info, ASN_INTEGER,
+ (u_char *) & result,
+ sizeof(result));
+ }
+
+ break;
+
+ case MODE_GET:
+ if (var->type == ASN_NULL) { /* valid request if ASN_NULL */
+ /*
+ * is it the right column?
+ */
+ if (table_info->colnum == RESULT_COLUMN &&
+ /*
+ * and within the max boundries?
+ */
+ *(table_info->indexes->val.integer) <= MAX_COLONE &&
+ *(table_info->indexes->next_variable->val.integer)
+ <= MAX_COLTWO) {
+
+ /*
+ * then, the result is column1 * column2
+ */
+ result = *(table_info->indexes->val.integer) *
+ *(table_info->indexes->next_variable->val.integer);
+ snmp_set_var_typed_value(var, ASN_INTEGER,
+ (u_char *) & result,
+ sizeof(result));
+ }
+ }
+ break;
+
+ }
+
+ requests = requests->next;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+#define TESTHANDLER_SET_NAME "my_test"
+int
+my_test_instance_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ static u_long accesses = 0;
+ u_long *accesses_cache = NULL;
+
+ DEBUGMSGTL(("testhandler", "Got instance request:\n"));
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ snmp_set_var_typed_value(requests->requestvb, ASN_UNSIGNED,
+ (u_char *) & accesses, sizeof(accesses));
+ break;
+
+ case MODE_SET_RESERVE1:
+ if (requests->requestvb->type != ASN_UNSIGNED)
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_WRONGTYPE);
+ break;
+
+ case MODE_SET_RESERVE2:
+ /*
+ * store old info for undo later
+ */
+ memdup((u_char **) & accesses_cache,
+ (u_char *) & accesses, sizeof(accesses));
+ if (accesses_cache == NULL) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ return SNMP_ERR_NOERROR;
+ }
+ netsnmp_request_add_list_data(requests,
+ netsnmp_create_data_list
+ (TESTHANDLER_SET_NAME,
+ accesses_cache, free));
+ break;
+
+ case MODE_SET_ACTION:
+ /*
+ * update current
+ */
+ accesses = *(requests->requestvb->val.integer);
+ DEBUGMSGTL(("testhandler", "updated accesses -> %d\n", accesses));
+ break;
+
+ case MODE_SET_UNDO:
+ accesses =
+ *((u_long *) netsnmp_request_get_list_data(requests,
+ TESTHANDLER_SET_NAME));
+ break;
+
+ case MODE_SET_COMMIT:
+ case MODE_SET_FREE:
+ /*
+ * nothing to do
+ */
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+my_data_table_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ char *column3;
+ netsnmp_table_request_info *table_info;
+ netsnmp_table_row *row;
+
+ while (requests) {
+ if (requests->processed) {
+ requests = requests->next;
+ continue;
+ }
+
+ /*
+ * extract our stored data and table info
+ */
+ row = netsnmp_extract_table_row(requests);
+ table_info = netsnmp_extract_table_info(requests);
+ if (row)
+ column3 = (char *) row->data;
+ if (!row || !table_info || !column3)
+ continue;
+
+ /*
+ * there's only one column, we don't need to check if it's right
+ */
+ netsnmp_table_data_build_result(reginfo, reqinfo, requests, row,
+ table_info->colnum,
+ ASN_OCTET_STR, column3,
+ strlen(column3));
+ requests = requests->next;
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/testhandler.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/testhandler.h
new file mode 100644
index 0000000000..20806ab303
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/testhandler.h
@@ -0,0 +1,9 @@
+/*
+ * testhandler.h
+ */
+
+void init_testhandler(void);
+Netsnmp_Node_Handler my_test_handler;
+Netsnmp_Node_Handler my_test_table_handler;
+Netsnmp_Node_Handler my_data_table_handler;
+Netsnmp_Node_Handler my_test_instance_handler;
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tunnel.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/tunnel.h
new file mode 100644
index 0000000000..232ddb3811
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tunnel.h
@@ -0,0 +1,6 @@
+/*
+ * tunnel.h: top level .h file to merely include the sub-module.
+ */
+config_require(tunnel/tunnel)
+config_add_mib(TUNNEL-MIB)
+config_add_mib(IPV6-FLOW-LABEL-MIB)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tunnel/tunnel.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/tunnel/tunnel.c
new file mode 100644
index 0000000000..2a1cf78b69
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tunnel/tunnel.c
@@ -0,0 +1,998 @@
+/*
+ * tunnel.c --
+ *
+ * An implementation of the TUNNEL-MIB for the UCD-SNMP 4.2
+ * agent running on Linux 2.2.x.
+ *
+ * Copyright (c) 2000 Frank Strauss <strauss@ibr.cs.tu-bs.de>
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appears in all copies and
+ * that both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of the author and CMU and
+ * The Regents of the University of California not be used in advertising
+ * or publicity pertaining to distribution of the software without
+ * specific written permission.
+ *
+ * THE AUTHOR AND CMU AND THE REGENTS OF THE UNIVERSITY OF CALIFORNIA
+ * DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * THE AUTHOR OR CMU OR THE REGENTS OF THE UNIVERSITY OF CALIFORNIA BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM THE LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ */
+
+/*
+ * NOTE: This TUNNEL-MIB implementation
+ *
+ * (a) DOES NOT implement write access on the tunnelConfigTable,
+ * i.e. no new tunnels can be created and no existing tunnels
+ * can be removed through SET operations.
+ *
+ * (b) DOES implement write access on some tunnelIfTable objects
+ * to allow reconfiguring established tunnels. This violates
+ * RFC 2667! However, the author thinks it makes sense. ;-)
+ */
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <signal.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <linux/if.h>
+#include <linux/ip.h>
+#include <linux/sockios.h>
+#include <linux/if_tunnel.h>
+#include <linux/if_arp.h>
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+#include "tunnel.h"
+
+#ifndef MIN
+#define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif
+#ifndef MAX
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#endif
+
+
+
+#ifdef USING_IF_MIB_IFTABLE_IFTABLE_MODULE
+#include "if-mib/ifTable/ifTable.h"
+#include "if-mib/ifTable/ifTable_defs.h"
+#else
+/*
+ * This is used, because the TUNNEL-MIB augments ifTable.
+ */
+extern unsigned char *var_ifEntry(struct variable *,
+ oid *, size_t *,
+ int, size_t *, WriteMethod **);
+#endif
+
+
+/*
+ * tunnel_variables_oid:
+ * this is the top level oid that we want to register under. This
+ * is essentially a prefix, with the suffix appearing in the
+ * variable below.
+ */
+oid tunnel_variables_oid[] =
+ { 1, 3, 6, 1, 2, 1, 10, 131, 1, 1 };
+const int tunnel_len = 10;
+
+oid tunnel_ifEntry_oid[] =
+ { 1, 3, 6, 1, 2, 1, 10, 131, 1, 1, 1, 1 };
+const int tunnel_ifEntry_len = 12;
+
+oid tunnel_configEntry_oid[] =
+ { 1, 3, 6, 1, 2, 1, 10, 131, 1, 1, 2, 1 };
+const int tunnel_configEntry_len = 12;
+
+
+
+struct tunnel {
+ oid ifindex;
+ int id;
+ char *ifname;
+ int active;
+ unsigned long local;
+ unsigned long remote;
+ int encaps;
+ int hoplimit;
+ int security;
+ int tos;
+ oid config_name[MAX_OID_LEN];
+ size_t config_length;
+ struct tunnel *next;
+};
+
+
+
+/*
+ * variable4 tunnel_variables:
+ * this variable defines function callbacks and type return information
+ * for the tunnel mib section
+ */
+
+struct variable4 tunnel_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+#define LOCALADDRESS 1
+ {LOCALADDRESS, ASN_IPADDRESS, RWRITE, var_tunnelIfEntry, 3, {1, 1, 1}},
+#define REMOTEADDRESS 2
+ {REMOTEADDRESS, ASN_IPADDRESS, RWRITE, var_tunnelIfEntry, 3,
+ {1, 1, 2}},
+#define ENCAPSMETHOD 3
+ {ENCAPSMETHOD, ASN_INTEGER, RONLY, var_tunnelIfEntry, 3, {1, 1, 3}},
+#define HOPLIMIT 4
+ {HOPLIMIT, ASN_INTEGER, RWRITE, var_tunnelIfEntry, 3, {1, 1, 4}},
+#define SECURITY 5
+ {SECURITY, ASN_INTEGER, RONLY, var_tunnelIfEntry, 3, {1, 1, 5}},
+#define TOS 6
+ {TOS, ASN_INTEGER, RWRITE, var_tunnelIfEntry, 3, {1, 1, 6}},
+
+#define IFINDEX 7
+ {IFINDEX, ASN_INTEGER, RONLY, var_tunnelConfigEntry, 3, {2, 1, 5}},
+#define ROWSTATUS 8
+ {ROWSTATUS, ASN_INTEGER, RWRITE, var_tunnelConfigEntry, 3, {2, 1, 6}},
+};
+
+
+
+extern int register_sysORTable(oid *, size_t, const char *);
+extern int unregister_sysORTable(oid *, size_t);
+
+static oid sysORTable_reg[] = { 1, 3, 6, 1, 2, 1, 10, 131 };
+static size_t sysORTable_reglen = 8;
+
+static struct tunnel *tunnels;
+
+
+
+void
+deinit_tunnel(void)
+{
+ unregister_sysORTable(sysORTable_reg, sysORTable_reglen);
+}
+
+
+
+int
+term_tunnel(int majorID, int minorID, void *serverarg, void *clientarg)
+{
+ deinit_tunnel();
+ return 0;
+}
+
+
+
+void
+init_tunnel(void)
+{
+ register_sysORTable(sysORTable_reg, sysORTable_reglen,
+ "RFC 2667 TUNNEL-MIB implementation for "
+ "Linux 2.2.x kernels.");
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("tunnel", tunnel_variables, variable4,
+ tunnel_variables_oid);
+
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+ SNMP_CALLBACK_SHUTDOWN, term_tunnel, NULL);
+
+ tunnels = NULL;
+}
+
+
+
+static int
+getType(int index)
+{
+#ifndef USING_IF_MIB_IFTABLE_IFTABLE_MODULE
+ oid name[MAX_OID_LEN] = { 1, 3, 6, 1, 2, 1, 2, 2, 1, 3 };
+ size_t length = 10;
+ struct variable ifType_variable =
+ { 3, ASN_INTEGER, RONLY, var_ifEntry, 10,
+ {1, 3, 6, 1, 2, 1, 2, 2, 1, 3}
+ };
+ unsigned char *p;
+ size_t var_len;
+ WriteMethod *write_method;
+
+ name[length] = index;
+ length++;
+
+ p = var_ifEntry(&ifType_variable,
+ name, &length,
+ 1 /* exact */ , &var_len, &write_method);
+ if (!p)
+ return 0;
+
+ return *(int *) p;
+#else
+ ifTable_mib_index imi;
+ ifTable_rowreq_ctx *rr;
+
+ imi.ifIndex = index;
+ rr = ifTable_row_find_by_mib_index(&imi);
+ if (NULL == rr)
+ return 0;
+
+ return rr->data.ifType;
+#endif
+}
+
+
+
+static char *
+getName(int index)
+{
+#ifndef USING_IF_MIB_IFTABLE_IFTABLE_MODULE
+ oid name[MAX_OID_LEN] = { 1, 3, 6, 1, 2, 1, 2, 2, 1, 2 };
+ size_t length = 10;
+ struct variable ifName_variable =
+ { 2, ASN_INTEGER, RONLY, var_ifEntry, 10,
+ {1, 3, 6, 1, 2, 1, 2, 2, 1, 2}
+ };
+ unsigned char *p;
+ size_t var_len;
+ WriteMethod *write_method;
+
+ name[length] = index;
+ length++;
+
+ p = var_ifEntry(&ifName_variable,
+ name, &length,
+ 1 /* exact */ , &var_len, &write_method);
+ if (!p)
+ return NULL;
+
+ return p;
+#else
+ return netsnmp_access_interface_name_find(index);
+#endif
+}
+
+
+
+static struct ip_tunnel_parm *
+getTunnelParm(char *ifname)
+{
+ struct ifreq ifrq;
+ int fd;
+ static struct ip_tunnel_parm parm;
+
+ if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ return NULL;
+ }
+
+ memset(&parm, 0, sizeof(struct ip_tunnel_parm));
+ strcpy(ifrq.ifr_name, ifname);
+ ifrq.ifr_ifru.ifru_data = (void *) &parm;
+ if (ioctl(fd, SIOCGETTUNNEL, &ifrq) < 0) {
+ /*
+ * try again with the last char of the device name cut off.
+ * it might have been a zero digit appended by the agent.
+ */
+ ifrq.ifr_name[strlen(ifrq.ifr_name) - 1] = 0;
+ if (ioctl(fd, SIOCGETTUNNEL, &ifrq) < 0) {
+ close(fd);
+ return NULL;
+ }
+ ifname[strlen(ifname) - 1] = 0;
+ }
+
+ close(fd);
+
+ return &parm;
+}
+
+
+
+int
+setTunnelParm(char *ifname, struct ip_tunnel_parm *parm)
+{
+ struct ifreq ifrq;
+ int fd;
+ int err;
+
+ if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ return -1;
+ }
+
+ strcpy(ifrq.ifr_name, ifname);
+ ifrq.ifr_ifru.ifru_data = (void *) parm;
+ err = ioctl(fd, SIOCCHGTUNNEL, &ifrq);
+ close(fd);
+
+ return err;
+}
+
+
+
+/*
+ * update a struct tunnel. its index and ifname elements have to be set.
+ */
+static struct tunnel *
+updateTunnel(struct tunnel *tunnel)
+{
+ struct ip_tunnel_parm *parm;
+ int fd;
+ struct ifreq ifrq;
+
+ /*
+ * NOTE: getTunnelParm() may adjust the passed ifname.
+ */
+ parm = getTunnelParm(tunnel->ifname);
+ if (!parm) {
+ DEBUGMSGTL(("tunnel",
+ "updateTunnel(): getTunnelParm(\"%s\") returned NULL\n",
+ tunnel->ifname));
+ tunnel->active = 0;
+ return NULL;
+ }
+
+ tunnel->active = 1;
+
+ tunnel->local = parm->iph.saddr;
+ tunnel->remote = parm->iph.daddr;
+
+ if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ DEBUGMSGTL(("snmpd", "socket open failure in updateTunnels()\n"));
+ return NULL;
+ } else {
+ /*
+ * NOTE: this ioctl does not guarantee 6 bytes of a physaddr.
+ * In particular, a 'sit0' interface only appears to get back
+ * 4 bytes of sa_data. We don't use sa_data here, or we'd
+ * need to memset it to 0 before the ioct.
+ */
+ strcpy(ifrq.ifr_name, tunnel->ifname);
+ if (ioctl(fd, SIOCGIFHWADDR, &ifrq) == 0)
+ switch (ifrq.ifr_hwaddr.sa_family) {
+ case ARPHRD_TUNNEL:
+ tunnel->encaps = 2;
+ break;; /* direct */
+ case ARPHRD_TUNNEL6:
+ tunnel->encaps = 2;
+ break;; /* direct */
+ case ARPHRD_IPGRE:
+ tunnel->encaps = 3;
+ break;; /* gre */
+ case ARPHRD_SIT:
+ tunnel->encaps = 2;
+ break;; /* direct */
+ default:
+ tunnel->encaps = 1; /* other */
+ }
+ close(fd);
+ }
+
+ tunnel->hoplimit = parm->iph.ttl;
+ tunnel->security = 1;
+ tunnel->tos = (parm->iph.tos & 1) ? -1 : parm->iph.tos;
+ /*
+ * XXX: adjust tos mapping (kernel <-> TUNNEL-MIB::tunnelIfTOS)
+ */
+
+ return tunnel;
+}
+
+
+
+static void
+updateTunnels(void)
+{
+ static int max_index = 1;
+ static struct tunnel *last_tunnel = NULL;
+ struct tunnel *tunnel;
+ char *ifname;
+ int type;
+
+ /*
+ * uptime the tunnels we have so far
+ */
+ for (tunnel = tunnels; tunnel; tunnel = tunnel->next) {
+ DEBUGMSG(("tunnel",
+ "updateTunnels(): updating %s (index=%d)\n",
+ tunnel->ifname, tunnel->ifindex));
+ updateTunnel(tunnel);
+ }
+
+ /*
+ * look for new tunnels
+ */
+ for (; max_index < 256; max_index++) {
+ DEBUGMSG(("tunnel",
+ "updateTunnels(): looking for new index=%d\n",
+ max_index));
+ type = getType(max_index);
+ if (type == 131) {
+ tunnel = (struct tunnel *) malloc(sizeof(struct tunnel));
+ if (!tunnel)
+ continue;
+
+ tunnel->ifindex = max_index;
+ tunnel->id = 1;
+
+ ifname = getName(max_index);
+ if (!ifname) {
+ free(tunnel);
+ continue;
+ }
+
+ tunnel->ifname = strdup(ifname);
+ if (!tunnel->ifname) {
+ free(tunnel);
+ continue;
+ }
+
+ if (!updateTunnel(tunnel)) {
+ free(tunnel);
+ continue;
+ }
+
+ if (last_tunnel)
+ last_tunnel->next = tunnel;
+ if (!tunnels)
+ tunnels = last_tunnel = tunnel;
+ tunnel->next = NULL;
+ last_tunnel = tunnel;
+
+ DEBUGMSG(("tunnel",
+ "updateTunnels(): added %s (index=%d state=%d)\n",
+ tunnel->ifname, tunnel->ifindex, tunnel->active));
+ }
+ if (type == 0)
+ break;
+ }
+}
+
+
+
+static struct tunnel *
+getTunnelByIfIndex(int index)
+{
+ struct tunnel *tunnel;
+
+ DEBUGMSG(("tunnel", "getTunnelByIfIndex(%d): ", index));
+
+ for (tunnel = tunnels; tunnel; tunnel = tunnel->next) {
+ if (tunnel->ifindex == index) {
+ if (!tunnel->active)
+ break;
+ DEBUGMSG(("tunnel",
+ "%s (index=%d)\n", tunnel->ifname, tunnel->ifindex));
+ return tunnel;
+ }
+ }
+ DEBUGMSG(("tunnel", "NONE\n"));
+ return NULL;
+}
+
+
+
+static struct tunnel *
+getNextTunnelByIfIndex(int index)
+{
+ struct tunnel *tunnel;
+
+ DEBUGMSG(("tunnel", "getNextTunnelByIfIndex(%d): ", index));
+
+ for (tunnel = tunnels; tunnel; tunnel = tunnel->next) {
+ if (tunnel->ifindex > index) {
+ if (!tunnel->active)
+ continue;
+ DEBUGMSG(("tunnel",
+ "%s (index=%d)\n", tunnel->ifname, tunnel->ifindex));
+ return tunnel;
+ }
+ }
+ DEBUGMSG(("tunnel", "NONE\n"));
+ return NULL;
+}
+
+
+
+static void
+fillConfigOid(oid * name, struct tunnel *tunnel)
+{
+ name[0] = ((unsigned char *) &tunnel->local)[0];
+ name[1] = ((unsigned char *) &tunnel->local)[1];
+ name[2] = ((unsigned char *) &tunnel->local)[2];
+ name[3] = ((unsigned char *) &tunnel->local)[3];
+ name[4] = ((unsigned char *) &tunnel->remote)[0];
+ name[5] = ((unsigned char *) &tunnel->remote)[1];
+ name[6] = ((unsigned char *) &tunnel->remote)[2];
+ name[7] = ((unsigned char *) &tunnel->remote)[3];
+ name[8] = tunnel->encaps;
+ name[9] = tunnel->id;
+ DEBUGMSGOID(("tunnel", name, 10));
+}
+
+
+
+static struct tunnel *
+getTunnelByConfigOid(oid * name, size_t * length)
+{
+ struct tunnel *tunnel;
+ oid tname[4 + 4 + 1 + 1];
+
+ DEBUGMSG(("tunnel", "getTunnelByConfigOid(): "));
+
+ for (tunnel = tunnels; tunnel; tunnel = tunnel->next) {
+ fillConfigOid(tname, tunnel);
+ if (!snmp_oid_compare(tname, 4 + 4 + 1 + 1,
+ &name[tunnel_len + 3],
+ (*length) - tunnel_len - 3)) {
+ if (!tunnel->active)
+ break;
+ DEBUGMSG(("tunnel",
+ "%s (index=%d)\n", tunnel->ifname, tunnel->ifindex));
+ return tunnel;
+ }
+ }
+ DEBUGMSG(("tunnel", "NONE\n"));
+ return NULL;
+}
+
+
+
+static struct tunnel *
+getNextTunnelByConfigOid(oid * name, size_t * length)
+{
+ struct tunnel *tunnel, *last_tunnel;
+ oid tname[10], last_tname[10];
+
+ DEBUGMSG(("tunnel", "getNextTunnelByConfigOid("));
+ DEBUGMSGOID(("tunnel", name, *length));
+ DEBUGMSG(("tunnel", "): "));
+
+ last_tunnel = NULL;
+ for (tunnel = tunnels; tunnel; tunnel = tunnel->next) {
+ if (!tunnel->active)
+ continue;
+ fillConfigOid(tname, tunnel);
+ if (snmp_oid_compare(tname, 10,
+ &name[tunnel_len + 3],
+ (*length) - tunnel_len - 3) > 0) {
+ if (!last_tunnel) {
+ last_tunnel = tunnel;
+ memcpy((char *) last_tname, (char *) tname,
+ 10 * sizeof(oid));
+ } else {
+ if (snmp_oid_compare(tname, 10, last_tname, 10) < 0) {
+ last_tunnel = tunnel;
+ memcpy((char *) last_tname, (char *) tname,
+ 10 * sizeof(oid));
+ }
+ }
+ }
+ }
+
+ if (last_tunnel) {
+ DEBUGMSG(("tunnel",
+ "%s (index=%d)\n",
+ last_tunnel->ifname, last_tunnel->ifindex));
+ } else {
+ DEBUGMSG(("tunnel", "NONE\n"));
+ }
+
+ return last_tunnel;
+}
+
+
+
+static int
+writeLocalAddress(int action, unsigned char *var_val,
+ unsigned char var_val_type, size_t var_val_len,
+ unsigned char *statP, oid * name, size_t name_len)
+{
+ static struct tunnel *tunnel;
+ struct ip_tunnel_parm *parm;
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_IPADDRESS) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != 4) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ case RESERVE2:
+ tunnel = getTunnelByIfIndex((int) name[name_len - 1]);
+ if (!tunnel) {
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ case FREE:
+ break;
+ case ACTION:
+ break;
+ case UNDO:
+ break;
+ case COMMIT:
+ if (!tunnel) {
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ parm = getTunnelParm(tunnel->ifname);
+ if (!parm) {
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ parm->iph.saddr = *(unsigned long *) var_val;
+ setTunnelParm(tunnel->ifname, parm);
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+static int
+writeRemoteAddress(int action, unsigned char *var_val,
+ unsigned char var_val_type, size_t var_val_len,
+ unsigned char *statP, oid * name, size_t name_len)
+{
+ static struct tunnel *tunnel;
+ struct ip_tunnel_parm *parm;
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_IPADDRESS) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len != 4) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ case RESERVE2:
+ tunnel = getTunnelByIfIndex((int) name[name_len - 1]);
+ if (!tunnel) {
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ case FREE:
+ break;
+ case ACTION:
+ break;
+ case UNDO:
+ break;
+ case COMMIT:
+ if (!tunnel) {
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ parm = getTunnelParm(tunnel->ifname);
+ if (!parm) {
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ parm->iph.daddr = *(unsigned long *) var_val;
+ setTunnelParm(tunnel->ifname, parm);
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+static int
+writeHopLimit(int action, unsigned char *var_val,
+ unsigned char var_val_type, size_t var_val_len,
+ unsigned char *statP, oid * name, size_t name_len)
+{
+ static struct tunnel *tunnel;
+ struct ip_tunnel_parm *parm;
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(long)) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ case RESERVE2:
+ tunnel = getTunnelByIfIndex((int) name[name_len - 1]);
+ if (!tunnel) {
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ case FREE:
+ break;
+ case ACTION:
+ break;
+ case UNDO:
+ break;
+ case COMMIT:
+ if (!tunnel) {
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ parm = getTunnelParm(tunnel->ifname);
+ if (!parm) {
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ parm->iph.ttl = *(long *) var_val;
+ setTunnelParm(tunnel->ifname, parm);
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+static int
+writeTOS(int action, unsigned char *var_val,
+ unsigned char var_val_type, size_t var_val_len,
+ unsigned char *statP, oid * name, size_t name_len)
+{
+ static struct tunnel *tunnel;
+ struct ip_tunnel_parm *parm;
+
+ switch (action) {
+ case RESERVE1:
+ if (var_val_type != ASN_INTEGER) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(long)) {
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ case RESERVE2:
+ tunnel = getTunnelByIfIndex((int) name[name_len - 1]);
+ if (!tunnel) {
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ case FREE:
+ break;
+ case ACTION:
+ break;
+ case UNDO:
+ break;
+ case COMMIT:
+ if (!tunnel) {
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ parm = getTunnelParm(tunnel->ifname);
+ if (!parm) {
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ /*
+ * this does not cover all meaningful values:
+ */
+ parm->iph.tos = (*(long *) var_val == -1) ? 1 : *(long *) var_val;
+ setTunnelParm(tunnel->ifname, parm);
+ break;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+
+
+unsigned char *
+var_tunnelIfEntry(struct variable *vp,
+ oid * name, size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ static unsigned long ret_addr;
+ static long ret_int;
+ struct tunnel *tunnel;
+
+ DEBUGMSGTL(("tunnel", "var_tunnelIfEntry: "));
+ DEBUGMSGOID(("tunnel", name, *length));
+ DEBUGMSG(("tunnel", " %d\n", exact));
+
+ updateTunnels();
+
+ if (exact) {
+ if (*length != tunnel_len + 3 + 1) {
+ return NULL;
+ }
+ tunnel = getTunnelByIfIndex((int) name[*length - 1]);
+ } else {
+ if ((*length) < tunnel_len) {
+ memcpy((char *) name, (char *) tunnel_variables_oid,
+ tunnel_len * sizeof(oid));
+ }
+ if ((*length) < tunnel_len + 1) {
+ name[tunnel_len] = 1;
+ }
+ if ((*length) < tunnel_len + 2) {
+ name[tunnel_len + 1] = 1;
+ }
+ if ((*length) < tunnel_len + 3) {
+ name[tunnel_len + 2] = 1;
+ }
+ if ((*length) < tunnel_len + 4) {
+ name[tunnel_len + 3] = 0;
+ }
+ *length = tunnel_len + 4;
+
+ tunnel = getNextTunnelByIfIndex(name[*length - 1]);
+ if (!tunnel) {
+ /*
+ * end of column, continue with first row of next column
+ */
+ tunnel = tunnels;
+ name[tunnel_len + 2]++;
+ if (name[tunnel_len + 2] > 6) {
+ /*
+ * there is no next column
+ */
+ return NULL;
+ }
+ if (!tunnel) {
+ /*
+ * there is no (next) row
+ */
+ return NULL;
+ }
+ }
+ }
+
+ if (!tunnel) {
+ return NULL;
+ }
+
+ name[*length - 1] = tunnel->ifindex;
+
+ DEBUGMSGTL(("tunnel", "var_tunnelIfEntry: using"));
+ DEBUGMSGOID(("tunnel", name, *length));
+ DEBUGMSG(("tunnel", "\n"));
+
+ switch (name[tunnel_len + 2]) {
+ case 1: /* tunnelIfLocalAddress */
+ ret_addr = tunnel->local;
+ *var_len = 4;
+ vp->type = ASN_IPADDRESS;
+ *write_method = writeLocalAddress;
+ return (u_char *) & ret_addr;
+ case 2: /* tunnelIfRemoteAddress */
+ ret_addr = tunnel->remote;
+ *var_len = 4;
+ vp->type = ASN_IPADDRESS;
+ *write_method = writeRemoteAddress;
+ return (u_char *) & ret_addr;
+ case 3: /* tunnelIfEncapsMethod */
+ ret_int = tunnel->encaps;
+ *var_len = sizeof(ret_int);
+ vp->type = ASN_INTEGER;
+ return (u_char *) & ret_int;
+ case 4: /* tunnelIfHopLimit */
+ ret_int = tunnel->hoplimit;
+ *var_len = sizeof(ret_int);
+ vp->type = ASN_INTEGER;
+ *write_method = writeHopLimit;
+ return (u_char *) & ret_int;
+ case 5: /* tunnelIfSecurity */
+ ret_int = tunnel->security;
+ *var_len = sizeof(ret_int);
+ vp->type = ASN_INTEGER;
+ return (u_char *) & ret_int;
+ case 6: /* tunnelIfTOS */
+ ret_int = tunnel->tos;
+ *var_len = sizeof(ret_int);
+ vp->type = ASN_INTEGER;
+ *write_method = writeTOS;
+ return (u_char *) & ret_int;
+ default:
+ return 0;
+ }
+
+ return NULL;
+}
+
+
+
+unsigned char *
+var_tunnelConfigEntry(struct variable *vp,
+ oid * name, size_t * length,
+ int exact, size_t * var_len,
+ WriteMethod ** write_method)
+{
+ static long ret_int;
+ struct tunnel *tunnel;
+ int i;
+
+ DEBUGMSGTL(("tunnel", "var_tunnelConfigEntry: "));
+ DEBUGMSGOID(("tunnel", name, *length));
+ DEBUGMSG(("tunnel", " %d\n", exact));
+
+ updateTunnels();
+
+ if (exact) {
+ if (*length != tunnel_len + 3 + 4 + 4 + 1 + 1) {
+ return NULL;
+ }
+ tunnel = getTunnelByConfigOid(name, length);
+ } else {
+ if (snmp_oid_compare(name, *length,
+ tunnel_configEntry_oid,
+ tunnel_configEntry_len) < 0) {
+ *length = 0;
+ }
+ if ((*length) < tunnel_len) {
+ memcpy((char *) name, (char *) tunnel_variables_oid,
+ tunnel_len * sizeof(oid));
+ }
+ if ((*length) < tunnel_len + 1) {
+ name[tunnel_len] = 2;
+ }
+ if ((*length) < tunnel_len + 2) {
+ name[tunnel_len + 1] = 1;
+ }
+ if ((*length) < tunnel_len + 3) {
+ name[tunnel_len + 2] = 5;
+ }
+ for (i = MAX(*length, tunnel_len + 3);
+ i < tunnel_len + 3 + 4 + 4 + 1 + 1; i++) {
+ name[i] = 0;
+ }
+ *length = tunnel_len + 3 + 4 + 4 + 1 + 1;
+ tunnel = getNextTunnelByConfigOid(name, length);
+ if (!tunnel) {
+ /*
+ * end of column, continue with first row of next column
+ */
+ tunnel = tunnels;
+ name[tunnel_len + 2]++;
+ if (name[tunnel_len + 2] > 6) {
+ /*
+ * there is no next column
+ */
+ return NULL;
+ }
+ if (!tunnel) {
+ /*
+ * there is no (next) row
+ */
+ return NULL;
+ }
+ }
+ }
+
+ if (!tunnel) {
+ return NULL;
+ }
+
+ fillConfigOid(&name[tunnel_len + 3], tunnel);
+
+ DEBUGMSGTL(("tunnel", "var_tunnelConfigEntry: using "));
+ DEBUGMSGOID(("tunnel", name, *length));
+ DEBUGMSG(("tunnel", "\n"));
+
+ switch (name[tunnel_len + 2]) {
+ case 5: /* tunnelConfigIfIndex */
+ ret_int = tunnel->ifindex;
+ *var_len = sizeof(ret_int);
+ vp->type = ASN_INTEGER;
+ return (u_char *) & ret_int;
+ case 6: /* tunnelConfigStatus */
+ ret_int = 1; /* active */
+ *var_len = sizeof(ret_int);
+ vp->type = ASN_INTEGER;
+ return (u_char *) & ret_int;
+ default:
+ return 0;
+ }
+
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/tunnel/tunnel.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/tunnel/tunnel.h
new file mode 100644
index 0000000000..147f765b0e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/tunnel/tunnel.h
@@ -0,0 +1,46 @@
+/*
+ * tunnel.h --
+ *
+ * Interface of the TUNNEL-MIB implementation.
+ *
+ * Copyright (c) 2000-2003 Frank Strauss <strauss@ibr.cs.tu-bs.de>
+ *
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appears in all copies and
+ * that both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of the author and CMU and
+ * The Regents of the University of California not be used in advertising
+ * or publicity pertaining to distribution of the software without
+ * specific written permission.
+ *
+ * THE AUTHOR AND CMU AND THE REGENTS OF THE UNIVERSITY OF CALIFORNIA
+ * DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+ * THE AUTHOR OR CMU OR THE REGENTS OF THE UNIVERSITY OF CALIFORNIA BE
+ * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+ * DAMAGES WHATSOEVER RESULTING FROM THE LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ *
+ */
+
+#ifndef _MIBGROUP_TUNNEL_H
+#define _MIBGROUP_TUNNEL_H
+
+void init_tunnel(void);
+void deinit_tunnel(void);
+
+unsigned char *var_tunnelIfEntry(struct variable *, oid *, size_t *,
+ int, size_t *,
+ WriteMethod ** write_method);
+
+unsigned char *var_tunnelConfigEntry(struct variable *, oid *, size_t *,
+ int, size_t *,
+ WriteMethod ** write_method);
+
+#endif /* _MIBGROUP_TUNNEL_H */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/disk.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/disk.c
new file mode 100644
index 0000000000..c2019a3765
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/disk.c
@@ -0,0 +1,882 @@
+/*
+ * disk.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <stdio.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include <signal.h>
+#if HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#if !(defined(bsdi2) || defined(netbsd1))
+#include <sys/vmmeter.h>
+#endif
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_CONF_H
+#include <sys/conf.h>
+#endif
+#if HAVE_ASM_PAGE_H
+#include <asm/page.h>
+#endif
+#if HAVE_SYS_SWAP_H
+#include <sys/swap.h>
+#endif
+#if HAVE_SYS_FS_H
+#include <sys/fs.h>
+#else
+#if HAVE_UFS_FS_H
+#include <ufs/fs.h>
+#else
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_VNODE_H
+#include <sys/vnode.h>
+#endif
+#ifdef HAVE_UFS_UFS_QUOTA_H
+#include <ufs/ufs/quota.h>
+#endif
+#ifdef HAVE_UFS_UFS_INODE_H
+#include <ufs/ufs/inode.h>
+#endif
+#if HAVE_UFS_FFS_FS_H
+#include <ufs/ffs/fs.h>
+#endif
+#endif
+#endif
+#if HAVE_MTAB_H
+#include <mtab.h>
+#endif
+#include <sys/stat.h>
+#include <errno.h>
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#if defined(HAVE_STATFS)
+#if HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#if !defined(HAVE_STATVFS)
+#define statvfs statfs
+#endif
+#endif
+#if HAVE_VM_VM_H
+#include <vm/vm.h>
+#endif
+#if HAVE_VM_SWAP_PAGER_H
+#include <vm/swap_pager.h>
+#endif
+#if HAVE_SYS_FIXPOINT_H
+#include <sys/fixpoint.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_FSTAB_H
+#include <fstab.h>
+#endif
+#if HAVE_MNTENT_H
+#include <mntent.h>
+#endif
+#if HAVE_SYS_MNTTAB_H
+#include <sys/mnttab.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "struct.h"
+#include "disk.h"
+#include "util_funcs.h"
+#if USING_UCD_SNMP_ERRORMIB_MODULE
+#include "errormib.h"
+#else
+#define setPerrorstatus(x) snmp_log_perror(x)
+#endif
+
+/*
+ * * config file parsing routines
+ * */
+static void disk_free_config(void);
+static void disk_parse_config(const char *, char *);
+static void disk_parse_config_all(const char *, char *);
+static void find_and_add_allDisks(int minpercent);
+static void add_device(char *path, char *device,
+ int minspace, int minpercent, int override);
+static void modify_disk_parameters(int index, int minspace,
+ int minpercent);
+static int disk_exists(char *path);
+static char *find_device(char *path);
+
+struct diskpart {
+ char device[STRMAX];
+ char path[STRMAX];
+ int minimumspace;
+ int minpercent;
+};
+
+int numdisks;
+int allDisksIncluded = 0;
+int maxdisks = 0;
+struct diskpart *disks;
+
+struct variable2 extensible_disk_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_disk, 1, {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_disk, 1, {ERRORNAME}},
+ {DISKDEVICE, ASN_OCTET_STR, RONLY, var_extensible_disk, 1,
+ {DISKDEVICE}},
+ {DISKMINIMUM, ASN_INTEGER, RONLY, var_extensible_disk, 1,
+ {DISKMINIMUM}},
+ {DISKMINPERCENT, ASN_INTEGER, RONLY, var_extensible_disk, 1,
+ {DISKMINPERCENT}},
+ {DISKTOTAL, ASN_INTEGER, RONLY, var_extensible_disk, 1, {DISKTOTAL}},
+ {DISKAVAIL, ASN_INTEGER, RONLY, var_extensible_disk, 1, {DISKAVAIL}},
+ {DISKUSED, ASN_INTEGER, RONLY, var_extensible_disk, 1, {DISKUSED}},
+ {DISKPERCENT, ASN_INTEGER, RONLY, var_extensible_disk, 1,
+ {DISKPERCENT}},
+ {DISKPERCENTNODE, ASN_INTEGER, RONLY, var_extensible_disk, 1,
+ {DISKPERCENTNODE}},
+ {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_disk, 1, {ERRORFLAG}},
+ {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_disk, 1, {ERRORMSG}}
+};
+
+/*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+oid disk_variables_oid[] = { NETSNMP_UCDAVIS_MIB, NETSNMP_DISKMIBNUM, 1 };
+
+void
+init_disk(void)
+{
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/disk", extensible_disk_variables, variable2,
+ disk_variables_oid);
+
+ snmpd_register_config_handler("disk", disk_parse_config,
+ disk_free_config,
+ "path [ minspace | minpercent% ]");
+ snmpd_register_config_handler("includeAllDisks", disk_parse_config_all,
+ disk_free_config,
+ "minpercent%");
+ allDisksIncluded = 0;
+}
+
+static void
+disk_free_config(void)
+{
+ int i;
+
+ numdisks = 0;
+ for (i = 0; i < maxdisks; i++) { /* init/erase disk db */
+ disks[i].device[0] = 0;
+ disks[i].path[0] = 0;
+ disks[i].minimumspace = -1;
+ disks[i].minpercent = -1;
+ }
+ allDisksIncluded = 0;
+}
+
+static void
+disk_parse_config(const char *token, char *cptr)
+{
+#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
+ char tmpbuf[1024];
+ char path[STRMAX];
+ int minpercent;
+ int minspace;
+
+ if (numdisks == maxdisks) {
+ if (maxdisks == 0) {
+ maxdisks = 50;
+ disks = malloc(maxdisks * sizeof(struct diskpart));
+ if (!disks) {
+ config_perror("malloc failed for new disk allocation.");
+ sprintf(tmpbuf, "\tignoring: %s", cptr);
+ tmpbuf[ sizeof(tmpbuf)-1 ] = 0;
+ config_perror(tmpbuf);
+ return;
+ }
+ memset(disks, 0, maxdisks * sizeof(struct diskpart));
+ } else {
+ maxdisks *= 2;
+ disks = realloc(disks, maxdisks * sizeof(struct diskpart));
+ if (!disks) {
+ config_perror("malloc failed for new disk allocation.");
+ sprintf(tmpbuf, "\tignoring: %s", cptr);
+ tmpbuf[ sizeof(tmpbuf)-1 ] = 0;
+ config_perror(tmpbuf);
+ return;
+ }
+ memset(disks + maxdisks/2, 0, maxdisks/2 * sizeof(struct diskpart));
+ }
+ }
+
+ /*
+ * read disk path (eg, /1 or /usr)
+ */
+ copy_nword(cptr, path, sizeof(path));
+ cptr = skip_not_white(cptr);
+ cptr = skip_white(cptr);
+
+ /*
+ * read optional minimum disk usage spec
+ */
+ if(cptr != NULL) {
+ if(strchr(cptr, '%') == 0) {
+ minspace = atoi(cptr);
+ minpercent = -1;
+ }
+ else {
+ minspace = -1;
+ minpercent = atoi(cptr);
+ }
+ } else {
+ minspace = NETSNMP_DEFDISKMINIMUMSPACE;
+ minpercent = -1;
+ }
+
+ /*
+ * check if the disk already exists, if so then modify its
+ * parameters. if it does not exist then add it
+ */
+ add_device(path, find_device(path), minspace, minpercent, 1);
+#endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
+}
+
+static void
+disk_parse_config_all(const char *token, char *cptr)
+{
+#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
+ char tmpbuf[1024];
+ int minpercent = DISKMINPERCENT;
+
+ if (numdisks == maxdisks) {
+ if (maxdisks == 0) {
+ maxdisks = 50;
+ disks = malloc(maxdisks * sizeof(struct diskpart));
+ if (!disks) {
+ config_perror("malloc failed for new disk allocation.");
+ sprintf(tmpbuf, "\tignoring: %s", cptr);
+ config_perror(tmpbuf);
+ return;
+ }
+ memset(disks, 0, maxdisks * sizeof(struct diskpart));
+ } else {
+ maxdisks *= 2;
+ disks = realloc(disks, maxdisks * sizeof(struct diskpart));
+ if (!disks) {
+ config_perror("malloc failed for new disk allocation.");
+ sprintf(tmpbuf, "\tignoring: %s", cptr);
+ config_perror(tmpbuf);
+ return;
+ }
+ memset(disks + maxdisks/2, 0, maxdisks/2 * sizeof(struct diskpart));
+ }
+ }
+ /*
+ * read the minimum disk usage percent
+ */
+ if(cptr != NULL) {
+ if(strchr(cptr, '%') != 0) {
+ minpercent = atoi(cptr);
+ }
+ }
+ /*
+ * if we have already seen the "includeAllDisks" directive
+ * then search for the disk in the "disks" array and modify
+ * the values. if we havent seen the "includeAllDisks"
+ * directive then include this disk
+ */
+ if(allDisksIncluded) {
+ config_perror("includeAllDisks already specified.");
+ sprintf(tmpbuf, "\tignoring: includeAllDisks %s", cptr);
+ config_perror(tmpbuf);
+ }
+ else {
+ allDisksIncluded = 1;
+ find_and_add_allDisks(minpercent);
+ }
+#endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
+}
+
+
+static void
+add_device(char *path, char *device, int minspace, int minpercent, int override)
+{
+ int index;
+
+ if (!path || !strcmp(path, "none")) {
+ DEBUGMSGTL(("ucd-snmp/disk", "Skipping null path device (%s)\n", device));
+ return;
+ }
+ if (numdisks == maxdisks) {
+ if (maxdisks == 0) {
+ maxdisks = 50;
+ disks = malloc(maxdisks * sizeof(struct diskpart));
+ if (!disks) {
+ char tmpbuf[1024];
+ snprintf(tmpbuf, sizeof(tmpbuf), "\tignoring: %s", device);
+ tmpbuf[ sizeof(tmpbuf)-1 ] = 0;
+ config_perror(tmpbuf);
+ return;
+ }
+ memset(disks, 0, maxdisks * sizeof(struct diskpart));
+ } else {
+ maxdisks *= 2;
+ disks = realloc(disks, maxdisks * sizeof(struct diskpart));
+ if (!disks) {
+ char tmpbuf[1024];
+ config_perror("malloc failed for new disk allocation.");
+ snprintf(tmpbuf, sizeof(tmpbuf), "\tignoring: %s", device);
+ tmpbuf[ sizeof(tmpbuf)-1 ] = 0;
+ config_perror(tmpbuf);
+ return;
+ }
+ memset(disks + maxdisks/2, 0, maxdisks/2 * sizeof(struct diskpart));
+ }
+ }
+
+ index = disk_exists(path);
+ if((index != -1) && (index < maxdisks) && (override==1)) {
+ modify_disk_parameters(index, minspace, minpercent);
+ }
+ else if(index == -1){
+ /* add if and only if the device was found */
+ if(device[0] != 0) {
+ /* The following buffers are cleared above, no need to add '\0' */
+ strncpy(disks[numdisks].path, path, sizeof(disks[numdisks].path) - 1);
+ strncpy(disks[numdisks].device, device,
+ sizeof(disks[numdisks].device) - 1);
+ disks[numdisks].minimumspace = minspace;
+ disks[numdisks].minpercent = minpercent;
+ numdisks++;
+ }
+ else {
+ disks[numdisks].minimumspace = -1;
+ disks[numdisks].minpercent = -1;
+ disks[numdisks].path[0] = 0;
+ disks[numdisks].device[0] = 0;
+ }
+ }
+}
+
+void
+modify_disk_parameters(int index, int minspace, int minpercent)
+{
+ disks[index].minimumspace = minspace;
+ disks[index].minpercent = minpercent;
+}
+
+int disk_exists(char *path)
+{
+ int index;
+ for(index = 0; index < numdisks; index++) {
+ DEBUGMSGTL(("ucd-snmp/disk", "Checking for %s. Found %s at %d\n", path, disks[index].path, index));
+ if(strcmp(path, disks[index].path) == 0) {
+ return index;
+ }
+ }
+ return -1;
+}
+
+static void
+find_and_add_allDisks(int minpercent)
+{
+#if HAVE_GETMNTENT
+#if HAVE_SYS_MNTTAB_H
+ struct mnttab mnttab;
+#else
+ struct mntent *mntent;
+#endif
+ FILE *mntfp;
+#elif HAVE_FSTAB_H
+ struct fstab *fstab1;
+#elif HAVE_STATFS
+ struct statfs statf;
+#endif
+#if defined(HAVE_GETMNTENT) && !defined(HAVE_SETMNTENT)
+ int i;
+#endif
+
+ int dummy = 0;
+ char tmpbuf[1024];
+ /*
+ * find the device for the path and copy the device into the
+ * string declared above and at the end of the routine return it
+ * to the caller
+ */
+#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
+#if HAVE_GETMNTENT
+#if HAVE_SETMNTENT
+ mntfp = setmntent(ETC_MNTTAB, "r");
+ if (!mntfp) {
+ snprintf( tmpbuf, sizeof(tmpbuf), "Can't open %s (setmntent)\n", ETC_MNTTAB );
+ config_perror(tmpbuf);
+ return;
+ }
+ while (mntfp && NULL != (mntent = getmntent(mntfp))) {
+ add_device(mntent->mnt_dir, mntent->mnt_fsname, -1, minpercent, 0);
+ dummy = 1;
+ }
+ if (mntfp)
+ endmntent(mntfp);
+ if(dummy != 0) {
+ /*
+ * dummy clause for else below
+ */
+ }
+#else /* getmentent but not setmntent */
+ mntfp = fopen(ETC_MNTTAB, "r");
+ if (!mntfp) {
+ snprintf( tmpbuf, sizeof(tmpbuf), "Can't open %s (fopen)\n", ETC_MNTTAB );
+ config_perror(tmpbuf);
+ return;
+ }
+ while ((i = getmntent(mntfp, &mnttab)) == 0) {
+ add_device(mnttab.mnt_mountp, mnttab.mnt_special, -1, minpercent, 0);
+ dummy = 1;
+ }
+ fclose(mntfp);
+ if(dummy != 0) {
+ /*
+ * dummy clause for else below
+ */
+ }
+#endif /* HAVE_SETMNTENT */
+#elif HAVE_FSTAB_H
+ setfsent(); /* open /etc/fstab */
+ while((fstab1 = getfsent()) != NULL) {
+ add_device(fstab1->fs_file, fstab1->fs_spec, -1, minpercent, 0);
+ dummy = 1;
+ }
+ endfsent(); /* close /etc/fstab */
+ if(dummy != 0) {
+ /*
+ * dummy clause for else below
+ */
+ }
+#elif HAVE_STATFS
+ /*
+ * since there is no way to get all the mounted systems with just
+ * statfs we default to the root partition "/"
+ */
+ if (statfs("/", &statf) == 0) {
+ add_device("/", statf.f_mntfromname, -1, minpercent, 0);
+ }
+#endif
+ else {
+ if (numdisks == maxdisks) {
+ return;
+ }
+ snprintf(tmpbuf, sizeof(tmpbuf),
+ "Couldn't find device for disk %s",
+ disks[numdisks].path);
+ tmpbuf[ sizeof(tmpbuf)-1 ] = 0;
+ config_pwarn(tmpbuf);
+ disks[numdisks].minimumspace = -1;
+ disks[numdisks].minpercent = -1;
+ disks[numdisks].path[0] = 0;
+ }
+#else
+ config_perror("'disk' checks not supported on this architecture.");
+#endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
+
+}
+
+static char *
+find_device(char *path)
+{
+#if HAVE_GETMNTENT
+#if HAVE_SYS_MNTTAB_H
+ struct mnttab mnttab;
+#else
+ struct mntent *mntent;
+#endif
+ FILE *mntfp;
+#elif HAVE_FSTAB_H
+ struct fstab *fstab;
+ struct stat stat1;
+#elif HAVE_STATFS
+ struct statfs statf;
+#endif
+ char tmpbuf[1024];
+ static char device[STRMAX];
+#if defined(HAVE_GETMNTENT) && !defined(HAVE_SETMNTENT)
+ int i;
+#endif
+
+ device[0] = '\0'; /* null terminate the device */
+
+
+ /* find the device for the path and copy the device into the
+ * string declared above and at the end of the routine return it
+ * to the caller
+ */
+#if HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS
+#if HAVE_GETMNTENT
+#if HAVE_SETMNTENT
+ mntfp = setmntent(ETC_MNTTAB, "r");
+ if (!mntfp) {
+ snprintf( tmpbuf, sizeof(tmpbuf), "Can't open %s (setmntent)\n", ETC_MNTTAB );
+ config_perror(tmpbuf);
+ return NULL;
+ }
+ while (mntfp && NULL != (mntent = getmntent(mntfp)))
+ if (strcmp(path, mntent->mnt_dir) == 0) {
+ strncpy(device, mntent->mnt_fsname, sizeof(device));
+ device[sizeof(device) - 1] = '\0';
+ DEBUGMSGTL(("ucd-snmp/disk", "Disk: %s\n",
+ mntent->mnt_fsname));
+ break;
+ } else {
+ DEBUGMSGTL(("ucd-snmp/disk", " %s != %s\n",
+ path, mntent->mnt_dir));
+ }
+ if (mntfp)
+ endmntent(mntfp);
+#else /* getmentent but not setmntent */
+ mntfp = fopen(ETC_MNTTAB, "r");
+ if (!mntfp) {
+ snprintf( tmpbuf, sizeof(tmpbuf), "Can't open %s (fopen)\n", ETC_MNTTAB );
+ config_perror(tmpbuf);
+ return NULL;
+ }
+ while ((i = getmntent(mntfp, &mnttab)) == 0)
+ if (strcmp(path, mnttab.mnt_mountp) == 0)
+ break;
+ else {
+ DEBUGMSGTL(("ucd-snmp/disk", " %s != %s\n",
+ path, mnttab.mnt_mountp));
+ }
+ fclose(mntfp);
+ if (i == 0) {
+ strncpy(device, mnttab.mnt_special, sizeof(device));
+ device[sizeof(device) - 1] = '\0';
+ }
+#endif /* HAVE_SETMNTENT */
+#elif HAVE_FSTAB_H
+ stat(path, &stat1);
+ setfsent();
+ if ((fstab = getfsfile(path))) {
+ strncpy(device, fstab->fs_spec, sizeof(device));
+ device[sizeof(device) - 1] = '\0';
+ }
+ endfsent();
+ if (device[0] != '\0') {
+ /*
+ * dummy clause for else below
+ */
+ }
+
+#elif HAVE_STATFS
+ if (statfs(path, &statf) == 0) {
+ strncpy(device, statf.f_mntfromname, sizeof(device) - 1);
+ device[sizeof(device) - 1] = '\0';
+ DEBUGMSGTL(("ucd-snmp/disk", "Disk: %s\n",
+ statf.f_mntfromname));
+ }
+#endif
+ else {
+ sprintf(tmpbuf, "Couldn't find device for disk %s",
+ path);
+ config_pwarn(tmpbuf);
+ }
+#else
+ config_perror("'disk' checks not supported on this architecture.");
+#endif /* HAVE_FSTAB_H || HAVE_GETMNTENT || HAVE_STATFS */
+ return device;
+}
+
+
+/*
+ * var_extensible_disk(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+u_char *
+var_extensible_disk(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+ int percent, iserror, disknum = 0;
+#if !defined(HAVE_SYS_STATVFS_H) && !defined(HAVE_STATFS)
+ double totalblks, free, used, avail, availblks;
+#else
+ static long avail;
+#if defined(STRUCT_STATVFS_HAS_F_FILES) || defined(STRUCT_STATFS_HAS_F_FILES)
+ int percent_inode;
+#endif
+#endif
+ static long long_ret;
+ static char errmsg[300];
+ float multiplier;
+
+#if defined(HAVE_STATVFS) || defined(HAVE_STATFS)
+#ifdef STAT_STATFS_FS_DATA
+ struct fs_data fsd;
+ struct {
+ u_int f_blocks, f_bfree, f_bavail, f_bsize;
+ } vfs;
+#else
+ struct statvfs vfs;
+#endif
+#else
+#if HAVE_FSTAB_H
+ int file;
+ union {
+ struct fs iu_fs;
+ char dummy[SBSIZE];
+ } sb;
+#define filesys sb.iu_fs
+#endif
+#endif
+
+tryAgain:
+ if (header_simple_table
+ (vp, name, length, exact, var_len, write_method, numdisks))
+ return (NULL);
+ disknum = name[*length - 1] - 1;
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = disknum + 1;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* DISKPATH */
+ *var_len = strlen(disks[disknum].path);
+ return ((u_char *) disks[disknum].path);
+ case DISKDEVICE:
+ *var_len = strlen(disks[disknum].device);
+ return ((u_char *) disks[disknum].device);
+ case DISKMINIMUM:
+ long_ret = disks[disknum].minimumspace;
+ return ((u_char *) (&long_ret));
+ case DISKMINPERCENT:
+ long_ret = disks[disknum].minpercent;
+ return ((u_char *) (&long_ret));
+ }
+#if defined(HAVE_STATVFS) || defined(HAVE_STATFS)
+#ifdef STAT_STATFS_FS_DATA
+ if (statvfs(disks[disknum].path, &fsd) == -1)
+#else
+ if (statvfs(disks[disknum].path, &vfs) == -1)
+#endif
+ {
+ snmp_log(LOG_ERR, "Couldn't open device %s\n",
+ disks[disknum].device);
+ setPerrorstatus("statvfs dev/disk");
+ if (!exact)
+ goto tryAgain;
+ return NULL;
+ }
+#ifdef STAT_STATFS_FS_DATA
+ vfs.f_blocks = fsd.fd_btot;
+ vfs.f_bfree = fsd.fd_bfree;
+ vfs.f_bavail = fsd.fd_bfreen;
+ vfs.f_bsize = 1024; /* Ultrix f_bsize is a VM parameter apparently. */
+#endif
+#if defined(HAVE_ODS)
+ vfs.f_blocks = vfs.f_spare[0];
+ vfs.f_bfree = vfs.f_spare[1];
+ vfs.f_bavail = vfs.f_spare[2];
+#endif
+ percent =
+ vfs.f_blocks == 0 ? 0 :
+ vfs.f_bavail <= 0 ? 100 :
+ (int) ((double) (vfs.f_blocks - vfs.f_bfree) /
+ (double) (vfs.f_blocks -
+ (vfs.f_bfree - vfs.f_bavail)) * 100.0 + 0.5);
+ multiplier = (float)vfs.f_bsize / (float)1024.0;
+#ifdef STRUCT_STATVFS_HAS_F_FRSIZE
+ if (vfs.f_frsize > 255)
+ multiplier = (float)vfs.f_frsize / (float)1024.0;
+#endif
+ avail = (long)(vfs.f_bavail * multiplier);
+ iserror = (disks[disknum].minimumspace >= 0 ?
+ avail < disks[disknum].minimumspace :
+ 100 - percent <= disks[disknum].minpercent) ? 1 : 0;
+#if defined(STRUCT_STATVFS_HAS_F_FILES) || defined STRUCT_STATFS_HAS_F_FAVAIL
+ percent_inode = vfs.f_favail <= 0 ? 100 :
+ (int) ((double) (vfs.f_files - vfs.f_ffree) /
+ (double) (vfs.f_files -
+ (vfs.f_ffree - vfs.f_favail)) * 100.0 + 0.5);
+#else
+#if defined(STRUCT_STATFS_HAS_F_FILES) && defined(STRUCT_STATFS_HAS_F_FFREE)
+ percent_inode = vfs.f_files == 0 ? 100.0 :
+ (int) ((double) (vfs.f_files - vfs.f_ffree) /
+ (double) (vfs.f_files) * 100.0 + 0.5);
+#endif
+#endif /* defined(STRUCT_STATVFS_HAS_F_FILES) */
+ switch (vp->magic) {
+ case DISKTOTAL:
+ long_ret = (long)(vfs.f_blocks * multiplier);
+ return ((u_char *) (&long_ret));
+ case DISKAVAIL:
+ return ((u_char *) (&avail));
+ case DISKUSED:
+ long_ret = (long)((vfs.f_blocks - vfs.f_bfree) * multiplier);
+ return ((u_char *) (&long_ret));
+ case DISKPERCENT:
+ long_ret = percent;
+ return ((u_char *) (&long_ret));
+#if defined(STRUCT_STATVFS_HAS_F_FILES) || defined (STRUCT_STATFS_HAS_F_FILES)
+ case DISKPERCENTNODE:
+ long_ret = percent_inode;
+ return ((u_char *) (&long_ret));
+#endif
+ case ERRORFLAG:
+ long_ret = iserror;
+ return ((u_char *) (&long_ret));
+ case ERRORMSG:
+ if (iserror) {
+ if (disks[disknum].minimumspace >= 0)
+ snprintf(errmsg, sizeof(errmsg),
+ "%s: less than %d free (= %d)",
+ disks[disknum].path, disks[disknum].minimumspace,
+ (int) avail);
+ else
+ snprintf(errmsg, sizeof(errmsg),
+ "%s: less than %d%% free (= %d%%)",
+ disks[disknum].path, disks[disknum].minpercent,
+ percent);
+ errmsg[ sizeof(errmsg)-1 ] = 0;
+ } else
+ errmsg[0] = 0;
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ }
+#else
+#if HAVE_FSTAB_H
+ /*
+ * read the disk information
+ */
+ if ((file = open(disks[disknum].device, 0)) < 0) {
+ snmp_log(LOG_ERR, "Couldn't open device %s\n",
+ disks[disknum].device);
+ setPerrorstatus("open dev/disk");
+ if (!exact)
+ goto tryAgain;
+ return (NULL);
+ }
+ lseek(file, (long) (SBLOCK * DEV_BSIZE), 0);
+ if (read(file, (char *) &filesys, SBSIZE) != SBSIZE) {
+ setPerrorstatus("open dev/disk");
+ snmp_log(LOG_ERR, "Error reading device %s\n",
+ disks[disknum].device);
+ close(file);
+ if (!exact)
+ goto tryAgain;
+ return (NULL);
+ }
+ close(file);
+ totalblks = filesys.fs_dsize;
+ free = filesys.fs_cstotal.cs_nbfree * filesys.fs_frag +
+ filesys.fs_cstotal.cs_nffree;
+ used = totalblks - free;
+ availblks = totalblks * (100 - filesys.fs_minfree) / 100;
+ avail = availblks > used ? availblks - used : 0;
+ percent =
+ totalblks == 0 ? 0 :
+ availblks == 0 ? 100 :
+ (int) ((double) used / (double) totalblks * 100.0 + 0.5);
+ multiplier = (float)filesys.fs_fsize / (float)1024.0;
+ iserror =
+ (disks[disknum].minimumspace >= 0
+ ? avail * multiplier < disks[disknum].minimumspace
+ : 100 - percent <= disks[disknum].minpercent) ? 1 : 0;
+ switch (vp->magic) {
+ case DISKTOTAL:
+ long_ret = (long)(totalblks * multiplier);
+ return ((u_char *) (&long_ret));
+ case DISKAVAIL:
+ long_ret = (long)(avail * multiplier);
+ return ((u_char *) (&long_ret));
+ case DISKUSED:
+ long_ret = (long)(used * multiplier);
+ return ((u_char *) (&long_ret));
+ case DISKPERCENT:
+ long_ret = percent;
+ return ((u_char *) (&long_ret));
+ case ERRORFLAG:
+ long_ret = iserror;
+ return ((u_char *) (&long_ret));
+ case ERRORMSG:
+ if (iserror) {
+ if (disks[disknum].minimumspace >= 0)
+ snprintf(errmsg, sizeof(errmsg),
+ "%s: less than %d free (= %d)",
+ disks[disknum].path, disks[disknum].minimumspace,
+ avail * filesys.fs_fsize / 1024);
+ else
+ snprintf(errmsg, sizeof(errmsg),
+ "%s: less than %d%% free (= %d%%)",
+ disks[disknum].path, disks[disknum].minpercent,
+ percent);
+ errmsg[ sizeof(errmsg)-1 ] = 0;
+ } else
+ errmsg[0] = 0;
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ }
+#endif
+#endif
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/disk.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/disk.h
new file mode 100644
index 0000000000..6bc5b14d5b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/disk.h
@@ -0,0 +1,25 @@
+/*
+ * Template MIB group interface - disk.h
+ *
+ */
+#ifndef _MIBGROUP_DISK_H
+#define _MIBGROUP_DISK_H
+
+void init_disk(void);
+
+config_require(util_funcs)
+
+ extern FindVarMethod var_extensible_disk;
+
+#include "mibdefs.h"
+
+#define DISKDEVICE 3
+#define DISKMINIMUM 4
+#define DISKMINPERCENT 5
+#define DISKTOTAL 6
+#define DISKAVAIL 7
+#define DISKUSED 8
+#define DISKPERCENT 9
+#define DISKPERCENTNODE 10
+
+#endif /* _MIBGROUP_DISK_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/diskio.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/diskio.c
new file mode 100644
index 0000000000..f597f1abc2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/diskio.c
@@ -0,0 +1,1169 @@
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+/*
+ * needed by util_funcs.h
+ */
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * header_generic() comes from here
+ */
+#include "util_funcs.h"
+
+/*
+ * include our .h file
+ */
+#include "diskio.h"
+
+#define CACHE_TIMEOUT 1
+static time_t cache_time = 0;
+
+#ifdef solaris2
+#include <kstat.h>
+
+#define MAX_DISKS 128
+
+static kstat_ctl_t *kc;
+static kstat_t *ksp;
+static kstat_io_t kio;
+static int cache_disknr = -1;
+#endif /* solaris2 */
+
+#if defined(aix4) || defined(aix5) || defined(aix6)
+/*
+ * handle disk statistics via libperfstat
+ */
+#include <libperfstat.h>
+static perfstat_disk_t *ps_disk; /* storage for all disk values */
+static int ps_numdisks; /* number of disks in system, may change while running */
+#endif
+
+#if defined(bsdi3) || defined(bsdi4)
+#include <string.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <sys/diskstats.h>
+#endif /* bsdi */
+
+#if defined (freebsd4) || defined(freebsd5)
+#include <sys/param.h>
+#if __FreeBSD_version >= 500101
+#include <sys/resource.h> /* for CPUSTATES in devstat.h */
+#else
+#include <sys/dkstat.h>
+#endif
+#include <devstat.h>
+#include <net-snmp/utilities.h>
+
+#include <math.h>
+/* sampling interval, in seconds */
+#define DISKIO_SAMPLE_INTERVAL 5
+
+#endif /* freebsd */
+
+#if defined(freebsd5) && __FreeBSD_version >= 500107
+ #define GETDEVS(x) devstat_getdevs(NULL, (x))
+#else
+ #define GETDEVS(x) getdevs((x))
+#endif
+
+#if defined (darwin)
+#include <CoreFoundation/CoreFoundation.h>
+#include <IOKit/IOKitLib.h>
+#include <IOKit/storage/IOBlockStorageDriver.h>
+#include <IOKit/storage/IOMedia.h>
+#include <IOKit/IOBSD.h>
+
+static mach_port_t masterPort; /* to communicate with I/O Kit */
+#endif /* darwin */
+
+void diskio_parse_config(const char *, char *);
+
+#if defined (freebsd4) || defined(freebsd5)
+void devla_getstats(unsigned int regno, void *dummy);
+#endif
+
+FILE *file;
+
+ /*********************
+ *
+ * Initialisation & common implementation functions
+ *
+ *********************/
+
+
+/*
+ * this is an optional function called at the time the agent starts up
+ * to do any initilizations you might require. You don't have to
+ * create it, as it is optional.
+ */
+
+/*
+ * IMPORTANT: If you add or remove this function, you *must* re-run
+ * the configure script as it checks for its existance.
+ */
+
+void
+init_diskio(void)
+{
+ /*
+ * Define a 'variable' structure that is a representation of our mib.
+ */
+
+ /*
+ * first, we have to pick the variable type. They are all defined in
+ * the var_struct.h file in the agent subdirectory. I'm picking the
+ * variable2 structure since the longest sub-component of the oid I
+ * want to load is .2.1 and .2.2 so I need at most 2 spaces in the
+ * last entry.
+ */
+
+ struct variable2 diskio_variables[] = {
+ {DISKIO_INDEX, ASN_INTEGER, RONLY, var_diskio, 1, {1}},
+ {DISKIO_DEVICE, ASN_OCTET_STR, RONLY, var_diskio, 1, {2}},
+ {DISKIO_NREAD, ASN_COUNTER, RONLY, var_diskio, 1, {3}},
+ {DISKIO_NWRITTEN, ASN_COUNTER, RONLY, var_diskio, 1, {4}},
+ {DISKIO_READS, ASN_COUNTER, RONLY, var_diskio, 1, {5}},
+ {DISKIO_WRITES, ASN_COUNTER, RONLY, var_diskio, 1, {6}},
+ {DISKIO_LA1, ASN_INTEGER, RONLY, var_diskio, 1, {9}},
+ {DISKIO_LA5, ASN_INTEGER, RONLY, var_diskio, 1, {10}},
+ {DISKIO_LA15, ASN_INTEGER, RONLY, var_diskio, 1, {11}},
+ {DISKIO_NREADX, ASN_COUNTER64, RONLY, var_diskio, 1, {12}},
+ {DISKIO_NWRITTENX, ASN_COUNTER64, RONLY, var_diskio, 1, {13}},
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath.
+ */
+ oid diskio_variables_oid[] =
+ { 1, 3, 6, 1, 4, 1, 2021, 13, 15, 1, 1 };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ *
+ * This is a macro defined in ../../snmp_vars.h. The arguments are:
+ *
+ * descr: A short description of the mib group being loaded.
+ * var: The variable structure to load.
+ * vartype: The variable structure used to define it (variable2, variable4, ...)
+ * theoid: A *initialized* *exact length* oid pointer.
+ * (sizeof(theoid) *must* return the number of elements!)
+ */
+ REGISTER_MIB("diskio", diskio_variables, variable2,
+ diskio_variables_oid);
+
+#ifdef solaris2
+ kc = kstat_open();
+
+ if (kc == NULL)
+ snmp_log(LOG_ERR, "diskio: Couldn't open kstat\n");
+#endif
+
+#ifdef darwin
+ /*
+ * Get the I/O Kit communication handle.
+ */
+ IOMasterPort(bootstrap_port, &masterPort);
+#endif
+
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ /*
+ * initialize values to gather information on first request
+ */
+ ps_numdisks = 0;
+ ps_disk = NULL;
+#endif
+
+#if defined (freebsd4) || defined(freebsd5)
+ devla_getstats(0, NULL);
+ /* collect LA data regularly */
+ snmp_alarm_register(DISKIO_SAMPLE_INTERVAL, SA_REPEAT, devla_getstats, NULL);
+#endif
+
+}
+
+#ifdef solaris2
+int
+get_disk(int disknr)
+{
+ time_t now;
+ int i = 0;
+ kstat_t *tksp;
+
+ now = time(NULL);
+ if (disknr == cache_disknr && cache_time + CACHE_TIMEOUT > now) {
+ return 1;
+ }
+
+ /*
+ * could be optimiced by checking if cache_disknr<=disknr
+ * if so, just reread the data - not going through the whole chain
+ * from kc->kc_chain
+ */
+
+ for (tksp = kc->kc_chain; tksp != NULL; tksp = tksp->ks_next) {
+ if (tksp->ks_type == KSTAT_TYPE_IO
+ && !strcmp(tksp->ks_class, "disk")) {
+ if (i == disknr) {
+ if (kstat_read(kc, tksp, &kio) == -1)
+ snmp_log(LOG_ERR, "diskio: kstat_read failed\n");
+ ksp = tksp;
+ cache_time = now;
+ cache_disknr = disknr;
+ return 1;
+ } else {
+ i++;
+ }
+ }
+ }
+ return 0;
+}
+
+
+u_char *
+var_diskio(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * define any variables we might return as static!
+ */
+ static long long_ret;
+ static struct counter64 c64_ret;
+
+ if (header_simple_table
+ (vp, name, length, exact, var_len, write_method, MAX_DISKS))
+ return NULL;
+
+
+ if (get_disk(name[*length - 1] - 1) == 0)
+ return NULL;
+
+
+ /*
+ * We can now simply test on vp's magic number, defined in diskio.h
+ */
+ switch (vp->magic) {
+ case DISKIO_INDEX:
+ long_ret = (long) name[*length - 1];
+ return (u_char *) & long_ret;
+ case DISKIO_DEVICE:
+ *var_len = strlen(ksp->ks_name);
+ return (u_char *) ksp->ks_name;
+ case DISKIO_NREAD:
+ long_ret = (uint32_t) kio.nread;
+ return (u_char *) & long_ret;
+ case DISKIO_NWRITTEN:
+ long_ret = (uint32_t) kio.nwritten;
+ return (u_char *) & long_ret;
+ case DISKIO_NREADX:
+ *var_len = sizeof(struct counter64);
+ c64_ret.low = kio.nread & 0xffffffff;;
+ c64_ret.high = kio.nread >> 32;
+ return (u_char *) & c64_ret;
+ case DISKIO_NWRITTENX:
+ *var_len = sizeof(struct counter64);
+ c64_ret.low = kio.nwritten & 0xffffffff;;
+ c64_ret.high = kio.nwritten >> 32;
+ return (u_char *) & c64_ret;
+ case DISKIO_READS:
+ long_ret = (uint32_t) kio.reads;
+ return (u_char *) & long_ret;
+ case DISKIO_WRITES:
+ long_ret = (uint32_t) kio.writes;
+ return (u_char *) & long_ret;
+
+ default:
+ ERROR_MSG("diskio.c: don't know how to handle this request.");
+ }
+ /*
+ * if we fall to here, fail by returning NULL
+ */
+ return NULL;
+}
+#endif /* solaris2 */
+
+#if defined(bsdi3) || defined(bsdi4)
+static int ndisk;
+static struct diskstats *dk;
+static char **dkname;
+
+static int
+getstats(void)
+{
+ time_t now;
+ int mib[2];
+ char *t, *tp;
+ int size, dkn_size, i;
+
+ now = time(NULL);
+ if (cache_time + CACHE_TIMEOUT > now) {
+ return 1;
+ }
+ mib[0] = CTL_HW;
+ mib[1] = HW_DISKSTATS;
+ size = 0;
+ if (sysctl(mib, 2, NULL, &size, NULL, 0) < 0) {
+ perror("Can't get size of HW_DISKSTATS mib");
+ return 0;
+ }
+ if (ndisk != size / sizeof(*dk)) {
+ if (dk)
+ free(dk);
+ if (dkname) {
+ for (i = 0; i < ndisk; i++)
+ if (dkname[i])
+ free(dkname[i]);
+ free(dkname);
+ }
+ ndisk = size / sizeof(*dk);
+ if (ndisk == 0)
+ return 0;
+ dkname = malloc(ndisk * sizeof(char *));
+ mib[0] = CTL_HW;
+ mib[1] = HW_DISKNAMES;
+ if (sysctl(mib, 2, NULL, &dkn_size, NULL, 0) < 0) {
+ perror("Can't get size of HW_DISKNAMES mib");
+ return 0;
+ }
+ tp = t = malloc(dkn_size);
+ if (sysctl(mib, 2, t, &dkn_size, NULL, 0) < 0) {
+ perror("Can't get size of HW_DISKNAMES mib");
+ return 0;
+ }
+ for (i = 0; i < ndisk; i++) {
+ dkname[i] = strdup(tp);
+ tp += strlen(tp) + 1;
+ }
+ free(t);
+ dk = malloc(ndisk * sizeof(*dk));
+ }
+ mib[0] = CTL_HW;
+ mib[1] = HW_DISKSTATS;
+ if (sysctl(mib, 2, dk, &size, NULL, 0) < 0) {
+ perror("Can't get HW_DISKSTATS mib");
+ return 0;
+ }
+ cache_time = now;
+ return 1;
+}
+
+u_char *
+var_diskio(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+ unsigned int indx;
+
+ if (getstats() == 0)
+ return 0;
+
+ if (header_simple_table
+ (vp, name, length, exact, var_len, write_method, ndisk))
+ return NULL;
+
+ indx = (unsigned int) (name[*length - 1] - 1);
+ if (indx >= ndisk)
+ return NULL;
+
+ switch (vp->magic) {
+ case DISKIO_INDEX:
+ long_ret = (long) indx + 1;
+ return (u_char *) & long_ret;
+ case DISKIO_DEVICE:
+ *var_len = strlen(dkname[indx]);
+ return (u_char *) dkname[indx];
+ case DISKIO_NREAD:
+ long_ret =
+ (signed long) (dk[indx].dk_sectors * dk[indx].dk_secsize);
+ return (u_char *) & long_ret;
+ case DISKIO_NWRITTEN:
+ return NULL; /* Sigh... BSD doesn't keep seperate track */
+ case DISKIO_READS:
+ long_ret = (signed long) dk[indx].dk_xfers;
+ return (u_char *) & long_ret;
+ case DISKIO_WRITES:
+ return NULL; /* Sigh... BSD doesn't keep seperate track */
+
+ default:
+ ERROR_MSG("diskio.c: don't know how to handle this request.");
+ }
+ return NULL;
+}
+#endif /* bsdi */
+
+#if defined(freebsd4) || defined(freebsd5)
+
+/* disk load average patch by Rojer */
+
+struct dev_la {
+#if ( defined(freebsd5) && __FreeBSD_version >= 500107 )
+ struct bintime prev;
+#else
+ struct timeval prev;
+#endif
+ double la1,la5,la15;
+ char name[DEVSTAT_NAME_LEN+5];
+ };
+
+static struct dev_la *devloads = NULL;
+static int ndevs = 0;
+
+#if ! ( defined(freebsd5) && __FreeBSD_version >= 500107 )
+double devla_timeval_diff(struct timeval *t1, struct timeval *t2) {
+
+ double dt1 = (double) t1->tv_sec + (double) t1->tv_usec * 0.000001;
+ double dt2 = (double) t2->tv_sec + (double) t2->tv_usec * 0.000001;
+
+ return dt2-dt1;
+
+ }
+#endif
+
+void devla_getstats(unsigned int regno, void *dummy) {
+
+ static struct statinfo *lastat = NULL;
+ int i;
+ double busy_time, busy_percent;
+ static double expon1, expon5, expon15;
+ char current_name[DEVSTAT_NAME_LEN+5];
+
+ if (lastat == NULL) {
+ lastat = (struct statinfo *) malloc(sizeof(struct statinfo));
+ if (lastat != NULL)
+ lastat->dinfo = (struct devinfo *) calloc(sizeof(struct devinfo), 1);
+ if (lastat == NULL || lastat->dinfo == NULL) {
+ SNMP_FREE(lastat);
+ ERROR_MSG("Memory alloc failure - devla_getstats()\n");
+ return;
+ }
+ }
+
+ if ((GETDEVS(lastat)) == -1) {
+ ERROR_MSG("can't do getdevs()\n");
+ return;
+ }
+
+ if (ndevs != 0) {
+ for (i=0; i < ndevs; i++) {
+ snprintf(current_name, sizeof(current_name), "%s%d",
+ lastat->dinfo->devices[i].device_name, lastat->dinfo->devices[i].unit_number);
+ if (strcmp(current_name, devloads[i].name)) {
+ ndevs = 0;
+ free(devloads);
+ }
+ }
+ }
+
+ if (ndevs == 0) {
+ ndevs = lastat->dinfo->numdevs;
+ devloads = (struct dev_la *) malloc(ndevs * sizeof(struct dev_la));
+ bzero(devloads, ndevs * sizeof(struct dev_la));
+ for (i=0; i < ndevs; i++) {
+ devloads[i].la1 = devloads[i].la5 = devloads[i].la15 = 0;
+ memcpy(&devloads[i].prev, &lastat->dinfo->devices[i].busy_time, sizeof(devloads[i].prev));
+ snprintf(devloads[i].name, sizeof(devloads[i].name), "%s%d",
+ lastat->dinfo->devices[i].device_name, lastat->dinfo->devices[i].unit_number);
+ }
+ expon1 = exp(-(((double)DISKIO_SAMPLE_INTERVAL) / ((double)60)));
+ expon5 = exp(-(((double)DISKIO_SAMPLE_INTERVAL) / ((double)300)));
+ expon15 = exp(-(((double)DISKIO_SAMPLE_INTERVAL) / ((double)900)));
+ }
+
+ for (i=0; i<ndevs; i++) {
+#if defined(freebsd5) && __FreeBSD_version >= 500107
+ busy_time = devstat_compute_etime(&lastat->dinfo->devices[i].busy_time, &devloads[i].prev);
+#else
+ busy_time = devla_timeval_diff(&devloads[i].prev, &lastat->dinfo->devices[i].busy_time);
+#endif
+ if ( busy_time < 0 )
+ busy_time = 0; /* Account for possible FP loss of precision near zero */
+ busy_percent = busy_time * 100 / DISKIO_SAMPLE_INTERVAL;
+ devloads[i].la1 = devloads[i].la1 * expon1 + busy_percent * (1 - expon1);
+/* fprintf(stderr, "(%d) %s: update la1=%.2lf%%\n", i, devloads[i].name, expon1); */
+ devloads[i].la5 = devloads[i].la5 * expon5 + busy_percent * (1 - expon5);
+ devloads[i].la15 = devloads[i].la15 * expon15 + busy_percent * (1 - expon15);
+ memcpy(&devloads[i].prev, &lastat->dinfo->devices[i].busy_time, sizeof(devloads[i].prev));
+ }
+
+ }
+
+/* end of disk LA patch */
+
+static int ndisk;
+static struct statinfo *stat;
+FILE *file;
+
+static int
+getstats(void)
+{
+ time_t now;
+ int i;
+
+ now = time(NULL);
+ if (cache_time + CACHE_TIMEOUT > now) {
+ return 0;
+ }
+ if (stat == NULL) {
+ stat = (struct statinfo *) malloc(sizeof(struct statinfo));
+ if (stat != NULL)
+ stat->dinfo = (struct devinfo *) calloc(sizeof(struct devinfo), 1);
+ if (stat == NULL || stat->dinfo == NULL) {
+ SNMP_FREE(stat);
+ ERROR_MSG("Memory alloc failure - getstats\n");
+ return 1;
+ }
+ }
+
+ if (GETDEVS(stat) == -1) {
+ fprintf(stderr, "Can't get devices:%s\n", devstat_errbuf);
+ return 1;
+ }
+ ndisk = stat->dinfo->numdevs;
+ /* Gross hack to include device numbers in the device name array */
+ for (i = 0; i < ndisk; i++) {
+ char *cp = stat->dinfo->devices[i].device_name;
+ int len = strlen(cp);
+ if (len > DEVSTAT_NAME_LEN - 3)
+ len -= 3;
+ cp += len;
+ sprintf(cp, "%d", stat->dinfo->devices[i].unit_number);
+ }
+ cache_time = now;
+ return 0;
+}
+
+u_char *
+var_diskio(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+ static struct counter64 c64_ret;
+ long long longlong_ret;
+ unsigned int indx;
+
+ if (getstats() == 1) {
+ return NULL;
+ }
+
+
+ if (header_simple_table
+ (vp, name, length, exact, var_len, write_method, ndisk)) {
+ return NULL;
+ }
+
+ indx = (unsigned int) (name[*length - 1] - 1);
+
+ if (indx >= ndisk)
+ return NULL;
+
+ switch (vp->magic) {
+ case DISKIO_INDEX:
+ long_ret = (long) indx + 1;;
+ return (u_char *) & long_ret;
+ case DISKIO_DEVICE:
+ *var_len = strlen(stat->dinfo->devices[indx].device_name);
+ return (u_char *) stat->dinfo->devices[indx].device_name;
+ case DISKIO_NREAD:
+#if defined(freebsd5) && __FreeBSD_version >= 500107
+ long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_READ];
+#else
+ long_ret = (signed long) stat->dinfo->devices[indx].bytes_read;
+#endif
+ return (u_char *) & long_ret;
+ case DISKIO_NWRITTEN:
+#if defined(freebsd5) && __FreeBSD_version >= 500107
+ long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_WRITE];
+#else
+ long_ret = (signed long) stat->dinfo->devices[indx].bytes_written;
+#endif
+ return (u_char *) & long_ret;
+ case DISKIO_NREADX:
+ *var_len = sizeof(struct counter64);
+#if defined(freebsd5) && __FreeBSD_version >= 500107
+ longlong_ret = stat->dinfo->devices[indx].bytes[DEVSTAT_READ];
+#else
+ longlong_ret = stat->dinfo->devices[indx].bytes_read;
+#endif
+ c64_ret.low = longlong_ret & 0xffffffff;
+ c64_ret.high = longlong_ret >> 32;
+ return (u_char *) & c64_ret;
+ case DISKIO_NWRITTENX:
+ *var_len = sizeof(struct counter64);
+#if defined(freebsd5) && __FreeBSD_version >= 500107
+ longlong_ret = stat->dinfo->devices[indx].bytes[DEVSTAT_WRITE];
+#else
+ longlong_ret = stat->dinfo->devices[indx].bytes_written;
+#endif
+ c64_ret.low = longlong_ret & 0xffffffff;
+ c64_ret.high = longlong_ret >> 32;
+ return (u_char *) & c64_ret;
+ case DISKIO_READS:
+#if defined(freebsd5) && __FreeBSD_version >= 500107
+ long_ret = (signed long) stat->dinfo->devices[indx].operations[DEVSTAT_READ];
+#else
+ long_ret = (signed long) stat->dinfo->devices[indx].num_reads;
+#endif
+ return (u_char *) & long_ret;
+ case DISKIO_WRITES:
+#if defined(freebsd5) && __FreeBSD_version >= 500107
+ long_ret = (signed long) stat->dinfo->devices[indx].operations[DEVSTAT_WRITE];
+#else
+ long_ret = (signed long) stat->dinfo->devices[indx].num_writes;
+#endif
+ return (u_char *) & long_ret;
+ case DISKIO_LA1:
+ long_ret = devloads[indx].la1;
+ return (u_char *) & long_ret;
+ case DISKIO_LA5:
+ long_ret = devloads[indx].la5;
+ return (u_char *) & long_ret;
+ case DISKIO_LA15:
+ long_ret = devloads[indx].la15;
+ return (u_char *) & long_ret;
+
+ default:
+ ERROR_MSG("diskio.c: don't know how to handle this request.");
+ }
+ return NULL;
+}
+#endif /* freebsd4 */
+
+
+#ifdef linux
+
+#define DISK_INCR 2
+
+typedef struct linux_diskio
+{
+ int major;
+ int minor;
+ unsigned long blocks;
+ char name[256];
+ unsigned long rio;
+ unsigned long rmerge;
+ unsigned long rsect;
+ unsigned long ruse;
+ unsigned long wio;
+ unsigned long wmerge;
+ unsigned long wsect;
+ unsigned long wuse;
+ unsigned long running;
+ unsigned long use;
+ unsigned long aveq;
+} linux_diskio;
+
+typedef struct linux_diskio_header
+{
+ linux_diskio* indices;
+ int length;
+ int alloc;
+} linux_diskio_header;
+
+static linux_diskio_header head;
+
+
+int getstats(void)
+{
+ FILE* parts;
+ time_t now;
+
+ now = time(NULL);
+ if (cache_time + CACHE_TIMEOUT > now) {
+ return 0;
+ }
+
+ if (!head.indices) {
+ head.alloc = DISK_INCR;
+ head.indices = (linux_diskio *)malloc(head.alloc*sizeof(linux_diskio));
+ }
+ head.length = 0;
+
+ memset(head.indices, 0, head.alloc*sizeof(linux_diskio));
+
+ /* Is this a 2.6 kernel? */
+ parts = fopen("/proc/diskstats", "r");
+ if (parts) {
+ char buffer[1024];
+ while (fgets(buffer, sizeof(buffer), parts)) {
+ linux_diskio* pTemp;
+ if (head.length == head.alloc) {
+ head.alloc += DISK_INCR;
+ head.indices = (linux_diskio *)realloc(head.indices, head.alloc*sizeof(linux_diskio));
+ }
+ pTemp = &head.indices[head.length];
+ sscanf (buffer, "%d %d", &pTemp->major, &pTemp->minor);
+ if (sscanf (buffer, "%d %d %s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
+ &pTemp->major, &pTemp->minor, pTemp->name,
+ &pTemp->rio, &pTemp->rmerge, &pTemp->rsect, &pTemp->ruse,
+ &pTemp->wio, &pTemp->wmerge, &pTemp->wsect, &pTemp->wuse,
+ &pTemp->running, &pTemp->use, &pTemp->aveq) != 14)
+ sscanf (buffer, "%d %d %s %lu %lu %lu %lu\n",
+ &pTemp->major, &pTemp->minor, pTemp->name,
+ &pTemp->rio, &pTemp->rsect,
+ &pTemp->wio, &pTemp->wsect);
+ head.length++;
+ }
+ }
+ else {
+ /* See if a 2.4 kernel */
+ char buffer[1024];
+ int rc;
+ parts = fopen("/proc/partitions", "r");
+ if (!parts) {
+ snmp_log_perror("/proc/partitions");
+ return 1;
+ }
+
+ /*
+ * first few fscanfs are garbage we don't care about. skip it.
+ */
+ fgets(buffer, sizeof(buffer), parts);
+ fgets(buffer, sizeof(buffer), parts);
+
+ while (! feof(parts)) {
+ linux_diskio* pTemp;
+
+ if (head.length == head.alloc) {
+ head.alloc += DISK_INCR;
+ head.indices = (linux_diskio *)realloc(head.indices, head.alloc*sizeof(linux_diskio));
+ }
+ pTemp = &head.indices[head.length];
+
+ rc = fscanf (parts, "%d %d %lu %s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
+ &pTemp->major, &pTemp->minor, &pTemp->blocks, pTemp->name,
+ &pTemp->rio, &pTemp->rmerge, &pTemp->rsect, &pTemp->ruse,
+ &pTemp->wio, &pTemp->wmerge, &pTemp->wsect, &pTemp->wuse,
+ &pTemp->running, &pTemp->use, &pTemp->aveq);
+ if (rc != 15) {
+ snmp_log(LOG_ERR, "diskio.c: cannot find statistics in /proc/partitions\n");
+ return 1;
+ }
+ head.length++;
+ }
+ }
+
+ fclose(parts);
+ cache_time = now;
+ return 0;
+}
+
+u_char *
+var_diskio(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len,
+ WriteMethod ** write_method)
+{
+ unsigned int indx;
+ static unsigned long long_ret;
+ static struct counter64 c64_ret;
+
+ if (getstats() == 1) {
+ return NULL;
+ }
+
+ if (header_simple_table(vp, name, length, exact, var_len, write_method, head.length))
+ {
+ return NULL;
+ }
+
+ indx = (unsigned int) (name[*length - 1] - 1);
+
+ if (indx >= head.length)
+ return NULL;
+
+ switch (vp->magic) {
+ case DISKIO_INDEX:
+ long_ret = indx+1;
+ return (u_char *) &long_ret;
+ case DISKIO_DEVICE:
+ *var_len = strlen(head.indices[indx].name);
+ return (u_char *) head.indices[indx].name;
+ case DISKIO_NREAD:
+ long_ret = (head.indices[indx].rsect*512) & 0xffffffff;
+ return (u_char *) & long_ret;
+ case DISKIO_NWRITTEN:
+ long_ret = (head.indices[indx].wsect*512) & 0xffffffff;
+ return (u_char *) & long_ret;
+ case DISKIO_READS:
+ long_ret = head.indices[indx].rio & 0xffffffff;
+ return (u_char *) & long_ret;
+ case DISKIO_WRITES:
+ long_ret = head.indices[indx].wio & 0xffffffff;
+ return (u_char *) & long_ret;
+ case DISKIO_NREADX:
+ *var_len = sizeof(struct counter64);
+ c64_ret.low = head.indices[indx].rsect * 512 & 0xffffffff;
+ c64_ret.high = head.indices[indx].rsect >> (32 - 9);
+ return (u_char *) & c64_ret;
+ case DISKIO_NWRITTENX:
+ *var_len = sizeof(struct counter64);
+ c64_ret.low = head.indices[indx].wsect * 512 & 0xffffffff;
+ c64_ret.high = head.indices[indx].wsect >> (32 - 9);
+ return (u_char *) & c64_ret;
+ default:
+ snmp_log(LOG_ERR, "diskio.c: don't know how to handle %d request\n", vp->magic);
+ }
+ return NULL;
+}
+#endif /* linux */
+
+#if defined(darwin)
+
+#define MAXDRIVES 16 /* most drives we will record */
+#define MAXDRIVENAME 31 /* largest drive name we allow */
+
+#define kIDXBytesRead 0 /* used as index into the stats array in a drivestats struct */
+#define kIDXBytesWritten 1
+#define kIDXNumReads 2
+#define kIDXNumWrites 3
+#define kIDXLast 3
+
+struct drivestats {
+ char name[MAXDRIVENAME + 1];
+ long bsd_unit_number;
+ long stats[kIDXLast+1];
+};
+
+static struct drivestats drivestat[MAXDRIVES];
+
+static mach_port_t masterPort; /* to communicate with I/O Kit */
+
+static int num_drives; /* number of drives detected */
+
+static int
+collect_drive_stats(io_registry_entry_t driver, long *stats)
+{
+ CFNumberRef number;
+ CFDictionaryRef properties;
+ CFDictionaryRef statistics;
+ long value;
+ kern_return_t status;
+ int i;
+
+
+ /*
+ * If the drive goes away, we may not get any properties
+ * for it. So take some defaults. Nb: use memset ??
+ */
+ for (i = 0; i < kIDXLast; i++) {
+ stats[i] = 0;
+ }
+
+ /* retrieve the properties */
+ status = IORegistryEntryCreateCFProperties(driver, (CFMutableDictionaryRef *)&properties,
+ kCFAllocatorDefault, kNilOptions);
+ if (status != KERN_SUCCESS) {
+ snmp_log(LOG_ERR, "diskio: device has no properties\n");
+/* fprintf(stderr, "device has no properties\n"); */
+ return (1);
+ }
+
+ /* retrieve statistics from properties */
+ statistics = (CFDictionaryRef)CFDictionaryGetValue(properties,
+ CFSTR(kIOBlockStorageDriverStatisticsKey));
+ if (statistics) {
+
+ /* Now hand me the crystals. */
+ if ((number = (CFNumberRef)CFDictionaryGetValue(statistics,
+ CFSTR(kIOBlockStorageDriverStatisticsBytesReadKey)))) {
+ CFNumberGetValue(number, kCFNumberSInt32Type, &value);
+ stats[kIDXBytesRead] = value;
+ }
+
+ if ((number = (CFNumberRef)CFDictionaryGetValue(statistics,
+ CFSTR(kIOBlockStorageDriverStatisticsBytesWrittenKey)))) {
+ CFNumberGetValue(number, kCFNumberSInt32Type, &value);
+ stats[kIDXBytesWritten] = value;
+ }
+
+ if ((number = (CFNumberRef)CFDictionaryGetValue(statistics,
+ CFSTR(kIOBlockStorageDriverStatisticsReadsKey)))) {
+ CFNumberGetValue(number, kCFNumberSInt32Type, &value);
+ stats[kIDXNumReads] = value;
+ }
+ if ((number = (CFNumberRef)CFDictionaryGetValue(statistics,
+ CFSTR(kIOBlockStorageDriverStatisticsWritesKey)))) {
+ CFNumberGetValue(number, kCFNumberSInt32Type, &value);
+ stats[kIDXNumWrites] = value;
+ }
+ }
+ /* we're done with the properties, release them */
+ CFRelease(properties);
+ return (0);
+}
+
+/*
+ * Check whether an IORegistryEntry refers to a valid
+ * I/O device, and if so, collect the information.
+ */
+static int
+handle_drive(io_registry_entry_t drive, struct drivestats * dstat)
+{
+ io_registry_entry_t parent;
+ CFMutableDictionaryRef properties;
+ CFStringRef name;
+ CFNumberRef number;
+ kern_return_t status;
+
+ /* get drive's parent */
+ status = IORegistryEntryGetParentEntry(drive, kIOServicePlane, &parent);
+ if (status != KERN_SUCCESS) {
+ snmp_log(LOG_ERR, "diskio: device has no parent\n");
+/* fprintf(stderr, "device has no parent\n"); */
+ return(1);
+ }
+
+ if (IOObjectConformsTo(parent, "IOBlockStorageDriver")) {
+
+ /* get drive properties */
+ status = IORegistryEntryCreateCFProperties(drive, &properties,
+ kCFAllocatorDefault, kNilOptions);
+ if (status != KERN_SUCCESS) {
+ snmp_log(LOG_ERR, "diskio: device has no properties\n");
+/* fprintf(stderr, "device has no properties\n"); */
+ return(1);
+ }
+
+ /* get BSD name and unitnumber from properties */
+ name = (CFStringRef)CFDictionaryGetValue(properties,
+ CFSTR(kIOBSDNameKey));
+ number = (CFNumberRef)CFDictionaryGetValue(properties,
+ CFSTR(kIOBSDUnitKey));
+
+ /* Collect stats and if succesful store them with the name and unitnumber */
+ if (name && number && !collect_drive_stats(parent, dstat->stats)) {
+
+ CFStringGetCString(name, dstat->name, MAXDRIVENAME, CFStringGetSystemEncoding());
+ CFNumberGetValue(number, kCFNumberSInt32Type, &dstat->bsd_unit_number);
+ num_drives++;
+ }
+
+ /* clean up, return success */
+ CFRelease(properties);
+ return(0);
+ }
+
+ /* failed, don't keep parent */
+ IOObjectRelease(parent);
+ return(1);
+}
+
+static int
+getstats(void)
+{
+ time_t now;
+ io_iterator_t drivelist;
+ io_registry_entry_t drive;
+ CFMutableDictionaryRef match;
+ kern_return_t status;
+
+ now = time(NULL); /* register current time and check wether cache can be used */
+ if (cache_time + CACHE_TIMEOUT > now) {
+ return 0;
+ }
+
+ /* Retrieve a list of drives. */
+ match = IOServiceMatching("IOMedia");
+ CFDictionaryAddValue(match, CFSTR(kIOMediaWholeKey), kCFBooleanTrue);
+ status = IOServiceGetMatchingServices(masterPort, match, &drivelist);
+ if (status != KERN_SUCCESS) {
+ snmp_log(LOG_ERR, "diskio: couldn't match whole IOMedia devices\n");
+/* fprintf(stderr,"Couldn't match whole IOMedia devices\n"); */
+ return(1);
+ }
+
+ num_drives = 0; /* NB: Incremented by handle_drive */
+ while ((drive = IOIteratorNext(drivelist)) && (num_drives < MAXDRIVES)) {
+ handle_drive(drive, &drivestat[num_drives]);
+ IOObjectRelease(drive);
+ }
+ IOObjectRelease(drivelist);
+
+ cache_time = now;
+ return (0);
+}
+
+u_char *
+var_diskio(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+ unsigned int indx;
+
+ if (getstats() == 1) {
+ return NULL;
+ }
+
+
+ if (header_simple_table
+ (vp, name, length, exact, var_len, write_method, num_drives)) {
+ return NULL;
+ }
+
+ indx = (unsigned int) (name[*length - 1] - 1);
+
+ if (indx >= num_drives)
+ return NULL;
+
+ switch (vp->magic) {
+ case DISKIO_INDEX:
+ long_ret = (long) drivestat[indx].bsd_unit_number;
+ return (u_char *) & long_ret;
+ case DISKIO_DEVICE:
+ *var_len = strlen(drivestat[indx].name);
+ return (u_char *) drivestat[indx].name;
+ case DISKIO_NREAD:
+ long_ret = (signed long) drivestat[indx].stats[kIDXBytesRead];
+ return (u_char *) & long_ret;
+ case DISKIO_NWRITTEN:
+ long_ret = (signed long) drivestat[indx].stats[kIDXBytesWritten];
+ return (u_char *) & long_ret;
+ case DISKIO_READS:
+ long_ret = (signed long) drivestat[indx].stats[kIDXNumReads];
+ return (u_char *) & long_ret;
+ case DISKIO_WRITES:
+ long_ret = (signed long) drivestat[indx].stats[kIDXNumWrites];
+ return (u_char *) & long_ret;
+
+ default:
+ ERROR_MSG("diskio.c: don't know how to handle this request.");
+ }
+ return NULL;
+}
+#endif /* darwin */
+
+
+#if defined(aix4) || defined(aix5) || defined(aix6)
+/*
+ * collect statistics for all disks
+ */
+int
+collect_disks(void)
+{
+ time_t now;
+ int i;
+ perfstat_id_t first;
+
+ /* cache valid? if yes, just return */
+ now = time(NULL);
+ if (ps_disk != NULL && cache_time + CACHE_TIMEOUT > now) {
+ return 0;
+ }
+
+ /* get number of disks we have */
+ i = perfstat_disk(NULL, NULL, sizeof(perfstat_disk_t), 0);
+ if(i <= 0) return 1;
+
+ /* if number of disks differs or structures are uninitialized, init them */
+ if(i != ps_numdisks || ps_disk == NULL) {
+ if(ps_disk != NULL) free(ps_disk);
+ ps_numdisks = i;
+ ps_disk = malloc(sizeof(perfstat_disk_t) * ps_numdisks);
+ if(ps_disk == NULL) return 1;
+ }
+
+ /* gather statistics about all disks we have */
+ strcpy(first.name, "");
+ i = perfstat_disk(&first, ps_disk, sizeof(perfstat_disk_t), ps_numdisks);
+ if(i != ps_numdisks) return 1;
+
+ cache_time = now;
+ return 0;
+}
+
+
+u_char *
+var_diskio(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+ static struct counter64 c64_ret;
+ unsigned int indx;
+
+ /* get disk statistics */
+ if (collect_disks())
+ return NULL;
+
+ if (header_simple_table
+ (vp, name, length, exact, var_len, write_method, ps_numdisks))
+ return NULL;
+
+ indx = (unsigned int) (name[*length - 1] - 1);
+ if (indx >= ps_numdisks)
+ return NULL;
+
+ /* deliver requested data on requested disk */
+ switch (vp->magic) {
+ case DISKIO_INDEX:
+ long_ret = (long) indx;
+ return (u_char *) & long_ret;
+ case DISKIO_DEVICE:
+ *var_len = strlen(ps_disk[indx].name);
+ return (u_char *) ps_disk[indx].name;
+ case DISKIO_NREAD:
+ long_ret = (signed long) ps_disk[indx].rblks * ps_disk[indx].bsize;
+ return (u_char *) & long_ret;
+ case DISKIO_NWRITTEN:
+ long_ret = (signed long) ps_disk[indx].wblks * ps_disk[indx].bsize;
+ return (u_char *) & long_ret;
+ case DISKIO_READS:
+ long_ret = (signed long) ps_disk[indx].xfers;
+ return (u_char *) & long_ret;
+ case DISKIO_WRITES:
+ long_ret = (signed long) 0; /* AIX has just one value for read/write transfers */
+ return (u_char *) & long_ret;
+ case DISKIO_NREADX:
+ *var_len = sizeof(struct counter64);
+ c64_ret.low = (ps_disk[indx].rblks * ps_disk[indx].bsize) & 0xffffffff;;
+ c64_ret.high = (ps_disk[indx].rblks * ps_disk[indx].bsize) >> 32;
+ return (u_char *) & c64_ret;
+ case DISKIO_NWRITTENX:
+ *var_len = sizeof(struct counter64);
+ c64_ret.low = (ps_disk[indx].wblks * ps_disk[indx].bsize) & 0xffffffff;;
+ c64_ret.high = (ps_disk[indx].wblks * ps_disk[indx].bsize) >> 32;
+ return (u_char *) & c64_ret;
+
+ default:
+ ERROR_MSG("diskio.c: don't know how to handle this request.");
+ }
+
+ /* return NULL in case of error */
+ return NULL;
+}
+#endif /* aix 4/5 */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/diskio.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/diskio.h
new file mode 100644
index 0000000000..05596abddd
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/diskio.h
@@ -0,0 +1,38 @@
+#ifndef _MIBGROUP_DISKIO_H
+#define _MIBGROUP_DISKIO_H
+
+config_require(util_funcs)
+config_add_mib(UCD-DISKIO-MIB)
+
+ /*
+ * Define all our functions using prototyping for ANSI compilers
+ */
+ /*
+ * These functions are then defined in the example.c file
+ */
+ void init_diskio(void);
+ FindVarMethod var_diskio;
+
+
+/*
+ * Magic number definitions. These numbers are the last oid index
+ * numbers to the table that you are going to define. For example,
+ * lets say (since we are) creating a mib table at the location
+ * .1.3.6.1.4.1.2021.254. The following magic numbers would be the
+ * next numbers on that oid for the var_example function to use, ie:
+ * .1.3.6.1.4.1.2021.254.1 (and .2 and .3 ...)
+ */
+
+#define DISKIO_INDEX 1
+#define DISKIO_DEVICE 2
+#define DISKIO_NREAD 3
+#define DISKIO_NWRITTEN 4
+#define DISKIO_READS 5
+#define DISKIO_WRITES 6
+#define DISKIO_LA1 9
+#define DISKIO_LA5 10
+#define DISKIO_LA15 11
+#define DISKIO_NREADX 12
+#define DISKIO_NWRITTENX 13
+
+#endif /* _MIBGROUP_DISKIO_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/dlmod.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/dlmod.c
new file mode 100644
index 0000000000..81b583097c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/dlmod.c
@@ -0,0 +1,592 @@
+/*
+ * Dynamic Loadable Agent Modules MIB (UCD-DLMOD-MIB) - dlmod.c
+ *
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <ctype.h>
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "util_funcs.h"
+
+#if defined(HAVE_DLFCN_H) && ( defined(HAVE_DLOPEN) || defined(HAVE_LIBDL) )
+
+#include <dlfcn.h>
+#include "dlmod.h"
+
+static struct dlmod *dlmods = NULL;
+static int dlmod_next_index = 1;
+static char dlmod_path[1024];
+
+static void dlmod_parse_config(const char *, char *);
+static void dlmod_free_config(void);
+
+/*
+ * this variable defines function callbacks and type return
+ * information for the dlmod mib
+ */
+static struct variable4 dlmod_variables[] = {
+ {DLMODNEXTINDEX, ASN_INTEGER, RONLY, var_dlmod, 1, {1}},
+ {DLMODNAME, ASN_OCTET_STR, RWRITE, var_dlmodEntry, 3, {2, 1, 2}},
+ {DLMODPATH, ASN_OCTET_STR, RWRITE, var_dlmodEntry, 3, {2, 1, 3}},
+ {DLMODERROR, ASN_OCTET_STR, RONLY, var_dlmodEntry, 3, {2, 1, 4}},
+ {DLMODSTATUS, ASN_INTEGER, RWRITE, var_dlmodEntry, 3, {2, 1, 5}},
+};
+
+static oid dlmod_variables_oid[] = { 1, 3, 6, 1, 4, 1, 2021, 13, 14 };
+static int dlmod_variables_oid_len = 9;
+
+void
+init_dlmod(void)
+{
+ char *p;
+ int len;
+
+ REGISTER_MIB("dlmod", dlmod_variables, variable4, dlmod_variables_oid);
+
+ /*
+ * TODO: REGISTER_SYSOR_ENTRY
+ */
+
+ DEBUGMSGTL(("dlmod", "register mib\n"));
+
+ snmpd_register_config_handler("dlmod", dlmod_parse_config,
+ dlmod_free_config,
+ "module-name module-path");
+
+ p = getenv("SNMPDLMODPATH");
+ strncpy(dlmod_path, SNMPDLMODPATH, sizeof(dlmod_path));
+ dlmod_path[ sizeof(dlmod_path)-1 ] = 0;
+ if (p) {
+ if (p[0] == ':') {
+ len = strlen(dlmod_path);
+ if (dlmod_path[len - 1] != ':') {
+ strncat(dlmod_path, ":", sizeof(dlmod_path) - len -1);
+ len++;
+ }
+ strncat(dlmod_path, p + 1, sizeof(dlmod_path) - len);
+ } else
+ strncpy(dlmod_path, p, sizeof(dlmod_path));
+ }
+ dlmod_path[ sizeof(dlmod_path)-1 ] = 0;
+ DEBUGMSGTL(("dlmod", "dlmod_path: %s\n", dlmod_path));
+}
+
+void
+deinit_dlmod(void)
+{
+ unregister_mib(dlmod_variables_oid, dlmod_variables_oid_len);
+ snmpd_unregister_config_handler("dlmod");
+}
+
+struct dlmod *
+dlmod_create_module(void)
+{
+ struct dlmod **pdlmod, *dlm;
+
+ DEBUGMSGTL(("dlmod", "dlmod_create_module\n"));
+ dlm = (struct dlmod *) calloc(1, sizeof(struct dlmod));
+ if (dlm == NULL)
+ return NULL;
+
+ dlm->index = dlmod_next_index++;
+ dlm->status = DLMOD_UNLOADED;
+
+ for (pdlmod = &dlmods; *pdlmod != NULL; pdlmod = &((*pdlmod)->next));
+ (*pdlmod) = dlm;
+
+ return dlm;
+}
+
+void
+dlmod_delete_module(struct dlmod *dlm)
+{
+ struct dlmod **pdlmod;
+
+ DEBUGMSGTL(("dlmod", "dlmod_delete_module\n"));
+ if (!dlm || dlm->status != DLMOD_UNLOADED)
+ return;
+
+ for (pdlmod = &dlmods; *pdlmod; pdlmod = &((*pdlmod)->next))
+ if (*pdlmod == dlm) {
+ *pdlmod = dlm->next;
+ free(dlm);
+ return;
+ }
+}
+
+void
+dlmod_load_module(struct dlmod *dlm)
+{
+ char sym_init[64];
+ char *p, tmp_path[255];
+ int (*dl_init) (void);
+ char *st;
+
+ DEBUGMSGTL(("dlmod", "dlmod_load_module %s: %s\n", dlm->name,
+ dlm->path));
+
+ if (!dlm || !dlm->path || !dlm->name ||
+ (dlm->status != DLMOD_UNLOADED && dlm->status != DLMOD_ERROR))
+ return;
+
+ if (dlm->path[0] == '/') {
+#ifdef RTLD_NOW
+ dlm->handle = dlopen(dlm->path, RTLD_NOW);
+#else
+ dlm->handle = dlopen(dlm->path, RTLD_LAZY);
+#endif
+ if (dlm->handle == NULL) {
+ snprintf(dlm->error, sizeof(dlm->error),
+ "dlopen failed: %s", dlerror());
+ dlm->status = DLMOD_ERROR;
+ return;
+ }
+ } else {
+ for (p = strtok_r(dlmod_path, ":", &st); p; p = strtok_r(NULL, ":", &st)) {
+ snprintf(tmp_path, sizeof(tmp_path), "%s/%s.so", p, dlm->path);
+ DEBUGMSGTL(("dlmod", "p: %s tmp_path: %s\n", p, tmp_path));
+#ifdef RTLD_NOW
+ dlm->handle = dlopen(tmp_path, RTLD_NOW);
+#else
+ dlm->handle = dlopen(tmp_path, RTLD_LAZY);
+#endif
+ if (dlm->handle == NULL) {
+ snprintf(dlm->error, sizeof(dlm->error),
+ "dlopen failed: %s", dlerror());
+ dlm->status = DLMOD_ERROR;
+ }
+ }
+ strncpy(dlm->path, tmp_path, sizeof(dlm->path));
+ if (dlm->status == DLMOD_ERROR)
+ return;
+ }
+ snprintf(sym_init, sizeof(sym_init), "init_%s", dlm->name);
+ dl_init = dlsym(dlm->handle, sym_init);
+ if (dl_init == NULL) {
+ dlclose(dlm->handle);
+ snprintf(dlm->error, sizeof(dlm->error),
+ "dlsym failed: can't find \'%s\'", sym_init);
+ dlm->status = DLMOD_ERROR;
+ return;
+ }
+
+ dl_init();
+ dlm->error[0] = '\0';
+ dlm->status = DLMOD_LOADED;
+}
+
+void
+dlmod_unload_module(struct dlmod *dlm)
+{
+ char sym_deinit[64];
+ int (*dl_deinit) (void);
+
+ if (!dlm || dlm->status != DLMOD_LOADED)
+ return;
+
+ snprintf(sym_deinit, sizeof(sym_deinit), "deinit_%s", dlm->name);
+ dl_deinit = dlsym(dlm->handle, sym_deinit);
+ if (dl_deinit == NULL) {
+ snprintf(dlm->error, sizeof(dlm->error),
+ "dlsym failed: can't find \'%s\'", sym_deinit);
+ } else {
+ dl_deinit();
+ }
+ dlclose(dlm->handle);
+ dlm->status = DLMOD_UNLOADED;
+ DEBUGMSGTL(("dlmod", "Module %s unloaded\n", dlm->name));
+}
+
+struct dlmod *
+dlmod_get_by_index(int iindex)
+{
+ struct dlmod *dlmod;
+
+ for (dlmod = dlmods; dlmod; dlmod = dlmod->next)
+ if (dlmod->index == iindex)
+ return dlmod;
+
+ return NULL;
+}
+
+static void
+dlmod_parse_config(const char *token, char *cptr)
+{
+ char *dlm_name, *dlm_path;
+ struct dlmod *dlm;
+ char *st;
+
+ if (cptr == NULL) {
+ config_perror("Bad dlmod line");
+ return;
+ }
+ /*
+ * remove comments
+ */
+ *(cptr + strcspn(cptr, "#;\r\n")) = '\0';
+
+ dlm = dlmod_create_module();
+ if (!dlm)
+ return;
+
+ /*
+ * dynamic module name
+ */
+ dlm_name = strtok_r(cptr, "\t ", &st);
+ if (dlm_name == NULL) {
+ config_perror("Bad dlmod line");
+ dlmod_delete_module(dlm);
+ return;
+ }
+ strncpy(dlm->name, dlm_name, sizeof(dlm->name));
+
+ /*
+ * dynamic module path
+ */
+ dlm_path = strtok_r(NULL, "\t ", &st);
+ if (dlm_path)
+ strncpy(dlm->path, dlm_path, sizeof(dlm->path));
+ else
+ strncpy(dlm->path, dlm_name, sizeof(dlm->path));
+
+ dlmod_load_module(dlm);
+
+ if (dlm->status == DLMOD_ERROR)
+ snmp_log(LOG_ERR, "%s\n", dlm->error);
+}
+
+static void
+dlmod_free_config(void)
+{
+ struct dlmod *dtmp, *dtmp2;
+
+ for (dtmp = dlmods; dtmp != NULL;) {
+ dtmp2 = dtmp;
+ dtmp = dtmp->next;
+ dlmod_unload_module(dtmp2);
+ free(dtmp2);
+ }
+ dlmods = NULL;
+}
+
+
+/*
+ * header_dlmod(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ */
+
+static int
+header_dlmod(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define DLMOD_NAME_LENGTH 10
+ oid newname[MAX_OID_LEN];
+ int result;
+
+ memcpy((char *) newname, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+ newname[DLMOD_NAME_LENGTH] = 0;
+
+ result =
+ snmp_oid_compare(name, *length, newname, (int) vp->namelen + 1);
+ if ((exact && (result != 0)) || (!exact && (result >= 0))) {
+ return MATCH_FAILED;
+ }
+
+ memcpy((char *) name, (char *) newname,
+ ((int) vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+ return MATCH_SUCCEEDED;
+}
+
+
+u_char *
+var_dlmod(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+
+ /*
+ * variables we may use later
+ */
+
+ *write_method = 0; /* assume it isnt writable for the time being */
+ *var_len = sizeof(int); /* assume an integer and change later
+ * if not */
+
+ if (header_dlmod(vp, name, length, exact,
+ var_len, write_method) == MATCH_FAILED)
+ return 0;
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+ case DLMODNEXTINDEX:
+ long_return = dlmod_next_index;
+ return (unsigned char *) &long_return;
+ default:
+ DEBUGMSGTL(("dlmod", "unknown sub-id %d in var_dlmod\n",
+ vp->magic));
+ }
+ return 0;
+}
+
+
+/*
+ * header_dlmodEntry(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+
+
+static struct dlmod *
+header_dlmodEntry(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+#define DLMODENTRY_NAME_LENGTH 12
+ oid newname[MAX_OID_LEN];
+ int result;
+ struct dlmod *dlm = 0;
+ int dlmod_index;
+
+ memcpy((char *) newname, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+ *write_method = 0;
+
+ for (dlmod_index = 1; dlmod_index < dlmod_next_index; dlmod_index++) {
+ dlm = dlmod_get_by_index(dlmod_index);
+
+ DEBUGMSGTL(("dlmod", "dlmodEntry dlm: %p dlmod_index: %d\n",
+ dlm, dlmod_index));
+
+ if (dlm) {
+ newname[12] = dlmod_index;
+ result = snmp_oid_compare(name, *length, newname,
+ (int) vp->namelen + 1);
+
+ if ((exact && (result == 0)) || (!exact && (result < 0)))
+ break;
+ }
+ }
+
+ if (dlmod_index >= dlmod_next_index) {
+ if (dlmod_index == dlmod_next_index &&
+ exact && vp->magic == DLMODSTATUS)
+
+ *write_method = write_dlmodStatus;
+ return NULL;
+ }
+
+ memcpy((char *) name, (char *) newname,
+ ((int) vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+ *var_len = sizeof(long);
+ return dlm;
+}
+
+u_char *
+var_dlmodEntry(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * variables we may use later
+ */
+ struct dlmod *dlm;
+
+ *var_len = sizeof(int); /* assume an integer and change later
+ * if not */
+
+ dlm =
+ header_dlmodEntry(vp, name, length, exact, var_len, write_method);
+ if (dlm == NULL)
+ return 0;
+
+ /*
+ * this is where we do the value assignments for the mib results.
+ */
+ switch (vp->magic) {
+ case DLMODNAME:
+ *write_method = write_dlmodName;
+ *var_len = strlen(dlm->name);
+ return (unsigned char *) dlm->name;
+ case DLMODPATH:
+ *write_method = write_dlmodPath;
+ *var_len = strlen(dlm->path);
+ return (unsigned char *) dlm->path;
+ case DLMODERROR:
+ *var_len = strlen(dlm->error);
+ return (unsigned char *) dlm->error;
+ case DLMODSTATUS:
+ *write_method = write_dlmodStatus;
+ long_return = dlm->status;
+ return (unsigned char *) &long_return;
+ default:
+ DEBUGMSGTL(("dlmod", "unknown sub-id %d in var_dlmodEntry\n",
+ vp->magic));
+ }
+ return 0;
+}
+
+int
+write_dlmodName(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static struct dlmod *dlm;
+
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR, "write to dlmodName not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(dlm->name)-1) {
+ snmp_log(LOG_ERR, "write to dlmodName: bad length: too long\n");
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (action == COMMIT) {
+ dlm = dlmod_get_by_index(name[12]);
+ if (!dlm || dlm->status == DLMOD_LOADED)
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ strncpy(dlm->name, (const char *) var_val, var_val_len);
+ dlm->name[var_val_len] = 0;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_dlmodPath(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ static struct dlmod *dlm;
+
+ if (var_val_type != ASN_OCTET_STR) {
+ snmp_log(LOG_ERR, "write to dlmodPath not ASN_OCTET_STR\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(dlm->path)-1) {
+ snmp_log(LOG_ERR, "write to dlmodPath: bad length: too long\n");
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (action == COMMIT) {
+ dlm = dlmod_get_by_index(name[12]);
+ if (!dlm || dlm->status == DLMOD_LOADED)
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ strncpy(dlm->path, (const char *) var_val, var_val_len);
+ dlm->path[var_val_len] = 0;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+write_dlmodStatus(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ /*
+ * variables we may use later
+ */
+ struct dlmod *dlm;
+
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR, "write to dlmodStatus not ASN_INTEGER\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ if (var_val_len > sizeof(long)) {
+ snmp_log(LOG_ERR, "write to dlmodStatus: bad length\n");
+ return SNMP_ERR_WRONGLENGTH;
+ }
+ if (action == COMMIT) {
+ /*
+ * object identifier in form .1.3.6.1.4.1.2021.13.14.2.1.4.x
+ * where X is index with offset 12
+ */
+
+ dlm = dlmod_get_by_index(name[12]);
+ switch (*((long *) var_val)) {
+ case DLMOD_CREATE:
+ if (dlm || (name[12] != dlmod_next_index))
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ dlm = dlmod_create_module();
+ if (!dlm)
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ break;
+ case DLMOD_LOAD:
+ if (!dlm || dlm->status == DLMOD_LOADED)
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ dlmod_load_module(dlm);
+ break;
+ case DLMOD_UNLOAD:
+ if (!dlm || dlm->status != DLMOD_LOADED)
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ dlmod_unload_module(dlm);
+ break;
+ case DLMOD_DELETE:
+ if (!dlm || dlm->status == DLMOD_LOADED)
+ return SNMP_ERR_RESOURCEUNAVAILABLE;
+ dlmod_delete_module(dlm);
+ break;
+ default:
+ return SNMP_ERR_WRONGVALUE;
+ }
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+#else /* no dlopen support */
+
+void
+init_dlmod(void)
+{
+ DEBUGMSGTL(("dlmod",
+ "Dynamic modules not support on this platform\n"));
+}
+
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/dlmod.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/dlmod.h
new file mode 100644
index 0000000000..690bc45974
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/dlmod.h
@@ -0,0 +1,60 @@
+/*
+ * Dynamic Loadable Agent Modules MIB (UCD-DLMOD-MIB) - dlmod.h
+ *
+ */
+
+#ifndef _MIBGROUP_DLMOD_H
+#define _MIBGROUP_DLMOD_H
+
+/*
+ * TODO #include "mibdefs.h"
+ */
+
+config_add_mib(UCD-DLMOD-MIB)
+#ifndef SNMPDLMODPATH
+#define SNMPDLMODPATH "/usr/local/lib/snmp/dlmod"
+#endif
+ struct dlmod {
+ struct dlmod *next;
+ int index;
+ char name[64 + 1];
+ char path[255 + 1];
+ char error[255 + 1];
+ void *handle;
+ int status;
+ };
+
+ void dlmod_load_module(struct dlmod *);
+ void dlmod_unload_module(struct dlmod *);
+ struct dlmod *dlmod_create_module(void);
+ void dlmod_delete_module(struct dlmod *);
+ struct dlmod *dlmod_get_by_index(int);
+
+ void dlmod_init(void);
+ void dlmod_deinit(void);
+
+ extern void init_dlmod(void);
+ extern void deinit_dlmod(void);
+
+ extern FindVarMethod var_dlmod;
+ extern FindVarMethod var_dlmodEntry;
+ extern WriteMethod write_dlmodName;
+ extern WriteMethod write_dlmodPath;
+ extern WriteMethod write_dlmodStatus;
+
+#define DLMODNEXTINDEX 1
+#define DLMODINDEX 2
+#define DLMODNAME 3
+#define DLMODPATH 4
+#define DLMODERROR 5
+#define DLMODSTATUS 6
+
+#define DLMOD_LOADED 1
+#define DLMOD_UNLOADED 2
+#define DLMOD_ERROR 3
+#define DLMOD_LOAD 4
+#define DLMOD_UNLOAD 5
+#define DLMOD_CREATE 6
+#define DLMOD_DELETE 7
+
+#endif /* _MIBGROUP_DLMOD_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/errormib.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/errormib.c
new file mode 100644
index 0000000000..4a43c318a2
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/errormib.c
@@ -0,0 +1,235 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include <signal.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#if !(defined(bsdi2) || defined(netbsd1))
+#include <sys/vmmeter.h>
+#endif
+#endif
+#if HAVE_SYS_CONF_H
+#include <sys/conf.h>
+#endif
+#if HAVE_ASM_PAGE_H
+#include <asm/page.h>
+#endif
+#if HAVE_SYS_SWAP_H
+#include <sys/swap.h>
+#endif
+#if HAVE_SYS_FS_H
+#include <sys/fs.h>
+#else
+#if HAVE_UFS_FS_H
+#include <ufs/fs.h>
+#else
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_VNODE_H
+#include <sys/vnode.h>
+#endif
+#ifdef HAVE_UFS_UFS_QUOTA_H
+#include <ufs/ufs/quota.h>
+#endif
+#ifdef HAVE_UFS_UFS_INODE_H
+#include <ufs/ufs/inode.h>
+#endif
+#if HAVE_UFS_FFS_FS_H
+#include <ufs/ffs/fs.h>
+#endif
+#endif
+#endif
+#if HAVE_MTAB_H
+#include <mtab.h>
+#endif
+#include <errno.h>
+#if HAVE_FSTAB_H
+#include <fstab.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#if (!defined(HAVE_STATVFS)) && defined(HAVE_STATFS)
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#define statvfs statfs
+#endif
+#if HAVE_VM_VM_H
+#include <vm/vm.h>
+#endif
+#if HAVE_VM_SWAP_PAGER_H
+#include <vm/swap_pager.h>
+#endif
+#if HAVE_SYS_FIXPOINT_H
+#include <sys/fixpoint.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "struct.h"
+#include "errormib.h"
+#include "util_funcs.h"
+
+static time_t errorstatustime = 0;
+static int errorstatusprior = 0;
+static char errorstring[STRMAX];
+
+void
+setPerrorstatus(const char *to)
+{
+ char buf[STRMAX];
+
+ snprintf(buf, sizeof(buf), "%s: %s", to, strerror(errno));
+ buf[ sizeof(buf)-1 ] = 0;
+ snmp_log_perror(to);
+ seterrorstatus(buf, 5);
+}
+
+void
+seterrorstatus(const char *to, int prior)
+{
+ if (errorstatusprior <= prior ||
+ (NETSNMP_ERRORTIMELENGTH < (time(NULL) - errorstatustime))) {
+ strncpy(errorstring, to, sizeof(errorstring));
+ errorstring[ sizeof(errorstring)-1 ] = 0;
+ errorstatusprior = prior;
+ errorstatustime = time(NULL);
+ }
+}
+
+void
+init_errormib(void)
+{
+
+ /*
+ * define the structure we're going to ask the agent to register our
+ * information at
+ */
+ struct variable2 extensible_error_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_errors, 1,
+ {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_errors, 1,
+ {ERRORNAME}},
+ {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_errors, 1,
+ {ERRORFLAG}},
+ {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_errors, 1,
+ {ERRORMSG}}
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid extensible_error_variables_oid[] =
+ { NETSNMP_UCDAVIS_MIB, NETSNMP_ERRORMIBNUM };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/errormib", extensible_error_variables,
+ variable2, extensible_error_variables_oid);
+}
+
+/*
+ * var_extensible_errors(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+u_char *
+var_extensible_errors(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+ static long long_ret;
+ static char errmsg[300];
+
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return (NULL);
+
+ errmsg[0] = 0;
+
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = name[*length - 1];
+ return ((u_char *) (&long_ret));
+ case ERRORNAME:
+ strcpy(errmsg, "snmp");
+ *var_len = strlen(errmsg);
+ return ((u_char *) errmsg);
+ case ERRORFLAG:
+ long_ret =
+ (NETSNMP_ERRORTIMELENGTH >= time(NULL) - errorstatustime) ? 1 : 0;
+ return ((u_char *) (&long_ret));
+ case ERRORMSG:
+ if ((NETSNMP_ERRORTIMELENGTH >= time(NULL) - errorstatustime) ? 1 : 0) {
+ strncpy(errmsg, errorstring, sizeof(errmsg));
+ errmsg[ sizeof(errmsg)-1 ] = 0;
+ } else
+ errmsg[0] = 0;
+ *var_len = strlen(errmsg);
+ return ((u_char *) errmsg);
+ }
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/errormib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/errormib.h
new file mode 100644
index 0000000000..5dcb2cc6bd
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/errormib.h
@@ -0,0 +1,17 @@
+/*
+ * Errormibess watching mib group
+ */
+#ifndef _MIBGROUP_ERRORMIB_H
+#define _MIBGROUP_ERRORMIB_H
+
+void init_errormib(void);
+
+config_require(util_funcs)
+
+ void setPerrorstatus(const char *);
+ void seterrorstatus(const char *, int);
+ extern FindVarMethod var_extensible_errors;
+
+#include "mibdefs.h"
+
+#endif /* _MIBGROUP_ERRORMIB_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/extensible.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/extensible.c
new file mode 100644
index 0000000000..42c7042e72
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/extensible.c
@@ -0,0 +1,694 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#include <signal.h>
+#if HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#if !(defined(bsdi2) || defined(netbsd1))
+#include <sys/vmmeter.h>
+#endif
+#endif
+#if HAVE_SYS_CONF_H
+#include <sys/conf.h>
+#endif
+#if HAVE_ASM_PAGE_H
+#include <asm/page.h>
+#endif
+#if HAVE_SYS_SWAP_H
+#include <sys/swap.h>
+#endif
+#if HAVE_SYS_FS_H
+#include <sys/fs.h>
+#else
+#if HAVE_UFS_FS_H
+#include <ufs/fs.h>
+#else
+#if HAVE_UFS_UFS_DINODE_H
+#include <ufs/ufs/dinode.h>
+#endif
+#if HAVE_UFS_FFS_FS_H
+#include <ufs/ffs/fs.h>
+#endif
+#endif
+#endif
+#if HAVE_MTAB_H
+#include <mtab.h>
+#endif
+#include <sys/stat.h>
+#include <errno.h>
+#if HAVE_FSTAB_H
+#include <fstab.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#if (!defined(HAVE_STATVFS)) && defined(HAVE_STATFS)
+#if HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#define statvfs statfs
+#endif
+#if HAVE_VM_VM_H
+#include <vm/vm.h>
+#endif
+#if HAVE_VM_SWAP_PAGER_H
+#include <vm/swap_pager.h>
+#endif
+#if HAVE_SYS_FIXPOINT_H
+#include <sys/fixpoint.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#include <ctype.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#ifndef HAVE_STRNCASECMP
+int strncasecmp(const char *s1, const char *s2, size_t n);
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+#include <net-snmp/agent/agent_callbacks.h>
+
+#include "struct.h"
+#include "extensible.h"
+#include "utilities/execute.h"
+#include "util_funcs.h"
+
+extern struct myproc *procwatch; /* moved to proc.c */
+extern int numprocs; /* ditto */
+extern struct extensible *extens; /* In exec.c */
+extern struct extensible *relocs; /* In exec.c */
+extern int numextens; /* ditto */
+extern int numrelocs; /* ditto */
+extern struct extensible *passthrus; /* In pass.c */
+extern int numpassthrus; /* ditto */
+extern netsnmp_subtree *subtrees;
+extern struct variable2 extensible_relocatable_variables[];
+extern struct variable2 extensible_passthru_variables[];
+
+/*
+ * the relocatable extensible commands variables
+ */
+struct variable2 extensible_relocatable_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_relocatable, 1,
+ {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_relocatable, 1,
+ {ERRORNAME}},
+ {SHELLCOMMAND, ASN_OCTET_STR, RONLY, var_extensible_relocatable, 1,
+ {SHELLCOMMAND}},
+ {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_relocatable, 1,
+ {ERRORFLAG}},
+ {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_relocatable, 1,
+ {ERRORMSG}},
+ {ERRORFIX, ASN_INTEGER, RWRITE, var_extensible_relocatable, 1,
+ {ERRORFIX}},
+ {ERRORFIXCMD, ASN_OCTET_STR, RONLY, var_extensible_relocatable, 1,
+ {ERRORFIXCMD}}
+};
+
+
+void
+init_extensible(void)
+{
+
+ struct variable2 extensible_extensible_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_shell, 1,
+ {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_shell, 1,
+ {ERRORNAME}},
+ {SHELLCOMMAND, ASN_OCTET_STR, RONLY, var_extensible_shell, 1,
+ {SHELLCOMMAND}},
+ {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_shell, 1,
+ {ERRORFLAG}},
+ {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_shell, 1,
+ {ERRORMSG}},
+ {ERRORFIX, ASN_INTEGER, RWRITE, var_extensible_shell, 1,
+ {ERRORFIX}},
+ {ERRORFIXCMD, ASN_OCTET_STR, RONLY, var_extensible_shell, 1,
+ {ERRORFIXCMD}}
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid extensible_variables_oid[] =
+ { NETSNMP_UCDAVIS_MIB, NETSNMP_SHELLMIBNUM, 1 };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/extensible", extensible_extensible_variables,
+ variable2, extensible_variables_oid);
+
+ snmpd_register_config_handler("exec", extensible_parse_config,
+ extensible_free_config,
+ "[miboid] name program arguments");
+ snmpd_register_config_handler("sh", extensible_parse_config,
+ extensible_free_config,
+ "[miboid] name program-or-script arguments");
+ snmpd_register_config_handler("execfix", execfix_parse_config, NULL,
+ "exec-or-sh-name program [arguments...]");
+ snmp_register_callback(SNMP_CALLBACK_APPLICATION,
+ SNMPD_CALLBACK_PRE_UPDATE_CONFIG,
+ extensible_unregister, NULL);
+}
+
+extern int pass_compare(const void *a, const void *b);
+
+void
+extensible_parse_config(const char *token, char *cptr)
+{
+ struct extensible *ptmp, **pp;
+ char *tcptr;
+ int scount;
+
+ /*
+ * allocate and clear memory structure
+ */
+ ptmp = (struct extensible *) calloc(1, sizeof(struct extensible));
+ if (ptmp == NULL)
+ return; /* XXX memory alloc error */
+
+ if (*cptr == '.')
+ cptr++;
+ if (isdigit(*cptr)) {
+ /*
+ * its a relocatable extensible mib
+ */
+ config_perror("WARNING: This output format is not valid, and is only retained for backward compatibility - Please consider using the 'extend' directive instead" );
+ for (pp = &relocs, numrelocs++; *pp; pp = &((*pp)->next));
+ (*pp) = ptmp;
+ pp = &relocs; scount = numrelocs;
+
+ } else {
+ /*
+ * it goes in with the general extensible table
+ */
+ for (pp = &extens, numextens++; *pp; pp = &((*pp)->next));
+ (*pp) = ptmp;
+ pp = &extens; scount = numextens;
+ }
+
+ /*
+ * the rest is pretty much handled the same
+ */
+ if (!strncasecmp(token, "sh", 2))
+ ptmp->type = SHPROC;
+ else
+ ptmp->type = EXECPROC;
+ if (isdigit(*cptr)) {
+ ptmp->miblen = parse_miboid(cptr, ptmp->miboid);
+ while (isdigit(*cptr) || *cptr == '.')
+ cptr++;
+ }
+
+ /*
+ * name
+ */
+ cptr = skip_white(cptr);
+ copy_nword(cptr, ptmp->name, sizeof(ptmp->name));
+ cptr = skip_not_white(cptr);
+ cptr = skip_white(cptr);
+ /*
+ * command
+ */
+ if (cptr == NULL) {
+ config_perror("No command specified on line");
+ } else {
+ /*
+ * Support multi-element commands in shell configuration
+ * lines, but truncate after the first command for 'exec'
+ */
+ for (tcptr = cptr; *tcptr != 0 && *tcptr != '#'; tcptr++)
+ if (*tcptr == ';' && ptmp->type == EXECPROC)
+ break;
+ strncpy(ptmp->command, cptr, tcptr - cptr);
+ ptmp->command[tcptr - cptr] = 0;
+ }
+#ifdef NETSNMP_EXECFIXCMD
+ sprintf(ptmp->fixcmd, NETSNMP_EXECFIXCMD, ptmp->name);
+#endif
+ if (ptmp->miblen > 0) {
+ /*
+ * For relocatable "exec" entries,
+ * register the new (not-strictly-valid) MIB subtree...
+ */
+ register_mib(token,
+ (struct variable *) extensible_relocatable_variables,
+ sizeof(struct variable2),
+ sizeof(extensible_relocatable_variables) /
+ sizeof(*extensible_relocatable_variables),
+ ptmp->miboid, ptmp->miblen);
+
+ /*
+ * ... and ensure the entries are sorted by OID.
+ * This isn't needed for entries in the main extTable (which
+ * don't have MIB OIDs explicitly associated with them anyway)
+ */
+ if (scount > 1 && pp != &extens) {
+ int i;
+ struct extensible **etmp = (struct extensible **)
+ malloc(((sizeof(struct extensible *)) * scount));
+ if (etmp == NULL)
+ return; /* XXX memory alloc error */
+ for (i = 0, ptmp = *pp;
+ i < scount && ptmp != 0; i++, ptmp = ptmp->next)
+ etmp[i] = ptmp;
+ qsort(etmp, scount, sizeof(struct extensible *),
+ pass_compare);
+ *pp = (struct extensible *) etmp[0];
+ ptmp = (struct extensible *) etmp[0];
+
+ for (i = 0; i < scount - 1; i++) {
+ ptmp->next = etmp[i + 1];
+ ptmp = ptmp->next;
+ }
+ ptmp->next = NULL;
+ free(etmp);
+ }
+ }
+}
+
+int
+extensible_unregister(int major, int minor,
+ void *serverarg, void *clientarg)
+{
+ extensible_free_config();
+ return 0;
+}
+
+void
+extensible_free_config(void)
+{
+ struct extensible *etmp, *etmp2;
+ oid tname[MAX_OID_LEN];
+ int i;
+
+ for (etmp = extens; etmp != NULL;) {
+ etmp2 = etmp;
+ etmp = etmp->next;
+ free(etmp2);
+ }
+
+ for (etmp = relocs; etmp != NULL;) {
+ etmp2 = etmp;
+ etmp = etmp->next;
+
+ /*
+ * The new modular API results in the column
+ * objects being registered individually, so
+ * they need to be unregistered individually too!
+ */
+ memset(tname, 0, MAX_OID_LEN*sizeof(oid));
+ memcpy(tname, etmp2->miboid, etmp2->miblen*sizeof(oid));
+ for (i=1; i<4; i++) {
+ tname[etmp2->miblen] = i;
+ unregister_mib(tname, etmp2->miblen+1);
+ }
+ for (i=100; i<=103; i++) {
+ tname[etmp2->miblen] = i;
+ unregister_mib(tname, etmp2->miblen+1);
+ }
+ free(etmp2);
+ }
+
+ relocs = NULL;
+ extens = NULL;
+ numextens = 0;
+ numrelocs = 0;
+}
+
+
+#define MAXMSGLINES 1000
+
+struct extensible *extens = NULL; /* In exec.c */
+struct extensible *relocs = NULL; /* In exec.c */
+int numextens = 0, numrelocs = 0; /* ditto */
+
+
+/*
+ * var_extensible_shell(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+
+/*
+ * find a give entry in the linked list associated with a proc name
+ */
+struct extensible *
+get_exec_by_name(char *name)
+{
+ struct extensible *etmp;
+
+ if (name == NULL)
+ return NULL;
+
+ for (etmp = extens; etmp != NULL && strcmp(etmp->name, name) != 0;
+ etmp = etmp->next);
+
+ if(NULL == etmp)
+ for (etmp = relocs; etmp != NULL && strcmp(etmp->name, name) != 0;
+ etmp = etmp->next);
+
+ return etmp;
+}
+
+void
+execfix_parse_config(const char *token, char *cptr)
+{
+ char tmpname[STRMAX];
+ struct extensible *execp;
+
+ /*
+ * don't allow two entries with the same name
+ */
+ cptr = copy_nword(cptr, tmpname, sizeof(tmpname));
+ if ((execp = get_exec_by_name(tmpname)) == NULL) {
+ config_perror("No exec entry registered for this exec name yet.");
+ return;
+ }
+
+ if (strlen(cptr) > sizeof(execp->fixcmd)) {
+ config_perror("fix command too long.");
+ return;
+ }
+
+ strncpy(execp->fixcmd, cptr, sizeof(execp->fixcmd));
+ execp->fixcmd[ sizeof(execp->fixcmd)-1 ] = 0;
+}
+
+u_char *
+var_extensible_shell(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+ static struct extensible *exten = 0;
+ static long long_ret;
+ int len;
+
+ if (header_simple_table
+ (vp, name, length, exact, var_len, write_method, numextens))
+ return (NULL);
+
+ if ((exten = get_exten_instance(extens, name[*length - 1]))) {
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = name[*length - 1];
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* name defined in config file */
+ *var_len = strlen(exten->name);
+ return ((u_char *) (exten->name));
+ case SHELLCOMMAND:
+ *var_len = strlen(exten->command);
+ return ((u_char *) (exten->command));
+ case ERRORFLAG: /* return code from the process */
+ len = sizeof(exten->output);
+ if (exten->type == EXECPROC) {
+ exten->result = run_exec_command( exten->command, NULL,
+ exten->output, &len);
+ } else {
+ exten->result = run_shell_command(exten->command, NULL,
+ exten->output, &len);
+ }
+ long_ret = exten->result;
+ return ((u_char *) (&long_ret));
+ case ERRORMSG: /* first line of text returned from the process */
+ len = sizeof(exten->output);
+ if (exten->type == EXECPROC) {
+ exten->result = run_exec_command( exten->command, NULL,
+ exten->output, &len);
+ } else {
+ exten->result = run_shell_command(exten->command, NULL,
+ exten->output, &len);
+ }
+ *var_len = strlen(exten->output);
+ if (exten->output[*var_len - 1] == '\n')
+ exten->output[--(*var_len)] = '\0';
+ return ((u_char *) (exten->output));
+ case ERRORFIX:
+ *write_method = fixExecError;
+ long_return = 0;
+ return ((u_char *) & long_return);
+
+ case ERRORFIXCMD:
+ *var_len = strlen(exten->fixcmd);
+ return ((u_char *) exten->fixcmd);
+ }
+ return NULL;
+ }
+ return NULL;
+}
+
+int
+fixExecError(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+
+ struct extensible *exten;
+ long tmp = 0;
+ int fd;
+ static struct extensible ex;
+ FILE *file;
+
+ if ((exten = get_exten_instance(extens, name[10]))) {
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR, "Wrong type != int\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ tmp = *((long *) var_val);
+ if ((tmp == 1) && (action == COMMIT) && (exten->fixcmd[0] != 0)) {
+ sprintf(ex.command, exten->fixcmd);
+ if ((fd = get_exec_output(&ex)) != -1) {
+ file = fdopen(fd, "r");
+ while (fgets(ex.output, sizeof(ex.output), file) != NULL);
+ fclose(file);
+ wait_on_exec(&ex);
+ }
+ }
+ return SNMP_ERR_NOERROR;
+ }
+ return SNMP_ERR_WRONGTYPE;
+}
+
+u_char *
+var_extensible_relocatable(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+ int i;
+ int len;
+ struct extensible *exten = 0;
+ static long long_ret;
+ static char errmsg[STRMAX];
+ char *cp, *cp1;
+ struct variable myvp;
+ oid tname[MAX_OID_LEN];
+
+ memcpy(&myvp, vp, sizeof(struct variable));
+
+ long_ret = *length;
+ for (i = 1; i <= (int) numrelocs; i++) {
+ exten = get_exten_instance(relocs, i);
+ if (!exten)
+ continue;
+ if ((int) exten->miblen == (int) vp->namelen - 1) {
+ memcpy(myvp.name, exten->miboid, exten->miblen * sizeof(oid));
+ myvp.namelen = exten->miblen;
+ *length = vp->namelen;
+ memcpy(tname, vp->name, vp->namelen * sizeof(oid));
+ if (!header_simple_table
+ (&myvp, tname, length, -1, var_len, write_method, -1))
+ break;
+ else
+ exten = NULL;
+ }
+ }
+ if (i > (int) numrelocs || exten == NULL) {
+ *length = long_ret;
+ *var_len = 0;
+ *write_method = NULL;
+ return (NULL);
+ }
+
+ *length = long_ret;
+ if (header_simple_table(vp, name, length, exact, var_len, write_method,
+ ((vp->magic == ERRORMSG) ? MAXMSGLINES : 1)))
+ return (NULL);
+
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = name[*length - 1];
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* name defined in config file */
+ *var_len = strlen(exten->name);
+ return ((u_char *) (exten->name));
+ case SHELLCOMMAND:
+ *var_len = strlen(exten->command);
+ return ((u_char *) (exten->command));
+ case ERRORFLAG: /* return code from the process */
+ len = sizeof(exten->output);
+ if (exten->type == EXECPROC)
+ exten->result = run_exec_command( exten->command, NULL,
+ exten->output, &len);
+ else
+ exten->result = run_shell_command(exten->command, NULL,
+ exten->output, &len);
+ long_ret = exten->result;
+ return ((u_char *) (&long_ret));
+ case ERRORMSG: /* first line of text returned from the process */
+ len = sizeof(exten->output);
+ if (exten->type == EXECPROC)
+ exten->result = run_exec_command( exten->command, NULL,
+ exten->output, &len);
+ else
+ exten->result = run_shell_command(exten->command, NULL,
+ exten->output, &len);
+
+ /*
+ * Pick the output string apart into individual lines,
+ * and extract the one being asked for....
+ */
+ cp1 = exten->output;
+ for (i = 1; i != (int) name[*length - 1]; i++) {
+ cp = strchr(cp1, '\n');
+ if (!cp) {
+ *var_len = 0;
+ /* wait_on_exec(exten); ??? */
+ return NULL;
+ }
+ cp1 = ++cp;
+ }
+ /*
+ * ... and quit if we've run off the end of the output
+ */
+ if (!*cp1) {
+ *var_len = 0;
+ return NULL;
+ }
+ cp = strchr(cp1, '\n');
+ if (cp)
+ *cp = 0;
+ strncpy(errmsg, cp1, sizeof(errmsg));
+ errmsg[ sizeof(errmsg)-1 ] = 0;
+ *var_len = strlen(errmsg);
+ if (errmsg[*var_len - 1] == '\n')
+ errmsg[--(*var_len)] = '\0';
+ return ((u_char *) (errmsg));
+ case ERRORFIX:
+ *write_method = fixExecError;
+ long_return = 0;
+ return ((u_char *) & long_return);
+
+ case ERRORFIXCMD:
+ *var_len = strlen(exten->fixcmd);
+ return ((u_char *) exten->fixcmd);
+ }
+ return NULL;
+}
+
+netsnmp_subtree *
+find_extensible(netsnmp_subtree *tp, oid *tname, size_t tnamelen, int exact)
+{
+ size_t tmp;
+ int i;
+ struct extensible *exten = 0;
+ struct variable myvp;
+ oid name[MAX_OID_LEN];
+ static netsnmp_subtree mysubtree[2] =
+ { { NULL, 0, NULL, 0, NULL, 0, NULL, 0, 0, NULL, NULL, 0, 0, 0,
+ NULL, NULL, NULL, 0, 0, NULL, 0, 0 },
+ { NULL, 0, NULL, 0, NULL, 0, NULL, 0, 0, NULL, NULL, 0, 0, 0,
+ NULL, NULL, NULL, 0, 0, NULL, 0, 0 } };
+
+ for (i = 1; i <= (int) numrelocs; i++) {
+ exten = get_exten_instance(relocs, i);
+ if (!exten)
+ continue;
+ if (exten->miblen != 0) {
+ memcpy(myvp.name, exten->miboid, exten->miblen * sizeof(oid));
+ memcpy(name, tname, tnamelen * sizeof(oid));
+ myvp.name[exten->miblen] = name[exten->miblen];
+ myvp.namelen = exten->miblen + 1;
+ tmp = exten->miblen + 1;
+ if (!header_simple_table(&myvp, name, &tmp, -1,
+ NULL, NULL, numrelocs)) {
+ break;
+ }
+ }
+ }
+ if (i > (int)numrelocs || exten == NULL) {
+ return (tp);
+ }
+
+ if (mysubtree[0].name_a != NULL) {
+ free(mysubtree[0].name_a);
+ mysubtree[0].name_a = NULL;
+ }
+ mysubtree[0].name_a = snmp_duplicate_objid(exten->miboid, exten->miblen);
+ mysubtree[0].namelen = exten->miblen;
+ mysubtree[0].variables = (struct variable *)extensible_relocatable_variables;
+ mysubtree[0].variables_len = sizeof(extensible_relocatable_variables) /
+ sizeof(*extensible_relocatable_variables);
+ mysubtree[0].variables_width = sizeof(*extensible_relocatable_variables);
+ mysubtree[1].namelen = 0;
+ return (mysubtree);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/extensible.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/extensible.h
new file mode 100644
index 0000000000..558f14b2cb
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/extensible.h
@@ -0,0 +1,32 @@
+/*
+ * Template MIB group interface - extensible.h
+ *
+ */
+#ifndef _MIBGROUP_EXTENSIBLE_H
+#define _MIBGROUP_EXTENSIBLE_H
+
+void init_extensible(void);
+
+config_require(util_funcs)
+config_require(utilities/execute)
+
+ extern FindVarMethod var_extensible_shell;
+ extern WriteMethod fixExecError;
+ extern FindVarMethod var_extensible_relocatable;
+ netsnmp_subtree *find_extensible(netsnmp_subtree *, oid *, size_t, int);
+
+/*
+ * config file parsing routines
+ */
+ void extensible_free_config(void);
+ void extensible_parse_config(const char *, char *);
+ void execfix_parse_config(const char *, char *);
+ int extensible_unregister(int, int, void *, void *);
+
+#include "mibdefs.h"
+
+#define SHELLCOMMAND 3
+#define SHELLRESULT 6
+#define SHELLOUTPUT 7
+
+#endif /* _MIBGROUP_EXTENSIBLE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/file.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/file.c
new file mode 100644
index 0000000000..00c98d4245
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/file.c
@@ -0,0 +1,185 @@
+/* Portions of this file are subject to the following copyrights. See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "file.h"
+#include "util_funcs.h"
+
+#define MAXFILE 20
+
+struct filestat fileTable[MAXFILE];
+int fileCount;
+
+void
+init_file(void)
+{
+ struct variable2 file_table[] = {
+ {FILE_INDEX, ASN_INTEGER, RONLY, var_file_table, 1, {1}},
+ {FILE_NAME, ASN_OCTET_STR, RONLY, var_file_table, 1, {2}},
+ {FILE_SIZE, ASN_INTEGER, RONLY, var_file_table, 1, {3}},
+ {FILE_MAX, ASN_INTEGER, RONLY, var_file_table, 1, {4}},
+ {FILE_ERROR, ASN_INTEGER, RONLY, var_file_table, 1, {100}},
+ {FILE_MSG, ASN_OCTET_STR, RONLY, var_file_table, 1, {101}}
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid file_variables_oid[] = { NETSNMP_UCDAVIS_MIB, 15, 1 };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/file", file_table, variable2,
+ file_variables_oid);
+
+ snmpd_register_config_handler("file", file_parse_config,
+ file_free_config, "file [maxsize]");
+
+}
+
+void
+file_free_config(void)
+{
+ fileCount = 0;
+}
+
+void
+file_parse_config(const char *token, char *cptr)
+{
+ char *cp;
+
+ if (fileCount < MAXFILE) {
+ fileTable[fileCount].max = -1;
+
+ cp = copy_nword(cptr, fileTable[fileCount].name, FILE_NAME_MAX);
+
+ if (strlen(fileTable[fileCount].name) >= FILE_NAME_MAX - 1) {
+ config_perror("file name too long");
+ return;
+ }
+
+ if (cp)
+ fileTable[fileCount].max = strtoul(cp, NULL, 10);
+ else
+ fileTable[fileCount].max = -1;
+
+ fileCount++;
+ }
+}
+
+void
+updateFile(int iindex)
+{
+ struct stat sb;
+
+ if (stat(fileTable[iindex].name, &sb) == 0)
+ fileTable[iindex].size = sb.st_size >> 10;
+}
+
+/*
+ * OID functions
+ */
+
+u_char *
+var_file_table(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+ static char error[256];
+ int iindex;
+ struct filestat *file;
+
+ if (header_simple_table
+ (vp, name, length, exact, var_len, write_method, fileCount))
+ return (NULL);
+
+ iindex = name[*length - 1] - 1;
+
+ updateFile(iindex);
+
+ file = &fileTable[iindex];
+
+ switch (vp->magic) {
+ case FILE_INDEX:
+ long_ret = iindex + 1;
+ return (u_char *) & long_ret;
+
+ case FILE_NAME:
+ *var_len = strlen(file->name);
+ return (u_char *) file->name;
+
+ case FILE_SIZE:
+ long_ret = file->size;
+ return (u_char *) & long_ret;
+
+ case FILE_MAX:
+ long_ret = file->max;
+ return (u_char *) & long_ret;
+
+ case FILE_ERROR:
+ if (file->max >= 0 && file->size > file->max)
+ long_ret = 1;
+ else
+ long_ret = 0;
+
+ return (u_char *) & long_ret;
+
+ case FILE_MSG:
+ if (file->max >= 0 && file->size > file->max)
+ snprintf(error, sizeof(error), FILE_ERROR_MSG, file->name,
+ file->max, file->size);
+ else
+ strcpy(error, "");
+
+ *var_len = strlen(error);
+ return (u_char *) error;
+
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_file_table\n",
+ vp->magic));
+ }
+
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/file.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/file.h
new file mode 100644
index 0000000000..8b222c59a1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/file.h
@@ -0,0 +1,36 @@
+/*
+ * Template MIB group interface - file.h
+ *
+ */
+#ifndef _MIBGROUP_FILE_H
+#define _MIBGROUP_FILE_H
+
+#include "mibdefs.h"
+
+void init_file(void);
+
+/*
+ * config file parsing routines
+ */
+void file_free_config(void);
+void file_parse_config(const char *, char *);
+extern FindVarMethod var_file_table;
+
+#define FILE_NAME_MAX SNMP_MAXPATH
+
+struct filestat {
+ char name[FILE_NAME_MAX];
+ int size;
+ int max;
+};
+
+#define FILE_ERROR_MSG "%s: size exceeds %dkb (= %dkb)"
+
+#define FILE_INDEX 1
+#define FILE_NAME 2
+#define FILE_SIZE 3
+#define FILE_MAX 4
+#define FILE_ERROR 100
+#define FILE_MSG 101
+
+#endif /* _MIBGROUP_FILE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/hpux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/hpux.c
new file mode 100644
index 0000000000..db094d3843
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/hpux.c
@@ -0,0 +1,119 @@
+/*
+ * HP specific stuff that OpenView recognizes
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#include <signal.h>
+#if HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#include <sys/vmmeter.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "hpux.h"
+#include "mibdefs.h"
+
+void
+int_hpux(void)
+{
+
+ /*
+ * define the structure we're going to ask the agent to register our
+ * information at
+ */
+ struct variable2 hp_variables[] = {
+ {HPCONF, ASN_INTEGER, RWRITE, var_hp, 1, {HPCONF}},
+ {HPRECONFIG, ASN_INTEGER, RWRITE, var_hp, 1, {HPRECONFIG}},
+ {HPFLAG, ASN_INTEGER, RWRITE, var_hp, 1, {HPFLAG}},
+ {HPLOGMASK, ASN_INTEGER, RWRITE, var_hp, 1, {ERRORFLAG}},
+ {HPSTATUS, ASN_INTEGER, RWRITE, var_hp, 1, {ERRORMSG}}
+ };
+
+ struct variable2 hptrap_variables[] = {
+ {HPTRAP, ASN_IPADDRESS, RWRITE, var_hp, 1, {HPTRAP}},
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid hp_variables_oid[] =
+ { 1, 3, 6, 1, 4, 1, 11, 2, 13, 1, 2, 1 };
+ oid hptrap_variables_oid[] =
+ { 1, 3, 6, 1, 4, 1, 11, 2, 13, 2 };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/hpux:hp", hp_variables, variable2,
+ hp_variables_oid);
+ REGISTER_MIB("ucd-snmp/hpux:hptrap", hptrap_variables, variable2,
+ hptrap_variables_oid);
+
+}
+
+
+#ifdef RESERVED_FOR_FUTURE_USE
+int
+writeHP(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ int var_val_len, u_char * statP, oid * name, int name_len)
+{
+ DODEBUG("Gotto: writeHP\n");
+ return SNMP_ERR_NOERROR;
+}
+#endif
+
+unsigned char *
+var_hp(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+
+ oid newname[MAX_OID_LEN];
+ int result;
+ static long long_ret;
+
+ memcpy((char *) newname, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+ newname[*length] = 0;
+ result =
+ snmp_oid_compare(name, *length, newname, (int) vp->namelen + 1);
+ if ((exact && (result != 0)) || (!exact && (result >= 0)))
+ return NULL;
+ memcpy((char *) name, (char *) newname,
+ ((int) vp->namelen + 1) * sizeof(oid));
+ *length = *length + 1;
+ *var_len = sizeof(long); /* default length */
+ switch (vp->magic) {
+ case HPFLAG:
+ case HPCONF:
+ case HPSTATUS:
+ case HPRECONFIG:
+ long_ret = 1;
+ return (u_char *) & long_ret; /* remove trap */
+ case HPLOGMASK:
+ long_ret = 3;
+ return (u_char *) & long_ret;
+ case HPTRAP:
+ newname[*length - 1] = 128;
+ newname[*length] = 120;
+ newname[*length + 1] = 57;
+ newname[*length + 2] = 92;
+ *length = *length + 3;
+ memcpy((char *) name, (char *) newname, *length * sizeof(oid));
+ long_ret = ((((((128 << 8) + 120) << 8) + 57) << 8) + 92);
+ return (u_char *) & long_ret;
+ }
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/hpux.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/hpux.h
new file mode 100644
index 0000000000..02f72c7991
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/hpux.h
@@ -0,0 +1,21 @@
+/*
+ * hpux specific mib sections
+ *
+ */
+#ifndef _MIBGROUP_HPUX_H
+#define _MIBGROUP_HPUX_H
+
+FindVarMethod var_hp;
+WriteMethod writeHP;
+
+
+#define TRAPAGENT 128.120.57.92
+
+#define HPCONF 1
+#define HPRECONFIG 2
+#define HPFLAG 3
+#define HPLOGMASK 4
+#define HPSTATUS 6
+#define HPTRAP 101
+
+#endif /* _MIBGROUP_HPUX_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/lmSensors.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/lmSensors.c
new file mode 100644
index 0000000000..d7dbd9898e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/lmSensors.c
@@ -0,0 +1,1062 @@
+/* lmSensors.c
+ *
+ * Sections of this code were derived from the published API's of
+ * some Sun products. Hence, portions of the code may be copyright
+ * Sun Microsystems.
+ *
+ * Additional code provided by Mike Fisher and Thomas E. Lackley
+ *
+ * This component allows net-snmp to report sensor information.
+ *
+ * In order to use it, the ./configure invocation must include...
+ *
+ * --with-mib-modules="ucd-snmp/lmSensors"
+ *
+ * It uses one of three different methodologies. Some platforms make
+ * use of an lm_sensors driver to access the information on the
+ * health monitoring hardware, such as the LM75 and LM78 chips.
+ *
+ * For further information see http://secure.netroedge.com/~lm78/
+ *
+ * The Solaris platform uses the other two methodologies. Earlier
+ * platforms such as the Enterprise 450 use kstat to report sensor
+ * information. Later platforms, such as the V880 use the picld
+ * daemon to control system resources and report sensor information.
+ * Picld is supported only on Solaris 2.8 and later.
+ *
+ * Both these methodologies are implemented in a "read only" manner.
+ * You cannot use this code to change anything eg. fan speeds.
+ *
+ * The lmSensors component delivers the information documented in the
+ * LM-SENSORS-MIB. The information is divided up as follows:
+ *
+ * -temperatures (in thousandsths of a Celsius degree)
+ * -fans (rpm's)
+ * -voltages (in milliVolts)
+ * -other (switches, LEDs and i2c's (things that use the i2c bus))
+ * NOTE: This version does not support gpio's. Still on the learning curve.
+ *
+ * Because the MIB only allows output of the datatype Gauge32 this
+ * limits the amount of meaningful information that can be delivered
+ * from "other" sensors. Hence, the code does a certain amount of
+ * translating. See the source for individual sensor types.
+ *
+ * If an "other" sensor delivers a value 99, it means that it
+ * is delivering a "status" that the code does not account for.
+ * If you discover one of these, please pass it on and I'll
+ * put it in.
+ *
+ * It was recently discovered that the sensors code had not be following
+ * the MIB for some sensors. The MIB required reporting some items
+ * in mV and mC. These changes have been noted in the source.
+ *
+ * To see debugging messages, run the daemon as follows:
+ *
+ * /usr/local/sbin/snmpd -f -L -Ducd-snmp/lmSensors
+ * (change path to wherever you installed it)
+ *
+ * or using gdb:
+ *
+ * gdb snmpd
+ * run -f -L -Ducd-snmp/lmSensors
+ *
+ * The component can record up to 256 instances of each type.
+ *
+ * The following should always be included first before anything else
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * minimal include directives
+ */
+
+#include "util_funcs.h"
+#include <time.h>
+
+/*
+ * Load required drivers and libraries.
+ */
+
+#ifdef solaris2
+ #include <kstat.h>
+ #ifdef HAVE_PICL_H
+ #include <picl.h> /* accesses the picld daemon */
+ #endif
+/* the following should be sufficient for any Sun-based sensors */
+ #include </usr/platform/sun4u/include/sys/envctrl.h>
+#else
+ #include <sensors/sensors.h>
+ #define CONFIG_FILE_NAME "/etc/sensors.conf"
+#endif
+
+#include "lmSensors.h"
+
+#define TEMP_TYPE (0)
+#define FAN_TYPE (1)
+#define VOLT_TYPE (2)
+#define MISC_TYPE (3)
+#define N_TYPES (4)
+
+#ifdef solaris2
+ #define MAX_NAME (256)
+ #define MAX_SENSORS (256) /* there's a lot of sensors on a v880 */
+#else
+ #define MAX_NAME (64)
+ #define DEFAULT_SENSORS (256)
+#endif
+
+
+/*
+ * lmSensors_variables_oid:
+ * this is the top level oid that we want to register under. This
+ * is essentially a prefix, with the suffix appearing in the
+ * variable below.
+ */
+
+
+oid lmSensors_variables_oid[] =
+ { 1, 3, 6, 1, 4, 1, 2021, 13, 16 };
+
+/*
+ * variable4 lmSensors_variables:
+ * this variable defines function callbacks and type return information
+ * for the lmSensors mib section
+ */
+
+struct variable4 lmSensors_variables[] = {
+ /*
+ * magic number , variable type , ro/rw , callback fn , L, oidsuffix
+ */
+#define LMTEMPSENSORSINDEX 3
+ {LMTEMPSENSORSINDEX, ASN_INTEGER, RONLY, var_lmSensorsTable, 3,
+ {2, 1, 1}},
+#define LMTEMPSENSORSDEVICE 4
+ {LMTEMPSENSORSDEVICE, ASN_OCTET_STR, RONLY, var_lmSensorsTable, 3,
+ {2, 1, 2}},
+#define LMTEMPSENSORSVALUE 5
+ {LMTEMPSENSORSVALUE, ASN_GAUGE, RONLY, var_lmSensorsTable, 3,
+ {2, 1, 3}},
+#define LMFANSENSORSINDEX 8
+ {LMFANSENSORSINDEX, ASN_INTEGER, RONLY, var_lmSensorsTable, 3,
+ {3, 1, 1}},
+#define LMFANSENSORSDEVICE 9
+ {LMFANSENSORSDEVICE, ASN_OCTET_STR, RONLY, var_lmSensorsTable, 3,
+ {3, 1, 2}},
+#define LMFANSENSORSVALUE 10
+ {LMFANSENSORSVALUE, ASN_GAUGE, RONLY, var_lmSensorsTable, 3,
+ {3, 1, 3}},
+#define LMVOLTSENSORSINDEX 13
+ {LMVOLTSENSORSINDEX, ASN_INTEGER, RONLY, var_lmSensorsTable, 3,
+ {4, 1, 1}},
+#define LMVOLTSENSORSDEVICE 14
+ {LMVOLTSENSORSDEVICE, ASN_OCTET_STR, RONLY, var_lmSensorsTable, 3,
+ {4, 1, 2}},
+#define LMVOLTSENSORSVALUE 15
+ {LMVOLTSENSORSVALUE, ASN_GAUGE, RONLY, var_lmSensorsTable, 3,
+ {4, 1, 3}},
+#define LMMISCSENSORSINDEX 18
+ {LMMISCSENSORSINDEX, ASN_INTEGER, RONLY, var_lmSensorsTable, 3,
+ {5, 1, 1}},
+#define LMMISCSENSORSDEVICE 19
+ {LMMISCSENSORSDEVICE, ASN_OCTET_STR, RONLY, var_lmSensorsTable, 3,
+ {5, 1, 2}},
+#define LMMISCSENSORSVALUE 20
+ {LMMISCSENSORSVALUE, ASN_GAUGE, RONLY, var_lmSensorsTable, 3,
+ {5, 1, 3}},
+};
+
+typedef struct {
+#ifdef solaris2
+ #ifdef HAVE_PICL_H
+ char name[PICL_PROPNAMELEN_MAX]; /*required for picld*/
+ int value;
+ #else
+ char name[MAX_NAME];
+ int value;
+ #endif
+#else
+ char name[MAX_NAME];
+ int value;
+#endif
+} _sensor;
+
+typedef struct {
+ int n;
+#ifdef solaris2
+ _sensor sensor[MAX_SENSORS];
+#else
+ _sensor* sensor;
+ size_t current_len;
+#endif
+} _sensor_array;
+
+static _sensor_array sensor_array[N_TYPES];
+static time_t timestamp;
+
+static int sensor_init(void);
+static int sensor_load(void);
+static int _sensor_load(time_t t);
+#ifndef solaris2
+static void free_sensor_arrays(void);
+#endif
+
+/*
+ * init_lmSensors():
+ * Initialization routine. This is called when the agent starts up.
+ * At a minimum, registration of your variables should take place here.
+ */
+void
+init_lmSensors(void)
+{
+ sensor_init();
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("lmSensors", lmSensors_variables, variable4,
+ lmSensors_variables_oid);
+}
+
+/*
+ * shutdown_lmSensors():
+ * A shutdown/cleanup routine. This is called when the agent shutsdown.
+ */
+void
+shutdown_lmSensors(void)
+{
+#ifndef solaris2
+ DEBUGMSG(("ucd-snmp/lmSensors", "=> shutdown_lmSensors\n"));
+ free_sensor_arrays();
+ DEBUGMSG(("ucd-snmp/lmSensors", "<= shutdown_lmSensors\n"));
+#endif
+} /* shutdown_lmSensors */
+
+/*
+ * var_lmSensorsTable():
+ * Handle this table separately from the scalar value case.
+ * The workings of this are basically the same as for var_lmSensors above.
+ */
+unsigned char *
+var_lmSensorsTable(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+ static unsigned char string[SPRINT_MAX_LEN];
+
+ int s_index;
+ int s_type = -1;
+ int n_sensors;
+ unsigned char* ret = NULL;
+
+ _sensor s;
+
+ if (sensor_load())
+ {
+ ret = NULL;
+ goto leaving;
+ }
+
+ switch (vp->magic) {
+ case LMTEMPSENSORSINDEX:
+ case LMTEMPSENSORSDEVICE:
+ case LMTEMPSENSORSVALUE:
+ s_type = TEMP_TYPE;
+ n_sensors = sensor_array[s_type].n;
+ break;
+
+ case LMFANSENSORSINDEX:
+ case LMFANSENSORSDEVICE:
+ case LMFANSENSORSVALUE:
+ s_type = FAN_TYPE;
+ n_sensors = sensor_array[s_type].n;
+ break;
+
+ case LMVOLTSENSORSINDEX:
+ case LMVOLTSENSORSDEVICE:
+ case LMVOLTSENSORSVALUE:
+ s_type = VOLT_TYPE;
+ n_sensors = sensor_array[s_type].n;
+ break;
+
+ case LMMISCSENSORSINDEX:
+ case LMMISCSENSORSDEVICE:
+ case LMMISCSENSORSVALUE:
+ s_type = MISC_TYPE;
+ n_sensors = sensor_array[s_type].n;
+ break;
+
+ default:
+ s_type = -1;
+ n_sensors = 0;
+ }
+
+ if (header_simple_table(vp, name, length, exact,
+ var_len, write_method,
+ n_sensors) == MATCH_FAILED)
+ {
+ ret = NULL;
+ goto leaving;
+ }
+
+ if (s_type < 0)
+ {
+ ret = NULL;
+ goto leaving;
+ }
+
+ s_index = name[*length - 1] - 1;
+ s = sensor_array[s_type].sensor[s_index];
+
+ switch (vp->magic) {
+ case LMTEMPSENSORSINDEX:
+ case LMFANSENSORSINDEX:
+ case LMVOLTSENSORSINDEX:
+ case LMMISCSENSORSINDEX:
+ long_ret = s_index;
+ ret = (unsigned char *) &long_ret;
+ goto leaving;
+
+ case LMTEMPSENSORSDEVICE:
+ case LMFANSENSORSDEVICE:
+ case LMVOLTSENSORSDEVICE:
+ case LMMISCSENSORSDEVICE:
+ strncpy(string, s.name, SPRINT_MAX_LEN - 1);
+ *var_len = strlen(string);
+ ret = (unsigned char *) string;
+ goto leaving;
+
+ case LMTEMPSENSORSVALUE:
+ case LMFANSENSORSVALUE:
+ case LMVOLTSENSORSVALUE:
+ case LMMISCSENSORSVALUE:
+ long_ret = s.value;
+ ret = (unsigned char *) &long_ret;
+ goto leaving;
+
+ default:
+ ERROR_MSG("Unable to handle table request");
+ }
+
+leaving:
+ return ret;
+}
+
+static int
+sensor_init(void)
+{
+ int res;
+#ifndef solaris2
+ char filename[] = CONFIG_FILE_NAME;
+ time_t t = time(NULL);
+ FILE *fp = fopen(filename, "r");
+ int i = 0;
+
+ DEBUGMSG(("ucd-snmp/lmSensors", "=> sensor_init\n"));
+
+ for (i = 0; i < N_TYPES; i++)
+ {
+ sensor_array[i].n = 0;
+ sensor_array[i].current_len = 0;
+ sensor_array[i].sensor = NULL;
+ }
+
+ if (!fp)
+ {
+ res = 1;
+ goto leaving;
+ }
+
+ if (sensors_init(fp))
+ {
+ res = 2;
+ goto leaving;
+ }
+
+ _sensor_load(t); /* I'll let the linux people decide whether they want to load right away */
+#endif /* not solaris2 */
+
+leaving:
+ DEBUGMSG(("ucd-snmp/lmSensors", "<= sensor_init\n"));
+ return res;
+}
+
+static int
+sensor_load(void)
+{
+ int rc = 0;
+ time_t t = time(NULL);
+
+ if (t > timestamp + 7) /* this may require some tuning - currently 7 seconds*/
+ {
+#ifndef solaris2
+ free_sensor_arrays();
+#endif
+ rc = _sensor_load(t);
+ }
+
+ return rc;
+}
+
+/* This next code block includes all kstat and picld code for the Solaris platform.
+ * If you're not compiling on a Solaris that supports picld, it won't be included.
+ */
+
+#ifdef solaris2
+/* ******* picld sensor procedures * */
+#ifdef HAVE_PICL_H
+
+/* the following are generic modules for reading sensor information
+ the scale variable handles miniVolts */
+
+static int
+read_num_sensor(picl_nodehdl_t childh, char *prop ,int scale, int *value)
+ {
+ picl_nodehdl_t sensorh;
+ picl_propinfo_t sensor_info;
+ picl_errno_t error_code;
+ int valid = 1;
+
+ union valu {
+ char buf[PICL_PROPSIZE_MAX];
+ uint32_t us4;
+ uint16_t us2;
+ int32_t is4;
+ int16_t is2;
+ float f;
+ } val;
+
+ error_code = (picl_get_propinfo_by_name(childh, prop,
+ &sensor_info, &sensorh));
+
+ if (error_code != PICL_SUCCESS) {
+ DEBUGMSGTL(("ucd-snmp/lmSensors",
+ "sensor info lookup failed in read_num_sensor - error code->%d\n", error_code));
+ return(error_code);
+ }
+
+ error_code = picl_get_propval(sensorh, &val.buf, sensor_info.size);
+
+ if (error_code != PICL_SUCCESS) {
+ DEBUGMSGTL(("ucd-snmp/lmSensors",
+ "sensor value lookup failed in read_num_sensor - error code->%d\n", error_code));
+ return(error_code);
+ }
+
+ /* Can't make assumptions about the type or size of the value we get... */
+
+ if (sensor_info.type == PICL_PTYPE_FLOAT) {
+ *value = (int)(val.f*scale);
+ } else if (sensor_info.type == PICL_PTYPE_UNSIGNED_INT) {
+ if (sensor_info.size == 2) {
+ *value = (int)(val.us2 * scale);
+ } else if (sensor_info.size == 4) {
+ *value = (int)(val.us4 * scale);
+ } else
+ valid = 0;
+ } else if (sensor_info.type == PICL_PTYPE_INT) {
+ if (sensor_info.size == 2) {
+ *value = (int)(val.is2 * scale);
+ } else if (sensor_info.size == 4) {
+ *value = (int)(val.is4 * scale);
+ } else
+ valid = 0;
+ } else
+ valid = 0;
+
+ if (valid == 0) {
+ DEBUGMSGTL(("ucd-snmp/lmSensors",
+ "Don't know how to handle data type %d with length %d\n",
+ sensor_info.type, sensor_info.size));
+ error_code = PICL_FAILURE;
+ } else
+ DEBUGMSGTL(("ucd-snmp/lmSensors", "read_num_sensor value is %d\n", *value));
+
+ return(error_code);
+} /* end of read_num_sensor() */
+
+static int
+read_enum_sensor(picl_nodehdl_t childh, char **options, u_int *value)
+{
+ picl_nodehdl_t sensorh;
+ picl_propinfo_t sensor_info;
+ picl_errno_t error_code;
+ char state[PICL_PROPSIZE_MAX];
+ int i;
+
+ error_code = (picl_get_propinfo_by_name(childh, "State",
+ &sensor_info, &sensorh));
+
+ if (error_code != PICL_SUCCESS) {
+ DEBUGMSGTL(("ucd-snmp/lmSensors",
+ "sensor info lookup failed in read_enum_sensor - error code->%d\n", error_code));
+ return(error_code);
+ }
+
+ error_code = picl_get_propval(sensorh, state, sensor_info.size);
+
+ if (error_code != PICL_SUCCESS) {
+ DEBUGMSGTL(("ucd-snmp/lmSensors",
+ "sensor value lookup failed in read_enum_sensor - error code->%d\n", error_code));
+ return(error_code);
+ }
+
+ /* Start with error value, then try to fill in something better.
+ Use case-insensitive match to find the right value since platforms
+ may return either case.
+ */
+
+ *value = 99;
+
+ for (i = 0; options[i] != NULL; i++){
+ if (strncasecmp(state, options[i], strlen(options[i])) == 0){
+ *value = i;
+ break;
+ }
+ }
+
+ DEBUGMSGTL(("ucd-snmp/lmSensors", "read_enum_sensor value is %d\n", *value));
+ return(error_code);
+} /* end of read_enum_sensor() */
+
+/* scale variable handles miniVolts*/
+
+static int
+process_num_sensor(picl_nodehdl_t childh,
+ char propname[PICL_PROPNAMELEN_MAX],
+ char propval[PICL_PROPNAMELEN_MAX], int typ, int scale)
+{
+ int value = 0;
+ picl_errno_t error_code;
+
+ if (sensor_array[typ].n >= MAX_SENSORS){
+ DEBUGMSGTL(("ucd-snmp/lmSensors",
+ "There are too many sensors of type %d\n",typ));
+ } else{
+ error_code = read_num_sensor(childh, propval, scale, &value);
+
+ if (error_code == PICL_SUCCESS) {
+ sensor_array[typ].sensor[sensor_array[typ].n].value = value;
+ snprintf(sensor_array[typ].sensor[sensor_array[typ].n].name,
+ (PICL_PROPNAMELEN_MAX - 1),"%s",propname);
+ sensor_array[typ].sensor[sensor_array[typ].n].
+ name[PICL_PROPNAMELEN_MAX - 1] = '\0';
+ sensor_array[typ].n++;
+ } else
+ DEBUGMSGTL(("ucd-snmp/lmSensors",
+ "read of %s in process_num_sensor returned error code %d\n", propname, error_code));
+ }
+} /* end process_num_sensor() */
+
+static int
+process_enum_sensor(picl_nodehdl_t childh,
+ char propname[PICL_PROPNAMELEN_MAX],
+ int typ, char **options)
+{
+ int value = 0;
+ picl_errno_t error_code;
+
+ if (sensor_array[typ].n >= MAX_SENSORS){
+ DEBUGMSGTL(("ucd-snmp/lmSensors",
+ "There are too many sensors of type %d\n",typ));
+ } else{
+ error_code = read_enum_sensor(childh, options, &value);
+
+ if (error_code == PICL_SUCCESS) {
+ sensor_array[typ].sensor[sensor_array[typ].n].value = value;
+ snprintf(sensor_array[typ].sensor[sensor_array[typ].n].name,
+ (PICL_PROPNAMELEN_MAX - 1),"%s",propname);
+ sensor_array[typ].sensor[sensor_array[typ].n].
+ name[PICL_PROPNAMELEN_MAX - 1] = '\0';
+ sensor_array[typ].n++;
+ } else
+ DEBUGMSGTL(("ucd-snmp/lmSensors",
+ "read of %s in process_enum_sensor returned error code %d\n", propname, error_code));
+ }
+} /* end process_enum_sensor() */
+
+/* The following are modules for dealing with individual sensors types.
+ They call the generic modules above. */
+
+static int
+process_individual_fan(picl_nodehdl_t childh,
+ char propname[PICL_PROPNAMELEN_MAX])
+{
+ process_num_sensor(childh, propname, "AtoDSensorValue", FAN_TYPE, 1);
+}
+
+
+static int
+process_newtype_fan(picl_nodehdl_t childh,
+ char propname[PICL_PROPNAMELEN_MAX])
+{
+ process_num_sensor(childh, propname, "Speed", FAN_TYPE, 1);
+}
+
+
+static int
+process_temperature_sensor(picl_nodehdl_t childh,
+ char propname[PICL_PROPNAMELEN_MAX])
+{
+ process_num_sensor(childh, propname, "Temperature", TEMP_TYPE, 1000);
+} /* MIB asks for mC */
+
+static int
+process_voltage_sensor(picl_nodehdl_t childh,
+ char propname[PICL_PROPNAMELEN_MAX])
+{
+ process_num_sensor(childh, propname, "Voltage", VOLT_TYPE, 1000);
+} /* MIB asks for mV */
+
+static int
+process_digital_sensor(picl_nodehdl_t childh,
+ char propname[PICL_PROPNAMELEN_MAX])
+{
+ process_num_sensor(childh, propname, "AtoDSensorValue", VOLT_TYPE, 1);
+}
+
+
+static int
+process_switch(picl_nodehdl_t childh,
+ char propname[PICL_PROPNAMELEN_MAX])
+{
+
+ char *settings[]={"OFF","ON","NORMAL","LOCKED","UNKNOWN",
+ "DIAG","SECURE",NULL};
+
+ process_enum_sensor(childh, propname, MISC_TYPE, settings);
+}
+
+static int
+process_led(picl_nodehdl_t childh,
+ char propname[PICL_PROPNAMELEN_MAX])
+{
+
+ char *settings[]={"OFF","ON","BLINK",NULL};
+ process_enum_sensor(childh, propname, MISC_TYPE, settings);
+}
+
+static int
+process_i2c(picl_nodehdl_t childh,
+ char propname[PICL_PROPNAMELEN_MAX])
+{
+ char *settings[]={"OK",NULL};
+ process_enum_sensor(childh, propname, MISC_TYPE, settings);
+}
+
+/* walks its way recusively through the tree of sensors */
+
+static int
+process_sensors(int level, picl_nodehdl_t nodeh)
+{
+ picl_nodehdl_t childh;
+ picl_nodehdl_t nexth;
+
+ char propname[PICL_PROPNAMELEN_MAX];
+ char propclass[PICL_CLASSNAMELEN_MAX];
+ picl_errno_t error_code;
+
+ level++;
+
+ DEBUGMSGTL(("ucd-snmp/lmSensors","in process_sensors() level %d\n",level));
+
+ /* look up first child node */
+ error_code = picl_get_propval_by_name(nodeh, PICL_PROP_CHILD, &childh,
+ sizeof (picl_nodehdl_t));
+ if (error_code != PICL_SUCCESS) {
+ DEBUGMSGTL(("ucd-snmp/lmSensors",
+ "picl_get_propval_by_name(%s) %d\n",
+ PICL_PROP_CHILD, error_code));
+ return (error_code);
+ }
+
+ /* step through child nodes, get the name first */
+ while (error_code == PICL_SUCCESS) {
+
+ error_code = picl_get_propval_by_name(childh, PICL_PROP_NAME,
+ propname, (PICL_PROPNAMELEN_MAX - 1));
+ if (error_code != PICL_SUCCESS) { /*we found a node with no name. Impossible.! */
+ DEBUGMSGTL(("ucd-snmp/lmSensors",
+ "picl_get_propval_by_name(%s) = %d\n",
+ PICL_PROP_NAME, error_code));
+ return (error_code);
+ }
+
+ error_code = picl_get_propval_by_name(childh, PICL_PROP_CLASSNAME,
+ propclass, sizeof (propclass));
+ if (error_code != PICL_SUCCESS) { /*we found a node with no class. Impossible.! */
+ DEBUGMSGTL(("ucd-snmp/lmSensors",
+ "picl_get_propval_by_name(%s) = %d\n",
+ PICL_PROP_CLASSNAME, error_code));
+ return (error_code);
+ }
+
+ DEBUGMSGTL(("ucd-snmp/lmSensors","found %s of class %s\n",propname,propclass));
+
+ if (strstr(propclass,"fan-tachometer"))
+ process_individual_fan(childh,propname);
+ else if (strstr(propclass,"fan"))
+ process_newtype_fan(childh,propname);
+ else if (strstr(propclass,"temperature-sensor"))
+ process_temperature_sensor(childh,propname);
+ else if (strstr(propclass,"voltage-sensor"))
+ process_voltage_sensor(childh,propname);
+ else if (strstr(propclass,"digital-sensor"))
+ process_digital_sensor(childh,propname);
+ else if (strstr(propclass,"switch"))
+ process_switch(childh,propname);
+ else if (strstr(propclass,"led"))
+ process_led(childh,propname);
+ else if (strstr(propclass,"i2c"))
+ process_i2c(childh,propname);
+/*
+ else if (strstr(propclass,"gpio"))
+ process_gpio(childh,propname);
+*/
+
+
+ /* look for children of children (note, this is recursive) */
+ if (!(strstr(propclass,"picl") &&
+ (strstr(propname,"frutree") || strstr(propname,"obp")))) {
+ error_code = process_sensors(level,childh);
+ DEBUGMSGTL(("ucd-snmp/lmSensors",
+ "process_sensors(%s) returned %d\n",
+ propname, error_code));
+ }
+
+ /* get next child node at this level*/
+ error_code = picl_get_propval_by_name(childh, PICL_PROP_PEER,
+ &nexth, sizeof (picl_nodehdl_t));
+ if (error_code != PICL_SUCCESS) {/* no more children - buh bye*/
+ DEBUGMSGTL(("ucd-snmp/lmSensors","Process sensors is out of children! Returning...\n"));
+ return (error_code);
+ }
+
+ childh = nexth;
+
+ } /* while */
+ return (error_code);
+} /* process sensors */
+
+#endif
+/* ******** end of picld sensor procedures * */
+
+#endif /* solaris2 */
+static int
+_sensor_load(time_t t)
+{
+#ifdef solaris2
+ int i,j;
+ int typ;
+ int temp=0; /* do not reset this later, more than one typ has temperatures*/
+ int other=0;
+ const char *fantypes[]={"CPU","PWR","AFB"};
+ kstat_ctl_t *kc;
+ kstat_t *kp;
+ envctrl_fan_t *fan_info;
+ envctrl_ps_t *power_info;
+ envctrl_encl_t *enc_info;
+
+/* DEBUGMSG(("ucd-snmp/lmSensors", "Reading the sensors\n")); */
+
+/* initialize the array */
+ for (i = 0; i < N_TYPES; i++){
+ sensor_array[i].n = 0;
+ for (j=0; j < MAX_SENSORS; j++){
+ sensor_array[i].sensor[j].name[0] = '\0';
+ sensor_array[i].sensor[j].value = 0;
+ }
+ } /*end for i*/
+
+/* try picld (if supported), if that doesn't work, try kstat */
+#ifdef HAVE_PICL_H
+
+/* some more declarations */
+
+ int er_code;
+ picl_errno_t error_code;
+ int level=0;
+ picl_nodehdl_t rooth;
+
+er_code = picl_initialize();
+
+if (er_code == PICL_SUCCESS) {
+
+ error_code = picl_get_root(&rooth);
+
+ if (error_code != PICL_SUCCESS) {
+ DEBUGMSG(("ucd-snmp/lmSensors", "picld couldn't get root error code->%d\n",error_code));
+ }
+ else{
+ DEBUGMSGTL(("ucd-snmp/lmSensors", "found root\n"));
+ error_code = process_sensors(level,rooth);
+ if (error_code != 255)
+ if (error_code != 7)
+ DEBUGMSG(("ucd-snmp/lmSensors", "picld had an internal problem error code->%d\n",error_code));
+ } /* end else */
+
+ picl_shutdown();
+
+} /* end if err_code for picl_initialize */
+
+else {
+ DEBUGMSG(("ucd-snmp/lmSensors", "picld couldn't initialize picld because error code->%d\n",er_code));
+
+} /*end else picl_initialize */
+
+#endif /* end of picld section */
+/* initialize kstat */
+
+kc = kstat_open();
+if (kc == 0) {
+ DEBUGMSG(("ucd-snmp/lmSensors", "couldn't open kstat"));
+ } /* endif kc */
+else{
+ temp = 0;
+ kp = kstat_lookup(kc, ENVCTRL_MODULE_NAME, 0, ENVCTRL_KSTAT_FANSTAT);
+ if (kp == 0) {
+ DEBUGMSGTL(("ucd-snmp/lmSensors", "couldn't lookup fan kstat\n"));
+ } /* endif lookup fans */
+ else{
+ if (kstat_read(kc, kp, 0) == -1) {
+ DEBUGMSGTL(("ucd-snmp/lmSensors", "couldn't read fan kstat"));
+ } /* endif kstatread fan */
+ else{
+ typ = 1;
+ fan_info = (envctrl_fan_t *) kp->ks_data;
+ sensor_array[typ].n = kp->ks_ndata;
+ for (i=0; i < kp->ks_ndata; i++){
+ DEBUGMSG(("ucd-snmp/lmSensors", "found instance %d fan type %d speed %d OK %d bustedfan %d\n",
+ fan_info->instance, fan_info->type,fan_info->fanspeed,fan_info->fans_ok,fan_info->fanflt_num));
+ sensor_array[typ].sensor[i].value = fan_info->fanspeed;
+ snprintf(sensor_array[typ].sensor[i].name,(MAX_NAME - 1),
+ "fan type %s number %d",fantypes[fan_info->type],fan_info->instance);
+ sensor_array[typ].sensor[i].name[MAX_NAME - 1] = '\0';
+ fan_info++;
+ } /* end for fan_info */
+ } /* end else kstatread fan */
+ } /* end else lookup fans*/
+
+
+ kp = kstat_lookup(kc, ENVCTRL_MODULE_NAME, 0, ENVCTRL_KSTAT_PSNAME);
+ if (kp == 0) {
+ DEBUGMSGTL(("ucd-snmp/lmSensors", "couldn't lookup power supply kstat\n"));
+ } /* endif lookup power supply */
+ else{
+ if (kstat_read(kc, kp, 0) == -1) {
+ DEBUGMSGTL(("ucd-snmp/lmSensors", "couldn't read power supply kstat\n"));
+ } /* endif kstatread fan */
+ else{
+ typ = 0; /* this is a power supply temperature, not a voltage*/
+ power_info = (envctrl_ps_t *) kp->ks_data;
+ sensor_array[typ].n = kp->ks_ndata;
+ for (i=0; i < kp->ks_ndata; i++){
+ DEBUGMSG(("ucd-snmp/lmSensors", "found instance %d psupply temp mC %d %dW OK %d share %d limit %d\n",
+ power_info->instance, power_info->ps_tempr*1000,power_info->ps_rating,
+ power_info->ps_ok,power_info->curr_share_ok,power_info->limit_ok));
+ sensor_array[typ].sensor[temp].value = power_info->ps_tempr*1000;
+ snprintf(sensor_array[typ].sensor[temp].name,(MAX_NAME-1),
+ "power supply %d",power_info->instance);
+ sensor_array[typ].sensor[temp].name[MAX_NAME - 1] = '\0';
+ power_info++; /* increment the data structure */
+ temp++; /* increment the temperature sensor array element */
+ } /* end for power_info */
+ } /* end else kstatread power supply */
+ } /* end else lookup power supplies*/
+
+ kp = kstat_lookup(kc, ENVCTRL_MODULE_NAME, 0, ENVCTRL_KSTAT_ENCL);
+ if (kp == 0) {
+ DEBUGMSGTL(("ucd-snmp/lmSensors", "couldn't lookup enclosure kstat\n"));
+ } /* endif lookup enclosure */
+ else{
+ if (kstat_read(kc, kp, 0) == -1) {
+ DEBUGMSGTL(("ucd-snmp/lmSensors", "couldn't read enclosure kstat\n"));
+ } /* endif kstatread enclosure */
+ else{
+ enc_info = (envctrl_encl_t *) kp->ks_data;
+ other = 0;
+ for (i=0; i < kp->ks_ndata; i++){
+ switch (enc_info->type){
+ case ENVCTRL_ENCL_FSP:
+ DEBUGMSG(("ucd-snmp/lmSensors", "front panel value %d\n",enc_info->value));
+ typ = 3; /* misc */
+ sensor_array[typ].sensor[other].value = enc_info->value;
+ strncpy(sensor_array[typ].sensor[other].name,"FSP",MAX_NAME-1);
+ sensor_array[typ].sensor[other].name[MAX_NAME-1]='\0'; /* null terminate */
+ other++;
+ break;
+ case ENVCTRL_ENCL_AMBTEMPR:
+ DEBUGMSG(("ucd-snmp/lmSensors", "ambient temp mC %d\n",enc_info->value*1000));
+ typ = 0; /* temperature sensor */
+ sensor_array[typ].sensor[temp].value = enc_info->value*1000;
+ strncpy(sensor_array[typ].sensor[temp].name,"Ambient",MAX_NAME-1);
+ sensor_array[typ].sensor[temp].name[MAX_NAME-1]='\0'; /* null terminate */
+ temp++;
+ break;
+ case ENVCTRL_ENCL_BACKPLANE4:
+ DEBUGMSG(("ucd-snmp/lmSensors", "There is a backplane4\n"));
+ typ = 3; /* misc */
+ sensor_array[typ].sensor[other].value = enc_info->value;
+ strncpy(sensor_array[typ].sensor[other].name,"Backplane4",MAX_NAME-1);
+ sensor_array[typ].sensor[other].name[MAX_NAME-1]='\0'; /* null terminate */
+ other++;
+ break;
+ case ENVCTRL_ENCL_BACKPLANE8:
+ DEBUGMSG(("ucd-snmp/lmSensors", "There is a backplane8\n"));
+ typ = 3; /* misc */
+ sensor_array[typ].sensor[other].value = enc_info->value;
+ strncpy(sensor_array[typ].sensor[other].name,"Backplane8",MAX_NAME-1);
+ sensor_array[typ].sensor[other].name[MAX_NAME-1]='\0'; /* null terminate */
+ other++;
+ break;
+ case ENVCTRL_ENCL_CPUTEMPR:
+ DEBUGMSG(("ucd-snmp/lmSensors", "CPU%d temperature mC %d\n",enc_info->instance,enc_info->value*1000));
+ typ = 0; /* temperature sensor */
+ sensor_array[typ].sensor[temp].value = enc_info->value*1000;
+ snprintf(sensor_array[typ].sensor[temp].name,MAX_NAME,"CPU%d",enc_info->instance);
+ sensor_array[typ].sensor[temp].name[MAX_NAME-1]='\0'; /* null terminate */
+ temp++;
+ break;
+ default:
+ DEBUGMSG(("ucd-snmp/lmSensors", "unknown element instance &d type &d value %d\n",
+ enc_info->instance, enc_info->type, enc_info->value));
+ break;
+ } /* end switch */
+ enc_info++;
+ } /* end for enc_info */
+ sensor_array[3].n = other;
+ sensor_array[0].n = temp;
+ } /* end else kstatread enclosure */
+ } /* end else lookup enclosure*/
+
+ kstat_close(kc);
+
+} /* end else kstat */
+#else /* end solaris2 only ie. ifdef everything else */
+
+ const sensors_chip_name *chip;
+ const sensors_feature_data *data;
+ int chip_nr = 0;
+ int rc = 0;
+ unsigned int i = 0;
+
+ for (i = 0; i < N_TYPES; i++)
+ {
+ sensor_array[i].n = 0;
+ sensor_array[i].current_len = 0;
+
+ /* Malloc the default number of sensors. */
+ sensor_array[i].sensor = (_sensor*)malloc(sizeof(_sensor) * DEFAULT_SENSORS);
+ if (sensor_array[i].sensor == NULL)
+ {
+ /* Continuing would be unsafe */
+ snmp_log(LOG_ERR, "Cannot malloc sensor array!");
+ return (rc = 1);
+ } /* end if */
+ sensor_array[i].current_len = DEFAULT_SENSORS;
+ } /* end for */
+
+ while ((chip = sensors_get_detected_chips(&chip_nr))) {
+ int a = 0;
+ int b = 0;
+
+ while ((data = sensors_get_all_features(*chip, &a, &b))) {
+ char *label = NULL;
+ double val;
+
+ if ((data->mode & SENSORS_MODE_R) &&
+ (data->mapping == SENSORS_NO_MAPPING) &&
+ !sensors_get_label(*chip, data->number, &label) &&
+ !sensors_get_feature(*chip, data->number, &val)) {
+ int type = -1;
+ float mul;
+ _sensor_array *array;
+
+ /* The label, as determined for a given chip in sensors.conf,
+ * is used to place each sensor in the appropriate bucket.
+ * Volt, Fan, Temp, and Misc. If the text being looked for below
+ * is not in the label of a given sensor (e.g., the temp1 sensor
+ * has been labeled 'CPU' and not 'CPU temp') it will end up being
+ * lumped in the MISC bucket. */
+
+ if (strstr(label, "V")) {
+ type = VOLT_TYPE;
+ mul = 1000.0;
+ }
+ if (strstr(label, "fan") || strstr(label, "Fan")) {
+ type = FAN_TYPE;
+ mul = 1.0;
+ }
+ if (strstr(label, "temp") || strstr(label, "Temp")) {
+ type = TEMP_TYPE;
+ mul = 1000.0;
+ }
+ if (type == -1) {
+ type = MISC_TYPE;
+ mul = 1000.0;
+ }
+
+ array = &sensor_array[type];
+ if ( array->current_len <= array->n) {
+ _sensor* old_buffer = array->sensor;
+ size_t new_size = (sizeof(_sensor) * array->current_len) + (sizeof(_sensor) * DEFAULT_SENSORS);
+ array->sensor = (_sensor*)realloc(array->sensor, new_size);
+ if (array->sensor == NULL)
+ {
+ /* Continuing would be unsafe */
+ snmp_log(LOG_ERR, "too many sensors to fit, and failed to alloc more, failing on %s\n", label);
+ free(old_buffer);
+ old_buffer = NULL;
+ if (label) {
+ free(label);
+ label = NULL;
+ } /* end if label */
+ return (rc=1);
+ } /* end if array->sensor */
+ array->current_len = new_size / sizeof(_sensor);
+ DEBUGMSG(("ucd-snmp/lmSensors", "type #%d increased to %d elements\n", type, array->current_len));
+ } /* end if array->current */
+ strncpy(array->sensor[array->n].name, label, MAX_NAME);
+ array->sensor[array->n].value = (int) (val * mul);
+ DEBUGMSGTL(("sensors","sensor %d, value %d\n",
+ array->sensor[array->n].name,
+ array->sensor[array->n].value));
+ array->n++;
+ } /* end if data-mode */
+ if (label) {
+ free(label);
+ label = NULL;
+ } /* end if label */
+ } /* end while data */
+ } /* end while chip */
+ return rc;
+#endif /* end else ie. ifdef everything else */
+ /* Update the timestamp after a load. */
+ timestamp = t;
+}
+
+#ifndef solaris2
+/* Free all the sensor arrays. */
+static void
+free_sensor_arrays()
+{
+ unsigned int i = 0;
+ DEBUGMSG(("ucd-snmp/lmSensors", "=> free_sensor_arrays\n"));
+ for (i = 0; i < N_TYPES; i++){
+ if (sensor_array[i].sensor != NULL)
+ {
+ free(sensor_array[i].sensor);
+ sensor_array[i].sensor = NULL;
+ }
+ /* For good measure, reset the other values. */
+ sensor_array[i].n = 0;
+ sensor_array[i].current_len = 0;
+ }
+ DEBUGMSG(("ucd-snmp/lmSensors", "<= free_sensor_arrays\n"));
+}
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/lmSensors.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/lmSensors.h
new file mode 100644
index 0000000000..afed6fafc3
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/lmSensors.h
@@ -0,0 +1,16 @@
+/*
+ * This file was generated by mib2c and is intended for use as a mib module
+ * for the ucd-snmp snmpd agent.
+ */
+
+#ifndef _MIBGROUP_LMSENSORS_H
+#define _MIBGROUP_LMSENSORS_H
+
+config_require(util_funcs)
+config_add_mib(LM-SENSORS-MIB)
+
+ void init_lmSensors(void);
+ void shutdown_lmSensors(void);
+ FindVarMethod var_lmSensorsTable;
+
+#endif /* _MIBGROUP_LMSENSORS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/loadave.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/loadave.c
new file mode 100644
index 0000000000..25bf1d3580
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/loadave.c
@@ -0,0 +1,379 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include <signal.h>
+#if HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#if !(defined(bsdi2) || defined(netbsd1))
+#include <sys/vmmeter.h>
+#endif
+#endif
+#if HAVE_SYS_CONF_H
+#include <sys/conf.h>
+#endif
+#if HAVE_ASM_PAGE_H
+#include <asm/page.h>
+#endif
+#if HAVE_SYS_SWAP_H
+#include <sys/swap.h>
+#endif
+#if HAVE_SYS_FS_H
+#include <sys/fs.h>
+#else
+#if HAVE_UFS_FS_H
+#include <ufs/fs.h>
+#else
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_VNODE_H
+#include <sys/vnode.h>
+#endif
+#ifdef HAVE_UFS_UFS_QUOTA_H
+#include <ufs/ufs/quota.h>
+#endif
+#ifdef HAVE_UFS_UFS_INODE_H
+#include <ufs/ufs/inode.h>
+#endif
+#if HAVE_UFS_FFS_FS_H
+#include <ufs/ffs/fs.h>
+#endif
+#endif
+#endif
+#if HAVE_MTAB_H
+#include <mtab.h>
+#endif
+#include <errno.h>
+#if HAVE_FSTAB_H
+#include <fstab.h>
+#endif
+#if HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#if (!defined(HAVE_STATVFS)) && defined(HAVE_STATFS)
+#if HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#define statvfs statfs
+#endif
+#if HAVE_VM_VM_H
+#include <vm/vm.h>
+#endif
+#if HAVE_VM_SWAP_PAGER_H
+#include <vm/swap_pager.h>
+#endif
+#if HAVE_SYS_FIXPOINT_H
+#include <sys/fixpoint.h>
+#endif
+#if HAVE_SYS_LOADAVG_H
+#include <sys/loadavg.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#ifdef dynix
+#include <sys/mc_vmparam.h>
+#endif
+#if defined(hpux10) || defined(hpux11)
+#include <sys/pstat.h>
+#endif
+#if defined(aix4) || defined(aix5) || defined(aix6)
+#include <libperfstat.h>
+#endif
+#if HAVE_SYS_SYSGET_H
+#include <sys/sysget.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "struct.h"
+#include "loadave.h"
+#include "util_funcs.h"
+#include "kernel.h"
+
+double maxload[3];
+
+void
+init_loadave(void)
+{
+
+ /*
+ * define the structure we're going to ask the agent to register our
+ * information at
+ */
+ struct variable2 extensible_loadave_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_loadave, 1,
+ {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_loadave, 1,
+ {ERRORNAME}},
+ {LOADAVE, ASN_OCTET_STR, RONLY, var_extensible_loadave, 1,
+ {LOADAVE}},
+ {LOADMAXVAL, ASN_OCTET_STR, RONLY, var_extensible_loadave, 1,
+ {LOADMAXVAL}},
+ {LOADAVEINT, ASN_INTEGER, RONLY, var_extensible_loadave, 1,
+ {LOADAVEINT}},
+#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
+ {LOADAVEFLOAT, ASN_OPAQUE_FLOAT, RONLY, var_extensible_loadave, 1,
+ {LOADAVEFLOAT}},
+#endif
+ {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_loadave, 1,
+ {ERRORFLAG}},
+ {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_loadave, 1,
+ {ERRORMSG}}
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid loadave_variables_oid[] =
+ { NETSNMP_UCDAVIS_MIB, NETSNMP_LOADAVEMIBNUM, 1 };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/loadave", extensible_loadave_variables,
+ variable2, loadave_variables_oid);
+
+ snmpd_register_config_handler("load", loadave_parse_config,
+ loadave_free_config,
+ "max1 [max5] [max15]");
+}
+
+void
+loadave_parse_config(const char *token, char *cptr)
+{
+ int i;
+
+ for (i = 0; i <= 2; i++) {
+ if (cptr != NULL)
+ maxload[i] = atof(cptr);
+ else
+ maxload[i] = maxload[i - 1];
+ cptr = skip_not_white(cptr);
+ cptr = skip_white(cptr);
+ }
+}
+
+void
+loadave_free_config(void)
+{
+ int i;
+
+ for (i = 0; i <= 2; i++)
+ maxload[i] = NETSNMP_DEFMAXLOADAVE;
+}
+
+/*
+ * try to get load average
+ * Inputs: pointer to array of doubles, number of elements in array
+ * Returns: 0=array has values, -1=error occurred.
+ */
+int
+try_getloadavg(double *r_ave, size_t s_ave)
+{
+ double *pave = r_ave;
+#ifndef HAVE_GETLOADAVG
+#ifdef HAVE_SYS_FIXPOINT_H
+ fix favenrun[3];
+#endif
+#if (defined(ultrix) || defined(sun) || defined(__alpha) || defined(dynix))
+ int i;
+#if (defined(sun) || defined(__alpha) || defined(dynix))
+ long favenrun[3];
+ if (s_ave > 3) /* bounds check */
+ return (-1);
+#define FIX_TO_DBL(_IN) (((double) _IN)/((double) FSCALE))
+#endif
+#endif
+#if defined(aix4) || defined(aix5) || defined(aix6)
+ int favenrun[3];
+ perfstat_cpu_total_t cs;
+#endif
+#if defined(hpux10) || defined(hpux11)
+ struct pst_dynamic pst_buf;
+#endif
+#ifdef irix6
+ int i, favenrun[3];
+ sgt_cookie_t cookie;
+#endif
+#endif /* !HAVE_GETLOADAVG */
+
+#ifdef HAVE_GETLOADAVG
+ if (getloadavg(pave, s_ave) == -1)
+ return (-1);
+#elif defined(linux)
+ {
+ FILE *in = fopen("/proc/loadavg", "r");
+ if (!in) {
+ snmp_log(LOG_ERR, "snmpd: cannot open /proc/loadavg\n");
+ return (-1);
+ }
+ fscanf(in, "%lf %lf %lf", pave, (pave + 1), (pave + 2));
+ fclose(in);
+ }
+#elif (defined(ultrix) || defined(sun) || defined(__alpha) || defined(dynix))
+ if (auto_nlist(LOADAVE_SYMBOL, (char *) favenrun, sizeof(favenrun)) ==
+ 0)
+ return (-1);
+ for (i = 0; i < s_ave; i++)
+ *(pave + i) = FIX_TO_DBL(favenrun[i]);
+#elif defined(hpux10) || defined(hpux11)
+ if (pstat_getdynamic(&pst_buf, sizeof(struct pst_dynamic), 1, 0) < 0)
+ return(-1);
+ r_ave[0] = pst_buf.psd_avg_1_min;
+ r_ave[1] = pst_buf.psd_avg_5_min;
+ r_ave[2] = pst_buf.psd_avg_15_min;
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+ if(perfstat_cpu_total((perfstat_id_t *)NULL, &cs, sizeof(perfstat_cpu_total_t), 1) > 0) {
+ r_ave[0] = cs.loadavg[0] / 65536.0;
+ r_ave[1] = cs.loadavg[1] / 65536.0;
+ r_ave[2] = cs.loadavg[2] / 65536.0;
+ }
+#elif defined(irix6)
+ SGT_COOKIE_INIT(&cookie);
+ SGT_COOKIE_SET_KSYM(&cookie, "avenrun");
+ sysget(SGT_KSYM, (char*)favenrun, sizeof(favenrun), SGT_READ, &cookie);
+ for (i = 0; i < s_ave; i++)
+ r_ave[i] = favenrun[i] / 1000.0;
+ DEBUGMSGTL(("ucd-snmp/loadave", "irix6: %d %d %d\n", favenrun[0], favenrun[1], favenrun[2]));
+#elif !defined(cygwin)
+#if defined(NETSNMP_CAN_USE_NLIST) && defined(LOADAVE_SYMBOL)
+ if (auto_nlist(LOADAVE_SYMBOL, (char *) pave, sizeof(double) * s_ave)
+ == 0)
+#endif
+ return (-1);
+#endif
+ /*
+ * XXX
+ * To calculate this, we need to compare
+ * successive values of the kernel array
+ * '_cp_times', and calculate the resulting
+ * percentage changes.
+ * This calculation needs to be performed
+ * regularly - perhaps as a background process.
+ *
+ * See the source to 'top' for full details.
+ *
+ * The linux SNMP HostRes implementation
+ * uses 'avenrun[0]*100' as an approximation.
+ * This is less than accurate, but has the
+ * advantage of being simple to implement!
+ *
+ * I'm also assuming a single processor
+ */
+ return 0;
+}
+
+u_char *
+var_extensible_loadave(struct variable * vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+ static long long_ret;
+ static float float_ret;
+ static char errmsg[300];
+ double avenrun[3];
+ if (header_simple_table
+ (vp, name, length, exact, var_len, write_method, 3))
+ return (NULL);
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = name[*length - 1];
+ return ((u_char *) (&long_ret));
+ case ERRORNAME:
+ sprintf(errmsg, "Load-%d", ((name[*length - 1] == 1) ? 1 :
+ ((name[*length - 1] == 2) ? 5 : 15)));
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ }
+ if (try_getloadavg(&avenrun[0], sizeof(avenrun) / sizeof(avenrun[0]))
+ == -1)
+ return (0);
+ switch (vp->magic) {
+ case LOADAVE:
+
+ sprintf(errmsg, "%.2f", avenrun[name[*length - 1] - 1]);
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case LOADMAXVAL:
+ sprintf(errmsg, "%.2f", maxload[name[*length - 1] - 1]);
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case LOADAVEINT:
+ long_ret = (u_long) (avenrun[name[*length - 1] - 1] * 100);
+ return ((u_char *) (&long_ret));
+#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
+ case LOADAVEFLOAT:
+ float_ret = (float) avenrun[name[*length - 1] - 1];
+ *var_len = sizeof(float_ret);
+ return ((u_char *) (&float_ret));
+#endif
+ case ERRORFLAG:
+ long_ret = (maxload[name[*length - 1] - 1] != 0 &&
+ avenrun[name[*length - 1] - 1] >=
+ maxload[name[*length - 1] - 1]) ? 1 : 0;
+ return ((u_char *) (&long_ret));
+ case ERRORMSG:
+ if (maxload[name[*length - 1] - 1] != 0 &&
+ avenrun[name[*length - 1] - 1] >=
+ maxload[name[*length - 1] - 1]) {
+ sprintf(errmsg, "%d min Load Average too high (= %.2f)",
+ (name[*length - 1] ==
+ 1) ? 1 : ((name[*length - 1] == 2) ? 5 : 15),
+ avenrun[name[*length - 1] - 1]);
+ } else {
+ errmsg[0] = 0;
+ }
+ *var_len = strlen(errmsg);
+ return ((u_char *) errmsg);
+ }
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/loadave.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/loadave.h
new file mode 100644
index 0000000000..497bfb8556
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/loadave.h
@@ -0,0 +1,26 @@
+/*
+ * Loadaveess watching mib group
+ */
+#ifndef _MIBGROUP_LOADAVE_H
+#define _MIBGROUP_LOADAVE_H
+
+config_require(util_funcs)
+
+ void init_loadave(void);
+ extern FindVarMethod var_extensible_loadave;
+
+/*
+ * config file parsing routines
+ */
+ void loadave_parse_config(const char *, char *);
+ void loadave_free_config(void);
+ int try_getloadavg(double *r_ave, size_t s_ave);
+
+#include "mibdefs.h"
+
+#define LOADAVE 3
+#define LOADMAXVAL 4
+#define LOADAVEINT 5
+#define LOADAVEFLOAT 6
+
+#endif /* _MIBGROUP_LOADAVE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/logmatch.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/logmatch.c
new file mode 100644
index 0000000000..17300c498c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/logmatch.c
@@ -0,0 +1,554 @@
+/* Portions of this file are subject to the following copyrights. See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#ifdef HAVE_REGEX_H
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+
+
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "util_funcs.h"
+#include "logmatch.h"
+#include "util_funcs.h"
+
+#define MAXLOGMATCH 50
+
+struct logmatchstat logmatchTable[MAXLOGMATCH];
+int logmatchCount;
+
+void
+init_logmatch(void)
+{
+ struct variable2 logmatch_info[] = {
+ {LOGMATCH_INFO, ASN_INTEGER, RONLY, var_logmatch_table, 0}
+ };
+
+ struct variable2 logmatch_table[] = {
+ {LOGMATCH_INDEX, ASN_INTEGER, RONLY, var_logmatch_table, 1, {1}},
+ {LOGMATCH_NAME, ASN_OCTET_STR, RONLY, var_logmatch_table, 1, {2}},
+ {LOGMATCH_FILENAME, ASN_OCTET_STR, RONLY, var_logmatch_table, 1,
+ {3}},
+ {LOGMATCH_REGEX, ASN_OCTET_STR, RONLY, var_logmatch_table, 1, {4}},
+ {LOGMATCH_GLOBALCTR, ASN_COUNTER, RONLY, var_logmatch_table, 1,
+ {5}},
+ {LOGMATCH_GLOBALCNT, ASN_INTEGER, RONLY, var_logmatch_table, 1,
+ {6}},
+ {LOGMATCH_CURRENTCTR, ASN_COUNTER, RONLY, var_logmatch_table, 1,
+ {7}},
+ {LOGMATCH_CURRENTCNT, ASN_INTEGER, RONLY, var_logmatch_table, 1,
+ {8}},
+ {LOGMATCH_COUNTER, ASN_COUNTER, RONLY, var_logmatch_table, 1, {9}},
+ {LOGMATCH_COUNT, ASN_INTEGER, RONLY, var_logmatch_table, 1, {10}},
+ {LOGMATCH_FREQ, ASN_INTEGER, RONLY, var_logmatch_table, 1, {11}},
+ {LOGMATCH_ERROR, ASN_INTEGER, RONLY, var_logmatch_table, 1, {100}},
+ {LOGMATCH_MSG, ASN_OCTET_STR, RONLY, var_logmatch_table, 1, {101}}
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid logmatch_info_oid[] = { NETSNMP_UCDAVIS_MIB, 16, 1 };
+ oid logmatch_variables_oid[] = { NETSNMP_UCDAVIS_MIB, 16, 2, 1 };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/logmatch", logmatch_info, variable2,
+ logmatch_info_oid);
+ REGISTER_MIB("ucd-snmp/logmatch", logmatch_table, variable2,
+ logmatch_variables_oid);
+
+ snmpd_register_config_handler("logmatch", logmatch_parse_config,
+ logmatch_free_config,
+ "logmatch name path cycletime regex");
+
+}
+
+/***************************************************************
+* *
+* !!!---!!! PUBLIC !!! --- !!! *
+* *
+* logmatch_free_config *
+* free memory allocated by this mib module *
+* *
+***************************************************************/
+
+void
+logmatch_free_config(void)
+{
+ int i;
+
+ /*
+ * ------------------------------------
+ * the only memory we have allocated
+ * is the memory allocated by regcomp
+ * ------------------------------------
+ */
+
+ for (i = 0; i < logmatchCount; i++) {
+
+ regfree(&(logmatchTable[i].regexBuffer));
+ }
+ logmatchCount = 0;
+}
+
+/***************************************************************
+* *
+* !!!---!!! PUBLIC !!! --- !!! *
+* *
+* logmatch_parse_config *
+* parse one line from snmpd.conf *
+* *
+***************************************************************/
+
+void
+logmatch_parse_config(const char *token, char *cptr)
+{
+
+ char space_name;
+ char space_path;
+
+ if (logmatchCount < MAXLOGMATCH) {
+ logmatchTable[logmatchCount].frequency = 30;
+ logmatchTable[logmatchCount].thisIndex = logmatchCount;
+
+
+ /*
+ * ------------------------------------
+ * be careful this counter needs to be
+ * reset from persistent storage
+ * ------------------------------------
+ */
+
+ logmatchTable[logmatchCount].globalMatchCounter = 0;
+ logmatchTable[logmatchCount].currentMatchCounter = 0;
+ logmatchTable[logmatchCount].matchCounter = 0;
+ logmatchTable[logmatchCount].virgin = TRUE;
+ logmatchTable[logmatchCount].currentFilePosition = 0;
+
+
+ /*
+ * ------------------------------------
+ * be careful: the flag 255 must fit to
+ * the size of regEx as definded in
+ * logmatch.h
+ * ------------------------------------
+ */
+
+ sscanf(cptr, "%255s%c%255s%c %d %255c\n",
+ logmatchTable[logmatchCount].name,
+ &space_name,
+ logmatchTable[logmatchCount].filename,
+ &space_path,
+ &(logmatchTable[logmatchCount].frequency),
+ logmatchTable[logmatchCount].regEx);
+
+ /*
+ * Log an error then return if any of the strings scanned in were
+ * larger then they should have been.
+ */
+ if (space_name != ' ') {
+ snmp_log(LOG_ERR, "logmatch_parse_config: the name scanned " \
+ "in from line %s is too large. logmatchCount = %d\n",
+ cptr, logmatchCount);
+ return;
+ } else if (space_path != ' ') {
+ snmp_log(LOG_ERR, "logmatch_parse_config: the file name " \
+ "scanned in from line %s is too large. logmatchCount = %d\n",
+ cptr, logmatchCount);
+ return;
+ }
+
+ /*
+ * ------------------------------------
+ * just to be safe "NULL" the end of
+ * the arary regEx as sscanf won't do
+ * it with the %c modifier
+ * ------------------------------------
+ */
+
+ logmatchTable[logmatchCount].regEx[255] = '\0';
+
+
+ /*
+ * ------------------------------------
+ * now compile the regular expression
+ * ------------------------------------
+ */
+
+ logmatchTable[logmatchCount].myRegexError =
+ regcomp(&(logmatchTable[logmatchCount].regexBuffer),
+ logmatchTable[logmatchCount].regEx,
+ REG_EXTENDED | REG_NOSUB);
+
+ if (logmatchTable[logmatchCount].frequency > 0) {
+ snmp_alarm_register(logmatchTable[logmatchCount].frequency,
+ SA_REPEAT,
+ (SNMPAlarmCallback *)
+ updateLogmatch_Scheduled,
+ &(logmatchTable[logmatchCount])
+ );
+ }
+
+ logmatchCount++;
+ }
+}
+
+
+/***************************************************************
+* *
+* !!!---!!! PUBLIC !!! --- !!! *
+* *
+* updateLogmatch *
+* this function is called back by snmpd alarms *
+* *
+***************************************************************/
+
+
+void
+updateLogmatch(int iindex)
+{
+
+ regmatch_t myMatch;
+ int matchResultCode;
+ char inbuf[1024];
+ char perfilename[1024];
+ FILE *perfile;
+ unsigned long pos, ccounter, counter;
+ int result;
+ int toobig;
+ int anyChanges = FALSE;
+ struct stat sb;
+
+ /*
+ * ------------------------------------
+ * we can never be sure if this is the
+ * last time we are being called here,
+ * so we always update a persistent
+ * data file with our current file
+ * position
+ * ------------------------------------
+ */
+
+ snprintf(perfilename, sizeof(perfilename), "%s/snmpd_logmatch_%s.pos",
+ get_persistent_directory(), logmatchTable[iindex].name);
+
+ if (logmatchTable[iindex].virgin) {
+
+ /*
+ * ------------------------------------
+ * this is the first time we are being
+ * called; let's try to find an old
+ * file position stored in a persistent
+ * data file and restore it
+ * ------------------------------------
+ */
+
+ if ((perfile = fopen(perfilename, "r"))) {
+
+
+ /*
+ * ------------------------------------
+ * the persistent data file exists so
+ * let's read it out
+ * ------------------------------------
+ */
+
+
+ pos = counter = ccounter = 0;
+
+ if (fscanf(perfile, "%lu %lu %lu", &pos, &ccounter, &counter)) {
+
+
+ /*
+ * ------------------------------------
+ * the data could be read; now let's
+ * try to open the logfile to be
+ * scanned
+ * ------------------------------------
+ */
+
+ if ((logmatchTable[iindex].logfile =
+ fopen(logmatchTable[iindex].filename, "r"))) {
+
+
+ /*
+ * ------------------------------------
+ * the log file could be opened; now
+ * let's try to set the pointer
+ * ------------------------------------
+ */
+
+ if (!fseek
+ (logmatchTable[iindex].logfile, pos, SEEK_SET)) {
+
+
+ /*
+ * ------------------------------------
+ * the pointer could be set - this is
+ * the most that we can do: if the
+ * pointer is smaller than the file
+ * size we must assume that the pointer
+ * still points to where it read the
+ * file last time; let's restore the
+ * data
+ * ------------------------------------
+ */
+
+ logmatchTable[iindex].currentFilePosition = pos;
+ logmatchTable[iindex].currentMatchCounter =
+ ccounter;
+ logmatchTable[iindex].globalMatchCounter = counter;
+ }
+
+ fclose(logmatchTable[iindex].logfile);
+ }
+ }
+
+ fclose(perfile);
+ }
+
+ logmatchTable[iindex].virgin = FALSE;
+ }
+
+
+ /*
+ * ------------------------------------
+ * now the pointer and the counter are
+ * set either zero or reset to old
+ * value; now let's try to read some
+ * data
+ * ------------------------------------
+ */
+
+ if (stat(logmatchTable[iindex].filename, &sb) == 0) {
+
+ if (logmatchTable[iindex].currentFilePosition > sb.st_size) {
+ toobig = TRUE;
+ } else {
+ toobig = FALSE;
+ }
+
+ if ((logmatchTable[iindex].logfile =
+ fopen(logmatchTable[iindex].filename, "r"))) {
+
+ result =
+ fseek(logmatchTable[iindex].logfile,
+ logmatchTable[iindex].currentFilePosition, SEEK_SET);
+
+ if (result || toobig || (errno == EINVAL)
+ || feof(logmatchTable[iindex].logfile)) {
+
+
+ /*
+ * ------------------------------------
+ * when we are here that means we
+ * could't set the file position maybe
+ * the file was rotated; let's reset
+ * the filepointer, but not the counter
+ * ------------------------------------
+ */
+
+
+ logmatchTable[iindex].currentFilePosition = 0;
+ logmatchTable[iindex].currentMatchCounter = 0;
+ fseek(logmatchTable[iindex].logfile, 0, SEEK_SET);
+ anyChanges = TRUE;
+ }
+
+ while (fgets
+ (inbuf, sizeof(inbuf), logmatchTable[iindex].logfile)) {
+
+ matchResultCode =
+ regexec(&(logmatchTable[iindex].regexBuffer),
+ inbuf, 0, &myMatch, REG_NOTEOL);
+
+ if (matchResultCode == 0) {
+ logmatchTable[iindex].globalMatchCounter++;
+ logmatchTable[iindex].currentMatchCounter++;
+ logmatchTable[iindex].matchCounter++;
+ anyChanges = TRUE;
+ }
+ }
+
+ logmatchTable[iindex].currentFilePosition =
+ ftell(logmatchTable[iindex].logfile);
+ fclose(logmatchTable[iindex].logfile);
+ }
+ }
+
+
+ /*
+ * ------------------------------------
+ * at this point we can be safe that
+ * our current file position is
+ * straightened out o.k. - we never
+ * know if this is the last time we are
+ * being called so save the position
+ * in a file
+ * ------------------------------------
+ */
+
+ if (anyChanges && (perfile = fopen(perfilename, "w"))) {
+
+
+ /*
+ * ------------------------------------
+ * o.k. lets write out our variable
+ * ------------------------------------
+ */
+
+ fprintf(perfile, "%lu %lu %lu\n",
+ logmatchTable[iindex].currentFilePosition,
+ logmatchTable[iindex].currentMatchCounter,
+ logmatchTable[iindex].globalMatchCounter);
+
+ fclose(perfile);
+ }
+
+}
+
+
+void
+updateLogmatch_Scheduled(unsigned int registrationNumber,
+ struct logmatchstat *logmatchtable)
+{
+
+ updateLogmatch(logmatchtable->thisIndex);
+}
+
+
+
+
+/*
+ * OID functions
+ */
+
+u_char *
+var_logmatch_table(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+ static char message[1024];
+ int iindex;
+ struct logmatchstat *logmatch;
+
+ if (vp->magic == LOGMATCH_INFO) {
+ if (header_generic(vp, name, length, exact, var_len, write_method)
+ == MATCH_FAILED)
+ return (NULL);
+ } else {
+ if (header_simple_table
+ (vp, name, length, exact, var_len, write_method,
+ logmatchCount))
+ return (NULL);
+ }
+
+
+ iindex = name[*length - 1] - 1;
+ logmatch = &logmatchTable[iindex];
+
+ if (logmatch->myRegexError == 0)
+ updateLogmatch(iindex);
+
+ switch (vp->magic) {
+ case LOGMATCH_INFO:
+ long_ret = MAXLOGMATCH;
+ return (u_char *) & long_ret;
+
+ case LOGMATCH_INDEX:
+ long_ret = iindex + 1;
+ return (u_char *) & long_ret;
+
+ case LOGMATCH_NAME:
+ *var_len = strlen(logmatch->name);
+ return (u_char *) logmatch->name;
+
+ case LOGMATCH_FILENAME:
+ *var_len = strlen(logmatch->filename);
+ return (u_char *) logmatch->filename;
+
+ case LOGMATCH_REGEX:
+ *var_len = strlen(logmatch->regEx);
+ return (u_char *) logmatch->regEx;
+
+ case LOGMATCH_GLOBALCTR:
+ case LOGMATCH_GLOBALCNT:
+ long_ret = (logmatch->globalMatchCounter);
+ return (u_char *) & long_ret;
+
+ case LOGMATCH_CURRENTCTR:
+ case LOGMATCH_CURRENTCNT:
+ long_ret = (logmatch->currentMatchCounter);
+ return (u_char *) & long_ret;
+
+ case LOGMATCH_COUNTER:
+ case LOGMATCH_COUNT:
+ long_ret = (logmatch->matchCounter);
+ logmatch->matchCounter = 0;
+ return (u_char *) & long_ret;
+
+ case LOGMATCH_FREQ:
+ long_ret = logmatch->frequency;
+ return (u_char *) & long_ret;
+
+ case LOGMATCH_ERROR:
+ if (logmatch->frequency >= 0 && logmatch->myRegexError == 0)
+ long_ret = 0;
+ else
+ long_ret = 1;
+
+ return (u_char *) & long_ret;
+
+ case LOGMATCH_MSG:
+
+ regerror(logmatch->myRegexError, &(logmatch->regexBuffer), message,
+ sizeof(message));
+
+ *var_len = strlen(message);
+ return (u_char *) message;
+
+ default:
+ DEBUGMSGTL(("snmpd", "unknown sub-id %d in var_logmatch_table\n",
+ vp->magic));
+ }
+
+ return NULL;
+}
+
+#endif /* HAVE_REGEX */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/logmatch.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/logmatch.h
new file mode 100644
index 0000000000..eb2c0700ba
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/logmatch.h
@@ -0,0 +1,57 @@
+/*
+ * Template MIB group interface - logmatch.h
+ *
+ */
+#ifndef _MIBGROUP_LOGMATCH_H
+#define _MIBGROUP_LOGMATCH_H
+
+#include "mibdefs.h"
+#include <regex.h>
+
+struct logmatchstat {
+ char filename[256];
+ char regEx[256];
+ char name[256];
+ FILE *logfile;
+ long currentFilePosition;
+ unsigned long globalMatchCounter;
+ unsigned long currentMatchCounter;
+ unsigned long matchCounter;
+ regex_t regexBuffer;
+ int myRegexError;
+ int virgin;
+ int thisIndex;
+ int frequency;
+};
+void init_logmatch(void);
+
+
+/*
+ * config logmatch parsing routines
+ */
+void logmatch_free_config(void);
+void logmatch_parse_config(const char *, char *);
+void updateLogmatch_Scheduled(unsigned int,
+ struct logmatchstat *);
+extern FindVarMethod var_logmatch_table;
+
+
+
+#define LOGMATCH_ERROR_MSG "%s: size exceeds %dkb (= %dkb)"
+
+#define LOGMATCH_INFO 0
+#define LOGMATCH_INDEX 1
+#define LOGMATCH_NAME 2
+#define LOGMATCH_FILENAME 3
+#define LOGMATCH_REGEX 4
+#define LOGMATCH_GLOBALCTR 5
+#define LOGMATCH_GLOBALCNT 6
+#define LOGMATCH_CURRENTCTR 7
+#define LOGMATCH_CURRENTCNT 8
+#define LOGMATCH_COUNTER 9
+#define LOGMATCH_COUNT 10
+#define LOGMATCH_FREQ 11
+#define LOGMATCH_ERROR 100
+#define LOGMATCH_MSG 101
+
+#endif /* _MIBGROUP_LOGMATCH_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory.c
new file mode 100644
index 0000000000..109e96fca1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory.c
@@ -0,0 +1,231 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.9 2005/01/07 09:37:18 dts12 Exp $
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/hardware/memory.h>
+#include "memory.h"
+
+#define DEFAULTMINIMUMSWAP 16000 /* kilobytes */
+int memory_object_index;
+int minimum_swap;
+
+/** Initializes the memory module */
+void
+init_memory(void)
+{
+ static oid memory_oid[] = { 1, 3, 6, 1, 4, 1, 2021, 4 };
+ static oid memSwapError_oid[] = { 1, 3, 6, 1, 4, 1, 2021, 4, 100 };
+ static oid memSwapErrMsg_oid[] = { 1, 3, 6, 1, 4, 1, 2021, 4, 101 };
+
+ DEBUGMSGTL(("memory", "Initializing\n"));
+
+ memory_object_index = OID_LENGTH(memory_oid);
+ netsnmp_register_scalar_group(
+ netsnmp_create_handler_registration("memory", handle_memory,
+ memory_oid, memory_object_index,
+ HANDLER_CAN_RONLY),
+ 1, 17);
+ netsnmp_register_scalar(
+ netsnmp_create_handler_registration("memSwapError", handle_memory,
+ memSwapError_oid, memory_object_index+1,
+ HANDLER_CAN_RONLY));
+ netsnmp_register_scalar(
+ netsnmp_create_handler_registration("memSwapErrMsg", handle_memory,
+ memSwapErrMsg_oid, memory_object_index+1,
+ HANDLER_CAN_RONLY));
+
+ snmpd_register_config_handler("swap", memory_parse_config,
+ memory_free_config, "min-avail");
+}
+
+void
+memory_parse_config(const char *token, char *cptr)
+{
+ minimum_swap = atoi(cptr);
+}
+
+void
+memory_free_config(void)
+{
+ minimum_swap = DEFAULTMINIMUMSWAP;
+}
+
+int
+handle_memory(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ netsnmp_memory_info *mem_info;
+ int val;
+ char buf[1024];
+
+ /*
+ * We just need to handle valid GET requests, as invalid instances
+ * are rejected automatically, and (valid) GETNEXT requests are
+ * converted into the appropriate GET request.
+ *
+ * We also only ever receive one request at a time.
+ */
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ netsnmp_memory_load();
+ switch (requests->requestvb->name[ memory_object_index ]) {
+ case MEMORY_INDEX:
+ val = 0;
+ break;
+ case MEMORY_ERRNAME:
+ sprintf(buf, "swap");
+ snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
+ (u_char *)buf, strlen(buf));
+ return SNMP_ERR_NOERROR;
+ case MEMORY_SWAP_TOTAL:
+ mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 0 );
+ if (!mem_info)
+ goto NOSUCH;
+ val = mem_info->size; /* swaptotal */
+ val *= (mem_info->units/1024);
+ break;
+ case MEMORY_SWAP_AVAIL:
+ mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 0 );
+ if (!mem_info)
+ goto NOSUCH;
+ val = mem_info->free; /* swapfree */
+ val *= (mem_info->units/1024);
+ break;
+ case MEMORY_REAL_TOTAL:
+ mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 0 );
+ if (!mem_info)
+ goto NOSUCH;
+ val = mem_info->size; /* memtotal */
+ val *= (mem_info->units/1024);
+ break;
+ case MEMORY_REAL_AVAIL:
+ mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_PHYSMEM, 0 );
+ if (!mem_info)
+ goto NOSUCH;
+ val = mem_info->free; /* memfree */
+ val *= (mem_info->units/1024);
+ break;
+ case MEMORY_STXT_TOTAL:
+ mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_STEXT, 0 );
+ if (!mem_info)
+ goto NOSUCH;
+ val = mem_info->size;
+ val *= (mem_info->units/1024);
+ break;
+ case MEMORY_STXT_AVAIL: /* Deprecated */
+ case MEMORY_STXT_USED:
+ /*
+ * The original MIB description of memAvailSwapTXT
+ * was inconsistent with that implied by the name.
+ * Retain the actual behaviour for the (sole)
+ * implementation of this object, but deprecate it in
+ * favour of a more consistently named replacement object.
+ */
+ mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_STEXT, 0 );
+ if (!mem_info)
+ goto NOSUCH;
+ val = (mem_info->size - mem_info->free);
+ val *= (mem_info->units/1024);
+ break;
+ case MEMORY_RTXT_TOTAL:
+ mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_RTEXT, 0 );
+ if (!mem_info)
+ goto NOSUCH;
+ val = mem_info->size;
+ val *= (mem_info->units/1024);
+ break;
+ case MEMORY_RTXT_AVAIL: /* Deprecated */
+ case MEMORY_RTXT_USED:
+ /*
+ * The original MIB description of memAvailRealTXT
+ * was inconsistent with that implied by the name.
+ * Retain the actual behaviour for the (sole)
+ * implementation of this object, but deprecate it in
+ * favour of a more consistently named replacement object.
+ */
+ mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_RTEXT, 0 );
+ if (!mem_info)
+ goto NOSUCH;
+ val = (mem_info->size - mem_info->free);
+ val *= (mem_info->units/1024);
+ break;
+ case MEMORY_FREE:
+ mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_VIRTMEM, 0 );
+ if (!mem_info)
+ goto NOSUCH;
+ val = mem_info->free; /* memfree + swapfree */
+ val *= (mem_info->units/1024);
+ break;
+ case MEMORY_SWAP_MIN:
+ val = minimum_swap;
+ break;
+ case MEMORY_SHARED:
+ mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SHARED, 0 );
+ if (!mem_info)
+ goto NOSUCH;
+ val = mem_info->size; /* memshared */
+ val *= (mem_info->units/1024);
+ break;
+ case MEMORY_BUFFER:
+ mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_MBUF, 0 );
+ if (!mem_info || mem_info->size == -1)
+ goto NOSUCH;
+ val = (mem_info->size - mem_info->free); /* buffers */
+ val *= (mem_info->units/1024);
+ break;
+ case MEMORY_CACHED:
+ mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_CACHED, 0 );
+ if (!mem_info || mem_info->size== -1)
+ goto NOSUCH;
+ val = (mem_info->size - mem_info->free); /* cached */
+ val *= (mem_info->units/1024);
+ break;
+ case MEMORY_SWAP_ERROR:
+ mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 0 );
+ if (!mem_info)
+ goto NOSUCH;
+ val = ((mem_info->units / 1024) * mem_info->free > minimum_swap) ? 0 : 1;
+ break;
+ case MEMORY_SWAP_ERRMSG:
+ mem_info = netsnmp_memory_get_byIdx( NETSNMP_MEM_TYPE_SWAP, 0 );
+ if (!mem_info)
+ goto NOSUCH;
+ if ((mem_info->units / 1024) * mem_info->free > minimum_swap)
+ buf[0] = 0;
+ else
+ sprintf(buf, "Running out of swap space (%ld)", mem_info->free);
+ snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
+ (u_char *)buf, strlen(buf));
+ return SNMP_ERR_NOERROR;
+ default:
+ snmp_log(LOG_ERR, "unknown object (%lu) in handle_memory\n",
+ requests->requestvb->name[ memory_object_index ]);
+NOSUCH:
+ netsnmp_set_request_error( reqinfo, requests, SNMP_NOSUCHOBJECT );
+ return SNMP_ERR_NOERROR;
+ }
+ /*
+ * All non-integer objects (and errors) have already been
+ * processed. So return the integer value.
+ */
+ snmp_set_var_typed_value(requests->requestvb, ASN_INTEGER,
+ (u_char *)&val, sizeof(val));
+ break;
+
+ default:
+ /*
+ * we should never get here, so this is a really bad error
+ */
+ snmp_log(LOG_ERR, "unknown mode (%d) in handle_memory\n",
+ reqinfo->mode);
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory.h
new file mode 100644
index 0000000000..a44d82e51a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory.h
@@ -0,0 +1,37 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : mib2c.scalar.conf,v 1.9 2005/01/07 09:37:18 dts12 Exp $
+ */
+#ifndef MEMORY_H
+#define MEMORY_H
+
+config_require(hardware/memory)
+
+/*
+ * function declarations
+ */
+void init_memory(void);
+void memory_parse_config(const char *token, char *cptr);
+void memory_free_config(void);
+Netsnmp_Node_Handler handle_memory;
+
+#define MEMORY_INDEX 1
+#define MEMORY_ERRNAME 2
+#define MEMORY_SWAP_TOTAL 3
+#define MEMORY_SWAP_AVAIL 4
+#define MEMORY_REAL_TOTAL 5
+#define MEMORY_REAL_AVAIL 6
+#define MEMORY_STXT_TOTAL 7
+#define MEMORY_STXT_AVAIL 8 /* Deprecated */
+#define MEMORY_RTXT_TOTAL 9
+#define MEMORY_RTXT_AVAIL 10 /* Deprecated */
+#define MEMORY_FREE 11
+#define MEMORY_SWAP_MIN 12
+#define MEMORY_SHARED 13
+#define MEMORY_BUFFER 14
+#define MEMORY_CACHED 15
+#define MEMORY_STXT_USED 16
+#define MEMORY_RTXT_USED 17
+#define MEMORY_SWAP_ERROR 100
+#define MEMORY_SWAP_ERRMSG 101
+#endif /* MEMORY_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_aix4.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_aix4.c
new file mode 100644
index 0000000000..318eee0a49
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_aix4.c
@@ -0,0 +1,249 @@
+/*
+ * AIX4 memory statistics module for net-snmp
+ *
+ * Version 0.1 - Initial release - 05/Jun/2003
+ *
+ * Derived from memory_solaris2.c
+ * Using libperfstat for statistics (Redbook SG24-6039)
+ *
+ * Ported to AIX by Michael Kukat <michael.kukat@to.com>
+ * Thinking Objects Software GmbH
+ * Lilienthalstraße 2
+ * 70825 Stuttgart-Korntal
+ * http://www.to.com/
+ *
+ * Thanks go to Jochen Kmietsch for the solaris2 support and
+ * to DaimlerChrysler AG Stuttgart for making this port possible
+ */
+
+#include <net-snmp/net-snmp-config.h> /* local SNMP configuration details */
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <sys/types.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h" /* utility function declarations */
+#include "memory.h" /* the module-specific header */
+#include "memory_aix4.h" /* the module-specific header */
+
+#include <libperfstat.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+#define MAXSTRSIZE 80
+
+int minimumswap;
+static char errmsg[1024];
+
+static FindVarMethod var_extensible_mem;
+static long getFreeSwap(void);
+static long getTotalFree(void);
+static long getTotalSwap(void);
+static long getFreeReal(void);
+static long getTotalReal(void);
+
+void
+init_memory_aix4(void)
+{
+
+ struct variable2 extensible_mem_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_mem, 1,
+ {ERRORNAME}},
+ {MEMTOTALSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALSWAP}},
+ {MEMAVAILSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMAVAILSWAP}},
+ {MEMTOTALREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALREAL}},
+ {MEMAVAILREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMAVAILREAL}},
+ {MEMTOTALSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALSWAPTXT}},
+ {MEMUSEDSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMUSEDSWAPTXT}},
+ {MEMTOTALREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALREALTXT}},
+ {MEMUSEDREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMUSEDREALTXT}},
+ {MEMTOTALFREE, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALFREE}},
+ {MEMSWAPMINIMUM, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMSWAPMINIMUM}},
+ {MEMSHARED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMSHARED}},
+ {MEMBUFFER, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMBUFFER}},
+ {MEMCACHED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMCACHED}},
+ {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {ERRORFLAG}},
+ {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_mem, 1, {ERRORMSG}}
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid mem_variables_oid[] = { NETSNMP_UCDAVIS_MIB, NETSNMP_MEMMIBNUM };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/memory", extensible_mem_variables, variable2,
+ mem_variables_oid);
+
+ snmpd_register_config_handler("swap", memory_parse_config,
+ memory_free_config, "min-avail");
+
+}
+
+static u_char *
+var_extensible_mem(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+
+ /*
+ * Initialize the return value to 0
+ */
+ long_ret = 0;
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return (NULL);
+
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = 0;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* dummy name */
+ sprintf(errmsg, "swap");
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case MEMTOTALSWAP:
+ long_ret = getTotalSwap() * (getpagesize() / 1024);
+ return ((u_char *) (&long_ret));
+ case MEMAVAILSWAP:
+ long_ret = getFreeSwap() * (getpagesize() / 1024);
+ return ((u_char *) (&long_ret));
+ case MEMSWAPMINIMUM:
+ long_ret = minimumswap;
+ return ((u_char *) (&long_ret));
+ case MEMTOTALREAL:
+ long_ret = getTotalReal() * (getpagesize() / 1024);
+ return ((u_char *) (&long_ret));
+ case MEMAVAILREAL:
+ long_ret = getFreeReal() * (getpagesize() / 1024);
+ return ((u_char *) (&long_ret));
+ case MEMTOTALFREE:
+ long_ret = getTotalFree() * (getpagesize() / 1024);
+ return ((u_char *) (&long_ret));
+
+ case ERRORFLAG:
+ long_ret = getTotalFree() * (getpagesize() / 1024);
+ long_ret = (long_ret > minimumswap) ? 0 : 1;
+ return ((u_char *) (&long_ret));
+
+ case ERRORMSG:
+ long_ret = getTotalFree() * (getpagesize() / 1024);
+ if ((long_ret > minimumswap) ? 0 : 1)
+ sprintf(errmsg, "Running out of swap space (%ld)", long_ret);
+ else
+ errmsg[0] = 0;
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+
+ }
+
+ return (NULL);
+}
+
+#define DEFAULTMINIMUMSWAP 16000 /* kilobytes */
+
+void
+memory_parse_config(const char *token, char *cptr)
+{
+ minimumswap = atoi(cptr);
+}
+
+void
+memory_free_config(void)
+{
+ minimumswap = DEFAULTMINIMUMSWAP;
+}
+
+static long
+getTotalSwap(void)
+{
+ long total_mem = -1;
+ perfstat_memory_total_t mem;
+
+ if(perfstat_memory_total((perfstat_id_t *)NULL, &mem, sizeof(perfstat_memory_total_t), 1) >= 1) {
+ total_mem = mem.pgsp_total;
+ }
+
+ return (total_mem);
+}
+
+static long
+getFreeSwap(void)
+{
+ long free_mem = -1;
+ perfstat_memory_total_t mem;
+
+ if(perfstat_memory_total((perfstat_id_t *)NULL, &mem, sizeof(perfstat_memory_total_t), 1) >= 1) {
+ free_mem = mem.pgsp_free;
+ }
+
+ return (free_mem);
+}
+
+static long
+getTotalFree(void)
+{
+ long free_mem = -1;
+ perfstat_memory_total_t mem;
+
+ if(perfstat_memory_total((perfstat_id_t *)NULL, &mem, sizeof(perfstat_memory_total_t), 1) >= 1) {
+ free_mem = mem.pgsp_free + mem.real_free;
+ }
+
+ return (free_mem);
+}
+
+static long
+getTotalReal(void)
+{
+ long total_mem = -1;
+ perfstat_memory_total_t mem;
+
+ if(perfstat_memory_total((perfstat_id_t *)NULL, &mem, sizeof(perfstat_memory_total_t), 1) >= 1) {
+ total_mem = mem.real_total;
+ }
+
+ return (total_mem);
+}
+
+static long
+getFreeReal(void)
+{
+ long free_mem = -1;
+ perfstat_memory_total_t mem;
+
+ if(perfstat_memory_total((perfstat_id_t *)NULL, &mem, sizeof(perfstat_memory_total_t), 1) >= 1) {
+ free_mem = mem.real_free;
+ }
+
+ return (free_mem);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_aix4.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_aix4.h
new file mode 100644
index 0000000000..9f58041bd3
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_aix4.h
@@ -0,0 +1,12 @@
+/*
+ * memory quantity mib groups
+ *
+ */
+#ifndef _MIBGROUP_MEMORY_AIX4_H
+#define _MIBGROUP_MEMORY_AIX4_H
+
+#include "mibdefs.h"
+
+void init_memory_aix4(void);
+
+#endif /* _MIBGROUP_MEMORY_AIX4_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_darwin7.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_darwin7.c
new file mode 100644
index 0000000000..79cc4c9183
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_darwin7.c
@@ -0,0 +1,394 @@
+/*
+ * memory_darwin7.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+
+/*
+ * Ripped from /usr/scr/usr.bin/vmstat/vmstat.c (covering all bases)
+ */
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#include <sys/dkstat.h>
+#include <sys/buf.h>
+#include <sys/uio.h>
+#include <sys/malloc.h>
+#include <sys/signal.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+#include <sys/stat.h>
+
+#include <time.h>
+#include <nlist.h>
+#include <kvm.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+#include <limits.h>
+#include <mach/mach.h>
+#include <dirent.h>
+
+#if HAVE_DMALLOC_H
+#include <dmalloc.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"
+#include "memory.h"
+#include "memory_darwin7.h"
+
+/*
+ * * Swap info
+ * */
+/*off_t swapTotal;
+off_t swapUsed;
+off_t swapFree;
+*/
+
+/*
+ * Default swap warning limit (kb)
+ */
+#define DEFAULTMINIMUMSWAP 16000
+
+/*
+ * Swap warning limit
+ */
+long minimumswap;
+
+static FindVarMethod var_extensible_mem;
+
+void
+init_memory_darwin7(void)
+{
+
+ struct variable2 extensible_mem_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_mem, 1, {ERRORNAME}},
+ {MEMTOTALSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MEMTOTALSWAP}},
+ {MEMAVAILSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MEMAVAILSWAP}},
+ {MEMTOTALREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MEMTOTALREAL}},
+ {MEMAVAILREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MEMAVAILREAL}},
+ {MEMTOTALSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MEMTOTALSWAPTXT}},
+ {MEMUSEDSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MEMUSEDSWAPTXT}},
+ {MEMTOTALREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MEMTOTALREALTXT}},
+ {MEMUSEDREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MEMUSEDREALTXT}},
+ {MEMTOTALFREE, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MEMTOTALFREE}},
+ {MEMSWAPMINIMUM, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MEMSWAPMINIMUM}},
+ {MEMSHARED, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MEMSHARED}},
+ {MEMBUFFER, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MEMBUFFER}},
+ {MEMCACHED, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MEMCACHED}},
+ {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_mem, 1, {ERRORFLAG}},
+ {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_mem, 1, {ERRORMSG}}
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid mem_variables_oid[] = { NETSNMP_UCDAVIS_MIB, NETSNMP_MEMMIBNUM };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/memory", extensible_mem_variables, variable2,
+ mem_variables_oid);
+
+ snmpd_register_config_handler("swap", memory_parse_config,
+ memory_free_config, "min-avail");
+}
+
+
+void
+memory_parse_config(const char *token, char *cptr)
+{
+ minimumswap = atoi(cptr);
+}
+
+void
+memory_free_config(void)
+{
+ minimumswap = DEFAULTMINIMUMSWAP;
+}
+
+off_t
+swapsize(void)
+{
+ int pagesize;
+ int i, n;
+ DIR *dirp;
+ struct dirent *dp;
+ struct stat buf;
+ char errmsg[1024];
+ char full_name[1024];
+ off_t swapSize;
+
+ /* we set the size to -1 if we're not supported */
+ swapSize = -1;
+
+#if defined(SWAPFILE_DIR) && defined(SWAPFILE_PREFIX)
+ dirp = opendir((const char *) SWAPFILE_DIR);
+ while((dp = readdir(dirp)) != NULL) {
+ /* if the file starts with the same as SWAPFILE_PREFIX
+ * we want to stat the file to get it's size
+ */
+ if(strspn(dp->d_name,(char *) SWAPFILE_PREFIX) == strlen((char *) SWAPFILE_PREFIX)) {
+ sprintf(full_name,"%s/%s",SWAPFILE_DIR,dp->d_name);
+ /* we need to stat each swapfile to get it's size */
+ if(stat(full_name,&buf) != 0) {
+ sprintf(errmsg, "swapsize: can't stat file %s",full_name);
+ snmp_log_perror(errmsg);
+ } else {
+ /* total swap allocated is the size of
+ * all the swapfile's that exist in
+ * the SWAPFILE_DIR dir
+ */
+ swapSize += buf.st_size;
+ }
+ }
+
+ }
+ closedir(dirp);
+#endif
+
+ return swapSize;
+
+}
+
+
+/*
+ * var_extensible_mem(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+
+static unsigned char *
+var_extensible_mem(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+ static char errmsg[1024];
+ /* the getting used swap routine takes awhile, so we
+ * do not want to run it often, so we use a cache to
+ * keep from updating it too often
+ */
+ static time_t prev_time;
+ time_t cur_time = time((time_t *)NULL);
+
+ int mib[2];
+
+ u_long phys_mem;
+ size_t phys_mem_size = sizeof(phys_mem);
+
+ int pagesize;
+ size_t pagesize_size = sizeof(pagesize);
+
+ u_long pages_used;
+
+ off_t swapFree;
+ static off_t swapUsed;
+ off_t swapSize;
+
+ /* for host_statistics() */
+ vm_statistics_data_t vm_stat;
+ int count = HOST_VM_INFO_COUNT;
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return (NULL);
+
+ mib[0] = CTL_HW;
+ mib[1] = HW_PHYSMEM;
+
+ /*
+ * Physical memory
+ */
+ if(sysctl(mib, 2, &phys_mem, &phys_mem_size, NULL, 0) == -1)
+ snmp_log_perror("sysctl: phys_mem");
+
+ /*
+ * Pagesize
+ */
+ mib[1] = HW_PAGESIZE;
+ if(sysctl(mib, 2, &pagesize, &pagesize_size, NULL, 0) == -1)
+ snmp_log_perror("sysctl: pagesize");
+ /*
+ * used memory
+ */
+ host_statistics(mach_host_self(),HOST_VM_INFO,&vm_stat,&count);
+ pages_used = vm_stat.active_count + vm_stat.inactive_count + vm_stat.wire_count;
+ /*
+ * Page-to-kb macro
+ */
+#define ptok(p) ((p) * (pagesize >> 10))
+
+ /*
+ * swap info
+ */
+
+ swapSize = swapsize();
+ /* if it's been less then 30 seconds since the
+ * last run, don't call the pages_swapped()
+ * routine yet */
+ if(cur_time > prev_time + 30) {
+ swapUsed = (off_t) pages_swapped();
+ prev_time = time((time_t *)NULL);
+ }
+ swapFree = swapSize - (swapUsed * pagesize);
+
+ long_ret = 0; /* set to 0 as default */
+
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = 0;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* dummy name */
+ sprintf(errmsg, "swap");
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case MEMTOTALSWAP:
+ long_ret = swapSize >> 10;
+ return ((u_char *) (&long_ret));
+ case MEMAVAILSWAP: /* FREE swap memory */
+ long_ret = swapFree >> 10;
+ return ((u_char *) (&long_ret));
+ case MEMTOTALREAL:
+ long_ret = phys_mem >> 10;
+ return ((u_char *) (&long_ret));
+ case MEMAVAILREAL: /* FREE real memory */
+ long_ret = (phys_mem >> 10) - (ptok(pages_used));
+ return ((u_char *) (&long_ret));
+ case MEMSWAPMINIMUM:
+ long_ret = minimumswap;
+ return ((u_char *) (&long_ret));
+ /*
+ * these are not implemented
+ */
+ case MEMTOTALSWAPTXT:
+ case MEMUSEDSWAPTXT:
+ case MEMTOTALREALTXT:
+ case MEMUSEDREALTXT:
+ case MEMTOTALFREE:
+ case MEMSHARED:
+ case MEMBUFFER:
+ case MEMCACHED:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_ret = -1;
+ return ((u_char *) (&long_ret));
+
+ case ERRORFLAG:
+ long_ret = (swapFree > minimumswap) ? 0 : 1;
+ return ((u_char *) (&long_ret));
+ case ERRORMSG:
+ if (swapFree < minimumswap)
+ sprintf(errmsg, "Running out of swap space (%qd)", swapFree);
+ else
+ errmsg[0] = 0;
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ }
+ return NULL;
+}
+
+
+/* get the number of pages that are swapped out */
+/* we think this is correct and are valid values */
+/* but not sure. time will tell if it's correct */
+/* Note: this routine is _expensive_!!! we run this */
+/* as little as possible by caching it's return so */
+/* it's not run on every poll */
+/* Apple, please give us a better way! :) */
+int pages_swapped(void) {
+ boolean_t retval;
+ kern_return_t error;
+ processor_set_t *psets, pset;
+ task_t *tasks;
+ unsigned i, j, pcnt, tcnt;
+ int pid;
+ mach_msg_type_number_t count;
+ vm_address_t address;
+ mach_port_t object_name;
+ vm_region_extended_info_data_t info;
+ vm_size_t size;
+ mach_port_t mach_port;
+ int swapped_pages;
+ int swapped_pages_total = 0;
+ char errmsg[1024];
+
+
+ mach_port = mach_host_self();
+ error = host_processor_sets(mach_port, &psets, &pcnt);
+ if (error != KERN_SUCCESS) {
+ sprintf(errmsg, "Error in host_processor_sets(): %s\n", mach_error_string(error));
+ snmp_log_perror(errmsg);
+ return(0);
+ }
+
+ for (i = 0; i < pcnt; i++) {
+ error = host_processor_set_priv(mach_port, psets[i], &pset);
+ if (error != KERN_SUCCESS) {
+ sprintf(errmsg,"Error in host_processor_set_priv(): %s\n", mach_error_string(error));
+ snmp_log_perror(errmsg);
+ return(0);
+ }
+
+ error = processor_set_tasks(pset, &tasks, &tcnt);
+ if (error != KERN_SUCCESS) {
+ sprintf(errmsg,"Error in processor_set_tasks(): %s\n", mach_error_string(error));
+ snmp_log_perror(errmsg);
+ return(0);
+ }
+
+ for (j = 0; j < tcnt; j++) {
+ error = pid_for_task(tasks[j], &pid);
+ if (error != KERN_SUCCESS) {
+ /* Not a process, or the process is gone. */
+ continue;
+ }
+
+ swapped_pages = 0;
+ for (address = 0;; address += size) {
+ /* Get memory region. */
+ count = VM_REGION_EXTENDED_INFO_COUNT;
+ if (vm_region(tasks[j], &address, &size, VM_REGION_EXTENDED_INFO, (vm_region_extended_info_t)&info, &count, &object_name) != KERN_SUCCESS) {
+ /* No more memory regions. */
+ break;
+ }
+
+ if(info.pages_swapped_out > 0) {
+ swapped_pages += info.pages_swapped_out;
+ }
+ }
+
+ if(swapped_pages > 0) {
+ swapped_pages_total += swapped_pages;
+ }
+
+ if (tasks[j] != mach_task_self()) {
+ mach_port_deallocate(mach_task_self(), tasks[j]);
+ }
+ }
+ }
+
+ return(swapped_pages_total);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_darwin7.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_darwin7.h
new file mode 100644
index 0000000000..efa99c8250
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_darwin7.h
@@ -0,0 +1,12 @@
+/*
+ * memory quantity mib groups
+ *
+ */
+#ifndef _MIBGROUP_MEMORY_DARWIN7_H
+#define _MIBGROUP_MEMORY_DARWIN7_H
+
+#include "mibdefs.h"
+
+extern void init_memory_darwin7(void);
+
+#endif /* _MIBGROUP_MEMORY_DARWIN7_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_dynix.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_dynix.c
new file mode 100644
index 0000000000..b1d6cb3cae
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_dynix.c
@@ -0,0 +1,227 @@
+#include <net-snmp/net-snmp-config.h>
+
+#ifdef dynix
+# ifdef HAVE_SYS_SWAP_H
+# include <sys/swap.h>
+# endif
+# ifdef HAVE_SYS_PARAM_H
+# include <sys/param.h>
+# endif
+# ifdef HAVE_UNISTD_H
+# include <unistd.h>
+# endif
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+
+#include "util_funcs.h" /* utility function declarations */
+#include "memory.h" /* the module-specific header */
+#include "memory_dynix.h" /* the module-specific header */
+
+int minimumswap;
+static char errmsg[1024];
+
+static FindVarMethod var_extensible_mem;
+static long getFreeSwap(void);
+static long getTotalSwap(void);
+static long getTotalFree(void);
+
+void
+init_memory_dynix(void)
+{
+
+ struct variable2 extensible_mem_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_mem, 1,
+ {ERRORNAME}},
+ {MEMTOTALSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALSWAP}},
+ {MEMAVAILSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMAVAILSWAP}},
+ {MEMTOTALREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALREAL}},
+ {MEMAVAILREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMAVAILREAL}},
+ {MEMTOTALSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALSWAPTXT}},
+ {MEMUSEDSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMUSEDSWAPTXT}},
+ {MEMTOTALREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALREALTXT}},
+ {MEMUSEDREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMUSEDREALTXT}},
+ {MEMTOTALFREE, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALFREE}},
+ {MEMSWAPMINIMUM, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMSWAPMINIMUM}},
+ {MEMSHARED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMSHARED}},
+ {MEMBUFFER, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMBUFFER}},
+ {MEMCACHED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMCACHED}},
+ {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {ERRORFLAG}},
+ {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_mem, 1, {ERRORMSG}}
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid mem_variables_oid[] = { NETSNMP_UCDAVIS_MIB, NETSNMP_MEMMIBNUM };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/memory", extensible_mem_variables, variable2,
+ mem_variables_oid);
+
+ snmpd_register_config_handler("swap", memory_parse_config,
+ memory_free_config, "min-avail");
+
+}
+
+static u_char *
+var_extensible_mem(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+
+ /*
+ * Initialize the return value to 0
+ */
+ long_ret = 0;
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return (NULL);
+
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = 0;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* dummy name */
+ sprintf(errmsg, "swap");
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case MEMTOTALSWAP:
+ long_ret = S2KB(getTotalSwap());
+ return ((u_char *) (&long_ret));
+ case MEMAVAILSWAP:
+ long_ret = S2KB(getFreeSwap());
+ return ((u_char *) (&long_ret));
+ case MEMSWAPMINIMUM:
+ long_ret = minimumswap;
+ return ((u_char *) (&long_ret));
+ case MEMTOTALREAL:
+ long_ret = P2KB(sysconf(_SC_PHYSMEM));
+ return ((u_char *) (&long_ret));
+ case MEMAVAILREAL:
+ long_ret = P2KB(sysconf(_SC_FREEMEM));
+ return ((u_char *) (&long_ret));
+ case MEMTOTALFREE:
+ long_ret = getTotalFree();
+ return ((u_char *) (&long_ret));
+
+ case ERRORFLAG:
+ long_ret = getTotalFree();
+ long_ret = (long_ret > minimumswap) ? 0 : 1;
+ return ((u_char *) (&long_ret));
+
+ case ERRORMSG:
+ long_ret = getTotalFree();
+ if ((long_ret > minimumswap) ? 0 : 1)
+ sprintf(errmsg, "Running out of swap space (%ld)", long_ret);
+ else
+ errmsg[0] = 0;
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+
+ }
+
+ return (NULL);
+}
+
+#define DEFAULTMINIMUMSWAP 16384 /* kilobytes */
+
+void
+memory_parse_config(const char *token, char *cptr)
+{
+ minimumswap = atoi(cptr);
+}
+
+void
+memory_free_config(void)
+{
+ minimumswap = DEFAULTMINIMUMSWAP;
+}
+
+
+
+/*
+ * return is in sectors
+ */
+long
+getTotalSwap(void)
+{
+ long total_swp_sectors = -1;
+
+ size_t max_elements = MAXSWAPDEVS;
+ swapsize_t swap_dblks[MAXSWAPDEVS];
+ swapstat_t swap_status;
+ int swap_sizes;
+
+ if ((swap_sizes =
+ getswapstat(max_elements, swap_dblks, &swap_status) >= 0))
+ total_swp_sectors =
+ swap_dblks[0].sws_size * swap_dblks[0].sws_total;
+
+ return (total_swp_sectors);
+}
+
+/*
+ * return is in sectors
+ */
+static long
+getFreeSwap(void)
+{
+ long free_swp_sectors = -1;
+
+ size_t max_elements = MAXSWAPDEVS;
+ swapsize_t swap_dblks[MAXSWAPDEVS];
+ swapstat_t swap_status;
+ int i, swap_sizes;
+
+ if ((swap_sizes =
+ getswapstat(max_elements, swap_dblks, &swap_status) >= 0)) {
+ for (i = 0; i < swap_sizes; i++)
+ free_swp_sectors +=
+ swap_dblks[0].sws_size * swap_dblks[i].sws_avail;
+ }
+
+ return (free_swp_sectors);
+}
+
+/*
+ * return is in kilobytes
+ */
+static long
+getTotalFree(void)
+{
+ long free_swap = S2KB(getFreeSwap());
+ long free_mem = P2KB(sysconf(_SC_FREEMEM));
+
+ if (free_swap < 0)
+ return (free_swap);
+ if (free_mem < 0)
+ return (free_mem);
+
+ free_mem += free_swap;
+ return (free_mem);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_dynix.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_dynix.h
new file mode 100644
index 0000000000..0a6998d3b6
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_dynix.h
@@ -0,0 +1,27 @@
+/*
+ * memory quantity mib groups
+ *
+ */
+#ifndef _MIBGROUP_MEMORY_DYNIX_H
+#define _MIBGROUP_MEMORY_DYNIX_H
+
+#include "mibdefs.h"
+
+/*
+ * from /usr/include/sys/mc_param.h
+ */
+#define MMU_PAGESIZE 0x1000 /* 4096 bytes */
+
+/*
+ * Here's the correct way to convert sectors to KB
+ * #define S2KB(size) (((size)*DEV_BSIZE)/1024)
+ * Here's the quick way plus no fear of overflow
+ */
+#define S2KB(size) ((size)/2) /* sectors to KB */
+#define S2MB(size) (((size)+1023)/2048) /* sectors to MB */
+#define P2KB(size) ((size)*(MMU_PAGESIZE/1024)) /* pages to KB */
+#define P2MB(size) ((P2KB(size)+511)/1024) /* pages to MB */
+
+void init_memory_dynix(void);
+
+#endif /* _MIBGROUP_MEMORY_DYNIX_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_freebsd2.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_freebsd2.c
new file mode 100644
index 0000000000..72c70184a3
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_freebsd2.c
@@ -0,0 +1,371 @@
+/*
+ * memory_freebsd2.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+
+/*
+ * Ripped from /usr/scr/usr.bin/vmstat/vmstat.c (covering all bases)
+ */
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#include <sys/dkstat.h>
+#ifdef freebsd5
+#include <sys/bio.h>
+#endif
+#include <sys/buf.h>
+#include <sys/uio.h>
+#include <sys/namei.h>
+#include <sys/malloc.h>
+#include <sys/signal.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+
+#if HAVE_SYS_VMPARAM_H
+#include <sys/vmparam.h>
+#else
+#include <vm/vm_param.h>
+#endif
+
+#include <time.h>
+#include <nlist.h>
+#include <kvm.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+#include <limits.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"
+#include "memory.h"
+#include "memory_freebsd2.h"
+
+/*
+ * nlist symbols
+ */
+#define SUM_SYMBOL "cnt"
+#ifndef openbsd2
+#define BUFSPACE_SYMBOL "bufspace"
+#endif
+
+/*
+ * Default swap warning limit (kb)
+ */
+#define DEFAULTMINIMUMSWAP 16000
+
+/*
+ * Swap warning limit
+ */
+long minimumswap;
+
+/*
+ * Swap info
+ */
+quad_t swapTotal;
+quad_t swapUsed;
+quad_t swapFree;
+
+static FindVarMethod var_extensible_mem;
+
+void
+init_memory_freebsd2(void)
+{
+
+ struct variable2 extensible_mem_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_mem, 1,
+ {ERRORNAME}},
+ {MEMTOTALSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALSWAP}},
+ {MEMAVAILSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMAVAILSWAP}},
+ {MEMTOTALREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALREAL}},
+ {MEMAVAILREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMAVAILREAL}},
+ {MEMTOTALSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALSWAPTXT}},
+ {MEMUSEDSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMUSEDSWAPTXT}},
+ {MEMTOTALREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALREALTXT}},
+ {MEMUSEDREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMUSEDREALTXT}},
+ {MEMTOTALFREE, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALFREE}},
+ {MEMSWAPMINIMUM, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMSWAPMINIMUM}},
+ {MEMSHARED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMSHARED}},
+ {MEMBUFFER, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMBUFFER}},
+ {MEMCACHED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMCACHED}},
+ {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {ERRORFLAG}},
+ {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_mem, 1, {ERRORMSG}}
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid mem_variables_oid[] = { NETSNMP_UCDAVIS_MIB, NETSNMP_MEMMIBNUM };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/memory", extensible_mem_variables, variable2,
+ mem_variables_oid);
+
+ snmpd_register_config_handler("swap", memory_parse_config,
+ memory_free_config, "min-avail");
+}
+
+
+void
+memory_parse_config(const char *token, char *cptr)
+{
+ minimumswap = atoi(cptr);
+}
+
+void
+memory_free_config(void)
+{
+ minimumswap = DEFAULTMINIMUMSWAP;
+}
+
+#ifndef freebsd4
+/*
+ * Executes swapinfo and parses last line
+ */
+/*
+ * This is just way too ugly ;)
+ */
+
+void
+swapmode(void)
+{
+ struct extensible ext;
+ int fd;
+ FILE *file;
+
+ strcpy(ext.command, "/usr/sbin/swapinfo -k");
+
+ if ((fd = get_exec_output(&ext)) != -1) {
+ file = fdopen(fd, "r");
+
+ while (fgets(ext.output, sizeof(ext.output), file) != NULL);
+
+ fclose(file);
+ wait_on_exec(&ext);
+
+ sscanf(ext.output, "%*s%*d%qd%qd", &swapUsed, &swapFree);
+
+ swapTotal = swapUsed + swapFree;
+ }
+}
+#else
+/*
+ * swapmode is based on a program called swapinfo written
+ * by Kevin Lahey <kml@rokkaku.atl.ga.us>.
+ */
+
+#include <sys/conf.h>
+
+void
+swapmode(void)
+{
+ int pagesize;
+ int i, n;
+ static kvm_t *kd = NULL;
+ struct kvm_swap kswap[16];
+
+ if (kd == NULL)
+ kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
+
+ n = kvm_getswapinfo(kd, kswap, sizeof(kswap) / sizeof(kswap[0]), 0);
+
+ swapUsed = swapTotal = swapFree = 0;
+ /*
+ * Count up free swap space.
+ */
+ for (i = 0; i < n; ++i)
+ swapFree += kswap[i].ksw_total - kswap[i].ksw_used;
+
+ /*
+ * Count up total swap space
+ */
+ for (i = 0; i < n; i++)
+ swapTotal += kswap[i].ksw_total;
+
+ /*
+ * Calculate used swap space
+ */
+ swapUsed = swapTotal - swapFree;
+
+ /*
+ * Convert to kb
+ */
+ pagesize = getpagesize() / 1024;
+
+ swapTotal *= pagesize;
+ swapUsed *= pagesize;
+ swapFree *= pagesize;
+}
+#endif
+
+
+/*
+ * var_extensible_mem(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+
+static unsigned char *
+var_extensible_mem(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+ static char errmsg[1024];
+
+ static struct vmmeter mem;
+ static struct vmtotal total;
+ size_t total_size = sizeof(total);
+ int total_mib[] = { CTL_VM, VM_METER };
+
+ u_long phys_mem;
+ size_t phys_mem_size = sizeof(phys_mem);
+ int phys_mem_mib[] = { CTL_HW, HW_PHYSMEM };
+
+#ifdef BUFSPACE_SYMBOL
+ long bufspace;
+#endif
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return (NULL);
+
+ /*
+ * Memory info
+ */
+ auto_nlist(SUM_SYMBOL, (char *) &mem, sizeof(mem));
+ sysctl(total_mib, 2, &total, &total_size, NULL, 0);
+
+ /*
+ * Swap info
+ */
+ swapmode();
+ /*
+ * getSwap();
+ */
+
+ /*
+ * Physical memory
+ */
+ sysctl(phys_mem_mib, 2, &phys_mem, &phys_mem_size, NULL, 0);
+
+#ifdef BUFSPACE_SYMBOL
+ /*
+ * Buffer space
+ */
+ auto_nlist(BUFSPACE_SYMBOL, (char *) &bufspace, sizeof(bufspace));
+#endif
+
+ long_ret = 0; /* set to 0 as default */
+
+ /*
+ * Page-to-kb macro
+ */
+#define ptok(p) ((p) * (mem.v_page_size >> 10))
+
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = 0;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* dummy name */
+ sprintf(errmsg, "swap");
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case MEMTOTALSWAP:
+ long_ret = swapTotal;
+ return ((u_char *) (&long_ret));
+ case MEMAVAILSWAP: /* FREE swap memory */
+ long_ret = swapFree;
+ return ((u_char *) (&long_ret));
+ case MEMTOTALREAL:
+ long_ret = phys_mem >> 10;
+ return ((u_char *) (&long_ret));
+ case MEMAVAILREAL: /* FREE real memory */
+ long_ret = ptok(mem.v_free_count);
+ return ((u_char *) (&long_ret));
+
+ /*
+ * these are not implemented
+ */
+ case MEMTOTALSWAPTXT:
+ case MEMUSEDSWAPTXT:
+ case MEMTOTALREALTXT:
+ case MEMUSEDREALTXT:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_ret = -1;
+ return ((u_char *) (&long_ret));
+
+ case MEMTOTALFREE:
+ long_ret = ptok((int) total.t_free);
+ return ((u_char *) (&long_ret));
+ case MEMSWAPMINIMUM:
+ long_ret = minimumswap;
+ return ((u_char *) (&long_ret));
+ case MEMSHARED:
+ long_ret = ptok(total.t_vmshr +
+ total.t_avmshr + total.t_rmshr + total.t_armshr);
+ return ((u_char *) (&long_ret));
+#ifdef BUFSPACE_SYMBOL
+ case MEMBUFFER:
+ long_ret = bufspace >> 10;
+ return ((u_char *) (&long_ret));
+#endif
+#ifndef openbsd2
+ case MEMCACHED:
+#ifdef darwin
+ long_ret = ptok(mem.v_lookups);
+#else
+ long_ret = ptok(mem.v_cache_count) + ptok(mem.v_inactive_count);
+#endif
+ return ((u_char *) (&long_ret));
+#endif
+ case ERRORFLAG:
+ long_ret = (swapFree > minimumswap) ? 0 : 1;
+ return ((u_char *) (&long_ret));
+ case ERRORMSG:
+ if (swapFree < minimumswap)
+ sprintf(errmsg, "Running out of swap space (%qd)", swapFree);
+ else
+ errmsg[0] = 0;
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ }
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_freebsd2.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_freebsd2.h
new file mode 100644
index 0000000000..ef2e0b92d5
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_freebsd2.h
@@ -0,0 +1,12 @@
+/*
+ * memory quantity mib groups
+ *
+ */
+#ifndef _MIBGROUP_MEMORY_FREEBSD2_H
+#define _MIBGROUP_MEMORY_FREEBSD2_H
+
+#include "mibdefs.h"
+
+extern void init_memory_freebsd2(void);
+
+#endif /* _MIBGROUP_MEMORY_FREEBSD2_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_hpux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_hpux.c
new file mode 100644
index 0000000000..5bf99ad7e3
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_hpux.c
@@ -0,0 +1,291 @@
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <sys/types.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+#include "memory.h" /* the module-specific header */
+#include "memory_hpux.h" /* the module-specific header */
+
+#include <sys/pstat.h>
+
+#define MAXSTRSIZE 80
+#define DEFAULTMINIMUMSWAP 16000 /* kilobytes */
+
+int minimumswap;
+static char errmsg[1024];
+
+static FindVarMethod var_extensible_mem;
+static long getFreeSwap(void);
+static long getTotalFree(void);
+static long getTotalSwap(void);
+
+struct swapinfo {
+ unsigned long total_swap; /* in kilobytes */
+ unsigned long free_swap; /* in kilobytes */
+};
+
+void
+memory_parse_config(const char *token, char *cptr)
+{
+ minimumswap = atoi(cptr);
+}
+
+void
+memory_free_config(void)
+{
+ minimumswap = DEFAULTMINIMUMSWAP;
+}
+
+void
+init_memory_hpux(void)
+{
+
+ struct variable2 extensible_mem_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_mem, 1,
+ {ERRORNAME}},
+ {MEMTOTALSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALSWAP}},
+ {MEMAVAILSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMAVAILSWAP}},
+ {MEMTOTALREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALREAL}},
+ {MEMAVAILREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMAVAILREAL}},
+ {MEMTOTALSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALSWAPTXT}},
+ {MEMUSEDSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMUSEDSWAPTXT}},
+ {MEMTOTALREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALREALTXT}},
+ {MEMUSEDREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMUSEDREALTXT}},
+ {MEMTOTALFREE, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALFREE}},
+ {MEMSWAPMINIMUM, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMSWAPMINIMUM}},
+ {MEMSHARED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMSHARED}},
+ {MEMBUFFER, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMBUFFER}},
+ {MEMCACHED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMCACHED}},
+ {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {ERRORFLAG}},
+ {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_mem, 1, {ERRORMSG}}
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid mem_variables_oid[] = { NETSNMP_UCDAVIS_MIB, NETSNMP_MEMMIBNUM };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/memory", extensible_mem_variables, variable2,
+ mem_variables_oid);
+
+ snmpd_register_config_handler("swap", memory_parse_config,
+ memory_free_config, "min-avail");
+
+} /* end init_hpux */
+
+static int
+get_swapinfo(struct swapinfo *swap)
+{
+
+ struct pst_swapinfo pss;
+ int i = 0;
+
+ while (pstat_getswap(&pss, sizeof(pss), (size_t) 1, i) != -1) {
+ if (pss.pss_idx == (unsigned) i) {
+ swap->total_swap += pss.pss_nblksenabled;
+ swap->free_swap += 4 * pss.pss_nfpgs; /* nfpgs is in 4-byte blocks - who knows why? */
+ i++;
+ } else
+ return;
+ }
+} /* end get_swapinfo */
+
+static u_char *
+var_extensible_mem(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+ struct swapinfo swap;
+ struct pst_static pst;
+ struct pst_dynamic psd;
+ static long long_ret;
+
+ /*
+ * Initialize the return value to 0
+ */
+ long_ret = 0;
+ swap.total_swap = 0;
+ swap.free_swap = 0;
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return (NULL);
+
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = 0;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* dummy name */
+ sprintf(errmsg, "swap");
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case MEMTOTALSWAP:
+ get_swapinfo(&swap);
+ long_ret = swap.total_swap;
+ return ((u_char *) (&long_ret));
+ case MEMAVAILSWAP:
+ get_swapinfo(&swap);
+ long_ret = swap.free_swap;
+ return ((u_char *) (&long_ret));
+ case MEMSWAPMINIMUM:
+ long_ret = minimumswap;
+ return ((u_char *) (&long_ret));
+ case MEMTOTALREAL:
+ /*
+ * Retrieve the static memory statistics
+ */
+ if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+ snmp_log(LOG_ERR, "memory_hpux: pstat_getstatic failed!\n");
+ return (NULL);
+ }
+ long_ret = pst.page_size / 1024 * pst.physical_memory;
+ return ((u_char *) (&long_ret));
+ case MEMAVAILREAL:
+ /*
+ * Retrieve the static memory statistics
+ */
+ if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+ snmp_log(LOG_ERR, "memory_hpux: pstat_getstatic failed!\n");
+ return (NULL);
+ }
+ /*
+ * Retrieve the dynamic memory statistics
+ */
+ if (pstat_getdynamic(&psd, sizeof(psd), (size_t) 1, 0) == -1) {
+ snmp_log(LOG_ERR, "memory_hpux: pstat_getdynamic failed!\n");
+ return (NULL);
+ }
+ long_ret = pst.page_size / 1024 * psd.psd_free;
+ return ((u_char *) (&long_ret));
+ case MEMTOTALSWAPTXT:
+ /*
+ * Retrieve the static memory statistics
+ */
+ if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+ snmp_log(LOG_ERR, "memory_hpux: pstat_getstatic failed!\n");
+ return (NULL);
+ }
+ /*
+ * Retrieve the dynamic memory statistics
+ */
+ if (pstat_getdynamic(&psd, sizeof(psd), (size_t) 1, 0) == -1) {
+ snmp_log(LOG_ERR, "memory_hpux: pstat_getdynamic failed!\n");
+ return (NULL);
+ }
+ long_ret = pst.page_size / 1024 * psd.psd_vmtxt;
+ return ((u_char *) (&long_ret));
+ case MEMUSEDSWAPTXT:
+ /*
+ * Retrieve the static memory statistics
+ */
+ if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+ snmp_log(LOG_ERR, "memory_hpux: pstat_getstatic failed!\n");
+ return (NULL);
+ }
+ /*
+ * Retrieve the dynamic memory statistics
+ */
+ if (pstat_getdynamic(&psd, sizeof(psd), (size_t) 1, 0) == -1) {
+ snmp_log(LOG_ERR, "memory_hpux: pstat_getdynamic failed!\n");
+ return (NULL);
+ }
+ long_ret = pst.page_size / 1024 * (psd.psd_vmtxt - psd.psd_avmtxt);
+ return ((u_char *) (&long_ret));
+ case MEMTOTALREALTXT:
+ /*
+ * Retrieve the static memory statistics
+ */
+ if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+ snmp_log(LOG_ERR, "memory_hpux: pstat_getstatic failed!\n");
+ return (NULL);
+ }
+ /*
+ * Retrieve the dynamic memory statistics
+ */
+ if (pstat_getdynamic(&psd, sizeof(psd), (size_t) 1, 0) == -1) {
+ snmp_log(LOG_ERR, "memory_hpux: pstat_getdynamic failed!\n");
+ return (NULL);
+ }
+ long_ret = pst.page_size / 1024 * psd.psd_rmtxt;
+ return ((u_char *) (&long_ret));
+ case MEMUSEDREALTXT:
+ /*
+ * Retrieve the static memory statistics
+ */
+ if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+ snmp_log(LOG_ERR, "memory_hpux: pstat_getstatic failed!\n");
+ return (NULL);
+ }
+ /*
+ * Retrieve the dynamic memory statistics
+ */
+ if (pstat_getdynamic(&psd, sizeof(psd), (size_t) 1, 0) == -1) {
+ snmp_log(LOG_ERR, "memory_hpux: pstat_getdynamic failed!\n");
+ return (NULL);
+ }
+ long_ret = pst.page_size / 1024 * (psd.psd_rmtxt - psd.psd_armtxt);
+ return ((u_char *) (&long_ret));
+ case MEMTOTALFREE:
+ /*
+ * Retrieve the static memory statistics
+ */
+ if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+ snmp_log(LOG_ERR, "memory_hpux: pstat_getstatic failed!\n");
+ return (NULL);
+ }
+ /*
+ * Retrieve the dynamic memory statistics
+ */
+ if (pstat_getdynamic(&psd, sizeof(psd), (size_t) 1, 0) == -1) {
+ snmp_log(LOG_ERR, "memory_hpux: pstat_getdynamic failed!\n");
+ return (NULL);
+ }
+ get_swapinfo(&swap);
+ long_ret = (pst.page_size / 1024 * psd.psd_free) + swap.free_swap;
+ return ((u_char *) (&long_ret));
+ case ERRORFLAG:
+ get_swapinfo(&swap);
+ long_ret = (swap.free_swap > minimumswap) ? 0 : 1;
+ return ((u_char *) (&long_ret));
+ case ERRORMSG:
+ get_swapinfo(&swap);
+ if ((swap.free_swap > minimumswap) ? 0 : 1)
+ sprintf(errmsg, "Running out of swap space (%ld)", long_ret);
+ else
+ errmsg[0] = 0;
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+
+ } /* end case */
+
+ return (NULL);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_hpux.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_hpux.h
new file mode 100644
index 0000000000..ffc3a9b472
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_hpux.h
@@ -0,0 +1,12 @@
+/*
+ * memory quantity mib groups
+ *
+ */
+#ifndef _MIBGROUP_MEMORY_HPUX_H
+#define _MIBGROUP_MEMORY_HPUX_H
+
+#include "mibdefs.h"
+
+void init_memory_hpux(void);
+
+#endif /* _MIBGROUP_MEMORY_HPUX_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_netbsd1.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_netbsd1.c
new file mode 100644
index 0000000000..663292146c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_netbsd1.c
@@ -0,0 +1,255 @@
+/*
+ * memory_netbsd1.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+/*
+ * Ripped from /usr/scr/usr.bin/vmstat/vmstat.c (covering all bases)
+ */
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#include <sys/dkstat.h>
+#include <sys/buf.h>
+#include <sys/uio.h>
+#include <sys/namei.h>
+#include <sys/malloc.h>
+#include <sys/signal.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+
+#if defined(HAVE_UVM_UVM_PARAM_H) && defined(HAVE_UVM_UVM_EXTERN_H)
+#include <uvm/uvm_param.h>
+#include <uvm/uvm_extern.h>
+#elif defined(HAVE_VM_VM_PARAM_H) && defined(HAVE_VM_VM_EXTERN_H)
+#include <vm/vm_param.h>
+#include <vm/vm_extern.h>
+#else
+#error memory_netbsd1.c: Is this really a NetBSD system?
+#endif
+
+#include <time.h>
+#include <nlist.h>
+#include <kvm.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+#include <limits.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"
+#include "memory.h"
+#include "memory_netbsd1.h"
+
+/*
+ * Default swap warning limit (kb)
+ */
+#define DEFAULTMINIMUMSWAP 16000
+
+/*
+ * Swap warning limit
+ */
+long minimumswap;
+
+/*
+ * Swap info
+ */
+quad_t swapTotal;
+quad_t swapUsed;
+quad_t swapFree;
+
+static FindVarMethod var_extensible_mem;
+
+void
+init_memory_netbsd1(void)
+{
+
+ struct variable2 extensible_mem_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_mem, 1,
+ {ERRORNAME}},
+ {MEMTOTALSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALSWAP}},
+ {MEMAVAILSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMAVAILSWAP}},
+ {MEMTOTALREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALREAL}},
+ {MEMAVAILREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMAVAILREAL}},
+ {MEMTOTALSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALSWAPTXT}},
+ {MEMUSEDSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMUSEDSWAPTXT}},
+ {MEMTOTALREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALREALTXT}},
+ {MEMUSEDREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMUSEDREALTXT}},
+ {MEMTOTALFREE, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALFREE}},
+ {MEMSWAPMINIMUM, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMSWAPMINIMUM}},
+ {MEMSHARED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMSHARED}},
+ {MEMBUFFER, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMBUFFER}},
+ {MEMCACHED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMCACHED}},
+ {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {ERRORFLAG}},
+ {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_mem, 1, {ERRORMSG}}
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid mem_variables_oid[] = { NETSNMP_UCDAVIS_MIB, NETSNMP_MEMMIBNUM };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/memory", extensible_mem_variables, variable2,
+ mem_variables_oid);
+
+ snmpd_register_config_handler("swap", memory_parse_config,
+ memory_free_config, "min-avail");
+}
+
+
+void
+memory_parse_config(const char *token, char *cptr)
+{
+ minimumswap = atoi(cptr);
+}
+
+void
+memory_free_config(void)
+{
+ minimumswap = DEFAULTMINIMUMSWAP;
+}
+
+
+/*
+ * var_extensible_mem(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+
+static
+unsigned char *
+var_extensible_mem(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+ static char errmsg[1024];
+
+ static struct uvmexp uvmexp;
+ int uvmexp_size = sizeof(uvmexp);
+ int uvmexp_mib[] = { CTL_VM, VM_UVMEXP };
+ static struct vmtotal total;
+ size_t total_size = sizeof(total);
+ int total_mib[] = { CTL_VM, VM_METER };
+
+ long phys_mem;
+ size_t phys_mem_size = sizeof(phys_mem);
+ int phys_mem_mib[] = { CTL_HW, HW_PHYSMEM };
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return (NULL);
+
+ /*
+ * Memory info
+ */
+ sysctl(uvmexp_mib, 2, &uvmexp, &uvmexp_size, NULL, 0);
+ sysctl(total_mib, 2, &total, &total_size, NULL, 0);
+
+ /*
+ * Physical memory
+ */
+ sysctl(phys_mem_mib, 2, &phys_mem, &phys_mem_size, NULL, 0);
+
+ long_ret = 0; /* set to 0 as default */
+
+ /*
+ * Page-to-kb macro
+ */
+#define ptok(p) ((p) * (uvmexp.pagesize >> 10))
+
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = 0;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* dummy name */
+ sprintf(errmsg, "swap");
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case MEMTOTALSWAP:
+ long_ret = ptok(uvmexp.swpages);
+ return ((u_char *) (&long_ret));
+ case MEMAVAILSWAP: /* FREE swap memory */
+ long_ret = ptok(uvmexp.swpages - uvmexp.swpginuse);
+ return ((u_char *) (&long_ret));
+ case MEMTOTALREAL:
+ long_ret = phys_mem >> 10;
+ return ((u_char *) (&long_ret));
+ case MEMAVAILREAL: /* FREE real memory */
+ long_ret = ptok(uvmexp.free);
+ return ((u_char *) (&long_ret));
+
+ /*
+ * these are not implemented
+ */
+ case MEMTOTALSWAPTXT:
+ case MEMUSEDSWAPTXT:
+ case MEMTOTALREALTXT:
+ case MEMUSEDREALTXT:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_ret = -1;
+ return ((u_char *) (&long_ret));
+
+ case MEMTOTALFREE:
+ long_ret = ptok((int) total.t_free);
+ return ((u_char *) (&long_ret));
+ case MEMSWAPMINIMUM:
+ long_ret = minimumswap;
+ return ((u_char *) (&long_ret));
+ case MEMSHARED:
+ return ((u_char *) (&long_ret));
+ case MEMBUFFER:
+ return NULL;
+ case MEMCACHED:
+ return NULL;
+ case ERRORFLAG:
+ long_ret = (swapFree > minimumswap) ? 0 : 1;
+ return ((u_char *) (&long_ret));
+ case ERRORMSG:
+ if (swapFree < minimumswap)
+ sprintf(errmsg, "Running out of swap space (%qd)", swapFree);
+ else
+ errmsg[0] = 0;
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ }
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_netbsd1.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_netbsd1.h
new file mode 100644
index 0000000000..a93754a35a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_netbsd1.h
@@ -0,0 +1,12 @@
+/*
+ * memory quantity mib groups
+ *
+ */
+#ifndef _MIBGROUP_MEMORY_NETBSD1_H
+#define _MIBGROUP_MEMORY_NETBSD1_H
+
+#include "mibdefs.h"
+
+extern void init_memory_netbsd1(void);
+
+#endif /* _MIBGROUP_MEMORY_NETBSD1_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_solaris2.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_solaris2.c
new file mode 100644
index 0000000000..33f41b2495
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_solaris2.c
@@ -0,0 +1,278 @@
+#include <net-snmp/net-snmp-config.h> /* local SNMP configuration details */
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include <sys/types.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h" /* utility function declarations */
+#include "memory.h" /* the module-specific header */
+#include "memory_solaris2.h" /* the module-specific header */
+
+#include <kstat.h>
+#include <sys/stat.h>
+#include <sys/swap.h>
+#include <unistd.h>
+
+#define MAXSTRSIZE 80
+
+int minimumswap;
+static char errmsg[1024];
+/****************************
+ * Kstat specific variables *
+ ****************************/
+extern kstat_ctl_t *kstat_fd; /* defined in kernel_sunos5.c */
+kstat_t *ksp1, *ksp2;
+kstat_named_t *kn, *kn2;
+
+static FindVarMethod var_extensible_mem;
+static long getFreeSwap(void);
+static long getTotalFree(void);
+static long getTotalSwap(void);
+
+void
+init_memory_solaris2(void)
+{
+
+ struct variable2 extensible_mem_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_mem, 1, {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_mem, 1,
+ {ERRORNAME}},
+ {MEMTOTALSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALSWAP}},
+ {MEMAVAILSWAP, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMAVAILSWAP}},
+ {MEMTOTALREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALREAL}},
+ {MEMAVAILREAL, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMAVAILREAL}},
+ {MEMTOTALSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALSWAPTXT}},
+ {MEMUSEDSWAPTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMUSEDSWAPTXT}},
+ {MEMTOTALREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALREALTXT}},
+ {MEMUSEDREALTXT, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMUSEDREALTXT}},
+ {MEMTOTALFREE, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMTOTALFREE}},
+ {MEMSWAPMINIMUM, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMSWAPMINIMUM}},
+ {MEMSHARED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMSHARED}},
+ {MEMBUFFER, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMBUFFER}},
+ {MEMCACHED, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {MEMCACHED}},
+ {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_mem, 1,
+ {ERRORFLAG}},
+ {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_mem, 1, {ERRORMSG}}
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid mem_variables_oid[] = { NETSNMP_UCDAVIS_MIB, NETSNMP_MEMMIBNUM };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/memory", extensible_mem_variables, variable2,
+ mem_variables_oid);
+
+ snmpd_register_config_handler("swap", memory_parse_config,
+ memory_free_config, "min-avail");
+
+ if (kstat_fd == 0) {
+ kstat_fd = kstat_open();
+ if (kstat_fd == 0) {
+ snmp_log_perror("kstat_open");
+ }
+ }
+}
+
+static u_char *
+var_extensible_mem(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ static long long_ret;
+
+ /*
+ * Initialize the return value to 0
+ */
+ long_ret = 0;
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return (NULL);
+
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = 0;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* dummy name */
+ sprintf(errmsg, "swap");
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case MEMTOTALSWAP:
+ long_ret = getTotalSwap() * (getpagesize() / 1024);
+ return ((u_char *) (&long_ret));
+ case MEMAVAILSWAP:
+ long_ret = getFreeSwap() * (getpagesize() / 1024);
+ return ((u_char *) (&long_ret));
+ case MEMSWAPMINIMUM:
+ long_ret = minimumswap;
+ return ((u_char *) (&long_ret));
+ case MEMTOTALREAL:
+#ifdef _SC_PHYS_PAGES
+ long_ret = sysconf(_SC_PHYS_PAGES) * (getpagesize()/1024);
+#else
+ ksp1 = kstat_lookup(kstat_fd, "unix", 0, "system_pages");
+ kstat_read(kstat_fd, ksp1, 0);
+ kn = kstat_data_lookup(ksp1, "physmem");
+
+ long_ret = kn->value.ul * (getpagesize() / 1024);
+#endif
+ return ((u_char *) (&long_ret));
+ case MEMAVAILREAL:
+#ifdef _SC_AVPHYS_PAGES
+ long_ret = sysconf(_SC_AVPHYS_PAGES) * (getpagesize()/1024);
+#else
+ long_ret =
+ (getTotalFree() - getFreeSwap()) * (getpagesize() / 1024);
+#endif
+ return ((u_char *) (&long_ret));
+ case MEMTOTALFREE:
+ long_ret = getTotalFree() * (getpagesize() / 1024);
+ return ((u_char *) (&long_ret));
+
+ case ERRORFLAG:
+ long_ret = getTotalFree() * (getpagesize() / 1024);
+ long_ret = (long_ret > minimumswap) ? 0 : 1;
+ return ((u_char *) (&long_ret));
+
+ case ERRORMSG:
+ long_ret = getTotalFree() * (getpagesize() / 1024);
+ if ((long_ret > minimumswap) ? 0 : 1)
+ sprintf(errmsg, "Running out of swap space (%ld)", long_ret);
+ else
+ errmsg[0] = 0;
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+
+ }
+
+ return (NULL);
+}
+
+#define DEFAULTMINIMUMSWAP 16000 /* kilobytes */
+
+void
+memory_parse_config(const char *token, char *cptr)
+{
+ minimumswap = atoi(cptr);
+}
+
+void
+memory_free_config(void)
+{
+ minimumswap = DEFAULTMINIMUMSWAP;
+}
+
+long
+getTotalSwap(void)
+{
+ long total_mem;
+
+ size_t num;
+ int i, n;
+ swaptbl_t *s;
+ char *strtab;
+
+ total_mem = 0;
+
+ num = swapctl(SC_GETNSWP, 0);
+ s = malloc(num * sizeof(swapent_t) + sizeof(struct swaptable));
+ if (s) {
+ strtab = (char *) malloc((num + 1) * MAXSTRSIZE);
+ if (strtab) {
+ for (i = 0; i < (num + 1); i++) {
+ s->swt_ent[i].ste_path = strtab + (i * MAXSTRSIZE);
+ }
+ s->swt_n = num + 1;
+ n = swapctl(SC_LIST, s);
+
+ for (i = 0; i < n; i++)
+ total_mem += s->swt_ent[i].ste_pages;
+
+ free(strtab);
+ }
+ free(s);
+ }
+
+ return (total_mem);
+}
+
+/*
+ * returns -1 if malloc fails.
+ */
+static long
+getFreeSwap(void)
+{
+ long free_mem = -1;
+
+ size_t num;
+ int i, n;
+ swaptbl_t *s;
+ char *strtab;
+
+ num = swapctl(SC_GETNSWP, 0);
+ s = malloc(num * sizeof(swapent_t) + sizeof(struct swaptable));
+ if (s) {
+ strtab = (char *) malloc((num + 1) * MAXSTRSIZE);
+ if (strtab) {
+ free_mem = 0;
+ for (i = 0; i < (num + 1); i++) {
+ s->swt_ent[i].ste_path = strtab + (i * MAXSTRSIZE);
+ }
+ s->swt_n = num + 1;
+ n = swapctl(SC_LIST, s);
+
+ for (i = 0; i < n; i++)
+ free_mem += s->swt_ent[i].ste_free;
+
+ free(strtab);
+ }
+ free(s);
+ }
+
+ return (free_mem);
+}
+
+static long
+getTotalFree(void)
+{
+ unsigned long free_mem, allocated, reserved, available, used_size;
+ struct anoninfo ai;
+
+ if (-1 == swapctl(SC_AINFO, &ai)) {
+ snmp_log_perror("swapctl(SC_AINFO)");
+ return 0;
+ }
+ allocated = ai.ani_max - ai.ani_free;
+ reserved = (ai.ani_resv - allocated);
+ available = (ai.ani_max - ai.ani_resv); /* K-byte */
+ free_mem = used_size = reserved + allocated;
+ free_mem = available;
+ return (free_mem);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_solaris2.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_solaris2.h
new file mode 100644
index 0000000000..336b3dd8c1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/memory_solaris2.h
@@ -0,0 +1,12 @@
+/*
+ * memory quantity mib groups
+ *
+ */
+#ifndef _MIBGROUP_MEMORY_SOLARIS2_H
+#define _MIBGROUP_MEMORY_SOLARIS2_H
+
+#include "mibdefs.h"
+
+void init_memory_solaris2(void);
+
+#endif /* _MIBGROUP_MEMORY_SOLARIS2_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/pass.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/pass.c
new file mode 100644
index 0000000000..037211614c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/pass.c
@@ -0,0 +1,540 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <ctype.h>
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#ifdef WIN32
+#include <limits.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "pass.h"
+#include "extensible.h"
+#include "util_funcs.h"
+
+struct extensible *passthrus = NULL;
+int numpassthrus = 0;
+
+/*
+ * the relocatable extensible commands variables
+ */
+struct variable2 extensible_passthru_variables[] = {
+ /*
+ * bogus entry. Only some of it is actually used.
+ */
+ {MIBINDEX, ASN_INTEGER, RWRITE, var_extensible_pass, 0, {MIBINDEX}},
+};
+
+
+
+/*
+ * lexicographical compare two object identifiers.
+ * * Returns -1 if name1 < name2,
+ * * 0 if name1 = name2,
+ * * 1 if name1 > name2
+ * *
+ * * This method differs from snmp_oid_compare
+ * * in that the comparison stops at the length
+ * * of the smallest object identifier.
+ */
+int
+snmp_oid_min_compare(const oid * in_name1,
+ size_t len1, const oid * in_name2, size_t len2)
+{
+ register int len;
+ register const oid *name1 = in_name1;
+ register const oid *name2 = in_name2;
+
+ /*
+ * len = minimum of len1 and len2
+ */
+ if (len1 < len2)
+ len = len1;
+ else
+ len = len2;
+ /*
+ * find first non-matching OID
+ */
+ while (len-- > 0) {
+ /*
+ * these must be done in seperate comparisons, since
+ * subtracting them and using that result has problems with
+ * subids > 2^31.
+ */
+ if (*(name1) < *(name2))
+ return -1;
+ if (*(name1++) > *(name2++))
+ return 1;
+ }
+ /*
+ * both OIDs equal up to length of shorter OID
+ */
+
+ return 0;
+}
+
+
+/*
+ * This is also called from pass_persist.c
+ */
+int
+asc2bin(char *p)
+{
+ char *r, *q = p;
+ char c;
+ int n = 0;
+
+ for (;;) {
+ c = (char) strtol(q, &r, 16);
+ if (r == q)
+ break;
+ *p++ = c;
+ q = r;
+ n++;
+ }
+ return n;
+}
+
+/*
+ * This is also called from pass_persist.c
+ */
+int
+bin2asc(char *p, size_t n)
+{
+ int i, flag = 0;
+ char buffer[SNMP_MAXBUF];
+
+ /* prevent buffer overflow */
+ if ((int)n > (sizeof(buffer) - 1))
+ n = sizeof(buffer) - 1;
+
+ for (i = 0; i < (int) n; i++) {
+ buffer[i] = p[i];
+ if (!isprint(p[i]))
+ flag = 1;
+ }
+ if (flag == 0) {
+ p[n] = 0;
+ return n;
+ }
+ for (i = 0; i < (int) n; i++) {
+ sprintf(p, "%02x ", (unsigned char) (buffer[i] & 0xff));
+ p += 3;
+ }
+ *--p = 0;
+ return 3 * n - 1;
+}
+
+void
+init_pass(void)
+{
+ snmpd_register_config_handler("pass", pass_parse_config,
+ pass_free_config, "miboid command");
+}
+
+void
+pass_parse_config(const char *token, char *cptr)
+{
+ struct extensible **ppass = &passthrus, **etmp, *ptmp;
+ char *tcptr, *endopt;
+ int i, priority;
+
+ /*
+ * options
+ */
+ priority = DEFAULT_MIB_PRIORITY;
+ while (*cptr == '-') {
+ cptr++;
+ switch (*cptr) {
+ case 'p':
+ /* change priority level */
+ cptr++;
+ cptr = skip_white(cptr);
+ if (! isdigit(*cptr)) {
+ config_perror("priority must be an integer");
+ return;
+ }
+ priority = strtol((const char*) cptr, &endopt, 0);
+ if ((priority == LONG_MIN) || (priority == LONG_MAX)) {
+ config_perror("priority under/overflow");
+ return;
+ }
+ cptr = endopt;
+ cptr = skip_white(cptr);
+ break;
+ default:
+ config_perror("unknown option for pass directive");
+ return;
+ }
+ }
+
+ /*
+ * MIB
+ */
+ if (*cptr == '.')
+ cptr++;
+ if (!isdigit(*cptr)) {
+ config_perror("second token is not a OID");
+ return;
+ }
+ numpassthrus++;
+
+ while (*ppass != NULL)
+ ppass = &((*ppass)->next);
+ (*ppass) = (struct extensible *) malloc(sizeof(struct extensible));
+ if (*ppass == NULL)
+ return;
+ (*ppass)->type = PASSTHRU;
+
+ (*ppass)->miblen = parse_miboid(cptr, (*ppass)->miboid);
+ while (isdigit(*cptr) || *cptr == '.')
+ cptr++;
+ /*
+ * path
+ */
+ cptr = skip_white(cptr);
+ if (cptr == NULL) {
+ config_perror("No command specified on pass line");
+ (*ppass)->command[0] = 0;
+ } else {
+ for (tcptr = cptr; *tcptr != 0 && *tcptr != '#' && *tcptr != ';';
+ tcptr++);
+ strncpy((*ppass)->command, cptr, tcptr - cptr);
+ (*ppass)->command[tcptr - cptr] = 0;
+ }
+ strncpy((*ppass)->name, (*ppass)->command, sizeof((*ppass)->name));
+ (*ppass)->name[ sizeof((*ppass)->name)-1 ] = 0;
+ (*ppass)->next = NULL;
+
+ register_mib_priority("pass", (struct variable *) extensible_passthru_variables,
+ sizeof(struct variable2),
+ 1, (*ppass)->miboid, (*ppass)->miblen, priority);
+
+ /*
+ * argggg -- pasthrus must be sorted
+ */
+ if (numpassthrus > 1) {
+ etmp = (struct extensible **)
+ malloc(((sizeof(struct extensible *)) * numpassthrus));
+ if (etmp == NULL)
+ return;
+
+ for (i = 0, ptmp = (struct extensible *) passthrus;
+ i < numpassthrus && ptmp != 0; i++, ptmp = ptmp->next)
+ etmp[i] = ptmp;
+ qsort(etmp, numpassthrus, sizeof(struct extensible *),
+ pass_compare);
+ passthrus = (struct extensible *) etmp[0];
+ ptmp = (struct extensible *) etmp[0];
+
+ for (i = 0; i < numpassthrus - 1; i++) {
+ ptmp->next = etmp[i + 1];
+ ptmp = ptmp->next;
+ }
+ ptmp->next = NULL;
+ free(etmp);
+ }
+}
+
+void
+pass_free_config(void)
+{
+ struct extensible *etmp, *etmp2;
+
+ for (etmp = passthrus; etmp != NULL;) {
+ etmp2 = etmp;
+ etmp = etmp->next;
+ unregister_mib(etmp2->miboid, etmp2->miblen);
+ free(etmp2);
+ }
+ passthrus = NULL;
+ numpassthrus = 0;
+}
+
+u_char *
+var_extensible_pass(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ oid newname[MAX_OID_LEN];
+ int i, rtest, fd, newlen;
+ static long long_ret;
+ char buf[SNMP_MAXBUF];
+ static char buf2[SNMP_MAXBUF];
+ static oid objid[MAX_OID_LEN];
+ struct extensible *passthru;
+ FILE *file;
+
+ long_ret = *length;
+ for (i = 1; i <= numpassthrus; i++) {
+ passthru = get_exten_instance(passthrus, i);
+ rtest = snmp_oid_min_compare(name, *length,
+ passthru->miboid, passthru->miblen);
+ if ((exact && rtest == 0) || (!exact && rtest <= 0)) {
+ /*
+ * setup args
+ */
+ if (passthru->miblen >= *length || rtest < 0)
+ sprint_mib_oid(buf, passthru->miboid, passthru->miblen);
+ else
+ sprint_mib_oid(buf, name, *length);
+ if (exact)
+ snprintf(passthru->command, sizeof(passthru->command),
+ "%s -g %s", passthru->name, buf);
+ else
+ snprintf(passthru->command, sizeof(passthru->command),
+ "%s -n %s", passthru->name, buf);
+ passthru->command[ sizeof(passthru->command)-1 ] = 0;
+ DEBUGMSGTL(("ucd-snmp/pass", "pass-running: %s\n",
+ passthru->command));
+ /*
+ * valid call. Exec and get output
+ */
+ if ((fd = get_exec_output(passthru)) != -1) {
+ file = fdopen(fd, "r");
+ if (fgets(buf, sizeof(buf), file) == NULL) {
+ fclose(file);
+ wait_on_exec(passthru);
+ if (exact) {
+ /*
+ * to enable creation
+ */
+ *write_method = setPass;
+ *var_len = 0;
+ return (NULL);
+ }
+ continue;
+ }
+ newlen = parse_miboid(buf, newname);
+
+ /*
+ * its good, so copy onto name/length
+ */
+ memcpy((char *) name, (char *) newname,
+ (int) newlen * sizeof(oid));
+ *length = newlen;
+
+ /*
+ * set up return pointer for setable stuff
+ */
+ *write_method = setPass;
+
+ if (newlen == 0 || fgets(buf, sizeof(buf), file) == NULL
+ || fgets(buf2, sizeof(buf2), file) == NULL) {
+ *var_len = 0;
+ fclose(file);
+ wait_on_exec(passthru);
+ return (NULL);
+ }
+ fclose(file);
+ wait_on_exec(passthru);
+
+ /*
+ * buf contains the return type, and buf2 contains the data
+ */
+ if (!strncasecmp(buf, "string", 6)) {
+ buf2[strlen(buf2) - 1] = 0; /* zap the linefeed */
+ *var_len = strlen(buf2);
+ vp->type = ASN_OCTET_STR;
+ return ((unsigned char *) buf2);
+ } else if (!strncasecmp(buf, "integer", 7)) {
+ *var_len = sizeof(long_ret);
+ long_ret = strtol(buf2, NULL, 10);
+ vp->type = ASN_INTEGER;
+ return ((unsigned char *) &long_ret);
+ } else if (!strncasecmp(buf, "unsigned", 8)) {
+ *var_len = sizeof(long_ret);
+ long_ret = strtoul(buf2, NULL, 10);
+ vp->type = ASN_UNSIGNED;
+ return ((unsigned char *) &long_ret);
+ } else if (!strncasecmp(buf, "counter", 7)) {
+ *var_len = sizeof(long_ret);
+ long_ret = strtoul(buf2, NULL, 10);
+ vp->type = ASN_COUNTER;
+ return ((unsigned char *) &long_ret);
+ } else if (!strncasecmp(buf, "octet", 5)) {
+ *var_len = asc2bin(buf2);
+ vp->type = ASN_OCTET_STR;
+ return ((unsigned char *) buf2);
+ } else if (!strncasecmp(buf, "opaque", 6)) {
+ *var_len = asc2bin(buf2);
+ vp->type = ASN_OPAQUE;
+ return ((unsigned char *) buf2);
+ } else if (!strncasecmp(buf, "gauge", 5)) {
+ *var_len = sizeof(long_ret);
+ long_ret = strtoul(buf2, NULL, 10);
+ vp->type = ASN_GAUGE;
+ return ((unsigned char *) &long_ret);
+ } else if (!strncasecmp(buf, "objectid", 8)) {
+ newlen = parse_miboid(buf2, objid);
+ *var_len = newlen * sizeof(oid);
+ vp->type = ASN_OBJECT_ID;
+ return ((unsigned char *) objid);
+ } else if (!strncasecmp(buf, "timetick", 8)) {
+ *var_len = sizeof(long_ret);
+ long_ret = strtoul(buf2, NULL, 10);
+ vp->type = ASN_TIMETICKS;
+ return ((unsigned char *) &long_ret);
+ } else if (!strncasecmp(buf, "ipaddress", 9)) {
+ newlen = parse_miboid(buf2, objid);
+ if (newlen != 4) {
+ snmp_log(LOG_ERR,
+ "invalid ipaddress returned: %s\n",
+ buf2);
+ *var_len = 0;
+ return (NULL);
+ }
+ long_ret =
+ (objid[0] << (8 * 3)) + (objid[1] << (8 * 2)) +
+ (objid[2] << 8) + objid[3];
+ long_ret = htonl(long_ret);
+ *var_len = sizeof(long_ret);
+ vp->type = ASN_IPADDRESS;
+ return ((unsigned char *) &long_ret);
+ }
+ }
+ *var_len = 0;
+ return (NULL);
+ }
+ }
+ if (var_len)
+ *var_len = 0;
+ *write_method = NULL;
+ return (NULL);
+}
+
+int
+setPass(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len, u_char * statP, oid * name, size_t name_len)
+{
+ int i, rtest;
+ struct extensible *passthru;
+
+ char buf[SNMP_MAXBUF], buf2[SNMP_MAXBUF];
+ long tmp;
+ unsigned long utmp;
+
+ for (i = 1; i <= numpassthrus; i++) {
+ passthru = get_exten_instance(passthrus, i);
+ rtest = snmp_oid_min_compare(name, name_len,
+ passthru->miboid, passthru->miblen);
+ if (rtest <= 0) {
+ if (action != ACTION)
+ return SNMP_ERR_NOERROR;
+ /*
+ * setup args
+ */
+ if (passthru->miblen >= name_len || rtest < 0)
+ sprint_mib_oid(buf, passthru->miboid, passthru->miblen);
+ else
+ sprint_mib_oid(buf, name, name_len);
+ snprintf(passthru->command, sizeof(passthru->command),
+ "%s -s %s ", passthru->name, buf);
+ passthru->command[ sizeof(passthru->command)-1 ] = 0;
+ switch (var_val_type) {
+ case ASN_INTEGER:
+ case ASN_COUNTER:
+ case ASN_GAUGE:
+ case ASN_TIMETICKS:
+ tmp = *((long *) var_val);
+ switch (var_val_type) {
+ case ASN_INTEGER:
+ sprintf(buf, "integer %d\n", (int) tmp);
+ break;
+ case ASN_COUNTER:
+ sprintf(buf, "counter %d\n", (int) tmp);
+ break;
+ case ASN_GAUGE:
+ sprintf(buf, "gauge %d\n", (int) tmp);
+ break;
+ case ASN_TIMETICKS:
+ sprintf(buf, "timeticks %d\n", (int) tmp);
+ break;
+ }
+ break;
+ case ASN_IPADDRESS:
+ utmp = *((u_long *) var_val);
+ utmp = ntohl(utmp);
+ sprintf(buf, "ipaddress %d.%d.%d.%d\n",
+ (int) ((utmp & 0xff000000) >> (8 * 3)),
+ (int) ((utmp & 0xff0000) >> (8 * 2)),
+ (int) ((utmp & 0xff00) >> (8)),
+ (int) ((utmp & 0xff)));
+ break;
+ case ASN_OCTET_STR:
+ memcpy(buf2, var_val, var_val_len);
+ if (var_val_len == 0)
+ sprintf(buf, "string \"\"\n");
+ else if (bin2asc(buf2, var_val_len) == (int) var_val_len)
+ snprintf(buf, sizeof(buf), "string \"%s\"\n", buf2);
+ else
+ snprintf(buf, sizeof(buf), "octet \"%s\"\n", buf2);
+ buf[ sizeof(buf)-1 ] = 0;
+ break;
+ case ASN_OBJECT_ID:
+ sprint_mib_oid(buf2, (oid *) var_val, var_val_len);
+ snprintf(buf, sizeof(buf), "objectid \"%s\"\n", buf2);
+ buf[ sizeof(buf)-1 ] = 0;
+ break;
+ }
+ strncat(passthru->command, buf, sizeof(passthru->command));
+ passthru->command[ sizeof(passthru->command)-1 ] = 0;
+ DEBUGMSGTL(("ucd-snmp/pass", "pass-running: %s",
+ passthru->command));
+ exec_command(passthru);
+ DEBUGMSGTL(("ucd-snmp/pass", "pass-running returned: %s",
+ passthru->output));
+ if (!strncasecmp(passthru->output, "not-writable", 12)) {
+ return SNMP_ERR_NOTWRITABLE;
+ } else if (!strncasecmp(passthru->output, "wrong-type", 10)) {
+ return SNMP_ERR_WRONGTYPE;
+ }
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ if (snmp_get_do_debugging()) {
+ sprint_mib_oid(buf2, name, name_len);
+ DEBUGMSGTL(("ucd-snmp/pass", "pass-notfound: %s\n", buf2));
+ }
+ return SNMP_ERR_NOSUCHNAME;
+}
+
+int
+pass_compare(const void *a, const void *b)
+{
+ const struct extensible *const *ap, *const *bp;
+ ap = (const struct extensible * const *) a;
+ bp = (const struct extensible * const *) b;
+ return snmp_oid_compare((*ap)->miboid, (*ap)->miblen, (*bp)->miboid,
+ (*bp)->miblen);
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/pass.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/pass.h
new file mode 100644
index 0000000000..fff1b7d6c0
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/pass.h
@@ -0,0 +1,23 @@
+/*
+ * pass: pass through extensiblity
+ */
+#ifndef _MIBGROUP_PASS_H
+#define _MIBGROUP_PASS_H
+
+void init_pass(void);
+
+config_require(util_funcs)
+
+extern FindVarMethod var_extensible_pass;
+WriteMethod setPass;
+int pass_compare(const void *, const void *);
+
+/*
+ * config file parsing routines
+ */
+void pass_free_config(void);
+void pass_parse_config(const char *, char *);
+
+#include "mibdefs.h"
+
+#endif /* _MIBGROUP_PASS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/pass_persist.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/pass_persist.c
new file mode 100644
index 0000000000..7e71e27b56
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/pass_persist.c
@@ -0,0 +1,800 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_IO_H
+#include <io.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <ctype.h>
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#ifdef WIN32
+#include <limits.h>
+#endif
+
+#include <signal.h>
+#include <errno.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "pass_persist.h"
+#include "extensible.h"
+#include "util_funcs.h"
+
+struct extensible *persistpassthrus = NULL;
+int numpersistpassthrus = 0;
+struct persist_pipe_type {
+ FILE *fIn, *fOut;
+ int fdIn, fdOut;
+ int pid;
+} *persist_pipes = (struct persist_pipe_type *) NULL;
+static int init_persist_pipes(void);
+static void close_persist_pipe(int iindex);
+static int open_persist_pipe(int iindex, char *command);
+static void destruct_persist_pipes(void);
+static int write_persist_pipe(int iindex, const char *data);
+
+/*
+ * These are defined in pass.c
+ */
+extern int asc2bin(char *p);
+extern int bin2asc(char *p, size_t n);
+extern int snmp_oid_min_compare(const oid *, size_t, const oid *,
+ size_t);
+
+/*
+ * the relocatable extensible commands variables
+ */
+struct variable2 extensible_persist_passthru_variables[] = {
+ /*
+ * bogus entry. Only some of it is actually used.
+ */
+ {MIBINDEX, ASN_INTEGER, RWRITE, var_extensible_pass_persist, 0,
+ {MIBINDEX}},
+};
+
+void
+init_pass_persist(void)
+{
+ snmpd_register_config_handler("pass_persist",
+ pass_persist_parse_config,
+ pass_persist_free_config,
+ "miboid program");
+}
+
+void
+pass_persist_parse_config(const char *token, char *cptr)
+{
+ struct extensible **ppass = &persistpassthrus, **etmp, *ptmp;
+ char *tcptr, *endopt;
+ int i, priority;
+
+ /*
+ * options
+ */
+ priority = DEFAULT_MIB_PRIORITY;
+ while (*cptr == '-') {
+ cptr++;
+ switch (*cptr) {
+ case 'p':
+ /* change priority level */
+ cptr++;
+ cptr = skip_white(cptr);
+ if (! isdigit(*cptr)) {
+ config_perror("priority must be an integer");
+ return;
+ }
+ priority = strtol((const char*) cptr, &endopt, 0);
+ if ((priority == LONG_MIN) || (priority == LONG_MAX)) {
+ config_perror("priority under/overflow");
+ return;
+ }
+ cptr = endopt;
+ cptr = skip_white(cptr);
+ break;
+ default:
+ config_perror("unknown option for pass directive");
+ return;
+ }
+ }
+
+ /*
+ * MIB
+ */
+ if (*cptr == '.')
+ cptr++;
+ if (!isdigit(*cptr)) {
+ config_perror("second token is not a OID");
+ return;
+ }
+ numpersistpassthrus++;
+
+ while (*ppass != NULL)
+ ppass = &((*ppass)->next);
+ (*ppass) = (struct extensible *) malloc(sizeof(struct extensible));
+ if (*ppass == NULL)
+ return;
+ (*ppass)->type = PASSTHRU_PERSIST;
+
+ (*ppass)->miblen = parse_miboid(cptr, (*ppass)->miboid);
+ while (isdigit(*cptr) || *cptr == '.')
+ cptr++;
+ /*
+ * path
+ */
+ cptr = skip_white(cptr);
+ if (cptr == NULL) {
+ config_perror("No command specified on pass_persist line");
+ (*ppass)->command[0] = 0;
+ } else {
+ for (tcptr = cptr; *tcptr != 0 && *tcptr != '#' && *tcptr != ';';
+ tcptr++);
+ strncpy((*ppass)->command, cptr, tcptr - cptr);
+ (*ppass)->command[tcptr - cptr] = 0;
+ }
+ strncpy((*ppass)->name, (*ppass)->command, sizeof((*ppass)->name));
+ (*ppass)->name[ sizeof((*ppass)->name)-1 ] = 0;
+ (*ppass)->next = NULL;
+
+ register_mib_priority("pass_persist",
+ (struct variable *) extensible_persist_passthru_variables,
+ sizeof(struct variable2), 1, (*ppass)->miboid,
+ (*ppass)->miblen, priority);
+
+ /*
+ * argggg -- pasthrus must be sorted
+ */
+ if (numpersistpassthrus > 1) {
+ etmp = (struct extensible **)
+ malloc(((sizeof(struct extensible *)) * numpersistpassthrus));
+ if (etmp == NULL)
+ return;
+ for (i = 0, ptmp = (struct extensible *) persistpassthrus;
+ i < numpersistpassthrus && ptmp != 0; i++, ptmp = ptmp->next)
+ etmp[i] = ptmp;
+ qsort(etmp, numpersistpassthrus, sizeof(struct extensible *),
+ pass_persist_compare);
+ persistpassthrus = (struct extensible *) etmp[0];
+ ptmp = (struct extensible *) etmp[0];
+
+ for (i = 0; i < numpersistpassthrus - 1; i++) {
+ ptmp->next = etmp[i + 1];
+ ptmp = ptmp->next;
+ }
+ ptmp->next = NULL;
+ free(etmp);
+ }
+}
+
+void
+pass_persist_free_config(void)
+{
+ struct extensible *etmp, *etmp2;
+
+ /*
+ * Close any open pipes to any programs
+ */
+ destruct_persist_pipes();
+
+ for (etmp = persistpassthrus; etmp != NULL;) {
+ etmp2 = etmp;
+ etmp = etmp->next;
+ unregister_mib(etmp2->miboid, etmp2->miblen);
+ free(etmp2);
+ }
+ persistpassthrus = NULL;
+ numpersistpassthrus = 0;
+}
+
+u_char *
+var_extensible_pass_persist(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ oid newname[MAX_OID_LEN];
+ int i, rtest, newlen;
+ static long long_ret;
+ char buf[SNMP_MAXBUF];
+ static char buf2[SNMP_MAXBUF];
+ static oid objid[MAX_OID_LEN];
+ struct extensible *persistpassthru;
+ FILE *file;
+
+ /*
+ * Make sure that our basic pipe structure is malloced
+ */
+ init_persist_pipes();
+
+ long_ret = *length;
+ for (i = 1; i <= numpersistpassthrus; i++) {
+ persistpassthru = get_exten_instance(persistpassthrus, i);
+ rtest = snmp_oid_min_compare(name, *length,
+ persistpassthru->miboid,
+ persistpassthru->miblen);
+ if ((exact && rtest == 0) || (!exact && rtest <= 0)) {
+ /*
+ * setup args
+ */
+ if (persistpassthru->miblen >= *length || rtest < 0)
+ sprint_mib_oid(buf, persistpassthru->miboid,
+ persistpassthru->miblen);
+ else
+ sprint_mib_oid(buf, name, *length);
+
+ /*
+ * Open our pipe if necessary
+ */
+ if (!open_persist_pipe(i, persistpassthru->name)) {
+ return (NULL);
+ }
+
+ if (exact)
+ snprintf(persistpassthru->command,
+ sizeof(persistpassthru->command), "get\n%s\n", buf);
+ else
+ snprintf(persistpassthru->command,
+ sizeof(persistpassthru->command), "getnext\n%s\n", buf);
+ persistpassthru->command[ sizeof(persistpassthru->command)-1 ] = 0;
+
+ DEBUGMSGTL(("ucd-snmp/pass_persist",
+ "persistpass-sending:\n%s",
+ persistpassthru->command));
+ if (!write_persist_pipe(i, persistpassthru->command)) {
+ *var_len = 0;
+ /*
+ * close_persist_pipes is called in write_persist_pipe
+ */
+ return (NULL);
+ }
+
+ /*
+ * valid call. Exec and get output
+ */
+
+ if ((file = persist_pipes[i].fIn)) {
+ if (fgets(buf, sizeof(buf), file) == NULL) {
+ *var_len = 0;
+ close_persist_pipe(i);
+ return (NULL);
+ }
+ /*
+ * persistent scripts return "NONE\n" on invalid items
+ */
+ if (!strncmp(buf, "NONE", 4)) {
+ if (exact) {
+ *var_len = 0;
+ return (NULL);
+ }
+ continue;
+ }
+ newlen = parse_miboid(buf, newname);
+
+ /*
+ * its good, so copy onto name/length
+ */
+ memcpy((char *) name, (char *) newname,
+ (int) newlen * sizeof(oid));
+ *length = newlen;
+
+ /*
+ * set up return pointer for setable stuff
+ */
+ *write_method = setPassPersist;
+
+ if (newlen == 0 || fgets(buf, sizeof(buf), file) == NULL
+ || fgets(buf2, sizeof(buf2), file) == NULL) {
+ *var_len = 0;
+ close_persist_pipe(i);
+ return (NULL);
+ }
+ /*
+ * buf contains the return type, and buf2 contains the data
+ */
+ if (!strncasecmp(buf, "string", 6)) {
+ buf2[strlen(buf2) - 1] = 0; /* zap the linefeed */
+ *var_len = strlen(buf2);
+ vp->type = ASN_OCTET_STR;
+ return ((unsigned char *) buf2);
+ } else if (!strncasecmp(buf, "integer", 7)) {
+ *var_len = sizeof(long_ret);
+ long_ret = strtol(buf2, NULL, 10);
+ vp->type = ASN_INTEGER;
+ return ((unsigned char *) &long_ret);
+ } else if (!strncasecmp(buf, "unsigned", 8)) {
+ *var_len = sizeof(long_ret);
+ long_ret = strtoul(buf2, NULL, 10);
+ vp->type = ASN_UNSIGNED;
+ return ((unsigned char *) &long_ret);
+ } else if (!strncasecmp(buf, "counter", 7)) {
+ *var_len = sizeof(long_ret);
+ long_ret = strtoul(buf2, NULL, 10);
+ vp->type = ASN_COUNTER;
+ return ((unsigned char *) &long_ret);
+ } else if (!strncasecmp(buf, "octet", 5)) {
+ *var_len = asc2bin(buf2);
+ vp->type = ASN_OCTET_STR;
+ return ((unsigned char *) buf2);
+ } else if (!strncasecmp(buf, "opaque", 6)) {
+ *var_len = asc2bin(buf2);
+ vp->type = ASN_OPAQUE;
+ return ((unsigned char *) buf2);
+ } else if (!strncasecmp(buf, "gauge", 5)) {
+ *var_len = sizeof(long_ret);
+ long_ret = strtoul(buf2, NULL, 10);
+ vp->type = ASN_GAUGE;
+ return ((unsigned char *) &long_ret);
+ } else if (!strncasecmp(buf, "objectid", 8)) {
+ newlen = parse_miboid(buf2, objid);
+ *var_len = newlen * sizeof(oid);
+ vp->type = ASN_OBJECT_ID;
+ return ((unsigned char *) objid);
+ } else if (!strncasecmp(buf, "timetick", 8)) {
+ *var_len = sizeof(long_ret);
+ long_ret = strtoul(buf2, NULL, 10);
+ vp->type = ASN_TIMETICKS;
+ return ((unsigned char *) &long_ret);
+ } else if (!strncasecmp(buf, "ipaddress", 9)) {
+ newlen = parse_miboid(buf2, objid);
+ if (newlen != 4) {
+ snmp_log(LOG_ERR,
+ "invalid ipaddress returned: %s\n",
+ buf2);
+ *var_len = 0;
+ return (NULL);
+ }
+ long_ret =
+ (objid[0] << (8 * 3)) + (objid[1] << (8 * 2)) +
+ (objid[2] << 8) + objid[3];
+ long_ret = htonl(long_ret);
+ *var_len = sizeof(long_ret);
+ vp->type = ASN_IPADDRESS;
+ return ((unsigned char *) &long_ret);
+ }
+ }
+ *var_len = 0;
+ return (NULL);
+ }
+ }
+ if (var_len)
+ *var_len = 0;
+ *write_method = NULL;
+ return (NULL);
+}
+
+int
+setPassPersist(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ int i, rtest;
+ struct extensible *persistpassthru;
+
+ char buf[SNMP_MAXBUF], buf2[SNMP_MAXBUF];
+ long tmp;
+ unsigned long utmp;
+
+ /*
+ * Make sure that our basic pipe structure is malloced
+ */
+ init_persist_pipes();
+
+ for (i = 1; i <= numpersistpassthrus; i++) {
+ persistpassthru = get_exten_instance(persistpassthrus, i);
+ rtest = snmp_oid_min_compare(name, name_len,
+ persistpassthru->miboid,
+ persistpassthru->miblen);
+ if (rtest <= 0) {
+ if (action != ACTION)
+ return SNMP_ERR_NOERROR;
+ /*
+ * setup args
+ */
+ if (persistpassthru->miblen >= name_len || rtest < 0)
+ sprint_mib_oid(buf, persistpassthru->miboid,
+ persistpassthru->miblen);
+ else
+ sprint_mib_oid(buf, name, name_len);
+ snprintf(persistpassthru->command,
+ sizeof(persistpassthru->command), "set\n%s\n", buf);
+ persistpassthru->command[ sizeof(persistpassthru->command)-1 ] = 0;
+ switch (var_val_type) {
+ case ASN_INTEGER:
+ case ASN_COUNTER:
+ case ASN_GAUGE:
+ case ASN_TIMETICKS:
+ tmp = *((long *) var_val);
+ switch (var_val_type) {
+ case ASN_INTEGER:
+ sprintf(buf, "integer %d\n", (int) tmp);
+ break;
+ case ASN_COUNTER:
+ sprintf(buf, "counter %d\n", (int) tmp);
+ break;
+ case ASN_GAUGE:
+ sprintf(buf, "gauge %d\n", (int) tmp);
+ break;
+ case ASN_TIMETICKS:
+ sprintf(buf, "timeticks %d\n", (int) tmp);
+ break;
+ }
+ break;
+ case ASN_IPADDRESS:
+ utmp = *((u_long *) var_val);
+ utmp = ntohl(utmp);
+ sprintf(buf, "ipaddress %d.%d.%d.%d\n",
+ (int) ((utmp & 0xff000000) >> (8 * 3)),
+ (int) ((utmp & 0xff0000) >> (8 * 2)),
+ (int) ((utmp & 0xff00) >> (8)),
+ (int) ((utmp & 0xff)));
+ break;
+ case ASN_OCTET_STR:
+ memcpy(buf2, var_val, var_val_len);
+ if (var_val_len == 0)
+ sprintf(buf, "string \"\"\n");
+ else if (bin2asc(buf2, var_val_len) == (int) var_val_len)
+ snprintf(buf, sizeof(buf), "string \"%s\"\n", buf2);
+ else
+ snprintf(buf, sizeof(buf), "octet \"%s\"\n", buf2);
+ buf[ sizeof(buf)-1 ] = 0;
+ break;
+ case ASN_OBJECT_ID:
+ sprint_mib_oid(buf2, (oid *) var_val, var_val_len);
+ snprintf(buf, sizeof(buf), "objectid \"%s\"\n", buf2);
+ buf[ sizeof(buf)-1 ] = 0;
+ break;
+ }
+ strncat(persistpassthru->command, buf,
+ sizeof(persistpassthru->command) -
+ strlen(persistpassthru->command) - 2);
+ persistpassthru->command[ sizeof(persistpassthru->command)-2 ] = '\n';
+ persistpassthru->command[ sizeof(persistpassthru->command)-1 ] = 0;
+
+ if (!open_persist_pipe(i, persistpassthru->name)) {
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ DEBUGMSGTL(("ucd-snmp/pass_persist",
+ "persistpass-writing: %s\n",
+ persistpassthru->command));
+ if (!write_persist_pipe(i, persistpassthru->command)) {
+ close_persist_pipe(i);
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (fgets(buf, sizeof(buf), persist_pipes[i].fIn) == NULL) {
+ close_persist_pipe(i);
+ return SNMP_ERR_NOTWRITABLE;
+ }
+
+ if (!strncasecmp(buf, "not-writable", 12)) {
+ return SNMP_ERR_NOTWRITABLE;
+ } else if (!strncasecmp(buf, "wrong-type", 10)) {
+ return SNMP_ERR_WRONGTYPE;
+ } else if (!strncasecmp(buf, "wrong-length", 12)) {
+ return SNMP_ERR_WRONGLENGTH;
+ } else if (!strncasecmp(buf, "wrong-value", 11)) {
+ return SNMP_ERR_WRONGVALUE;
+ } else if (!strncasecmp(buf, "inconsistent-value", 18)) {
+ return SNMP_ERR_INCONSISTENTVALUE;
+ }
+ return SNMP_ERR_NOERROR;
+ }
+ }
+ if (snmp_get_do_debugging()) {
+ sprint_mib_oid(buf2, name, name_len);
+ DEBUGMSGTL(("ucd-snmp/pass_persist", "persistpass-notfound: %s\n",
+ buf2));
+ }
+ return SNMP_ERR_NOSUCHNAME;
+}
+
+int
+pass_persist_compare(const void *a, const void *b)
+{
+ const struct extensible *const *ap, *const *bp;
+ ap = (const struct extensible * const *) a;
+ bp = (const struct extensible * const *) b;
+ return snmp_oid_compare((*ap)->miboid, (*ap)->miblen, (*bp)->miboid,
+ (*bp)->miblen);
+}
+
+/*
+ * Initialize our persistent pipes
+ * - Returns 1 on success, 0 on failure.
+ * - Initializes all FILE pointers to NULL to indicate "closed"
+ */
+static int
+init_persist_pipes(void)
+{
+ int i;
+
+ /*
+ * if we are already taken care of, just return
+ */
+ if (persist_pipes) {
+ return persist_pipes ? 1 : 0;
+ }
+
+ /*
+ * Otherwise malloc and initialize
+ */
+ persist_pipes = (struct persist_pipe_type *)
+ malloc(sizeof(struct persist_pipe_type) *
+ (numpersistpassthrus + 1));
+ if (persist_pipes) {
+ for (i = 0; i <= numpersistpassthrus; i++) {
+ persist_pipes[i].fIn = persist_pipes[i].fOut = (FILE *) 0;
+ persist_pipes[i].fdIn = persist_pipes[i].fdOut = -1;
+ persist_pipes[i].pid = -1;
+ }
+ }
+ return persist_pipes ? 1 : 0;
+}
+
+/*
+ * Destruct our persistent pipes
+ *
+ */
+static void
+destruct_persist_pipes(void)
+{
+ int i;
+
+ /*
+ * Return if there are no pipes
+ */
+ if (!persist_pipes) {
+ return;
+ }
+
+ for (i = 0; i <= numpersistpassthrus; i++) {
+ close_persist_pipe(i);
+ }
+
+ free(persist_pipes);
+ persist_pipes = (struct persist_pipe_type *) 0;
+}
+
+/*
+ * returns 0 on failure, 1 on success
+ */
+static int
+open_persist_pipe(int iindex, char *command)
+{
+ static int recurse = 0; /* used to allow one level of recursion */
+
+ DEBUGMSGTL(("ucd-snmp/pass_persist", "open_persist_pipe(%d,'%s')\n",
+ iindex, command));
+ /*
+ * Open if it's not already open
+ */
+ if (persist_pipes[iindex].pid == -1) {
+ int fdIn, fdOut, pid;
+
+ /*
+ * Did we fail?
+ */
+ if ((0 == get_exec_pipes(command, &fdIn, &fdOut, &pid)) ||
+ (pid == -1)) {
+ DEBUGMSGTL(("ucd-snmp/pass_persist",
+ "open_persist_pipe: pid == -1\n"));
+ recurse = 0;
+ return 0;
+ }
+
+ /*
+ * If not, fill out our structure
+ */
+ persist_pipes[iindex].pid = pid;
+ persist_pipes[iindex].fdIn = fdIn;
+ persist_pipes[iindex].fdOut = fdOut;
+ persist_pipes[iindex].fIn = fdopen(fdIn, "r");
+ persist_pipes[iindex].fOut = fdopen(fdOut, "w");
+
+ /*
+ * Setup our -non-buffered-io-
+ */
+ setbuf(persist_pipes[iindex].fOut, (char *) 0);
+ }
+
+ /*
+ * Send test packet always so we can self-catch
+ */
+ {
+ char buf[SNMP_MAXBUF];
+ /*
+ * Should catch SIGPIPE around this call!
+ */
+ if (!write_persist_pipe(iindex, "PING\n")) {
+ DEBUGMSGTL(("ucd-snmp/pass_persist",
+ "open_persist_pipe: Error writing PING\n"));
+ close_persist_pipe(iindex);
+
+ /*
+ * Recurse one time if we get a SIGPIPE
+ */
+ if (!recurse) {
+ recurse = 1;
+ return open_persist_pipe(iindex, command);
+ }
+ recurse = 0;
+ return 0;
+ }
+ if (fgets(buf, sizeof(buf), persist_pipes[iindex].fIn) == NULL) {
+ DEBUGMSGTL(("ucd-snmp/pass_persist",
+ "open_persist_pipe: Error reading for PONG\n"));
+ close_persist_pipe(iindex);
+ recurse = 0;
+ return 0;
+ }
+ if (strncmp(buf, "PONG", 4)) {
+ DEBUGMSGTL(("ucd-snmp/pass_persist",
+ "open_persist_pipe: PONG not received!\n"));
+ close_persist_pipe(iindex);
+ recurse = 0;
+ return 0;
+ }
+ }
+
+ recurse = 0;
+ return 1;
+}
+
+#if STRUCT_SIGACTION_HAS_SA_SIGACTION
+/*
+ * Generic handler
+ */
+void
+sigpipe_handler(int sig, siginfo_t * sip, void *uap)
+{
+ return;
+}
+#endif
+
+static int
+write_persist_pipe(int iindex, const char *data)
+{
+#if HAVE_SIGNAL
+ struct sigaction sa, osa;
+ int wret = 0, werrno = 0;
+
+ /*
+ * Don't write to a non-existant process
+ */
+ if (persist_pipes[iindex].pid == -1) {
+ return 0;
+ }
+
+ /*
+ * Setup our signal action to catch SIGPIPEs
+ */
+ sa.sa_handler = NULL;
+#if STRUCT_SIGACTION_HAS_SA_SIGACTION
+ sa.sa_sigaction = &sigpipe_handler;
+#endif
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ if (sigaction(SIGPIPE, &sa, &osa)) {
+ DEBUGMSGTL(("ucd-snmp/pass_persist",
+ "write_persist_pipe: sigaction failed: %d", errno));
+ }
+
+ /*
+ * Do the write
+ */
+ wret = write(persist_pipes[iindex].fdOut, data, strlen(data));
+ werrno = errno;
+
+ /*
+ * Reset the signal handler
+ */
+ sigaction(SIGPIPE, &osa, (struct sigaction *) 0);
+
+ if (wret < 0) {
+ if (werrno != EINTR) {
+ DEBUGMSGTL(("ucd-snmp/pass_persist",
+ "write_persist_pipe: write returned unknown error %d\n",
+ errno));
+ }
+ close_persist_pipe(iindex);
+ return 0;
+ }
+#endif /* HAVE_SIGNAL */
+#if defined(WIN32) && !defined (mingw32) && !defined (HAVE_SIGNAL)
+/* We have no signal here (maybe we can make a Thread?) so write may block,
+ * but probably never will.
+ */
+ int wret = 0, werrno = 0;
+
+ /*
+ * Do the write
+ */
+ wret = write(persist_pipes[iindex].fdOut, data,strlen(data));
+ werrno = errno;
+
+ if (wret < 0) {
+ if (werrno != EINTR) {
+ DEBUGMSGTL(("ucd-snmp/pass_persist", "write_persist_pipe: write returned unknown error %d\n",errno));
+ }
+ close_persist_pipe(iindex);
+ return 0;
+ }
+#endif /* WIN32 */
+ return 1;
+}
+
+static void
+close_persist_pipe(int iindex)
+{
+/* Alexander Prömel, alexander@proemel.de 08/24/2006
+ The hard coded pathnames, are temporary.
+ I'll fix it soon.
+ If you changed them here, you have to do it in ../util_funcs.c too.
+*/
+#ifdef __uClinux__
+ char fifo_in_path[256];
+ char fifo_out_path[256];
+
+ snprintf(fifo_in_path, 256, "/flash/cp_%d", persist_pipes[iindex].pid);
+ snprintf(fifo_out_path, 256, "/flash/pc_%d", persist_pipes[iindex].pid);
+#endif
+
+ /*
+ * Check and nix every item
+ */
+ if (persist_pipes[iindex].fOut) {
+ fclose(persist_pipes[iindex].fOut);
+ persist_pipes[iindex].fOut = (FILE *) 0;
+ }
+ if (persist_pipes[iindex].fdOut != -1) {
+ close(persist_pipes[iindex].fdOut);
+ persist_pipes[iindex].fdOut = -1;
+ }
+ if (persist_pipes[iindex].fIn) {
+ fclose(persist_pipes[iindex].fIn);
+ persist_pipes[iindex].fIn = (FILE *) 0;
+ }
+ if (persist_pipes[iindex].fdIn != -1) {
+ close(persist_pipes[iindex].fdIn);
+ persist_pipes[iindex].fdIn = -1;
+ }
+#ifdef __uClinux__
+ /*remove the pipes*/
+ unlink(fifo_in_path);
+ unlink(fifo_out_path);
+#endif
+
+ if (persist_pipes[iindex].pid != -1) {
+#if HAVE_SYS_WAIT_H
+ waitpid(persist_pipes[iindex].pid, 0, 0);
+#endif
+ persist_pipes[iindex].pid = -1;
+ }
+
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/pass_persist.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/pass_persist.h
new file mode 100644
index 0000000000..33be66e3c4
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/pass_persist.h
@@ -0,0 +1,22 @@
+/*
+ * pass: pass through extensiblity
+ */
+#ifndef _MIBGROUP_PASS_PERSIST_H
+#define _MIBGROUP_PASS_PERSIST_H
+
+config_require(util_funcs)
+
+void init_pass_persist(void);
+extern FindVarMethod var_extensible_pass_persist;
+extern WriteMethod setPassPersist;
+
+/*
+ * config file parsing routines
+ */
+void pass_persist_free_config(void);
+void pass_persist_parse_config(const char *, char *);
+int pass_persist_compare(const void *, const void *);
+
+#include "mibdefs.h"
+
+#endif /* _MIBGROUP_PASS_PERSIST_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/proc.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/proc.c
new file mode 100644
index 0000000000..9fde2c4944
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/proc.c
@@ -0,0 +1,854 @@
+#include <net-snmp/net-snmp-config.h>
+
+#ifdef solaris2
+#define _KMEMUSER /* Needed by <sys/user.h> */
+#include <sys/types.h> /* helps define struct rlimit */
+#endif
+
+#if HAVE_IO_H /* win32 */
+#include <io.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#include <math.h>
+#include <ctype.h>
+#include <sys/types.h>
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_KVM_H
+#include <kvm.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "proc.h"
+#ifdef USING_UCD_SNMP_ERRORMIB_MODULE
+#include "errormib.h"
+#else
+#define setPerrorstatus(x) snmp_log_perror(x)
+#endif
+#include "util_funcs.h"
+#include "kernel.h"
+
+static struct myproc *get_proc_instance(struct myproc *, oid);
+struct myproc *procwatch = NULL;
+static struct extensible fixproc;
+int numprocs = 0;
+
+void
+init_proc(void)
+{
+
+ /*
+ * define the structure we're going to ask the agent to register our
+ * information at
+ */
+ struct variable2 extensible_proc_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_proc, 1, {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_proc, 1,
+ {ERRORNAME}},
+ {PROCMIN, ASN_INTEGER, RONLY, var_extensible_proc, 1, {PROCMIN}},
+ {PROCMAX, ASN_INTEGER, RONLY, var_extensible_proc, 1, {PROCMAX}},
+ {PROCCOUNT, ASN_INTEGER, RONLY, var_extensible_proc, 1,
+ {PROCCOUNT}},
+ {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_proc, 1,
+ {ERRORFLAG}},
+ {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_proc, 1,
+ {ERRORMSG}},
+ {ERRORFIX, ASN_INTEGER, RWRITE, var_extensible_proc, 1,
+ {ERRORFIX}},
+ {ERRORFIXCMD, ASN_OCTET_STR, RONLY, var_extensible_proc, 1,
+ {ERRORFIXCMD}}
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid proc_variables_oid[] = { NETSNMP_UCDAVIS_MIB, NETSNMP_PROCMIBNUM, 1 };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/proc", extensible_proc_variables, variable2,
+ proc_variables_oid);
+
+ snmpd_register_config_handler("proc", proc_parse_config,
+ proc_free_config,
+ "process-name [max-num] [min-num]");
+ snmpd_register_config_handler("procfix", procfix_parse_config, NULL,
+ "process-name program [arguments...]");
+}
+
+
+/*
+ * Define snmpd.conf reading routines first. They get called
+ * automatically by the invocation of a macro in the proc.h file.
+ */
+
+void
+proc_free_config(void)
+{
+ struct myproc *ptmp, *ptmp2;
+
+ for (ptmp = procwatch; ptmp != NULL;) {
+ ptmp2 = ptmp;
+ ptmp = ptmp->next;
+ free(ptmp2);
+ }
+ procwatch = NULL;
+ numprocs = 0;
+}
+
+/*
+ * find a give entry in the linked list associated with a proc name
+ */
+static struct myproc *
+get_proc_by_name(char *name)
+{
+ struct myproc *ptmp;
+
+ if (name == NULL)
+ return NULL;
+
+ for (ptmp = procwatch; ptmp != NULL && strcmp(ptmp->name, name) != 0;
+ ptmp = ptmp->next);
+ return ptmp;
+}
+
+void
+procfix_parse_config(const char *token, char *cptr)
+{
+ char tmpname[STRMAX];
+ struct myproc *procp;
+
+ /*
+ * don't allow two entries with the same name
+ */
+ cptr = copy_nword(cptr, tmpname, sizeof(tmpname));
+ if ((procp = get_proc_by_name(tmpname)) == NULL) {
+ config_perror("No proc entry registered for this proc name yet.");
+ return;
+ }
+
+ if (strlen(cptr) > sizeof(procp->fixcmd)) {
+ config_perror("fix command too long.");
+ return;
+ }
+
+ strcpy(procp->fixcmd, cptr);
+}
+
+
+void
+proc_parse_config(const char *token, char *cptr)
+{
+ char tmpname[STRMAX];
+ struct myproc **procp = &procwatch;
+
+ /*
+ * don't allow two entries with the same name
+ */
+ copy_nword(cptr, tmpname, sizeof(tmpname));
+ if (get_proc_by_name(tmpname) != NULL) {
+ config_perror("Already have an entry for this process.");
+ return;
+ }
+
+ /*
+ * skip past used ones
+ */
+ while (*procp != NULL)
+ procp = &((*procp)->next);
+
+ (*procp) = (struct myproc *) calloc(1, sizeof(struct myproc));
+ if (*procp == NULL)
+ return; /* memory alloc error */
+ numprocs++;
+ /*
+ * not blank and not a comment
+ */
+ copy_nword(cptr, (*procp)->name, sizeof((*procp)->name));
+ cptr = skip_not_white(cptr);
+ if ((cptr = skip_white(cptr))) {
+ (*procp)->max = atoi(cptr);
+ cptr = skip_not_white(cptr);
+ if ((cptr = skip_white(cptr)))
+ (*procp)->min = atoi(cptr);
+ else
+ (*procp)->min = 0;
+ } else {
+ (*procp)->max = 0;
+ (*procp)->min = 0;
+ }
+#ifdef NETSNMP_PROCFIXCMD
+ sprintf((*procp)->fixcmd, NETSNMP_PROCFIXCMD, (*procp)->name);
+#endif
+ DEBUGMSGTL(("ucd-snmp/proc", "Read: %s (%d) (%d)\n",
+ (*procp)->name, (*procp)->max, (*procp)->min));
+}
+
+/*
+ * The routine that handles everything
+ */
+
+u_char *
+var_extensible_proc(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+ struct myproc *proc;
+ static long long_ret;
+ static char errmsg[300];
+
+
+ if (header_simple_table
+ (vp, name, length, exact, var_len, write_method, numprocs))
+ return (NULL);
+
+ if ((proc = get_proc_instance(procwatch, name[*length - 1]))) {
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = name[*length - 1];
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* process name to check for */
+ *var_len = strlen(proc->name);
+ return ((u_char *) (proc->name));
+ case PROCMIN:
+ long_ret = proc->min;
+ return ((u_char *) (&long_ret));
+ case PROCMAX:
+ long_ret = proc->max;
+ return ((u_char *) (&long_ret));
+ case PROCCOUNT:
+ long_ret = sh_count_procs(proc->name);
+ return ((u_char *) (&long_ret));
+ case ERRORFLAG:
+ long_ret = sh_count_procs(proc->name);
+ if (long_ret >= 0 &&
+ ((proc->min && long_ret < proc->min) ||
+ (proc->max && long_ret > proc->max) ||
+ (proc->min == 0 && proc->max == 0 && long_ret < 1))) {
+ long_ret = 1;
+ } else {
+ long_ret = 0;
+ }
+ return ((u_char *) (&long_ret));
+ case ERRORMSG:
+ long_ret = sh_count_procs(proc->name);
+ if (long_ret < 0) {
+ errmsg[0] = 0; /* catch out of mem errors return 0 count */
+ } else if (proc->min && long_ret < proc->min) {
+ snprintf(errmsg, sizeof(errmsg),
+ "Too few %s running (# = %d)",
+ proc->name, (int) long_ret);
+ } else if (proc->max && long_ret > proc->max) {
+ snprintf(errmsg, sizeof(errmsg),
+ "Too many %s running (# = %d)",
+ proc->name, (int) long_ret);
+ } else if (proc->min == 0 && proc->max == 0 && long_ret < 1) {
+ snprintf(errmsg, sizeof(errmsg),
+ "No %s process running.", proc->name);
+ } else {
+ errmsg[0] = 0;
+ }
+ errmsg[ sizeof(errmsg)-1 ] = 0;
+ *var_len = strlen(errmsg);
+ return ((u_char *) errmsg);
+ case ERRORFIX:
+ *write_method = fixProcError;
+ long_return = fixproc.result;
+ return ((u_char *) & long_return);
+ case ERRORFIXCMD:
+ if (proc->fixcmd) {
+ *var_len = strlen(proc->fixcmd);
+ return (u_char *) proc->fixcmd;
+ }
+ errmsg[0] = 0;
+ *var_len = 0;
+ return ((u_char *) errmsg);
+ }
+ return NULL;
+ }
+ return NULL;
+}
+
+int
+fixProcError(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+
+ struct myproc *proc;
+ long tmp = 0;
+
+ if ((proc = get_proc_instance(procwatch, name[10]))) {
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR, "Wrong type != int\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ tmp = *((long *) var_val);
+ if (tmp == 1 && action == COMMIT) {
+ if (proc->fixcmd[0]) {
+ strcpy(fixproc.command, proc->fixcmd);
+ exec_command(&fixproc);
+ }
+ }
+ return SNMP_ERR_NOERROR;
+ }
+ return SNMP_ERR_WRONGTYPE;
+}
+
+static struct myproc *
+get_proc_instance(struct myproc *proc, oid inst)
+{
+ int i;
+
+ if (proc == NULL)
+ return (NULL);
+ for (i = 1; (i != (int) inst) && (proc != NULL); i++)
+ proc = proc->next;
+ return (proc);
+}
+
+#ifdef bsdi2
+#include <sys/param.h>
+#include <sys/sysctl.h>
+
+#define PP(pp, field) ((pp)->kp_proc . field)
+#define EP(pp, field) ((pp)->kp_eproc . field)
+#define VP(pp, field) ((pp)->kp_eproc.e_vm . field)
+
+/*
+ * these are for keeping track of the proc array
+ */
+
+static int nproc = 0;
+static int onproc = -1;
+static struct kinfo_proc *pbase = 0;
+
+int
+sh_count_procs(char *procname)
+{
+ register int i, ret = 0;
+ register struct kinfo_proc *pp;
+ static int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL };
+
+ if (sysctl(mib, 3, NULL, &nproc, NULL, 0) < 0)
+ return 0;
+
+ if (nproc > onproc || !pbase) {
+ if ((pbase = (struct kinfo_proc *) realloc(pbase,
+ nproc +
+ sizeof(struct
+ kinfo_proc))) ==
+ 0)
+ return -1;
+ onproc = nproc;
+ memset(pbase, 0, nproc + sizeof(struct kinfo_proc));
+ }
+
+ if (sysctl(mib, 3, pbase, &nproc, NULL, 0) < 0)
+ return -1;
+
+ for (pp = pbase, i = 0; i < nproc / sizeof(struct kinfo_proc);
+ pp++, i++) {
+ if (PP(pp, p_stat) != 0 && (((PP(pp, p_flag) & P_SYSTEM) == 0))) {
+ if (PP(pp, p_stat) != SZOMB
+ && !strcmp(PP(pp, p_comm), procname))
+ ret++;
+ }
+ }
+ return ret;
+}
+
+#elif defined(aix4) || defined(aix5) || defined(aix6)
+#include <procinfo.h>
+#include <sys/types.h>
+
+struct procsinfo pinfo;
+char pinfo_name[256];
+
+int
+sh_count_procs(char *procname)
+{
+ pid_t index;
+ int count;
+ char *sep;
+
+ index = 0;
+ count = 0;
+
+ while(getprocs(&pinfo, sizeof(pinfo), NULL, 0, &index, 1) == 1) {
+ strncpy(pinfo_name, pinfo.pi_comm, 256);
+ pinfo_name[255] = 0;
+ sep = strchr(pinfo_name, ' ');
+ if(sep != NULL) *sep = 0;
+ if(strcmp(procname, pinfo_name) == 0) count++;
+ }
+
+ return count;
+}
+
+#elif NETSNMP_OSTYPE == NETSNMP_LINUXID
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+int
+sh_count_procs(char *procname)
+{
+ DIR *dir;
+ char cmdline[512], *tmpc;
+ char state[64];
+ struct dirent *ent;
+#ifdef USE_PROC_CMDLINE
+ int fd;
+#endif
+ int len,plen=strlen(procname),total = 0;
+ FILE *status;
+
+ if ((dir = opendir("/proc")) == NULL) return -1;
+ while (NULL != (ent = readdir(dir))) {
+ if(!(ent->d_name[0] >= '0' && ent->d_name[0] <= '9')) continue;
+#ifdef USE_PROC_CMDLINE /* old method */
+ /* read /proc/XX/cmdline */
+ sprintf(cmdline,"/proc/%s/cmdline",ent->d_name);
+ if((fd = open(cmdline, O_RDONLY)) < 0) continue;
+ len = read(fd,cmdline,sizeof(cmdline) - 1);
+ close(fd);
+ if(len <= 0) continue;
+ cmdline[len] = 0;
+ while(--len && !cmdline[len]);
+ while(--len) if(!cmdline[len]) cmdline[len] = ' ';
+ if(!strncmp(cmdline,procname,plen)) total++;
+#else
+ /* read /proc/XX/status */
+ sprintf(cmdline,"/proc/%s/status",ent->d_name);
+ if ((status = fopen(cmdline, "r")) == NULL)
+ continue;
+ if (fgets(cmdline, sizeof(cmdline), status) == NULL) {
+ fclose(status);
+ break;
+ }
+ /* Grab the state of the process as well
+ * (so we can ignore zombie processes)
+ * XXX: Assumes the second line is the status
+ */
+ if (fgets(state, sizeof(state), status) == NULL) {
+ state[0]='\0';
+ }
+ fclose(status);
+ cmdline[sizeof(cmdline)-1] = '\0';
+ state[sizeof(state)-1] = '\0';
+ /* XXX: assumes Name: is first */
+ if (strncmp("Name:",cmdline, 5) != 0)
+ break;
+ tmpc = skip_token(cmdline);
+ if (!tmpc)
+ break;
+ for (len=0;; len++) {
+ if (tmpc[len] && isgraph(tmpc[len])) continue;
+ tmpc[len]='\0';
+ break;
+ }
+ DEBUGMSGTL(("proc","Comparing wanted %s against %s\n",
+ procname, tmpc));
+ if(len==plen && !strncmp(tmpc,procname,plen)) {
+ /* Do not count zombie process as they are not running processes */
+ if ( strstr(state, "zombie") == NULL ) {
+ total++;
+ DEBUGMSGTL(("proc", " Matched. total count now=%d\n", total));
+ } else {
+ DEBUGMSGTL(("proc", " Skipping zombie process.\n"));
+ }
+ }
+#endif
+ }
+ closedir(dir);
+ return total;
+}
+
+#elif NETSNMP_OSTYPE == NETSNMP_ULTRIXID
+
+#define NPROCS 32 /* number of proces to read at once */
+
+extern int kmem, mem, swap;
+
+#include <sys/user.h>
+#include <sys/proc.h>
+#include <sys/file.h>
+#include <sys/vm.h>
+#include <machine/pte.h>
+#ifdef HAVE_NLIST_H
+#include <nlist.h>
+#endif
+
+static struct user *getuser(struct proc *);
+static int getword(off_t);
+static int getstruct(off_t, char *, off_t, int);
+
+static struct nlist proc_nl[] = {
+ {"_nproc"},
+#define X_NPROC 0
+ {"_proc"},
+#define X_PROC 1
+ {"_proc_bitmap"},
+#define X_PROC_BITMAP 2
+ {NULL}
+};
+
+int
+sh_count_procs(char *procname)
+{
+ int total, proc_active, nproc;
+ int thisproc = 0;
+ int absolute_proc_number = -1;
+ struct user *auser;
+ struct proc *aproc, *procp;
+ unsigned bitmap;
+ struct proc procs[NPROCS], *procsp;
+ static int inited = 0;
+
+ procp = (struct proc *) getword(proc_nl[X_PROC].n_value);
+ nproc = getword(proc_nl[X_NPROC].n_value);
+
+ total = 0;
+ for (;;) {
+ do {
+ while (thisproc == 0) {
+ int nread;
+ int psize;
+
+ if (nproc == 0)
+ return (total);
+
+ thisproc = MIN(NPROCS, nproc);
+ psize = thisproc * sizeof(struct proc);
+ nproc -= thisproc;
+ if (lseek(kmem, (off_t) procp, L_SET) == -1 ||
+ (nread = read(kmem, (char *) procs, psize)) < 0) {
+ /*
+ * warn("read proc");
+ */
+ return (total);
+ } else if (nread != psize) {
+ thisproc = nread / sizeof(struct proc);
+ nproc = 0;
+ /*
+ * warn("read proc: short read");
+ */
+ }
+ procsp = procs;
+ procp += thisproc;
+ }
+
+ aproc = procsp++;
+ thisproc--;
+
+ absolute_proc_number++;
+ if ((absolute_proc_number % 32) == 0)
+ bitmap =
+ getword((unsigned int) proc_nl[X_PROC_BITMAP].n_value +
+ ((absolute_proc_number / 32) * 4));
+ proc_active =
+ (bitmap & (1 << (absolute_proc_number % 32))) != 0;
+ if (proc_active && aproc->p_stat != SZOMB
+ && !(aproc->p_type & SWEXIT))
+ auser = getuser(aproc);
+ } while (!proc_active || auser == NULL);
+
+ if (strcmp(auser->u_comm, procname) == 0)
+ total++;
+ }
+}
+
+#define SW_UADDR dtob(getword((off_t)dmap.dm_ptdaddr))
+#define SW_UBYTES sizeof(struct user)
+
+#define SKRD(file, src, dst, size) \
+ (lseek(file, (off_t)(src), L_SET) == -1) || \
+ (read(file, (char *)(dst), (size)) != (size))
+
+static struct user *
+getuser(struct proc *aproc)
+{
+ static union {
+ struct user user;
+ char upgs[UPAGES][NBPG];
+ } u;
+ static struct pte uptes[UPAGES];
+ static struct dmap dmap;
+ int i, nbytes;
+
+ /*
+ * If process is not in core, we simply snarf it's user struct
+ * from the swap device.
+ */
+ if ((aproc->p_sched & SLOAD) == 0) {
+ if (!getstruct
+ ((off_t) aproc->p_smap, "aproc->p_smap", (off_t) & dmap,
+ sizeof(dmap))) {
+ /*
+ * warnx("can't read dmap for pid %d from %s", aproc->p_pid,
+ * _PATH_DRUM);
+ */
+ return (NULL);
+ }
+ if (SKRD(swap, SW_UADDR, &u.user, SW_UBYTES)) {
+ /*
+ * warnx("can't read u for pid %d from %s", aproc->p_pid, _PATH_DRUM);
+ */
+ return (NULL);
+ }
+ return (&u.user);
+ }
+
+ /*
+ * Process is in core. Follow p_addr to read in the page
+ * table entries that map the u-area and then read in the
+ * physical pages that comprise the u-area.
+ *
+ * If at any time, an lseek() or read() fails, print a warning
+ * message and return NULL.
+ */
+ if (SKRD(kmem, aproc->p_addr, uptes, sizeof(uptes))) {
+ /*
+ * warnx("can't read user pt for pid %d from %s", aproc->p_pid, _PATH_DRUM);
+ */
+ return (NULL);
+ }
+
+ nbytes = sizeof(struct user);
+ for (i = 0; i < UPAGES && nbytes > 0; i++) {
+ if (SKRD(mem, ptob(uptes[i].pg_pfnum), u.upgs[i], NBPG)) {
+ /*
+ * warnx("can't read user page %u for pid %d from %s",
+ * uptes[i].pg_pfnum, aproc->p_pid, _PATH_MEM);
+ */
+ return (NULL);
+ }
+ nbytes -= NBPG;
+ }
+ return (&u.user);
+}
+
+static int
+getword(off_t loc)
+{
+ int val;
+
+ if (SKRD(kmem, loc, &val, sizeof(val)))
+ exit(1);
+ return (val);
+}
+
+static int
+getstruct(off_t loc, char *name, off_t dest, int size)
+{
+ if (SKRD(kmem, loc, dest, size))
+ return (0);
+ return (1);
+}
+#elif NETSNMP_OSTYPE == NETSNMP_SOLARISID
+
+#ifdef _SLASH_PROC_METHOD_
+
+#include <fcntl.h>
+#include <dirent.h>
+
+#include <procfs.h>
+
+/*
+ * Gets process information from /proc/.../psinfo
+ */
+
+int
+sh_count_procs(char *procname)
+{
+ int fd, total = 0;
+ struct psinfo info;
+ char fbuf[32];
+ struct dirent *ent;
+ DIR *dir;
+
+ if (!(dir = opendir("/proc"))) {
+ snmp_perror("/proc");
+ return -1;
+ }
+
+ while ((ent = readdir(dir))) {
+ if (!strcmp(ent->d_name, "..") || !strcmp(ent->d_name, "."))
+ continue;
+
+ snprintf(fbuf, sizeof fbuf, "/proc/%s/psinfo", ent->d_name);
+ if ((fd = open(fbuf, O_RDONLY)) < 0) { /* Continue or return error? */
+ snmp_perror(fbuf);
+ continue;
+ }
+
+ if (read(fd, (char *) &info, sizeof(struct psinfo)) !=
+ sizeof(struct psinfo)) {
+ snmp_perror(fbuf);
+ close(fd);
+ closedir(dir);
+ return -1;
+ }
+
+ if (!info.pr_nlwp && !info.pr_lwp.pr_lwpid) {
+ /*
+ * Zombie process
+ */
+ } else {
+ DEBUGMSGTL(("proc","Comparing wanted %s against %s\n",
+ procname, info.pr_fname));
+ if (!strcmp(procname, info.pr_fname)) {
+ total++;
+ DEBUGMSGTL(("proc", " Matched. total count now=%d\n", total));
+ }
+ }
+
+ close(fd);
+ }
+ closedir(dir);
+ return total;
+}
+
+#else /* _SLASH_PROC_METHOD_ */
+
+#define _KMEMUSER /* Needed by <sys/user.h> */
+
+#include <kvm.h>
+#include <fcntl.h>
+#include <sys/user.h>
+#include <sys/proc.h>
+
+int
+sh_count_procs(char *procname)
+{
+ struct proc *p;
+ struct user *u;
+ int total;
+
+ if (kd == NULL) {
+ return -1;
+ }
+ if (kvm_setproc(kd) < 0) {
+ return (-1);
+ }
+ kvm_setproc(kd);
+ total = 0;
+ while ((p = kvm_nextproc(kd)) != NULL) {
+ if (!p) {
+ return (-1);
+ }
+ u = kvm_getu(kd, p);
+ /*
+ * Skip this entry if u or u->u_comm is a NULL pointer
+ */
+ if (!u) {
+ continue;
+ }
+ if (strcmp(procname, u->u_comm) == 0)
+ total++;
+ }
+ return (total);
+}
+#endif /* _SLASH_PROC_METHOD_ */
+#else
+int
+sh_count_procs(char *procname)
+{
+ char line[STRMAX], *cptr, *cp;
+ int ret = 0, fd;
+ FILE *file;
+#ifndef NETSNMP_EXCACHETIME
+#endif
+ struct extensible ex;
+ int slow = strstr(PSCMD, "ax") != NULL;
+
+ strcpy(ex.command, PSCMD);
+ if ((fd = get_exec_output(&ex)) >= 0) {
+ if ((file = fdopen(fd, "r")) == NULL) {
+ setPerrorstatus("fdopen");
+ close(fd);
+ return (-1);
+ }
+ while (fgets(line, sizeof(line), file) != NULL) {
+ if (slow) {
+ cptr = find_field(line, 5);
+ cp = strrchr(cptr, '/');
+ if (cp)
+ cptr = cp + 1;
+ else if (*cptr == '-')
+ cptr++;
+ else if (*cptr == '[') {
+ cptr++;
+ cp = strchr(cptr, ']');
+ if (cp)
+ *cp = 0;
+ }
+ copy_nword(cptr, line, sizeof(line));
+ cp = line + strlen(line) - 1;
+ if (*cp == ':')
+ *cp = 0;
+ } else {
+ if ((cptr = find_field(line, NETSNMP_LASTFIELD)) == NULL)
+ continue;
+ copy_nword(cptr, line, sizeof(line));
+ }
+ if (!strcmp(line, procname))
+ ret++;
+ }
+ if (ftell(file) < 2) {
+#ifdef USING_UCD_SNMP_ERRORMIB_MODULE
+ seterrorstatus("process list unreasonable short (mem?)", 2);
+#endif
+ ret = -1;
+ }
+ fclose(file);
+ wait_on_exec(&ex);
+ } else {
+ ret = -1;
+ }
+ return (ret);
+}
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/proc.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/proc.h
new file mode 100644
index 0000000000..ff97cec079
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/proc.h
@@ -0,0 +1,28 @@
+/*
+ * Process watching mib group
+ */
+#ifndef _MIBGROUP_PROC_H
+#define _MIBGROUP_PROC_H
+
+config_require(util_funcs)
+
+ void init_proc(void);
+
+ extern FindVarMethod var_extensible_proc;
+ extern WriteMethod fixProcError;
+ int sh_count_procs(char *);
+
+/*
+ * config file parsing routines
+ */
+ void proc_free_config(void);
+ void proc_parse_config(const char *, char *);
+ void procfix_parse_config(const char *, char *);
+
+#include "mibdefs.h"
+
+#define PROCMIN 3
+#define PROCMAX 4
+#define PROCCOUNT 5
+
+#endif /* _MIBGROUP_PROC_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/proxy.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/proxy.c
new file mode 100644
index 0000000000..faf095c68c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/proxy.c
@@ -0,0 +1,667 @@
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright @ 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "proxy.h"
+
+static struct simple_proxy *proxies = NULL;
+
+oid testoid[] = { 1, 3, 6, 1, 4, 1, 2021, 8888, 1 };
+
+/*
+ * this must be standardized somewhere, right?
+ */
+#define MAX_ARGS 128
+
+char *context_string;
+
+static void
+proxyOptProc(int argc, char *const *argv, int opt)
+{
+ switch (opt) {
+ case 'C':
+ while (*optarg) {
+ switch (*optarg++) {
+ case 'n':
+ optind++;
+ if (optind < argc) {
+ context_string = argv[optind - 1];
+ } else {
+ config_perror("No context name passed to -Cn");
+ }
+ break;
+ case 'c':
+ netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_IGNORE_NO_COMMUNITY, 1);
+ break;
+ default:
+ config_perror("unknown argument passed to -C");
+ break;
+ }
+ }
+ break;
+ default:
+ break;
+ /*
+ * shouldn't get here
+ */
+ }
+}
+
+void
+proxy_parse_config(const char *token, char *line)
+{
+ /*
+ * proxy args [base-oid] [remap-to-remote-oid]
+ */
+
+ netsnmp_session session, *ss;
+ struct simple_proxy *newp, **listpp;
+ char args[MAX_ARGS][SPRINT_MAX_LEN], *argv[MAX_ARGS];
+ int argn, arg;
+ char *cp;
+ netsnmp_handler_registration *reg;
+
+ context_string = NULL;
+
+ DEBUGMSGTL(("proxy_config", "entering\n"));
+
+ /*
+ * create the argv[] like array
+ */
+ strcpy(argv[0] = args[0], "snmpd-proxy"); /* bogus entry for getopt() */
+ for (argn = 1, cp = line; cp && argn < MAX_ARGS;) {
+ argv[argn] = args[argn];
+ cp = copy_nword(cp, argv[argn], SPRINT_MAX_LEN);
+ argn++;
+ }
+
+ for (arg = 0; arg < argn; arg++) {
+ DEBUGMSGTL(("proxy_args", "final args: %d = %s\n", arg,
+ argv[arg]));
+ }
+
+ DEBUGMSGTL(("proxy_config", "parsing args: %d\n", argn));
+ /* Call special parse_args that allows for no specified community string */
+ arg = snmp_parse_args(argn, argv, &session, "C:", proxyOptProc);
+
+ /* reset this in case we modified it */
+ netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_IGNORE_NO_COMMUNITY, 0);
+
+ if (arg < 0) {
+ config_perror("failed to parse proxy args");
+ return;
+ }
+ DEBUGMSGTL(("proxy_config", "done parsing args\n"));
+
+ if (arg >= argn) {
+ config_perror("missing base oid");
+ return;
+ }
+
+ /*
+ * usm_set_reportErrorOnUnknownID(0);
+ *
+ * hack, stupid v3 ASIs.
+ */
+ /*
+ * XXX: on a side note, we don't really need to be a reference
+ * platform any more so the proper thing to do would be to fix
+ * snmplib/snmpusm.c to pass in the pdu type to usm_process_incoming
+ * so this isn't needed.
+ */
+ ss = snmp_open(&session);
+ /*
+ * usm_set_reportErrorOnUnknownID(1);
+ */
+ if (ss == NULL) {
+ /*
+ * diagnose snmp_open errors with the input netsnmp_session pointer
+ */
+ snmp_sess_perror("snmpget", &session);
+ SOCK_CLEANUP;
+ return;
+ }
+
+ newp = (struct simple_proxy *) calloc(1, sizeof(struct simple_proxy));
+
+ newp->sess = ss;
+ DEBUGMSGTL(("proxy_init", "name = %s\n", args[arg]));
+ newp->name_len = MAX_OID_LEN;
+ if (!snmp_parse_oid(args[arg++], newp->name, &newp->name_len)) {
+ snmp_perror("proxy");
+ config_perror("illegal proxy oid specified\n");
+ return;
+ }
+
+ if (arg < argn) {
+ DEBUGMSGTL(("proxy_init", "base = %s\n", args[arg]));
+ newp->base_len = MAX_OID_LEN;
+ if (!snmp_parse_oid(args[arg++], newp->base, &newp->base_len)) {
+ snmp_perror("proxy");
+ config_perror("illegal variable name specified (base oid)\n");
+ return;
+ }
+ }
+ if ( context_string )
+ newp->context = strdup(context_string);
+
+ DEBUGMSGTL(("proxy_init", "registering at: "));
+ DEBUGMSGOID(("proxy_init", newp->name, newp->name_len));
+ DEBUGMSG(("proxy_init", "\n"));
+
+ /*
+ * add to our chain
+ */
+ /*
+ * must be sorted!
+ */
+ listpp = &proxies;
+ while (*listpp &&
+ snmp_oid_compare(newp->name, newp->name_len,
+ (*listpp)->name, (*listpp)->name_len) > 0) {
+ listpp = &((*listpp)->next);
+ }
+
+ /*
+ * listpp should be next in line from us.
+ */
+ if (*listpp) {
+ /*
+ * make our next in the link point to the current link
+ */
+ newp->next = *listpp;
+ }
+ /*
+ * replace current link with us
+ */
+ *listpp = newp;
+
+ reg = netsnmp_create_handler_registration("proxy",
+ proxy_handler,
+ newp->name,
+ newp->name_len,
+ HANDLER_CAN_RWRITE);
+ reg->handler->myvoid = newp;
+ if (context_string)
+ reg->contextName = strdup(context_string);
+
+ netsnmp_register_handler(reg);
+}
+
+void
+proxy_free_config(void)
+{
+ struct simple_proxy *rm;
+
+ DEBUGMSGTL(("proxy_free_config", "Free config\n"));
+ while (proxies) {
+ rm = proxies;
+ proxies = rm->next;
+
+ DEBUGMSGTL(( "proxy_free_config", "freeing "));
+ DEBUGMSGOID(("proxy_free_config", rm->name, rm->name_len));
+ DEBUGMSG(( "proxy_free_config", " (%s)\n", rm->context));
+ unregister_mib_context(rm->name, rm->name_len,
+ DEFAULT_MIB_PRIORITY, 0, 0,
+ rm->context);
+ SNMP_FREE(rm->variables);
+ SNMP_FREE(rm->context);
+ snmp_close(rm->sess);
+ SNMP_FREE(rm);
+ }
+}
+
+/*
+ * Configure special parameters on the session.
+ * Currently takes the parameter configured and changes it if something
+ * was configured. It becomes "-c" if the community string from the pdu
+ * is placed on the session.
+ */
+int
+proxy_fill_in_session(netsnmp_mib_handler *handler,
+ netsnmp_agent_request_info *reqinfo,
+ void **configured)
+{
+ netsnmp_session *session;
+ struct simple_proxy *sp;
+
+ sp = (struct simple_proxy *) handler->myvoid;
+ if (!sp) {
+ return 0;
+ }
+ session = sp->sess;
+ if (!session) {
+ return 0;
+ }
+
+#if !defined(NETSNMP_DISABLE_SNMPV1) || !defined(NETSNMP_DISABLE_SNMPV2C)
+#if defined(NETSNMP_DISABLE_SNMPV1)
+ if (session->version == SNMP_VERSION_2c) {
+#else
+#if defined(NETSNMP_DISABLE_SNMPV2C)
+ if (session->version == SNMP_VERSION_1) {
+#else
+ if (session->version == SNMP_VERSION_1 ||
+ session->version == SNMP_VERSION_2c) {
+#endif
+#endif
+
+ /*
+ * Check if session has community string defined for it.
+ * If not, need to extract community string from the pdu.
+ * Copy to session and set 'configured' to indicate this.
+ */
+ if (session->community_len == 0) {
+ DEBUGMSGTL(("proxy", "session has no community string\n"));
+ if (reqinfo->asp == NULL || reqinfo->asp->pdu == NULL ||
+ reqinfo->asp->pdu->community_len == 0) {
+ return 0;
+ }
+
+ *configured = malloc(strlen("-c") + 1);
+ strcpy(*configured, "-c");
+ DEBUGMSGTL(("proxy", "pdu has community string\n"));
+ session->community_len = reqinfo->asp->pdu->community_len;
+ session->community = malloc(session->community_len + 1);
+ strncpy((char *)session->community,
+ (const char *)reqinfo->asp->pdu->community,
+ session->community_len);
+ }
+ }
+#endif
+
+ return 1;
+}
+
+/*
+ * Free any specially configured parameters used on the session.
+ */
+void
+proxy_free_filled_in_session_args(netsnmp_session *session, void **configured)
+{
+
+ /* Only do comparisions, etc., if something was configured */
+ if (*configured == NULL) {
+ return;
+ }
+
+ /* If used community string from pdu, release it from session now */
+ if (strcmp((const char *)(*configured), "-c") == 0) {
+ free(session->community);
+ session->community = NULL;
+ session->community_len = 0;
+ }
+
+ free((u_char *)(*configured));
+ *configured = NULL;
+}
+
+void
+init_proxy(void)
+{
+ snmpd_register_config_handler("proxy", proxy_parse_config,
+ proxy_free_config,
+ "[snmpcmd args] host oid [remoteoid]");
+}
+
+void
+shutdown_proxy(void)
+{
+ proxy_free_config();
+}
+
+int
+proxy_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_pdu *pdu;
+ struct simple_proxy *sp;
+ oid *ourname;
+ size_t ourlength;
+ netsnmp_request_info *request = requests;
+ u_char *configured = NULL;
+
+ DEBUGMSGTL(("proxy", "proxy handler starting, mode = %d\n",
+ reqinfo->mode));
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ case MODE_GETNEXT:
+ case MODE_GETBULK: /* WWWXXX */
+ pdu = snmp_pdu_create(reqinfo->mode);
+ break;
+
+ case MODE_SET_ACTION:
+ pdu = snmp_pdu_create(SNMP_MSG_SET);
+ break;
+
+ case MODE_SET_UNDO:
+ /*
+ * If we set successfully (status == NOERROR),
+ * we can't back out again, so need to report the fact.
+ * If we failed to set successfully, then we're fine.
+ */
+ for (request = requests; request; request=request->next) {
+ if (request->status == SNMP_ERR_NOERROR) {
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_UNDOFAILED);
+ return SNMP_ERR_UNDOFAILED;
+ }
+ }
+ return SNMP_ERR_NOERROR;
+
+ case MODE_SET_RESERVE1:
+ case MODE_SET_RESERVE2:
+ case MODE_SET_FREE:
+ case MODE_SET_COMMIT:
+ /*
+ * Nothing to do in this pass
+ */
+ return SNMP_ERR_NOERROR;
+
+ default:
+ snmp_log(LOG_WARNING, "unsupported mode for proxy called (%d)\n",
+ reqinfo->mode);
+ return SNMP_ERR_NOERROR;
+ }
+
+ sp = (struct simple_proxy *) handler->myvoid;
+
+ if (!pdu || !sp) {
+ netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_GENERR);
+ return SNMP_ERR_NOERROR;
+ }
+
+ while (request) {
+ ourname = request->requestvb->name;
+ ourlength = request->requestvb->name_length;
+
+ if (sp->base_len > 0) {
+ if ((ourlength - sp->name_len + sp->base_len) > MAX_OID_LEN) {
+ /*
+ * too large
+ */
+ snmp_log(LOG_ERR,
+ "proxy oid request length is too long\n");
+ return SNMP_ERR_NOERROR;
+ }
+ /*
+ * suffix appended?
+ */
+ DEBUGMSGTL(("proxy", "length=%d, base_len=%d, name_len=%d\n",
+ ourlength, sp->base_len, sp->name_len));
+ if (ourlength > (int) sp->name_len)
+ memcpy(&(sp->base[sp->base_len]), &(ourname[sp->name_len]),
+ sizeof(oid) * (ourlength - sp->name_len));
+ ourlength = ourlength - sp->name_len + sp->base_len;
+ ourname = sp->base;
+ }
+
+ snmp_pdu_add_variable(pdu, ourname, ourlength,
+ request->requestvb->type,
+ request->requestvb->val.string,
+ request->requestvb->val_len);
+ request->delegated = 1;
+ request = request->next;
+ }
+
+ /*
+ * Customize session parameters based on request information
+ */
+ if (!proxy_fill_in_session(handler, reqinfo, (void **)&configured)) {
+ netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_GENERR);
+ return SNMP_ERR_NOERROR;
+ }
+
+ /*
+ * send the request out
+ */
+ DEBUGMSGTL(("proxy", "sending pdu\n"));
+ snmp_async_send(sp->sess, pdu, proxy_got_response,
+ netsnmp_create_delegated_cache(handler, reginfo,
+ reqinfo, requests,
+ (void *) sp));
+
+ /* Free any special parameters generated on the session */
+ proxy_free_filled_in_session_args(sp->sess, (void **)&configured);
+
+ return SNMP_ERR_NOERROR;
+}
+
+int
+proxy_got_response(int operation, netsnmp_session * sess, int reqid,
+ netsnmp_pdu *pdu, void *cb_data)
+{
+ netsnmp_delegated_cache *cache = (netsnmp_delegated_cache *) cb_data;
+ netsnmp_request_info *requests, *request = NULL;
+ netsnmp_variable_list *vars, *var = NULL;
+
+ struct simple_proxy *sp;
+ oid myname[MAX_OID_LEN];
+ size_t myname_len = MAX_OID_LEN;
+
+ cache = netsnmp_handler_check_cache(cache);
+
+ if (!cache) {
+ DEBUGMSGTL(("proxy", "a proxy request was no longer valid.\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ requests = cache->requests;
+
+
+ sp = (struct simple_proxy *) cache->localinfo;
+
+ if (!sp) {
+ DEBUGMSGTL(("proxy", "a proxy request was no longer valid.\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ switch (operation) {
+ case NETSNMP_CALLBACK_OP_TIMED_OUT:
+ /*
+ * WWWXXX: don't leave requests delayed if operation is
+ * something like TIMEOUT
+ */
+ DEBUGMSGTL(("proxy", "got timed out... requests = %08p\n", requests));
+
+ netsnmp_handler_mark_requests_as_delegated(requests,
+ REQUEST_IS_NOT_DELEGATED);
+ if(cache->reqinfo->mode != MODE_GETNEXT) {
+ DEBUGMSGTL(("proxy", " ignoring timeout\n"));
+ netsnmp_set_request_error(cache->reqinfo, requests, /* XXXWWW: should be index = 0 */
+ SNMP_ERR_GENERR);
+ }
+ netsnmp_free_delegated_cache(cache);
+ return 0;
+
+ case NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE:
+ vars = pdu->variables;
+
+ if (pdu->errstat != SNMP_ERR_NOERROR) {
+ /*
+ * If we receive an error from the proxy agent, pass it on up.
+ * The higher-level processing seems to Do The Right Thing.
+ *
+ * 2005/06 rks: actually, it doesn't do the right thing for
+ * a get-next request that returns NOSUCHNAME. If we do nothing,
+ * it passes that error back to the comman initiator. What it should
+ * do is ignore the error and move on to the next tree. To
+ * accomplish that, all we need to do is clear the delegated flag.
+ * Not sure if any other error codes need the same treatment. Left
+ * as an exercise to the reader...
+ */
+ DEBUGMSGTL(("proxy", "got error response (%d)\n", pdu->errstat));
+ if((cache->reqinfo->mode == MODE_GETNEXT) &&
+ (SNMP_ERR_NOSUCHNAME == pdu->errstat)) {
+ DEBUGMSGTL(("proxy", " ignoring error response\n"));
+ netsnmp_handler_mark_requests_as_delegated(requests,
+ REQUEST_IS_NOT_DELEGATED);
+ }
+ else if ((cache->reqinfo->mode == MODE_SET_ACTION)) {
+ /*
+ * In order for netsnmp_wrap_up_request to consider the
+ * SET request complete,
+ * there must be no delegated requests pending.
+ * https://sourceforge.net/tracker/
+ * ?func=detail&atid=112694&aid=1554261&group_id=12694
+ */
+ DEBUGMSGTL(("proxy",
+ "got SET error %s, index %d\n",
+ snmp_errstring(pdu->errstat), pdu->errindex));
+ netsnmp_handler_mark_requests_as_delegated(
+ requests, REQUEST_IS_NOT_DELEGATED);
+ netsnmp_request_set_error_idx(requests, pdu->errstat,
+ pdu->errindex);
+ }
+ else {
+ netsnmp_handler_mark_requests_as_delegated( requests,
+ REQUEST_IS_NOT_DELEGATED);
+ netsnmp_request_set_error_idx(requests, pdu->errstat,
+ pdu->errindex);
+ }
+
+ /*
+ * update the original request varbinds with the results
+ */
+ } else for (var = vars, request = requests;
+ request && var;
+ request = request->next, var = var->next_variable) {
+ /*
+ * XXX - should this be done here?
+ * Or wait until we know it's OK?
+ */
+ snmp_set_var_typed_value(request->requestvb, var->type,
+ var->val.string, var->val_len);
+
+ DEBUGMSGTL(("proxy", "got response... "));
+ DEBUGMSGOID(("proxy", var->name, var->name_length));
+ DEBUGMSG(("proxy", "\n"));
+ request->delegated = 0;
+
+ /*
+ * Check the response oid is legitimate,
+ * and discard the value if not.
+ *
+ * XXX - what's the difference between these cases?
+ */
+ if (sp->base_len &&
+ (var->name_length < sp->base_len ||
+ snmp_oid_compare(var->name, sp->base_len, sp->base,
+ sp->base_len) != 0)) {
+ DEBUGMSGTL(( "proxy", "out of registered range... "));
+ DEBUGMSGOID(("proxy", var->name, sp->base_len));
+ DEBUGMSG(( "proxy", " (%d) != ", sp->base_len));
+ DEBUGMSGOID(("proxy", sp->base, sp->base_len));
+ DEBUGMSG(( "proxy", "\n"));
+ snmp_set_var_typed_value(request->requestvb, ASN_NULL, NULL, 0);
+
+ continue;
+ } else if (!sp->base_len &&
+ (var->name_length < sp->name_len ||
+ snmp_oid_compare(var->name, sp->name_len, sp->name,
+ sp->name_len) != 0)) {
+ DEBUGMSGTL(( "proxy", "out of registered base range... "));
+ DEBUGMSGOID(("proxy", var->name, sp->name_len));
+ DEBUGMSG(( "proxy", " (%d) != ", sp->name_len));
+ DEBUGMSGOID(("proxy", sp->name, sp->name_len));
+ DEBUGMSG(( "proxy", "\n"));
+ snmp_set_var_typed_value(request->requestvb, ASN_NULL, NULL, 0);
+ continue;
+ } else {
+ /*
+ * If the returned OID is legitimate, then update
+ * the original request varbind accordingly.
+ */
+ if (sp->base_len) {
+ /*
+ * XXX: oid size maxed?
+ */
+ memcpy(myname, sp->name, sizeof(oid) * sp->name_len);
+ myname_len =
+ sp->name_len + var->name_length - sp->base_len;
+ if (myname_len > MAX_OID_LEN) {
+ snmp_log(LOG_WARNING,
+ "proxy OID return length too long.\n");
+ netsnmp_set_request_error(cache->reqinfo, requests,
+ SNMP_ERR_GENERR);
+ if (pdu)
+ snmp_free_pdu(pdu);
+ netsnmp_free_delegated_cache(cache);
+ return 1;
+ }
+
+ if (var->name_length > sp->base_len)
+ memcpy(&myname[sp->name_len],
+ &var->name[sp->base_len],
+ sizeof(oid) * (var->name_length -
+ sp->base_len));
+ snmp_set_var_objid(request->requestvb, myname,
+ myname_len);
+ } else {
+ snmp_set_var_objid(request->requestvb, var->name,
+ var->name_length);
+ }
+ }
+ }
+
+ if (request || var) {
+ /*
+ * ack, this is bad. The # of varbinds don't match and
+ * there is no way to fix the problem
+ */
+ if (pdu)
+ snmp_free_pdu(pdu);
+ snmp_log(LOG_ERR,
+ "response to proxy request illegal. We're screwed.\n");
+ netsnmp_set_request_error(cache->reqinfo, requests,
+ SNMP_ERR_GENERR);
+ }
+
+ /* fix bulk_to_next operations */
+ if (cache->reqinfo->mode == MODE_GETBULK)
+ netsnmp_bulk_to_next_fix_requests(requests);
+
+ /*
+ * free the response
+ */
+ if (pdu && 0)
+ snmp_free_pdu(pdu);
+ break;
+
+ default:
+ DEBUGMSGTL(("proxy", "no response received: op = %d\n",
+ operation));
+ break;
+ }
+
+ netsnmp_free_delegated_cache(cache);
+ return 1;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/proxy.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/proxy.h
new file mode 100644
index 0000000000..b715d43643
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/proxy.h
@@ -0,0 +1,22 @@
+#ifndef UCD_SNMP_PROXY_H
+#define UCD_SNMP_PROXY_H
+
+struct simple_proxy {
+ struct variable2 *variables;
+ oid name[MAX_OID_LEN];
+ size_t name_len;
+ oid base[MAX_OID_LEN];
+ size_t base_len;
+ char *context;
+ netsnmp_session *sess;
+ struct simple_proxy *next;
+};
+
+int proxy_got_response(int, netsnmp_session *, int,
+ netsnmp_pdu *, void *);
+void proxy_parse_config(const char *, char *);
+void init_proxy(void);
+void shutdown_proxy(void);
+Netsnmp_Node_Handler proxy_handler;
+
+#endif /* UCD_SNMP_PROXY_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/versioninfo.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/versioninfo.c
new file mode 100644
index 0000000000..c74a043919
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/versioninfo.c
@@ -0,0 +1,224 @@
+#include <net-snmp/net-snmp-config.h>
+
+#include <sys/types.h>
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "versioninfo.h"
+#include "util_funcs.h"
+
+void
+init_versioninfo(void)
+{
+
+ /*
+ * define the structure we're going to ask the agent to register our
+ * information at
+ */
+ struct variable2 extensible_version_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_version, 1,
+ {MIBINDEX}},
+ {VERTAG, ASN_OCTET_STR, RONLY, var_extensible_version, 1,
+ {VERTAG}},
+ {VERDATE, ASN_OCTET_STR, RONLY, var_extensible_version, 1,
+ {VERDATE}},
+ {VERCDATE, ASN_OCTET_STR, RONLY, var_extensible_version, 1,
+ {VERCDATE}},
+ {VERIDENT, ASN_OCTET_STR, RONLY, var_extensible_version, 1,
+ {VERIDENT}},
+ {VERCONFIG, ASN_OCTET_STR, RONLY, var_extensible_version, 1,
+ {VERCONFIG}},
+ {VERCLEARCACHE, ASN_INTEGER, RWRITE, var_extensible_version, 1,
+ {VERCLEARCACHE}},
+ {VERUPDATECONFIG, ASN_INTEGER, RWRITE, var_extensible_version, 1,
+ {VERUPDATECONFIG}},
+ {VERRESTARTAGENT, ASN_INTEGER, RWRITE, var_extensible_version, 1,
+ {VERRESTARTAGENT}},
+ {VERSAVEPERSISTENT, ASN_INTEGER, RWRITE, var_extensible_version, 1,
+ {VERSAVEPERSISTENT}},
+ {VERDEBUGGING, ASN_INTEGER, RWRITE, var_extensible_version, 1,
+ {VERDEBUGGING}}
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid version_variables_oid[] =
+ { NETSNMP_UCDAVIS_MIB, NETSNMP_VERSIONMIBNUM };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/versioninfo", extensible_version_variables,
+ variable2, version_variables_oid);
+
+}
+
+
+u_char *
+var_extensible_version(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+ static long long_ret;
+ static char errmsg[300];
+ char *cptr;
+ time_t curtime;
+#ifdef NETSNMP_CONFIGURE_OPTIONS
+ static char config_opts[] = NETSNMP_CONFIGURE_OPTIONS;
+#endif
+
+ DEBUGMSGTL(("ucd-snmp/versioninfo", "var_extensible_version: "));
+ DEBUGMSGOID(("ucd-snmp/versioninfo", name, *length));
+ DEBUGMSG(("ucd-snmp/versioninfo", " %d\n", exact));
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return (NULL);
+
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = name[8];
+ return ((u_char *) (&long_ret));
+ case VERTAG:
+ sprintf(errmsg, netsnmp_get_version());
+ *var_len = strlen(errmsg);
+ return ((u_char *) errmsg);
+ case VERDATE:
+ sprintf(errmsg, "$Date: 2006-09-14 17:48:50 -0700 (Thu, 14 Sep 2006) $");
+ *var_len = strlen(errmsg);
+ return ((u_char *) errmsg);
+ case VERCDATE:
+ curtime = time(NULL);
+ cptr = ctime(&curtime);
+ sprintf(errmsg, cptr);
+ *var_len = strlen(errmsg) - 1;
+ return ((u_char *) errmsg);
+ case VERIDENT:
+ sprintf(errmsg,
+ "$Id: versioninfo.c 15220 2006-09-15 00:48:50Z tanders $");
+ *var_len = strlen(errmsg);
+ return ((u_char *) errmsg);
+ case VERCONFIG:
+#ifdef NETSNMP_CONFIGURE_OPTIONS
+ *var_len = strlen(config_opts);
+ if (*var_len > 1024)
+ *var_len = 1024; /* mib imposed restriction */
+ return (u_char *) config_opts;
+#else
+ sprintf(errmsg, "");
+ *var_len = strlen(errmsg);
+ return ((u_char *) errmsg);
+#endif
+ case VERCLEARCACHE:
+ *write_method = clear_cache;
+ long_ret = 0;
+ return ((u_char *) & long_ret);
+ case VERUPDATECONFIG:
+ *write_method = update_hook;
+ long_ret = 0;
+ return ((u_char *) & long_ret);
+ case VERRESTARTAGENT:
+ *write_method = restart_hook;
+ long_ret = 0;
+ return ((u_char *) & long_ret);
+ case VERSAVEPERSISTENT:
+ *write_method = save_persistent;
+ long_ret = 0;
+ return ((u_char *) & long_ret);
+ case VERDEBUGGING:
+ *write_method = debugging_hook;
+ long_ret = snmp_get_do_debugging();
+ return ((u_char *) & long_ret);
+ }
+ return NULL;
+}
+
+int
+update_hook(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ long tmp = 0;
+
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_ERR, "Wrong type != int\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ tmp = *((long *) var_val);
+ if (tmp == 1 && action == COMMIT) {
+ update_config();
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+debugging_hook(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ long tmp = 0;
+
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("versioninfo", "Wrong type != int\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ tmp = *((long *) var_val);
+ if (action == COMMIT) {
+ snmp_set_do_debugging(tmp);
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+int
+save_persistent(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+ long tmp = 0;
+
+ if (var_val_type != ASN_INTEGER) {
+ DEBUGMSGTL(("versioninfo", "Wrong type != int\n"));
+ return SNMP_ERR_WRONGTYPE;
+ }
+ tmp = *((long *) var_val);
+ if (action == COMMIT) {
+ snmp_store(netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_APPTYPE));
+ }
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/versioninfo.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/versioninfo.h
new file mode 100644
index 0000000000..d9911476cb
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/versioninfo.h
@@ -0,0 +1,32 @@
+/*
+ * Template MIB group interface - versioninfo.h
+ *
+ */
+#ifndef _MIBGROUP_VERSIONINFO_H
+#define _MIBGROUP_VERSIONINFO_H
+
+void init_versioninfo(void);
+
+extern FindVarMethod var_extensible_version;
+extern WriteMethod update_hook;
+extern WriteMethod debugging_hook;
+extern WriteMethod save_persistent;
+
+#include "mibdefs.h"
+
+/*
+ * Version info mib
+ */
+#define VERTAG 2
+#define VERDATE 3
+#define VERCDATE 4
+#define VERIDENT 5
+#define VERCONFIG 6
+#define VERCLEARCACHE 10
+#define VERUPDATECONFIG 11
+#define VERRESTARTAGENT 12
+#define VERSAVEPERSISTENT 13
+#define VERDEBUGGING 20
+
+config_require(util_funcs)
+#endif /* _MIBGROUP_VERSIONINFO_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat.c
new file mode 100644
index 0000000000..f0d54f24ed
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat.c
@@ -0,0 +1,257 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include <net-snmp/agent/hardware/cpu.h>
+#include "vmstat.h"
+
+FindVarMethod var_extensible_vmstat;
+
+
+
+void
+init_vmstat(void)
+{
+ static oid vmstat_oid[] = { NETSNMP_UCDAVIS_MIB, 11 };
+
+ DEBUGMSGTL(("vmstat", "Initializing\n"));
+ netsnmp_register_scalar_group(
+ netsnmp_create_handler_registration("vmstat", vmstat_handler,
+ vmstat_oid, OID_LENGTH(vmstat_oid),
+ HANDLER_CAN_RONLY),
+ MIBINDEX, RAWSWAPOUT);
+}
+
+
+int
+vmstat_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+ oid obj;
+ long value = 0;
+ char cp[300];
+ netsnmp_cpu_info *info = netsnmp_cpu_get_byIdx( -1, 0 );
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ obj = requests->requestvb->name[ requests->requestvb->name_length-2 ];
+ switch (obj) {
+ case MIBINDEX: /* dummy value */
+ snmp_set_var_typed_integer(requests->requestvb, ASN_INTEGER, 1);
+ break;
+
+ case ERRORNAME: /* dummy name */
+ sprintf(cp, "systemStats");
+ snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR,
+ cp, strlen(cp));
+ break;
+
+/*
+ case IOSENT:
+ long_ret = vmstat(iosent);
+ return ((u_char *) (&long_ret));
+ case IORECEIVE:
+ long_ret = vmstat(ioreceive);
+ return ((u_char *) (&long_ret));
+ case IORAWSENT:
+ long_ret = vmstat(rawiosent);
+ return ((u_char *) (&long_ret));
+ case IORAWRECEIVE:
+ long_ret = vmstat(rawioreceive);
+ return ((u_char *) (&long_ret));
+*/
+
+ /*
+ * Raw CPU statistics
+ * Taken directly from the (overall) cpu_info structure.
+ *
+ * XXX - Need some form of flag to skip objects that
+ * aren't supported on a given architecture.
+ */
+ case CPURAWUSER:
+ snmp_set_var_typed_integer(requests->requestvb, ASN_COUNTER,
+ info->user_ticks );
+ break;
+ case CPURAWNICE:
+ snmp_set_var_typed_integer(requests->requestvb, ASN_COUNTER,
+ info->nice_ticks );
+ break;
+ case CPURAWSYSTEM:
+ /*
+ * Some architecture have traditionally reported a
+ * combination of CPU statistics for this object.
+ * The CPU HAL module uses 'sys2_ticks' for this,
+ * so use this value in preference to 'sys_ticks'
+ * if it has a non-zero value.
+ */
+ snmp_set_var_typed_integer(requests->requestvb, ASN_COUNTER,
+ info->sys2_ticks ?
+ info->sys2_ticks :
+ info->sys_ticks );
+ break;
+ case CPURAWIDLE:
+ snmp_set_var_typed_integer(requests->requestvb, ASN_COUNTER,
+ info->idle_ticks );
+ break;
+ case CPURAWWAIT:
+ snmp_set_var_typed_integer(requests->requestvb, ASN_COUNTER,
+ info->wait_ticks );
+ break;
+ case CPURAWKERNEL:
+ snmp_set_var_typed_integer(requests->requestvb, ASN_COUNTER,
+ info->kern_ticks );
+ break;
+ case CPURAWINTR:
+ snmp_set_var_typed_integer(requests->requestvb, ASN_COUNTER,
+ info->intrpt_ticks );
+ break;
+ case CPURAWSOFTIRQ:
+ snmp_set_var_typed_integer(requests->requestvb, ASN_COUNTER,
+ info->sirq_ticks );
+ break;
+
+ /*
+ * 'Cooked' CPU statistics
+ * Percentage usage of the specified statistic calculated
+ * over the period (1 min) that history is being kept for.
+ *
+ * This is actually a change of behaviour for some architectures,
+ * but:
+ * a) It ensures consistency across all systems
+ * a) It matches the definition of the MIB objects
+ *
+ * Note that this value will only be reported once the agent
+ * has a full minute's history collected.
+ */
+ case CPUUSER:
+ if ( info->history && info->history[0].total_hist ) {
+ value = (info->user_ticks - info->history[0].user_hist)*100;
+ value /= (info->total_ticks - info->history[0].total_hist);
+ snmp_set_var_typed_integer(requests->requestvb,
+ ASN_INTEGER, value);
+ }
+ break;
+ case CPUSYSTEM:
+ if ( info->history && info->history[0].total_hist ) {
+ /* or sys2_ticks ??? */
+ value = (info->sys_ticks - info->history[0].sys_hist)*100;
+ value /= (info->total_ticks - info->history[0].total_hist);
+ snmp_set_var_typed_integer(requests->requestvb,
+ ASN_INTEGER, value);
+ }
+ break;
+ case CPUIDLE:
+ if ( info->history && info->history[0].total_hist ) {
+ value = (info->idle_ticks - info->history[0].idle_hist)*100;
+ value /= (info->total_ticks - info->history[0].total_hist);
+ snmp_set_var_typed_integer(requests->requestvb,
+ ASN_INTEGER, value);
+ }
+ break;
+
+ /*
+ * Similarly for the Interrupt and Context switch statistics
+ * (raw and per-second, calculated over the last minute)
+ */
+ case SYSRAWINTERRUPTS:
+ snmp_set_var_typed_integer(requests->requestvb, ASN_COUNTER,
+ info->nInterrupts );
+ break;
+ case SYSRAWCONTEXT:
+ snmp_set_var_typed_integer(requests->requestvb, ASN_COUNTER,
+ info->nCtxSwitches );
+ break;
+ case SYSINTERRUPTS:
+ if ( info->history && info->history[0].total_hist ) {
+ value = (info->nInterrupts - info->history[0].intr_hist)/60;
+ snmp_set_var_typed_integer(requests->requestvb,
+ ASN_INTEGER, value);
+ }
+ break;
+ case SYSCONTEXT:
+ if ( info->history && info->history[0].total_hist ) {
+ value = (info->nCtxSwitches - info->history[0].ctx_hist)/60;
+ snmp_set_var_typed_integer(requests->requestvb,
+ ASN_INTEGER, value);
+ }
+ break;
+
+ /*
+ * Similarly for the Swap statistics...
+ */
+ case RAWSWAPIN:
+ snmp_set_var_typed_integer(requests->requestvb, ASN_COUNTER,
+ info->swapIn );
+ break;
+ case RAWSWAPOUT:
+ snmp_set_var_typed_integer(requests->requestvb, ASN_COUNTER,
+ info->swapOut );
+ break;
+ case SWAPIN:
+ if ( info->history && info->history[0].total_hist ) {
+ value = (info->swapIn - info->history[0].swpi_hist)/60;
+ /* ??? value *= PAGE_SIZE; */
+ snmp_set_var_typed_integer(requests->requestvb,
+ ASN_INTEGER, value);
+ }
+ break;
+ case SWAPOUT:
+ if ( info->history && info->history[0].total_hist ) {
+ value = (info->swapOut - info->history[0].swpo_hist)/60;
+ /* ??? value *= PAGE_SIZE; */
+ snmp_set_var_typed_integer(requests->requestvb,
+ ASN_INTEGER, value);
+ }
+ break;
+
+ /*
+ * ... and the I/O statistics.
+ */
+ case IORAWSENT:
+ snmp_set_var_typed_integer(requests->requestvb, ASN_COUNTER,
+ info->pageOut );
+ break;
+ case IORAWRECEIVE:
+ snmp_set_var_typed_integer(requests->requestvb, ASN_COUNTER,
+ info->pageIn );
+ break;
+ case IOSENT:
+ if ( info->history && info->history[0].total_hist ) {
+ value = (info->pageOut - info->history[0].pageo_hist)/60;
+ snmp_set_var_typed_integer(requests->requestvb,
+ ASN_INTEGER, value);
+ }
+ break;
+ case IORECEIVE:
+ if ( info->history && info->history[0].total_hist ) {
+ value = (info->pageIn - info->history[0].pagei_hist)/60;
+ snmp_set_var_typed_integer(requests->requestvb,
+ ASN_INTEGER, value);
+ }
+ break;
+
+ default:
+/*
+ XXX - The systemStats group is "holely", so walking it would
+ trigger this message repeatedly. We really need a form
+ of the table column registration mechanism, that would
+ work with scalar groups.
+ snmp_log(LOG_ERR,
+ "unknown object (%d) in vmstat_handler\n", (int)obj);
+ */
+ break;
+ }
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown mode (%d) in vmstat_handler\n",
+ reqinfo->mode);
+ return SNMP_ERR_GENERR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat.h
new file mode 100644
index 0000000000..b8d520256f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat.h
@@ -0,0 +1,40 @@
+/*
+ * vmstat mib groups
+ *
+ */
+#ifndef _MIBGROUP_VMSTAT_H
+#define _MIBGROUP_VMSTAT_H
+
+config_require(hardware/cpu)
+
+#include "mibdefs.h"
+
+Netsnmp_Node_Handler vmstat_handler;
+void init_vmstat(void);
+
+#define SWAPIN 3
+#define SWAPOUT 4
+#define IOSENT 5
+#define IORECEIVE 6
+#define SYSINTERRUPTS 7
+#define SYSCONTEXT 8
+#define CPUUSER 9
+#define CPUSYSTEM 10
+#define CPUIDLE 11
+#define CPUERROR 16
+#define CPURAWUSER 50
+#define CPURAWNICE 51
+#define CPURAWSYSTEM 52
+#define CPURAWIDLE 53
+#define CPURAWWAIT 54
+#define CPURAWKERNEL 55
+#define CPURAWINTR 56
+#define IORAWSENT 57
+#define IORAWRECEIVE 58
+#define SYSRAWINTERRUPTS 59
+#define SYSRAWCONTEXT 60
+#define CPURAWSOFTIRQ 61
+#define RAWSWAPIN 62
+#define RAWSWAPOUT 63
+
+#endif /* _MIBGROUP_VMSTAT_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_aix4.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_aix4.c
new file mode 100644
index 0000000000..d4904f9c41
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_aix4.c
@@ -0,0 +1,654 @@
+/*
+ * AIX4/5 cpu statistics module for net-snmp
+ *
+ * Version 0.1 - Initial release - 05/Jun/2003
+ *
+ * Derived from vmstat_solaris2.c
+ * Using libperfstat for statistics (Redbook SG24-6039)
+ *
+ * Ported to AIX by Michael Kukat <michael.kukat@to.com>
+ * Thinking Objects Software GmbH
+ * Lilienthalstraße 2
+ * 70825 Stuttgart-Korntal
+ * http://www.to.com/
+ *
+ * Thanks go to Jochen Kmietsch for the solaris2 support and
+ * to DaimlerChrysler AG Stuttgart for making this port possible
+ */
+
+/*
+ * To make lint skip the debug code and stop complaining
+ */
+#ifdef __lint
+#define NETSNMP_NO_DEBUGGING 1
+#endif
+
+/*
+ * Includes start here
+ */
+
+/*
+ * Standard includes
+ */
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <string.h>
+
+/*
+ * libperfstat structs
+ */
+#include <libperfstat.h>
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "mibdefs.h"
+#include "util_funcs.h"
+
+/*
+ * Header file for this module
+ */
+#include "vmstat.h"
+#include "vmstat_aix4.h"
+
+/*
+ * Includes end here
+ */
+
+
+/*
+ * Global structures start here
+ */
+
+/*
+ * A structure to save data gathered from the libperfstat.
+ */
+struct cpu_stat_snapshot {
+ unsigned long long css_time;
+ unsigned int css_cpus;
+ unsigned long long css_swapin;
+ unsigned long long css_swapout;
+ unsigned long long css_blocks_read;
+ unsigned long long css_blocks_write;
+ unsigned long long css_interrupts;
+ unsigned long long css_context_sw;
+ unsigned long long css_cpu[CPU_STATES];
+};
+
+/*
+ * Global structures end here
+ */
+
+
+/*
+ * Global variables start here
+ */
+
+/*
+ * Variables for the calculated values, filled in update_stats
+ * Need to be global since we need them in more than one function
+ */
+static ulong swapin;
+static ulong swapout;
+static ulong blocks_read;
+static ulong blocks_write;
+static ulong interrupts;
+static ulong context_sw;
+
+/*
+ * Since MIB wants CPU_SYSTEM, which is CPU_KERNEL + CPU_WAIT
+ */
+static long cpu_perc[CPU_STATES];
+
+/*
+ * How many snapshots we have already taken, needed for the first
+ * POLL_INTERVAL * POLL_VALUES seconds of agent running
+ */
+static unsigned int number_of_snapshots;
+
+/*
+ * The place to store the snapshots of system data in
+ */
+static struct cpu_stat_snapshot snapshot[POLL_VALUES + 1];
+
+/*
+ * And one for the raw counters, which we fill when the raw values are
+ * requested, as opposed to the absolute values, which are taken every
+ * POLL_INTERVAL seconds and calculated over POLL_INTERVAL * POLL_VALUES time
+ */
+static struct cpu_stat_snapshot raw_values;
+
+/*
+ * Global variables end here
+ */
+
+
+/*
+ * Functions start here
+ */
+
+/*
+ * Function prototype
+ */
+static void update_stats(unsigned int registrationNumber, void *clientarg);
+static int take_snapshot(struct cpu_stat_snapshot *css);
+
+/*
+ * init_vmstat_aix4 starts here
+ * Init function for this module, from prototype
+ * Defines variables handled by this module, defines root OID for
+ * this module and registers it with the agent
+ */
+
+FindVarMethod var_extensible_vmstat;
+
+void
+init_vmstat_aix4(void)
+{
+
+ /*
+ * Which variables do we service ?
+ */
+ struct variable2 extensible_vmstat_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1,
+ {ERRORNAME}},
+ {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}},
+ {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}},
+ {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}},
+ {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {IORECEIVE}},
+ {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSINTERRUPTS}},
+ {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSCONTEXT}},
+ {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}},
+ {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {CPUSYSTEM}},
+ {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}},
+ {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWUSER}},
+ {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWSYSTEM}},
+ {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWIDLE}},
+ {CPURAWWAIT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWWAIT}},
+ {CPURAWKERNEL, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWKERNEL}},
+ {IORAWSENT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {IORAWSENT}},
+ {IORAWRECEIVE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {IORAWRECEIVE}},
+ {SYSRAWINTERRUPTS, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {SYSRAWINTERRUPTS}},
+ {SYSRAWCONTEXT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {SYSRAWCONTEXT}},
+ /*
+ * Future use:
+ * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }},
+ * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }}
+ */
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid vmstat_variables_oid[] = { NETSNMP_UCDAVIS_MIB, 11 };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ * LINTED Trust me, I know what I'm doing
+ */
+ REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2,
+ vmstat_variables_oid);
+
+ /*
+ * Start with some useful data
+ */
+ update_stats(0, NULL);
+
+ /*
+ * update_stats is run every POLL_INTERVAL seconds using this routine
+ * (see 'man snmp_alarm')
+ * This is only executed once to get some useful data in the beginning
+ */
+ if (snmp_alarm_register(5, NULL, update_stats, NULL) == 0) {
+ snmp_log(LOG_WARNING,
+ "vmstat_aix4 (init): snmp_alarm_register failed.\n");
+ }
+ /*
+ * This is the one that runs update_stats every POLL_INTERVAL seconds
+ */
+ if (snmp_alarm_register(POLL_INTERVAL, SA_REPEAT, update_stats, NULL)
+ == 0) {
+ snmp_log(LOG_ERR,
+ "vmstat_aix4 (init): snmp_alarm_register failed, cannot service requests.\n");
+ }
+
+} /* init_vmstat_aix4 ends here */
+
+/*
+ * Data collection function take_snapshot starts here
+ * Get data from kernel and save into the snapshot strutcs
+ * Argument is the snapshot struct to save to. Global anyway, but looks nicer
+ */
+static int
+take_snapshot(struct cpu_stat_snapshot *css)
+{
+ /*
+ * Variables start here
+ */
+
+ /*
+ * High resolution time counter
+ */
+ struct timeval tp;
+ unsigned long long current_time;
+
+ /*
+ * see libperfstat.h, holds CPU/memory data
+ */
+ perfstat_cpu_total_t cs;
+ perfstat_memory_total_t ms;
+
+ /*
+ * The usual stuff to count on, err, by
+ */
+ int i;
+
+ /*
+ * Variables end here
+ */
+
+ /*
+ * Function starts here
+ */
+
+ /*
+ * Get time
+ */
+ gettimeofday(&tp, (struct timezone *)NULL);
+ current_time = tp.tv_sec * (unsigned long long)1000000 + tp.tv_usec;
+
+ /*
+ * If we have just gotten the data, return the values from last run (skip if-clause)
+ * This happens on a snmpwalk request. No need to read the perfstat again
+ * if we just did it less than 2 seconds ago
+ * Jumps into if-clause either when snapshot is empty or when too old
+ */
+
+ if ((css->css_time == 0)
+ || (current_time > css->css_time + 2000000)) {
+ /*
+ * Make sure we clean up before we put new data into snapshot
+ */
+ memset(css, 0, sizeof *css);
+
+ /*
+ * Update timer
+ */
+ css->css_time = current_time;
+
+ if((perfstat_cpu_total((perfstat_id_t *)NULL, &cs, sizeof(perfstat_cpu_total_t), 1) > 0) &&
+ (perfstat_memory_total((perfstat_id_t *)NULL, &ms, sizeof(perfstat_memory_total_t), 1) > 0)) {
+ css->css_cpus = cs.ncpus;
+ css->css_swapin = ms.pgspins;
+ css->css_swapout = ms.pgspouts;
+ css->css_blocks_read = cs.sysread;
+ css->css_blocks_write = cs.syswrite;
+ css->css_interrupts = cs.devintrs + cs.softintrs;
+ css->css_context_sw = cs.pswitch;
+ css->css_cpu[CPU_USER] = cs.user;
+ css->css_cpu[CPU_SYSTEM] = cs.sys;
+ css->css_cpu[CPU_IDLE] = cs.idle;
+ css->css_cpu[CPU_WAIT] = cs.wait;
+ }
+ }
+
+ /*
+ * All engines running at warp speed, no problems (if there are any engines, that is)
+ */
+ return (cs.ncpus > 0 ? 0 : -1);
+} /* take_snapshot ends here */
+
+/*
+ * This gets called every POLL_INTERVAL seconds to update the snapshots.
+ * It takes a new snapshot and drops the oldest one. This way we move
+ * the time window so we always take the values over
+ * POLL_INTERVAL * POLL_VALUES seconds and update the data used every
+ * POLL_INTERVAL seconds
+ * The alarm timer is in the init function of this module (snmp_alarm_register)
+ */
+/*
+ * ARGSUSED0
+ */
+static void
+update_stats(unsigned int registrationNumber, void *clientarg)
+{
+ /*
+ * The time between the samples we compare
+ */
+ unsigned long long time_diff;
+
+ /*
+ * Easier to use these than the snapshots, short hand pointers
+ */
+ struct cpu_stat_snapshot *css_old, *css_new;
+
+ /*
+ * The usual stuff to count on, err, by
+ */
+ int i;
+
+ /*
+ * The sum of the CPU ticks that have passed on the different CPU states, so we can calculate
+ * the percentages of each state
+ */
+ unsigned long long cpu_sum = 0;
+
+ DEBUGMSGTL(("ucd-snmp/vmstat_aix4.c:update_stats",
+ "updating stats\n"));
+
+ /*
+ * Take the current snapshot
+ */
+ if (take_snapshot(&snapshot[0]) == -1) {
+ snmp_log(LOG_WARNING,
+ "vmstat_aix4 (update_stats): Something went wrong with take_snapshot.\n");
+ return;
+ }
+
+ /*
+ * Do we have some data we can use ? An issue right after the start of the agent
+ */
+ if (number_of_snapshots > 0) {
+ /*
+ * Huh, the number of CPUs changed during run time. That is indeed s.th. worth noting, we
+ * output a humorous (more or less) syslog message and need to retake the snapshots
+ */
+ if (snapshot[0].css_cpus != snapshot[1].css_cpus) {
+ if (snapshot[0].css_cpus > snapshot[1].css_cpus) {
+ snmp_log(LOG_NOTICE,
+ "vmstat_aix4 (update_stats): Cool ! Number of CPUs increased, must be hot-pluggable.\n");
+ } else {
+ snmp_log(LOG_NOTICE,
+ "vmstat_aix4 (update_stats): Lost at least one CPU, RIP.\n");
+ }
+ /*
+ * Make all snapshots but the current one invalid
+ */
+ number_of_snapshots = 1;
+ /*
+ * Move the current one in the "first" [1] slot
+ */
+ memmove(&snapshot[1], &snapshot[0], sizeof snapshot[0]);
+ /*
+ * Erase the current one
+ */
+ memset(&snapshot[0], 0, sizeof snapshot[0]);
+ /*
+ * Try to get a new snapshot in five seconds so we can return s.th. useful
+ */
+ if (snmp_alarm_register(5, NULL, update_stats, NULL) == 0) {
+ snmp_log(LOG_WARNING,
+ "vmstat_aix4 (update_stats): snmp_alarm_register failed.\n");
+ }
+ return;
+ }
+
+ /*
+ * Short hand pointers
+ */
+ css_new = &snapshot[0];
+ css_old = &snapshot[number_of_snapshots];
+
+ /*
+ * How much time has passed between the snapshots we get the values from ?
+ */
+ time_diff =
+ (snapshot[0].css_time -
+ snapshot[number_of_snapshots].css_time) / 1000;
+
+ DEBUGMSGTL(("ucd-snmp/vmstat_aix4.c:update_stats",
+ "time_diff: %lld\n", time_diff));
+
+ /*
+ * swapin and swapout are in pages, MIB wants kB/s,so we just need to get kB and seconds
+ * For the others we need to get value per second
+ * getpagesize() returns pagesize in bytes
+ */
+ /*
+ * LINTED cast needed, really
+ */
+ swapin =
+ (uint_t) ((css_new->css_swapin - css_old->css_swapin) *
+ getpagesize() / 1024 / time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ swapout =
+ (uint_t) ((css_new->css_swapout - css_old->css_swapout) *
+ getpagesize() / 1024 / time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ blocks_read =
+ (uint_t) ((css_new->css_blocks_read - css_old->css_blocks_read) /
+ time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ blocks_write =
+ (uint_t) ((css_new->css_blocks_write - css_old->css_blocks_write) /
+ time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ interrupts =
+ (uint_t) ((css_new->css_interrupts - css_old->css_interrupts) /
+ time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ context_sw =
+ (uint_t) ((css_new->css_context_sw - css_old->css_context_sw) /
+ time_diff);
+
+ /*
+ * Loop thru all the CPU_STATES and get the differences
+ */
+ for (i = 0; i < CPU_STATES; i++) {
+ cpu_sum += (css_new->css_cpu[i] - css_old->css_cpu[i]);
+ }
+
+ /*
+ * Now calculate the absolute percentage values
+ * Looks somewhat complicated sometimes but tries to get around using floats to increase speed
+ */
+ for (i = 0; i < CPU_STATES; i++) {
+ /*
+ * Since we don't return fractions we use + 0.5 to get between 99 and 101 percent adding the values
+ * together, otherwise we would get less than 100 most of the time
+ */
+ /*
+ * LINTED has to be 'long'
+ */
+ cpu_perc[i] =
+ (long) (((css_new->css_cpu[i] - css_old->css_cpu[i]) * 100 +
+ (cpu_sum / 2)) / cpu_sum);
+ }
+ /* "system" is "kernel", we have to add "wait" to get the correct value */
+ cpu_perc[CPU_SYSTEM] += cpu_perc[CPU_WAIT];
+ }
+
+ /*
+ * Make the current one the first one and move the whole thing one place down
+ */
+ memmove(&snapshot[1], &snapshot[0],
+ (size_t) (((char *) &snapshot[POLL_VALUES]) -
+ ((char *) &snapshot[0])));
+
+ /*
+ * Erase the current one
+ */
+ memset(&snapshot[0], 0, sizeof snapshot[0]);
+
+ /*
+ * Only important on start up, we keep track of how many snapshots we have taken so far
+ */
+ if (number_of_snapshots < POLL_VALUES) {
+ number_of_snapshots++;
+ }
+} /* update_stats ends here */
+
+/*
+ * *var_extensible_vmstat starts here
+ * The guts of the module, this routine gets called to service a request
+ */
+unsigned char *
+var_extensible_vmstat(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * Needed for returning the values
+ */
+ static long long_ret;
+ static char errmsg[300];
+
+ /*
+ * set to 0 as default
+ */
+ long_ret = 0;
+
+ /*
+ * generic check whether the options passed make sense and whether the
+ */
+ /*
+ * right variable is requested
+ */
+ if (header_generic(vp, name, length, exact, var_len, write_method) !=
+ MATCH_SUCCEEDED) {
+ return (NULL);
+ }
+
+ /*
+ * The function that actually returns s.th.
+ */
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = 1;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* dummy name */
+ sprintf(errmsg, "systemStats");
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case SWAPIN:
+ return ((u_char *) (&swapin));
+ case SWAPOUT:
+ return ((u_char *) (&swapout));
+ case IOSENT:
+ return ((u_char *) (&blocks_write));
+ case IORECEIVE:
+ return ((u_char *) (&blocks_read));
+ case SYSINTERRUPTS:
+ return ((u_char *) (&interrupts));
+ case SYSCONTEXT:
+ return ((u_char *) (&context_sw));
+ case CPUUSER:
+ return ((u_char *) (&cpu_perc[CPU_USER]));
+ case CPUSYSTEM:
+ return ((u_char *) (&cpu_perc[CPU_SYSTEM]));
+ case CPUIDLE:
+ return ((u_char *) (&cpu_perc[CPU_IDLE]));
+ case CPURAWUSER:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[CPU_USER] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ /*
+ * We are missing CPURAWNICE, AIX does not account for this in the kernel so this OID can not
+ * be returned. Also, these values will roll over sooner or later and then return inaccurate data
+ * but the MIB wants Integer32 so we cannot put a counter here
+ * (Has been changed to Counter32 in the latest MIB version!)
+ */
+ case CPURAWSYSTEM:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) ((raw_values.css_cpu[CPU_SYSTEM] +
+ raw_values.css_cpu[CPU_WAIT]) / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWIDLE:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[CPU_IDLE] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWWAIT:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[CPU_WAIT] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWKERNEL:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[CPU_SYSTEM] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case IORAWSENT:
+ long_ret = (long) (raw_values.css_blocks_write);
+ return ((u_char *) (&long_ret));
+ case IORAWRECEIVE:
+ long_ret = (long) (raw_values.css_blocks_read);
+ return ((u_char *) (&long_ret));
+ case SYSRAWINTERRUPTS:
+ long_ret = (long) (raw_values.css_interrupts);
+ return ((u_char *) (&long_ret));
+ case SYSRAWCONTEXT:
+ long_ret = (long) (raw_values.css_context_sw);
+ return ((u_char *) (&long_ret));
+
+ /*
+ * reserved for future use
+ */
+ /*
+ * case ERRORFLAG:
+ * return((u_char *) (&long_ret));
+ * case ERRORMSG:
+ * return((u_char *) (&long_ret));
+ */
+ default:
+ snmp_log(LOG_ERR,
+ "vmstat_aix4: Error in request, no match found.\n");
+ }
+ return (NULL);
+} /* *var_extensible_vmstat ends here */
+
+/*
+ * Functions end here
+ */
+
+/*
+ * Program ends here
+ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_aix4.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_aix4.h
new file mode 100644
index 0000000000..50869ab9fb
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_aix4.h
@@ -0,0 +1,47 @@
+/*
+ * vmstat_aix4.h
+ * Header file for vmstat_aix4 module for UCD-SNMP
+ * Michael Kukat <michael.kukat@to.com>
+ * see vmstat_aix4.c for revision history and additional comments
+ *
+ */
+
+/*
+ * Prevent accidental double inclusions
+ */
+#ifndef _MIBGROUP_VMSTAT_AIX4_H
+#define _MIBGROUP_VMSTAT_AIX4_H
+
+ /*
+ * Directive to include utility module
+ */
+config_require(util_funcs)
+
+ /*
+ * we have to define the index ourselves, because perfstat structures
+ * use named fields in the structure for those.
+ */
+#define CPU_USER 0
+#define CPU_SYSTEM 1
+#define CPU_IDLE 2
+#define CPU_WAIT 3
+#define CPU_STATES 4
+ /*
+ * Time interval to gather system data
+ * Lower value -> more accurate data, higher value -> less CPU usage
+ * Value is in seconds
+ */
+#define POLL_INTERVAL 60
+ /*
+ * How many snapshots of system data to keep. Values returned are over
+ * time difference between first and last snapshot
+ * Using POLL_INTERVAL 60 and POLL_VALUES 5 we get the values
+ * over five minutes, which is a reasonable figure
+ */
+#define POLL_VALUES 5
+ /*
+ * Declared in vmstat_aix4.c, from prototype
+ */
+ void init_vmstat_aix4(void);
+
+#endif /* _MIBGROUP_VMSTAT_AIX4_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_bsdi4.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_bsdi4.c
new file mode 100644
index 0000000000..cb86264634
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_bsdi4.c
@@ -0,0 +1,281 @@
+/*
+ * vmstat_bsdi4.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+/*
+ * Ripped from /usr/scr/usr.bin/vmstat/vmstat.c (covering all bases)
+ */
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#include <sys/dkstat.h>
+#include <sys/buf.h>
+#include <sys/uio.h>
+#include <sys/namei.h>
+#include <sys/malloc.h>
+#include <sys/signal.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+
+#include <vm/vm_param.h>
+#include <vm/vm_extern.h>
+
+#include <time.h>
+#include <nlist.h>
+#include <kvm.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+#include <limits.h>
+
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"
+#include "vmstat.h"
+
+/*
+ * CPU percentage
+ */
+#define CPU_PRC 100
+#define BOOTTIME_SYMBOL "boottime"
+
+FindVarMethod var_extensible_vmstat;
+
+void
+init_vmstat_bsdi4(void)
+{
+
+ struct variable2 extensible_vmstat_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1,
+ {ERRORNAME}},
+ {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}},
+ {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}},
+ {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}},
+ {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {IORECEIVE}},
+ {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSINTERRUPTS}},
+ {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSCONTEXT}},
+ {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}},
+ {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {CPUSYSTEM}},
+ {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}},
+ {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWUSER}},
+ {CPURAWNICE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWNICE}},
+ {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWSYSTEM}},
+ {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWIDLE}},
+ {CPURAWKERNEL, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWKERNEL}},
+ {CPURAWINTR, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWINTR}},
+ /*
+ * Future use:
+ */
+ /*
+ * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }},
+ * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }}
+ */
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid vmstat_variables_oid[] = { NETSNMP_UCDAVIS_MIB, 11 };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2,
+ vmstat_variables_oid);
+
+}
+
+
+long
+getuptime(void)
+{
+ static time_t now, boottime;
+ time_t uptime;
+
+ if (boottime == 0)
+ auto_nlist(BOOTTIME_SYMBOL, (char *) &boottime, sizeof(boottime));
+
+ time(&now);
+ uptime = now - boottime;
+
+ return (uptime);
+}
+
+unsigned char *
+var_extensible_vmstat(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+ int loop;
+
+ time_t time_new = getuptime();
+ static time_t time_old;
+ static time_t time_diff;
+
+ static long cpu_old[CPUSTATES];
+ static long cpu_new[CPUSTATES];
+ static long cpu_diff[CPUSTATES];
+ static long cpu_total;
+ long cpu_sum;
+ double cpu_prc;
+
+ static struct vmmeter mem_old, mem_new;
+ int mem_mib[] = { CTL_VM, VM_CNT };
+ int mem_size = sizeof(struct vmmeter);
+ int cpu_mib[] = { CTL_KERN, KERN_CPUSTATS };
+ int cpu_size = sizeof(struct cpustats);
+
+ static long long_ret;
+ static char errmsg[300];
+
+ long_ret = 0; /* set to 0 as default */
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return (NULL);
+
+ /*
+ * Update structures (only if time has passed)
+ */
+ if (time_new != time_old) {
+ time_diff = time_new - time_old;
+ time_old = time_new;
+
+ /*
+ * CPU usage
+ */
+ sysctl(cpu_mib, 2, &cpu_new, &cpu_size, NULL, 0);
+
+ cpu_total = 0;
+
+ for (loop = 0; loop < CPUSTATES; loop++) {
+ cpu_diff[loop] = cpu_new[loop] - cpu_old[loop];
+ cpu_old[loop] = cpu_new[loop];
+ cpu_total += cpu_diff[loop];
+ }
+
+ if (cpu_total == 0)
+ cpu_total = 1;
+
+ /*
+ * Memory info
+ */
+ mem_old = mem_new;
+ sysctl(mem_mib, 2, &mem_new, &mem_size, NULL, 0);
+ }
+
+ /*
+ * Rate macro
+ */
+#define rate(x) (((x)+ time_diff/2) / time_diff)
+
+ /*
+ * Page-to-kb macro
+ */
+#define ptok(p) ((p) * (mem_new.v_page_size >> 10))
+
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = 1;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* dummy name */
+ sprintf(errmsg, "systemStats");
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case SWAPIN:
+ long_ret = ptok(mem_new.v_swpin - mem_old.v_swpin);
+ long_ret = rate(long_ret);
+ return ((u_char *) (&long_ret));
+ case SWAPOUT:
+ long_ret = ptok(mem_new.v_swpout - mem_old.v_swpout);
+ long_ret = rate(long_ret);
+ return ((u_char *) (&long_ret));
+ case IOSENT:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_ret = -1;
+ return ((u_char *) (&long_ret));
+ case IORECEIVE:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_ret = -1;
+ return ((u_char *) (&long_ret));
+ case SYSINTERRUPTS:
+ long_ret = rate(mem_new.v_intr - mem_old.v_intr);
+ return ((u_char *) (&long_ret));
+ case SYSCONTEXT:
+ long_ret = rate(mem_new.v_swtch - mem_old.v_swtch);
+ return ((u_char *) (&long_ret));
+ case CPUUSER:
+ cpu_sum = cpu_diff[CP_USER] + cpu_diff[CP_NICE];
+ cpu_prc = (float) cpu_sum / (float) cpu_total;
+ long_ret = cpu_prc * CPU_PRC;
+ return ((u_char *) (&long_ret));
+ case CPUSYSTEM:
+ cpu_sum = cpu_diff[CP_SYS] + cpu_diff[CP_INTR];
+ cpu_prc = (float) cpu_sum / (float) cpu_total;
+ long_ret = cpu_prc * CPU_PRC;
+ return ((u_char *) (&long_ret));
+ case CPUIDLE:
+ cpu_sum = cpu_diff[CP_IDLE];
+ cpu_prc = (float) cpu_sum / (float) cpu_total;
+ long_ret = cpu_prc * CPU_PRC;
+ return ((u_char *) (&long_ret));
+ case CPURAWUSER:
+ long_ret = cpu_new[CP_USER];
+ return ((u_char *) (&long_ret));
+ case CPURAWNICE:
+ long_ret = cpu_new[CP_NICE];
+ return ((u_char *) (&long_ret));
+ case CPURAWSYSTEM:
+ long_ret = cpu_new[CP_SYS] + cpu_new[CP_INTR];
+ return ((u_char *) (&long_ret));
+ case CPURAWIDLE:
+ long_ret = cpu_new[CP_IDLE];
+ return ((u_char *) (&long_ret));
+ case CPURAWKERNEL:
+ long_ret = cpu_new[CP_SYS];
+ return ((u_char *) (&long_ret));
+ case CPURAWINTR:
+ long_ret = cpu_new[CP_INTR];
+ return ((u_char *) (&long_ret));
+ /*
+ * reserved for future use
+ */
+ /*
+ * case ERRORFLAG:
+ * return((u_char *) (&long_ret));
+ * case ERRORMSG:
+ * return((u_char *) (&long_ret));
+ */
+ }
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_bsdi4.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_bsdi4.h
new file mode 100644
index 0000000000..0b67a12385
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_bsdi4.h
@@ -0,0 +1,12 @@
+/*
+ * vmstat mib groups
+ *
+ */
+#ifndef _MIBGROUP_VMSTAT_BSDI4_H
+#define _MIBGROUP_VMSTAT_BSDI4_H
+
+#include "mibdefs.h"
+
+void init_vmstat_bsdi4(void);
+
+#endif /* _MIBGROUP_VMSTAT_BSDI4_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_darwin7.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_darwin7.c
new file mode 100644
index 0000000000..70415e5e9e
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_darwin7.c
@@ -0,0 +1,317 @@
+/*
+ * vmstat_darwin7.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+/*
+ * Ripped from /usr/scr/usr.bin/vmstat/vmstat.c (covering all bases)
+ */
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#include <sys/dkstat.h>
+#include <sys/buf.h>
+#include <sys/uio.h>
+#include <sys/malloc.h>
+#include <sys/signal.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+
+#if HAVE_SYS_VMPARAM_H
+#include <sys/vmparam.h>
+#else
+#include <vm/vm_param.h>
+#endif
+
+#include <time.h>
+#include <nlist.h>
+#include <kvm.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+#include <limits.h>
+
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"
+#include "vmstat.h"
+#include "vmstat_darwin7.h"
+
+
+/*
+ * nlist symbols
+ */
+#define CPTIME_SYMBOL "cp_time"
+#define SUM_SYMBOL "cnt"
+#define INTRCNT_SYMBOL "intrcnt"
+#define EINTRCNT_SYMBOL "eintrcnt"
+#define BOOTTIME_SYMBOL "boottime"
+
+/*
+ * Number of interrupts
+ */
+#define INT_COUNT 10
+
+/*
+ * CPU percentage
+ */
+#define CPU_PRC 100
+
+FindVarMethod var_extensible_vmstat;
+
+void
+init_vmstat_darwin7(void)
+{
+
+ struct variable2 extensible_vmstat_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1,
+ {ERRORNAME}},
+ {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}},
+ {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}},
+ {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}},
+ {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {IORECEIVE}},
+ {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSINTERRUPTS}},
+ {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSCONTEXT}},
+ {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}},
+ {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {CPUSYSTEM}},
+ {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}},
+ {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWUSER}},
+ {CPURAWNICE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWNICE}},
+ {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWSYSTEM}},
+ {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWIDLE}},
+ {CPURAWKERNEL, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWKERNEL}},
+ {CPURAWINTR, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWINTR}},
+ {SYSRAWINTERRUPTS, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {SYSRAWINTERRUPTS}},
+ {SYSRAWCONTEXT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {SYSRAWCONTEXT}},
+ /*
+ * Future use:
+ */
+ /*
+ * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }},
+ * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }}
+ */
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid vmstat_variables_oid[] = { NETSNMP_UCDAVIS_MIB, 11 };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2,
+ vmstat_variables_oid);
+
+}
+
+
+long
+getuptime(void)
+{
+ static time_t now, boottime;
+ time_t uptime;
+
+ if (boottime == 0)
+ auto_nlist(BOOTTIME_SYMBOL, (char *) &boottime, sizeof(boottime));
+
+ time(&now);
+ uptime = now - boottime;
+
+ return (uptime);
+}
+
+unsigned char *
+var_extensible_vmstat(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+ int loop;
+
+ time_t time_new = getuptime();
+ static time_t time_old;
+ static time_t time_diff;
+
+/* static long cpu_old[CPUSTATES];
+ static long cpu_new[CPUSTATES];
+ static long cpu_diff[CPUSTATES]; */
+ static long cpu_total;
+ long cpu_sum;
+ double cpu_prc;
+
+ static struct vmmeter mem_old, mem_new;
+
+ static long long_ret;
+ static char errmsg[300];
+
+ long_ret = 0; /* set to 0 as default */
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return (NULL);
+
+ /*
+ * Update structures (only if time has passed)
+ * we only update every 30 seconds so that we don't
+ * get strange results, especially with cpu information
+ */
+ if (time_new > time_old + 30) {
+ time_diff = time_new - time_old;
+ time_old = time_new;
+
+ /*
+ * CPU usage
+ */
+/* auto_nlist(CPTIME_SYMBOL, (char *) cpu_new, sizeof(cpu_new)); */
+
+ cpu_total = 0;
+
+/* for (loop = 0; loop < CPUSTATES; loop++) {
+ cpu_diff[loop] = cpu_new[loop] - cpu_old[loop];
+ cpu_old[loop] = cpu_new[loop];
+ cpu_total += cpu_diff[loop];
+ }
+ */
+
+ if (cpu_total == 0)
+ cpu_total = 1;
+
+ /*
+ * Memory info
+ */
+ mem_old = mem_new;
+ auto_nlist(SUM_SYMBOL, (char *) &mem_new, sizeof(mem_new));
+ }
+
+ /*
+ * Rate macro
+ */
+#define rate(x) (((x)+ time_diff/2) / time_diff)
+
+ /*
+ * Page-to-kb macro
+ */
+#define ptok(p) ((p) * (mem_new.v_page_size >> 10))
+
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = 1;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* dummy name */
+ sprintf(errmsg, "systemStats");
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case SWAPIN:
+#if defined(openbsd2) || defined(darwin)
+ long_ret = ptok(mem_new.v_swpin - mem_old.v_swpin);
+#else
+ long_ret = ptok(mem_new.v_swappgsin - mem_old.v_swappgsin +
+ mem_new.v_vnodepgsin - mem_old.v_vnodepgsin);
+#endif
+ long_ret = rate(long_ret);
+ return ((u_char *) (&long_ret));
+ case SWAPOUT:
+#if defined(openbsd2) || defined(darwin)
+ long_ret = ptok(mem_new.v_swpout - mem_old.v_swpout);
+#else
+ long_ret = ptok(mem_new.v_swappgsout - mem_old.v_swappgsout +
+ mem_new.v_vnodepgsout - mem_old.v_vnodepgsout);
+#endif
+ long_ret = rate(long_ret);
+ return ((u_char *) (&long_ret));
+ case IOSENT:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_ret = -1;
+ return ((u_char *) (&long_ret));
+ case IORECEIVE:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_ret = -1;
+ return ((u_char *) (&long_ret));
+ case SYSINTERRUPTS:
+ long_ret = rate(mem_new.v_intr - mem_old.v_intr);
+ return ((u_char *) (&long_ret));
+ case SYSCONTEXT:
+ long_ret = rate(mem_new.v_swtch - mem_old.v_swtch);
+ return ((u_char *) (&long_ret));
+ case CPUUSER:
+/* cpu_sum = cpu_diff[CP_USER] + cpu_diff[CP_NICE];
+ cpu_prc = (float) cpu_sum / (float) cpu_total;
+ long_ret = cpu_prc * CPU_PRC; */
+ return ((u_char *) (&long_ret));
+ case CPUSYSTEM:
+/* cpu_sum = cpu_diff[CP_SYS] + cpu_diff[CP_INTR];
+ cpu_prc = (float) cpu_sum / (float) cpu_total;
+ long_ret = cpu_prc * CPU_PRC; */
+ return ((u_char *) (&long_ret));
+ case CPUIDLE:
+/* cpu_sum = cpu_diff[CP_IDLE];
+ cpu_prc = (float) cpu_sum / (float) cpu_total;
+ long_ret = cpu_prc * CPU_PRC; */
+ return ((u_char *) (&long_ret));
+ case CPURAWUSER:
+/* long_ret = cpu_new[CP_USER]; */
+ return ((u_char *) (&long_ret));
+ case CPURAWNICE:
+/* long_ret = cpu_new[CP_NICE]; */
+ return ((u_char *) (&long_ret));
+ case CPURAWSYSTEM:
+/* long_ret = cpu_new[CP_SYS] + cpu_new[CP_INTR]; */
+ return ((u_char *) (&long_ret));
+ case CPURAWIDLE:
+/* long_ret = cpu_new[CP_IDLE]; */
+ return ((u_char *) (&long_ret));
+ case CPURAWKERNEL:
+/* long_ret = cpu_new[CP_SYS]; */
+ return ((u_char *) (&long_ret));
+ case CPURAWINTR:
+/* long_ret = cpu_new[CP_INTR]; */
+ return ((u_char *) (&long_ret));
+ case SYSRAWINTERRUPTS:
+ long_ret = mem_new.v_intr;
+ return ((u_char *) (&long_ret));
+ case SYSRAWCONTEXT:
+ long_ret = mem_new.v_swtch;
+ return ((u_char *) (&long_ret));
+ /*
+ * reserved for future use
+ */
+ /*
+ * case ERRORFLAG:
+ * return((u_char *) (&long_ret));
+ * case ERRORMSG:
+ * return((u_char *) (&long_ret));
+ */
+ }
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_darwin7.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_darwin7.h
new file mode 100644
index 0000000000..f92e5095ac
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_darwin7.h
@@ -0,0 +1,12 @@
+/*
+ * vmstat mib groups
+ *
+ */
+#ifndef _MIBGROUP_VMSTAT_DARWIN7_H
+#define _MIBGROUP_VMSTAT_DARWIN7_H
+
+#include "mibdefs.h"
+
+void init_vmstat_darwin7(void);
+
+#endif /* _MIBGROUP_VMSTAT_DARWIN7_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_dynix.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_dynix.c
new file mode 100644
index 0000000000..9170b26fc4
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_dynix.c
@@ -0,0 +1,790 @@
+/*
+ * vmstat_dynix.c
+ * UCD SNMP module for systemStats section of UCD-SNMP-MIB for Dynix
+ * Patrick Hess <phess@phess.best.vwh.net>
+ *
+ * This is just a port of the vmstat_solaris2 code Version 0.7
+ *
+ */
+
+/*
+ * To make lint skip the debug code and stop complaining
+ */
+#ifdef __lint
+#define NETSNMP_NO_DEBUGGING 1
+#endif
+
+#define __NO_ASM_MACRO 1
+
+/*
+ * Includes start here
+ */
+#include <net-snmp/net-snmp-config.h>
+
+/*
+ * Standard includes
+ */
+#include <sys/tmp_ctl.h>
+#include <sys/sysperf.h>
+#include <sys/vmmeter.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "mibdefs.h"
+#include "util_funcs.h"
+
+/*
+ * Header file for this module
+ */
+#include "vmstat.h"
+#include "vmstat_dynix.h"
+
+/*
+ * Includes end here
+ */
+
+
+/*
+ * Global structures start here
+ */
+
+/*
+ * A structure to save data gathered from the kernel kstat interface to.
+ */
+/*
+ * We used to have the sys/sysinfo.h cpu_stat_t here but we did not need
+ */
+/*
+ * all of it, some in a different size and some additional ones so we build
+ */
+/*
+ * our own
+ */
+struct cpu_stat_snapshot {
+ time_t css_time;
+ unsigned int css_cpus;
+ unsigned long long css_swapin;
+ unsigned long long css_swapout;
+ unsigned long long css_blocks_read;
+ unsigned long long css_blocks_write;
+ unsigned long long css_interrupts;
+ unsigned long long css_context_sw;
+ unsigned long long css_cpu[V_CPU_STATES];
+};
+
+/*
+ * Global structures end here
+ */
+
+
+/*
+ * Global variables start here
+ */
+
+/*
+ * Variables for the calculated values, filled in update_stats
+ */
+/*
+ * Need to be global since we need them in more than one function
+ */
+static ulong swapin;
+static ulong swapout;
+static ulong blocks_read;
+static ulong blocks_write;
+static ulong interrupts;
+static ulong context_sw;
+
+/*
+ * Since MIB wants V_CPU_SYSTEM, which is V_CPU_KERNEL + V_CPU_STREAM
+ */
+static long cpu_perc[V_CPU_STATES + 1];
+
+/*
+ * How many snapshots we have already taken, needed for the first
+ */
+/*
+ * POLL_INTERVAL * POLL_VALUES seconds of agent running
+ */
+static unsigned int number_of_snapshots;
+
+/*
+ * The place to store the snapshots of system data in
+ */
+static struct cpu_stat_snapshot snapshot[POLL_VALUES + 1];
+
+/*
+ * And one for the raw counters, which we fill when the raw values are
+ */
+/*
+ * requested, as opposed to the absolute values, which are taken every
+ */
+/*
+ * POLL_INTERVAL seconds and calculated over POLL_INTERVAL * POLL_VALUES time
+ */
+static struct cpu_stat_snapshot raw_values;
+
+/*
+ * Global variables end here
+ */
+
+
+/*
+ * Functions start here
+ */
+
+/*
+ * Function prototype
+ */
+static void update_stats(unsigned int registrationNumber,
+ void *clientarg);
+static int take_snapshot(struct cpu_stat_snapshot *css);
+
+/*
+ * init_vmstat_dynix starts here
+ */
+/*
+ * Init function for this module, from prototype
+ */
+/*
+ * Defines variables handled by this module, defines root OID for
+ */
+/*
+ * this module and registers it with the agent
+ */
+
+FindVarMethod var_extensible_vmstat;
+
+void
+init_vmstat_dynix(void)
+{
+
+ /*
+ * Which variables do we service ?
+ */
+ struct variable2 extensible_vmstat_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1,
+ {ERRORNAME}},
+ {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}},
+ {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}},
+ {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}},
+ {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {IORECEIVE}},
+ {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSINTERRUPTS}},
+ {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSCONTEXT}},
+ {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}},
+ {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {CPUSYSTEM}},
+ {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}},
+ {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWUSER}},
+ {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWSYSTEM}},
+ {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWIDLE}},
+ {CPURAWWAIT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWWAIT}},
+ {CPURAWKERNEL, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWKERNEL}},
+ {IORAWSENT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {IORAWSENT}},
+ {IORAWRECEIVE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {IORAWRECEIVE}},
+ /*
+ * Future use:
+ */
+ /*
+ * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }},
+ * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }}
+ */
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ */
+ /*
+ * registering underneath
+ */
+ oid vmstat_variables_oid[] = { NETSNMP_UCDAVIS_MIB, 11 };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ /*
+ * LINTED Trust me, I know what I'm doing
+ */
+ REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2,
+ vmstat_variables_oid);
+
+ /*
+ * Start with some useful data
+ */
+ update_stats(0, NULL);
+
+ /*
+ * update_stats is run every POLL_INTERVAL seconds using this routine
+ */
+ /*
+ * (see 'man snmp_alarm')
+ */
+ /*
+ * This is only executed once to get some useful data in the beginning
+ */
+ if (snmp_alarm_register(5, NULL, update_stats, NULL) == 0) {
+ snmp_log(LOG_WARNING,
+ "vmstat_dynix (init): snmp_alarm_register failed.\n");
+ }
+ /*
+ * This is the one that runs update_stats every POLL_INTERVAL seconds
+ */
+ if (snmp_alarm_register(POLL_INTERVAL, SA_REPEAT, update_stats, NULL)
+ == 0) {
+ snmp_log(LOG_ERR,
+ "vmstat_dynix (init): snmp_alarm_register failed, cannot service requests.\n");
+ }
+
+} /* init_vmstat_dynix ends here */
+
+/*
+ * Data collection function take_snapshot starts here
+ */
+/*
+ * Get data from kernel and save into the snapshot strutcs
+ */
+/*
+ * Argument is the snapshot struct to save to. Global anyway, but looks nicer
+ */
+static int
+take_snapshot(struct cpu_stat_snapshot *css)
+{
+ /*
+ * Variables start here
+ */
+
+ /*
+ * Counters
+ */
+ unsigned int cpu_num = 0;
+
+ /*
+ * Low resolution time counter
+ */
+ time_t current_time;
+
+ /*
+ * see sys/sysperf.h, holds CPU data
+ */
+ exp_vmmeter_t *cs, *origcs = 0;
+
+ /*
+ * size of the cs struct
+ */
+ size_t vminfo_size;
+
+ /*
+ * The usual stuff to count on, err, by
+ */
+ int i;
+ int engnum = 0;
+
+ /*
+ * Variables end here
+ */
+
+ /*
+ * Function starts here
+ */
+
+ /*
+ * Get time
+ */
+ current_time = time(0);
+
+ /*
+ * If we have just gotten the data, return the values from last run (skip if-clause)
+ */
+ /*
+ * This happens on a snmpwalk request.
+ */
+ /*
+ * if we just did it less than 2 seconds ago
+ */
+ /*
+ * Jumps into if-clause either when snapshot is empty or when too old
+ */
+
+ if ((css->css_time == 0) || (current_time > css->css_time + 2)) {
+ /*
+ * Make sure we clean up before we put new data into snapshot
+ */
+ memset(css, 0, sizeof *css);
+
+ /*
+ * Get the number of CPUs we gather data from
+ */
+ if ((cpu_num = tmp_ctl(TMP_NENG, 0)) < 0) {
+ snmp_log(LOG_ERR,
+ "vmstat_dynix: (take snapshot) bad tmp_ctl return\n");
+ return (-1);
+ }
+ css->css_cpus = cpu_num;
+
+ vminfo_size = cpu_num * sizeof(exp_vmmeter_t);
+
+ if (!(cs = (exp_vmmeter_t *) malloc(vminfo_size))) {
+ snmp_log(LOG_ERR,
+ "vmstat_dynix: (take_snapshot) bad malloc return\n");
+ return (-1);
+ }
+ origcs = cs;
+
+ /*
+ * Update timer
+ */
+ css->css_time = current_time;
+
+ /*
+ * Read data from kernel into cs structure
+ */
+ /*
+ * cs is the buffer we are writing to and
+ */
+ /*
+ * vminfo_size is the size of the cs struct
+ */
+ if ((getkerndata(VMMETER_DATAID, cs, vminfo_size)) < 0) {
+ snmp_log(LOG_ERR,
+ "vmstat_dynix (take_snapshot): getkerndata failure.");
+ return (-1);
+ }
+
+ /*
+ * Get the data from each CPU
+ */
+ /*
+ * We walk through the whole vmmeter struct and sum up all the found stats,
+ */
+ /*
+ * there's one for every CPU in a machine
+ */
+ /*
+ * Okay... you can't laugh at this! I'm a C-hack, not a C-coder. :)
+ */
+ while (engnum < cpu_num) {
+
+ /*
+ * Get the data from the cs structure and sum it up in our own structure
+ */
+ css->css_swapin += (unsigned long long) cs->v_swpin;
+ css->css_swapout += (unsigned long long) cs->v_swpout;
+ css->css_blocks_read += (unsigned long long) cs->v_phread;
+ css->css_blocks_write += (unsigned long long) cs->v_phwrite;
+ css->css_interrupts += (unsigned long long) cs->v_intr;
+ css->css_context_sw += (unsigned long long) cs->v_swtch;
+
+ /*
+ * We need a for-loop for the CPU STATE values
+ */
+ for (i = 0; i < V_CPU_STATES; i++) {
+ css->css_cpu[i] += (unsigned long long) cs->v_time[i];
+ } /* end for */
+
+ cs++;
+ engnum++;
+ } /* end while */
+ }
+
+ free((void *) origcs);
+
+ /*
+ * All engines running at warp speed, no problems (if there are any engines, that is)
+ */
+ return (cpu_num > 0 ? 0 : -1);
+} /* take_snapshot ends here */
+
+/*
+ * This gets called every POLL_INTERVAL seconds to update the snapshots. It takes a new snapshot and
+ */
+/*
+ * drops the oldest one. This way we move the time window so we always take the values over
+ */
+/*
+ * POLL_INTERVAL * POLL_VALUES seconds and update the data used every POLL_INTERVAL seconds
+ */
+/*
+ * The alarm timer is in the init function of this module (snmp_alarm_register)
+ */
+/*
+ * ARGSUSED0
+ */
+static void
+update_stats(unsigned int registrationNumber, void *clientarg)
+{
+ /*
+ * The time between the samples we compare
+ */
+ time_t time_diff;
+
+ /*
+ * Easier to use these than the snapshots, short hand pointers
+ */
+ struct cpu_stat_snapshot *css_old, *css_new;
+
+ /*
+ * The usual stuff to count on, err, by
+ */
+ int i;
+
+ /*
+ * The sum of the CPU ticks that have passed on the different CPU states, so we can calculate
+ */
+ /*
+ * the percentages of each state
+ */
+ unsigned long long cpu_sum = 0;
+
+ DEBUGMSGTL(("ucd-snmp/vmstat_dynix.c:update_stats",
+ "updating stats\n"));
+
+ /*
+ * Take the current snapshot
+ */
+ if (take_snapshot(&snapshot[0]) == -1) {
+ snmp_log(LOG_WARNING,
+ "vmstat_dynix (update_stats): Something went wrong with take_snapshot.");
+ return;
+ }
+
+ /*
+ * Do we have some data we can use ? An issue right after the start of the agent
+ */
+ if (number_of_snapshots > 0) {
+ /*
+ * Huh, the number of CPUs changed during run time. That is indeed s.th. worth noting, we
+ */
+ /*
+ * output a humorous (more or less) syslog message and need to retake the snapshots
+ */
+ if (snapshot[0].css_cpus != snapshot[1].css_cpus) {
+ if (snapshot[0].css_cpus > snapshot[1].css_cpus) {
+ snmp_log(LOG_NOTICE,
+ "vmstat_dynix (update_stats): Cool ! Number of CPUs increased, must be hot-pluggable.");
+ } else {
+ snmp_log(LOG_NOTICE,
+ "vmstat_dynix (update_stats): Lost at least one CPU, RIP.");
+ }
+ /*
+ * Make all snapshots but the current one invalid
+ */
+ number_of_snapshots = 1;
+ /*
+ * Move the current one in the "first" [1] slot
+ */
+ memmove(&snapshot[1], &snapshot[0], sizeof snapshot[0]);
+ /*
+ * Erase the current one
+ */
+ memset(&snapshot[0], 0, sizeof snapshot[0]);
+ /*
+ * Try to get a new snapshot in five seconds so we can return s.th. useful
+ */
+ if (snmp_alarm_register(5, NULL, update_stats, NULL) == 0) {
+ snmp_log(LOG_WARNING,
+ "vmstat_dynix (update_stats): snmp_alarm_register failed.\n");
+ }
+ return;
+ }
+
+ /*
+ * Short hand pointers
+ */
+ css_new = &snapshot[0];
+ css_old = &snapshot[number_of_snapshots];
+
+ /*
+ * How much time has passed between the snapshots we get the values from ?
+ */
+ /*
+ * Time is in seconds
+ */
+ time_diff =
+ snapshot[0].css_time - snapshot[number_of_snapshots].css_time;
+
+ if (time_diff == 0)
+ DEBUGMSGTL(("ucd-snmp/vmstat_dynix.c:update_stats",
+ "time_diff is ZERO... watch for the segfault\n"));
+
+ DEBUGMSGTL(("ucd-snmp/vmstat_dynix.c:update_stats",
+ "time_diff: %lld\n", time_diff));
+
+ /*
+ * swapin and swapout are in pages, MIB wants kB/s,so we just need to get kB and seconds
+ */
+ /*
+ * For the others we need to get value per second
+ */
+ /*
+ * decided to use sysconf(_SC_PAGESIZE) instead to get around an #ifndef (I don't like those)
+ */
+ /*
+ * LINTED cast needed, really
+ */
+ swapin =
+ (uint_t) ((css_new->css_swapin -
+ css_old->css_swapin) * (time_t) 1000 *
+ sysconf(_SC_PAGESIZE) / 1024 / time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ swapout =
+ (uint_t) ((css_new->css_swapout -
+ css_old->css_swapout) * (time_t) 1000 *
+ sysconf(_SC_PAGESIZE) / 1024 / time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ blocks_read =
+ (uint_t) ((css_new->css_blocks_read -
+ css_old->css_blocks_read) * (time_t) 1000 /
+ time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ blocks_write =
+ (uint_t) ((css_new->css_blocks_write -
+ css_old->css_blocks_write) * (time_t) 1000 /
+ time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ interrupts =
+ (uint_t) ((css_new->css_interrupts -
+ css_old->css_interrupts) * (time_t) 1000 /
+ time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ context_sw =
+ (uint_t) ((css_new->css_context_sw -
+ css_old->css_context_sw) * (time_t) 1000 /
+ time_diff);
+
+ /*
+ * Loop thru all the V_CPU_STATES and get the differences
+ */
+ for (i = 0; i < V_CPU_STATES; i++) {
+ cpu_sum += (css_new->css_cpu[i] - css_old->css_cpu[i]);
+ }
+
+ /*
+ * Now calculate the absolute percentage values
+ */
+ /*
+ * Looks somewhat complicated sometimes but tries to get around using floats to increase speed
+ */
+ for (i = 0; i < V_CPU_STATES; i++) {
+ /*
+ * Since we don't return fractions we use + 0.5 to get between 99 and 101 percent adding the values
+ */
+ /*
+ * together, otherwise we would get less than 100 most of the time
+ */
+ /*
+ * LINTED has to be 'long'
+ */
+ cpu_perc[i] =
+ (long) (((css_new->css_cpu[i] -
+ css_old->css_cpu[i]) * 100 +
+ (cpu_sum / 2)) / cpu_sum);
+ }
+
+ /*
+ * As said before, MIB wants V_CPU_SYSTEM which is V_CPU_KERNEL + V_CPU_STREAM
+ */
+ /*
+ * LINTED has to be 'long'
+ */
+ cpu_perc[V_CPU_SYSTEM] =
+ (long) ((((css_new->css_cpu[V_CPU_KERNEL] -
+ css_old->css_cpu[V_CPU_KERNEL])
+ + (css_new->css_cpu[V_CPU_STREAM] -
+ css_old->css_cpu[V_CPU_STREAM]))
+ * 100 + (cpu_sum / 2)) / cpu_sum);
+ }
+
+ /*
+ * Make the current one the first one and move the whole thing one place down
+ */
+ memmove(&snapshot[1], &snapshot[0],
+ (size_t) (((char *) &snapshot[POLL_VALUES]) -
+ ((char *) &snapshot[0])));
+
+ /*
+ * Erase the current one
+ */
+ memset(&snapshot[0], 0, sizeof snapshot[0]);
+
+ /*
+ * Only important on start up, we keep track of how many snapshots we have taken so far
+ */
+ if (number_of_snapshots < POLL_VALUES) {
+ number_of_snapshots++;
+ }
+} /* update_stats ends here */
+
+/*
+ * *var_extensible_vmstat starts here
+ */
+/*
+ * The guts of the module, this routine gets called to service a request
+ */
+unsigned char *
+var_extensible_vmstat(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * Needed for returning the values
+ */
+ static long long_ret;
+ static char errmsg[300];
+
+ /*
+ * set to 0 as default
+ */
+ long_ret = 0;
+
+ /*
+ * generic check whether the options passed make sense and whether the
+ */
+ /*
+ * right variable is requested
+ */
+ if (header_generic(vp, name, length, exact, var_len, write_method) !=
+ MATCH_SUCCEEDED) {
+ return (NULL);
+ }
+
+ /*
+ * The function that actually returns s.th.
+ */
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = 1;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* dummy name */
+ sprintf(errmsg, "systemStats");
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case SWAPIN:
+ return ((u_char *) (&swapin));
+ case SWAPOUT:
+ return ((u_char *) (&swapout));
+ case IOSENT:
+ return ((u_char *) (&blocks_write));
+ case IORECEIVE:
+ return ((u_char *) (&blocks_read));
+ case SYSINTERRUPTS:
+ return ((u_char *) (&interrupts));
+ case SYSCONTEXT:
+ return ((u_char *) (&context_sw));
+ case CPUUSER:
+ return ((u_char *) (&cpu_perc[V_CPU_USER]));
+ case CPUSYSTEM:
+ return ((u_char *) (&cpu_perc[V_CPU_SYSTEM]));
+ case CPUIDLE:
+ return ((u_char *) (&cpu_perc[V_CPU_IDLE]));
+ case CPURAWUSER:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[V_CPU_USER] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ /*
+ * We are missing CPURAWNICE, Dynix does not account for this in the kernel so this OID can not
+ */
+ /*
+ * be returned. Also, these values will roll over sooner or later and then return inaccurate data
+ */
+ /*
+ * but the MIB wants Integer32 so we cannot put a counter here
+ */
+ /*
+ * (Has been changed to Counter32 in the latest MIB version!)
+ */
+ case CPURAWSYSTEM:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) ((raw_values.css_cpu[V_CPU_KERNEL] +
+ raw_values.css_cpu[V_CPU_STREAM]) /
+ raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWIDLE:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[V_CPU_IDLE] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWWAIT:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[V_CPU_STREAM] /
+ raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWKERNEL:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[V_CPU_KERNEL] /
+ raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case IORAWSENT:
+ long_ret = (long) (raw_values.css_blocks_write);
+ return ((u_char *) (&long_ret));
+ case IORAWRECEIVE:
+ long_ret = (long) (raw_values.css_blocks_read);
+ return ((u_char *) (&long_ret));
+
+ /*
+ * reserved for future use
+ */
+ /*
+ * case ERRORFLAG:
+ * return((u_char *) (&long_ret));
+ * case ERRORMSG:
+ * return((u_char *) (&long_ret));
+ */
+ default:
+ snmp_log(LOG_ERR,
+ "vmstat_dynix: Error in request, no match found.\n");
+ }
+ return (NULL);
+} /* *var_extensible_vmstat ends here */
+
+/*
+ * Functions end here
+ */
+
+/*
+ * Program ends here
+ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_dynix.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_dynix.h
new file mode 100644
index 0000000000..aae1790393
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_dynix.h
@@ -0,0 +1,51 @@
+/*
+ * vmstat_dynix.h
+ * Header file for vmstat_dynix module for UCD-SNMP
+ * Patrick Hess <phess@phess.best.vwh.net>
+ *
+ */
+
+/*
+ * Prevent accidental double inclusions
+ */
+#ifndef _MIBGROUP_VMSTAT_DYNIX_H
+#define _MIBGROUP_VMSTAT_DYNIX_H
+
+/*
+ * Directive to include utility module
+ */
+config_require(util_funcs)
+
+ /*
+ * MIB wants V_CPU_SYSTEM which is sysinfo V_CPU_KERNEL + V_CPU_WAIT
+ */
+#define V_CPU_SYSTEM 4
+ /*
+ * Time interval to gather system data
+ */
+ /*
+ * Lower value -> more accurate data, higher value -> less CPU usage
+ */
+ /*
+ * Value is in seconds
+ */
+#define POLL_INTERVAL 60
+ /*
+ * How many snapshots of system data to keep. Values returned are over
+ */
+ /*
+ * time difference between first and last snapshot
+ */
+ /*
+ * Using POLL_INTERVAL 60 and POLL_VALUES 5 we get the values
+ */
+ /*
+ * over five minutes, which is a reasonable figure
+ */
+#define POLL_VALUES 5
+ /*
+ * Declared in vmstat_dynix.c, from prototype
+ */
+ void init_vmstat_dynix(void);
+
+#endif /* _MIBGROUP_VMSTAT_DYNIX_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.c
new file mode 100644
index 0000000000..8aa9c761fa
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.c
@@ -0,0 +1,322 @@
+/*
+ * vmstat_freebsd2.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+/*
+ * Ripped from /usr/scr/usr.bin/vmstat/vmstat.c (covering all bases)
+ */
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#if defined(freebsd5) && __FreeBSD_version >= 500101
+#include <sys/resource.h>
+#else
+#include <sys/dkstat.h>
+#endif
+#ifdef freebsd5
+#include <sys/bio.h>
+#endif
+#include <sys/buf.h>
+#include <sys/uio.h>
+#include <sys/namei.h>
+#include <sys/malloc.h>
+#include <sys/signal.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+
+#if HAVE_SYS_VMPARAM_H
+#include <sys/vmparam.h>
+#else
+#include <vm/vm_param.h>
+#endif
+
+#include <time.h>
+#include <nlist.h>
+#include <kvm.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+#include <limits.h>
+
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"
+#include "vmstat.h"
+#include "vmstat_freebsd2.h"
+
+
+/*
+ * nlist symbols
+ */
+#define CPTIME_SYMBOL "cp_time"
+#define SUM_SYMBOL "cnt"
+#define INTRCNT_SYMBOL "intrcnt"
+#define EINTRCNT_SYMBOL "eintrcnt"
+#define BOOTTIME_SYMBOL "boottime"
+
+/*
+ * Number of interrupts
+ */
+#define INT_COUNT 10
+
+/*
+ * CPU percentage
+ */
+#define CPU_PRC 100
+
+FindVarMethod var_extensible_vmstat;
+
+void
+init_vmstat_freebsd2(void)
+{
+
+ struct variable2 extensible_vmstat_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1,
+ {ERRORNAME}},
+ {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}},
+ {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}},
+ {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}},
+ {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {IORECEIVE}},
+ {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSINTERRUPTS}},
+ {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSCONTEXT}},
+ {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}},
+ {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {CPUSYSTEM}},
+ {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}},
+ {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWUSER}},
+ {CPURAWNICE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWNICE}},
+ {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWSYSTEM}},
+ {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWIDLE}},
+ {CPURAWKERNEL, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWKERNEL}},
+ {CPURAWINTR, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWINTR}},
+ {SYSRAWINTERRUPTS, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {SYSRAWINTERRUPTS}},
+ {SYSRAWCONTEXT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {SYSRAWCONTEXT}},
+ /*
+ * Future use:
+ */
+ /*
+ * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }},
+ * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }}
+ */
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid vmstat_variables_oid[] = { NETSNMP_UCDAVIS_MIB, 11 };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2,
+ vmstat_variables_oid);
+
+}
+
+
+long
+getuptime(void)
+{
+ static time_t now, boottime;
+ time_t uptime;
+
+ if (boottime == 0)
+ auto_nlist(BOOTTIME_SYMBOL, (char *) &boottime, sizeof(boottime));
+
+ time(&now);
+ uptime = now - boottime;
+
+ return (uptime);
+}
+
+unsigned char *
+var_extensible_vmstat(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+ int loop;
+
+ time_t time_new = getuptime();
+ static time_t time_old;
+ static time_t time_diff;
+
+ static long cpu_old[CPUSTATES];
+ static long cpu_new[CPUSTATES];
+ static long cpu_diff[CPUSTATES];
+ static long cpu_total;
+ long cpu_sum;
+ double cpu_prc;
+
+ static struct vmmeter mem_old, mem_new;
+
+ static long long_ret;
+ static char errmsg[300];
+
+ long_ret = 0; /* set to 0 as default */
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return (NULL);
+
+ /*
+ * Update structures (only if time has passed)
+ */
+ if (time_new != time_old) {
+ time_diff = time_new - time_old;
+ time_old = time_new;
+
+ /*
+ * CPU usage
+ */
+ auto_nlist(CPTIME_SYMBOL, (char *) cpu_new, sizeof(cpu_new));
+
+ cpu_total = 0;
+
+ for (loop = 0; loop < CPUSTATES; loop++) {
+ cpu_diff[loop] = cpu_new[loop] - cpu_old[loop];
+ cpu_old[loop] = cpu_new[loop];
+ cpu_total += cpu_diff[loop];
+ }
+
+ if (cpu_total == 0)
+ cpu_total = 1;
+
+ /*
+ * Memory info
+ */
+ mem_old = mem_new;
+ auto_nlist(SUM_SYMBOL, (char *) &mem_new, sizeof(mem_new));
+ }
+
+ /*
+ * Rate macro
+ */
+#define rate(x) (((x)+ time_diff/2) / time_diff)
+
+ /*
+ * Page-to-kb macro
+ */
+#define ptok(p) ((p) * (mem_new.v_page_size >> 10))
+
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = 1;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* dummy name */
+ sprintf(errmsg, "systemStats");
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case SWAPIN:
+#if defined(openbsd2) || defined(darwin)
+ long_ret = ptok(mem_new.v_swpin - mem_old.v_swpin);
+#else
+ long_ret = ptok(mem_new.v_swappgsin - mem_old.v_swappgsin +
+ mem_new.v_vnodepgsin - mem_old.v_vnodepgsin);
+#endif
+ long_ret = rate(long_ret);
+ return ((u_char *) (&long_ret));
+ case SWAPOUT:
+#if defined(openbsd2) || defined(darwin)
+ long_ret = ptok(mem_new.v_swpout - mem_old.v_swpout);
+#else
+ long_ret = ptok(mem_new.v_swappgsout - mem_old.v_swappgsout +
+ mem_new.v_vnodepgsout - mem_old.v_vnodepgsout);
+#endif
+ long_ret = rate(long_ret);
+ return ((u_char *) (&long_ret));
+ case IOSENT:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_ret = -1;
+ return ((u_char *) (&long_ret));
+ case IORECEIVE:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_ret = -1;
+ return ((u_char *) (&long_ret));
+ case SYSINTERRUPTS:
+ long_ret = rate(mem_new.v_intr - mem_old.v_intr);
+ return ((u_char *) (&long_ret));
+ case SYSCONTEXT:
+ long_ret = rate(mem_new.v_swtch - mem_old.v_swtch);
+ return ((u_char *) (&long_ret));
+ case CPUUSER:
+ cpu_sum = cpu_diff[CP_USER] + cpu_diff[CP_NICE];
+ cpu_prc = (float) cpu_sum / (float) cpu_total;
+ long_ret = cpu_prc * CPU_PRC;
+ return ((u_char *) (&long_ret));
+ case CPUSYSTEM:
+ cpu_sum = cpu_diff[CP_SYS] + cpu_diff[CP_INTR];
+ cpu_prc = (float) cpu_sum / (float) cpu_total;
+ long_ret = cpu_prc * CPU_PRC;
+ return ((u_char *) (&long_ret));
+ case CPUIDLE:
+ cpu_sum = cpu_diff[CP_IDLE];
+ cpu_prc = (float) cpu_sum / (float) cpu_total;
+ long_ret = cpu_prc * CPU_PRC;
+ return ((u_char *) (&long_ret));
+ case CPURAWUSER:
+ long_ret = cpu_new[CP_USER];
+ return ((u_char *) (&long_ret));
+ case CPURAWNICE:
+ long_ret = cpu_new[CP_NICE];
+ return ((u_char *) (&long_ret));
+ case CPURAWSYSTEM:
+ long_ret = cpu_new[CP_SYS] + cpu_new[CP_INTR];
+ return ((u_char *) (&long_ret));
+ case CPURAWIDLE:
+ long_ret = cpu_new[CP_IDLE];
+ return ((u_char *) (&long_ret));
+ case CPURAWKERNEL:
+ long_ret = cpu_new[CP_SYS];
+ return ((u_char *) (&long_ret));
+ case CPURAWINTR:
+ long_ret = cpu_new[CP_INTR];
+ return ((u_char *) (&long_ret));
+ case SYSRAWINTERRUPTS:
+ long_ret = mem_new.v_intr;
+ return ((u_char *) (&long_ret));
+ case SYSRAWCONTEXT:
+ long_ret = mem_new.v_swtch;
+ return ((u_char *) (&long_ret));
+ /*
+ * reserved for future use
+ */
+ /*
+ * case ERRORFLAG:
+ * return((u_char *) (&long_ret));
+ * case ERRORMSG:
+ * return((u_char *) (&long_ret));
+ */
+ }
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.h
new file mode 100644
index 0000000000..f0e60b8e98
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_freebsd2.h
@@ -0,0 +1,12 @@
+/*
+ * vmstat mib groups
+ *
+ */
+#ifndef _MIBGROUP_VMSTAT_FREEBSD2_H
+#define _MIBGROUP_VMSTAT_FREEBSD2_H
+
+#include "mibdefs.h"
+
+void init_vmstat_freebsd2(void);
+
+#endif /* _MIBGROUP_VMSTAT_FREEBSD2_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_hpux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_hpux.c
new file mode 100644
index 0000000000..892fb7e63b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_hpux.c
@@ -0,0 +1,714 @@
+/*
+ * vmstat_hpux.c
+ * UCD SNMP module for systemStats section of UCD-SNMP-MIB for HPUX 10.x/11.x
+ */
+
+/*
+ * To make lint skip the debug code and stop complaining
+ */
+#ifdef __lint
+#define NETSNMP_NO_DEBUGGING 1
+#endif
+
+/*
+ * Includes start here
+ */
+
+/*
+ * UCD-SNMP config details
+ */
+#include <net-snmp/net-snmp-config.h>
+
+/*
+ * Standard includes
+ */
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <string.h>
+
+/*
+ * pstat and sysinfo structs
+ */
+#include <sys/pstat.h>
+#include <sys/dk.h>
+
+
+/*
+ * Includes needed for all modules
+ */
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include "mibdefs.h"
+
+/*
+ * Utility functions for UCD-SNMP
+ */
+#include "util_funcs.h"
+
+/*
+ * Header file for this module
+ */
+#include "vmstat.h"
+#include "vmstat_hpux.h"
+
+/*
+ * Includes end here
+ */
+
+
+/*
+ * Global structures start here
+ */
+
+/*
+ * A structure to save data gathered from the kernel pstat interface to.
+ * CPUSTATES are defined as (see sys/dk.h):
+ * #define CPUSTATES 9 -- number of CPU states
+ * #define CP_USER 0 -- user mode of USER process
+ * #define CP_NICE 1 -- user mode of USER process at nice priority
+ * #define CP_SYS 2 -- kernel mode of USER process
+ * #define CP_IDLE 3 -- IDLE mode
+ * #define CP_WAIT 4
+ * #define CP_BLOCK 5 -- time blocked on a spinlock
+ * #define CP_SWAIT 6 -- time blocked on the kernel semaphore
+ * #define CP_INTR 7 -- INTERRUPT mode
+ * #define CP_SSYS 8 -- kernel mode of KERNEL process
+ */
+
+struct cpu_stat_snapshot {
+ time_t css_time;
+ unsigned int css_cpus;
+ unsigned long long css_swapin;
+ unsigned long long css_swapout;
+ unsigned long long css_blocks_read;
+ unsigned long long css_blocks_write;
+ unsigned long long css_interrupts;
+ unsigned long long css_context_sw;
+ unsigned long long css_cpu[CPUSTATES];
+};
+
+/*
+ * Define a structure to hold kernel static information
+ */
+struct pst_static pst;
+
+/*
+ * Global structures end here
+ */
+
+/*
+ * Global variables start here
+ */
+
+/*
+ * Variables for the calculated values, filled in update_stats
+ * Need to be global since we need them in more than one function
+ */
+static unsigned long swapin;
+static unsigned long swapout;
+static unsigned long blocks_read;
+static unsigned long blocks_write;
+static unsigned long interrupts;
+static unsigned long context_sw;
+
+/*
+ * Since MIB wants CPU_SYSTEM, which is CP_SYS + CP_WAIT (see sys/dk.h)
+ */
+static long cpu_perc[CPUSTATES + 1];
+
+/*
+ * How many snapshots we have already taken, needed for the first
+ * POLL_INTERVAL * POLL_VALUES seconds of agent running
+ */
+static unsigned int number_of_snapshots;
+
+/*
+ * The place to store the snapshots of system data in
+ */
+static struct cpu_stat_snapshot snapshot[POLL_VALUES + 1];
+
+/*
+ * And one for the raw counters, which we fill when the raw values are
+ * requested, as opposed to the absolute values, which are taken every
+ * POLL_INTERVAL seconds and calculated over POLL_INTERVAL * POLL_VALUES time
+ */
+static struct cpu_stat_snapshot raw_values;
+
+/*
+ * Global variables end here
+ */
+
+
+/*
+ * Functions start here
+ */
+
+/*
+ * Function prototype
+ */
+static void update_stats(unsigned int registrationNumber,
+ void *clientarg);
+static int take_snapshot(struct cpu_stat_snapshot *css);
+
+/*
+ * init_vmstat_hpux starts here
+ */
+/*
+ * Init function for this module, from prototype
+ * Defines variables handled by this module, defines root OID for
+ * this module and registers it with the agent
+ */
+
+FindVarMethod var_extensible_vmstat;
+
+void
+init_vmstat_hpux(void)
+{
+
+ /*
+ * Which variables do we service ?
+ */
+ struct variable2 extensible_vmstat_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1,
+ {ERRORNAME}},
+ {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}},
+ {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}},
+ {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}},
+ {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {IORECEIVE}},
+ {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSINTERRUPTS}},
+ {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSCONTEXT}},
+ {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}},
+ {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {CPUSYSTEM}},
+ {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}},
+ {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWUSER}},
+ {CPURAWNICE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWNICE}},
+ {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWSYSTEM}},
+ {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWIDLE}},
+ {CPURAWWAIT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWWAIT}},
+ {CPURAWKERNEL, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWKERNEL}},
+ {IORAWSENT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {IORAWSENT}},
+ {IORAWRECEIVE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {IORAWRECEIVE}},
+ /*
+ * Future use:
+ */
+ /*
+ * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }},
+ * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }}
+ */
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid vmstat_variables_oid[] = { NETSNMP_UCDAVIS_MIB, 11 };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ /*
+ * LINTED Trust me, I know what I'm doing
+ */
+ REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2,
+ vmstat_variables_oid);
+
+ /*
+ * Start with some useful data
+ */
+ update_stats(0, NULL);
+
+ /*
+ * update_stats is run every POLL_INTERVAL seconds using this routine
+ * (see 'man snmp_alarm')
+ * This is only executed once to get some useful data in the beginning
+ */
+ if (snmp_alarm_register(5, NULL, update_stats, NULL) == 0) {
+ snmp_log(LOG_WARNING,
+ "vmstat_hpux (init): snmp_alarm_register failed.\n");
+ }
+ /*
+ * This is the one that runs update_stats every POLL_INTERVAL seconds
+ */
+ if (snmp_alarm_register(POLL_INTERVAL, SA_REPEAT, update_stats, NULL)
+ == 0) {
+ snmp_log(LOG_ERR,
+ "vmstat_hpux (init): snmp_alarm_register failed, cannot service requests.\n");
+ }
+
+} /* init_vmstat_hpux ends here */
+
+/*
+ * Data collection function take_snapshot starts here
+ * Get data from kernel and save into the snapshot strutcs
+ * Argument is the snapshot struct to save to. Global anyway, but looks nicer
+ */
+static int
+take_snapshot(struct cpu_stat_snapshot *css)
+{
+ /*
+ * Variables start here
+ */
+
+ struct pst_dynamic psd;
+ struct pst_processor *psp;
+ struct pst_vminfo psv;
+
+ /*
+ * time counter
+ */
+ time_t current_time;
+
+ /*
+ * The usual stuff to count on, err, by
+ */
+ int i;
+
+ /*
+ * Variables end here
+ */
+
+ /*
+ * Function starts here
+ */
+
+ /*
+ * Get time
+ */
+ time(&current_time);
+
+ /*
+ * If we have just gotten the data, return the values from last run (skip if-clause)
+ * This happens on a snmpwalk request. No need to read the pstat again
+ * if we just did it less than 2 seconds ago
+ * Jumps into if-clause either when snapshot is empty or when too old
+ */
+
+ if ((css->css_time == 0) || (current_time > css->css_time + 2)) {
+ /*
+ * Make sure we clean up before we put new data into snapshot
+ */
+ memset(css, 0, sizeof *css);
+
+ /*
+ * Update timer
+ */
+ css->css_time = current_time;
+
+ if (pstat_getdynamic(&psd, sizeof(psd), (size_t) 1, 0) != -1) {
+ css->css_cpus = psd.psd_proc_cnt;
+ DEBUGMSGTL(("take_snapshot", "*** Number of CPUs: %d\n",
+ css->css_cpus));
+
+ /*
+ * We need a for-loop for the CPU values
+ */
+ for (i = 0; i < CPUSTATES; i++) {
+ css->css_cpu[i] = (unsigned long long) psd.psd_cpu_time[i];
+ DEBUGMSGTL(("take_snapshot",
+ "*** Time for CPU state %d: %d\n", i,
+ psd.psd_cpu_time[i]));
+ }
+ psp =
+ (struct pst_processor *) malloc(css->css_cpus *
+ sizeof(*psp));
+ if (pstat_getprocessor(psp, sizeof(*psp), css->css_cpus, 0) !=
+ -1) {
+ int i;
+ for (i = 0; i < css->css_cpus; i++) {
+ css->css_blocks_read = psp[i].psp_phread;
+ css->css_blocks_write = psp[i].psp_phwrite;
+ }
+ } else
+ snmp_log(LOG_ERR,
+ "vmstat_hpux (take_snapshot): pstat_getprocessor failed!\n");
+ } else
+ snmp_log(LOG_ERR,
+ "vmstat_hpux (take_snapshot): pstat_getdynamic failed!\n");
+
+ if (pstat_getvminfo(&psv, sizeof(psv), (size_t) 1, 0) != -1) {
+ css->css_swapin = psv.psv_sswpin;
+ css->css_swapout = psv.psv_sswpout;
+ css->css_interrupts = psv.psv_sintr;
+ css->css_context_sw = psv.psv_sswtch;
+ } else
+ snmp_log(LOG_ERR,
+ "vmstat_hpux (take_snapshot): pstat_getvminfo failed!\n");
+
+ }
+
+ /*
+ * All engines running at warp speed, no problems (if there are any engines, that is)
+ */
+ return (css->css_cpus > 0 ? 0 : -1);
+} /* take_snapshot ends here */
+
+/*
+ * This gets called every POLL_INTERVAL seconds to update the snapshots. It takes a new snapshot and
+ * drops the oldest one. This way we move the time window so we always take the values over
+ * POLL_INTERVAL * POLL_VALUES seconds and update the data used every POLL_INTERVAL seconds
+ * The alarm timer is in the init function of this module (snmp_alarm_register)
+ */
+/*
+ * ARGSUSED0
+ */
+static void
+update_stats(unsigned int registrationNumber, void *clientarg)
+{
+ /*
+ * The time between the samples we compare
+ */
+ time_t time_diff;
+
+ /*
+ * Easier to use these than the snapshots, short hand pointers
+ */
+ struct cpu_stat_snapshot *css_old, *css_new;
+
+ /*
+ * The usual stuff to count on, err, by
+ */
+ int i;
+
+ /*
+ * The sum of the CPU ticks that have passed on the different CPU states, so we can calculate
+ * the percentages of each state
+ */
+ unsigned long long cpu_sum = 0;
+
+ DEBUGMSGTL(("ucd-snmp/vmstat_hpux.c:update_stats",
+ "updating stats\n"));
+
+ /*
+ * Take the current snapshot
+ */
+ if (take_snapshot(&snapshot[0]) == -1) {
+ snmp_log(LOG_WARNING,
+ "vmstat_hpux (update_stats): Something went wrong with take_snapshot.\n");
+ return;
+ }
+
+ /*
+ * Do we have some data we can use ? An issue right after the start of the agent
+ */
+ if (number_of_snapshots > 0) {
+ /*
+ * Huh, the number of CPUs changed during run time. That is indeed s.th. worth noting, we
+ * output a humorous (more or less) syslog message and need to retake the snapshots
+ */
+ if (snapshot[0].css_cpus != snapshot[1].css_cpus) {
+ if (snapshot[0].css_cpus > snapshot[1].css_cpus) {
+ snmp_log(LOG_NOTICE,
+ "vmstat_hpux (update_stats): Cool ! Number of CPUs increased, must be hot-pluggable.\n");
+ } else {
+ snmp_log(LOG_NOTICE,
+ "vmstat_hpux (update_stats): Lost at least one CPU, RIP.\n");
+ }
+ /*
+ * Make all snapshots but the current one invalid
+ */
+ number_of_snapshots = 1;
+ /*
+ * Move the current one in the "first" [1] slot
+ */
+ memmove(&snapshot[1], &snapshot[0], sizeof snapshot[0]);
+ /*
+ * Erase the current one
+ */
+ memset(&snapshot[0], 0, sizeof snapshot[0]);
+ /*
+ * Try to get a new snapshot in five seconds so we can return s.th. useful
+ */
+ if (snmp_alarm_register(5, NULL, update_stats, NULL) == 0) {
+ snmp_log(LOG_WARNING,
+ "vmstat_hpux (update_stats): snmp_alarm_register failed.\n");
+ }
+ return;
+ }
+
+ /*
+ * Short hand pointers
+ */
+ css_new = &snapshot[0];
+ css_old = &snapshot[number_of_snapshots];
+
+ /*
+ * How much time has passed between the snapshots we get the values from ?
+ */
+ time_diff =
+ (snapshot[0].css_time -
+ snapshot[number_of_snapshots].css_time);
+
+ DEBUGMSGTL(("ucd-snmp/vmstat_hpux.c:update_stats",
+ "time_diff: %lld\n", time_diff));
+
+ /*
+ * swapin and swapout are in pages, MIB wants kB/s,so we just need to get kB and seconds
+ * For the others we need to get value per second
+ * Retreive static information to obtain memory page_size
+ */
+ if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1) {
+ snmp_log(LOG_ERR, "vmstat_hpux: pstat_getstatic failed!\n");
+ }
+
+ /*
+ * LINTED cast needed, really
+ */
+ swapin =
+ (unsigned int) ((css_new->css_swapin - css_old->css_swapin) *
+ pst.page_size / 1024 / time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ swapout =
+ (unsigned int) ((css_new->css_swapout - css_old->css_swapout) *
+ pst.page_size / 1024 / time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ blocks_read =
+ (unsigned
+ int) ((css_new->css_blocks_read -
+ css_old->css_blocks_read) / time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ blocks_write =
+ (unsigned
+ int) ((css_new->css_blocks_write -
+ css_old->css_blocks_write) / time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ interrupts =
+ (unsigned
+ int) ((css_new->css_interrupts -
+ css_old->css_interrupts) / time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ context_sw =
+ (unsigned
+ int) ((css_new->css_context_sw -
+ css_old->css_context_sw) / time_diff);
+
+ /*
+ * Loop thru all the CPUSTATES and get the differences
+ */
+ for (i = 0; i < CPUSTATES; i++) {
+ cpu_sum += (css_new->css_cpu[i] - css_old->css_cpu[i]);
+ }
+
+ /*
+ * Now calculate the absolute percentage values
+ * Looks somewhat complicated sometimes but tries to get around using floats to increase speed
+ */
+ for (i = 0; i < CPUSTATES; i++) {
+ /*
+ * Since we don't return fractions we use + 0.5 to get between 99 and 101 percent adding the values
+ * together, otherwise we would get less than 100 most of the time
+ */
+ /*
+ * LINTED has to be 'long'
+ */
+ cpu_perc[i] =
+ (long) (((css_new->css_cpu[i] -
+ css_old->css_cpu[i]) * 100 +
+ (cpu_sum / 2)) / cpu_sum);
+ }
+
+ /*
+ * As said before, MIB wants CPU_SYSTEM which is CP_SYS + CP_WAIT
+ */
+ /*
+ * LINTED has to be 'long'
+ */
+ cpu_perc[CPU_SYSTEM] =
+ (long) ((((css_new->css_cpu[CP_SYS] - css_old->css_cpu[CP_SYS])
+ + (css_new->css_cpu[CP_WAIT] -
+ css_old->css_cpu[CP_WAIT]))
+ * 100 + (cpu_sum / 2)) / cpu_sum);
+ }
+
+ /*
+ * Make the current one the first one and move the whole thing one place down
+ */
+ memmove(&snapshot[1], &snapshot[0],
+ (size_t) (((char *) &snapshot[POLL_VALUES]) -
+ ((char *) &snapshot[0])));
+
+ /*
+ * Erase the current one
+ */
+ memset(&snapshot[0], 0, sizeof snapshot[0]);
+
+ /*
+ * Only important on start up, we keep track of how many snapshots we have taken so far
+ */
+ if (number_of_snapshots < POLL_VALUES) {
+ number_of_snapshots++;
+ }
+} /* update_stats ends here */
+
+/*
+ * *var_extensible_vmstat starts here
+ * The guts of the module, this routine gets called to service a request
+ */
+unsigned char *
+var_extensible_vmstat(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * Needed for returning the values
+ */
+ static long long_ret;
+ static char errmsg[300];
+
+ /*
+ * set to 0 as default
+ */
+ long_ret = 0;
+
+ /*
+ * generic check whether the options passed make sense and whether the
+ * right variable is requested
+ */
+ if (header_generic(vp, name, length, exact, var_len, write_method) !=
+ MATCH_SUCCEEDED) {
+ return (NULL);
+ }
+
+ /*
+ * The function that actually returns s.th.
+ */
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = 1;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* dummy name */
+ sprintf(errmsg, "systemStats");
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case SWAPIN:
+ return ((u_char *) (&swapin));
+ case SWAPOUT:
+ return ((u_char *) (&swapout));
+ case IOSENT:
+ return ((u_char *) (&blocks_write));
+ case IORECEIVE:
+ return ((u_char *) (&blocks_read));
+ case SYSINTERRUPTS:
+ return ((u_char *) (&interrupts));
+ case SYSCONTEXT:
+ return ((u_char *) (&context_sw));
+ case CPUUSER:
+ return ((u_char *) (&cpu_perc[CP_USER]));
+ case CPUSYSTEM:
+ return ((u_char *) (&cpu_perc[CPU_SYSTEM]));
+ case CPUIDLE:
+ return ((u_char *) (&cpu_perc[CP_IDLE]));
+ case CPURAWUSER:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[CP_USER] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWNICE:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[CP_NICE] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWSYSTEM:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) ((raw_values.css_cpu[CP_SYS] +
+ raw_values.css_cpu[CP_WAIT]) / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWIDLE:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[CP_IDLE] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWWAIT:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[CP_WAIT] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWKERNEL:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[CP_SYS] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case IORAWSENT:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret = (long) (raw_values.css_blocks_write);
+ return ((u_char *) (&long_ret));
+ case IORAWRECEIVE:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret = (long) (raw_values.css_blocks_read);
+ return ((u_char *) (&long_ret));
+
+ /*
+ * reserved for future use
+ */
+ /*
+ * case ERRORFLAG:
+ * return((u_char *) (&long_ret));
+ * case ERRORMSG:
+ * return((u_char *) (&long_ret));
+ */
+ default:
+ snmp_log(LOG_ERR,
+ "vmstat_hpux: Error in request, no match found.\n");
+ }
+ return (NULL);
+} /* *var_extensible_vmstat ends here */
+
+/*
+ * Functions end here
+ */
+
+/*
+ * Program ends here
+ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_hpux.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_hpux.h
new file mode 100644
index 0000000000..e10095e2c6
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_hpux.h
@@ -0,0 +1,55 @@
+/*
+ * vmstat_hpux.h
+ * Header file for vmstat_hpux module for UCD-SNMP
+ * Gary Edwards <garye@cadence.com>
+ *
+ */
+
+/*
+ * Prevent accidental double inclusions
+ */
+#ifndef _MIBGROUP_VMSTAT_HPUX_H
+#define _MIBGROUP_VMSTAT_HPUX_H
+
+/*
+ * Directive to include utility module
+ */
+config_require(util_funcs)
+
+ /*
+ * Make 64-bit pstat calls
+ */
+#define _PSTAT64
+ /*
+ * MIB wants CPU_SYSTEM which is CP_SYS + CP_WAIT (see sys/dk.h)
+ */
+#define CPU_SYSTEM 9
+ /*
+ * Time interval to gather system data
+ */
+ /*
+ * Lower value -> more accurate data, higher value -> less CPU usage
+ */
+ /*
+ * Value is in seconds
+ */
+#define POLL_INTERVAL 60
+ /*
+ * How many snapshots of system data to keep. Values returned are over
+ */
+ /*
+ * time difference between first and last snapshot
+ */
+ /*
+ * Using POLL_INTERVAL 60 and POLL_VALUES 5 we get the values
+ */
+ /*
+ * over five minutes, which is a reasonable figure
+ */
+#define POLL_VALUES 5
+ /*
+ * Declared in vmstat_hpux.c, from prototype
+ */
+ void init_vmstat_hpux(void);
+
+#endif /* _MIBGROUP_VMSTAT_HPUX_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_linux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_linux.c
new file mode 100644
index 0000000000..dc465f3383
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_linux.c
@@ -0,0 +1,561 @@
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include <ctype.h>
+#include <signal.h>
+#if HAVE_MACHINE_PARAM_H
+#include <machine/param.h>
+#endif
+#if HAVE_SYS_VMMETER_H
+#if !defined(bsdi2) && !defined(netbsd1)
+#include <sys/vmmeter.h>
+#endif
+#endif
+#if HAVE_SYS_CONF_H
+#include <sys/conf.h>
+#endif
+#if HAVE_SYS_FS_H
+#include <sys/fs.h>
+#else
+#if HAVE_UFS_FS_H
+#include <ufs/fs.h>
+#else
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_VNODE_H
+#include <sys/vnode.h>
+#endif
+#ifdef HAVE_UFS_UFS_QUOTA_H
+#include <ufs/ufs/quota.h>
+#endif
+#ifdef HAVE_UFS_UFS_INODE_H
+#include <ufs/ufs/inode.h>
+#endif
+#if HAVE_UFS_FFS_FS_H
+#include <ufs/ffs/fs.h>
+#endif
+#endif
+#endif
+#if HAVE_MTAB_H
+#include <mtab.h>
+#endif
+#include <sys/stat.h>
+#include <errno.h>
+#if HAVE_FSTAB_H
+#include <fstab.h>
+#endif
+#if HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#if HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#if (!defined(HAVE_STATVFS)) && defined(HAVE_STATFS)
+#if HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#if HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#if HAVE_SYS_SYSCTL_H
+#include <sys/sysctl.h>
+#endif
+#define statvfs statfs
+#endif
+#if HAVE_VM_SWAP_PAGER_H
+#include <vm/swap_pager.h>
+#endif
+#if HAVE_SYS_FIXPOINT_H
+#include <sys/fixpoint.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#include <sys/utsname.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+#include <net-snmp/agent/hardware/cpu.h>
+
+#include "mibdefs.h"
+#include "struct.h"
+#include "util_funcs.h"
+#include "vmstat.h"
+
+FindVarMethod var_extensible_vmstat;
+
+static int has_vmstat = 1;
+static int has_cpu_26 = 1;
+static time_t cache_time;
+#define CACHE_TIMEOUT 5
+
+#define STAT_FILE "/proc/stat"
+#define VMSTAT_FILE "/proc/vmstat"
+
+
+void
+init_vmstat(void)
+{
+ struct variable2 extensible_vmstat_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1,
+ {ERRORNAME}},
+ {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}},
+ {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}},
+ {RAWSWAPIN, ASN_COUNTER, RONLY, var_extensible_vmstat, 1, {RAWSWAPIN}},
+ {RAWSWAPOUT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1, {RAWSWAPOUT}},
+ {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}},
+ {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {IORECEIVE}},
+ {IORAWSENT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1, {IORAWSENT}},
+ {IORAWRECEIVE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {IORAWRECEIVE}},
+ {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSINTERRUPTS}},
+ {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSCONTEXT}},
+ {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}},
+ {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {CPUSYSTEM}},
+ {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}},
+ {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWUSER}},
+ {CPURAWNICE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWNICE}},
+ {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWSYSTEM}},
+ {CPURAWKERNEL, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWKERNEL}},
+ {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWIDLE}},
+ {SYSRAWINTERRUPTS, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {SYSRAWINTERRUPTS}},
+ {SYSRAWCONTEXT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {SYSRAWCONTEXT}},
+ {CPURAWWAIT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWWAIT}},
+ {CPURAWINTR, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWINTR}},
+ {CPURAWSOFTIRQ, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWSOFTIRQ}},
+ /*
+ * Future use:
+ */
+ /*
+ * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }},
+ * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }}
+ */
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid vmstat_variables_oid[] = { NETSNMP_UCDAVIS_MIB, 11 };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2,
+ vmstat_variables_oid);
+}
+
+
+static void
+getstat(unsigned long *cuse, unsigned long *cice, unsigned long *csys,
+ unsigned long *cide, unsigned *pin, unsigned *pout,
+ unsigned *swpin, unsigned *swpout, unsigned *itot, unsigned *i1,
+ unsigned *ct, unsigned long *ciow, unsigned long *cirq,
+ unsigned long *csoft)
+{
+ int statfd, vmstatfd;
+ static int first = 1;
+ static char *buff = NULL, *vmbuff = NULL;
+ static int bsize = 0, vmbsize = 0;
+ char *b, *c;
+ time_t now;
+ unsigned long long cpunum;
+ unsigned long long cusell = 0, cicell = 0, csysll = 0, cidell = 0,
+ ciowll = 0, cirqll = 0, csoftll = 0, ctll = 0, itotll = 0, i1ll = 0;
+
+ time(&now);
+ if (cache_time + CACHE_TIMEOUT < now) {
+ if ((statfd = open(STAT_FILE, O_RDONLY, 0)) == -1) {
+ snmp_log_perror(STAT_FILE);
+ return;
+ }
+ if (bsize == 0) {
+ bsize = 256;
+ buff = malloc(bsize);
+ }
+ while (read(statfd, buff, bsize) == bsize) {
+ bsize += 256;
+ buff = realloc(buff, bsize);
+ DEBUGMSGTL(("vmstat", "/proc/stat buffer increased to %d\n", bsize));
+ close(statfd);
+ statfd = open(STAT_FILE, O_RDONLY, 0);
+ }
+ close(statfd);
+ if (has_vmstat && (vmstatfd = open(VMSTAT_FILE, O_RDONLY, 0)) != -1) {
+ if (vmbsize == 0) {
+ vmbsize = 256;
+ vmbuff = malloc(vmbsize);
+ }
+ while (read(vmstatfd, vmbuff, vmbsize) == vmbsize) {
+ vmbsize += 256;
+ vmbuff = realloc(vmbuff, vmbsize);
+ close(vmstatfd);
+ vmstatfd = open(VMSTAT_FILE, O_RDONLY, 0);
+ }
+ close(vmstatfd);
+ }
+ else
+ has_vmstat = 0;
+ cache_time = now;
+ }
+
+ *itot = 0;
+ *i1 = 1;
+ c = buff;
+ while ((c = strstr(c+1, "cpu")) != NULL)
+ b = c;
+ sscanf(b, "cpu%llu", &cpunum);
+ cpunum++;
+ b = strstr(buff, "cpu ");
+ if (b) {
+ if (!has_cpu_26 ||
+ sscanf(b, "cpu %llu %llu %llu %llu %llu %llu %llu", &cusell,
+ &cicell, &csysll, &cidell, &ciowll, &cirqll, &csoftll) != 7) {
+ has_cpu_26 = 0;
+ sscanf(b, "cpu %llu %llu %llu %llu", &cusell, &cicell, &csysll,
+ &cidell);
+ *ciow = *cirq = *csoft = 0;
+ } else {
+ *ciow = (unsigned long)(ciowll/cpunum);
+ *cirq = (unsigned long)(cirqll/cpunum);
+ *csoft = (unsigned long)(csoftll/cpunum);
+ }
+ *cuse = (unsigned long)(cusell/cpunum);
+ *cice = (unsigned long)(cicell/cpunum);
+ *csys = (unsigned long)(csysll/cpunum);
+ *cide = (unsigned long)(cidell/cpunum);
+
+ }
+ else {
+ if (first)
+ snmp_log(LOG_ERR, "No cpu line in %s\n", STAT_FILE);
+ *cuse = *cice = *csys = *cide = *ciow = *cirq = *csoft = 0;
+ }
+ if (has_vmstat) {
+ b = strstr(vmbuff, "pgpgin ");
+ if (b)
+ sscanf(b, "pgpgin %u", pin);
+ else {
+ if (first)
+ snmp_log(LOG_ERR, "No pgpgin line in %s\n", VMSTAT_FILE);
+ *pin = 0;
+ }
+ b = strstr(vmbuff, "pgpgout ");
+ if (b)
+ sscanf(b, "pgpgout %u", pout);
+ else {
+ if (first)
+ snmp_log(LOG_ERR, "No pgpgout line in %s\n", VMSTAT_FILE);
+ *pout = 0;
+ }
+ b = strstr(vmbuff, "pswpin ");
+ if (b)
+ sscanf(b, "pswpin %u", swpin);
+ else {
+ if (first)
+ snmp_log(LOG_ERR, "No pswpin line in %s\n", VMSTAT_FILE);
+ *swpin = 0;
+ }
+ b = strstr(vmbuff, "pswpout ");
+ if (b)
+ sscanf(b, "pswpout %u", swpout);
+ else {
+ if (first)
+ snmp_log(LOG_ERR, "No pswpout line in %s\n", VMSTAT_FILE);
+ *swpout = 0;
+ }
+ }
+ else {
+ b = strstr(buff, "page ");
+ if (b)
+ sscanf(b, "page %u %u", pin, pout);
+ else {
+ if (first)
+ snmp_log(LOG_ERR, "No page line in %s\n", STAT_FILE);
+ *pin = *pout = 0;
+ }
+ b = strstr(buff, "swap ");
+ if (b)
+ sscanf(b, "swap %u %u", swpin, swpout);
+ else {
+ if (first)
+ snmp_log(LOG_ERR, "No swap line in %s\n", STAT_FILE);
+ *swpin = *swpout = 0;
+ }
+ }
+ b = strstr(buff, "intr ");
+ if (b) {
+ sscanf(b, "intr %llu %llu", &itotll, &i1ll);
+ *itot = (unsigned)itotll;
+ *i1 = (unsigned)i1ll;
+ }
+ else {
+ if (first)
+ snmp_log(LOG_ERR, "No intr line in %s\n", STAT_FILE);
+ *itot = 0;
+ }
+ b = strstr(buff, "ctxt ");
+ if (b) {
+ sscanf(b, "ctxt %llu", &ctll);
+ *ct = (unsigned long)ctll;
+ }
+ else {
+ if (first)
+ snmp_log(LOG_ERR, "No ctxt line in %s\n", STAT_FILE);
+ *ct = 0;
+ }
+ first = 0;
+}
+
+enum vmstat_index { swapin = 0, swapout,
+ rawswapin, rawswapout,
+ iosent, ioreceive,
+ rawiosent, rawioreceive,
+ sysinterrupts, syscontext,
+ cpuuser, cpusystem, cpuidle,
+ cpurawuser, cpurawnice,
+ cpurawsystem, cpurawidle,
+ cpurawinter, cpurawsoft, cpurawwait,
+ rawinterrupts, rawcontext
+};
+
+static unsigned
+vmstat(int iindex)
+{
+ double duse, dsys, didl, ddiv, divo2;
+ double druse, drnic, drsys, dridl;
+ unsigned int hertz;
+ double ddiv2;
+
+ netsnmp_cpu_info *cpu;
+ netsnmp_cpu_load();
+ cpu = netsnmp_cpu_get_byIdx( -1, 0 );
+
+ duse = cpu->user_ticks + cpu->nice_ticks;
+ dsys = cpu->sys_ticks;
+ didl = cpu->idle_ticks;
+ ddiv = duse + dsys + didl;
+ hertz = sysconf(_SC_CLK_TCK); /* get ticks/s from system */
+ divo2 = ddiv / 2;
+ druse = cpu->user_ticks;
+ drnic = cpu->nice_ticks;
+ drsys = cpu->sys_ticks;
+ dridl = cpu->idle_ticks;
+
+ ddiv2 = ddiv + cpu->wait_ticks
+ + cpu->intrpt_ticks
+ + cpu->sirq_ticks;
+ if (cpu->history) {
+ duse -= (cpu->history[0].user_hist + cpu->history[0].nice_hist);
+ dsys -= cpu->history[0].sys_hist;
+ didl -= cpu->history[0].idle_hist;
+ ddiv2 -= cpu->history[0].total_hist;
+ }
+ if (!ddiv) ddiv=1; /* Protect against division-by-0 */
+
+ switch (iindex) {
+ case swapin:
+ return (cpu->swapIn * 4 * hertz + divo2) / ddiv;
+ case swapout:
+ return (cpu->swapOut * 4 * hertz + divo2) / ddiv;
+ case iosent:
+ return (cpu->pageIn * hertz + divo2) / ddiv;
+ case ioreceive:
+ return (cpu->pageOut * hertz + divo2) / ddiv;
+ case sysinterrupts:
+ return (cpu->nInterrupts * hertz + divo2) / ddiv;
+ case syscontext:
+ return (cpu->nCtxSwitches * hertz + divo2) / ddiv;
+ case cpuuser:
+ return (ddiv2 ? 100 * duse / ddiv2 : 0);
+ case cpusystem:
+ return (ddiv2 ? 100 * dsys / ddiv2 : 0);
+ case cpuidle:
+ return (ddiv2 ? 100 * didl / ddiv2 : 0);
+ case cpurawuser:
+ return druse;
+ case cpurawnice:
+ return drnic;
+ case cpurawsystem:
+ return drsys;
+ case cpurawidle:
+ return dridl;
+ case rawinterrupts:
+ return cpu->nInterrupts;
+ case rawcontext:
+ return cpu->nCtxSwitches;
+ case cpurawwait:
+ return cpu->wait_ticks;
+ case cpurawinter:
+ return cpu->intrpt_ticks;
+ case cpurawsoft:
+ return cpu->sirq_ticks;
+ case rawiosent:
+ return cpu->pageOut*2;
+ case rawioreceive:
+ return cpu->pageIn*2;
+ case rawswapin:
+ return cpu->swapIn;
+ case rawswapout:
+ return cpu->swapOut;
+ default:
+ return -1;
+ }
+}
+
+unsigned char *
+var_extensible_vmstat(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+ static long long_ret;
+ static char errmsg[300];
+
+ long_ret = 0; /* set to 0 as default */
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return (NULL);
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = 1;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* dummy name */
+ sprintf(errmsg, "systemStats");
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case SWAPIN:
+ long_ret = vmstat(swapin);
+ return ((u_char *) (&long_ret));
+ case SWAPOUT:
+ long_ret = vmstat(swapout);
+ return ((u_char *) (&long_ret));
+ case RAWSWAPIN:
+ long_ret = vmstat(rawswapin);
+ return ((u_char *) (&long_ret));
+ case RAWSWAPOUT:
+ long_ret = vmstat(rawswapout);
+ return ((u_char *) (&long_ret));
+ case IOSENT:
+ long_ret = vmstat(iosent);
+ return ((u_char *) (&long_ret));
+ case IORECEIVE:
+ long_ret = vmstat(ioreceive);
+ return ((u_char *) (&long_ret));
+ case IORAWSENT:
+ long_ret = vmstat(rawiosent);
+ return ((u_char *) (&long_ret));
+ case IORAWRECEIVE:
+ long_ret = vmstat(rawioreceive);
+ return ((u_char *) (&long_ret));
+ case SYSINTERRUPTS:
+ long_ret = vmstat(sysinterrupts);
+ return ((u_char *) (&long_ret));
+ case SYSCONTEXT:
+ long_ret = vmstat(syscontext);
+ return ((u_char *) (&long_ret));
+ case CPUUSER:
+ long_ret = vmstat(cpuuser);
+ return ((u_char *) (&long_ret));
+ case CPUSYSTEM:
+ long_ret = vmstat(cpusystem);
+ return ((u_char *) (&long_ret));
+ case CPUIDLE:
+ long_ret = vmstat(cpuidle);
+ return ((u_char *) (&long_ret));
+ case CPURAWUSER:
+ long_ret = vmstat(cpurawuser);
+ return ((u_char *) (&long_ret));
+ case CPURAWNICE:
+ long_ret = vmstat(cpurawnice);
+ return ((u_char *) (&long_ret));
+ case CPURAWSYSTEM:
+ long_ret = vmstat(cpurawsystem)+vmstat(cpurawinter)+vmstat(cpurawsoft);
+ return ((u_char *) (&long_ret));
+ case CPURAWKERNEL:
+ long_ret = vmstat(cpurawsystem);
+ return ((u_char *) (&long_ret));
+ case CPURAWIDLE:
+ long_ret = vmstat(cpurawidle);
+ return ((u_char *) (&long_ret));
+ case SYSRAWINTERRUPTS:
+ long_ret = vmstat(rawinterrupts);
+ return (u_char *)&long_ret;
+ case SYSRAWCONTEXT:
+ long_ret = vmstat(rawcontext);
+ return (u_char *)&long_ret;
+ case CPURAWWAIT:
+ if (!has_cpu_26) return NULL;
+ long_ret = vmstat(cpurawwait);
+ return ((u_char *) (&long_ret));
+ case CPURAWINTR:
+ if (!has_cpu_26) return NULL;
+ long_ret = vmstat(cpurawinter);
+ return ((u_char *) (&long_ret));
+ case CPURAWSOFTIRQ:
+ if (!has_cpu_26) return NULL;
+ long_ret = vmstat(cpurawsoft);
+ return ((u_char *) (&long_ret));
+
+ /*
+ * reserved for future use
+ */
+ /*
+ * case ERRORFLAG:
+ * return((u_char *) (&long_ret));
+ * case ERRORMSG:
+ * return((u_char *) (&long_ret));
+ */
+ default:
+ snmp_log(LOG_ERR, "vmstat.c: don't know how to handle %d request\n",
+ vp->magic);
+ }
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_linux.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_linux.h
new file mode 100644
index 0000000000..738e2f1921
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_linux.h
@@ -0,0 +1,40 @@
+/*
+ * vmstat mib groups
+ *
+ */
+#ifndef _MIBGROUP_VMSTAT_H
+#define _MIBGROUP_VMSTAT_H
+
+config_require(hardware/cpu)
+
+#include "mibdefs.h"
+
+FindVarMethod var_extensible_vmstat;
+void init_vmstat(void);
+
+#define SWAPIN 3
+#define SWAPOUT 4
+#define IOSENT 5
+#define IORECEIVE 6
+#define SYSINTERRUPTS 7
+#define SYSCONTEXT 8
+#define CPUUSER 9
+#define CPUSYSTEM 10
+#define CPUIDLE 11
+#define CPUERROR 16
+#define CPURAWUSER 50
+#define CPURAWNICE 51
+#define CPURAWSYSTEM 52
+#define CPURAWIDLE 53
+#define CPURAWWAIT 54
+#define CPURAWKERNEL 55
+#define CPURAWINTR 56
+#define IORAWSENT 57
+#define IORAWRECEIVE 58
+#define SYSRAWINTERRUPTS 59
+#define SYSRAWCONTEXT 60
+#define CPURAWSOFTIRQ 61
+#define RAWSWAPIN 62
+#define RAWSWAPOUT 63
+
+#endif /* _MIBGROUP_VMSTAT_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_netbsd1.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_netbsd1.c
new file mode 100644
index 0000000000..48aeabf2e0
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_netbsd1.c
@@ -0,0 +1,315 @@
+/*
+ * vmstat_netbsd1.c
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+/*
+ * Ripped from /usr/scr/usr.bin/vmstat/vmstat.c (covering all bases)
+ */
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/proc.h>
+#include <sys/dkstat.h>
+#include <sys/buf.h>
+#include <sys/uio.h>
+#include <sys/namei.h>
+#include <sys/malloc.h>
+#include <sys/signal.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/sysctl.h>
+#include <sys/vmmeter.h>
+#include <sys/sched.h>
+
+#if defined(HAVE_UVM_UVM_PARAM_H) && defined(HAVE_UVM_UVM_EXTERN_H)
+#include <uvm/uvm_param.h>
+#include <uvm/uvm_extern.h>
+#elif defined(HAVE_VM_VM_PARAM_H) && defined(HAVE_VM_VM_EXTERN_H)
+#include <vm/vm_param.h>
+#include <vm/vm_extern.h>
+#else
+#error vmstat_netbsd1.c: Is this really a NetBSD system?
+#endif
+
+#include <time.h>
+#include <nlist.h>
+#include <kvm.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
+#include <limits.h>
+
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/agent/auto_nlist.h>
+
+#include "util_funcs.h"
+#include "vmstat.h"
+
+/*
+ * CPU percentage
+ */
+#define CPU_PRC 100
+#define CPTIME_SYMBOL "cp_time"
+#define BOOTTIME_SYMBOL "boottime"
+
+FindVarMethod var_extensible_vmstat;
+
+void
+init_vmstat_netbsd1(void)
+{
+
+ struct variable2 extensible_vmstat_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1,
+ {ERRORNAME}},
+ {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}},
+ {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}},
+ {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}},
+ {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {IORECEIVE}},
+ {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSINTERRUPTS}},
+ {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSCONTEXT}},
+ {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}},
+ {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {CPUSYSTEM}},
+ {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}},
+ {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWUSER}},
+ {CPURAWNICE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWNICE}},
+ {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWSYSTEM}},
+ {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWIDLE}},
+ {CPURAWKERNEL, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWKERNEL}},
+ {CPURAWINTR, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWINTR}},
+
+ /*
+ * Future use:
+ */
+ /*
+ * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }},
+ * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }}
+ */
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid vmstat_variables_oid[] = { NETSNMP_UCDAVIS_MIB, 11 };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ */
+ REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2,
+ vmstat_variables_oid);
+
+}
+
+
+long
+getuptime(void)
+{
+ static time_t now, boottime;
+ time_t uptime;
+
+ if (boottime == 0)
+ auto_nlist(BOOTTIME_SYMBOL, (char *) &boottime, sizeof(boottime));
+
+ time(&now);
+ uptime = now - boottime;
+
+ return (uptime);
+}
+
+unsigned char *
+var_extensible_vmstat(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+
+ int loop;
+
+ time_t time_new = getuptime();
+ static time_t time_old;
+ static time_t time_diff;
+
+#if defined(KERN_CP_TIME)
+ static uint64_t cpu_old[CPUSTATES];
+ static uint64_t cpu_new[CPUSTATES];
+ static uint64_t cpu_diff[CPUSTATES];
+ static uint64_t cpu_total;
+#elif defined(KERN_CPTIME)
+ static long cpu_old[CPUSTATES];
+ static long cpu_new[CPUSTATES];
+ static long cpu_diff[CPUSTATES];
+ static long cpu_total;
+#else
+ static long cpu_old[CPUSTATES];
+ static long cpu_new[CPUSTATES];
+ static long cpu_diff[CPUSTATES];
+ static long cpu_total;
+#endif
+ long cpu_sum;
+ double cpu_prc;
+
+ static struct uvmexp mem_old, mem_new;
+ int mem_mib[] = { CTL_VM, VM_UVMEXP };
+ int mem_size = sizeof(struct uvmexp);
+
+ static long long_ret;
+ static char errmsg[300];
+
+ long_ret = 0; /* set to 0 as default */
+
+ if (header_generic(vp, name, length, exact, var_len, write_method))
+ return (NULL);
+
+ /*
+ * Update structures (only if time has passed)
+ */
+ if (time_new != time_old) {
+#ifdef KERN_CP_TIME
+ int mib[2] = { CTL_KERN, KERN_CP_TIME };
+ int ssize = sizeof(cpu_new);
+
+ if (sysctl(mib, 2, cpu_new, &ssize, NULL, 0) < 0)
+ memset(cpu_new, 0, sizeof(cpu_new));
+#elif defined(KERN_CPTIME)
+ int mib[2] = { CTL_KERN, KERN_CPTIME };
+ int ssize = sizeof(cpu_new);
+
+ if (sysctl(mib, 2, cpu_new, &ssize, NULL, 0) < 0)
+ memset(cpu_new, 0, sizeof(cpu_new));
+#else
+ /*
+ * CPU usage
+ */
+ auto_nlist(CPTIME_SYMBOL, (char *) cpu_new, sizeof(cpu_new));
+#endif
+
+ time_diff = time_new - time_old;
+ time_old = time_new;
+
+ cpu_total = 0;
+
+ for (loop = 0; loop < CPUSTATES; loop++) {
+ cpu_diff[loop] = cpu_new[loop] - cpu_old[loop];
+ cpu_old[loop] = cpu_new[loop];
+ cpu_total += cpu_diff[loop];
+ }
+
+ if (cpu_total == 0)
+ cpu_total = 1;
+
+ /*
+ * Memory info
+ */
+ mem_old = mem_new;
+ sysctl(mem_mib, 2, &mem_new, &mem_size, NULL, 0);
+ }
+
+ /*
+ * Rate macro
+ */
+#define rate(x) (((x)+ time_diff/2) / time_diff)
+
+ /*
+ * Page-to-kb macro
+ */
+#define ptok(p) ((p) * (mem_new.pagesize >> 10))
+
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = 1;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* dummy name */
+ sprintf(errmsg, "systemStats");
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case SWAPIN:
+ long_ret = ptok(mem_new.swapins - mem_old.swapins);
+ long_ret = rate(long_ret);
+ return ((u_char *) (&long_ret));
+ case SWAPOUT:
+ long_ret = ptok(mem_new.swapouts - mem_old.swapouts);
+ long_ret = rate(long_ret);
+ return ((u_char *) (&long_ret));
+ case IOSENT:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_ret = -1;
+ return ((u_char *) (&long_ret));
+ case IORECEIVE:
+#if NETSNMP_NO_DUMMY_VALUES
+ return NULL;
+#endif
+ long_ret = -1;
+ return ((u_char *) (&long_ret));
+ case SYSINTERRUPTS:
+ long_ret = rate(mem_new.intrs - mem_old.intrs);
+ return ((u_char *) (&long_ret));
+ case SYSCONTEXT:
+ long_ret = rate(mem_new.swtch - mem_old.swtch);
+ return ((u_char *) (&long_ret));
+ case CPUUSER:
+ cpu_sum = cpu_diff[CP_USER] + cpu_diff[CP_NICE];
+ cpu_prc = (float) cpu_sum / (float) cpu_total;
+ long_ret = cpu_prc * CPU_PRC;
+ return ((u_char *) (&long_ret));
+ case CPUSYSTEM:
+ cpu_sum = cpu_diff[CP_SYS] + cpu_diff[CP_INTR];
+ cpu_prc = (float) cpu_sum / (float) cpu_total;
+ long_ret = cpu_prc * CPU_PRC;
+ return ((u_char *) (&long_ret));
+ case CPUIDLE:
+ cpu_sum = cpu_diff[CP_IDLE];
+ cpu_prc = (float) cpu_sum / (float) cpu_total;
+ long_ret = cpu_prc * CPU_PRC;
+ return ((u_char *) (&long_ret));
+ case CPURAWUSER:
+ long_ret = cpu_new[CP_USER];
+ return ((u_char *) (&long_ret));
+ case CPURAWNICE:
+ long_ret = cpu_new[CP_NICE];
+ return ((u_char *) (&long_ret));
+ case CPURAWSYSTEM:
+ long_ret = cpu_new[CP_SYS] + cpu_new[CP_INTR];
+ return ((u_char *) (&long_ret));
+ case CPURAWIDLE:
+ long_ret = cpu_new[CP_IDLE];
+ return ((u_char *) (&long_ret));
+ case CPURAWKERNEL:
+ long_ret = cpu_new[CP_SYS];
+ return ((u_char *) (&long_ret));
+ case CPURAWINTR:
+ long_ret = cpu_new[CP_INTR];
+ return ((u_char *) (&long_ret));
+ /*
+ * reserved for future use
+ */
+ /*
+ * case ERRORFLAG:
+ * return((u_char *) (&long_ret));
+ * case ERRORMSG:
+ * return((u_char *) (&long_ret));
+ */
+ }
+ return NULL;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_netbsd1.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_netbsd1.h
new file mode 100644
index 0000000000..eb6b172907
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_netbsd1.h
@@ -0,0 +1,12 @@
+/*
+ * vmstat mib groups
+ *
+ */
+#ifndef _MIBGROUP_VMSTAT_NETBSD1_H
+#define _MIBGROUP_VMSTAT_NETBSD1_H
+
+#include "mibdefs.h"
+
+void init_vmstat_netbsd1(void);
+
+#endif /* _MIBGROUP_VMSTAT_NETBSD1_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_solaris2.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_solaris2.c
new file mode 100644
index 0000000000..8c77f9748a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_solaris2.c
@@ -0,0 +1,774 @@
+/*
+ * vmstat_solaris2.c
+ * UCD SNMP module for systemStats section of UCD-SNMP-MIB for SunOS/Solaris
+ * Jochen Kmietsch <kmietsch@jochen.de>
+ * with fixes and additions from the UCD-SNMP community
+ * Uses some ideas from xosview and top
+ * Some comments paraphrased from the SUN man pages
+ * Version 0.1 initial release (Dec 1999)
+ * Version 0.2 added support for multiprocessor machines (Jan 2000)
+ * Version 0.3 some reliability enhancements and compile time fixes (Feb 2000)
+ * Version 0.4 portability issue and raw cpu value support (Jun 2000)
+ * Version 0.5 64-bit Solaris support and new data gathering routine (Aug 2000)
+ * Version 0.6 Memory savings, overroll precautions and lint checks (Aug 2000)
+ * Version 0.7 More raw counters and some cosmetic changes (Jan 2001)
+ *
+ */
+
+/*
+ * To make lint skip the debug code and stop complaining
+ */
+#ifdef __lint
+#define NETSNMP_NO_DEBUGGING 1
+#endif
+
+/*
+ * Includes start here
+ */
+
+/*
+ * Standard includes
+ */
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <string.h>
+
+/*
+ * kstat and sysinfo structs
+ */
+#include <kstat.h>
+#include <sys/sysinfo.h>
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "mibdefs.h"
+#include "util_funcs.h"
+
+/*
+ * Header file for this module
+ */
+#include "vmstat.h"
+#include "vmstat_solaris2.h"
+
+/*
+ * Includes end here
+ */
+
+
+/*
+ * Global structures start here
+ */
+
+/*
+ * A structure to save data gathered from the kernel kstat interface to.
+ * We used to have the sys/sysinfo.h cpu_stat_t here but we did not need
+ * all of it, some in a different size and some additional ones so we build
+ * our own
+ */
+struct cpu_stat_snapshot {
+ hrtime_t css_time;
+ unsigned int css_cpus;
+ unsigned long long css_swapin;
+ unsigned long long css_swapout;
+ unsigned long long css_blocks_read;
+ unsigned long long css_blocks_write;
+ unsigned long long css_interrupts;
+ unsigned long long css_context_sw;
+ unsigned long long css_cpu[CPU_STATES];
+};
+
+/*
+ * Global structures end here
+ */
+
+
+/*
+ * Global variables start here
+ */
+
+/*
+ * From kstat.h:
+ * Provides access to the kernel statistics library by
+ * initializing a kstat control structure and returning a pointer
+ * to this structure. This pointer must be used as the kc argument in
+ * following function calls from libkstat (here kc is called kstat_fd).
+ * Pointer to structure to be opened with kstat_open in main procedure.
+ * We share this one with memory_solaris2 and kernel_sunos5, where it's
+ * defined.
+ */
+extern kstat_ctl_t *kstat_fd;
+
+/*
+ * Variables for the calculated values, filled in update_stats
+ * Need to be global since we need them in more than one function
+ */
+static ulong swapin;
+static ulong swapout;
+static ulong blocks_read;
+static ulong blocks_write;
+static ulong interrupts;
+static ulong context_sw;
+
+/*
+ * Since MIB wants CPU_SYSTEM, which is CPU_KERNEL + CPU_WAIT
+ */
+static long cpu_perc[CPU_STATES + 1];
+
+/*
+ * How many snapshots we have already taken, needed for the first
+ * POLL_INTERVAL * POLL_VALUES seconds of agent running
+ */
+static unsigned int number_of_snapshots;
+
+/*
+ * The place to store the snapshots of system data in
+ */
+static struct cpu_stat_snapshot snapshot[POLL_VALUES + 1];
+
+/*
+ * And one for the raw counters, which we fill when the raw values are
+ * requested, as opposed to the absolute values, which are taken every
+ * POLL_INTERVAL seconds and calculated over POLL_INTERVAL * POLL_VALUES time
+ */
+static struct cpu_stat_snapshot raw_values;
+
+/*
+ * Global variables end here
+ */
+
+
+/*
+ * Functions start here
+ */
+
+/*
+ * Function prototype
+ */
+static void update_stats(unsigned int registrationNumber,
+ void *clientarg);
+static int take_snapshot(struct cpu_stat_snapshot *css);
+
+/*
+ * init_vmstat_solaris2 starts here
+ * Init function for this module, from prototype
+ * Defines variables handled by this module, defines root OID for
+ * this module and registers it with the agent
+ */
+
+FindVarMethod var_extensible_vmstat;
+
+void
+init_vmstat_solaris2(void)
+{
+
+ /*
+ * Which variables do we service ?
+ */
+ struct variable2 extensible_vmstat_variables[] = {
+ {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {MIBINDEX}},
+ {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1,
+ {ERRORNAME}},
+ {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}},
+ {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}},
+ {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}},
+ {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {IORECEIVE}},
+ {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSINTERRUPTS}},
+ {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {SYSCONTEXT}},
+ {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}},
+ {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1,
+ {CPUSYSTEM}},
+ {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}},
+ {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWUSER}},
+ {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWSYSTEM}},
+ {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWIDLE}},
+ {CPURAWWAIT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWWAIT}},
+ {CPURAWKERNEL, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {CPURAWKERNEL}},
+ {IORAWSENT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {IORAWSENT}},
+ {IORAWRECEIVE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1,
+ {IORAWRECEIVE}},
+ /*
+ * Future use:
+ * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }},
+ * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }}
+ */
+ };
+
+ /*
+ * Define the OID pointer to the top of the mib tree that we're
+ * registering underneath
+ */
+ oid vmstat_variables_oid[] = { NETSNMP_UCDAVIS_MIB, 11 };
+
+ /*
+ * register ourselves with the agent to handle our mib tree
+ * LINTED Trust me, I know what I'm doing
+ */
+ REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2,
+ vmstat_variables_oid);
+
+ /*
+ * First check whether shared kstat contol is NULL, if so, try to open our
+ * own.
+ */
+ if (kstat_fd == NULL) {
+ kstat_fd = kstat_open();
+ }
+
+ /*
+ * Then check whether either shared kstat was found or we succeeded in
+ * opening our own.
+ */
+ if (kstat_fd == NULL) {
+ snmp_log(LOG_ERR,
+ "vmstat_solaris2 (init): kstat_open() failed and no shared kstat control found.\n");
+ }
+
+ /*
+ * Start with some useful data
+ */
+ update_stats(0, NULL);
+
+ /*
+ * update_stats is run every POLL_INTERVAL seconds using this routine
+ * (see 'man snmp_alarm')
+ * This is only executed once to get some useful data in the beginning
+ */
+ if (snmp_alarm_register(5, NULL, update_stats, NULL) == 0) {
+ snmp_log(LOG_WARNING,
+ "vmstat_solaris2 (init): snmp_alarm_register failed.\n");
+ }
+ /*
+ * This is the one that runs update_stats every POLL_INTERVAL seconds
+ */
+ if (snmp_alarm_register(POLL_INTERVAL, SA_REPEAT, update_stats, NULL)
+ == 0) {
+ snmp_log(LOG_ERR,
+ "vmstat_solaris2 (init): snmp_alarm_register failed, cannot service requests.\n");
+ }
+
+} /* init_vmstat_solaris2 ends here */
+
+/*
+ * Data collection function take_snapshot starts here
+ * Get data from kernel and save into the snapshot strutcs
+ * Argument is the snapshot struct to save to. Global anyway, but looks nicer
+ */
+static int
+take_snapshot(struct cpu_stat_snapshot *css)
+{
+ /*
+ * Variables start here
+ */
+
+ /*
+ * From sys/kstat.h (included from kstat.h):
+ * Pointer to current kstat
+ */
+ kstat_t *ksp;
+
+ /*
+ * Counters
+ */
+ unsigned int cpu_num = 0;
+
+ /*
+ * High resolution time counter
+ */
+ hrtime_t current_time;
+
+ /*
+ * see sys/sysinfo.h, holds CPU data
+ */
+ cpu_stat_t cs;
+
+ /*
+ * The usual stuff to count on, err, by
+ */
+ int i;
+
+ /*
+ * Variables end here
+ */
+
+ /*
+ * Function starts here
+ */
+
+ /*
+ * Get time
+ */
+ current_time = gethrtime();
+
+ /*
+ * If we have just gotten the data, return the values from last run (skip if-clause)
+ * This happens on a snmpwalk request. No need to read the kstat again
+ * if we just did it less than 2 seconds ago
+ * Jumps into if-clause either when snapshot is empty or when too old
+ */
+
+ if ((css->css_time == 0)
+ || (current_time > css->css_time + 2000000000)) {
+ /*
+ * Make sure we clean up before we put new data into snapshot
+ */
+ memset(css, 0, sizeof *css);
+
+ /*
+ * Update timer
+ */
+ css->css_time = current_time;
+
+ /*
+ * Look thru all the cpu slots on the machine whether they holds a CPU
+ * and if so, get the data from that CPU
+ * We walk through the whole kstat chain and sum up all the found cpu_stat kstats,
+ * there's one for every CPU in a machine
+ */
+ for (ksp = kstat_fd->kc_chain; ksp != NULL; ksp = ksp->ks_next) {
+ /*
+ * If we encounter an invalid kstat, skip it and continue with next one
+ */
+ if (ksp->ks_flags & KSTAT_FLAG_INVALID) {
+ continue;
+ }
+
+ if (strcmp(ksp->ks_module, "cpu_stat") == 0) {
+ /*
+ * Yeah, we found a CPU.
+ */
+ cpu_num++;
+
+ /*
+ * Read data from kstat into cs structure
+ * kstat_fd is the control structure, ksp the kstat we are reading
+ * and cs the buffer we are writing to.
+ */
+ if ((ksp->ks_type != KSTAT_TYPE_RAW) ||
+ (ksp->ks_data_size != sizeof cs) ||
+ (kstat_read(kstat_fd, ksp, &cs) == -1)) {
+ snmp_log(LOG_ERR,
+ "vmstat_solaris2 (take_snapshot): could not read cs structure.\n");
+ return (-1);
+ }
+
+ /*
+ * Get the data from the cs structure and sum it up in our own structure
+ */
+ css->css_swapin +=
+ (unsigned long long) cs.cpu_vminfo.swapin;
+ css->css_swapout +=
+ (unsigned long long) cs.cpu_vminfo.swapout;
+ css->css_blocks_read +=
+ (unsigned long long) cs.cpu_sysinfo.bread;
+ css->css_blocks_write +=
+ (unsigned long long) cs.cpu_sysinfo.bwrite;
+ css->css_interrupts +=
+ (unsigned long long) cs.cpu_sysinfo.intr;
+ css->css_context_sw +=
+ (unsigned long long) cs.cpu_sysinfo.pswitch;
+
+ /*
+ * We need a for-loop for the CPU values
+ */
+ cs.cpu_sysinfo.cpu[CPU_WAIT] = cs.cpu_sysinfo.wait[W_IO] +
+ cs.cpu_sysinfo.wait[W_PIO];
+ for (i = 0; i < CPU_STATES; i++) {
+ css->css_cpu[i] +=
+ (unsigned long long) cs.cpu_sysinfo.cpu[i];
+ } /* end for */
+ } /* end if */
+ } /* end for */
+
+ /*
+ * Increment number of CPUs we gathered data from, for future use
+ */
+ css->css_cpus = cpu_num;
+ }
+
+ /*
+ * All engines running at warp speed, no problems (if there are any engines, that is)
+ */
+ return (cpu_num > 0 ? 0 : -1);
+} /* take_snapshot ends here */
+
+/*
+ * This gets called every POLL_INTERVAL seconds to update the snapshots. It takes a new snapshot and
+ * drops the oldest one. This way we move the time window so we always take the values over
+ * POLL_INTERVAL * POLL_VALUES seconds and update the data used every POLL_INTERVAL seconds
+ * The alarm timer is in the init function of this module (snmp_alarm_register)
+ * ARGSUSED0
+ */
+static void
+update_stats(unsigned int registrationNumber, void *clientarg)
+{
+ /*
+ * The time between the samples we compare
+ */
+ hrtime_t time_diff;
+
+ /*
+ * Easier to use these than the snapshots, short hand pointers
+ */
+ struct cpu_stat_snapshot *css_old, *css_new;
+
+ /*
+ * The usual stuff to count on, err, by
+ */
+ int i;
+
+ /*
+ * Kstat chain id, to check whether kstat chain changed
+ */
+ kid_t kid;
+
+ /*
+ * The sum of the CPU ticks that have passed on the different CPU states, so we can calculate
+ * the percentages of each state
+ */
+ unsigned long long cpu_sum = 0;
+
+ DEBUGMSGTL(("ucd-snmp/vmstat_solaris2.c:update_stats",
+ "updating stats\n"));
+
+ /*
+ * Just in case someone added (or removed) some CPUs during operation (or other kstat chain changes)
+ */
+ kid = kstat_chain_update(kstat_fd);
+ if (kid != 0) {
+ if (kid == -1) {
+ snmp_log(LOG_WARNING,
+ "vmstat_solaris2 (update_stats): Could not update kstat chain.\n");
+ } else {
+ /*
+ * On some machines this floods the logfile, thus commented out
+ * snmp_log(LOG_INFO, "vmstat_solaris2 (update_stats): Kstat chain changed.");
+ */
+ }
+ }
+
+ /*
+ * Take the current snapshot
+ */
+ if (take_snapshot(&snapshot[0]) == -1) {
+ snmp_log(LOG_WARNING,
+ "vmstat_solaris2 (update_stats): Something went wrong with take_snapshot.\n");
+ return;
+ }
+
+ /*
+ * Do we have some data we can use ? An issue right after the start of the agent
+ */
+ if (number_of_snapshots > 0) {
+ /*
+ * Huh, the number of CPUs changed during run time. That is indeed s.th. worth noting, we
+ * output a humorous (more or less) syslog message and need to retake the snapshots
+ */
+ if (snapshot[0].css_cpus != snapshot[1].css_cpus) {
+ if (snapshot[0].css_cpus > snapshot[1].css_cpus) {
+ snmp_log(LOG_NOTICE,
+ "vmstat_solaris2 (update_stats): Cool ! Number of CPUs increased, must be hot-pluggable.\n");
+ } else {
+ snmp_log(LOG_NOTICE,
+ "vmstat_solaris2 (update_stats): Lost at least one CPU, RIP.\n");
+ }
+ /*
+ * Make all snapshots but the current one invalid
+ */
+ number_of_snapshots = 1;
+ /*
+ * Move the current one in the "first" [1] slot
+ */
+ memmove(&snapshot[1], &snapshot[0], sizeof snapshot[0]);
+ /*
+ * Erase the current one
+ */
+ memset(&snapshot[0], 0, sizeof snapshot[0]);
+ /*
+ * Try to get a new snapshot in five seconds so we can return s.th. useful
+ */
+ if (snmp_alarm_register(5, NULL, update_stats, NULL) == 0) {
+ snmp_log(LOG_WARNING,
+ "vmstat_solaris2 (update_stats): snmp_alarm_register failed.\n");
+ }
+ return;
+ }
+
+ /*
+ * Short hand pointers
+ */
+ css_new = &snapshot[0];
+ css_old = &snapshot[number_of_snapshots];
+
+ /*
+ * How much time has passed between the snapshots we get the values from ?
+ * Time is in nanoseconds so a few zeros here to juggle with
+ * But the hrtime is not subject to change (s.b. setting the clock), unlike the normal time
+ */
+ time_diff =
+ (snapshot[0].css_time -
+ snapshot[number_of_snapshots].css_time) / 1000000;
+
+ DEBUGMSGTL(("ucd-snmp/vmstat_solaris2.c:update_stats",
+ "time_diff: %lld\n", time_diff));
+
+ /*
+ * swapin and swapout are in pages, MIB wants kB/s,so we just need to get kB and seconds
+ * For the others we need to get value per second
+ * getpagesize() returns pagesize in bytes
+ * decided to use sysconf(_SC_PAGESIZE) instead to get around an #ifndef (I don't like those)
+ * that was needed b/c some old Solaris versions don't have getpagesize()
+ */
+ /*
+ * LINTED cast needed, really
+ */
+ swapin =
+ (uint_t) ((css_new->css_swapin -
+ css_old->css_swapin) * (hrtime_t) 1000 *
+ sysconf(_SC_PAGESIZE) / 1024 / time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ swapout =
+ (uint_t) ((css_new->css_swapout -
+ css_old->css_swapout) * (hrtime_t) 1000 *
+ sysconf(_SC_PAGESIZE) / 1024 / time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ blocks_read =
+ (uint_t) ((css_new->css_blocks_read -
+ css_old->css_blocks_read) * (hrtime_t) 1000 /
+ time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ blocks_write =
+ (uint_t) ((css_new->css_blocks_write -
+ css_old->css_blocks_write) * (hrtime_t) 1000 /
+ time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ interrupts =
+ (uint_t) ((css_new->css_interrupts -
+ css_old->css_interrupts) * (hrtime_t) 1000 /
+ time_diff);
+ /*
+ * LINTED cast needed, really
+ */
+ context_sw =
+ (uint_t) ((css_new->css_context_sw -
+ css_old->css_context_sw) * (hrtime_t) 1000 /
+ time_diff);
+
+ /*
+ * Loop thru all the CPU_STATES and get the differences
+ */
+ for (i = 0; i < CPU_STATES; i++) {
+ cpu_sum += (css_new->css_cpu[i] - css_old->css_cpu[i]);
+ }
+
+ /*
+ * Now calculate the absolute percentage values
+ * Looks somewhat complicated sometimes but tries to get around using floats to increase speed
+ */
+ for (i = 0; i < CPU_STATES; i++) {
+ /*
+ * Since we don't return fractions we use + 0.5 to get between 99 and 101 percent adding the values
+ * together, otherwise we would get less than 100 most of the time
+ */
+ /*
+ * LINTED has to be 'long'
+ */
+ cpu_perc[i] =
+ (long) (((css_new->css_cpu[i] -
+ css_old->css_cpu[i]) * 100 +
+ (cpu_sum / 2)) / cpu_sum);
+ }
+
+ /*
+ * As said before, MIB wants CPU_SYSTEM which is CPU_KERNEL + CPU_WAIT
+ */
+ /*
+ * LINTED has to be 'long'
+ */
+ cpu_perc[CPU_SYSTEM] =
+ (long) ((((css_new->css_cpu[CPU_KERNEL] -
+ css_old->css_cpu[CPU_KERNEL])
+ + (css_new->css_cpu[CPU_WAIT] -
+ css_old->css_cpu[CPU_WAIT]))
+ * 100 + (cpu_sum / 2)) / cpu_sum);
+ }
+
+ /*
+ * Make the current one the first one and move the whole thing one place down
+ */
+ memmove(&snapshot[1], &snapshot[0],
+ (size_t) (((char *) &snapshot[POLL_VALUES]) -
+ ((char *) &snapshot[0])));
+
+ /*
+ * Erase the current one
+ */
+ memset(&snapshot[0], 0, sizeof snapshot[0]);
+
+ /*
+ * Only important on start up, we keep track of how many snapshots we have taken so far
+ */
+ if (number_of_snapshots < POLL_VALUES) {
+ number_of_snapshots++;
+ }
+} /* update_stats ends here */
+
+/*
+ * *var_extensible_vmstat starts here
+ * The guts of the module, this routine gets called to service a request
+ */
+unsigned char *
+var_extensible_vmstat(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact,
+ size_t * var_len, WriteMethod ** write_method)
+{
+ /*
+ * Needed for returning the values
+ */
+ static long long_ret;
+ static char errmsg[300];
+
+ /*
+ * set to 0 as default
+ */
+ long_ret = 0;
+
+ /*
+ * generic check whether the options passed make sense and whether the
+ * right variable is requested
+ */
+ if (header_generic(vp, name, length, exact, var_len, write_method) !=
+ MATCH_SUCCEEDED) {
+ return (NULL);
+ }
+
+ /*
+ * The function that actually returns s.th.
+ */
+ switch (vp->magic) {
+ case MIBINDEX:
+ long_ret = 1;
+ return ((u_char *) (&long_ret));
+ case ERRORNAME: /* dummy name */
+ sprintf(errmsg, "systemStats");
+ *var_len = strlen(errmsg);
+ return ((u_char *) (errmsg));
+ case SWAPIN:
+ return ((u_char *) (&swapin));
+ case SWAPOUT:
+ return ((u_char *) (&swapout));
+ case IOSENT:
+ return ((u_char *) (&blocks_write));
+ case IORECEIVE:
+ return ((u_char *) (&blocks_read));
+ case SYSINTERRUPTS:
+ return ((u_char *) (&interrupts));
+ case SYSCONTEXT:
+ return ((u_char *) (&context_sw));
+ case CPUUSER:
+ return ((u_char *) (&cpu_perc[CPU_USER]));
+ case CPUSYSTEM:
+ return ((u_char *) (&cpu_perc[CPU_SYSTEM]));
+ case CPUIDLE:
+ return ((u_char *) (&cpu_perc[CPU_IDLE]));
+ case CPURAWUSER:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[CPU_USER] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ /*
+ * We are missing CPURAWNICE, Solaris does not account for this in the kernel so this OID can not
+ * be returned. Also, these values will roll over sooner or later and then return inaccurate data
+ * but the MIB wants Integer32 so we cannot put a counter here
+ * (Has been changed to Counter32 in the latest MIB version!)
+ */
+ case CPURAWSYSTEM:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) ((raw_values.css_cpu[CPU_KERNEL] +
+ raw_values.css_cpu[CPU_WAIT]) / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWIDLE:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[CPU_IDLE] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWWAIT:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[CPU_WAIT] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case CPURAWKERNEL:
+ take_snapshot(&raw_values);
+ /*
+ * LINTED has to be 'long'
+ */
+ long_ret =
+ (long) (raw_values.css_cpu[CPU_KERNEL] / raw_values.css_cpus);
+ return ((u_char *) (&long_ret));
+ case IORAWSENT:
+ long_ret = (long) (raw_values.css_blocks_write);
+ return ((u_char *) (&long_ret));
+ case IORAWRECEIVE:
+ long_ret = (long) (raw_values.css_blocks_read);
+ return ((u_char *) (&long_ret));
+
+ /*
+ * reserved for future use
+ */
+ /*
+ * case ERRORFLAG:
+ * return((u_char *) (&long_ret));
+ * case ERRORMSG:
+ * return((u_char *) (&long_ret));
+ */
+ default:
+ snmp_log(LOG_ERR,
+ "vmstat_solaris2: Error in request, no match for %d.\n",
+ vp->magic);
+ }
+ return (NULL);
+} /* *var_extensible_vmstat ends here */
+
+/*
+ * Functions end here
+ */
+
+/*
+ * Program ends here
+ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_solaris2.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_solaris2.h
new file mode 100644
index 0000000000..82822888c3
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd-snmp/vmstat_solaris2.h
@@ -0,0 +1,60 @@
+/*
+ * vmstat_solaris2.h
+ * Header file for vmstat_solaris2 module for UCD-SNMP
+ * Jochen Kmietsch <kmietsch@jochen.de>
+ * see vmstat_solaris2.c for revision history and additional comments
+ *
+ */
+
+/*
+ * Prevent accidental double inclusions
+ */
+#ifndef _MIBGROUP_VMSTAT_SOLARIS2_H
+#define _MIBGROUP_VMSTAT_SOLARIS2_H
+
+/*
+ * The following statements are used by the configure script
+ */
+/*
+ * Dependency requirements
+ */
+config_arch_require(solaris2, kernel_sunos5)
+
+ /*
+ * Directive to include utility module
+ */
+config_require(util_funcs)
+
+ /*
+ * MIB wants CPU_SYSTEM which is sysinfo CPU_KERNEL + CPU_WAIT
+ */
+#define CPU_SYSTEM 4
+ /*
+ * Time interval to gather system data
+ */
+ /*
+ * Lower value -> more accurate data, higher value -> less CPU usage
+ */
+ /*
+ * Value is in seconds
+ */
+#define POLL_INTERVAL 60
+ /*
+ * How many snapshots of system data to keep. Values returned are over
+ */
+ /*
+ * time difference between first and last snapshot
+ */
+ /*
+ * Using POLL_INTERVAL 60 and POLL_VALUES 5 we get the values
+ */
+ /*
+ * over five minutes, which is a reasonable figure
+ */
+#define POLL_VALUES 5
+ /*
+ * Declared in vmstat_solaris2.c, from prototype
+ */
+ void init_vmstat_solaris2(void);
+
+#endif /* _MIBGROUP_VMSTAT_SOLARIS2_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd_snmp.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd_snmp.h
new file mode 100644
index 0000000000..34c2fbb654
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/ucd_snmp.h
@@ -0,0 +1,17 @@
+/* module to include the various ucd-snmp specific extension modules. */
+config_require(ucd-snmp/proc)
+config_require(ucd-snmp/versioninfo)
+config_require(ucd-snmp/pass)
+config_require(ucd-snmp/pass_persist)
+config_require(ucd-snmp/disk)
+config_require(ucd-snmp/loadave)
+config_require(agent/extend)
+config_require(ucd-snmp/errormib)
+config_require(ucd-snmp/file)
+config_require(ucd-snmp/dlmod)
+config_require(ucd-snmp/proxy)
+config_require(ucd-snmp/logmatch)
+config_require(ucd-snmp/memory)
+config_require(ucd-snmp/vmstat)
+config_add_mib(UCD-SNMP-MIB)
+config_add_mib(UCD-DEMO-MIB)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib.h
new file mode 100644
index 0000000000..754e506213
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib.h
@@ -0,0 +1,5 @@
+/*
+ * module to include the modules
+ */
+config_require(udp-mib/udpEndpointTable)
+config_add_mib(UDP-MIB)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint.h
new file mode 100644
index 0000000000..60d162676f
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint.h
@@ -0,0 +1,27 @@
+/*
+ * udp_endpoint data access header
+ *
+ * $Id: udp_endpoint.h 15387 2006-10-10 21:13:36Z tanders $
+ */
+/**---------------------------------------------------------------------*/
+/*
+ * configure required files
+ *
+ * Notes:
+ *
+ * 1) prefer functionality over platform, where possible. If a method
+ * is available for multiple platforms, test that first. That way
+ * when a new platform is ported, it won't need a new test here.
+ *
+ * 2) don't do detail requirements here. If, for example,
+ * HPUX11 had different reuirements than other HPUX, that should
+ * be handled in the *_hpux.h header file.
+ */
+config_require(udp-mib/data_access/udp_endpoint_common)
+#if defined( linux )
+config_require(udp-mib/data_access/udp_endpoint_linux)
+#elif defined( solaris2 )
+config_require(udp-mib/data_access/udp_endpoint_solaris2)
+#else
+# define NETSNMP_UDP_ENDPOINT_COMMON_ONLY
+#endif
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_common.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_common.c
new file mode 100644
index 0000000000..183c900573
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_common.c
@@ -0,0 +1,175 @@
+/*
+ * UDP-MIB endpoint architecture support
+ *
+ * $Id: udp_endpoint_common.c 13920 2005-12-11 17:55:01Z rstory $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include "udp-mib/udpEndpointTable/udpEndpointTable_constants.h"
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/ipaddress.h>
+#include <net-snmp/data_access/udp_endpoint.h>
+
+#include "udp_endpoint_private.h"
+
+/**---------------------------------------------------------------------*/
+/*
+ * local static vars
+ */
+
+
+/**---------------------------------------------------------------------*/
+/*
+ * initialization
+ */
+
+void
+netsnmp_access_udp_endpoint_init(void)
+{
+}
+
+/**---------------------------------------------------------------------*/
+/*
+ * container functions
+ */
+/**
+ * initialize udp_endpoint container
+ */
+netsnmp_container *
+netsnmp_access_udp_endpoint_container_init(u_int flags)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("access:udp_endpoint:container", "init\n"));
+
+ /*
+ * create the containers.
+ */
+ container = netsnmp_container_find("access_udp_endpoint:table_container");
+ if (NULL == container)
+ return NULL;
+
+ return container;
+}
+
+/**
+ * load udp_endpoint information in specified container
+ *
+ * @param container empty container, or NULL to have one created for you
+ * @param load_flags flags to modify behaviour.
+ *
+ * @retval NULL error
+ * @retval !NULL pointer to container
+ */
+netsnmp_container*
+netsnmp_access_udp_endpoint_container_load(netsnmp_container* container,
+ u_int load_flags)
+{
+ int rc;
+
+ DEBUGMSGTL(("access:udp_endpoint:container", "load\n"));
+
+ if (NULL == container)
+ container = netsnmp_access_udp_endpoint_container_init(0);
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "no container specified/found for access_udp_endpoint\n");
+ return NULL;
+ }
+
+ rc =
+ netsnmp_arch_udp_endpoint_container_load(container, load_flags);
+ if (0 != rc) {
+ netsnmp_access_udp_endpoint_container_free(container, 0);
+ container = NULL;
+ }
+
+ return container;
+}
+
+void
+netsnmp_access_udp_endpoint_container_free(netsnmp_container *container,
+ u_int free_flags)
+{
+ DEBUGMSGTL(("access:udp_endpoint:container", "free\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container for netsnmp_access_udp_endpoint_free\n");
+ return;
+ }
+
+ if(! (free_flags & NETSNMP_ACCESS_UDP_ENDPOINT_FREE_DONT_CLEAR)) {
+ /*
+ * free all items.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func*)free,
+ NULL);
+ }
+
+ if(! (free_flags & NETSNMP_ACCESS_UDP_ENDPOINT_FREE_KEEP_CONTAINER))
+ CONTAINER_FREE(container);
+}
+
+/**---------------------------------------------------------------------*/
+/*
+ * entry functions
+ */
+/**
+ */
+netsnmp_udp_endpoint_entry *
+netsnmp_access_udp_endpoint_entry_create(void)
+{
+ netsnmp_udp_endpoint_entry *entry =
+ SNMP_MALLOC_TYPEDEF(netsnmp_udp_endpoint_entry);
+
+ DEBUGMSGTL(("access:udp_endpoint:entry", "create\n"));
+
+ if(NULL == entry)
+ return NULL;
+
+ entry->oid_index.len = 1;
+ entry->oid_index.oids = (oid *) & entry->index;
+
+ return entry;
+}
+
+/**
+ */
+void
+netsnmp_access_udp_endpoint_entry_free(netsnmp_udp_endpoint_entry * entry)
+{
+ DEBUGMSGTL(("access:udp_endpoint:entry", "free\n"));
+
+ if (NULL == entry)
+ return;
+
+ /*
+ * SNMP_FREE not needed, for any of these,
+ * since the whole entry is about to be freed
+ */
+
+ free(entry);
+}
+
+
+/**---------------------------------------------------------------------*/
+/*
+ * Utility routines
+ */
+
+/**
+ * \internal
+ */
+static void
+_entry_release(netsnmp_udp_endpoint_entry * entry, void *context)
+{
+ netsnmp_access_udp_endpoint_entry_free(entry);
+}
+
+/**---------------------------------------------------------------------*/
+/*
+ *
+ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c
new file mode 100644
index 0000000000..4e43e01372
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_linux.c
@@ -0,0 +1,297 @@
+/*
+ * udpEndpointTable MIB architecture support
+ *
+ * $Id: udp_endpoint_linux.c 15986 2007-03-23 09:06:19Z dts12 $
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/library/file_utils.h>
+#include <net-snmp/library/text_utils.h>
+
+#include <net-snmp/data_access/ipaddress.h>
+#include <net-snmp/data_access/udp_endpoint.h>
+
+#include "udp-mib/udpEndpointTable/udpEndpointTable_constants.h"
+
+#include "udp_endpoint_private.h"
+
+#include <fcntl.h>
+
+static int _load4(netsnmp_container *container, u_int flags);
+#if defined (NETSNMP_ENABLE_IPV6)
+static int _load6(netsnmp_container *container, u_int flags);
+#endif
+
+/*
+ * initialize arch specific storage
+ *
+ * @retval 0: success
+ * @retval <0: error
+ */
+int
+netsnmp_arch_udp_endpoint_entry_init(netsnmp_udp_endpoint_entry *entry)
+{
+ /*
+ * init
+ */
+ return 0;
+}
+
+/*
+ * cleanup arch specific storage
+ */
+void
+netsnmp_arch_udp_endpoint_entry_cleanup(netsnmp_udp_endpoint_entry *entry)
+{
+ /*
+ * cleanup
+ */
+}
+
+/*
+ * copy arch specific storage
+ */
+int
+netsnmp_arch_udp_endpoint_entry_copy(netsnmp_udp_endpoint_entry *lhs,
+ netsnmp_udp_endpoint_entry *rhs)
+{
+ return 0;
+}
+
+/*
+ * delete an entry
+ */
+int
+netsnmp_arch_udp_endpoint_delete(netsnmp_udp_endpoint_entry *entry)
+{
+ if (NULL == entry)
+ return -1;
+ /** xxx-rks:9 udp_endpoint delete not implemented */
+ return -1;
+}
+
+
+/**
+ *
+ * @retval 0 no errors
+ * @retval !0 errors
+ */
+int
+netsnmp_arch_udp_endpoint_container_load(netsnmp_container *container,
+ u_int load_flags )
+{
+ int rc = 0;
+
+ rc = _load4(container, load_flags);
+ if(rc < 0) {
+ u_int flags = NETSNMP_ACCESS_UDP_ENDPOINT_FREE_KEEP_CONTAINER;
+ netsnmp_access_udp_endpoint_container_free(container, flags);
+ return rc;
+ }
+
+#if defined (NETSNMP_ENABLE_IPV6)
+ rc = _load6(container, load_flags);
+ if(rc < 0) {
+ u_int flags = NETSNMP_ACCESS_UDP_ENDPOINT_FREE_KEEP_CONTAINER;
+ netsnmp_access_udp_endpoint_container_free(container, flags);
+ return rc;
+ }
+#endif
+
+ return 0;
+}
+
+/**
+ * @internal
+ * process token value index line
+ */
+static int
+_process_line_udp_ep(netsnmp_line_info *line_info, void *mem,
+ struct netsnmp_line_process_info_s* lpi)
+{
+ netsnmp_udp_endpoint_entry *ep = (netsnmp_udp_endpoint_entry *)mem;
+ char *ptr, *sep;
+ u_char *u_ptr;
+ size_t u_ptr_len, offset, len;
+ unsigned long long inode;
+ size_t count = 0;
+
+ /*
+ * skip 'sl'
+ */
+ ptr = skip_not_white(line_info->start);
+ if (NULL == ptr) {
+ DEBUGMSGTL(("access:udp_endpoint", "no sl '%s'\n",
+ line_info->start));
+ return PMLP_RC_MEMORY_UNUSED;
+ }
+ ptr = skip_white(ptr);
+ if (NULL == ptr) {
+ DEBUGMSGTL(("text:util:tvi", "no space after sl '%s'\n",
+ line_info->start));
+ return PMLP_RC_MEMORY_UNUSED;
+ }
+
+ /*
+ * get local address. ignore error on hex conversion, since that
+ * function doesn't like the ':' between address and port. check the
+ * offset to see if it worked. May need to flip string too.
+ */
+ u_ptr = ep->loc_addr;
+ u_ptr_len = sizeof(ep->loc_addr);
+ sep = strchr(ptr, ':');
+ if (NULL == sep) {
+ DEBUGMSGTL(("text:util:tvi", "no ':' '%s'\n",
+ line_info->start));
+ return PMLP_RC_MEMORY_UNUSED;
+ }
+ len = (sep - ptr);
+ if (-1 == netsnmp_addrstr_hton(ptr, len)) {
+ DEBUGMSGTL(("text:util:tvi", "bad length %d for loc addr '%s'\n",
+ u_ptr_len, line_info->start));
+ return PMLP_RC_MEMORY_UNUSED;
+ }
+ offset = 0;
+ netsnmp_hex_to_binary(&u_ptr, &u_ptr_len, &offset, 0, ptr, NULL);
+ if ((4 != offset) && (16 != offset)) {
+ DEBUGMSGTL(("text:util:tvi", "bad offset %d for loc addr '%s'\n",
+ offset, line_info->start));
+ return PMLP_RC_MEMORY_UNUSED;
+ }
+ ep->loc_addr_len = offset;
+ ptr += (offset * 2);
+ ++ptr; /* skip ':' */
+
+ /*
+ * get local port
+ */
+ ep->loc_port = strtol(ptr, &ptr, 16);
+ ptr = skip_white(ptr);
+
+ /*
+ * get remote address. ignore error on hex conversion, since that
+ * function doesn't like the ':' between address and port. check the
+ * offset to see if it worked. May need to flip string too.
+ */
+ u_ptr = ep->rmt_addr;
+ u_ptr_len = sizeof(ep->rmt_addr);
+ sep = strchr(ptr, ':');
+ if (NULL == sep) {
+ DEBUGMSGTL(("text:util:tvi", "no ':' '%s'\n",
+ line_info->start));
+ return PMLP_RC_MEMORY_UNUSED;
+ }
+ len = (sep - ptr);
+ if (-1 == netsnmp_addrstr_hton(ptr, len)) {
+ DEBUGMSGTL(("text:util:tvi", "bad length %d for rmt addr '%s'\n",
+ u_ptr_len, line_info->start));
+ return PMLP_RC_MEMORY_UNUSED;
+ }
+ offset = 0;
+ netsnmp_hex_to_binary(&u_ptr, &u_ptr_len, &offset, 0, ptr, NULL);
+ if ((4 != offset) && (16 != offset)) {
+ DEBUGMSGTL(("text:util:tvi", "bad offset %d for rmt addr '%s'\n",
+ offset, line_info->start));
+ return PMLP_RC_MEMORY_UNUSED;
+ }
+ ep->rmt_addr_len = offset;
+ ptr += (offset * 2);
+ ++ptr; /* skip ':' */
+
+ /*
+ * get remote port
+ */
+ ep->rmt_port = strtol(ptr, &ptr, 16);
+ ptr = skip_white(ptr);
+
+ /*
+ * get state too
+ */
+ ep->state = strtol(ptr, &ptr, 16);
+
+ /*
+ * Use inode as instance value.
+ */
+ while (count != 5) {
+ ptr = skip_white(ptr);
+ ptr = skip_not_white(ptr);
+ count++;
+ }
+ inode = strtoull(ptr, &ptr, 0);
+ ep->instance = (u_int)inode;
+
+ ep->index = (u_int)(lpi->user_context);
+ lpi->user_context = (void*)((u_int)(lpi->user_context) + 1);
+
+ ep->oid_index.oids = &ep->index;
+ ep->oid_index.len = 1;
+
+ return PMLP_RC_MEMORY_USED;
+}
+
+/**
+ *
+ * @retval 0 no errors
+ * @retval !0 errors
+ */
+static int
+_load4(netsnmp_container *container, u_int load_flags)
+{
+ netsnmp_file *fp;
+ netsnmp_line_process_info lpi;
+
+ if (NULL == container)
+ return -1;
+
+ /*
+ * allocate file resources
+ */
+ fp = netsnmp_file_fill(NULL, "/proc/net/udp" , O_RDONLY, 0, 0);
+ if (NULL == fp) /** msg already logged */
+ return -2;
+
+ memset(&lpi, 0x0, sizeof(lpi));
+ lpi.mem_size = sizeof(netsnmp_udp_endpoint_entry);
+ lpi.process = _process_line_udp_ep;
+ lpi.user_context = (void*)0;
+
+ container = netsnmp_file_text_parse(fp, container, PM_USER_FUNCTION,
+ 0, &lpi);
+ return (NULL == container);
+}
+
+#if defined (NETSNMP_ENABLE_IPV6)
+/**
+ *
+ * @retval 0 no errors
+ * @retval !0 errors
+ */
+static int
+_load6(netsnmp_container *container, u_int load_flags)
+{
+ netsnmp_file *fp;
+ netsnmp_line_process_info lpi;
+
+ if (NULL == container)
+ return -1;
+
+ /*
+ * allocate file resources
+ */
+ fp = netsnmp_file_fill(NULL, "/proc/net/udp6" , O_RDONLY, 0, 0);
+ if (NULL == fp) /** msg already logged */
+ return -2;
+
+ memset(&lpi, 0x0, sizeof(lpi));
+ lpi.mem_size = sizeof(netsnmp_udp_endpoint_entry);
+ lpi.process = _process_line_udp_ep;
+ lpi.user_context = (void*)CONTAINER_SIZE(container);
+
+ container = netsnmp_file_text_parse(fp, container, PM_USER_FUNCTION,
+ 0, &lpi);
+
+ return (NULL == container);
+}
+#endif /* NETSNMP_ENABLE_IPV6 */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_private.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_private.h
new file mode 100644
index 0000000000..3ca9b2a7c4
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_private.h
@@ -0,0 +1,7 @@
+int netsnmp_arch_udp_endpoint_init(void);
+int netsnmp_arch_udp_endpoint_container_load(netsnmp_container *, u_int);
+int netsnmp_arch_udp_endpoint_entry_init(netsnmp_udp_endpoint_entry *);
+void netsnmp_arch_udp_endpoint_entry_cleanup(netsnmp_udp_endpoint_entry *);
+int netsnmp_arch_udp_endpoint_entry_delete(netsnmp_udp_endpoint_entry *);
+int netsnmp_arch_udp_endpoint_entry_copy(netsnmp_udp_endpoint_entry *,
+ netsnmp_udp_endpoint_entry *);
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_solaris2.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_solaris2.c
new file mode 100644
index 0000000000..f4b69df81b
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/data_access/udp_endpoint_solaris2.c
@@ -0,0 +1,198 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/ipaddress.h>
+#include <net-snmp/data_access/udp_endpoint.h>
+
+#include "udp-mib/udpEndpointTable/udpEndpointTable_constants.h"
+#include "udp-mib/data_access/udp_endpoint_private.h"
+
+#include "kernel_sunos5.h"
+
+static int _load_udp_endpoint_table_v4(netsnmp_container *, int);
+#if defined(NETSNMP_ENABLE_IPV6) && defined(SOLARIS_HAVE_IPV6_MIB_SUPPORT)
+static int _load_udp_endpoint_table_v6(netsnmp_container *, int);
+#endif
+
+int
+netsnmp_arch_udp_endpoint_entry_init(netsnmp_udp_endpoint_entry *ep)
+{
+ init_kernel_sunos5();
+ return 0;
+}
+
+void
+netsnmp_arch_udp_endpoint_entry_cleanup(netsnmp_udp_endpoint_entry *ep)
+{
+ /*
+ * Do nothing
+ */
+}
+
+int
+netsnmp_arch_udp_endpoint_entry_copy(netsnmp_udp_endpoint_entry *ep1,
+ netsnmp_udp_endpoint_entry *ep2)
+{
+ /*
+ * Do nothing
+ */
+ return 0;
+}
+
+int
+netsnmp_arch_udp_endpoint_delete(netsnmp_udp_endpoint_entry *ep)
+{
+ /*
+ * Not implemented
+ */
+ return (-1);
+}
+
+int
+netsnmp_arch_udp_endpoint_container_load(netsnmp_container * container,
+ u_int load_flag)
+{
+ int rc;
+
+ if ((rc = _load_udp_endpoint_table_v4(container, load_flag)) != 0) {
+ u_int flag = NETSNMP_ACCESS_UDP_ENDPOINT_FREE_KEEP_CONTAINER;
+ netsnmp_access_udp_endpoint_container_free(container, flag);
+ return (rc);
+ }
+#if defined(NETSNMP_ENABLE_IPV6) && defined(SOLARIS_HAVE_IPV6_MIB_SUPPORT)
+ if ((rc = _load_udp_endpoint_table_v6(container, load_flag)) != 0) {
+ u_int flag = NETSNMP_ACCESS_UDP_ENDPOINT_FREE_KEEP_CONTAINER;
+ netsnmp_access_udp_endpoint_container_free(container, flag);
+ return (rc);
+ }
+#endif
+ return (0);
+}
+
+static int
+_load_udp_endpoint_table_v4(netsnmp_container *container, int flag)
+{
+ netsnmp_udp_endpoint_entry *ep;
+ mib2_udpEntry_t ue;
+ req_e req = GET_FIRST;
+
+ DEBUGMSGT(("access:udp_endpoint:container", "load v4\n"));
+
+ while (getMibstat(MIB_UDP_LISTEN, &ue, sizeof(ue), req,
+ &Get_everything, 0)==0) {
+ req = GET_NEXT;
+ ep = netsnmp_access_udp_endpoint_entry_create();
+ if (ep == NULL)
+ return (-1);
+ DEBUGMSGT(("access:udp_endpoint:container", "add entry\n"));
+
+ /*
+ * local address/port.
+ */
+ ep->loc_addr_len = sizeof(ue.udpLocalAddress);
+ if (sizeof(ep->loc_addr) < ep->loc_addr_len) {
+ netsnmp_access_udp_endpoint_entry_free(ep);
+ return (-1);
+ }
+ memcpy(&ep->loc_addr, &ue.udpLocalAddress, ep->loc_addr_len);
+
+ ep->loc_port = ue.udpLocalPort;
+
+ /*
+ * remote address/port. The address length is the same as the
+ * local address, so no check needed. If the remote address is
+ * unspecfied, then the type should be set to "unknown" (per RFC 4113).
+ */
+ if (ue.udpEntryInfo.ue_RemoteAddress == INADDR_ANY) {
+ ep->rmt_addr_len = 0;
+ } else {
+ ep->rmt_addr_len = sizeof(ue.udpEntryInfo.ue_RemoteAddress);
+ memcpy(&ep->rmt_addr, &ue.udpEntryInfo.ue_RemoteAddress,
+ ep->rmt_addr_len);
+ }
+
+ ep->rmt_port = ue.udpEntryInfo.ue_RemotePort;
+
+ /*
+ * instance - if there is support for RFC 4293, then we also have
+ * support for RFC 4113.
+ */
+#ifdef SOLARIS_HAVE_RFC4293_SUPPORT
+ ep->instance = ue.udpInstance;
+#else
+ ep->instance = 0;
+#endif
+
+ /* state */
+ ep->state = 0;
+
+ /* index */
+ ep->index = CONTAINER_SIZE(container) + 1;
+ ep->oid_index.oids = &ep->index;
+ ep->oid_index.len = 1;
+
+ CONTAINER_INSERT(container, (void *)ep);
+ }
+ return (0);
+}
+
+#if defined(NETSNMP_ENABLE_IPV6) && defined(SOLARIS_HAVE_IPV6_MIB_SUPPORT)
+static int
+_load_udp_endpoint_table_v6(netsnmp_container *container, int flag)
+{
+ netsnmp_udp_endpoint_entry *ep;
+ mib2_udp6Entry_t ue6;
+ req_e req = GET_FIRST;
+
+ DEBUGMSGT(("access:udp_endpoint:container", "load v6\n"));
+
+ while (getMibstat(MIB_UDP6_ENDPOINT, &ue6, sizeof(ue6), req,
+ &Get_everything, 0)==0) {
+ req = GET_NEXT;
+ ep = netsnmp_access_udp_endpoint_entry_create();
+ if (ep == NULL)
+ return (-1);
+ DEBUGMSGT(("access:udp_endpoint:container", "add entry\n"));
+
+ /*
+ * local address/port.
+ */
+ ep->loc_addr_len = sizeof(ue6.udp6LocalAddress);
+ if (sizeof(ep->loc_addr) < ep->loc_addr_len) {
+ netsnmp_access_udp_endpoint_entry_free(ep);
+ return (-1);
+ }
+ (void)memcpy(&ep->loc_addr, &ue6.udp6LocalAddress, ep->loc_addr_len);
+
+ ep->loc_port = ue6.udp6LocalPort;
+
+ /* remote address/port */
+ if (IN6_IS_ADDR_UNSPECIFIED(&ue6.udp6EntryInfo.ue_RemoteAddress)) {
+ ep->rmt_addr_len = 0;
+ } else {
+ ep->rmt_addr_len = sizeof(ue6.udp6EntryInfo.ue_RemoteAddress);
+ (void)memcpy(&ep->rmt_addr, &ue6.udp6EntryInfo.ue_RemoteAddress,
+ ep->rmt_addr_len);
+ }
+ ep->rmt_port = ue6.udp6EntryInfo.ue_RemotePort;
+
+ /* instance */
+#ifdef SOLARIS_HAVE_RFC4293_SUPPORT
+ ep->instance = ue6.udp6Instance;
+#else
+ ep->instance = 0;
+#endif
+ /* state */
+ ep->state = 0;
+
+ /* index */
+ ep->index = CONTAINER_SIZE(container) + 1;
+ ep->oid_index.oids = &ep->index;
+ ep->oid_index.len = 1;
+
+ CONTAINER_INSERT(container, (void *)ep);
+ }
+ return (0);
+}
+#endif /* defined(NETSNMP_ENABLE_IPV6)&&defined(SOLARIS_HAVE_IPV6_MIB_SUPPORT)*/
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable.h
new file mode 100644
index 0000000000..95f49fda64
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable.h
@@ -0,0 +1,5 @@
+/*
+ * module to include the modules
+ */
+
+config_require(udp-mib/udpEndpointTable/udpEndpointTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.c
new file mode 100644
index 0000000000..5da022f7f1
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.c
@@ -0,0 +1,416 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: udpEndpointTable.c 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** \page MFD helper for udpEndpointTable
+ *
+ * \section intro Introduction
+ * Introductory text.
+ *
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "udpEndpointTable.h"
+
+#include <net-snmp/agent/mib_modules.h>
+
+#include "udpEndpointTable_interface.h"
+
+oid udpEndpointTable_oid[] = { UDPENDPOINTTABLE_OID };
+int udpEndpointTable_oid_size =
+OID_LENGTH(udpEndpointTable_oid);
+
+udpEndpointTable_registration udpEndpointTable_user_context;
+
+void initialize_table_udpEndpointTable(void);
+void shutdown_table_udpEndpointTable(void);
+
+
+/**
+ * Initializes the udpEndpointTable module
+ */
+void
+init_udpEndpointTable(void)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:init_udpEndpointTable",
+ "called\n"));
+
+ /*
+ * TODO:300:o: Perform udpEndpointTable one-time module initialization.
+ */
+
+ /*
+ * here we initialize all the tables we're planning on supporting
+ */
+ if (should_init("udpEndpointTable"))
+ initialize_table_udpEndpointTable();
+
+} /* init_udpEndpointTable */
+
+/**
+ * Shut-down the udpEndpointTable module (agent is exiting)
+ */
+void
+shutdown_udpEndpointTable(void)
+{
+ if (should_init("udpEndpointTable"))
+ shutdown_table_udpEndpointTable();
+
+}
+
+/**
+ * Initialize the table udpEndpointTable
+ * (Define its contents and how it's structured)
+ */
+void
+initialize_table_udpEndpointTable(void)
+{
+ udpEndpointTable_registration *user_context;
+ u_long flags;
+
+ DEBUGMSGTL(("verbose:udpEndpointTable:initialize_table_udpEndpointTable", "called\n"));
+
+ /*
+ * TODO:301:o: Perform udpEndpointTable one-time table initialization.
+ */
+
+ /*
+ * TODO:302:o: |->Initialize udpEndpointTable user context
+ * if you'd like to pass in a pointer to some data for this
+ * table, allocate or set it up here.
+ */
+ /*
+ * a netsnmp_data_list is a simple way to store void pointers. A simple
+ * string token is used to add, find or remove pointers.
+ */
+ user_context =
+ netsnmp_create_data_list("udpEndpointTable", NULL, NULL);
+
+ /*
+ * No support for any flags yet, but in the future you would
+ * set any flags here.
+ */
+ flags = 0;
+
+ /*
+ * call interface initialization code
+ */
+ _udpEndpointTable_initialize_interface(user_context, flags);
+} /* initialize_table_udpEndpointTable */
+
+/**
+ * Shutdown the table udpEndpointTable
+ */
+void
+shutdown_table_udpEndpointTable(void)
+{
+ /*
+ * call interface shutdown code
+ */
+ _udpEndpointTable_shutdown_interface(&udpEndpointTable_user_context);
+}
+
+/**
+ * pre-request callback
+ *
+ * @param user_context
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error
+ */
+int
+udpEndpointTable_pre_request(udpEndpointTable_registration * user_context)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_pre_request",
+ "called\n"));
+
+ /*
+ * TODO:510:o: Perform udpEndpointTable pre-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* udpEndpointTable_pre_request */
+
+/**
+ * post-request callback
+ *
+ * Note:
+ * New rows have been inserted into the container, and
+ * deleted rows have been removed from the container and
+ * released.
+ * @param user_context
+ * @param rc : MFD_SUCCESS if all requests succeeded
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error (ignored)
+ */
+int
+udpEndpointTable_post_request(udpEndpointTable_registration * user_context,
+ int rc)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_post_request",
+ "called\n"));
+
+ /*
+ * TODO:511:o: Perform udpEndpointTable post-request actions.
+ */
+
+ return MFD_SUCCESS;
+} /* udpEndpointTable_post_request */
+
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table udpEndpointTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * UDP-MIB::udpEndpointTable is subid 7 of udp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.7.7, length: 8
+ */
+
+/*
+ * ---------------------------------------------------------------------
+ * * TODO:200:r: Implement udpEndpointTable data context functions.
+ */
+
+
+/**
+ * set mib index(es)
+ *
+ * @param tbl_idx mib index structure
+ * @param udpEndpointLocalAddressType_val
+ * @param udpEndpointLocalAddress_val_ptr
+ * @param udpEndpointLocalAddress_val_ptr_len
+ * @param udpEndpointLocalPort_val
+ * @param udpEndpointRemoteAddressType_val
+ * @param udpEndpointRemoteAddress_val_ptr
+ * @param udpEndpointRemoteAddress_val_ptr_len
+ * @param udpEndpointRemotePort_val
+ * @param udpEndpointInstance_val
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This convenience function is useful for setting all the MIB index
+ * components with a single function call. It is assume that the C values
+ * have already been mapped from their native/rawformat to the MIB format.
+ */
+int
+udpEndpointTable_indexes_set_tbl_idx(udpEndpointTable_mib_index * tbl_idx,
+ u_long
+ udpEndpointLocalAddressType_val,
+ char *udpEndpointLocalAddress_val_ptr,
+ size_t
+ udpEndpointLocalAddress_val_ptr_len,
+ u_long udpEndpointLocalPort_val,
+ u_long
+ udpEndpointRemoteAddressType_val, char
+ *udpEndpointRemoteAddress_val_ptr,
+ size_t
+ udpEndpointRemoteAddress_val_ptr_len,
+ u_long udpEndpointRemotePort_val,
+ u_long udpEndpointInstance_val)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_indexes_set_tbl_idx", "called\n"));
+
+ /*
+ * udpEndpointLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ tbl_idx->udpEndpointLocalAddressType = udpEndpointLocalAddressType_val;
+
+ /*
+ * udpEndpointLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ tbl_idx->udpEndpointLocalAddress_len = sizeof(tbl_idx->udpEndpointLocalAddress) / sizeof(tbl_idx->udpEndpointLocalAddress[0]); /* max length */
+ /*
+ * make sure there is enough space for udpEndpointLocalAddress data
+ */
+ if ((NULL == tbl_idx->udpEndpointLocalAddress) ||
+ (tbl_idx->udpEndpointLocalAddress_len <
+ (udpEndpointLocalAddress_val_ptr_len))) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->udpEndpointLocalAddress_len =
+ udpEndpointLocalAddress_val_ptr_len;
+ memcpy(tbl_idx->udpEndpointLocalAddress,
+ udpEndpointLocalAddress_val_ptr,
+ udpEndpointLocalAddress_val_ptr_len *
+ sizeof(udpEndpointLocalAddress_val_ptr[0]));
+
+ /*
+ * udpEndpointLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ tbl_idx->udpEndpointLocalPort = udpEndpointLocalPort_val;
+
+ /*
+ * udpEndpointRemoteAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ tbl_idx->udpEndpointRemoteAddressType =
+ udpEndpointRemoteAddressType_val;
+
+ /*
+ * udpEndpointRemoteAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ tbl_idx->udpEndpointRemoteAddress_len = sizeof(tbl_idx->udpEndpointRemoteAddress) / sizeof(tbl_idx->udpEndpointRemoteAddress[0]); /* max length */
+ /*
+ * make sure there is enough space for udpEndpointRemoteAddress data
+ */
+ if ((NULL == tbl_idx->udpEndpointRemoteAddress) ||
+ (tbl_idx->udpEndpointRemoteAddress_len <
+ (udpEndpointRemoteAddress_val_ptr_len))) {
+ snmp_log(LOG_ERR, "not enough space for value\n");
+ return MFD_ERROR;
+ }
+ tbl_idx->udpEndpointRemoteAddress_len =
+ udpEndpointRemoteAddress_val_ptr_len;
+ memcpy(tbl_idx->udpEndpointRemoteAddress,
+ udpEndpointRemoteAddress_val_ptr,
+ udpEndpointRemoteAddress_val_ptr_len *
+ sizeof(udpEndpointRemoteAddress_val_ptr[0]));
+
+ /*
+ * udpEndpointRemotePort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ tbl_idx->udpEndpointRemotePort = udpEndpointRemotePort_val;
+
+ /*
+ * udpEndpointInstance(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h
+ */
+ tbl_idx->udpEndpointInstance = udpEndpointInstance_val;
+
+
+ return MFD_SUCCESS;
+} /* udpEndpointTable_indexes_set_tbl_idx */
+
+/**
+ * @internal
+ * set row context indexes
+ *
+ * @param reqreq_ctx the row context that needs updated indexes
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ *
+ * @remark
+ * This function sets the mib indexs, then updates the oid indexs
+ * from the mib index.
+ */
+int
+udpEndpointTable_indexes_set(udpEndpointTable_rowreq_ctx * rowreq_ctx,
+ u_long udpEndpointLocalAddressType_val,
+ char *udpEndpointLocalAddress_val_ptr,
+ size_t udpEndpointLocalAddress_val_ptr_len,
+ u_long udpEndpointLocalPort_val,
+ u_long udpEndpointRemoteAddressType_val,
+ char *udpEndpointRemoteAddress_val_ptr,
+ size_t udpEndpointRemoteAddress_val_ptr_len,
+ u_long udpEndpointRemotePort_val,
+ u_long udpEndpointInstance_val)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_indexes_set",
+ "called\n"));
+
+ if (MFD_SUCCESS !=
+ udpEndpointTable_indexes_set_tbl_idx(&rowreq_ctx->tbl_idx,
+ udpEndpointLocalAddressType_val,
+ udpEndpointLocalAddress_val_ptr,
+ udpEndpointLocalAddress_val_ptr_len,
+ udpEndpointLocalPort_val,
+ udpEndpointRemoteAddressType_val,
+ udpEndpointRemoteAddress_val_ptr,
+ udpEndpointRemoteAddress_val_ptr_len,
+ udpEndpointRemotePort_val,
+ udpEndpointInstance_val))
+ return MFD_ERROR;
+
+ /*
+ * convert mib index to oid index
+ */
+ rowreq_ctx->oid_idx.len = sizeof(rowreq_ctx->oid_tmp) / sizeof(oid);
+ if (0 != udpEndpointTable_index_to_oid(&rowreq_ctx->oid_idx,
+ &rowreq_ctx->tbl_idx)) {
+ return MFD_ERROR;
+ }
+
+ return MFD_SUCCESS;
+} /* udpEndpointTable_indexes_set */
+
+
+/*---------------------------------------------------------------------
+ * UDP-MIB::udpEndpointEntry.udpEndpointProcess
+ * udpEndpointProcess is subid 8 of udpEndpointEntry.
+ * Its status is Current, and its access level is ReadOnly.
+ * OID: .1.3.6.1.2.1.7.7.1.8
+ * Description:
+The system's process ID for the process associated with
+ this endpoint, or zero if there is no such process.
+ This value is expected to be the same as
+ HOST-RESOURCES-MIB::hrSWRunIndex or SYSAPPL-MIB::
+ sysApplElmtRunIndex for some row in the appropriate
+ tables.
+ *
+ * Attributes:
+ * accessible 1 isscalar 0 enums 0 hasdefval 0
+ * readable 1 iscolumn 1 ranges 0 hashint 0
+ * settable 0
+ *
+ *
+ * Its syntax is UNSIGNED32 (based on perltype UNSIGNED32)
+ * The net-snmp type is ASN_UNSIGNED. The C type decl is u_long (u_long)
+ */
+/**
+ * Extract the current value of the udpEndpointProcess data.
+ *
+ * Set a value using the data context for the row.
+ *
+ * @param rowreq_ctx
+ * Pointer to the row request context.
+ * @param udpEndpointProcess_val_ptr
+ * Pointer to storage for a u_long variable
+ *
+ * @retval MFD_SUCCESS : success
+ * @retval MFD_SKIP : skip this node (no value for now)
+ * @retval MFD_ERROR : Any other error
+ */
+int
+udpEndpointProcess_get(udpEndpointTable_rowreq_ctx * rowreq_ctx,
+ u_long * udpEndpointProcess_val_ptr)
+{
+ /** we should have a non-NULL pointer */
+ netsnmp_assert(NULL != udpEndpointProcess_val_ptr);
+
+
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointProcess_get",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:231:o: |-> Extract the current value of the udpEndpointProcess data.
+ * copy (* udpEndpointProcess_val_ptr ) from rowreq_ctx->data
+ */
+ (*udpEndpointProcess_val_ptr) = rowreq_ctx->data.udpEndpointProcess;
+
+ return MFD_SUCCESS;
+} /* udpEndpointProcess_get */
+
+
+
+/** @} */
+/** @} */
+/** @{ */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h
new file mode 100644
index 0000000000..f023db83c5
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable.h
@@ -0,0 +1,306 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.48 $ of : mfd-top.m2c,v $
+ *
+ * $Id: udpEndpointTable.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+#ifndef UDPENDPOINTTABLE_H
+#define UDPENDPOINTTABLE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/** @addtogroup misc misc: Miscellaneous routines
+ *
+ * @{
+ */
+#include <net-snmp/library/asn1.h>
+
+ /*
+ * other required module components
+ */
+ /* *INDENT-OFF* */
+config_require(udp-mib/data_access/udp_endpoint)
+config_require(udp-mib/udpEndpointTable/udpEndpointTable_interface)
+config_require(udp-mib/udpEndpointTable/udpEndpointTable_data_access)
+ /* *INDENT-ON* */
+
+ /*
+ * OID, column number and enum definions for udpEndpointTable
+ */
+#include "udpEndpointTable_constants.h"
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+ void init_udpEndpointTable(void);
+ void shutdown_udpEndpointTable(void);
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table udpEndpointTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * UDP-MIB::udpEndpointTable is subid 7 of udp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.7.7, length: 8
+ */
+ /*
+ *********************************************************************
+ * When you register your mib, you get to provide a generic
+ * pointer that will be passed back to you for most of the
+ * functions calls.
+ *
+ * TODO:100:r: Review all context structures
+ */
+ /*
+ * TODO:101:o: |-> Review udpEndpointTable registration context.
+ */
+ typedef netsnmp_data_list udpEndpointTable_registration;
+
+/**********************************************************************/
+ /*
+ * TODO:110:r: |-> Review udpEndpointTable data context structure.
+ * This structure is used to represent the data for udpEndpointTable.
+ */
+ /*
+ * This structure contains storage for all the columns defined in the
+ * udpEndpointTable.
+ */
+ typedef struct udpEndpointTable_data_s {
+
+ /*
+ * udpEndpointProcess(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ u_long udpEndpointProcess;
+
+ } udpEndpointTable_data;
+
+
+ /*
+ * TODO:120:r: |-> Review udpEndpointTable mib index.
+ * This structure is used to represent the index for udpEndpointTable.
+ */
+ typedef struct udpEndpointTable_mib_index_s {
+
+ /*
+ * udpEndpointLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ u_long udpEndpointLocalAddressType;
+
+ /*
+ * udpEndpointLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ /** 128 - 6(other indexes) - oid length(10) = 111 */
+ char udpEndpointLocalAddress[111];
+ size_t udpEndpointLocalAddress_len;
+
+ /*
+ * udpEndpointLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ u_long udpEndpointLocalPort;
+
+ /*
+ * udpEndpointRemoteAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ u_long udpEndpointRemoteAddressType;
+
+ /*
+ * udpEndpointRemoteAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ /** 128 - 6(other indexes) - oid length(10) = 111 */
+ char udpEndpointRemoteAddress[111];
+ size_t udpEndpointRemoteAddress_len;
+
+ /*
+ * udpEndpointRemotePort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ u_long udpEndpointRemotePort;
+
+ /*
+ * udpEndpointInstance(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h
+ */
+ u_long udpEndpointInstance;
+
+
+ } udpEndpointTable_mib_index;
+
+ /*
+ * TODO:121:r: | |-> Review udpEndpointTable max index length.
+ * If you KNOW that your indexes will never exceed a certain
+ * length, update this macro to that length.
+ *
+ * BE VERY CAREFUL TO TAKE INTO ACCOUNT THE MAXIMUM
+ * POSSIBLE LENGHT FOR EVERY VARIABLE LENGTH INDEX!
+ * Guessing 128 - col/entry(2) - oid len(8)
+ */
+#define MAX_udpEndpointTable_IDX_LEN 118
+
+
+ /*
+ *********************************************************************
+ * TODO:130:o: |-> Review udpEndpointTable Row request (rowreq) context.
+ * When your functions are called, you will be passed a
+ * udpEndpointTable_rowreq_ctx pointer.
+ */
+ typedef struct udpEndpointTable_rowreq_ctx_s {
+
+ /** this must be first for container compare to work */
+ netsnmp_index oid_idx;
+ oid oid_tmp[MAX_udpEndpointTable_IDX_LEN];
+
+ udpEndpointTable_mib_index tbl_idx;
+
+ udpEndpointTable_data data;
+
+ /*
+ * flags per row. Currently, the first (lower) 8 bits are reserved
+ * for the user. See mfd.h for other flags.
+ */
+ u_int rowreq_flags;
+
+ /*
+ * TODO:131:o: | |-> Add useful data to udpEndpointTable rowreq context.
+ */
+
+ /*
+ * storage for future expansion
+ */
+ netsnmp_data_list *udpEndpointTable_data_list;
+
+ } udpEndpointTable_rowreq_ctx;
+
+ typedef struct udpEndpointTable_ref_rowreq_ctx_s {
+ udpEndpointTable_rowreq_ctx *rowreq_ctx;
+ } udpEndpointTable_ref_rowreq_ctx;
+
+ /*
+ *********************************************************************
+ * function prototypes
+ */
+ int
+ udpEndpointTable_pre_request(udpEndpointTable_registration *
+ user_context);
+ int
+ udpEndpointTable_post_request(udpEndpointTable_registration *
+ user_context, int rc);
+
+
+ udpEndpointTable_rowreq_ctx
+ * udpEndpointTable_row_find_by_mib_index(udpEndpointTable_mib_index
+ * mib_idx);
+
+ extern oid udpEndpointTable_oid[];
+ extern int udpEndpointTable_oid_size;
+
+
+#include "udpEndpointTable_interface.h"
+#include "udpEndpointTable_data_access.h"
+ /*
+ *********************************************************************
+ * GET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * GET Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table udpEndpointTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * UDP-MIB::udpEndpointTable is subid 7 of udp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.7.7, length: 8
+ */
+ /*
+ * indexes
+ */
+
+ int udpEndpointProcess_get(udpEndpointTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long *
+ udpEndpointProcess_val_ptr);
+
+
+ int
+ udpEndpointTable_indexes_set_tbl_idx(udpEndpointTable_mib_index *
+ tbl_idx,
+ u_long
+ udpEndpointLocalAddressType_val,
+ char
+ *udpEndpointLocalAddress_val_ptr,
+ size_t
+ udpEndpointLocalAddress_val_ptr_len,
+ u_long
+ udpEndpointLocalPort_val,
+ u_long
+ udpEndpointRemoteAddressType_val,
+ char
+ *udpEndpointRemoteAddress_val_ptr,
+ size_t
+ udpEndpointRemoteAddress_val_ptr_len,
+ u_long
+ udpEndpointRemotePort_val,
+ u_long
+ udpEndpointInstance_val);
+ int
+ udpEndpointTable_indexes_set(udpEndpointTable_rowreq_ctx *
+ rowreq_ctx,
+ u_long
+ udpEndpointLocalAddressType_val,
+ char *udpEndpointLocalAddress_val_ptr,
+ size_t
+ udpEndpointLocalAddress_val_ptr_len,
+ u_long udpEndpointLocalPort_val,
+ u_long
+ udpEndpointRemoteAddressType_val, char
+ *udpEndpointRemoteAddress_val_ptr,
+ size_t
+ udpEndpointRemoteAddress_val_ptr_len,
+ u_long udpEndpointRemotePort_val,
+ u_long udpEndpointInstance_val);
+
+
+
+ /*
+ *********************************************************************
+ * SET function declarations
+ */
+
+ /*
+ *********************************************************************
+ * SET Table declarations
+ */
+
+
+ /*
+ * DUMMY markers, ignore
+ *
+ * TODO:099:x: *************************************************************
+ * TODO:199:x: *************************************************************
+ * TODO:299:x: *************************************************************
+ * TODO:399:x: *************************************************************
+ * TODO:499:x: *************************************************************
+ */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* UDPENDPOINTTABLE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_constants.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_constants.h
new file mode 100644
index 0000000000..6242e66357
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_constants.h
@@ -0,0 +1,85 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * : generic-table-constants.m2c,v 1.5 2005/07/15 22:41:16 rstory Exp $
+ *
+ * $Id: udpEndpointTable_constants.h 13787 2005-12-02 18:05:59Z rstory $
+ */
+#ifndef UDPENDPOINTTABLE_CONSTANTS_H
+#define UDPENDPOINTTABLE_CONSTANTS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ * column number definitions for table udpEndpointTable
+ */
+#define UDPENDPOINTTABLE_OID 1,3,6,1,2,1,7,7
+
+#define COLUMN_UDPENDPOINTLOCALADDRESSTYPE 1
+
+#define COLUMN_UDPENDPOINTLOCALADDRESS 2
+
+#define COLUMN_UDPENDPOINTLOCALPORT 3
+
+#define COLUMN_UDPENDPOINTREMOTEADDRESSTYPE 4
+
+#define COLUMN_UDPENDPOINTREMOTEADDRESS 5
+
+#define COLUMN_UDPENDPOINTREMOTEPORT 6
+
+#define COLUMN_UDPENDPOINTINSTANCE 7
+
+#define COLUMN_UDPENDPOINTPROCESS 8
+
+
+#define UDPENDPOINTTABLE_MIN_COL COLUMN_UDPENDPOINTPROCESS
+#define UDPENDPOINTTABLE_MAX_COL COLUMN_UDPENDPOINTPROCESS
+
+
+ /*
+ * NOTES on enums
+ * ==============
+ *
+ * Value Mapping
+ * -------------
+ * If the values for your data type don't exactly match the
+ * possible values defined by the mib, you should map them
+ * below. For example, a boolean flag (1/0) is usually represented
+ * as a TruthValue in a MIB, which maps to the values (1/2).
+ *
+ */
+/*************************************************************************
+ *************************************************************************
+ *
+ * enum definitions for table udpEndpointTable
+ *
+ *************************************************************************
+ *************************************************************************/
+
+/*************************************************************
+ * constants for enums for the MIB node
+ * udpEndpointLocalAddressType (InetAddressType / ASN_INTEGER)
+ *
+ * since a Textual Convention may be referenced more than once in a
+ * MIB, protect againt redefinitions of the enum values.
+ */
+#ifndef INETADDRESSTYPE_ENUMS
+#define INETADDRESSTYPE_ENUMS
+
+#define INETADDRESSTYPE_UNKNOWN 0
+#define INETADDRESSTYPE_IPV4 1
+#define INETADDRESSTYPE_IPV6 2
+#define INETADDRESSTYPE_IPV4Z 3
+#define INETADDRESSTYPE_IPV6Z 4
+#define INETADDRESSTYPE_DNS 16
+
+#endif /* INETADDRESSTYPE_ENUMS */
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* UDPENDPOINTTABLE_OIDS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.c
new file mode 100644
index 0000000000..af4762fb4d
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.c
@@ -0,0 +1,356 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: udpEndpointTable_data_access.c 15250 2006-09-19 03:27:05Z hardaker $
+ */
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <net-snmp/data_access/ipaddress.h>
+#include <net-snmp/data_access/udp_endpoint.h>
+
+/*
+ * include our parent header
+ */
+#include "udpEndpointTable.h"
+
+
+#include "udpEndpointTable_data_access.h"
+
+/** @ingroup interface
+ * @addtogroup data_access data_access: Routines to access data
+ *
+ * These routines are used to locate the data used to satisfy
+ * requests.
+ *
+ * @{
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table udpEndpointTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * UDP-MIB::udpEndpointTable is subid 7 of udp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.7.7, length: 8
+ */
+
+/**
+ * initialization for udpEndpointTable data access
+ *
+ * This function is called during startup to allow you to
+ * allocate any resources you need for the data table.
+ *
+ * @param udpEndpointTable_reg
+ * Pointer to udpEndpointTable_registration
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : unrecoverable error.
+ */
+int
+udpEndpointTable_init_data(udpEndpointTable_registration *
+ udpEndpointTable_reg)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_init_data",
+ "called\n"));
+
+ /*
+ * TODO:303:o: Initialize udpEndpointTable data.
+ */
+
+ return MFD_SUCCESS;
+} /* udpEndpointTable_init_data */
+
+/**
+ * container overview
+ *
+ */
+
+/**
+ * container initialization
+ *
+ * @param container_ptr_ptr A pointer to a container pointer. If you
+ * create a custom container, use this parameter to return it
+ * to the MFD helper. If set to NULL, the MFD helper will
+ * allocate a container for you.
+ * @param cache A pointer to a cache structure. You can set the timeout
+ * and other cache flags using this pointer.
+ *
+ * This function is called at startup to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases. If no custom
+ * container is allocated, the MFD code will create one for your.
+ *
+ * This is also the place to set up cache behavior. The default, to
+ * simply set the cache timeout, will work well with the default
+ * container. If you are using a custom container, you may want to
+ * look at the cache helper documentation to see if there are any
+ * flags you want to set.
+ *
+ * @remark
+ * This would also be a good place to do any initialization needed
+ * for you data source. For example, opening a connection to another
+ * process that will supply the data, opening a database, etc.
+ */
+void
+udpEndpointTable_container_init(netsnmp_container **container_ptr_ptr,
+ netsnmp_cache * cache)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_container_init",
+ "called\n"));
+
+ if (NULL == container_ptr_ptr) {
+ snmp_log(LOG_ERR,
+ "bad container param to udpEndpointTable_container_init\n");
+ return;
+ }
+
+ /*
+ * For advanced users, you can use a custom container. If you
+ * do not create one, one will be created for you.
+ */
+ *container_ptr_ptr = NULL;
+
+ if (NULL == cache) {
+ snmp_log(LOG_ERR,
+ "bad cache param to udpEndpointTable_container_init\n");
+ return;
+ }
+
+ /*
+ * TODO:345:A: Set up udpEndpointTable cache properties.
+ *
+ * Also for advanced users, you can set parameters for the
+ * cache. Do not change the magic pointer, as it is used
+ * by the MFD helper. To completely disable caching, set
+ * cache->enabled to 0.
+ */
+ cache->timeout = UDPENDPOINTTABLE_CACHE_TIMEOUT; /* seconds */
+} /* udpEndpointTable_container_init */
+
+/**
+ * container shutdown
+ *
+ * @param container_ptr A pointer to the container.
+ *
+ * This function is called at shutdown to allow you to customize certain
+ * aspects of the access method. For the most part, it is for advanced
+ * users. The default code should suffice for most cases.
+ *
+ * This function is called before udpEndpointTable_container_free().
+ *
+ * @remark
+ * This would also be a good place to do any cleanup needed
+ * for you data source. For example, closing a connection to another
+ * process that supplied the data, closing a database, etc.
+ */
+void
+udpEndpointTable_container_shutdown(netsnmp_container *container_ptr)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_container_shutdown", "called\n"));
+
+ if (NULL == container_ptr) {
+ snmp_log(LOG_ERR,
+ "bad params to udpEndpointTable_container_shutdown\n");
+ return;
+ }
+
+} /* udpEndpointTable_container_shutdown */
+
+/**
+ * load initial data
+ *
+ * TODO:350:M: Implement udpEndpointTable data load
+ * This function will also be called by the cache helper to load
+ * the container again (after the container free function has been
+ * called to free the previous contents).
+ *
+ * @param container container to which items should be inserted
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_RESOURCE_UNAVAILABLE : Can't access data source
+ * @retval MFD_ERROR : other error.
+ *
+ * This function is called to load the index(es) (and data, optionally)
+ * for the every row in the data set.
+ *
+ * @remark
+ * While loading the data, the only important thing is the indexes.
+ * If access to your data is cheap/fast (e.g. you have a pointer to a
+ * structure in memory), it would make sense to update the data here.
+ * If, however, the accessing the data invovles more work (e.g. parsing
+ * some other existing data, or peforming calculations to derive the data),
+ * then you can limit yourself to setting the indexes and saving any
+ * information you will need later. Then use the saved information in
+ * udpEndpointTable_row_prep() for populating data.
+ *
+ * @note
+ * If you need consistency between rows (like you want statistics
+ * for each row to be from the same time frame), you should set all
+ * data here.
+ *
+ */
+static u_long
+_address_type_from_len(int addrlen) {
+ switch (addrlen) {
+ case 4:
+ return INETADDRESSTYPE_IPV4;
+ case 16:
+ return INETADDRESSTYPE_IPV6;
+ case 0:
+ return INETADDRESSTYPE_UNKNOWN;
+ default:
+ /* To get same behavior as before */
+ return INETADDRESSTYPE_IPV4;
+ }
+}
+
+int
+udpEndpointTable_container_load(netsnmp_container *container)
+{
+ udpEndpointTable_rowreq_ctx *rowreq_ctx;
+ netsnmp_container *ep_c;
+ netsnmp_iterator *ep_it;
+ netsnmp_udp_endpoint_entry *ep;
+
+ /*
+ * temporary storage for index values
+ */
+ u_long udpEndpointLocalAddressType;
+ u_long udpEndpointRemoteAddressType;
+
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_container_load",
+ "called\n"));
+
+ /*
+ * TODO:351:M: |-> Load/update data in the udpEndpointTable container.
+ * loop over your udpEndpointTable data, allocate a rowreq context,
+ * set the index(es) [and data, optionally] and insert into
+ * the container.
+ */
+ ep_c = netsnmp_access_udp_endpoint_container_load(NULL, 0);
+ if (NULL == ep_c)
+ return MFD_RESOURCE_UNAVAILABLE;
+ ep_it = CONTAINER_ITERATOR(ep_c);
+ if (NULL == ep_c) {
+ netsnmp_access_udp_endpoint_container_free(ep_c, 0);
+ return MFD_RESOURCE_UNAVAILABLE;
+ }
+ for (ep = ITERATOR_FIRST(ep_it); ep; ep = ITERATOR_NEXT(ep_it)) {
+
+ /*
+ * TODO:352:M: | |-> set indexes in new udpEndpointTable rowreq context.
+ */
+ rowreq_ctx = udpEndpointTable_allocate_rowreq_ctx();
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "memory allocation failed\n");
+ return MFD_RESOURCE_UNAVAILABLE;
+ }
+ udpEndpointLocalAddressType = _address_type_from_len(ep->loc_addr_len);
+ udpEndpointRemoteAddressType = _address_type_from_len(ep->rmt_addr_len);
+ if (MFD_SUCCESS !=
+ udpEndpointTable_indexes_set(rowreq_ctx,
+ udpEndpointLocalAddressType,
+ ep->loc_addr,
+ ep->loc_addr_len,
+ ep->loc_port,
+ udpEndpointRemoteAddressType,
+ ep->rmt_addr,
+ ep->rmt_addr_len,
+ ep->rmt_port,
+ ep->instance)) {
+ snmp_log(LOG_ERR,
+ "error setting index while loading "
+ "udpEndpointTable data.\n");
+ udpEndpointTable_release_rowreq_ctx(rowreq_ctx);
+ continue;
+ }
+
+ /*
+ * TODO:352:r: | |-> populate udpEndpointTable data context.
+ * Populate data context here. (optionally, delay until row prep)
+ */
+ /*
+ * non-TRANSIENT data: no need to copy. set pointer to data
+ */
+
+ /*
+ * insert into table container
+ */
+ CONTAINER_INSERT(container, rowreq_ctx);
+ }
+
+ ITERATOR_RELEASE(ep_it);
+
+ netsnmp_access_udp_endpoint_container_free(ep_c,
+ NETSNMP_ACCESS_UDP_ENDPOINT_FREE_DONT_CLEAR);
+
+
+ DEBUGMSGT(("verbose:udpEndpointTable:udpEndpointTable_container_load",
+ "inserted %d records\n", CONTAINER_SIZE(container)));
+
+ return MFD_SUCCESS;
+} /* udpEndpointTable_container_load */
+
+/**
+ * container clean up
+ *
+ * @param container container with all current items
+ *
+ * This optional callback is called prior to all
+ * item's being removed from the container. If you
+ * need to do any processing before that, do it here.
+ *
+ * @note
+ * The MFD helper will take care of releasing all the row contexts.
+ *
+ */
+void
+udpEndpointTable_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_container_free",
+ "called\n"));
+
+ /*
+ * TODO:380:M: Free udpEndpointTable container data.
+ */
+} /* udpEndpointTable_container_free */
+
+/**
+ * prepare row for processing.
+ *
+ * When the agent has located the row for a request, this function is
+ * called to prepare the row for processing. If you fully populated
+ * the data context during the index setup phase, you may not need to
+ * do anything.
+ *
+ * @param rowreq_ctx pointer to a context.
+ *
+ * @retval MFD_SUCCESS : success.
+ * @retval MFD_ERROR : other error.
+ */
+int
+udpEndpointTable_row_prep(udpEndpointTable_rowreq_ctx * rowreq_ctx)
+{
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_row_prep",
+ "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ /*
+ * TODO:390:o: Prepare row for request.
+ * If populating row data was delayed, this is the place to
+ * fill in the row for this request.
+ */
+
+ return MFD_SUCCESS;
+} /* udpEndpointTable_row_prep */
+
+/** @} */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.h
new file mode 100644
index 0000000000..408461af27
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_data_access.h
@@ -0,0 +1,73 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.17 $ of : mfd-data-access.m2c,v $
+ *
+ * $Id: udpEndpointTable_data_access.h 13787 2005-12-02 18:05:59Z rstory $
+ */
+#ifndef UDPENDPOINTTABLE_DATA_ACCESS_H
+#define UDPENDPOINTTABLE_DATA_ACCESS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+ /*
+ *********************************************************************
+ * function declarations
+ */
+
+ /*
+ *********************************************************************
+ * Table declarations
+ */
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table udpEndpointTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+ /*
+ * UDP-MIB::udpEndpointTable is subid 7 of udp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.7.7, length: 8
+ */
+
+
+ int
+ udpEndpointTable_init_data(udpEndpointTable_registration *
+ udpEndpointTable_reg);
+
+
+ /*
+ * TODO:180:o: Review udpEndpointTable cache timeout.
+ * The number of seconds before the cache times out
+ */
+#define UDPENDPOINTTABLE_CACHE_TIMEOUT 60
+
+ void udpEndpointTable_container_init(netsnmp_container
+ **container_ptr_ptr,
+ netsnmp_cache * cache);
+ void udpEndpointTable_container_shutdown(netsnmp_container
+ *container_ptr);
+
+ int udpEndpointTable_container_load(netsnmp_container
+ *container);
+ void udpEndpointTable_container_free(netsnmp_container
+ *container);
+
+ int udpEndpointTable_cache_load(netsnmp_container
+ *container);
+ void udpEndpointTable_cache_free(netsnmp_container
+ *container);
+
+ int udpEndpointTable_row_prep(udpEndpointTable_rowreq_ctx *
+ rowreq_ctx);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* UDPENDPOINTTABLE_DATA_ACCESS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.c
new file mode 100644
index 0000000000..657f6f1678
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.c
@@ -0,0 +1,1073 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: udpEndpointTable_interface.c 15015 2006-08-17 15:06:43Z rstory $
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+
+/*
+ * standard Net-SNMP includes
+ */
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+/*
+ * include our parent header
+ */
+#include "udpEndpointTable.h"
+
+
+#include <net-snmp/agent/table_container.h>
+#include <net-snmp/library/container.h>
+
+#include "udpEndpointTable_interface.h"
+
+#include <ctype.h>
+
+/**********************************************************************
+ **********************************************************************
+ ***
+ *** Table udpEndpointTable
+ ***
+ **********************************************************************
+ **********************************************************************/
+/*
+ * UDP-MIB::udpEndpointTable is subid 7 of udp.
+ * Its status is Current.
+ * OID: .1.3.6.1.2.1.7.7, length: 8
+ */
+typedef struct udpEndpointTable_interface_ctx_s {
+
+ netsnmp_container *container;
+ netsnmp_cache *cache;
+
+ udpEndpointTable_registration *user_ctx;
+
+ netsnmp_table_registration_info tbl_info;
+
+ netsnmp_baby_steps_access_methods access_multiplexer;
+
+} udpEndpointTable_interface_ctx;
+
+static udpEndpointTable_interface_ctx udpEndpointTable_if_ctx;
+
+static void
+ _udpEndpointTable_container_init(udpEndpointTable_interface_ctx * if_ctx);
+static void
+ _udpEndpointTable_container_shutdown(udpEndpointTable_interface_ctx *
+ if_ctx);
+
+
+netsnmp_container *
+udpEndpointTable_container_get(void)
+{
+ return udpEndpointTable_if_ctx.container;
+}
+
+udpEndpointTable_registration *
+udpEndpointTable_registration_get(void)
+{
+ return udpEndpointTable_if_ctx.user_ctx;
+}
+
+udpEndpointTable_registration *
+udpEndpointTable_registration_set(udpEndpointTable_registration * newreg)
+{
+ udpEndpointTable_registration *old = udpEndpointTable_if_ctx.user_ctx;
+ udpEndpointTable_if_ctx.user_ctx = newreg;
+ return old;
+}
+
+int
+udpEndpointTable_container_size(void)
+{
+ return CONTAINER_SIZE(udpEndpointTable_if_ctx.container);
+}
+
+/*
+ * mfd multiplexer modes
+ */
+static Netsnmp_Node_Handler _mfd_udpEndpointTable_pre_request;
+static Netsnmp_Node_Handler _mfd_udpEndpointTable_post_request;
+static Netsnmp_Node_Handler _mfd_udpEndpointTable_object_lookup;
+static Netsnmp_Node_Handler _mfd_udpEndpointTable_get_values;
+/**
+ * @internal
+ * Initialize the table udpEndpointTable
+ * (Define its contents and how it's structured)
+ */
+void
+_udpEndpointTable_initialize_interface(udpEndpointTable_registration *
+ reg_ptr, u_long flags)
+{
+ netsnmp_baby_steps_access_methods *access_multiplexer =
+ &udpEndpointTable_if_ctx.access_multiplexer;
+ netsnmp_table_registration_info *tbl_info =
+ &udpEndpointTable_if_ctx.tbl_info;
+ netsnmp_handler_registration *reginfo;
+ netsnmp_mib_handler *handler;
+ int mfd_modes = 0;
+
+ DEBUGMSGTL(("internal:udpEndpointTable:_udpEndpointTable_initialize_interface", "called\n"));
+
+
+ /*************************************************
+ *
+ * save interface context for udpEndpointTable
+ */
+ /*
+ * Setting up the table's definition
+ */
+ netsnmp_table_helper_add_indexes(tbl_info, ASN_INTEGER,
+ /** index: udpEndpointLocalAddressType */
+ ASN_OCTET_STR,
+ /** index: udpEndpointLocalAddress */
+ ASN_UNSIGNED,
+ /** index: udpEndpointLocalPort */
+ ASN_INTEGER,
+ /** index: udpEndpointRemoteAddressType */
+ ASN_OCTET_STR,
+ /** index: udpEndpointRemoteAddress */
+ ASN_UNSIGNED,
+ /** index: udpEndpointRemotePort */
+ ASN_UNSIGNED,
+ /** index: udpEndpointInstance */
+ 0);
+
+ /*
+ * Define the minimum and maximum accessible columns. This
+ * optimizes retrival.
+ */
+ tbl_info->min_column = UDPENDPOINTTABLE_MIN_COL;
+ tbl_info->max_column = UDPENDPOINTTABLE_MAX_COL;
+
+ /*
+ * save users context
+ */
+ udpEndpointTable_if_ctx.user_ctx = reg_ptr;
+
+ /*
+ * call data access initialization code
+ */
+ udpEndpointTable_init_data(reg_ptr);
+
+ /*
+ * set up the container
+ */
+ _udpEndpointTable_container_init(&udpEndpointTable_if_ctx);
+ if (NULL == udpEndpointTable_if_ctx.container) {
+ snmp_log(LOG_ERR,
+ "could not initialize container for udpEndpointTable\n");
+ return;
+ }
+
+ /*
+ * access_multiplexer: REQUIRED wrapper for get request handling
+ */
+ access_multiplexer->object_lookup =
+ _mfd_udpEndpointTable_object_lookup;
+ access_multiplexer->get_values = _mfd_udpEndpointTable_get_values;
+
+ /*
+ * no wrappers yet
+ */
+ access_multiplexer->pre_request = _mfd_udpEndpointTable_pre_request;
+ access_multiplexer->post_request = _mfd_udpEndpointTable_post_request;
+
+
+ /*************************************************
+ *
+ * Create a registration, save our reg data, register table.
+ */
+ DEBUGMSGTL(("udpEndpointTable:init_udpEndpointTable",
+ "Registering udpEndpointTable as a mibs-for-dummies table.\n"));
+ handler =
+ netsnmp_baby_steps_access_multiplexer_get(access_multiplexer);
+ reginfo =
+ netsnmp_handler_registration_create("udpEndpointTable", handler,
+ udpEndpointTable_oid,
+ udpEndpointTable_oid_size,
+ HANDLER_CAN_BABY_STEP |
+ HANDLER_CAN_RONLY);
+ if (NULL == reginfo) {
+ snmp_log(LOG_ERR, "error registering table udpEndpointTable\n");
+ return;
+ }
+ reginfo->my_reg_void = &udpEndpointTable_if_ctx;
+
+ /*************************************************
+ *
+ * set up baby steps handler, create it and inject it
+ */
+ if (access_multiplexer->object_lookup)
+ mfd_modes |= BABY_STEP_OBJECT_LOOKUP;
+ if (access_multiplexer->set_values)
+ mfd_modes |= BABY_STEP_SET_VALUES;
+ if (access_multiplexer->irreversible_commit)
+ mfd_modes |= BABY_STEP_IRREVERSIBLE_COMMIT;
+ if (access_multiplexer->object_syntax_checks)
+ mfd_modes |= BABY_STEP_CHECK_OBJECT;
+
+ if (access_multiplexer->pre_request)
+ mfd_modes |= BABY_STEP_PRE_REQUEST;
+ if (access_multiplexer->post_request)
+ mfd_modes |= BABY_STEP_POST_REQUEST;
+
+ if (access_multiplexer->undo_setup)
+ mfd_modes |= BABY_STEP_UNDO_SETUP;
+ if (access_multiplexer->undo_cleanup)
+ mfd_modes |= BABY_STEP_UNDO_CLEANUP;
+ if (access_multiplexer->undo_sets)
+ mfd_modes |= BABY_STEP_UNDO_SETS;
+
+ if (access_multiplexer->row_creation)
+ mfd_modes |= BABY_STEP_ROW_CREATE;
+ if (access_multiplexer->consistency_checks)
+ mfd_modes |= BABY_STEP_CHECK_CONSISTENCY;
+ if (access_multiplexer->commit)
+ mfd_modes |= BABY_STEP_COMMIT;
+ if (access_multiplexer->undo_commit)
+ mfd_modes |= BABY_STEP_UNDO_COMMIT;
+
+ handler = netsnmp_baby_steps_handler_get(mfd_modes);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject row_merge helper with prefix rootoid_len + 2 (entry.col)
+ */
+ handler = netsnmp_get_row_merge_handler(reginfo->rootoid_len + 2);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject container_table helper
+ */
+ handler =
+ netsnmp_container_table_handler_get(tbl_info,
+ udpEndpointTable_if_ctx.
+ container,
+ TABLE_CONTAINER_KEY_NETSNMP_INDEX);
+ netsnmp_inject_handler(reginfo, handler);
+
+ /*************************************************
+ *
+ * inject cache helper
+ */
+ if (NULL != udpEndpointTable_if_ctx.cache) {
+ handler = netsnmp_cache_handler_get(udpEndpointTable_if_ctx.cache);
+ netsnmp_inject_handler(reginfo, handler);
+ }
+
+ /*
+ * register table
+ */
+ netsnmp_register_table(reginfo, tbl_info);
+
+} /* _udpEndpointTable_initialize_interface */
+
+/**
+ * @internal
+ * Shutdown the table udpEndpointTable
+ */
+void
+_udpEndpointTable_shutdown_interface(udpEndpointTable_registration *
+ reg_ptr)
+{
+ /*
+ * shutdown the container
+ */
+ _udpEndpointTable_container_shutdown(&udpEndpointTable_if_ctx);
+}
+
+void
+udpEndpointTable_valid_columns_set(netsnmp_column_info *vc)
+{
+ udpEndpointTable_if_ctx.tbl_info.valid_columns = vc;
+} /* udpEndpointTable_valid_columns_set */
+
+/**
+ * @internal
+ * convert the index component stored in the context to an oid
+ */
+int
+udpEndpointTable_index_to_oid(netsnmp_index * oid_idx,
+ udpEndpointTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * udpEndpointLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_udpEndpointLocalAddressType;
+ /*
+ * udpEndpointLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_udpEndpointLocalAddress;
+ /*
+ * udpEndpointLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_udpEndpointLocalPort;
+ /*
+ * udpEndpointRemoteAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_udpEndpointRemoteAddressType;
+ /*
+ * udpEndpointRemoteAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_udpEndpointRemoteAddress;
+ /*
+ * udpEndpointRemotePort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_udpEndpointRemotePort;
+ /*
+ * udpEndpointInstance(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_udpEndpointInstance;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_udpEndpointLocalAddressType, 0x00,
+ sizeof(var_udpEndpointLocalAddressType));
+ var_udpEndpointLocalAddressType.type = ASN_INTEGER;
+ memset(&var_udpEndpointLocalAddress, 0x00,
+ sizeof(var_udpEndpointLocalAddress));
+ var_udpEndpointLocalAddress.type = ASN_OCTET_STR;
+ memset(&var_udpEndpointLocalPort, 0x00,
+ sizeof(var_udpEndpointLocalPort));
+ var_udpEndpointLocalPort.type = ASN_UNSIGNED;
+ memset(&var_udpEndpointRemoteAddressType, 0x00,
+ sizeof(var_udpEndpointRemoteAddressType));
+ var_udpEndpointRemoteAddressType.type = ASN_INTEGER;
+ memset(&var_udpEndpointRemoteAddress, 0x00,
+ sizeof(var_udpEndpointRemoteAddress));
+ var_udpEndpointRemoteAddress.type = ASN_OCTET_STR;
+ memset(&var_udpEndpointRemotePort, 0x00,
+ sizeof(var_udpEndpointRemotePort));
+ var_udpEndpointRemotePort.type = ASN_UNSIGNED;
+ memset(&var_udpEndpointInstance, 0x00,
+ sizeof(var_udpEndpointInstance));
+ var_udpEndpointInstance.type = ASN_UNSIGNED;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_udpEndpointLocalAddressType.next_variable =
+ &var_udpEndpointLocalAddress;
+ var_udpEndpointLocalAddress.next_variable = &var_udpEndpointLocalPort;
+ var_udpEndpointLocalPort.next_variable =
+ &var_udpEndpointRemoteAddressType;
+ var_udpEndpointRemoteAddressType.next_variable =
+ &var_udpEndpointRemoteAddress;
+ var_udpEndpointRemoteAddress.next_variable =
+ &var_udpEndpointRemotePort;
+ var_udpEndpointRemotePort.next_variable = &var_udpEndpointInstance;
+ var_udpEndpointInstance.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_index_to_oid",
+ "called\n"));
+
+ /*
+ * udpEndpointLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ snmp_set_var_value(&var_udpEndpointLocalAddressType,
+ (u_char *) & mib_idx->udpEndpointLocalAddressType,
+ sizeof(mib_idx->udpEndpointLocalAddressType));
+
+ /*
+ * udpEndpointLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_udpEndpointLocalAddress,
+ (u_char *) & mib_idx->udpEndpointLocalAddress,
+ mib_idx->udpEndpointLocalAddress_len *
+ sizeof(mib_idx->udpEndpointLocalAddress[0]));
+
+ /*
+ * udpEndpointLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ snmp_set_var_value(&var_udpEndpointLocalPort,
+ (u_char *) & mib_idx->udpEndpointLocalPort,
+ sizeof(mib_idx->udpEndpointLocalPort));
+
+ /*
+ * udpEndpointRemoteAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ snmp_set_var_value(&var_udpEndpointRemoteAddressType,
+ (u_char *) & mib_idx->udpEndpointRemoteAddressType,
+ sizeof(mib_idx->udpEndpointRemoteAddressType));
+
+ /*
+ * udpEndpointRemoteAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_udpEndpointRemoteAddress,
+ (u_char *) & mib_idx->udpEndpointRemoteAddress,
+ mib_idx->udpEndpointRemoteAddress_len *
+ sizeof(mib_idx->udpEndpointRemoteAddress[0]));
+
+ /*
+ * udpEndpointRemotePort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ snmp_set_var_value(&var_udpEndpointRemotePort,
+ (u_char *) & mib_idx->udpEndpointRemotePort,
+ sizeof(mib_idx->udpEndpointRemotePort));
+
+ /*
+ * udpEndpointInstance(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h
+ */
+ snmp_set_var_value(&var_udpEndpointInstance,
+ (u_char *) & mib_idx->udpEndpointInstance,
+ sizeof(mib_idx->udpEndpointInstance));
+
+
+ err = build_oid_noalloc(oid_idx->oids, oid_idx->len, &oid_idx->len,
+ NULL, 0, &var_udpEndpointLocalAddressType);
+ if (err)
+ snmp_log(LOG_ERR, "error %d converting index to oid\n", err);
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_udpEndpointLocalAddressType);
+
+ return err;
+} /* udpEndpointTable_index_to_oid */
+
+/**
+ * extract udpEndpointTable indexes from a netsnmp_index
+ *
+ * @retval SNMP_ERR_NOERROR : no error
+ * @retval SNMP_ERR_GENERR : error
+ */
+int
+udpEndpointTable_index_from_oid(netsnmp_index * oid_idx,
+ udpEndpointTable_mib_index * mib_idx)
+{
+ int err = SNMP_ERR_NOERROR;
+
+ /*
+ * temp storage for parsing indexes
+ */
+ /*
+ * udpEndpointLocalAddressType(1)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_udpEndpointLocalAddressType;
+ /*
+ * udpEndpointLocalAddress(2)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_udpEndpointLocalAddress;
+ /*
+ * udpEndpointLocalPort(3)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_udpEndpointLocalPort;
+ /*
+ * udpEndpointRemoteAddressType(4)/InetAddressType/ASN_INTEGER/long(u_long)//l/a/w/E/r/d/h
+ */
+ netsnmp_variable_list var_udpEndpointRemoteAddressType;
+ /*
+ * udpEndpointRemoteAddress(5)/InetAddress/ASN_OCTET_STR/char(char)//L/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_udpEndpointRemoteAddress;
+ /*
+ * udpEndpointRemotePort(6)/InetPortNumber/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/H
+ */
+ netsnmp_variable_list var_udpEndpointRemotePort;
+ /*
+ * udpEndpointInstance(7)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/a/w/e/R/d/h
+ */
+ netsnmp_variable_list var_udpEndpointInstance;
+
+ /*
+ * set up varbinds
+ */
+ memset(&var_udpEndpointLocalAddressType, 0x00,
+ sizeof(var_udpEndpointLocalAddressType));
+ var_udpEndpointLocalAddressType.type = ASN_INTEGER;
+ memset(&var_udpEndpointLocalAddress, 0x00,
+ sizeof(var_udpEndpointLocalAddress));
+ var_udpEndpointLocalAddress.type = ASN_OCTET_STR;
+ memset(&var_udpEndpointLocalPort, 0x00,
+ sizeof(var_udpEndpointLocalPort));
+ var_udpEndpointLocalPort.type = ASN_UNSIGNED;
+ memset(&var_udpEndpointRemoteAddressType, 0x00,
+ sizeof(var_udpEndpointRemoteAddressType));
+ var_udpEndpointRemoteAddressType.type = ASN_INTEGER;
+ memset(&var_udpEndpointRemoteAddress, 0x00,
+ sizeof(var_udpEndpointRemoteAddress));
+ var_udpEndpointRemoteAddress.type = ASN_OCTET_STR;
+ memset(&var_udpEndpointRemotePort, 0x00,
+ sizeof(var_udpEndpointRemotePort));
+ var_udpEndpointRemotePort.type = ASN_UNSIGNED;
+ memset(&var_udpEndpointInstance, 0x00,
+ sizeof(var_udpEndpointInstance));
+ var_udpEndpointInstance.type = ASN_UNSIGNED;
+
+ /*
+ * chain temp index varbinds together
+ */
+ var_udpEndpointLocalAddressType.next_variable =
+ &var_udpEndpointLocalAddress;
+ var_udpEndpointLocalAddress.next_variable = &var_udpEndpointLocalPort;
+ var_udpEndpointLocalPort.next_variable =
+ &var_udpEndpointRemoteAddressType;
+ var_udpEndpointRemoteAddressType.next_variable =
+ &var_udpEndpointRemoteAddress;
+ var_udpEndpointRemoteAddress.next_variable =
+ &var_udpEndpointRemotePort;
+ var_udpEndpointRemotePort.next_variable = &var_udpEndpointInstance;
+ var_udpEndpointInstance.next_variable = NULL;
+
+
+ DEBUGMSGTL(("verbose:udpEndpointTable:udpEndpointTable_index_from_oid",
+ "called\n"));
+
+ /*
+ * parse the oid into the individual index components
+ */
+ err = parse_oid_indexes(oid_idx->oids, oid_idx->len,
+ &var_udpEndpointLocalAddressType);
+ if (err == SNMP_ERR_NOERROR) {
+ /*
+ * copy out values
+ */
+ mib_idx->udpEndpointLocalAddressType =
+ *((u_long *) var_udpEndpointLocalAddressType.val.string);
+ /*
+ * NOTE: val_len is in bytes, udpEndpointLocalAddress_len might not be
+ */
+ if (var_udpEndpointLocalAddress.val_len >
+ sizeof(mib_idx->udpEndpointLocalAddress))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->udpEndpointLocalAddress,
+ var_udpEndpointLocalAddress.val.string,
+ var_udpEndpointLocalAddress.val_len);
+ mib_idx->udpEndpointLocalAddress_len =
+ var_udpEndpointLocalAddress.val_len /
+ sizeof(mib_idx->udpEndpointLocalAddress[0]);
+ }
+ mib_idx->udpEndpointLocalPort =
+ *((u_long *) var_udpEndpointLocalPort.val.string);
+ mib_idx->udpEndpointRemoteAddressType =
+ *((u_long *) var_udpEndpointRemoteAddressType.val.string);
+ /*
+ * NOTE: val_len is in bytes, udpEndpointRemoteAddress_len might not be
+ */
+ if (var_udpEndpointRemoteAddress.val_len >
+ sizeof(mib_idx->udpEndpointRemoteAddress))
+ err = SNMP_ERR_GENERR;
+ else {
+ memcpy(mib_idx->udpEndpointRemoteAddress,
+ var_udpEndpointRemoteAddress.val.string,
+ var_udpEndpointRemoteAddress.val_len);
+ mib_idx->udpEndpointRemoteAddress_len =
+ var_udpEndpointRemoteAddress.val_len /
+ sizeof(mib_idx->udpEndpointRemoteAddress[0]);
+ }
+ mib_idx->udpEndpointRemotePort =
+ *((u_long *) var_udpEndpointRemotePort.val.string);
+ mib_idx->udpEndpointInstance =
+ *((u_long *) var_udpEndpointInstance.val.string);
+
+
+ }
+
+ /*
+ * parsing may have allocated memory. free it.
+ */
+ snmp_reset_var_buffers(&var_udpEndpointLocalAddressType);
+
+ return err;
+} /* udpEndpointTable_index_from_oid */
+
+
+/*
+ *********************************************************************
+ * @internal
+ * allocate resources for a udpEndpointTable_rowreq_ctx
+ */
+udpEndpointTable_rowreq_ctx *
+udpEndpointTable_allocate_rowreq_ctx(void)
+{
+ udpEndpointTable_rowreq_ctx *rowreq_ctx =
+ SNMP_MALLOC_TYPEDEF(udpEndpointTable_rowreq_ctx);
+
+ DEBUGMSGTL(("internal:udpEndpointTable:udpEndpointTable_allocate_rowreq_ctx", "called\n"));
+
+ if (NULL == rowreq_ctx) {
+ snmp_log(LOG_ERR, "Couldn't allocate memory for a "
+ "udpEndpointTable_rowreq_ctx.\n");
+ return NULL;
+ }
+
+ rowreq_ctx->oid_idx.oids = rowreq_ctx->oid_tmp;
+
+ rowreq_ctx->udpEndpointTable_data_list = NULL;
+
+
+ return rowreq_ctx;
+} /* udpEndpointTable_allocate_rowreq_ctx */
+
+/*
+ * @internal
+ * release resources for a udpEndpointTable_rowreq_ctx
+ */
+void
+udpEndpointTable_release_rowreq_ctx(udpEndpointTable_rowreq_ctx *
+ rowreq_ctx)
+{
+ DEBUGMSGTL(("internal:udpEndpointTable:udpEndpointTable_release_rowreq_ctx", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+
+ /*
+ * free index oid pointer
+ */
+ if (rowreq_ctx->oid_idx.oids != rowreq_ctx->oid_tmp)
+ free(rowreq_ctx->oid_idx.oids);
+
+ SNMP_FREE(rowreq_ctx);
+} /* udpEndpointTable_release_rowreq_ctx */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_udpEndpointTable_pre_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc;
+
+ DEBUGMSGTL(("internal:udpEndpointTable:_mfd_udpEndpointTable_pre_request", "called\n"));
+
+ if (1 != netsnmp_row_merge_status_first(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:udpEndpointTable",
+ "skipping additional pre_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ rc = udpEndpointTable_pre_request(udpEndpointTable_if_ctx.user_ctx);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("udpEndpointTable", "error %d from "
+ "udpEndpointTable_pre_request\n", rc));
+ netsnmp_request_set_error_all(requests, SNMP_VALIDATE_ERR(rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_udpEndpointTable_pre_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_udpEndpointTable_post_request(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ udpEndpointTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ int rc, packet_rc;
+
+ DEBUGMSGTL(("internal:udpEndpointTable:_mfd_udpEndpointTable_post_request", "called\n"));
+
+ /*
+ * release row context, if deleted
+ */
+ if (rowreq_ctx && (rowreq_ctx->rowreq_flags & MFD_ROW_DELETED))
+ udpEndpointTable_release_rowreq_ctx(rowreq_ctx);
+
+ /*
+ * wait for last call before calling user
+ */
+ if (1 != netsnmp_row_merge_status_last(reginfo, agtreq_info)) {
+ DEBUGMSGTL(("internal:udpEndpointTable",
+ "waiting for last post_request\n"));
+ return SNMP_ERR_NOERROR;
+ }
+
+ packet_rc = netsnmp_check_all_requests_error(agtreq_info->asp, 0);
+ rc = udpEndpointTable_post_request(udpEndpointTable_if_ctx.user_ctx,
+ packet_rc);
+ if (MFD_SUCCESS != rc) {
+ /*
+ * nothing we can do about it but log it
+ */
+ DEBUGMSGTL(("udpEndpointTable", "error %d from "
+ "udpEndpointTable_post_request\n", rc));
+ }
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_udpEndpointTable_post_request */
+
+/**
+ * @internal
+ * wrapper
+ */
+static int
+_mfd_udpEndpointTable_object_lookup(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info
+ *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ int rc = SNMP_ERR_NOERROR;
+ udpEndpointTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+
+ DEBUGMSGTL(("internal:udpEndpointTable:_mfd_udpEndpointTable_object_lookup", "called\n"));
+
+ /*
+ * get our context from mfd
+ * udpEndpointTable_interface_ctx *if_ctx =
+ * (udpEndpointTable_interface_ctx *)reginfo->my_reg_void;
+ */
+
+ if (NULL == rowreq_ctx) {
+ rc = SNMP_ERR_NOCREATION;
+ }
+
+ if (MFD_SUCCESS != rc)
+ netsnmp_request_set_error_all(requests, rc);
+ else
+ udpEndpointTable_row_prep(rowreq_ctx);
+
+ return SNMP_VALIDATE_ERR(rc);
+} /* _mfd_udpEndpointTable_object_lookup */
+
+/***********************************************************************
+ *
+ * GET processing
+ *
+ ***********************************************************************/
+/*
+ * @internal
+ * Retrieve the value for a particular column
+ */
+NETSNMP_STATIC_INLINE int
+_udpEndpointTable_get_column(udpEndpointTable_rowreq_ctx * rowreq_ctx,
+ netsnmp_variable_list * var, int column)
+{
+ int rc = SNMPERR_SUCCESS;
+
+ DEBUGMSGTL(("internal:udpEndpointTable:_mfd_udpEndpointTable_get_column", "called for %d\n", column));
+
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ switch (column) {
+
+ /*
+ * udpEndpointProcess(8)/UNSIGNED32/ASN_UNSIGNED/u_long(u_long)//l/A/w/e/r/d/h
+ */
+ case COLUMN_UDPENDPOINTPROCESS:
+ var->val_len = sizeof(u_long);
+ var->type = ASN_UNSIGNED;
+ rc = udpEndpointProcess_get(rowreq_ctx,
+ (u_long *) var->val.string);
+ break;
+
+ default:
+ snmp_log(LOG_ERR,
+ "unknown column %d in _udpEndpointTable_get_column\n",
+ column);
+ break;
+ }
+
+ return rc;
+} /* _udpEndpointTable_get_column */
+
+int
+_mfd_udpEndpointTable_get_values(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *agtreq_info,
+ netsnmp_request_info *requests)
+{
+ udpEndpointTable_rowreq_ctx *rowreq_ctx =
+ netsnmp_container_table_row_extract(requests);
+ netsnmp_table_request_info *tri;
+ u_char *old_string;
+ void (*dataFreeHook) (void *);
+ int rc;
+
+ DEBUGMSGTL(("internal:udpEndpointTable:_mfd_udpEndpointTable_get_values", "called\n"));
+
+ netsnmp_assert(NULL != rowreq_ctx);
+
+ for (; requests; requests = requests->next) {
+ /*
+ * save old pointer, so we can free it if replaced
+ */
+ old_string = requests->requestvb->val.string;
+ dataFreeHook = requests->requestvb->dataFreeHook;
+ if (NULL == requests->requestvb->val.string) {
+ requests->requestvb->val.string = requests->requestvb->buf;
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ } else if (requests->requestvb->buf ==
+ requests->requestvb->val.string) {
+ if (requests->requestvb->val_len !=
+ sizeof(requests->requestvb->buf))
+ requests->requestvb->val_len =
+ sizeof(requests->requestvb->buf);
+ }
+
+ /*
+ * get column data
+ */
+ tri = netsnmp_extract_table_info(requests);
+ if (NULL == tri)
+ continue;
+
+ rc = _udpEndpointTable_get_column(rowreq_ctx, requests->requestvb,
+ tri->colnum);
+ if (rc) {
+ if (MFD_SKIP == rc) {
+ requests->requestvb->type = SNMP_NOSUCHINSTANCE;
+ rc = SNMP_ERR_NOERROR;
+ }
+ } else if (NULL == requests->requestvb->val.string) {
+ snmp_log(LOG_ERR, "NULL varbind data pointer!\n");
+ rc = SNMP_ERR_GENERR;
+ }
+ if (rc)
+ netsnmp_request_set_error(requests, SNMP_VALIDATE_ERR(rc));
+
+ /*
+ * if the buffer wasn't used previously for the old data (i.e. it
+ * was allcoated memory) and the get routine replaced the pointer,
+ * we need to free the previous pointer.
+ */
+ if (old_string && (old_string != requests->requestvb->buf) &&
+ (requests->requestvb->val.string != old_string)) {
+ if (dataFreeHook)
+ (*dataFreeHook) (old_string);
+ else
+ free(old_string);
+ }
+ } /* for results */
+
+ return SNMP_ERR_NOERROR;
+} /* _mfd_udpEndpointTable_get_values */
+
+
+/***********************************************************************
+ *
+ * SET processing
+ *
+ ***********************************************************************/
+
+/*
+ * SET PROCESSING NOT APPLICABLE (per MIB or user setting)
+ */
+/***********************************************************************
+ *
+ * DATA ACCESS
+ *
+ ***********************************************************************/
+static void _container_free(netsnmp_container *container);
+
+/**
+ * @internal
+ */
+static int
+_cache_load(netsnmp_cache * cache, void *vmagic)
+{
+ DEBUGMSGTL(("internal:udpEndpointTable:_cache_load", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache for udpEndpointTable_cache_load\n");
+ return -1;
+ }
+
+ /** should only be called for an invalid or expired cache */
+ netsnmp_assert((0 == cache->valid) || (1 == cache->expired));
+
+ /*
+ * call user code
+ */
+ return udpEndpointTable_container_load((netsnmp_container *) cache->
+ magic);
+} /* _cache_load */
+
+/**
+ * @internal
+ */
+static void
+_cache_free(netsnmp_cache * cache, void *magic)
+{
+ netsnmp_container *container;
+
+ DEBUGMSGTL(("internal:udpEndpointTable:_cache_free", "called\n"));
+
+ if ((NULL == cache) || (NULL == cache->magic)) {
+ snmp_log(LOG_ERR,
+ "invalid cache in udpEndpointTable_cache_free\n");
+ return;
+ }
+
+ container = (netsnmp_container *) cache->magic;
+
+ _container_free(container);
+} /* _cache_free */
+
+/**
+ * @internal
+ */
+static void
+_container_item_free(udpEndpointTable_rowreq_ctx * rowreq_ctx,
+ void *context)
+{
+ DEBUGMSGTL(("internal:udpEndpointTable:_container_item_free",
+ "called\n"));
+
+ if (NULL == rowreq_ctx)
+ return;
+
+ udpEndpointTable_release_rowreq_ctx(rowreq_ctx);
+} /* _container_item_free */
+
+/**
+ * @internal
+ */
+static void
+_container_free(netsnmp_container *container)
+{
+ DEBUGMSGTL(("internal:udpEndpointTable:_container_free", "called\n"));
+
+ if (NULL == container) {
+ snmp_log(LOG_ERR,
+ "invalid container in udpEndpointTable_container_free\n");
+ return;
+ }
+
+ /*
+ * call user code
+ */
+ udpEndpointTable_container_free(container);
+
+ /*
+ * free all items. inefficient, but easy.
+ */
+ CONTAINER_CLEAR(container,
+ (netsnmp_container_obj_func *) _container_item_free,
+ NULL);
+} /* _container_free */
+
+/**
+ * @internal
+ * initialize the container with functions or wrappers
+ */
+void
+_udpEndpointTable_container_init(udpEndpointTable_interface_ctx * if_ctx)
+{
+ DEBUGMSGTL(("internal:udpEndpointTable:_udpEndpointTable_container_init", "called\n"));
+
+ /*
+ * cache init
+ */
+ if_ctx->cache = netsnmp_cache_create(30, /* timeout in seconds */
+ _cache_load, _cache_free,
+ udpEndpointTable_oid,
+ udpEndpointTable_oid_size);
+
+ if (NULL == if_ctx->cache) {
+ snmp_log(LOG_ERR, "error creating cache for udpEndpointTable\n");
+ return;
+ }
+
+ if_ctx->cache->flags = NETSNMP_CACHE_DONT_INVALIDATE_ON_SET;
+
+ udpEndpointTable_container_init(&if_ctx->container, if_ctx->cache);
+ if (NULL == if_ctx->container)
+ if_ctx->container =
+ netsnmp_container_find("udpEndpointTable:table_container");
+ if (NULL == if_ctx->container) {
+ snmp_log(LOG_ERR, "error creating container in "
+ "udpEndpointTable_container_init\n");
+ return;
+ }
+
+ if (NULL != if_ctx->cache)
+ if_ctx->cache->magic = (void *) if_ctx->container;
+} /* _udpEndpointTable_container_init */
+
+/**
+ * @internal
+ * shutdown the container with functions or wrappers
+ */
+void
+_udpEndpointTable_container_shutdown(udpEndpointTable_interface_ctx *
+ if_ctx)
+{
+ DEBUGMSGTL(("internal:udpEndpointTable:_udpEndpointTable_container_shutdown", "called\n"));
+
+ udpEndpointTable_container_shutdown(if_ctx->container);
+
+ _container_free(if_ctx->container);
+
+} /* _udpEndpointTable_container_shutdown */
+
+
+udpEndpointTable_rowreq_ctx *
+udpEndpointTable_row_find_by_mib_index(udpEndpointTable_mib_index *
+ mib_idx)
+{
+ udpEndpointTable_rowreq_ctx *rowreq_ctx;
+ oid oid_tmp[MAX_OID_LEN];
+ netsnmp_index oid_idx;
+ int rc;
+
+ /*
+ * set up storage for OID
+ */
+ oid_idx.oids = oid_tmp;
+ oid_idx.len = sizeof(oid_tmp) / sizeof(oid);
+
+ /*
+ * convert
+ */
+ rc = udpEndpointTable_index_to_oid(&oid_idx, mib_idx);
+ if (MFD_SUCCESS != rc)
+ return NULL;
+
+ rowreq_ctx =
+ CONTAINER_FIND(udpEndpointTable_if_ctx.container, &oid_idx);
+
+ return rowreq_ctx;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.h
new file mode 100644
index 0000000000..57866f3728
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/udp-mib/udpEndpointTable/udpEndpointTable_interface.h
@@ -0,0 +1,97 @@
+/*
+ * Note: this file originally auto-generated by mib2c using
+ * version : 1.67 $ of : mfd-interface.m2c,v $
+ *
+ * $Id: udpEndpointTable_interface.h 14169 2006-01-25 16:28:12Z dts12 $
+ */
+/** @ingroup interface Routines to interface to Net-SNMP
+ *
+ * \warning This code should not be modified, called directly,
+ * or used to interpret functionality. It is subject to
+ * change at any time.
+ *
+ * @{
+ */
+/*
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ * *** ***
+ * *** NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE ***
+ * *** ***
+ * *** ***
+ * *** THIS FILE DOES NOT CONTAIN ANY USER EDITABLE CODE. ***
+ * *** ***
+ * *** ***
+ * *** THE GENERATED CODE IS INTERNAL IMPLEMENTATION, AND ***
+ * *** ***
+ * *** ***
+ * *** IS SUBJECT TO CHANGE WITHOUT WARNING IN FUTURE RELEASES. ***
+ * *** ***
+ * *** ***
+ * *********************************************************************
+ * *********************************************************************
+ * *********************************************************************
+ */
+#ifndef UDPENDPOINTTABLE_INTERFACE_H
+#define UDPENDPOINTTABLE_INTERFACE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include "udpEndpointTable.h"
+
+
+ /*
+ ********************************************************************
+ * Table declarations
+ */
+
+ /*
+ * PUBLIC interface initialization routine
+ */
+ void
+ _udpEndpointTable_initialize_interface
+ (udpEndpointTable_registration * user_ctx, u_long flags);
+ void
+ _udpEndpointTable_shutdown_interface(udpEndpointTable_registration
+ * user_ctx);
+
+ udpEndpointTable_registration *udpEndpointTable_registration_get(void);
+
+ udpEndpointTable_registration
+ * udpEndpointTable_registration_set(udpEndpointTable_registration *
+ newreg);
+
+ netsnmp_container *udpEndpointTable_container_get(void);
+ int udpEndpointTable_container_size(void);
+
+ udpEndpointTable_rowreq_ctx
+ * udpEndpointTable_allocate_rowreq_ctx(void);
+ void
+ udpEndpointTable_release_rowreq_ctx(udpEndpointTable_rowreq_ctx *
+ rowreq_ctx);
+
+ int udpEndpointTable_index_to_oid(netsnmp_index * oid_idx,
+ udpEndpointTable_mib_index
+ * mib_idx);
+ int udpEndpointTable_index_from_oid(netsnmp_index *
+ oid_idx,
+ udpEndpointTable_mib_index
+ * mib_idx);
+
+ /*
+ * access to certain internals. use with caution!
+ */
+ void udpEndpointTable_valid_columns_set(netsnmp_column_info
+ *vc);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* UDPENDPOINTTABLE_INTERFACE_H */
+/** @} */
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/util_funcs.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/util_funcs.c
new file mode 100644
index 0000000000..43ea442c5a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/util_funcs.c
@@ -0,0 +1,1190 @@
+/*
+ * util_funcs.c
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_IO_H
+#include <io.h>
+#endif
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#include <sys/types.h>
+#ifdef __alpha
+#ifndef _BSD
+#define _BSD
+#define _myBSD
+#endif
+#endif
+#if HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+#ifdef __alpha
+#ifdef _myBSD
+#undef _BSD
+#undef _myBSD
+#endif
+#endif
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include <errno.h>
+#include <signal.h>
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include <ctype.h>
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#if HAVE_BASETSD_H
+#include <basetsd.h>
+#define ssize_t SSIZE_T
+#endif
+#if HAVE_RAISE
+#define alarm raise
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "struct.h"
+#include "util_funcs.h"
+#include "utilities/execute.h"
+
+#if HAVE_LIMITS_H
+#include "limits.h"
+#endif
+#ifdef USING_UCD_SNMP_ERRORMIB_MODULE
+#include "ucd-snmp/errormib.h"
+#else
+#define setPerrorstatus(x) snmp_log_perror(x)
+#endif
+
+
+#ifdef NETSNMP_EXCACHETIME
+static long cachetime;
+#endif
+
+extern int numprocs, numextens;
+
+void
+Exit(int var)
+{
+ snmp_log(LOG_ERR, "Server Exiting with code %d\n", var);
+ exit(var);
+}
+
+/** deprecated, use netsnmp_mktemp instead */
+const char *
+make_tempfile(void)
+{
+ static char name[32];
+ int fd = -1;
+
+ strcpy(name, get_temp_file_pattern());
+#ifdef HAVE_MKSTEMP
+ fd = mkstemp(name);
+#else
+ if (mktemp(name)) {
+# ifndef WIN32
+ fd = open(name, O_CREAT | O_EXCL | O_WRONLY);
+# else
+ /*
+ Win32 needs _S_IREAD | _S_IWRITE to set permissions on file after closing
+ */
+ fd = _open(name, _O_CREAT, _S_IREAD | _S_IWRITE | _O_EXCL | _O_WRONLY);
+# endif
+ }
+#endif
+ if (fd >= 0) {
+ close(fd);
+ DEBUGMSGTL(("make_tempfile", "temp file created: %s\n", name));
+ return name;
+ }
+ snmp_log(LOG_ERR,"make_tempfile: error creating file %s\n", name);
+ return NULL;
+}
+
+int
+shell_command(struct extensible *ex)
+{
+#if HAVE_SYSTEM
+ const char *ofname;
+ char shellline[STRMAX];
+ FILE *shellout;
+
+ ofname = make_tempfile();
+ if (ofname == NULL) {
+ ex->output[0] = 0;
+ ex->result = 127;
+ return ex->result;
+ }
+
+ snprintf(shellline, sizeof(shellline), "%s > %s", ex->command, ofname);
+ shellline[ sizeof(shellline)-1 ] = 0;
+ ex->result = system(shellline);
+ ex->result = WEXITSTATUS(ex->result);
+ shellout = fopen(ofname, "r");
+ if (shellout != NULL) {
+ if (fgets(ex->output, sizeof(ex->output), shellout) == NULL) {
+ ex->output[0] = 0;
+ }
+ fclose(shellout);
+ }
+ unlink(ofname);
+#else
+ ex->output[0] = 0;
+ ex->result = 0;
+#endif
+ return (ex->result);
+}
+
+#define MAXOUTPUT 300
+
+int
+exec_command(struct extensible *ex)
+{
+#if defined (HAVE_EXECV) || defined (WIN32)
+ int fd;
+ FILE *file;
+
+ if ((fd = get_exec_output(ex)) != -1) {
+ file = fdopen(fd, "r");
+ if (fgets(ex->output, sizeof(ex->output), file) == NULL) {
+ ex->output[0] = 0;
+ }
+ fclose(file);
+ wait_on_exec(ex);
+ } else
+#endif /* HAVE_EXECV */
+ {
+ ex->output[0] = 0;
+ ex->result = 0;
+ }
+ return (ex->result);
+}
+
+struct extensible *
+get_exten_instance(struct extensible *exten, size_t inst)
+{
+ int i;
+
+ if (exten == NULL)
+ return (NULL);
+ for (i = 1; i != (int) inst && exten != NULL; i++)
+ exten = exten->next;
+ return (exten);
+}
+
+void
+wait_on_exec(struct extensible *ex)
+{
+#if defined(WIN32) && !defined (mingw32)
+ int rc;
+ if (ex->tid != 0 && ex->pid != 0) {
+ HANDLE hThread = (HANDLE) ex->tid;
+ HANDLE hProcess = (HANDLE) ex->pid;
+ rc = WaitForSingleObject(hProcess, NETSNMP_TIMEOUT_WAITFORSINGLEOBJECT);
+ DEBUGMSGT(("exec:wait_on_exec","WaitForSingleObject rc=(%d)\n",rc ));
+ rc = CloseHandle( hThread );
+ DEBUGMSGT(("exec:wait_on_exec","CloseHandle hThread=(%d)\n",rc ));
+ rc = CloseHandle( hProcess );
+ DEBUGMSGT(("exec:wait_on_exec","CloseHandle hProcess=(%d)\n",rc ));
+ ex->pid = 0;
+ ex->tid = 0;
+ }
+#else
+#ifndef NETSNMP_EXCACHETIME
+ if (ex->pid && waitpid(ex->pid, &ex->result, 0) < 0) {
+ setPerrorstatus("waitpid");
+ }
+ ex->pid = 0;
+#endif /* NETSNMP_EXCACHETIME */
+#endif /* WIN32 */
+}
+
+#define MAXARGS 30
+
+int
+get_exec_output(struct extensible *ex)
+{
+#if HAVE_EXECV
+ char cachefile[STRMAX];
+ char cache[NETSNMP_MAXCACHESIZE];
+ ssize_t cachebytes;
+ int cfd;
+#ifdef NETSNMP_EXCACHETIME
+ long curtime;
+ static char lastcmd[STRMAX];
+ static int lastresult;
+#endif
+
+ DEBUGMSGTL(("exec:get_exec_output","calling %s\n", ex->command));
+
+ sprintf(cachefile, "%s/%s", get_persistent_directory(), NETSNMP_CACHEFILE);
+#ifdef NETSNMP_EXCACHETIME
+ curtime = time(NULL);
+ if (curtime > (cachetime + NETSNMP_EXCACHETIME) ||
+ strcmp(ex->command, lastcmd) != 0) {
+ strcpy(lastcmd, ex->command);
+ cachetime = curtime;
+#endif
+
+ cachebytes = NETSNMP_MAXCACHESIZE;
+ ex->result = run_exec_command( ex->command, NULL, cache, &cachebytes );
+
+ unlink(cachefile);
+ /*
+ * XXX Use SNMP_FILEMODE_CLOSED instead of 644?
+ */
+ if ((cfd = open(cachefile, O_WRONLY | O_TRUNC | O_CREAT, 0644)) < 0) {
+ snmp_log(LOG_ERR,"can not create cache file\n");
+ setPerrorstatus(cachefile);
+ cachetime = 0;
+ return -1;
+ }
+ if (cachebytes > 0)
+ write(cfd, (void *) cache, cachebytes);
+ close(cfd);
+#ifdef NETSNMP_EXCACHETIME
+ lastresult = ex->result;
+ } else {
+ ex->result = lastresult;
+ }
+#endif
+ DEBUGMSGTL(("exec:get_exec_output","using cached value\n"));
+ if ((cfd = open(cachefile, O_RDONLY)) < 0) {
+ snmp_log(LOG_ERR,"can not open cache file\n");
+ setPerrorstatus(cachefile);
+ return -1;
+ }
+ return (cfd);
+#else /* !HAVE_EXECV */
+#if defined(WIN32) && !defined(HAVE_EXECV)
+/* MSVC and MinGW. Cygwin already works as it has execv and fork */
+ int fd;
+
+ /* Reference: MS tech note: 190351 */
+ HANDLE hOutputReadTmp, hOutputRead, hOutputWrite = NULL;
+
+ HANDLE hErrorWrite;
+ SECURITY_ATTRIBUTES sa;
+ PROCESS_INFORMATION pi;
+ STARTUPINFO si;
+
+ sa.nLength= sizeof(SECURITY_ATTRIBUTES);
+ sa.lpSecurityDescriptor = NULL;
+ sa.bInheritHandle = TRUE;
+
+ DEBUGMSGTL(("exec:get_exec_output","calling %s\n", ex->command));
+
+ /* Child temporary output pipe with Inheritance on (sa.bInheritHandle is true) */
+ if (!CreatePipe(&hOutputReadTmp,&hOutputWrite,&sa,0)) {
+ DEBUGMSGTL(("util_funcs", "get_exec_pipes CreatePipe ChildOut: %d\n",
+ GetLastError()));
+ return -1;
+ }
+
+ /* Copy the stdout handle to the stderr handle in case the child closes one of
+ * its stdout handles. */
+ if (!DuplicateHandle(GetCurrentProcess(),hOutputWrite, GetCurrentProcess(),
+ &hErrorWrite,0, TRUE,DUPLICATE_SAME_ACCESS)) {
+ DEBUGMSGTL(("util_funcs", "get_exec_output DuplicateHandle: %d\n", GetLastError()));
+ return -1;
+ }
+
+ /* Create new copies of the input and output handles but set bInheritHandle to
+ * FALSE so the new handle can not be inherited. Otherwise the handles can not
+ * be closed. */
+ if (!DuplicateHandle(GetCurrentProcess(), hOutputReadTmp, GetCurrentProcess(),
+ &hOutputRead, 0, FALSE, DUPLICATE_SAME_ACCESS)) {
+ DEBUGMSGTL(("util_funcs", "get_exec_output DupliateHandle ChildOut: %d\n", GetLastError()));
+ CloseHandle(hErrorWrite);
+ return -1;
+ }
+
+ /* Close the temporary output and input handles */
+ if (!CloseHandle(hOutputReadTmp)) {
+ DEBUGMSGTL(("util_funcs", "get_exec_output CloseHandle (hOutputReadTmp): %d\n", GetLastError()));
+ CloseHandle(hErrorWrite);
+ CloseHandle(hOutputRead);
+ return -1;
+ }
+
+ /* Associates a C run-time file descriptor with an existing operating-system file handle. */
+ fd = _open_osfhandle((long) hOutputRead, 0);
+
+ /* Set up STARTUPINFO for CreateProcess with the handles and have it hide the window
+ * for the new process. */
+ ZeroMemory(&si,sizeof(STARTUPINFO));
+ si.cb = sizeof(STARTUPINFO);
+ si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
+ si.hStdOutput = hOutputWrite;
+ si.hStdError = hErrorWrite;
+ si.wShowWindow = SW_HIDE;
+
+ /* Launch the process that you want to redirect. Example snmpd.conf pass_persist:
+ * pass_persist .1.3.6.1.4.1.2021.255 c:/perl/bin/perl c:/temp/pass_persisttest
+ */
+ if (!CreateProcess(NULL, ex->command, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi)) {
+ DEBUGMSGTL(("util_funcs","get_exec_output CreateProcess:'%s' %d\n",ex->command, GetLastError()));
+ CloseHandle(hErrorWrite);
+ CloseHandle(hOutputRead);
+ return -1;
+ }
+
+ /* Set global child process handle */
+ ex->pid = (int)pi.hProcess;
+ ex->tid = (int)pi.hThread;
+
+ /* Close pipe handles to make sure that no handles to the write end of the
+ * output pipe are maintained in this process or else the pipe will
+ * not close when the child process exits and any calls to ReadFile
+ * will hang.
+ */
+
+ if (!CloseHandle(hOutputWrite)){
+ DEBUGMSGTL(("util_funcs","get_exec_output CloseHandle hOutputWrite: %d\n",ex->command, GetLastError()));
+ return -1;
+ }
+ if (!CloseHandle(hErrorWrite)) {
+ DEBUGMSGTL(("util_funcs","get_exec_output CloseHandle hErrorWrite: %d\n",ex->command, GetLastError()));
+ return -1;
+ }
+ return fd;
+#endif /* WIN32 */
+ return -1;
+#endif
+}
+int
+get_exec_pipes(char *cmd, int *fdIn, int *fdOut, int *pid)
+{
+/* Alexander Prömel, alexander@proemel.de 08/24/2006
+ The following code, is tested on picotux rev. 1.01.
+ I think, it will be better to put the named pipes, into /var/run or make it selectable via CONFIG file.
+ If the pipe file already exist, the creation will fail.
+ I put the pipes into /flash, the pipepath has to change in ucd-snmp/pass_persist.c too, if you change it here.
+*/
+#if HAVE_EXECV
+#ifdef __uClinux__ /* HAVE uClinux */
+ int in,out;
+ char fifo_in_path[256];
+ char fifo_out_path[256];
+ pid_t tpid;
+
+ if ((tpid = vfork()) == 0) { /*temp child*/
+ execve(cmd, NULL,NULL);
+ perror(cmd);
+ exit(1);
+ } else {
+ if(tpid > 0) {
+ /*initialize workspace*/
+ snprintf(fifo_in_path, 256, "/flash/cp_%d", tpid);
+ snprintf(fifo_out_path, 256, "/flash/pc_%d", tpid);
+
+ in = mkfifo(fifo_in_path, S_IRWXU); /*Create Input Pipe, 700*/
+ if ( in ) {
+ perror("parent: inpipe");
+ exit(0);
+ }
+ out = mkfifo(fifo_out_path, S_IRWXU); /*Create Output Pipe, 700*/
+ if ( out ) {
+ perror("parent: outpipe");
+ exit(0);
+ }
+
+ in = open(fifo_in_path,O_RDONLY); /*open the Input Pipe read Only*/
+ if(in < 0) {
+ perror("parent: input");
+ exit(0);
+ }
+ out = open(fifo_out_path,O_WRONLY); /*open the Output Pipe write Only*/
+ if(out < 0) {
+ perror("parent: output");
+ exit(0);
+ }
+
+ *fdIn = in; /*read*/
+ *fdOut = out; /*write*/
+ *pid = tpid;
+ return (1); /* We are returning 0 for error... */
+ } else { /*pid < 0*/
+ setPerrorstatus("vfork");
+ return 0;
+ }
+
+ }
+#else /*HAVE x86*/
+ int fd[2][2], i, cnt;
+ char ctmp[STRMAX], *cptr1, *cptr2, argvs[STRMAX], **argv,
+ **aptr;
+ /*
+ * Setup our pipes
+ */
+ if (pipe(fd[0]) || pipe(fd[1])) {
+ setPerrorstatus("pipe");
+ return 0;
+ }
+ if ((*pid = fork()) == 0) { /* First handle for the child */
+ close(0);
+ if (dup(fd[0][0]) != 0) {
+ setPerrorstatus("dup 0");
+ return 0;
+ }
+ close(1);
+ if (dup(fd[1][1]) != 1) {
+ setPerrorstatus("dup 1");
+ return 0;
+ }
+
+ /*
+ * write standard output and standard error to pipe.
+ */
+ /*
+ * close all non-standard open file descriptors
+ */
+ for (cnt = getdtablesize() - 1; cnt >= 2; --cnt)
+ (void) close(cnt);
+ (void) dup(1); /* stderr */
+
+ for (cnt = 1, cptr1 = cmd, cptr2 = argvs; *cptr1 != 0;
+ cptr2++, cptr1++) {
+ *cptr2 = *cptr1;
+ if (*cptr1 == ' ') {
+ *(cptr2++) = 0;
+ if ((cptr1 = skip_white(cptr1)) == NULL)
+ break;
+ *cptr2 = *cptr1;
+ if (*cptr1 != 0)
+ cnt++;
+ }
+ }
+ *cptr2 = 0;
+ *(cptr2 + 1) = 0;
+ argv = (char **) malloc((cnt + 2) * sizeof(char *));
+ if (argv == NULL)
+ return 0; /* memory alloc error */
+ aptr = argv;
+ *(aptr++) = argvs;
+ for (cptr2 = argvs, i = 1; i != cnt; cptr2++)
+ if (*cptr2 == 0) {
+ *(aptr++) = cptr2 + 1;
+ i++;
+ }
+ while (*cptr2 != 0)
+ cptr2++;
+ *(aptr++) = NULL;
+ copy_nword(cmd, ctmp, sizeof(ctmp));
+ execv(ctmp, argv);
+ perror(ctmp);
+ exit(1);
+ } else {
+ close(fd[0][0]);
+ close(fd[1][1]);
+ if (*pid < 0) {
+ close(fd[0][1]);
+ close(fd[1][0]);
+ setPerrorstatus("fork");
+ return 0;
+ }
+ *fdIn = fd[1][0];
+ *fdOut = fd[0][1];
+ return (1); /* We are returning 0 for error... */
+ }
+#endif /* uClinux or x86 */
+#endif /* !HAVE_EXECV */
+#if defined(WIN32) && !defined (mingw32) && !defined(HAVE_EXECV)
+/* MSVC (MinGW not working but should use this code). Cygwin already works as it has execv and fork */
+ /* Reference: MS tech note: 190351 */
+ HANDLE hInputWriteTmp, hInputRead, hInputWrite = NULL;
+ HANDLE hOutputReadTmp, hOutputRead, hOutputWrite = NULL;
+
+ HANDLE hErrorWrite;
+ SECURITY_ATTRIBUTES sa;
+ PROCESS_INFORMATION pi;
+ STARTUPINFO si;
+
+ sa.nLength= sizeof(SECURITY_ATTRIBUTES);
+ sa.lpSecurityDescriptor = NULL;
+ sa.bInheritHandle = TRUE;
+
+ /* Child temporary output pipe with Inheritance on (sa.bInheritHandle is true) */
+ if (!CreatePipe(&hOutputReadTmp,&hOutputWrite,&sa,0)) {
+ DEBUGMSGTL(("util_funcs", "get_exec_pipes CreatePipe ChildOut: %d\n",
+ GetLastError()));
+ return 0;
+ }
+ /* Child temporary input pipe with Inheritance on (sa.bInheritHandle is true) */
+ if (!CreatePipe(&hInputRead,&hInputWriteTmp,&sa,0)) {
+ DEBUGMSGTL(("util_funcs", "get_exec_pipes CreatePipe ChildIn: %d\n", GetLastError()));
+ return 0;
+ }
+
+ /* Copy the stdout handle to the stderr handle in case the child closes one of
+ * its stdout handles. */
+ if (!DuplicateHandle(GetCurrentProcess(),hOutputWrite, GetCurrentProcess(),
+ &hErrorWrite,0, TRUE,DUPLICATE_SAME_ACCESS)) {
+ DEBUGMSGTL(("util_funcs", "get_exec_pipes DuplicateHandle: %d\n", GetLastError()));
+ return 0;
+ }
+
+ /* Create new copies of the input and output handles but set bInheritHandle to
+ * FALSE so the new handle can not be inherited. Otherwise the handles can not
+ * be closed. */
+ if (!DuplicateHandle(GetCurrentProcess(), hOutputReadTmp, GetCurrentProcess(),
+ &hOutputRead, 0, FALSE, DUPLICATE_SAME_ACCESS)) {
+ DEBUGMSGTL(("util_funcs", "get_exec_pipes DupliateHandle ChildOut: %d\n", GetLastError()));
+ CloseHandle(hErrorWrite);
+ return 0;
+ }
+ if (!DuplicateHandle(GetCurrentProcess(),hInputWriteTmp,
+ GetCurrentProcess(), &hInputWrite, 0, FALSE, DUPLICATE_SAME_ACCESS)) {
+ DEBUGMSGTL(("util_funcs","get_exec_pipes DupliateHandle ChildIn: %d\n", GetLastError()));
+ CloseHandle(hErrorWrite);
+ CloseHandle(hOutputRead);
+ return 0;
+ }
+
+ /* Close the temporary output and input handles */
+ if (!CloseHandle(hOutputReadTmp)) {
+ DEBUGMSGTL(("util_funcs", "get_exec_pipes CloseHandle (hOutputReadTmp): %d\n", GetLastError()));
+ CloseHandle(hErrorWrite);
+ CloseHandle(hOutputRead);
+ CloseHandle(hInputWrite);
+ return 0;
+ }
+ if (!CloseHandle(hInputWriteTmp)) {
+ DEBUGMSGTL(("util_funcs", "get_exec_pipes CloseHandle (hInputWriteTmp): %d\n", GetLastError()));
+ CloseHandle(hErrorWrite);
+ CloseHandle(hOutputRead);
+ CloseHandle(hInputWrite);
+ return 0;
+ }
+
+ /* Associates a C run-time file descriptor with an existing operating-system file handle. */
+ *fdIn = _open_osfhandle((long) hOutputRead, 0);
+ *fdOut = _open_osfhandle((long) hInputWrite, 0);
+
+ /* Set up STARTUPINFO for CreateProcess with the handles and have it hide the window
+ * for the new process. */
+ ZeroMemory(&si,sizeof(STARTUPINFO));
+ si.cb = sizeof(STARTUPINFO);
+ si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
+ si.hStdOutput = hOutputWrite;
+ si.hStdInput = hInputRead;
+ si.hStdError = hErrorWrite;
+ si.wShowWindow = SW_HIDE;
+
+ /* Launch the process that you want to redirect. Example snmpd.conf pass_persist:
+ * pass_persist .1.3.6.1.4.1.2021.255 c:/perl/bin/perl c:/temp/pass_persisttest
+ */
+ if (!CreateProcess(NULL, cmd, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi)) {
+ DEBUGMSGTL(("util_funcs","get_exec_pipes CreateProcess:'%s' %d\n",cmd, GetLastError()));
+ CloseHandle(hErrorWrite);
+ CloseHandle(hOutputRead);
+ CloseHandle(hInputWrite);
+ return 0;
+ }
+
+ /* Set global child process handle */
+ *pid = (int)pi.hProcess;
+
+ /* Close pipe handles to make sure that no handles to the write end of the
+ * output pipe are maintained in this process or else the pipe will
+ * not close when the child process exits and any calls to ReadFile
+ * will hang.
+ */
+
+ if (!CloseHandle(hOutputWrite)){
+ DEBUGMSGTL(("util_funcs","get_exec_pipes CloseHandle hOutputWrite: %d\n",cmd, GetLastError()));
+ return 0;
+ }
+ if (!CloseHandle(hInputRead)) {
+ DEBUGMSGTL(("util_funcs","get_exec_pipes CloseHandle hInputRead: %d\n",cmd, GetLastError()));
+ return 0;
+ }
+ if (!CloseHandle(hErrorWrite)) {
+ DEBUGMSGTL(("util_funcs","get_exec_pipes CloseHandle hErrorWrite: %d\n",cmd, GetLastError()));
+ return 0;
+ }
+ return 1;
+#endif /* WIN32 */
+ return 0;
+}
+
+int
+clear_cache(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+
+ long tmp = 0;
+
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_NOTICE, "Wrong type != int\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ tmp = *((long *) var_val);
+ if (tmp == 1 && action == COMMIT) {
+#ifdef NETSNMP_EXCACHETIME
+ cachetime = 0; /* reset the cache next read */
+#endif
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+char **argvrestartp, *argvrestartname, *argvrestart;
+
+RETSIGTYPE
+restart_doit(int a)
+{
+ char * name = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_APPTYPE);
+ snmp_shutdown(name);
+
+ /* This signal handler may run with SIGALARM blocked.
+ * Since the signal mask is preserved accross execv(), we must
+ * make sure that SIGALARM is unblocked prior of execv'ing.
+ * Otherwise SIGALARM will be ignored in the next incarnation
+ * of snmpd, because the signal is blocked. And thus, the
+ * restart doesn't work anymore.
+ */
+#if HAVE_SIGBLOCK
+ sigsetmask(0);
+#endif
+
+ /*
+ * do the exec
+ */
+#if HAVE_EXECV
+ execv(argvrestartname, argvrestartp);
+ setPerrorstatus(argvrestartname);
+#endif
+}
+
+int
+restart_hook(int action,
+ u_char * var_val,
+ u_char var_val_type,
+ size_t var_val_len,
+ u_char * statP, oid * name, size_t name_len)
+{
+
+ long tmp = 0;
+
+ if (var_val_type != ASN_INTEGER) {
+ snmp_log(LOG_NOTICE, "Wrong type != int\n");
+ return SNMP_ERR_WRONGTYPE;
+ }
+ tmp = *((long *) var_val);
+ if (tmp == 1 && action == COMMIT) {
+#ifdef SIGALRM
+ signal(SIGALRM, restart_doit);
+#endif
+ alarm(NETSNMP_RESTARTSLEEP);
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+void
+print_mib_oid(oid name[], size_t len)
+{
+ char *buffer;
+ buffer = (char *) malloc(11 * len); /* maximum digit lengths for int32 + a '.' */
+ if (!buffer) {
+ snmp_log(LOG_ERR, "Malloc failed - out of memory?");
+ return;
+ }
+ sprint_mib_oid(buffer, name, len);
+ snmp_log(LOG_NOTICE, "Mib: %s\n", buffer);
+ free(buffer);
+}
+
+void
+sprint_mib_oid(char *buf, oid name[], size_t len)
+{
+ int i;
+ for (i = 0; i < (int) len; i++) {
+ sprintf(buf, ".%d", (int) name[i]);
+ while (*buf != 0)
+ buf++;
+ }
+}
+
+/*******************************************************************-o-******
+ * header_simple_table
+ *
+ * Parameters:
+ * *vp Variable data.
+ * *name Fully instantiated OID name.
+ * *length Length of name.
+ * exact TRUE if an exact match is desired.
+ * *var_len Hook for size of returned data type.
+ * (**write_method) Hook for write method (UNUSED).
+ * max
+ *
+ * Returns:
+ * 0 If name matches vp->name (accounting for 'exact') and is
+ * not greater in length than 'max'.
+ * 1 Otherwise.
+ *
+ *
+ * Compare 'name' to vp->name for the best match or an exact match (if
+ * requested). Also check that 'name' is not longer than 'max' if
+ * max is greater-than/equal 0.
+ * Store a successful match in 'name', and increment the OID instance if
+ * the match was not exact.
+ *
+ * 'name' and 'length' are undefined upon failure.
+ *
+ */
+int
+header_simple_table(struct variable *vp, oid * name, size_t * length,
+ int exact, size_t * var_len,
+ WriteMethod ** write_method, int max)
+{
+ int i, rtest; /* Set to: -1 If name < vp->name,
+ * 1 If name > vp->name,
+ * 0 Otherwise.
+ */
+ oid newname[MAX_OID_LEN];
+
+ for (i = 0, rtest = 0;
+ i < (int) vp->namelen && i < (int) (*length) && !rtest; i++) {
+ if (name[i] != vp->name[i]) {
+ if (name[i] < vp->name[i])
+ rtest = -1;
+ else
+ rtest = 1;
+ }
+ }
+ if (rtest > 0 ||
+ (exact == 1
+ && (rtest || (int) *length != (int) (vp->namelen + 1)))) {
+ if (var_len)
+ *var_len = 0;
+ return MATCH_FAILED;
+ }
+
+ memset(newname, 0, sizeof(newname));
+
+ if (((int) *length) <= (int) vp->namelen || rtest == -1) {
+ memmove(newname, vp->name, (int) vp->namelen * sizeof(oid));
+ newname[vp->namelen] = 1;
+ *length = vp->namelen + 1;
+ } else if (((int) *length) > (int) vp->namelen + 1) { /* exact case checked earlier */
+ *length = vp->namelen + 1;
+ memmove(newname, name, (*length) * sizeof(oid));
+ if (name[*length - 1] < ULONG_MAX) {
+ newname[*length - 1] = name[*length - 1] + 1;
+ } else {
+ /*
+ * Careful not to overflow...
+ */
+ newname[*length - 1] = name[*length - 1];
+ }
+ } else {
+ *length = vp->namelen + 1;
+ memmove(newname, name, (*length) * sizeof(oid));
+ if (!exact) {
+ if (name[*length - 1] < ULONG_MAX) {
+ newname[*length - 1] = name[*length - 1] + 1;
+ } else {
+ /*
+ * Careful not to overflow...
+ */
+ newname[*length - 1] = name[*length - 1];
+ }
+ } else {
+ newname[*length - 1] = name[*length - 1];
+ }
+ }
+ if ((max >= 0 && ((int)newname[*length - 1] > max)) ||
+ ( 0 == newname[*length - 1] )) {
+ if (var_len)
+ *var_len = 0;
+ return MATCH_FAILED;
+ }
+
+ memmove(name, newname, (*length) * sizeof(oid));
+ if (write_method)
+ *write_method = 0;
+ if (var_len)
+ *var_len = sizeof(long); /* default */
+ return (MATCH_SUCCEEDED);
+}
+
+/*
+ * header_generic(...
+ * Arguments:
+ * vp IN - pointer to variable entry that points here
+ * name IN/OUT - IN/name requested, OUT/name found
+ * length IN/OUT - length of IN/OUT oid's
+ * exact IN - TRUE if an exact match was requested
+ * var_len OUT - length of variable or 0 if function returned
+ * write_method
+ *
+ */
+
+/*******************************************************************-o-******
+ * generic_header
+ *
+ * Parameters:
+ * *vp (I) Pointer to variable entry that points here.
+ * *name (I/O) Input name requested, output name found.
+ * *length (I/O) Length of input and output oid's.
+ * exact (I) TRUE if an exact match was requested.
+ * *var_len (O) Length of variable or 0 if function returned.
+ * (**write_method) Hook to name a write method (UNUSED).
+ *
+ * Returns:
+ * MATCH_SUCCEEDED If vp->name matches name (accounting for exact bit).
+ * MATCH_FAILED Otherwise,
+ *
+ *
+ * Check whether variable (vp) matches name.
+ */
+int
+header_generic(struct variable *vp,
+ oid * name,
+ size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method)
+{
+ oid newname[MAX_OID_LEN];
+ int result;
+
+ DEBUGMSGTL(("util_funcs", "header_generic: "));
+ DEBUGMSGOID(("util_funcs", name, *length));
+ DEBUGMSG(("util_funcs", " exact=%d\n", exact));
+
+ memcpy((char *) newname, (char *) vp->name,
+ (int) vp->namelen * sizeof(oid));
+ newname[vp->namelen] = 0;
+ result = snmp_oid_compare(name, *length, newname, vp->namelen + 1);
+ DEBUGMSGTL(("util_funcs", " result: %d\n", result));
+ if ((exact && (result != 0)) || (!exact && (result >= 0)))
+ return (MATCH_FAILED);
+ memcpy((char *) name, (char *) newname,
+ ((int) vp->namelen + 1) * sizeof(oid));
+ *length = vp->namelen + 1;
+
+ *write_method = 0;
+ *var_len = sizeof(long); /* default to 'long' results */
+ return (MATCH_SUCCEEDED);
+}
+
+/*
+ * checkmib(): provided for backwards compatibility, do not use:
+ */
+int
+checkmib(struct variable *vp, oid * name, size_t * length,
+ int exact, size_t * var_len, WriteMethod ** write_method, int max)
+{
+ /*
+ * checkmib used to be header_simple_table, with reveresed boolean
+ * return output. header_simple_table() was created to match
+ * header_generic().
+ */
+ return (!header_simple_table(vp, name, length, exact, var_len,
+ write_method, max));
+}
+
+char *
+find_field(char *ptr, int field)
+{
+ int i;
+ char *init = ptr;
+
+ if (field == NETSNMP_LASTFIELD) {
+ /*
+ * skip to end
+ */
+ while (*ptr++);
+ ptr = ptr - 2;
+ /*
+ * rewind a field length
+ */
+ while (*ptr != 0 && isspace(*ptr) && init <= ptr)
+ ptr--;
+ while (*ptr != 0 && !isspace(*ptr) && init <= ptr)
+ ptr--;
+ if (isspace(*ptr))
+ ptr++; /* past space */
+ if (ptr < init)
+ ptr = init;
+ if (!isspace(*ptr) && *ptr != 0)
+ return (ptr);
+ } else {
+ if ((ptr = skip_white(ptr)) == NULL)
+ return (NULL);
+ for (i = 1; *ptr != 0 && i != field; i++) {
+ if ((ptr = skip_not_white(ptr)) == NULL)
+ return (NULL);
+ if ((ptr = skip_white(ptr)) == NULL)
+ return (NULL);
+ }
+ if (*ptr != 0 && i == field)
+ return (ptr);
+ return (NULL);
+ }
+ return (NULL);
+}
+
+int
+parse_miboid(const char *buf, oid * oidout)
+{
+ int i;
+
+ if (!buf)
+ return 0;
+ if (*buf == '.')
+ buf++;
+ for (i = 0; isdigit(*buf); i++) {
+ oidout[i] = atoi(buf);
+ while (isdigit(*buf++));
+ if (*buf == '.')
+ buf++;
+ }
+ /*
+ * oidout[i] = -1; hmmm
+ */
+ return i;
+}
+
+void
+string_append_int(char *s, int val)
+{
+ char textVal[16];
+
+ if (val < 10) {
+ *s++ = '0' + val;
+ *s = '\0';
+ return;
+ }
+ sprintf(textVal, "%d", val);
+ strcpy(s, textVal);
+ return;
+}
+
+struct internal_mib_table {
+ int max_size; /* Size of the current data table */
+ int next_index; /* Index of the next free entry */
+ int current_index; /* Index of the 'current' entry */
+ int cache_timeout;
+ marker_t cache_marker;
+ RELOAD *reload; /* Routine to read in the data */
+ COMPARE *compare; /* Routine to compare two entries */
+ int data_size; /* Size of an individual entry */
+ void *data; /* The table itself */
+};
+
+mib_table_t
+Initialise_Table(int size, int timeout, RELOAD *reload, COMPARE *compare)
+{
+ struct internal_mib_table *t;
+
+ t = (struct internal_mib_table *)
+ malloc(sizeof(struct internal_mib_table));
+ if (t == NULL)
+ return NULL;
+
+ t->max_size = 0;
+ t->next_index = 1; /* Don't use index 0 */
+ t->current_index = 1;
+ t->cache_timeout = timeout;
+ t->cache_marker = NULL;
+ t->reload = reload;
+ t->compare = compare;
+ t->data_size = size;
+ t->data = NULL;
+
+ return (mib_table_t) t;
+}
+
+#define TABLE_ADD( x, y ) ((void*)((char*)(x) + y))
+#define TABLE_INDEX(t, i) (TABLE_ADD(t->data, i * t->data_size))
+#define TABLE_START(t) (TABLE_INDEX(t, 1))
+#define TABLE_NEXT(t) (TABLE_INDEX(t, t->next_index))
+#define TABLE_CURRENT(t) (TABLE_INDEX(t, t->current_index))
+
+int
+check_and_reload_table(struct internal_mib_table *table)
+{
+ /*
+ * If the saved data is fairly recent,
+ * we don't need to reload it
+ */
+ if (table->cache_marker &&
+ !(atime_ready(table->cache_marker, table->cache_timeout * 1000)))
+ return 1;
+
+
+ /*
+ * Call the routine provided to read in the data
+ *
+ * N.B: Update the cache marker *before* calling
+ * this routine, to avoid problems with recursion
+ */
+ if (!table->cache_marker)
+ table->cache_marker = atime_newMarker();
+ else
+ atime_setMarker(table->cache_marker);
+
+ table->next_index = 1;
+ if (table->reload((mib_table_t) table) < 0) {
+ free(table->cache_marker);
+ table->cache_marker = NULL;
+ return 0;
+ }
+ table->current_index = 1;
+ if (table->compare != NULL) /* Sort the table */
+ qsort(TABLE_START(table), table->next_index-1,
+ table->data_size, table->compare);
+ return 1;
+}
+
+int
+Search_Table(mib_table_t t, void *entry, int exact)
+{
+ struct internal_mib_table *table = (struct internal_mib_table *) t;
+ void *entry2;
+ int res;
+
+ if (!check_and_reload_table(table))
+ return -1;
+
+ if (table->compare == NULL) {
+ /*
+ * XXX - not sure this is right ?
+ */
+ memcpy(entry, table->data, table->data_size);
+ return 0;
+ }
+
+ if (table->next_index == table->current_index)
+ table->current_index = 1;
+
+ entry2 = TABLE_CURRENT(table);
+ res = table->compare(entry, entry2);
+ if ((res < 0) && (table->current_index != 1)) {
+ table->current_index = 1;
+ entry2 = TABLE_CURRENT(table);
+ res = table->compare(entry, entry2);
+ }
+
+ while (res > 0) {
+ table->current_index++;
+ if (table->next_index == table->current_index)
+ return -1;
+ entry2 = TABLE_CURRENT(table);
+ res = table->compare(entry, entry2);
+ }
+
+ if (exact && res != 0)
+ return -1;
+
+ if (!exact && res == 0) {
+ table->current_index++;
+ if (table->next_index == table->current_index)
+ return -1;
+ entry2 = TABLE_CURRENT(table);
+ }
+ memcpy(entry, entry2, table->data_size);
+ return 0;
+}
+
+int
+Add_Entry(mib_table_t t, void *entry)
+{
+ struct internal_mib_table *table = (struct internal_mib_table *) t;
+ int new_max;
+ void *new_data; /* Used for
+ * a) extending the data table
+ * b) the next entry to use
+ */
+
+ if (table->max_size <= table->next_index) {
+ /*
+ * Table is full, so extend it to double the size
+ */
+ new_max = 2 * table->max_size;
+ if (new_max == 0)
+ new_max = 10; /* Start with 10 entries */
+
+ new_data = (void *) malloc(new_max * table->data_size);
+ if (new_data == NULL)
+ return -1;
+
+ if (table->data) {
+ memcpy(new_data, table->data,
+ table->max_size * table->data_size);
+ free(table->data);
+ }
+ table->data = new_data;
+ table->max_size = new_max;
+ }
+
+ /*
+ * Insert the new entry into the data array
+ */
+ new_data = TABLE_NEXT(table);
+ memcpy(new_data, entry, table->data_size);
+ table->next_index++;
+ return 0;
+}
+
+void *
+Retrieve_Table_Data(mib_table_t t, int *max_idx)
+{
+ struct internal_mib_table *table = (struct internal_mib_table *) t;
+
+ if (!check_and_reload_table(table))
+ return NULL;
+ *max_idx = table->next_index - 1;
+ return table->data;
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/util_funcs.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/util_funcs.h
new file mode 100644
index 0000000000..1b3fefe1f7
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/util_funcs.h
@@ -0,0 +1,55 @@
+/*
+ * util_funcs.h: utilitiy functions for extensible groups.
+ */
+#ifndef _MIBGROUP_UTIL_FUNCS_H
+#define _MIBGROUP_UTIL_FUNCS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "struct.h"
+
+void Exit(int);
+int shell_command(struct extensible *);
+int exec_command(struct extensible *);
+struct extensible *get_exten_instance(struct extensible *, size_t);
+int get_exec_output(struct extensible *);
+int get_exec_pipes(char *cmd, int *fdIn, int *fdOut, int *pid);
+WriteMethod clear_cache;
+RETSIGTYPE restart_doit(int);
+WriteMethod restart_hook;
+void print_mib_oid(oid *, size_t);
+void sprint_mib_oid(char *, oid *, size_t);
+int header_simple_table(struct variable *, oid *, size_t *,
+ int, size_t *,
+ WriteMethod ** write_method, int);
+int header_generic(struct variable *, oid *, size_t *, int,
+ size_t *, WriteMethod **);
+int checkmib(struct variable *, oid *, size_t *, int, size_t *,
+ WriteMethod ** write_method, int);
+char *find_field(char *, int);
+int parse_miboid(const char *, oid *);
+void string_append_int(char *, int);
+void wait_on_exec(struct extensible *);
+const char *make_tempfile(void);
+
+#define satosin(x) ((struct sockaddr_in *) &(x))
+#define SOCKADDR(x) (satosin(x)->sin_addr.s_addr)
+#ifndef MIB_STATS_CACHE_TIMEOUT
+#define MIB_STATS_CACHE_TIMEOUT 5
+#endif
+
+typedef void *mib_table_t;
+typedef int (RELOAD) (mib_table_t);
+typedef int (COMPARE) (const void *, const void *);
+mib_table_t Initialise_Table(int, int, RELOAD*, COMPARE*);
+int Search_Table(mib_table_t, void *, int);
+int Add_Entry(mib_table_t, void *);
+void *Retrieve_Table_Data(mib_table_t, int *);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MIBGROUP_UTIL_FUNCS_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities.h
new file mode 100644
index 0000000000..ffb9240f17
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities.h
@@ -0,0 +1,3 @@
+config_require(utilities/override)
+config_require(utilities/execute)
+config_require(utilities/iquery)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/execute.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/execute.c
new file mode 100644
index 0000000000..59ffaa9dae
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/execute.c
@@ -0,0 +1,456 @@
+/*
+ * Utility routines to assist with the running of sub-commands
+ */
+
+#include <net-snmp/net-snmp-config.h>
+
+#if HAVE_IO_H
+#include <io.h>
+#endif
+#include <stdio.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#include <sys/types.h>
+#include <ctype.h>
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#if HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#if HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+
+#include <errno.h>
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+#include <ucd-snmp/errormib.h>
+
+#include "util_funcs.h"
+
+#define setPerrorstatus(x) snmp_log_perror(x)
+
+int
+run_shell_command( char *command, char *input,
+ char *output, int *out_len) /* Or realloc style ? */
+{
+#if HAVE_SYSTEM
+ const char *ifname; /* Filename for input redirection */
+ const char *ofname; /* Filename for output redirection */
+ char shellline[STRMAX]; /* The full command to run */
+ int result; /* and the return value of the command */
+
+ if (!command)
+ return -1;
+
+ DEBUGMSGTL(("run_shell_command", "running %s\n", command));
+ DEBUGMSGTL(("run:shell", "running '%s'\n", command));
+
+ /*
+ * Set up the command to run....
+ */
+ if (input) {
+ FILE *file;
+
+ ifname = netsnmp_mktemp();
+ if(NULL == ifname)
+ return -1;
+ file = fopen(ifname, "w");
+ if(NULL == file) {
+ snmp_log(LOG_ERR,"couldn't open temporary file %s\n", ifname);
+ unlink(ifname);
+ return -1;
+ }
+ fprintf(file, "%s", input);
+ fclose( file );
+
+ if (output) {
+ ofname = netsnmp_mktemp();
+ if(NULL == ofname) {
+ if(ifname)
+ unlink(ifname);
+ return -1;
+ }
+ snprintf( shellline, sizeof(shellline), "(%s) < \"%s\" > \"%s\"",
+ command, ifname, ofname );
+ } else {
+ ofname = NULL; /* Just to shut the compiler up! */
+ snprintf( shellline, sizeof(shellline), "(%s) < \"%s\"",
+ command, ifname );
+ }
+ } else {
+ ifname = NULL; /* Just to shut the compiler up! */
+ if (output) {
+ ofname = netsnmp_mktemp();
+ if(NULL == ofname)
+ return -1;
+ snprintf( shellline, sizeof(shellline), "(%s) > \"%s\"",
+ command, ofname );
+ } else {
+ ofname = NULL; /* Just to shut the compiler up! */
+ snprintf( shellline, sizeof(shellline), "%s",
+ command );
+ }
+ }
+
+ /*
+ * ... and run it
+ */
+ result = system(shellline);
+
+ /*
+ * If output was requested, then retrieve & return it.
+ * Tidy up, and return the result of the command.
+ */
+ if ( output && out_len && (*out_len != 0) ) {
+ int fd; /* For processing any output */
+ int len = 0;
+ fd = open(ofname, O_RDONLY);
+ if(fd >= 0)
+ len = read( fd, output, *out_len-1 );
+ *out_len = len;
+ if (len >= 0) output[len] = 0;
+ else output[0] = 0;
+ if (fd >= 0) close(fd);
+ unlink(ofname);
+ }
+ if ( input ) {
+ unlink(ifname);
+ }
+
+ return result;
+#else
+ return -1;
+#endif
+}
+
+
+/*
+ * Split the given command up into separate tokens,
+ * ready to be passed to 'execv'
+ */
+char **
+tokenize_exec_command( char *command, int *argc )
+{
+ char ctmp[STRMAX];
+ char *cp;
+ char **argv;
+ int i;
+
+ argv = (char **) calloc(100, sizeof(char *));
+ cp = command;
+
+ for ( i=0; cp; i++ ) {
+ memset( ctmp, 0, STRMAX );
+ cp = copy_nword( cp, ctmp, STRMAX );
+ argv[i] = strdup( ctmp );
+ if (i == 99)
+ break;
+ }
+ if (cp) {
+ argv[i++] = strdup( cp );
+ }
+ argv[i] = 0;
+ *argc = i;
+
+ return argv;
+}
+
+char **
+xx_tokenize_exec_command( char *command, int *argc )
+{
+ char ctmp[STRMAX];
+ char *cptr1, *cptr2;
+ char **argv;
+ int count, i;
+
+ if (!command)
+ return NULL;
+
+ memset( ctmp, 0, STRMAX );
+ /*
+ * Make a copy of the command into the 'ctmp' buffer,
+ * splitting it into separate tokens
+ * (but still all in the one buffer).
+ */
+ count = 1;
+ for (cptr1 = command, cptr2 = ctmp;
+ cptr1 && *cptr1;
+ cptr1++, cptr2++) {
+ *cptr2 = *cptr1;
+ if (isspace(*cptr1)) {
+ /*
+ * We've reached the end of a token, so increase
+ * the count, and mark this in the command copy.
+ * Then get ready for the next word.
+ */
+ count++;
+ *cptr2 = 0; /* End of token */
+ cptr1 = skip_white(cptr1);
+ if (!cptr1)
+ break;
+ cptr1--; /* Back up one, ready for the next loop */
+ }
+ }
+
+ /*
+ * Now set up the 'argv' array,
+ * copying tokens out of the 'cptr' buffer
+ */
+ argv = (char **) calloc((count + 2), sizeof(char *));
+ if (argv == NULL)
+ return NULL;
+ cptr2 = ctmp;
+ for (i = 0; i < count; i++) {
+ argv[i] = strdup( cptr2 );
+ cptr2 += strlen( cptr2 )+1;
+ }
+ argv[count] = 0;
+ *argc = count;
+
+ return argv;
+}
+
+
+int
+run_exec_command( char *command, char *input,
+ char *output, int *out_len) /* Or realloc style ? */
+{
+#if HAVE_EXECV
+ int ipipe[2];
+ int opipe[2];
+ int i;
+ int pid;
+ int result;
+ char **argv;
+ int argc;
+
+ DEBUGMSGTL(("run:exec", "running '%s'\n", command));
+ pipe(ipipe);
+ pipe(opipe);
+ if ((pid = fork()) == 0) {
+ /*
+ * Child process
+ */
+
+ /*
+ * Set stdin/out/err to use the pipe
+ * and close everything else
+ */
+ close(0);
+ dup( ipipe[0]);
+ close(ipipe[1]);
+
+ close(1);
+ dup( opipe[1]);
+ close(opipe[0]);
+ close(2);
+ dup(1);
+ for (i = getdtablesize()-1; i>2; i--)
+ close(i);
+
+ /*
+ * Set up the argv array and execute it
+ * This is being run in the child process,
+ * so will release resources when it terminates.
+ */
+ argv = tokenize_exec_command( command, &argc );
+ execv( argv[0], argv );
+ perror( argv[0] );
+ exit(1); /* End of child */
+
+ } else if (pid > 0) {
+ char cache[NETSNMP_MAXCACHESIZE];
+ char *cache_ptr;
+ ssize_t count, cache_size, offset = 0;
+ int waited = 0, numfds;
+ fd_set readfds;
+ struct timeval timeout;
+
+ /*
+ * Parent process
+ */
+
+ /*
+ * Pass the input message (if any) to the child,
+ * wait for the child to finish executing, and read
+ * any output into the output buffer (if provided)
+ */
+ close(ipipe[0]);
+ close(opipe[1]);
+ if (input) {
+ write(ipipe[1], input, strlen(input));
+ close(ipipe[1]); /* or flush? */
+ }
+ else close(ipipe[1]);
+
+ /*
+ * child will block if it writes a lot of data and
+ * fills up the pipe before exiting, so we read data
+ * to keep the pipe empty.
+ */
+ if (output && ((NULL == out_len) || (0 == *out_len))) {
+ DEBUGMSGTL(("run:exec",
+ "invalid params; no output will be returned\n"));
+ output = NULL;
+ }
+ if (output) {
+ cache_ptr = output;
+ cache_size = *out_len - 1;
+ } else {
+ cache_ptr = cache;
+ cache_size = sizeof(cache);
+ }
+
+ /*
+ * xxx: some of this code was lifted from get_exec_output
+ * in util_funcs.c. Probably should be moved to a common
+ * routine for both to use.
+ */
+ DEBUGMSGTL(("verbose:run:exec"," waiting for child %d...\n", pid));
+ numfds = opipe[0] + 1;
+ i = NETSNMP_MAXREADCOUNT;
+ for (; i; --i) {
+ /*
+ * set up data for select
+ */
+ FD_ZERO(&readfds);
+ FD_SET(opipe[0],&readfds);
+ timeout.tv_sec = 1;
+ timeout.tv_usec = 0;
+
+ DEBUGMSGTL(("verbose:run:exec", " calling select\n"));
+ count = select(numfds, &readfds, NULL, NULL, &timeout);
+ if (count == -1) {
+ if (EAGAIN == errno)
+ continue;
+ else {
+ DEBUGMSGTL(("verbose:run:exec", " errno %d\n",
+ errno));
+ setPerrorstatus("read");
+ break;
+ }
+ } else if (0 == count) {
+ DEBUGMSGTL(("verbose:run:exec", " timeout\n"));
+ continue;
+ }
+
+ if (! FD_ISSET(opipe[0], &readfds)) {
+ DEBUGMSGTL(("verbose:run:exec", " fd not ready!\n"));
+ continue;
+ }
+
+ /*
+ * read data from the pipe, optionally saving to output buffer
+ */
+ count = read(opipe[0], &cache_ptr[offset], cache_size);
+ DEBUGMSGTL(("verbose:run:exec",
+ " read %d bytes\n", count));
+ if (0 == count) {
+ int rc;
+ /*
+ * we shouldn't get no data, because select should
+ * wait til the fd is ready. before we go back around,
+ * check to see if the child exited.
+ */
+ DEBUGMSGTL(("verbose:run:exec", " no data!\n"));
+ if ((rc = waitpid(pid, &result, WNOHANG)) <= 0) {
+ if (rc < 0) {
+ snmp_log_perror("waitpid");
+ break;
+ } else
+ DEBUGMSGTL(("verbose:run:exec",
+ " child not done!?!\n"));;
+ } else {
+ DEBUGMSGTL(("verbose:run:exec", " child done\n"));
+ waited = 1; /* don't wait again */
+ break;
+ }
+ }
+ else if (count > 0) {
+ /*
+ * got some data. fix up offset, if needed.
+ */
+ if(output) {
+ offset += count;
+ cache_size -= count;
+ if (cache_size <= 0) {
+ DEBUGMSGTL(("verbose:run:exec",
+ " output full\n"));
+ break;
+ }
+ DEBUGMSGTL(("verbose:run:exec",
+ " %d left in buffer\n", cache_size));
+ }
+ }
+ else if ((count == -1) && (EAGAIN != errno)) {
+ /*
+ * if error, break
+ */
+ DEBUGMSGTL(("verbose:run:exec", " errno %d\n",
+ errno));
+ setPerrorstatus("read");
+ break;
+ }
+ }
+ DEBUGMSGTL(("verbose:run:exec", " done reading\n"));
+ if (output)
+ DEBUGMSGTL(("run:exec", " got %d bytes\n", *out_len));
+
+ /*
+ * close pipe to signal that we aren't listenting any more.
+ */
+ close(opipe[0]);
+
+ /*
+ * if we didn't wait successfully above, wait now.
+ * xxx-rks: seems like this is a waste of the agent's
+ * time. maybe start a time to wait(WNOHANG) once a second,
+ * and late the agent continue?
+ */
+ if ((!waited) && (waitpid(pid, &result, 0) < 0 )) {
+ snmp_log_perror("waitpid");
+ return -1;
+ }
+
+ /*
+ * null terminate any output
+ */
+ if (output) {
+ output[offset] = 0;
+ *out_len = offset;
+ }
+ DEBUGMSGTL(("run:exec"," child %d finished. result=%d\n",
+ pid,result));
+
+ return WEXITSTATUS(result);
+
+ } else {
+ /*
+ * Parent process - fork failed
+ */
+ snmp_log_perror("fork");
+ close(ipipe[0]);
+ close(ipipe[1]);
+ close(opipe[0]);
+ close(opipe[1]);
+ return -1;
+ }
+
+#else
+ /*
+ * If necessary, fall back to using 'system'
+ */
+ DEBUGMSGTL(("run:exec", "running shell command '%s'\n", command));
+ return run_shell_command( command, input, output, out_len );
+#endif
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/execute.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/execute.h
new file mode 100644
index 0000000000..05e827049a
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/execute.h
@@ -0,0 +1,12 @@
+#ifndef _MIBGROUP_EXECUTE_H
+#define _MIBGROUP_EXECUTE_H
+
+config_require(util_funcs)
+config_belongs_in(agent_module)
+
+int run_shell_command(char *command, char *input,
+ char *output, int *out_len);
+int run_exec_command( char *command, char *input,
+ char *output, int *out_len);
+
+#endif /* _MIBGROUP_EXECUTE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/iquery.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/iquery.c
new file mode 100644
index 0000000000..59e33aa748
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/iquery.c
@@ -0,0 +1,201 @@
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "utilities/iquery.h"
+
+void
+netsnmp_parse_iquerySecLevel(const char *token, char *line)
+{
+ char buf[1024];
+ int secLevel;
+
+ if ((secLevel = parse_secLevel_conf( token, line )) >= 0 ) {
+ netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_INTERNAL_SECLEVEL, secLevel);
+ } else {
+ snprintf(buf, sizeof(buf), "Unknown security level: %s", line);
+ buf[ sizeof(buf)-1 ] = 0;
+ config_perror(buf);
+ }
+}
+
+void
+netsnmp_parse_iqueryVersion(const char *token, char *line)
+{
+ char buf[1024];
+
+#ifndef NETSNMP_DISABLE_SNMPV1
+ if (!strcmp( line, "1" ))
+ netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_INTERNAL_VERSION, SNMP_VERSION_1);
+ else
+#endif
+#ifndef NETSNMP_DISABLE_SNMPV2C
+ if (!strcmp( line, "2" ) || !strcasecmp( line, "2c" ))
+ netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_INTERNAL_VERSION, SNMP_VERSION_2c);
+ else
+#endif
+ if (!strcmp( line, "3" ))
+ netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_INTERNAL_VERSION, SNMP_VERSION_3);
+ else {
+ snprintf(buf, sizeof(buf), "Unknown version: %s", line);
+ buf[ sizeof(buf)-1 ] = 0;
+ config_perror(buf);
+ }
+}
+
+ /*
+ * Set up a default session for running internal queries.
+ * This needs to be done before the config files are read,
+ * so that it is available for "monitor" directives...
+ */
+int
+_init_default_iquery_session( int majorID, int minorID,
+ void *serverargs, void *clientarg)
+{
+ char *secName = netsnmp_ds_get_string(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_INTERNAL_SECNAME);
+ if (secName)
+ netsnmp_query_set_default_session(
+ netsnmp_iquery_user_session(secName));
+ return SNMPERR_SUCCESS;
+}
+
+ /*
+ * ... Unfortunately, the internal engine ID is not set up
+ * until later, so this default session is incomplete.
+ * The resulting engineID probe runs into problems,
+ * causing the very first internal query to time out.
+ * Updating the default session with the internal engineID
+ * once it has been set, fixes this problem.
+ */
+int
+_tweak_default_iquery_session( int majorID, int minorID,
+ void *serverargs, void *clientarg)
+{
+ u_char eID[SNMP_MAXBUF_SMALL];
+ size_t elen;
+ netsnmp_session *s = netsnmp_query_get_default_session();
+
+ if (s && s->securityEngineIDLen == 0 ) {
+ elen = snmpv3_get_engineID(eID, sizeof(eID));
+ memdup( &(s->securityEngineID), eID, elen );
+ s->securityEngineIDLen = elen;
+ }
+ return SNMPERR_SUCCESS;
+}
+
+void init_iquery(void){
+ char *type = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID,
+ NETSNMP_DS_LIB_APPTYPE);
+ netsnmp_ds_register_premib(ASN_OCTET_STR, type, "agentSecName",
+ NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_INTERNAL_SECNAME);
+ netsnmp_ds_register_premib(ASN_OCTET_STR, type, "iquerySecName",
+ NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_INTERNAL_SECNAME);
+
+ snmpd_register_config_handler("iqueryVersion",
+ netsnmp_parse_iqueryVersion, NULL,
+ "1 | 2c | 3");
+ snmpd_register_config_handler("iquerySecLevel",
+ netsnmp_parse_iquerySecLevel, NULL,
+ "noAuthNoPriv | authNoPriv | authPriv");
+
+ /*
+ * Set defaults
+ */
+ netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_INTERNAL_VERSION, SNMP_VERSION_3);
+ netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID,
+ NETSNMP_DS_AGENT_INTERNAL_SECLEVEL, SNMP_SEC_LEVEL_AUTHNOPRIV);
+
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+ SNMP_CALLBACK_POST_PREMIB_READ_CONFIG,
+ _init_default_iquery_session, NULL);
+ snmp_register_callback(SNMP_CALLBACK_LIBRARY,
+ SNMP_CALLBACK_POST_READ_CONFIG,
+ _tweak_default_iquery_session, NULL);
+}
+
+ /**************************
+ *
+ * APIs to construct an "internal query" session
+ *
+ **************************/
+
+netsnmp_session *netsnmp_iquery_pdu_session(netsnmp_pdu* pdu) {
+ if (!pdu)
+ return NULL;
+ if (pdu->version == SNMP_VERSION_3)
+ return netsnmp_iquery_session( pdu->securityName,
+ pdu->version,
+ pdu->securityModel,
+ pdu->securityLevel,
+ pdu->securityEngineID,
+ pdu->securityEngineIDLen);
+ else
+ return netsnmp_iquery_session( pdu->community,
+ pdu->version,
+ pdu->version+1,
+ SNMP_SEC_LEVEL_NOAUTH,
+ pdu->securityEngineID,
+ pdu->securityEngineIDLen);
+}
+
+netsnmp_session *netsnmp_iquery_user_session(char* secName){
+ u_char eID[SNMP_MAXBUF_SMALL];
+ size_t elen = snmpv3_get_engineID(eID, sizeof(eID));
+
+ return netsnmp_iquery_session( secName,
+ SNMP_VERSION_3,
+ SNMP_SEC_MODEL_USM,
+ SNMP_SEC_LEVEL_AUTHNOPRIV, eID, elen);
+}
+
+netsnmp_session *netsnmp_iquery_community_session( char* community, int version ) {
+ u_char eID[SNMP_MAXBUF_SMALL];
+ size_t elen = snmpv3_get_engineID(eID, sizeof(eID));
+
+ return netsnmp_iquery_session( community, version, version+1,
+ SNMP_SEC_LEVEL_NOAUTH, eID, elen);
+}
+
+netsnmp_session *netsnmp_iquery_session(char* secName, int version,
+ int secModel, int secLevel,
+ u_char* engineID, size_t engIDLen) {
+
+ /*
+ * This routine creates a completely new session every time.
+ * It might be worth keeping track of which 'secNames' already
+ * have iquery sessions created, and re-using the appropriate one.
+ */
+ extern int callback_master_num;
+ netsnmp_session *ss = NULL;
+
+#ifdef NETSNMP_TRANSPORT_CALLBACK_DOMAIN
+ ss = netsnmp_callback_open( callback_master_num, NULL, NULL, NULL);
+ if (ss) {
+ ss->version = version;
+ ss->securityModel = secModel;
+ ss->securityLevel = secLevel;
+ memdup( &(ss->securityEngineID), engineID, engIDLen );
+ ss->securityEngineIDLen = engIDLen;
+ if ( version == SNMP_VERSION_3 ) {
+ ss->securityNameLen = strlen(secName);
+ memdup(&(ss->securityName), (u_char*)secName, ss->securityNameLen);
+ } else {
+ memdup( &(ss->community), secName, strlen(secName));
+ ss->community_len = strlen(secName);
+ }
+ ss->myvoid = netsnmp_check_outstanding_agent_requests;
+ ss->flags |= SNMP_FLAGS_RESP_CALLBACK | SNMP_FLAGS_DONT_PROBE;
+ }
+#endif
+
+ return ss;
+}
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/iquery.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/iquery.h
new file mode 100644
index 0000000000..f98bd91238
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/iquery.h
@@ -0,0 +1,19 @@
+#ifndef IQUERY_H
+#define IQUERY_H
+
+config_belongs_in(agent_module)
+
+#ifndef NETSNMP_TRANSPORT_CALLBACK_DOMAIN
+config_error(utilities/iquery depends on the Callback transport)
+#endif
+
+void init_iquery(void);
+
+netsnmp_session *netsnmp_iquery_user_session( char* secName);
+netsnmp_session *netsnmp_iquery_community_session( char* community, int version );
+netsnmp_session *netsnmp_iquery_pdu_session(netsnmp_pdu* pdu);
+netsnmp_session *netsnmp_iquery_session( char* secName, int version,
+ int secModel, int secLevel,
+ u_char* engineID, size_t engIDLen);
+
+#endif /* IQUERY_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/override.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/override.c
new file mode 100644
index 0000000000..09ac849549
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/override.c
@@ -0,0 +1,280 @@
+/** allows overriding of a given oid with a new type and value */
+
+/* Portions of this file are subject to the following copyright(s). See
+ * the Net-SNMP's COPYING file for more details and other copyrights
+ * that may apply:
+ */
+/*
+ * Portions of this file are copyrighted by:
+ * Copyright © 2003 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms specified in the COPYING file
+ * distributed with the Net-SNMP package.
+ */
+
+#include <net-snmp/net-snmp-config.h>
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+
+typedef struct override_data_s {
+ int type;
+ void *value;
+ size_t value_len;
+ void *set_space;
+ size_t set_len;
+} override_data;
+
+/** @todo: (optionally) save values persistently when configured for
+ * read-write */
+int
+override_handler(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ override_data *data = handler->myvoid;
+ void *tmpptr;
+
+ if (!data) {
+ netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_GENERR);
+ return SNMP_ERR_NOERROR;
+ }
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ DEBUGMSGTL(("override", "overriding oid "));
+ DEBUGMSGOID(("override", requests->requestvb->name,
+ requests->requestvb->name_length));
+ DEBUGMSG(("override", "\n"));
+ snmp_set_var_typed_value(requests->requestvb, (u_char)data->type,
+ (u_char *) data->value, data->value_len);
+ break;
+
+ case MODE_SET_RESERVE1:
+ if (requests->requestvb->type != data->type)
+ netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_WRONGTYPE);
+ break;
+
+ case MODE_SET_RESERVE2:
+ if (memdup((u_char **) &data->set_space,
+ requests->requestvb->val.string,
+ requests->requestvb->val_len) == SNMPERR_GENERR)
+ netsnmp_set_request_error(reqinfo, requests,
+ SNMP_ERR_RESOURCEUNAVAILABLE);
+ break;
+
+ case MODE_SET_FREE:
+ SNMP_FREE(data->set_space);
+ break;
+
+ case MODE_SET_ACTION:
+ /* swap the values in */
+ tmpptr = data->value;
+ data->value = data->set_space;
+ data->set_space = tmpptr;
+
+ /* set the lengths */
+ data->set_len = data->value_len;
+ data->value_len = requests->requestvb->val_len;
+ break;
+
+ case MODE_SET_UNDO:
+ SNMP_FREE(data->value);
+ data->value = data->set_space;
+ data->value_len = data->set_len;
+ break;
+
+ case MODE_SET_COMMIT:
+ SNMP_FREE(data->set_space);
+ break;
+
+ default:
+ snmp_log(LOG_ERR, "unsupported mode in override handler\n");
+ netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_GENERR);
+ return SNMP_ERR_GENERR;
+ }
+ return SNMP_ERR_NOERROR;
+}
+
+#define MALLOC_OR_DIE(x) \
+ thedata->value = malloc(x); \
+ thedata->value_len = x; \
+ if (!thedata->value) { \
+ free(thedata); \
+ config_perror("memory allocation failure"); \
+ return; \
+ }
+
+void
+netsnmp_parse_override(const char *token, char *line)
+{
+ char *cp;
+ char buf[SNMP_MAXBUF], namebuf[SNMP_MAXBUF];
+ int readwrite = 0;
+ oid oidbuf[MAX_OID_LEN];
+ size_t oidbuf_len = sizeof(oidbuf);
+ int type;
+ override_data *thedata;
+ netsnmp_handler_registration *the_reg;
+
+ cp = copy_nword(line, namebuf, sizeof(namebuf) - 1);
+ if (strcmp(namebuf, "-rw") == 0) {
+ readwrite = 1;
+ cp = copy_nword(cp, namebuf, sizeof(namebuf) - 1);
+ }
+
+ if (!cp) {
+ config_perror("no oid specified");
+ return;
+ }
+
+ if (!snmp_parse_oid(namebuf, oidbuf, &oidbuf_len)) {
+ config_perror("illegal oid");
+ return;
+ }
+ cp = copy_nword(cp, buf, sizeof(buf) - 1);
+
+ if (!cp && strcmp(buf, "null") != 0) {
+ config_perror("no variable value specified");
+ return;
+ }
+
+ {
+ struct { const char* key; int value; } const strings[] = {
+ { "counter", ASN_COUNTER },
+ { "counter64", ASN_COUNTER64 },
+ { "integer", ASN_INTEGER },
+ { "ipaddress", ASN_IPADDRESS },
+ { "nsap", ASN_NSAP },
+ { "null", ASN_NULL },
+ { "object_id", ASN_OBJECT_ID },
+ { "octet_str", ASN_OCTET_STR },
+ { "opaque", ASN_OPAQUE },
+#ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES
+ { "opaque_counter64", ASN_OPAQUE_COUNTER64 },
+ { "opaque_double", ASN_OPAQUE_DOUBLE },
+ { "opaque_float", ASN_OPAQUE_FLOAT },
+ { "opaque_i64", ASN_OPAQUE_I64 },
+ { "opaque_u64", ASN_OPAQUE_U64 },
+#endif
+ { "timeticks", ASN_TIMETICKS },
+ { "uinteger", ASN_GAUGE },
+ { "unsigned", ASN_UNSIGNED },
+ { NULL, 0 }
+ }, * run;
+ for(run = strings; run->key && strcasecmp(run->key, buf) < 0; ++run);
+ if(run->key && strcasecmp(run->key, buf) == 0)
+ type = run->value;
+ else {
+ config_perror("unknown type specified");
+ return;
+ }
+ }
+
+ if (cp)
+ copy_nword(cp, buf, sizeof(buf) - 1);
+ else
+ buf[0] = 0;
+
+ thedata = SNMP_MALLOC_TYPEDEF(override_data);
+ if (!thedata) {
+ config_perror("memory allocation failure");
+ return;
+ }
+
+ thedata->type = type;
+
+ switch (type) {
+ case ASN_INTEGER:
+ MALLOC_OR_DIE(sizeof(long));
+ *((long *) thedata->value) = strtol(buf, NULL, 0);
+ break;
+
+ case ASN_COUNTER:
+ case ASN_TIMETICKS:
+ case ASN_UNSIGNED:
+ MALLOC_OR_DIE(sizeof(u_long));
+ *((u_long *) thedata->value) = strtoul(buf, NULL, 0);
+ break;
+
+ case ASN_OCTET_STR:
+ case ASN_BIT_STR:
+ if (buf[0] == '0' && buf[1] == 'x') {
+ /*
+ * hex
+ */
+ thedata->value_len =
+ hex_to_binary2(buf + 2, strlen(buf) - 2,
+ (char **) &thedata->value);
+ } else {
+ thedata->value = strdup(buf);
+ thedata->value_len = strlen(buf);
+ }
+ break;
+
+ case ASN_OBJECT_ID:
+ read_config_read_objid(buf, (oid **) & thedata->value,
+ &thedata->value_len);
+ break;
+
+ case ASN_NULL:
+ thedata->value_len = 0;
+ break;
+
+ default:
+ SNMP_FREE(thedata);
+ config_perror("illegal/unsupported type specified");
+ return;
+ }
+
+ if (!thedata->value && thedata->type != ASN_NULL) {
+ config_perror("memory allocation failure");
+ free(thedata);
+ return;
+ }
+
+ the_reg = SNMP_MALLOC_TYPEDEF(netsnmp_handler_registration);
+ if (!the_reg) {
+ config_perror("memory allocation failure");
+ free(thedata);
+ return;
+ }
+
+ the_reg->handlerName = strdup(namebuf);
+ the_reg->priority = 255;
+ the_reg->modes = (readwrite) ? HANDLER_CAN_RWRITE : HANDLER_CAN_RONLY;
+ the_reg->handler =
+ netsnmp_create_handler("override", override_handler);
+ memdup((u_char **) & the_reg->rootoid, (const u_char *) oidbuf,
+ oidbuf_len * sizeof(oid));
+ the_reg->rootoid_len = oidbuf_len;
+ if (!the_reg->rootoid || !the_reg->handler || !the_reg->handlerName) {
+ if (the_reg->handler)
+ SNMP_FREE(the_reg->handler->handler_name);
+ SNMP_FREE(the_reg->handler);
+ SNMP_FREE(the_reg->handlerName);
+ SNMP_FREE(the_reg);
+ config_perror("memory allocation failure");
+ free(thedata);
+ return;
+ }
+ the_reg->handler->myvoid = thedata;
+
+ if (netsnmp_register_instance(the_reg)) {
+ config_perror("oid registration failed within the agent");
+ SNMP_FREE(thedata->value);
+ free(thedata);
+ return;
+ }
+}
+
+
+void
+init_override(void)
+{
+
+ snmpd_register_config_handler("override", netsnmp_parse_override, NULL, /* XXX: free func */
+ "[-rw] mibnode type value");
+}
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/override.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/override.h
new file mode 100644
index 0000000000..5b0784264c
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/utilities/override.h
@@ -0,0 +1,7 @@
+#ifndef OVERRIDE_H
+#define OVERRIDE_H
+
+Netsnmp_Node_Handler override_handler;
+void init_override(void);
+
+#endif /* OVERRIDE_H */
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/winExtDLL.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/winExtDLL.c
new file mode 100755
index 0000000000..12f0791305
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/winExtDLL.c
@@ -0,0 +1,1605 @@
+/*
+ * winExtDLL Net-SNMP extension
+ * (c) 2006 Alex Burger
+ *
+ * Created 9/9/06
+ *
+ * Purpose: To load Windows SNMP Service extension DLLs provided with Windows
+ * (such as hostmib.dll). This allows Net-SNMP to be a replacement
+ * for the Windows SNMP service.
+ *
+ * Notes: This extension requires the PSDK including the Snmp.h header file.
+ * Including Snmp.h will conflict with existing Net-SNMP defines for
+ * ASN_OCTETSTRING etc. To resolve this, create a copy of Snmp.h in
+ * the PSDK include/ folder called Snmp-winExtDLL.h and change all
+ * occurances of ASN_ to MS_ASN_
+ *
+ * This extension requires that the Windows SNMP Service is installed
+ * but set to disabled. This is required so that the extension DLLs
+ * are available for loading, and also because this extension and the
+ * existing Windows extensions use the Windows SNMP API from snmpapi.dll.
+ *
+ * This extension is NOT for dynamically loading Net-SNMP extensions.
+ */
+
+#include <windows.h>
+#include <cstdio>
+#include <Snmp-winExtDLL.h> // Modified Windows SDK snmp.h. See Notes above
+#include <mgmtapi.h>
+#include <string.h>
+
+/*
+ * include important headers
+ */
+#include <net-snmp/net-snmp-config.h>
+#if HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+/*
+ * needed by util_funcs.h
+ */
+#if TIME_WITH_SYS_TIME
+# ifdef WIN32
+# include <sys/timeb.h>
+# else
+# include <sys/time.h>
+# endif
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#if HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#if HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#include <net-snmp/net-snmp-includes.h>
+#include <net-snmp/agent/net-snmp-agent-includes.h>
+
+#include "util_funcs.h"
+
+#include "winExtDLL.h"
+
+#define SZBUF_MAX 1024
+#define SZBUF_DLLNAME_MAX 254
+#define MAX_WINEXT_DLLS 100
+#define MAX_KEY_LENGTH 255
+#define MAX_VALUE_NAME 16383
+#define MAX_WINEXT_TRAP_EVENTS 100
+
+#define DEBUGMSGWINOID(x) do {if (_DBG_IF_) {__DBGMSGWINOID(x);} }while(0)
+#define __DBGMSGWINOID(x) debugmsg_win_oid x
+void debugmsg_win_oid(const char *token, const AsnObjectIdentifier * theoid);
+
+/* Structure to hold name, pointers to functions and MIB tree supported by
+ * each Windows SNMP Extension DLL */
+typedef struct {
+ char dll_name[SZBUF_DLLNAME_MAX];
+ DWORD (WINAPI *xSnmpExtensionInit)(DWORD, HANDLE*, AsnObjectIdentifier*);
+ DWORD (WINAPI *xSnmpExtensionInitEx)(AsnObjectIdentifier*);
+ DWORD (WINAPI *xSnmpExtensionQuery)(BYTE, SnmpVarBindList* ,AsnInteger32* ,AsnInteger32*);
+ DWORD (WINAPI *xSnmpExtensionQueryEx)(DWORD, DWORD, SnmpVarBindList*, AsnOctetString*, AsnInteger32*, AsnInteger32*);
+ BOOL (WINAPI *xSnmpExtensionTrap)( AsnObjectIdentifier *, AsnInteger *, AsnInteger *, AsnTimeticks *, SnmpVarBindList * );
+ HANDLE *subagentTrapEvent;
+ netsnmp_handler_registration *my_handler;
+ oid name[MAX_OID_LEN]; // pSupportedView in Net-SNMP format
+ size_t name_length;
+ AsnObjectIdentifier pSupportedView;
+} winExtensionAgents;
+
+winExtensionAgents winExtensionAgent[MAX_WINEXT_DLLS];
+winExtensionAgents winExtensionAgent_temp; /* For sorting */
+int winExtensionAgent_index = 0;
+
+char *extDLLs[MAX_WINEXT_DLLS];
+int extDLLs_index = 0;
+
+HANDLE *subagentTrapEvents[MAX_WINEXT_TRAP_EVENTS];
+int subagentTrapEvents_index = 0;
+
+void winExtDLL_free_config_winExtDLL(void);
+
+void read_ExtensionAgents_list();
+void read_ExtensionAgents_list2(const TCHAR *);
+
+void subagentTrapCheck();
+
+void send_trap(
+ AsnObjectIdentifier *,
+ AsnInteger *,
+ AsnInteger *,
+ AsnTimeticks *,
+ SnmpVarBindList *);
+
+void init_winExtDLL(void)
+{
+ // Windows SNMP
+ DWORD dwUptimeReference = 0;
+ HANDLE subagentTrapEvent;
+ AsnObjectIdentifier pSupportedView;
+ BOOL result;
+ HANDLE hThread;
+ DWORD IDThread;
+
+ char dll_name[SZBUF_DLLNAME_MAX];
+ DWORD (WINAPI *xSnmpExtensionInit)(DWORD, HANDLE*, AsnObjectIdentifier*);
+ DWORD (WINAPI *xSnmpExtensionInitEx)(AsnObjectIdentifier*);
+ DWORD (WINAPI *xSnmpExtensionQuery)(BYTE, SnmpVarBindList* ,AsnInteger32* ,AsnInteger32*);
+ DWORD (WINAPI *xSnmpExtensionQueryEx)(DWORD, DWORD, SnmpVarBindList*, AsnOctetString*, AsnInteger32*, AsnInteger32*);
+ BOOL (WINAPI *xSnmpExtensionTrap)( AsnObjectIdentifier *, AsnInteger *, AsnInteger *, AsnTimeticks *, SnmpVarBindList * );
+
+ // Net-SNMP
+ oid name[MAX_OID_LEN];
+ size_t length = 0;
+ int i;
+ int DLLnum = 0;
+ int winExtensionAgent_num = 0;
+
+ int iter, indx;
+
+ netsnmp_handler_registration *my_handler;
+
+ HANDLE hInst = NULL;
+
+ DEBUGMSGTL(("winExtDLL", "init_winExtDLL called\n"));
+
+ read_ExtensionAgents_list();
+
+ DEBUGMSGTL(("winExtDLL", "winExtDLL enabled.\n"));
+
+ DEBUGMSGTL(("winExtDLL", "Size of winExtensionAgent: %d\n",sizeof(winExtensionAgent) / sizeof(winExtensionAgents)));
+
+ for(i=0; i <= sizeof(winExtensionAgent) / sizeof(winExtensionAgents); i++) {
+ winExtensionAgent[0].xSnmpExtensionInit = NULL;
+ winExtensionAgent[0].xSnmpExtensionInitEx = NULL;
+ }
+
+ /* Load all the DLLs */
+ for (DLLnum = 0; DLLnum <= extDLLs_index; DLLnum++) {
+
+ if (! (extDLLs[DLLnum]))
+ continue;
+
+ DEBUGMSGTL(("winExtDLL", "-----------------------------------------\n"));
+ DEBUGMSGTL(("winExtDLL", "DLL to load: %s, DLL number: %d, winExtensionAgent_num: %d\n", extDLLs[DLLnum], DLLnum,
+ winExtensionAgent_num));
+ DEBUGMSGTL(("winExtDLL", "Size of DLL to load: %d\n", strlen(extDLLs[DLLnum])));
+
+ hInst = LoadLibrary(extDLLs[DLLnum]);
+
+ if (hInst == NULL)
+ {
+ DEBUGMSGTL(("winExtDLL","Could not load Windows extension DLL %s.\n", extDLLs[DLLnum]));
+ snmp_log(LOG_ERR,
+ "Could not load Windows extension DLL: %s.\n", extDLLs[DLLnum]);
+ continue;
+ }
+ else {
+ DEBUGMSGTL(("winExtDLL","DLL loaded.\n"));
+ }
+
+ // Create local copy of DLL name and functions
+ strncpy(dll_name, extDLLs[DLLnum], SZBUF_DLLNAME_MAX-1);
+ xSnmpExtensionInit = (DWORD (WINAPI *)(DWORD, HANDLE*, AsnObjectIdentifier*))
+ GetProcAddress ((HMODULE) hInst, "SnmpExtensionInit");
+ xSnmpExtensionInitEx = (DWORD (WINAPI *)(AsnObjectIdentifier*))
+ GetProcAddress ((HMODULE) hInst, "SnmpExtensionInitEx");
+ xSnmpExtensionQuery = (DWORD (WINAPI *)(BYTE, SnmpVarBindList* ,AsnInteger32* ,AsnInteger32*))
+ GetProcAddress ((HMODULE) hInst, "SnmpExtensionQuery");
+ xSnmpExtensionQueryEx = (DWORD (WINAPI *)(DWORD, DWORD, SnmpVarBindList*, AsnOctetString*, AsnInteger32*, AsnInteger32*))
+ GetProcAddress ((HMODULE) hInst, "SnmpExtensionQueryEx");
+ xSnmpExtensionTrap = (BOOL (WINAPI *)(AsnObjectIdentifier *, AsnInteger *, AsnInteger *, AsnTimeticks *, SnmpVarBindList * ))
+ GetProcAddress ((HMODULE) hInst, "SnmpExtensionTrap");
+
+ if (xSnmpExtensionQuery)
+ DEBUGMSGTL(("winExtDLL", "xSnmpExtensionQuery found\n"));
+ if (xSnmpExtensionQueryEx)
+ DEBUGMSGTL(("winExtDLL", "xSnmpExtensionQueryEx found\n"));
+ if (xSnmpExtensionQuery)
+ DEBUGMSGTL(("winExtDLL", "xSnmpExtensionTrap found\n"));
+
+ // Store DLL name and functions in winExtensionAgent array
+ strncpy(winExtensionAgent[winExtensionAgent_num].dll_name, dll_name, SZBUF_DLLNAME_MAX-1);
+ winExtensionAgent[winExtensionAgent_num].xSnmpExtensionInit = xSnmpExtensionInit;
+ winExtensionAgent[winExtensionAgent_num].xSnmpExtensionInitEx = xSnmpExtensionInitEx;
+ winExtensionAgent[winExtensionAgent_num].xSnmpExtensionQuery = xSnmpExtensionQuery;
+ winExtensionAgent[winExtensionAgent_num].xSnmpExtensionQueryEx = xSnmpExtensionQueryEx;
+ winExtensionAgent[winExtensionAgent_num].xSnmpExtensionTrap = xSnmpExtensionTrap;
+
+ // Init and get first supported view from Windows SNMP extension DLL
+ result = xSnmpExtensionInit(dwUptimeReference, &subagentTrapEvent, &pSupportedView);
+
+ DEBUGMSGTL(("winExtDLL", "Supported view: "));
+ DEBUGMSGWINOID(("winExtDLL", &pSupportedView));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ // Store the subagent's trap handler, even if it's NULL
+ winExtensionAgent[winExtensionAgent_num].subagentTrapEvent = subagentTrapEvent;
+
+ // Store the subagent's trap handler in a global array for use by waitformultipleobjects()
+ if (subagentTrapEvent) {
+ DEBUGMSGTL(("winExtDLL", "Trap handler defined. Storing...\n"));
+ subagentTrapEvents[subagentTrapEvents_index] = subagentTrapEvent;
+ subagentTrapEvents_index++;
+ }
+
+ // Convert OID from Windows 'supported view' to Net-SNMP
+ for (i = 0; i < (pSupportedView.idLength > MAX_OID_LEN?MAX_OID_LEN:pSupportedView.idLength); i++) {
+ name[i] = (oid)pSupportedView.ids[i];
+ }
+ length = i;
+
+ // Store supported view in Net-SNMP format
+ memcpy(winExtensionAgent[winExtensionAgent_num].name, name, sizeof(name));
+ winExtensionAgent[winExtensionAgent_num].name_length = length;
+
+ DEBUGMSGTL(("winExtDLL", "Windows OID converted to Net-SNMP: "));
+ DEBUGMSGOID(("winExtDLL", name, length));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ // Store supported view in Windows format
+ SnmpUtilOidCpy(&winExtensionAgent[winExtensionAgent_num].pSupportedView,&pSupportedView);
+
+ // Create handler registration
+ winExtensionAgent[winExtensionAgent_num].my_handler = netsnmp_create_handler_registration("winExtDLL",
+ var_winExtDLL,
+ name,
+ length,
+ HANDLER_CAN_RWRITE);
+
+ if (!winExtensionAgent[winExtensionAgent_num].my_handler) {
+ snmp_log(LOG_ERR,
+ "malloc failed registering handler for winExtDLL");
+ DEBUGMSGTL(("winExtDLL", "malloc failed registering handler for winExtDLL"));
+ return (-1);
+ }
+ else {
+ DEBUGMSGTL(("winExtDLL", "handler registered\n"));
+ }
+
+ // Register handler with Net-SNMP
+ netsnmp_register_handler(winExtensionAgent[winExtensionAgent_num].my_handler);
+
+ // Check for additional supported views and register them with the same handler
+ if (winExtensionAgent[winExtensionAgent_num].xSnmpExtensionInitEx) {
+ DEBUGMSGTL(("winExtDLL", "xSnmpExtensionInitEx found\n"));
+
+ winExtensionAgent_num++;
+
+ while (1) { // Loop looking for more supported views
+ // Store DLL name and functions in winExtensionAgent array
+ strncpy(winExtensionAgent[winExtensionAgent_num].dll_name, dll_name, SZBUF_DLLNAME_MAX-1);
+ winExtensionAgent[winExtensionAgent_num].xSnmpExtensionInit = xSnmpExtensionInit;
+ winExtensionAgent[winExtensionAgent_num].xSnmpExtensionInitEx = xSnmpExtensionInitEx;
+ winExtensionAgent[winExtensionAgent_num].xSnmpExtensionQuery = xSnmpExtensionQuery;
+ winExtensionAgent[winExtensionAgent_num].xSnmpExtensionQueryEx = xSnmpExtensionQueryEx;
+ winExtensionAgent[winExtensionAgent_num].xSnmpExtensionTrap = xSnmpExtensionTrap;
+ winExtensionAgent[winExtensionAgent_num].subagentTrapEvent = NULL;
+ // Get extra supported view
+ result = xSnmpExtensionInitEx(&pSupportedView);
+
+ if (! (result)) {
+ winExtensionAgent_num--;
+ break;
+ }
+
+ DEBUGMSGTL(("winExtDLL", "result of xSnmpExtensionInitEx: %d\n",result));
+
+ DEBUGMSGTL(("winExtDLL", "Supported view: "));
+ DEBUGMSGWINOID(("winExtDLL", &pSupportedView));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ // Convert OID from Windows 'supported view' to Net-SNMP
+ for (i = 0; i < (pSupportedView.idLength > MAX_OID_LEN?MAX_OID_LEN:pSupportedView.idLength); i++) {
+ name[i] = (oid)pSupportedView.ids[i];
+ }
+ length = i;
+
+ // Store supported view in Net-SNMP format
+ memcpy(winExtensionAgent[winExtensionAgent_num].name, name, sizeof(name));
+ winExtensionAgent[winExtensionAgent_num].name_length = length;
+
+ DEBUGMSGTL(("winExtDLL", "Windows OID converted to Net-SNMP: "));
+ DEBUGMSGOID(("winExtDLL", name, length));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ // Store supported view in Windows format
+ SnmpUtilOidCpy(&winExtensionAgent[winExtensionAgent_num].pSupportedView,&pSupportedView);
+
+ // Create handler registration
+ winExtensionAgent[winExtensionAgent_num].my_handler = netsnmp_create_handler_registration("winExtDLL",
+ var_winExtDLL,
+ name,
+ length,
+ HANDLER_CAN_RWRITE);
+
+ if (!winExtensionAgent[winExtensionAgent_num].my_handler) {
+ snmp_log(LOG_ERR,
+ "malloc failed registering handler for winExtDLL");
+ DEBUGMSGTL(("winExtDLL", "malloc failed registering handler for winExtDLL"));
+ return (-1);
+ }
+ else {
+ DEBUGMSGTL(("winExtDLL", "handler registered\n"));
+ }
+
+ // Register handler with Net-SNMP
+ netsnmp_register_handler(winExtensionAgent[winExtensionAgent_num].my_handler);
+
+ winExtensionAgent_num++;
+ }
+ }
+ winExtensionAgent_num++;
+ }
+
+
+ winExtensionAgent_index = winExtensionAgent_num-1; // Array index
+ DEBUGMSGTL(("winExtDLL", "winExtensionAgent_index: %d\n",winExtensionAgent_index));
+
+ /* Reverse sort array of winExtensionAgents */
+ i = sizeof(winExtensionAgent) / sizeof(winExtensionAgents);
+ //DEBUGMSGTL(("winExtDLL", "Sorting...\n"));
+ for (iter=0; iter < i-1; iter++) {
+ for (indx=0; indx < i-1; indx++) {
+ if (snmp_oidtree_compare(winExtensionAgent[indx].name, winExtensionAgent[indx].name_length,
+ winExtensionAgent[indx+1].name, winExtensionAgent[indx+1].name_length) < 0) {
+ winExtensionAgent_temp = winExtensionAgent[indx];
+ winExtensionAgent[indx] = winExtensionAgent[indx+1];
+ winExtensionAgent[indx+1] = winExtensionAgent_temp;
+ }
+ }
+ }
+ DEBUGMSGTL(("winExtDLL", "Dumping sorted Windows extension OIDs\n"));
+ for (i=0; winExtensionAgent[i].xSnmpExtensionInit; i++) {
+ DEBUGMSGTL(("winExtDLL", "DLL name: %s, view: ",winExtensionAgent[i].dll_name));
+ DEBUGMSGOID(("winExtDLL", winExtensionAgent[i].name, winExtensionAgent[i].name_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+ }
+
+ DEBUGMSGTL(("winExtDLL", "Number of subagentTrapEvents: %d\n",subagentTrapEvents_index));
+
+ if (subagentTrapEvents_index) {
+
+ DEBUGMSGTL(("winExtDLL", "Setting alarm check for subagent trap events every 5 seconds\n"));
+ snmp_alarm_register(5, /* seconds */
+ SA_REPEAT, /* repeat (every x seconds). */
+ subagentTrapCheck, /* our callback */
+ NULL /* no callback data needed */
+ );
+ }
+}
+
+int
+var_winExtDLL(netsnmp_mib_handler *handler,
+ netsnmp_handler_registration *reginfo,
+ netsnmp_agent_request_info *reqinfo,
+ netsnmp_request_info *requests)
+{
+
+ netsnmp_request_info *request = requests;
+ netsnmp_variable_list *var;
+ oid oid_requested[MAX_OID_LEN];
+ size_t oid_requested_length;
+
+ static char ret_szbuf_temp[SZBUF_MAX]; // Holder for return strings
+ static oid ret_oid[MAX_OID_LEN]; // Holder for return OIDs
+ static size_t ret_oid_length = 0; // Holder for return OIDs
+ static long ret_long; // Holder for all other returns
+
+ static char set_szbuf_temp[SZBUF_MAX]; // Holder for set strings
+ static oid set_oid[MAX_OID_LEN]; // Holder for set OIDs
+ static size_t set_oid_length = 0; // Holder for set OIDs
+ oid *temp_oid;
+ size_t temp_oid_length;
+
+ static int temp;
+ static u_long accesses = 7;
+ u_char netsnmp_ASN_type;
+ u_char windows_ASN_type;
+
+ char *stringtemp;
+
+ // WinSNMP variables:
+ BOOL result;
+ SnmpVarBind *mySnmpVarBind;
+ AsnInteger32 pErrorStatus;
+ AsnInteger32 pErrorIndex;
+ SnmpVarBindList pVarBindList;
+ int i=0;
+ int j=0;
+
+ DWORD (WINAPI *xSnmpExtensionQuery)(BYTE, SnmpVarBindList* ,AsnInteger32* ,AsnInteger32*);
+ DWORD (WINAPI *xSnmpExtensionQueryEx)(DWORD, DWORD, SnmpVarBindList*, AsnOctetString*, AsnInteger32*, AsnInteger32*);
+ DWORD (WINAPI *next_xSnmpExtensionQuery)(BYTE, SnmpVarBindList* ,AsnInteger32* ,AsnInteger32*);
+ DWORD (WINAPI *next_xSnmpExtensionQueryEx)(DWORD, DWORD, SnmpVarBindList*, AsnOctetString*, AsnInteger32*, AsnInteger32*);
+ AsnObjectIdentifier winExtensionAgent_pSupportedView; // Support view of this extension agent
+ oid winExtensionAgent_name[MAX_OID_LEN]; // Support view of this extension agent
+ size_t winExtensionAgent_name_length; // Support view of this extension agent
+
+ int match_winExtensionAgent_index = -1;
+
+ DEBUGMSGTL(("winExtDLL", "-----------------------------------------\n"));
+ DEBUGMSGTL(("winExtDLL", "var_winExtDLL handler starting, mode = %d\n",
+ reqinfo->mode));
+
+ switch (reqinfo->mode) {
+ case MODE_GET:
+ case MODE_GETNEXT:
+
+ if (reqinfo->mode == MODE_GET)
+ DEBUGMSGTL(("winExtDLL", "GET requested\n"));
+ else if (reqinfo->mode == MODE_GETNEXT)
+ DEBUGMSGTL(("winExtDLL", "GETNEXT requested\n"));
+
+ for (request = requests; request; request=request->next) {
+
+ var = request->requestvb;
+
+ // Make copy of requested OID
+ for (i = 0; i < (var->name_length > MAX_OID_LEN? MAX_OID_LEN: var->name_length); i++) {
+ oid_requested[i] = var->name[i];
+ }
+ oid_requested_length = i;
+
+ DEBUGMSGTL(("winExtDLL", "Requested: "));
+ DEBUGMSGOID(("winExtDLL", oid_requested, oid_requested_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ DEBUGMSGTL(("winExtDLL", "Var type requested: %d\n",var->type));
+
+ /* Loop through all the winExtensionAgent's looking for a matching handler */
+ xSnmpExtensionQuery = NULL;
+ xSnmpExtensionQueryEx = NULL;
+ next_xSnmpExtensionQuery = NULL;
+ next_xSnmpExtensionQueryEx = NULL;
+
+ DEBUGMSGTL(("winExtDLL", "Looping through all the winExtensionAgent's looking for a matching handler (exact).\n"));
+ // Search starting with lowest so a walk of .1.3 starts with the lowest extension
+ for (i = winExtensionAgent_index; winExtensionAgent[i].xSnmpExtensionInit && i >= 0; i--) {
+
+ /*DEBUGMSGTL(("winExtDLL", "Comparing: "));
+ DEBUGMSGOID(("winExtDLL", var->name, var->name_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ DEBUGMSGTL(("winExtDLL", "to: "));
+ DEBUGMSGOID(("winExtDLL", winExtensionAgent[i].name, winExtensionAgent[i].name_length));
+ DEBUGMSG(("winExtDLL", "\n"));*/
+
+ if (snmp_oidtree_compare(var->name, var->name_length, winExtensionAgent[i].name,
+ winExtensionAgent[i].name_length) == 0) {
+
+ DEBUGMSGTL(("winExtDLL", "Found exact match: "));
+ DEBUGMSGOID(("winExtDLL", winExtensionAgent[i].name, winExtensionAgent[i].name_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+ match_winExtensionAgent_index = i;
+ //DEBUGMSGTL(("winExtDLL", "Index: %d\n",match_winExtensionAgent_index));
+ break;
+ }
+ }
+
+ if (match_winExtensionAgent_index == -1) {
+ DEBUGMSGTL(("winExtDLL", "Looping through all the winExtensionAgent's looking for a matching handler (next best).\n"));
+ for (i=0; winExtensionAgent[i].xSnmpExtensionInit && i < MAX_WINEXT_DLLS; i++) {
+
+ /*DEBUGMSGTL(("winExtDLL", "Comparing: "));
+ DEBUGMSGOID(("winExtDLL", var->name, var->name_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ DEBUGMSGTL(("winExtDLL", "to: "));
+ DEBUGMSGOID(("winExtDLL", winExtensionAgent[i].name, winExtensionAgent[i].name_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+ DEBUGMSGTL(("winExtDLL", "and: "));
+ DEBUGMSGOID(("winExtDLL", winExtensionAgent[i+1].name, winExtensionAgent[i+1].name_length));
+ DEBUGMSG(("winExtDLL", "\n")); */
+
+ if (snmp_oidtree_compare(var->name, var->name_length, winExtensionAgent[i].name,
+ winExtensionAgent[i].name_length) <= 0 &&
+ snmp_oidtree_compare(var->name, var->name_length, winExtensionAgent[i+1].name,
+ winExtensionAgent[i+1].name_length) >= 0 // FIXME: Checking past the last extension?
+ ) {
+ DEBUGMSGTL(("winExtDLL", "Found best match: "));
+ DEBUGMSGOID(("winExtDLL", winExtensionAgent[i].name, winExtensionAgent[i].name_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+ match_winExtensionAgent_index = i;
+ //DEBUGMSGTL(("winExtDLL", "Index: %d\n",match_winExtensionAgent_index));
+ break;
+ }
+ }
+ }
+
+ //DEBUGMSG(("winExtDLL", "Index: %d\n",match_winExtensionAgent_index));
+
+ if (match_winExtensionAgent_index == -1) {
+ DEBUGMSGTL(("winExtDLL","Could not find a handler for the requested OID. This should never happen!!\n"));
+ return SNMP_ERR_GENERR;
+ }
+
+ // Make copy of current extension's OID
+ for (j = 0; j < (winExtensionAgent[i].name_length > MAX_OID_LEN? MAX_OID_LEN: winExtensionAgent[i].name_length); j++) {
+ winExtensionAgent_name[j] = winExtensionAgent[i].name[j];
+ }
+ winExtensionAgent_name_length = j;
+
+ xSnmpExtensionQuery = winExtensionAgent[i].xSnmpExtensionQuery;
+ xSnmpExtensionQueryEx = winExtensionAgent[i].xSnmpExtensionQueryEx;
+ SnmpUtilOidCpy(&winExtensionAgent_pSupportedView, &winExtensionAgent[i].pSupportedView);
+
+ if (! (xSnmpExtensionQuery || xSnmpExtensionQueryEx)) {
+ if (reqinfo->mode == MODE_GET) {
+ DEBUGMSGTL(("winExtDLL","Could not find a handler for the requested OID. This should never happen!!\n"));
+ return SNMP_ERR_GENERR;
+ }
+ else {
+ DEBUGMSGTL(("winExtDLL","Could not find a handler for the requested OID. Returning SNMP_ERR_NOSUCHNAME.\n"));
+ return SNMP_ERR_NOSUCHNAME;
+ }
+ }
+
+ // Query
+ pVarBindList.list = (SnmpVarBind *) SnmpUtilMemAlloc(sizeof (SnmpVarBind));
+ if (pVarBindList.list) {
+
+ // Convert OID from Net-SNMP to Windows
+
+ pVarBindList.list->name.ids = (UINT *) SnmpUtilMemAlloc(sizeof (UINT) *var->name_length);
+
+ if (pVarBindList.list->name.ids) {
+ // Actual copy
+
+ for (i = 0; i < var->name_length; i++) {
+ pVarBindList.list->name.ids[i] = (UINT)var->name[i];
+ }
+ pVarBindList.list->name.idLength = i;
+
+ DEBUGMSGTL(("winExtDLL", "Windows OID: "));
+ DEBUGMSGWINOID(("winExtDLL", pVarBindList.list));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ }
+ else {
+ DEBUGMSGTL(("winExtDLL", "\nyCould not allocate memory for Windows SNMP varbind.\n"));
+ return (0);
+ }
+
+ //pVarBindList.list = pVarBindList.list;
+
+ pVarBindList.len = 1;
+ }
+ else {
+ DEBUGMSGTL(("winExtDLL", "Could not allocate memory for Windows SNMP varbind list.\n"));
+ return (0);
+ }
+
+ if (reqinfo->mode == MODE_GET) {
+ DEBUGMSGTL(("winExtDLL", "win: MODE_GET\n"));
+ if (xSnmpExtensionQueryEx) {
+ DEBUGMSGTL(("winExtDLL", "Calling xSnmpExtensionQueryEx\n"));
+ result = xSnmpExtensionQueryEx(SNMP_PDU_GET, 1, &pVarBindList, NULL, &pErrorStatus, &pErrorIndex);
+ }
+ else {
+ DEBUGMSGTL(("winExtDLL", "Calling xSnmpExtensionQuery\n"));
+ result = xSnmpExtensionQuery(SNMP_PDU_GET, &pVarBindList, &pErrorStatus, &pErrorIndex);
+ }
+ }
+ else if (reqinfo->mode == MODE_GETNEXT) {
+ DEBUGMSGTL(("winExtDLL", "win: MODE_GETNEXT -\n"));
+ if (xSnmpExtensionQueryEx) {
+ DEBUGMSGTL(("winExtDLL", "Calling xSnmpExtensionQueryEx\n"));
+ result = xSnmpExtensionQueryEx(SNMP_PDU_GETNEXT, 1, &pVarBindList, NULL, &pErrorStatus, &pErrorIndex);
+ }
+ else {
+ DEBUGMSGTL(("winExtDLL", "Calling xSnmpExtensionQuery\n"));
+ result = xSnmpExtensionQuery(SNMP_PDU_GETNEXT, &pVarBindList, &pErrorStatus, &pErrorIndex);
+ }
+
+ DEBUGMSGTL(("winExtDLL", "Windows OID returned from xSnmpExtensionQuery(Ex): "));
+ DEBUGMSGWINOID(("winExtDLL", pVarBindList.list));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ // Convert OID from Windows to Net-SNMP so Net-SNMP has the new 'next' OID
+ // FIXME: Do we need to realloc var->name or is is MAX_OID_LEN?
+ for (i = 0; i < (pVarBindList.list->name.idLength > MAX_OID_LEN?MAX_OID_LEN:pVarBindList.list->name.idLength); i++) {
+ var->name[i] = (oid)pVarBindList.list->name.ids[i];
+ }
+ var->name_length = i;
+
+ DEBUGMSGTL(("winExtDLL", "Comparing: "));
+ DEBUGMSGOID(("winExtDLL", var->name, var->name_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ DEBUGMSGTL(("winExtDLL", "to: "));
+ DEBUGMSGOID(("winExtDLL", winExtensionAgent_name, winExtensionAgent_name_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+
+ // If the OID we got back is less than or equal to what we requested, increment the current supported view
+ // and send it back instead.
+ if (snmp_oid_compare(var->name, var->name_length, oid_requested, oid_requested_length) <= 0) {
+ DEBUGMSGTL(("winExtDLL", "xSnmpExtensionQuery(Ex) returned an OID less than or equal to what we requested\n"));
+ DEBUGMSGTL(("winExtDLL", " Setting return OID to be equal to current supported view, plus one\n"));
+
+ // Set var->name to be equal to current supported view, plus one
+ for (i = 0; i < (winExtensionAgent_name_length > MAX_OID_LEN? MAX_OID_LEN: winExtensionAgent_name_length); i++) {
+ var->name[i] = winExtensionAgent_name[i];
+ }
+ var->name_length = i;
+ var->name[i-1]++;
+
+ //return SNMP_ERR_NOSUCHNAME;
+
+ }
+
+ // If the OID we got back is outside our view, increment the current supported view and send it back instead.
+ // This is for Windows extension agents that support multiple views. We want Net-SNMP to decide if we should be
+ // called for this OID, not the extension agent, just in case there is a Net-SNMP agent in between.
+ else if (snmp_oidtree_compare(var->name, var->name_length, winExtensionAgent_name, winExtensionAgent_name_length) > 0) {
+ DEBUGMSGTL(("winExtDLL", "xSnmpExtensionQuery(Ex) returned an OID outside our view\n"));
+ DEBUGMSGTL(("winExtDLL", " Setting return OID to be equal to current supported view, plus one\n"));
+
+ // Set var->name to be equal to current supported view, plus one
+ for (i = 0; i < (winExtensionAgent_name_length > MAX_OID_LEN? MAX_OID_LEN: winExtensionAgent_name_length); i++) {
+ var->name[i] = winExtensionAgent_name[i];
+ }
+ var->name_length = i;
+ var->name[i-1]++;
+
+ //return SNMP_ERR_NOSUCHNAME;
+
+ }
+ }
+ DEBUGMSGTL(("winExtDLL", "OID being sent back to Net-SNMP: "));
+ DEBUGMSGOID(("winExtDLL", var->name, var->name_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ DEBUGMSGTL(("winExtDLL", "win: Result of xSnmpExtensionQuery(Ex): %d\n",result));
+
+ DEBUGMSGTL(("winExtDLL", "win: Error status of xSnmpExtensionQuery(Ex): %d\n",pErrorStatus));
+
+ DEBUGMSGTL(("winExtDLL", "win: asnType: %d\n",pVarBindList.list->value.asnType));
+
+ // Set Net-SNMP ASN type based on closest match to Windows ASN type
+ switch (pVarBindList.list->value.asnType) {
+ case MS_ASN_OCTETSTRING:
+ netsnmp_ASN_type = ASN_OCTET_STR;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_OCTETSTRING = ASN_OCTET_STR\n"));
+ break;
+ case MS_ASN_INTEGER: // And MS_ASN_INTEGER32
+ netsnmp_ASN_type = ASN_INTEGER;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_INTEGER = ASN_INTEGER\n"));
+ break;
+ case MS_ASN_UNSIGNED32: // SNMP v2
+ netsnmp_ASN_type = ASN_UNSIGNED;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_UNSIGNED32 = ASN_UNSIGNED\n"));
+ break;
+ case MS_ASN_COUNTER64: // SNMP v2
+ netsnmp_ASN_type = ASN_COUNTER64;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_COUNTER64 = ASN_COUNTER64\n"));
+ break;
+ case MS_ASN_BITS:
+ netsnmp_ASN_type = ASN_BIT_STR;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_BITS = ASN_BIT_STR\n"));
+ break;
+ case MS_ASN_OBJECTIDENTIFIER:
+ netsnmp_ASN_type = ASN_OBJECT_ID;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_OBJECTIDENTIFIER = ASN_OBJECT_ID\n"));
+ break;
+ case MS_ASN_SEQUENCE:
+ netsnmp_ASN_type = ASN_SEQUENCE;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_SEQUENCE = ASN_SEQUENCE\n"));
+ break;
+ case MS_ASN_IPADDRESS:
+ netsnmp_ASN_type = ASN_IPADDRESS;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_IPADDRESS = ASN_IPADDRESS\n"));
+ break;
+ case MS_ASN_COUNTER32:
+ netsnmp_ASN_type = ASN_COUNTER;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_COUNTER32 = ASN_COUNTER\n"));
+ break;
+ case MS_ASN_GAUGE32:
+ netsnmp_ASN_type = ASN_GAUGE;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_GAUGE32 = ASN_GAUGE\n"));
+ break;
+ case MS_ASN_TIMETICKS:
+ netsnmp_ASN_type = ASN_TIMETICKS;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_TIMETICKS = ASN_TIMETICKS\n"));
+ break;
+ case MS_ASN_OPAQUE:
+ netsnmp_ASN_type = ASN_OPAQUE;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_OPAQUE = ASN_OPAQUE\n"));
+ break;
+ default:
+ netsnmp_ASN_type = ASN_INTEGER;
+ DEBUGMSGTL(("winExtDLL", "unknown MS ASN type. Defaulting to ASN_INTEGER\n"));
+ break;
+ }
+
+ DEBUGMSGTL(("winExtDLL", "Net-SNMP object type for returned value: %d\n",netsnmp_ASN_type));
+
+ switch (pVarBindList.list->value.asnType) {
+ case MS_ASN_IPADDRESS:
+ case MS_ASN_OCTETSTRING:
+
+ strncpy(ret_szbuf_temp, pVarBindList.list->value.asnValue.string.stream, (pVarBindList.list->value.asnValue.string.length >
+ SZBUF_MAX?SZBUF_MAX:pVarBindList.list->value.asnValue.string.length));
+
+ if (pVarBindList.list->value.asnValue.string.length < SZBUF_MAX)
+ ret_szbuf_temp[pVarBindList.list->value.asnValue.string.length] = '\0';
+ else
+ ret_szbuf_temp[SZBUF_MAX-1] = '\0';
+
+ // Printing strings that have a comma in them via DEBUGMSGTL doesn't work..
+ DEBUGMSGTL(("winExtDLL", "Note: Sometimes junk is outputted here even though the string is fine. Problem with DEBUGMSGTL?\n",ret_szbuf_temp));
+ DEBUGMSGTL(("winExtDLL", "win: String: %s\n",ret_szbuf_temp));
+ DEBUGMSGTL(("winExtDLL", "win: length of string response: %d\n",strlen(ret_szbuf_temp)));
+
+ snmp_set_var_typed_value(var, netsnmp_ASN_type,
+ ret_szbuf_temp,
+ strlen(ret_szbuf_temp));
+ //return SNMP_ERR_NOERROR;
+ break;
+
+ case MS_ASN_INTEGER: // And MS_ASN_INTEGER32
+ case MS_ASN_UNSIGNED32:
+ case MS_ASN_COUNTER64:
+ case MS_ASN_BITS:
+ case MS_ASN_SEQUENCE:
+ case MS_ASN_COUNTER32:
+ case MS_ASN_GAUGE32:
+ case MS_ASN_TIMETICKS:
+ case MS_ASN_OPAQUE:
+
+ DEBUGMSGTL(("winExtDLL", "win: Long: %ld\n",pVarBindList.list->value.asnValue.number));
+
+ ret_long = pVarBindList.list->value.asnValue.number;
+
+ // Return results
+ snmp_set_var_typed_value(var, netsnmp_ASN_type,
+ &ret_long,
+ sizeof(ret_long));
+ //return SNMP_ERR_NOERROR;
+ break;
+
+ case MS_ASN_OBJECTIDENTIFIER:
+ // Convert OID to Net-SNMP
+
+ DEBUGMSGTL(("winExtDLL", "Returned OID: "));
+ DEBUGMSGWINOID(("winExtDLL", &pVarBindList.list->value.asnValue.object));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ // Convert OID from Windows to Net-SNMP
+ for (i = 0; i < (pVarBindList.list->value.asnValue.object.idLength > MAX_OID_LEN?MAX_OID_LEN:
+ pVarBindList.list->value.asnValue.object.idLength); i++) {
+ ret_oid[i] = (oid)pVarBindList.list->value.asnValue.object.ids[i];
+ }
+ ret_oid_length = i;
+
+ DEBUGMSGTL(("winExtDLL", "Windows OID converted to Net-SNMP: "));
+ DEBUGMSGOID(("winExtDLL", ret_oid, ret_oid_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ snmp_set_var_typed_value(var, netsnmp_ASN_type,
+ ret_oid,
+ ret_oid_length * sizeof(oid));
+ //return SNMP_ERR_NOERROR;
+
+ break;
+
+ default:
+ // The Windows agent didn't return data so set values to NULL
+ // FIXME: We never get here. We set it to INTEGER above..
+ snmp_set_var_typed_value(var, NULL,
+ NULL,
+ NULL);
+ break;
+ }
+ if (&pVarBindList)
+ SnmpUtilVarBindListFree(&pVarBindList);
+ }
+ break;
+
+ case MODE_SET_RESERVE1:
+ case MODE_SET_RESERVE2:
+ case MODE_SET_ACTION:
+
+ DEBUGMSGTL(("winExtDLL", "SET requested\n"));
+
+ for (request = requests; request; request=request->next) {
+
+ var = request->requestvb;
+
+ DEBUGMSGTL(("winExtDLL", "requested: "));
+ DEBUGMSGOID(("winExtDLL", var->name, var->name_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ DEBUGMSGTL(("winExtDLL", "Var type requested: %d\n",var->type));
+
+ /* Loop through all the winExtensionAgent's looking for a matching handler */
+ xSnmpExtensionQuery = NULL;
+ xSnmpExtensionQueryEx = NULL;
+ for (i=0; winExtensionAgent[i].xSnmpExtensionInit && i < MAX_WINEXT_DLLS; i++) {
+ DEBUGMSGTL(("winExtDLL", "Looping through all the winExtensionAgent's looking for a matching handler.\n"));
+
+ if (snmp_oidtree_compare(var->name, var->name_length, winExtensionAgent[i].name,
+ winExtensionAgent[i].name_length) >= 0) {
+ DEBUGMSGTL(("winExtDLL", "Found match: "));
+ DEBUGMSGOID(("winExtDLL", winExtensionAgent[i].name, winExtensionAgent[i].name_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+ xSnmpExtensionQuery = winExtensionAgent[i].xSnmpExtensionQuery;
+ xSnmpExtensionQueryEx = winExtensionAgent[i].xSnmpExtensionQueryEx;
+ break;
+ }
+ }
+
+ if (! (xSnmpExtensionQuery || xSnmpExtensionQueryEx)) {
+ DEBUGMSGTL(("winExtDLL","Could not find a handler for the requested OID. This should never happen!!\n"));
+ return SNMP_ERR_GENERR;
+ }
+
+ // Set Windows ASN type based on closest match to Net-SNMP ASN type
+ switch (var->type) {
+ case ASN_OCTET_STR:
+ windows_ASN_type = MS_ASN_OCTETSTRING;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_OCTETSTRING = ASN_OCTET_STR\n"));
+ break;
+ case ASN_INTEGER: // And MS_ASN_INTEGER32
+ windows_ASN_type = MS_ASN_INTEGER;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_INTEGER = ASN_INTEGER\n"));
+ break;
+ case ASN_UNSIGNED:
+ windows_ASN_type = MS_ASN_UNSIGNED32;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_UNSIGNED32 = ASN_UNSIGNED\n"));
+ break;
+ case ASN_COUNTER64:
+ windows_ASN_type = MS_ASN_COUNTER64;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_COUNTER64 = ASN_COUNTER64\n"));
+ break;
+ case ASN_BIT_STR:
+ windows_ASN_type = MS_ASN_BITS;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_BITS = ASN_BIT_STR\n"));
+ break;
+ case ASN_OBJECT_ID:
+ windows_ASN_type = MS_ASN_OBJECTIDENTIFIER;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_OBJECTIDENTIFIER = ASN_OBJECT_ID\n"));
+ break;
+ case ASN_SEQUENCE:
+ windows_ASN_type = MS_ASN_SEQUENCE;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_SEQUENCE = ASN_SEQUENCE\n"));
+ break;
+ case ASN_IPADDRESS:
+ windows_ASN_type = MS_ASN_IPADDRESS;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_IPADDRESS = ASN_IPADDRESS\n"));
+ break;
+ case ASN_COUNTER:
+ windows_ASN_type = MS_ASN_COUNTER32;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_COUNTER32 = ASN_COUNTER\n"));
+ break;
+// case ASN_GAUGE: // Same as UNSIGNED
+// windows_ASN_type = MS_ASN_GAUGE32;
+// DEBUGMSGTL(("winExtDLL", "MS_ASN_GAUGE32 = ASN_GAUGE\n"));
+// break;
+ case ASN_TIMETICKS:
+ windows_ASN_type = MS_ASN_TIMETICKS;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_TIMETICKS = ASN_TIMETICKS\n"));
+ break;
+ case ASN_OPAQUE:
+ windows_ASN_type = MS_ASN_OPAQUE;
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_OPAQUE = ASN_OPAQUE\n"));
+ break;
+ default:
+ windows_ASN_type = MS_ASN_INTEGER;
+ DEBUGMSGTL(("winExtDLL", "unknown MS ASN type. Defaulting to ASN_INTEGER\n"));
+ break;
+ }
+
+ DEBUGMSGTL(("winExtDLL", "Net-SNMP object type for returned value: %d\n",windows_ASN_type));
+
+ // Query
+ pVarBindList.list = (SnmpVarBind *) SnmpUtilMemAlloc(sizeof (SnmpVarBind));
+ if (pVarBindList.list) {
+ // Convert OID from Net-SNMP to Windows
+ pVarBindList.list->name.ids = (UINT *) SnmpUtilMemAlloc(sizeof (UINT) *var->name_length);
+
+ if (pVarBindList.list->name.ids) {
+ // Actual copy
+ for (i = 0; i < var->name_length; i++) {
+ pVarBindList.list->name.ids[i] = (UINT)var->name[i];
+ }
+ pVarBindList.list->name.idLength = i;
+
+ // Print OID
+ DEBUGMSGTL(("winExtDLL","Windows OID length: %d\n",pVarBindList.list->name.idLength));
+ DEBUGMSGTL(("winExtDLL","Windows OID: "));
+ DEBUGMSGWINOID(("winExtDLL", pVarBindList.list));
+ DEBUGMSG(("winExtDLL", "\n"));
+ }
+ else {
+ DEBUGMSGTL(("winExtDLL", "\nyCould not allocate memory for Windows SNMP varbind.\n"));
+ return (0);
+ }
+ //pVarBindList.list = pVarBindList.list;
+ pVarBindList.len = 1;
+ }
+ else {
+ DEBUGMSGTL(("winExtDLL", "\nyCould not allocate memory for Windows SNMP varbind list.\n"));
+ return (0);
+ }
+
+ // Set Windows ASN type
+ pVarBindList.list->value.asnType = windows_ASN_type;
+
+ switch (var->type) {
+ case ASN_IPADDRESS:
+ case ASN_OCTET_STR:
+
+ strncpy(set_szbuf_temp, var->val.string, (var->val_len > SZBUF_MAX?SZBUF_MAX:var->val_len));
+
+ // Make sure string is terminated
+ set_szbuf_temp[var->val_len > SZBUF_MAX?SZBUF_MAX:var->val_len] = '\0';
+
+ DEBUGMSGTL(("winExtDLL", "String to write: %s\n",set_szbuf_temp));
+ DEBUGMSGTL(("winExtDLL", "Length of string to write: %d\n",strlen(set_szbuf_temp)));
+
+ pVarBindList.list->value.asnValue.string.stream = set_szbuf_temp;
+ pVarBindList.list->value.asnValue.string.length = strlen(set_szbuf_temp);
+ pVarBindList.list->value.asnValue.string.dynamic = 0;
+
+ break;
+
+ case ASN_INTEGER: // And MS_ASN_INTEGER32
+ case ASN_UNSIGNED:
+ case ASN_COUNTER64:
+ case ASN_BIT_STR:
+ case ASN_SEQUENCE:
+ case ASN_COUNTER:
+ case ASN_TIMETICKS:
+ case ASN_OPAQUE:
+
+ pVarBindList.list->value.asnValue.number = *(var->val.integer);
+ break;
+
+ case ASN_OBJECT_ID:
+
+ // Convert OID from Net-SNMP to Windows
+ temp_oid = var->val.objid;
+ temp_oid_length = var->val_len / sizeof(oid);
+
+ DEBUGMSGTL(("winExtDLL","Sizeof var->val.objid: %d\n", temp_oid_length));
+
+ DEBUGMSGTL(("winExtDLL","OID: from user "));
+ DEBUGMSGOID(("winExtDLL", temp_oid, temp_oid_length));
+ DEBUGMSG(("winExtDLL","\n"));
+
+ mySnmpVarBind->name.ids = (UINT *) SnmpUtilMemAlloc(sizeof (UINT) * temp_oid_length);
+
+ if (mySnmpVarBind->name.ids) {
+ // Actual copy
+ for (i = 0; i < temp_oid_length; i++) {
+ mySnmpVarBind->name.ids[i] = (UINT)temp_oid[i];
+ }
+ mySnmpVarBind->name.idLength = i;
+
+ // Print OID
+ DEBUGMSGTL(("winExtDLL","Windows OID length: %d\n",mySnmpVarBind->name.idLength));
+ DEBUGMSGTL(("winExtDLL","Windows OID: "));
+ DEBUGMSGWINOID(("winExtDLL", mySnmpVarBind));
+ DEBUGMSG(("winExtDLL", "\n"));
+ }
+ else {
+ DEBUGMSGTL(("winExtDLL", "\nyCould not allocate memory for Windows SNMP varbind.\n"));
+ return SNMP_ERR_GENERR;
+ }
+ SnmpUtilOidCpy(&pVarBindList.list->value.asnValue.object, &mySnmpVarBind->name);
+ //pVarBindList.list->value.asnValue.object = mySnmpVarBind->name;
+ if (mySnmpVarBind)
+ SnmpUtilVarBindFree(mySnmpVarBind);
+
+ default:
+ break;
+ }
+
+ if (xSnmpExtensionQueryEx) {
+ DEBUGMSGTL(("winExtDLL", "Calling xSnmpExtensionQueryEx\n"));
+ result = xSnmpExtensionQueryEx(SNMP_PDU_SET, 1, &pVarBindList, NULL, &pErrorStatus, &pErrorIndex);
+ }
+ else {
+ DEBUGMSGTL(("winExtDLL", "Calling xSnmpExtensionQuery\n"));
+ result = xSnmpExtensionQuery(SNMP_PDU_SET, &pVarBindList, &pErrorStatus, &pErrorIndex);
+ }
+
+ DEBUGMSGTL(("winExtDLL", "win: Result of xSnmpExtensionQuery: %d\n",result));
+ DEBUGMSGTL(("winExtDLL", "win: Error status of xSnmpExtensionQuery: %d\n",pErrorStatus));
+ DEBUGMSGTL(("winExtDLL", "win: asnType: %d\n",pVarBindList.list->value.asnType));
+
+ if (result == 0) {
+ DEBUGMSGTL(("winExtDLL", "\nyxWindows SnmpExtensionQuery failure.\n"));
+ return SNMP_ERR_GENERR;
+ }
+
+ if (&pVarBindList)
+ SnmpUtilVarBindListFree(&pVarBindList);
+
+ if (pErrorStatus) {
+ switch (pErrorStatus) {
+ case SNMP_ERRORSTATUS_INCONSISTENTNAME:
+ return SNMP_ERR_GENERR;
+ default:
+ return pErrorStatus;
+ break;
+ }
+ }
+ }
+ break;
+
+ case MODE_SET_UNDO:
+ case MODE_SET_COMMIT:
+ case MODE_SET_FREE:
+
+ break;
+
+ default:
+ snmp_log(LOG_WARNING, "unsupported mode for winExtDLL called (%d)\n",
+ reqinfo->mode);
+ return SNMP_ERR_NOERROR;
+ }
+
+ return SNMP_ERR_NOERROR;
+}
+
+void winExtDLL_free_config_winExtDLL(void) {
+}
+
+void read_ExtensionAgents_list() {
+ HKEY hKey;
+ unsigned char * key_value = NULL;
+ DWORD key_value_size = 0;
+ DWORD key_value_type = 0;
+ DWORD valueSize = MAX_VALUE_NAME;
+ int i;
+ TCHAR valueName[MAX_VALUE_NAME];
+ TCHAR valueName2[MAX_VALUE_NAME];
+ DWORD retCode;
+
+ DEBUGMSGTL(("winExtDLL", "read_ExtensionAgents_list called\n"));
+
+ /* The Windows SNMP service stores the list of extension agents to be loaded in the
+ * registry under HKLM\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\ExtensionAgents.
+ * This list contains a list of other keys that contain the actual file path to the DLL.
+ */
+
+ /* Open SYSTEM\\CurrentControlSet\\Services\\SNMP\\Parameters\\ExtensionAgent */
+ retCode = RegOpenKeyExA(
+ HKEY_LOCAL_MACHINE,
+ "SYSTEM\\CurrentControlSet\\Services\\SNMP\\Parameters\\ExtensionAgents",
+ 0,
+ KEY_QUERY_VALUE,
+ &hKey);
+
+ if (retCode == ERROR_SUCCESS) {
+ /* Enumerate list of extension agents. This is a list of other keys that contain the
+ * actual filename of the extension agent. */
+ for (i=0; retCode==ERROR_SUCCESS; i++)
+ {
+ valueSize = MAX_VALUE_NAME;
+ valueName[0] = '\0';
+ retCode = RegEnumValue(
+ hKey,
+ i,
+ valueName,
+ &valueSize,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+
+ if (retCode == ERROR_SUCCESS )
+ {
+ /* Get key name that contains the actual filename of the extension agent */
+ DEBUGMSGTL(("winExtDLL", "-----------------------------------------\n"));
+ DEBUGMSGTL(("winExtDLL", "Registry: (%d) %s\n", i+1, valueName));
+
+ key_value_size = MAX_VALUE_NAME;
+ if (RegQueryValueExA(
+ hKey,
+ valueName,
+ NULL,
+ &key_value_type,
+ valueName2,
+ &key_value_size) == ERROR_SUCCESS) {
+ }
+ DEBUGMSGTL(("winExtDLL", "key_value: %s\n",valueName2));
+ read_ExtensionAgents_list2(valueName2);
+ extDLLs_index++;
+ }
+ }
+ if (extDLLs_index)
+ extDLLs_index--;
+ }
+}
+
+void read_ExtensionAgents_list2(const TCHAR *keyName) {
+ HKEY hKey;
+ unsigned char * key_value = NULL;
+ DWORD key_value_size = 0;
+ DWORD key_value_type = 0;
+ DWORD valueSize = MAX_VALUE_NAME;
+ TCHAR valueName[MAX_VALUE_NAME];
+ TCHAR valueNameExpanded[MAX_VALUE_NAME];
+ int i;
+ DWORD retCode;
+
+ DEBUGMSGTL(("winExtDLL", "read_ExtensionAgents_list2 called\n"));
+ DEBUGMSGTL(("winExtDLL", "Registry: Opening key %s\n", keyName));
+
+ /* Open extension agent's key */
+ retCode = RegOpenKeyExA(
+ HKEY_LOCAL_MACHINE,
+ keyName,
+ 0,
+ KEY_QUERY_VALUE,
+ &hKey);
+
+ if (retCode == ERROR_SUCCESS) {
+ /* Read Pathname value */
+
+ DEBUGMSGTL(("winExtDLL", "Registry: Reading value for %s\n", keyName));
+
+ key_value_size = MAX_VALUE_NAME;
+ retCode = RegQueryValueExA(
+ hKey,
+ "Pathname",
+ NULL,
+ &key_value_type,
+ valueName,
+ &key_value_size);
+
+ if (retCode == ERROR_SUCCESS) {
+ valueName[key_value_size-1] = NULL; /* Make sure last element is a NULL */
+ DEBUGMSGTL(("winExtDLL", "Extension agent Pathname size: %d\n",key_value_size));
+ DEBUGMSGTL(("winExtDLL", "Extension agent Pathname: %s\n",valueName));
+
+ if (ExpandEnvironmentStrings(valueName, valueNameExpanded, MAX_VALUE_NAME)) {
+ DEBUGMSGTL(("winExtDLL", "Extension agent Pathname expanded: %s\n",valueNameExpanded));
+ if (extDLLs_index < MAX_WINEXT_DLLS) {
+
+ extDLLs[extDLLs_index] = strdup(valueNameExpanded);
+
+ if (extDLLs[extDLLs_index]) {
+ strcpy(extDLLs[extDLLs_index], valueNameExpanded );
+ DEBUGMSGTL(("winExtDLL", "Extension agent Pathname expanded extDLLs: %s\n",extDLLs[extDLLs_index]));
+ DEBUGMSGTL(("winExtDLL", "Extension agent Pathname size: %d\n",strlen(extDLLs[extDLLs_index])));
+ }
+ else {
+ DEBUGMSGTL(("winExtDLL", "Could not allocate memory for extDLLs[%d]\n",extDLLs_index));
+ }
+ }
+ }
+ else {
+ DEBUGMSGTL(("winExtDLL", "ExpandEnvironmentStrings failed\n"));
+ }
+ }
+ }
+}
+
+// Called by alarm to check for traps waiting to be processed.
+void subagentTrapCheck() {
+ DWORD dwWaitResult;
+ BOOL bResult;
+ int i;
+ netsnmp_variable_list *notification_vars = NULL;
+
+ // Windows SNMP
+ AsnObjectIdentifier pEnterprise;
+ AsnInteger pGenericTrap;
+ AsnInteger pSpecificTrap;
+ AsnTimeticks pTimeStamp;
+ SnmpVarBindList pVariableBindings;
+
+ DEBUGMSGTL(("winExtDLL", "subagentTrapMonitor called\n"));
+
+ dwWaitResult = WaitForMultipleObjects(
+ subagentTrapEvents_index,
+ subagentTrapEvents,
+ FALSE,
+ 0);
+
+ if (! (dwWaitResult) || (dwWaitResult == WAIT_TIMEOUT))
+ return;
+
+ DEBUGMSGTL(("winExtDLL", "---------------------------------------------\n"));
+ DEBUGMSGTL(("winExtDLL", "subagentTrapCheck found a trap event (index: %d)\n",dwWaitResult));
+
+ /* Loop through all the winExtensionAgent's looking for a matching handler */
+ for (i=0; winExtensionAgent[i].xSnmpExtensionInit && i < MAX_WINEXT_DLLS; i++) {
+ DEBUGMSGTL(("winExtDLL", "Looping through all the winExtensionAgent's looking for a matching trap handler.\n"));
+
+ if (winExtensionAgent[i].subagentTrapEvent == subagentTrapEvents[dwWaitResult]) {
+ DEBUGMSGTL(("winExtDLL", "Found match: "));
+ DEBUGMSGOID(("winExtDLL", winExtensionAgent[i].name, winExtensionAgent[i].name_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ if (winExtensionAgent[i].xSnmpExtensionTrap)
+ DEBUGMSGTL(("winExtDLL", "xSnmpExtensionTrap exists for this subagent\n"));
+ else {
+ DEBUGMSGTL(("winExtDLL", "xSnmpExtensionTrap does NOT exist for this subagent\n"));
+ continue;
+ }
+
+ pEnterprise.ids = NULL;
+ pEnterprise.idLength = 0;
+ pGenericTrap = pSpecificTrap = NULL;
+ pTimeStamp = 0;
+ pVariableBindings.list = NULL;
+ pVariableBindings.len = 0;
+
+ DEBUGMSGTL(("winExtDLL", "Calling SnmpExtensionTrap\n"));
+ bResult = winExtensionAgent[i].xSnmpExtensionTrap(
+ &pEnterprise,
+ &pGenericTrap,
+ &pSpecificTrap,
+ &pTimeStamp,
+ &pVariableBindings);
+
+ DEBUGMSGTL(("winExtDLL", "result of SnmpExtensionTrap call: %d\n",bResult));
+
+
+ DEBUGMSGTL(("winExtDLL", "GenericTrap: %d\n",pGenericTrap));
+ DEBUGMSGTL(("winExtDLL", "SpecificTrap: %d\n",pSpecificTrap));
+
+ if (pEnterprise.idLength)
+ DEBUGMSGTL(("winExtDLL", "pEnterprise is not 0\n"));
+ else
+ DEBUGMSGTL(("winExtDLL", "pEnterprise is 0\n"));
+
+ // Assume that if enterprise length is >0, it's a real trap and not a cleanup call
+ // FIXME: Not sure if this is correct. Need to test with agent that sends a non-enterprise trap
+ if (pEnterprise.idLength) {
+
+ // Send the trap
+ send_trap(
+ &pEnterprise,
+ &pGenericTrap,
+ &pSpecificTrap,
+ &pTimeStamp,
+ &pVariableBindings);
+ }
+
+ // Look for more traps from this agent (if result is TRUE there are more traps)
+ while(bResult) {
+ DEBUGMSGTL(("winExtDLL", "More traps to process. Calling SnmpExtensionTrap again\n"));
+
+ pEnterprise.ids = NULL;
+ pEnterprise.idLength = 0;
+ pGenericTrap = pSpecificTrap = NULL;
+ pTimeStamp = 0;
+ pVariableBindings.list = NULL;
+ pVariableBindings.len = 0;
+
+ bResult = winExtensionAgent[i].xSnmpExtensionTrap(
+ &pEnterprise,
+ &pGenericTrap,
+ &pSpecificTrap,
+ &pTimeStamp,
+ &pVariableBindings);
+
+ DEBUGMSGTL(("winExtDLL", "result of SnmpExtensionTrap call: %d\n",bResult));
+
+ // Assume that if enterprise length is >0, it's a real trap and not a cleanup call
+ // FIXME: Not sure if this is correct. Need to test with agent that sends a non-enterprise trap
+ if (pEnterprise.idLength) {
+
+ DEBUGMSGTL(("winExtDLL", "GenericTrap: %d\n",pGenericTrap));
+ DEBUGMSGTL(("winExtDLL", "SpecificTrap: %d\n",pSpecificTrap));
+
+ if (pEnterprise.idLength)
+ DEBUGMSGTL(("winExtDLL", "pEnterprise is not 0\n"));
+ else
+ DEBUGMSGTL(("winExtDLL", "pEnterprise is 0\n"));
+
+ // Send the trap
+ send_trap(
+ &pEnterprise,
+ &pGenericTrap,
+ &pSpecificTrap,
+ &pTimeStamp,
+ &pVariableBindings);
+ }
+ SnmpUtilVarBindListFree(&pVariableBindings);
+ }
+ break;
+ }
+ }
+
+ // Events should be auto-reset, but just in case..
+ ResetEvent(dwWaitResult);
+
+ return 1;
+}
+
+
+void send_trap(
+ AsnObjectIdentifier *pEnterprise,
+ AsnInteger *pGenericTrap,
+ AsnInteger *pSpecificTrap,
+ AsnTimeticks *pTimeStamp,
+ SnmpVarBindList *pVariableBindings) {
+
+ int i, j;
+ SnmpVarBind mySnmpVarBind;
+ oid my_oid[MAX_OID_LEN]; // Holder for pVariableBindings OIDs
+ size_t my_oid_length = 0; // Holder for pVariableBindings OIDs
+
+ oid enterprise_oid[MAX_OID_LEN]; // Holder for enterprise OID
+ size_t enterprise_oid_length = 0; // Holder for enterprise OID
+
+ oid ret_oid[MAX_OID_LEN]; // Holder for return OIDs
+ size_t ret_oid_length = 0; // Holder for return OIDs
+
+ char *stringtemp;
+
+ /*
+ * here is where we store the variables to be sent in the trap
+ */
+ netsnmp_variable_list *notification_vars = NULL;
+
+ /*
+ * In the notification, we have to assign our notification OID to
+ * the snmpTrapOID.0 object. Here is it's definition.
+ */
+ oid objid_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
+ size_t objid_snmptrap_len = OID_LENGTH(objid_snmptrap);
+
+ DEBUGMSGTL(("winExtDLL", "send_trap() called\n"));
+ DEBUGMSGTL(("winExtDLL", "pVariableBindings length: %d\n",pVariableBindings->len));
+
+ if (*pGenericTrap != 6) {
+ DEBUGMSGTL(("winExtDLL", "Working on generic trap\n"));
+ DEBUGMSGTL(("winExtDLL", "sending v1 trap\n"));
+ send_easy_trap(*pGenericTrap, *pSpecificTrap);
+ return;
+ }
+
+ // Convert enterprise OID from Windows to Net-SNMP so Net-SNMP
+ for (j = 0; j < (pEnterprise->idLength > MAX_OID_LEN?MAX_OID_LEN:pEnterprise->idLength); j++) {
+ enterprise_oid[j] = (oid)pEnterprise->ids[j];
+ }
+ enterprise_oid_length = j;
+
+ DEBUGMSGTL(("winExtDLL", "Enterprise OID: "));
+ DEBUGMSGOID(("winExtDLL", enterprise_oid, enterprise_oid_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ // We need to copy .0.specific trap to copy of enterprise and use that for objid_snmptrap!!
+
+ for (i = 0; i < enterprise_oid_length; i++) {
+ my_oid[i] = enterprise_oid[i];
+ }
+ my_oid_length = i;
+
+ my_oid[my_oid_length] = 0;
+ my_oid_length++;
+
+ my_oid[my_oid_length] = *pSpecificTrap;
+ my_oid_length++;
+
+ DEBUGMSGTL(("winExtDLL", "Trap OID (snmpTrapOID.0): "));
+ DEBUGMSGOID(("winExtDLL", my_oid, my_oid_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ /*
+ * add in the trap definition object
+ */
+ snmp_varlist_add_variable(&notification_vars,
+ /*
+ * the snmpTrapOID.0 variable
+ */
+ objid_snmptrap, objid_snmptrap_len,
+ /*
+ * value type is an OID
+ */
+ ASN_OBJECT_ID,
+ /*
+ * value contents is our notification OID
+ */
+ (u_char *) my_oid,
+ /*
+ * size in bytes
+ */
+ my_oid_length * sizeof(oid));
+
+ for (i = 0; i< pVariableBindings->len; i++) {
+
+ mySnmpVarBind = pVariableBindings->list[i];
+
+ // Convert OID from Windows to Net-SNMP so Net-SNMP
+ for (j = 0; j < (mySnmpVarBind.name.idLength > MAX_OID_LEN?MAX_OID_LEN:mySnmpVarBind.name.idLength); j++) {
+ my_oid[j] = (oid)mySnmpVarBind.name.ids[j];
+ }
+ my_oid_length = j;
+
+ DEBUGMSGTL(("winExtDLL", "OID in trap variable binding: "));
+ DEBUGMSGOID(("winExtDLL", my_oid, my_oid_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ // Set Net-SNMP ASN type based on closest match to Windows ASN type
+ switch (mySnmpVarBind.value.asnType) {
+ case MS_ASN_OCTETSTRING: // AsnOctetString
+ stringtemp = netsnmp_strdup_and_null(mySnmpVarBind.value.asnValue.string.stream, mySnmpVarBind.value.asnValue.string.length);
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_OCTETSTRING = ASN_OCTET_STR\n"));
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_OCTETSTRING = %s\n",stringtemp));
+ snmp_varlist_add_variable(&notification_vars,
+ my_oid, my_oid_length,
+ ASN_OCTET_STR,
+ stringtemp,
+ strlen(stringtemp));
+ break;
+ case MS_ASN_INTEGER: // And MS_ASN_INTEGER32
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_INTEGER = ASN_INTEGER\n"));
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_INTEGER = %d\n",mySnmpVarBind.value.asnValue.number));
+ snmp_varlist_add_variable(&notification_vars,
+ my_oid, my_oid_length,
+ ASN_INTEGER,
+ (u_char *)&mySnmpVarBind.value.asnValue.number,
+ sizeof(mySnmpVarBind.value.asnValue.number));
+ break;
+ case MS_ASN_UNSIGNED32: // SNMP v2
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_UNSIGNED32 = ASN_UNSIGNED\n"));
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_UNSIGNED32 = %d\n",mySnmpVarBind.value.asnValue.unsigned32));
+ snmp_varlist_add_variable(&notification_vars,
+ my_oid, my_oid_length,
+ ASN_UNSIGNED,
+ (u_char *)&mySnmpVarBind.value.asnValue.unsigned32,
+ sizeof(mySnmpVarBind.value.asnValue.unsigned32));
+ break;
+ case MS_ASN_COUNTER64: // SNMP v2
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_COUNTER64 = ASN_COUNTER64\n"));
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_COUNTER64 = %d\n",mySnmpVarBind.value.asnValue.counter64));
+ snmp_varlist_add_variable(&notification_vars,
+ my_oid, my_oid_length,
+ ASN_COUNTER64,
+ (u_char *)&mySnmpVarBind.value.asnValue.counter64,
+ sizeof(mySnmpVarBind.value.asnValue.counter64));
+ break;
+ case MS_ASN_BITS: // AsnOctetString
+ stringtemp = netsnmp_strdup_and_null(mySnmpVarBind.value.asnValue.bits.stream, mySnmpVarBind.value.asnValue.bits.length);
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_BITS = ASN_BIT_STR\n"));
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_BITS = %s\n",stringtemp));
+ snmp_varlist_add_variable(&notification_vars,
+ my_oid, my_oid_length,
+ ASN_BIT_STR,
+ stringtemp,
+ strlen(stringtemp));
+ break;
+ case MS_ASN_OBJECTIDENTIFIER: // AsnObjectIdentifier
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_OBJECTIDENTIFIER = ASN_OBJECT_ID\n"));
+ // Convert OID to Net-SNMP
+
+ DEBUGMSGTL(("winExtDLL", "Returned OID: "));
+ DEBUGMSGWINOID(("winExtDLL", &mySnmpVarBind.value.asnValue.object));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ // Convert OID from Windows to Net-SNMP
+ for (i = 0; i < (mySnmpVarBind.value.asnValue.object.idLength > MAX_OID_LEN?MAX_OID_LEN:
+ mySnmpVarBind.value.asnValue.object.idLength); i++) {
+ ret_oid[i] = (oid)mySnmpVarBind.value.asnValue.object.ids[i];
+ }
+ ret_oid_length = i;
+
+ DEBUGMSGTL(("winExtDLL", "Windows OID converted to Net-SNMP: "));
+ DEBUGMSGOID(("winExtDLL", ret_oid, ret_oid_length));
+ DEBUGMSG(("winExtDLL", "\n"));
+
+ snmp_varlist_add_variable(&notification_vars,
+ my_oid, my_oid_length,
+ ASN_OBJECT_ID,
+ (u_char *)&ret_oid,
+ ret_oid_length * sizeof(oid));
+ break;
+ case MS_ASN_SEQUENCE: // AsnOctetString
+ stringtemp = netsnmp_strdup_and_null(mySnmpVarBind.value.asnValue.sequence.stream, mySnmpVarBind.value.asnValue.sequence.length);
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_SEQUENCE = ASN_SEQUENCE\n"));
+ snmp_varlist_add_variable(&notification_vars,
+ my_oid, my_oid_length,
+ ASN_SEQUENCE,
+ stringtemp,
+ strlen(stringtemp));
+ break;
+ case MS_ASN_IPADDRESS: // AsnOctetString
+ stringtemp = netsnmp_strdup_and_null(mySnmpVarBind.value.asnValue.address.stream, mySnmpVarBind.value.asnValue.address.length);
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_IPADDRESS = ASN_IPADDRESS\n"));
+ snmp_varlist_add_variable(&notification_vars,
+ my_oid, my_oid_length,
+ ASN_IPADDRESS,
+ stringtemp,
+ strlen(stringtemp));
+ break;
+ case MS_ASN_COUNTER32:
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_COUNTER32 = ASN_COUNTER\n"));
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_COUNTER32 = %d\n",mySnmpVarBind.value.asnValue.counter));
+ snmp_varlist_add_variable(&notification_vars,
+ my_oid, my_oid_length,
+ ASN_COUNTER,
+ (u_char *)&mySnmpVarBind.value.asnValue.counter,
+ sizeof(mySnmpVarBind.value.asnValue.counter));
+ break;
+ case MS_ASN_GAUGE32:
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_GAUGE32 = ASN_GAUGE\n"));
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_GAUGE32 = %d\n",mySnmpVarBind.value.asnValue.gauge));
+ snmp_varlist_add_variable(&notification_vars,
+ my_oid, my_oid_length,
+ ASN_GAUGE,
+ (u_char *)&mySnmpVarBind.value.asnValue.gauge,
+ sizeof(mySnmpVarBind.value.asnValue.gauge));
+ break;
+ case MS_ASN_TIMETICKS:
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_TIMETICKS = ASN_TIMETICKS\n"));
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_TIMETICKS = %d\n",mySnmpVarBind.value.asnValue.ticks));
+ snmp_varlist_add_variable(&notification_vars,
+ my_oid, my_oid_length,
+ ASN_TIMETICKS,
+ (u_char *)&mySnmpVarBind.value.asnValue.ticks,
+ sizeof(mySnmpVarBind.value.asnValue.ticks));
+ break;
+ case MS_ASN_OPAQUE: // AsnOctetString
+ stringtemp = netsnmp_strdup_and_null(mySnmpVarBind.value.asnValue.arbitrary.stream, mySnmpVarBind.value.asnValue.arbitrary.length);
+ DEBUGMSGTL(("winExtDLL", "MS_ASN_OPAQUE = ASN_OPAQUE\n"));
+ snmp_varlist_add_variable(&notification_vars,
+ my_oid, my_oid_length,
+ ASN_OPAQUE,
+ stringtemp,
+ strlen(stringtemp)); break;
+ default:
+ DEBUGMSGTL(("winExtDLL", "Defaulting to ASN_INTEGER\n"));
+ break;
+ }
+ }
+ /*
+ * send the trap out. This will send it to all registered
+ * receivers (see the "SETTING UP TRAP AND/OR INFORM DESTINATIONS"
+ * section of the snmpd.conf manual page.
+ */
+
+ DEBUGMSGTL(("winExtDLL", "sending v2 trap\n"));
+ send_v2trap(notification_vars);
+
+ /*
+ * free the created notification variable list
+ */
+ DEBUGMSGTL(("winExtDLL", "cleaning up\n"));
+ snmp_free_varbind(notification_vars);
+}
+
+/* DEBUGMSGWINOID */
+void
+debugmsg_win_oid(const char *token, const AsnObjectIdentifier * theoid)
+{
+ u_char buf[1024];
+ u_char temp[10];
+ size_t buf_len = 0, out_len = 0;
+ int i;
+
+ buf[0] = '\0';
+
+ for (i = 0; i < theoid->idLength; i++) {
+ sprintf(temp, ".%d", theoid->ids[i]);
+ strcat(buf, temp);
+ }
+
+ if (buf != NULL) {
+ debugmsg(token, "%s", buf);
+ //DEBUGMSGTL((token, "%s\n", buf));
+ }
+}
+
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/winExtDLL.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/winExtDLL.h
new file mode 100755
index 0000000000..b13ab23977
--- /dev/null
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/winExtDLL.h
@@ -0,0 +1,34 @@
+/*
+ * Don't include ourselves twice
+ */
+#ifndef _WINEXTDLL_H
+#define _WINEXTDLL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * We use 'header_generic' from the util_funcs module,
+ * so make sure this module is included in the agent.
+ */
+config_require(util_funcs)
+
+
+ /*
+ * Declare our publically-visible functions.
+ * Typically, these will include the initialization and shutdown functions,
+ * the main request callback routine and any writeable object methods.
+ *
+ * Function prototypes are provided for the callback routine ('FindVarMethod')
+ * and writeable object methods ('WriteMethod').
+ */
+ void init_winExtDLL(void);
+
+ Netsnmp_Node_Handler var_winExtDLL;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _WINEXTDLL_H */