use of org.snmp4j.security.Priv3DES in project openhab1-addons by openhab.
the class SnmpBinding method listen.
/**
* Configures a {@link DefaultUdpTransportMapping} and starts listening on
* <code>SnmpBinding.port</code> for incoming SNMP Traps.
*/
private void listen() {
UdpAddress address = new UdpAddress(SnmpBinding.port);
try {
if (transport != null) {
transport.close();
transport = null;
}
if (snmp != null) {
snmp.close();
snmp = null;
}
transport = new DefaultUdpTransportMapping(address);
// add all security protocols
SecurityProtocols.getInstance().addDefaultProtocols();
SecurityProtocols.getInstance().addPrivacyProtocol(new Priv3DES());
// Create Target
if (SnmpBinding.community != null) {
CommunityTarget target = new CommunityTarget();
target.setCommunity(new OctetString(SnmpBinding.community));
}
snmp = new Snmp(transport);
transport.listen();
logger.debug("SNMP binding is listening on " + address);
} catch (IOException ioe) {
logger.error("SNMP binding couldn't listen to " + address, ioe);
}
}
Aggregations