3 * usmStats.c: implements the usmStats portion of the SNMP-USER-BASED-SM-MIB
6 #include <net-snmp/net-snmp-config.h>
12 #include <net-snmp/net-snmp-includes.h>
13 #include <net-snmp/agent/net-snmp-agent-includes.h>
15 #include "util_funcs.h"
16 #include "mibII/sysORTable.h"
19 struct variable2 usmStats_variables[] = {
20 {USMSTATSUNSUPPORTEDSECLEVELS, ASN_COUNTER, RONLY, var_usmStats, 1,
22 {USMSTATSNOTINTIMEWINDOWS, ASN_COUNTER, RONLY, var_usmStats, 1, {2}},
23 {USMSTATSUNKNOWNUSERNAMES, ASN_COUNTER, RONLY, var_usmStats, 1, {3}},
24 {USMSTATSUNKNOWNENGINEIDS, ASN_COUNTER, RONLY, var_usmStats, 1, {4}},
25 {USMSTATSWRONGDIGESTS, ASN_COUNTER, RONLY, var_usmStats, 1, {5}},
26 {USMSTATSDECRYPTIONERRORS, ASN_COUNTER, RONLY, var_usmStats, 1, {6}},
30 * now load this mib into the agents mib table
32 oid usmStats_variables_oid[] = { 1, 3, 6, 1, 6, 3, 15, 1, 1 };
38 #ifdef USING_MIBII_SYSORTABLE_MODULE
39 static oid reg[] = { 1, 3, 6, 1, 6, 3, 15, 2, 1, 1 };
40 register_sysORTable(reg, 10,
41 "The management information definitions for the SNMP User-based Security Model.");
44 REGISTER_MIB("snmpv3/usmStats", usmStats_variables, variable2,
45 usmStats_variables_oid);
49 var_usmStats(struct variable *vp,
52 int exact, size_t * var_len, WriteMethod ** write_method)
56 * variables we may use later
61 *write_method = 0; /* assume it isnt writable for the time being */
62 *var_len = sizeof(long_ret); /* assume an integer and change later if not */
64 if (header_generic(vp, name, length, exact, var_len, write_method))
68 * this is where we do the value assignments for the mib results.
72 && (tmagic <= (STAT_USM_STATS_END - STAT_USM_STATS_START))) {
73 long_ret = snmp_get_statistic(tmagic + STAT_USM_STATS_START);
74 return (unsigned char *) &long_ret;