| 1 |
/* |
| 2 |
* snmpMPDStats.c: tallies errors for SNMPv3 message processing. |
| 3 |
* |
| 4 |
* Portions of this file are subject to the following copyright(s). See |
| 5 |
* the Net-SNMP's COPYING file for more details and other copyrights |
| 6 |
* that may apply: |
| 7 |
* |
| 8 |
* Portions of this file are copyrighted by: |
| 9 |
* Copyright (c) 2016 VMware, Inc. All rights reserved. |
| 10 |
* Use is subject to license terms specified in the COPYING file |
| 11 |
* distributed with the Net-SNMP package. |
| 12 |
*/ |
| 13 |
|
| 14 |
#include <net-snmp/net-snmp-config.h> |
| 15 |
|
| 16 |
#include <net-snmp/net-snmp-features.h> |
| 17 |
|
| 18 |
#include <net-snmp/net-snmp-includes.h> |
| 19 |
#include <net-snmp/agent/net-snmp-agent-includes.h> |
| 20 |
#include <net-snmp/agent/sysORTable.h> |
| 21 |
|
| 22 |
#include "snmpMPDStats.h" |
| 23 |
|
| 24 |
#include <net-snmp/agent/snmp_get_statistic.h> |
| 25 |
|
| 26 |
#define snmpMPDMIB 1, 3, 6, 1, 6, 3, 11 |
| 27 |
#define snmpMPDMIBObjects snmpMPDMIB, 2 |
| 28 |
#define snmpMPDMIBCompliances snmpMPDMIB, 3, 1 |
| 29 |
|
| 30 |
netsnmp_feature_require(helper_statistics); |
| 31 |
|
| 32 |
static oid snmpMPDStats[] = { snmpMPDMIBObjects, 1 }; |
| 33 |
|
| 34 |
static netsnmp_handler_registration* snmpMPDStats_reg = NULL; |
| 35 |
static oid snmpMPDCompliance[] = { snmpMPDMIBCompliances, 1 }; |
| 36 |
|
| 37 |
void |
| 38 |
init_snmpMPDStats(void) |
| 39 |
{ |
| 40 |
netsnmp_handler_registration* s = |
| 41 |
netsnmp_create_handler_registration( |
| 42 |
"snmpMPDStats", NULL, snmpMPDStats, OID_LENGTH(snmpMPDStats), |
| 43 |
HANDLER_CAN_RONLY); |
| 44 |
if (!s) |
| 45 |
return; |
| 46 |
|
| 47 |
if (NETSNMP_REGISTER_STATISTIC_HANDLER(s, 1, MPD) != MIB_REGISTERED_OK) |
| 48 |
return; |
| 49 |
|
| 50 |
REGISTER_SYSOR_ENTRY(snmpMPDCompliance, |
| 51 |
"The MIB for Message Processing and Dispatching."); |
| 52 |
snmpMPDStats_reg = s; |
| 53 |
} |
| 54 |
|
| 55 |
void |
| 56 |
shutdown_snmpMPDStats(void) |
| 57 |
{ |
| 58 |
UNREGISTER_SYSOR_ENTRY(snmpMPDCompliance); |
| 59 |
if (snmpMPDStats_reg) { |
| 60 |
netsnmp_unregister_handler(snmpMPDStats_reg); |
| 61 |
snmpMPDStats_reg = NULL; |
| 62 |
} |
| 63 |
} |