| 1 |
/* |
| 2 |
* snmpTlstmSession |
| 3 |
*/ |
| 4 |
|
| 5 |
#include <net-snmp/net-snmp-config.h> |
| 6 |
#include <net-snmp/net-snmp-includes.h> |
| 7 |
#include <net-snmp/agent/net-snmp-agent-includes.h> |
| 8 |
|
| 9 |
#include "tlstm-mib.h" |
| 10 |
#include "snmpTlstmSession.h" |
| 11 |
|
| 12 |
static netsnmp_handler_registration* _myreg = NULL; |
| 13 |
|
| 14 |
/** Initializes the snmpTlstmSession module */ |
| 15 |
void |
| 16 |
init_snmpTlstmSession(void) |
| 17 |
{ |
| 18 |
static oid myoid[] = { SNMP_TLS_TM_BASE, 2, 1 }; |
| 19 |
int rc; |
| 20 |
|
| 21 |
DEBUGMSGTL(("tlstmSession", "Initializing\n")); |
| 22 |
|
| 23 |
_myreg = netsnmp_create_handler_registration("snmpTlstmSession", NULL, |
| 24 |
myoid, OID_LENGTH(myoid), |
| 25 |
HANDLER_CAN_RONLY); |
| 26 |
if (NULL == _myreg) { |
| 27 |
snmp_log(LOG_ERR, "failed to create handler registration for " |
| 28 |
"snmpTlstmSession\n"); |
| 29 |
return; |
| 30 |
} |
| 31 |
|
| 32 |
rc = NETSNMP_REGISTER_STATISTIC_HANDLER(_myreg, 1, TLSTM); |
| 33 |
if (MIB_REGISTERED_OK != rc) { |
| 34 |
snmp_log(LOG_ERR, "failed to register snmpTlstmSession mdoule\n"); |
| 35 |
netsnmp_handler_registration_free(_myreg); |
| 36 |
_myreg = NULL; |
| 37 |
} |
| 38 |
|
| 39 |
} |
| 40 |
|
| 41 |
|
| 42 |
void |
| 43 |
shutdown_snmpTlstmSession(void) |
| 44 |
{ |
| 45 |
if (_myreg) { |
| 46 |
netsnmp_unregister_handler(_myreg); |
| 47 |
_myreg = NULL; |
| 48 |
} |
| 49 |
} |