本文整理了Java中org.snmp4j.Snmp.getMessageProcessingModel()
方法的一些代码示例,展示了Snmp.getMessageProcessingModel()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Snmp.getMessageProcessingModel()
方法的具体详情如下:
包路径:org.snmp4j.Snmp
类名称:Snmp
方法名:getMessageProcessingModel
[英]Gets the message processing model for the supplied ID.
[中]获取所提供ID的消息处理模型。
代码示例来源:origin: org.kaazing/snmp4j
private MPv3 getMPv3() {
MPv3 mpv3 = (MPv3) getMessageProcessingModel(MessageProcessingModel.MPv3);
if (mpv3 == null) {
throw new NoSuchElementException("MPv3 not available");
}
return mpv3;
}
代码示例来源:origin: org.snmp4j/snmp4j
private MPv3 getMPv3() {
MPv3 mpv3 = (MPv3) getMessageProcessingModel(MessageProcessingModel.MPv3);
if (mpv3 == null) {
throw new NoSuchElementException("MPv3 not available");
}
return mpv3;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
private MPv3 getMPv3() {
MPv3 mpv3 = (MPv3) getMessageProcessingModel(MessageProcessingModel.MPv3);
if (mpv3 == null) {
throw new NoSuchElementException("MPv3 not available");
}
return mpv3;
}
代码示例来源:origin: org.snmp4j/snmp4j
/**
* Gets the User Based Security Model (USM). This is a convenience method
* that uses the {@link MPv3#getSecurityModel} method of the associated MPv3
* instance to get the USM.
*
* @return the <code>USM</code> instance associated with the MPv3 bound to this
* <code>Snmp</code> instance, or <code>null</code> otherwise.
*/
public USM getUSM() {
MPv3 mp = (MPv3) getMessageProcessingModel(MPv3.ID);
if (mp != null) {
return (USM) mp.getSecurityModel(SecurityModel.SECURITY_MODEL_USM);
}
return null;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
/**
* Gets the User Based Security Model (USM). This is a convenience method
* that uses the {@link MPv3#getSecurityModel} method of the associated MPv3
* instance to get the USM.
* @return
* the <code>USM</code> instance associated with the MPv3 bound to this
* <code>Snmp</code> instance, or <code>null</code> otherwise.
*/
public USM getUSM() {
MPv3 mp = (MPv3) getMessageProcessingModel(MPv3.ID);
if (mp != null) {
return (USM)mp.getSecurityModel(SecurityModel.SECURITY_MODEL_USM);
}
return null;
}
代码示例来源:origin: org.kaazing/snmp4j
/**
* Gets the User Based Security Model (USM). This is a convenience method
* that uses the {@link MPv3#getSecurityModel} method of the associated MPv3
* instance to get the USM.
* @return
* the <code>USM</code> instance associated with the MPv3 bound to this
* <code>Snmp</code> instance, or <code>null</code> otherwise.
*/
public USM getUSM() {
MPv3 mp = (MPv3) getMessageProcessingModel(MPv3.ID);
if (mp != null) {
return (USM)mp.getSecurityModel(SecurityModel.SECURITY_MODEL_USM);
}
return null;
}
代码示例来源:origin: net.itransformers.snmp2xml4j/snmptoolkit
((MPv3) snmp.getMessageProcessingModel(MPv3.ID)).setLocalEngineID(new OctetString(MPv3.createLocalEngineID()).getValue());
代码示例来源:origin: oVirt/ovirt-engine
private org.snmp4j.Snmp createSnmp3(Profile profile) {
try {
TransportMapping<?> transport = new DefaultUdpTransportMapping();
org.snmp4j.Snmp snmp = new org.snmp4j.Snmp(transport);
SecurityProtocols securityProtocols = SecurityProtocols.getInstance();
securityProtocols.addDefaultProtocols();
securityProtocols.addAuthenticationProtocol(new AuthMD5());
securityProtocols.addAuthenticationProtocol(new AuthSHA());
securityProtocols.addPrivacyProtocol(new PrivAES128());
securityProtocols.addPrivacyProtocol(new PrivAES192());
securityProtocols.addPrivacyProtocol(new PrivAES256());
USM usm = new USM(securityProtocols, profile.engineId, 0);
((org.snmp4j.mp.MPv3) snmp.getMessageProcessingModel(org.snmp4j.mp.MPv3.ID))
.setLocalEngineID(profile.engineId.getValue());
((org.snmp4j.mp.MPv3) snmp.getMessageProcessingModel(org.snmp4j.mp.MPv3.ID))
.getSecurityModels().addSecurityModel(usm);
SecurityModels.getInstance().addSecurityModel(
usm);
transport.listen();
snmp.getUSM().addUser(
profile.username,
getUsmUser(profile));
return snmp;
} catch (IOException e) {
throw new NotificationServiceException("error creating version 3 snmp " + getClass().getName());
}
}
代码示例来源:origin: net.itransformers.snmp2xml4j/snmptoolkit
MessageDispatcher dispatcher = messageDispatcherFactory.createMessageDispatcherMapping();
Snmp snmp = new Snmp(dispatcher, transport);
((MPv3) snmp.getMessageProcessingModel(MPv3.ID)).setLocalEngineID(new OctetString(MPv3.createLocalEngineID()).getValue());
代码示例来源:origin: org.snmp4j/snmp4j
if ((args.containsKey("v")) &&
("3".equals(ArgumentParser.getValue(settings, "v", 0)))) {
MPv3 mpv3 = (MPv3) snmp.getMessageProcessingModel(MPv3.ID);
if (target.getSecurityModel() == SecurityModel.SECURITY_MODEL_USM) {
SecurityModels.getInstance().addSecurityModel(
代码示例来源:origin: org.kaazing/snmp4j
private Snmp createSnmpSession() throws IOException {
AbstractTransportMapping transport;
if (address instanceof TcpAddress) {
transport = new DefaultTcpTransportMapping();
}
else {
transport = new DefaultUdpTransportMapping();
}
// Could save some CPU cycles:
// transport.setAsyncMsgProcessingSupported(false);
Snmp snmp = new Snmp(transport);
((MPv3)snmp.getMessageProcessingModel(MPv3.ID)).
setLocalEngineID(localEngineID.getValue());
if (version == SnmpConstants.version3) {
USM usm = new USM(SecurityProtocols.getInstance(),
localEngineID,
engineBootCount);
SecurityModels.getInstance().addSecurityModel(usm);
addUsmUser(snmp);
}
return snmp;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
private Snmp createSnmpSession() throws IOException {
AbstractTransportMapping<? extends Address> transport;
if (address instanceof TlsAddress) {
transport = new TLSTM();
}
else if (address instanceof TcpAddress) {
transport = new DefaultTcpTransportMapping();
}
else {
transport = new DefaultUdpTransportMapping();
}
// Could save some CPU cycles:
// transport.setAsyncMsgProcessingSupported(false);
Snmp snmp = new Snmp(transport);
MPv3 mpv3 = (MPv3)snmp.getMessageProcessingModel(MPv3.ID);
mpv3.setLocalEngineID(localEngineID.getValue());
mpv3.setCurrentMsgID(MPv3.randomMsgID(engineBootCount));
if (version == SnmpConstants.version3) {
USM usm = new USM(SecurityProtocols.getInstance(),
localEngineID,
engineBootCount);
SecurityModels.getInstance().addSecurityModel(usm);
addUsmUser(snmp);
SecurityModels.getInstance().addSecurityModel(
new TSM(localEngineID, false));
}
return snmp;
}
代码示例来源:origin: Stratio/ingestion
.getMessageProcessingModel(MessageProcessingModel.MPv3))
.createLocalEngineID();
USM usm = new USM(SecurityProtocols.getInstance(), new OctetString(localEngineID),
.getMessageProcessingModel(MessageProcessingModel.MPv3))
.createLocalEngineID();
USM usm = new USM(SecurityProtocols.getInstance(), new OctetString(localEngineID),
内容来源于网络,如有侵权,请联系作者删除!