本文整理汇总了Java中org.snmp4j.security.SecurityLevel.NOAUTH_NOPRIV属性的典型用法代码示例。如果您正苦于以下问题:Java SecurityLevel.NOAUTH_NOPRIV属性的具体用法?Java SecurityLevel.NOAUTH_NOPRIV怎么用?Java SecurityLevel.NOAUTH_NOPRIV使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.snmp4j.security.SecurityLevel
的用法示例。
在下文中一共展示了SecurityLevel.NOAUTH_NOPRIV属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendTest
public void sendTest(String agentAddress, int port, String community, PDU pdu) {
for (RegistrationInfo info : s_registrations.values()) {
if (port == info.getPort()) {
Snmp snmp = info.getSession();
MessageDispatcher dispatcher = snmp.getMessageDispatcher();
TransportMapping transport = info.getTransportMapping();
int securityModel = (pdu instanceof PDUv1 ? SecurityModel.SECURITY_MODEL_SNMPv1 :SecurityModel.SECURITY_MODEL_SNMPv2c);
int messageModel = (pdu instanceof PDUv1 ? MessageProcessingModel.MPv1 : MessageProcessingModel.MPv2c);
CommandResponderEvent e = new CommandResponderEvent(dispatcher, transport, new IpAddress(agentAddress), messageModel,
securityModel, community.getBytes(),
SecurityLevel.NOAUTH_NOPRIV, new PduHandle(), pdu, 1000, null);
info.getHandler().processPdu(e);
}
}
}
示例2: convertSecurityLevel
/**
* This method adapts the OpenNMS SNMPv3 security level constants
* to SNMP4J defined constants.
*
* @param securityLevel
* @return
*/
private int convertSecurityLevel(int securityLevel) {
switch (securityLevel) {
case SnmpAgentConfig.AUTH_NOPRIV :
securityLevel = SecurityLevel.AUTH_NOPRIV;
break;
case SnmpAgentConfig.AUTH_PRIV :
securityLevel = SecurityLevel.AUTH_PRIV;
break;
case SnmpAgentConfig.NOAUTH_NOPRIV :
securityLevel = SecurityLevel.NOAUTH_NOPRIV;
break;
default :
securityLevel = SecurityLevel.NOAUTH_NOPRIV;
}
return securityLevel;
}