本文整理了Java中org.snmp4j.PDU.addAll()
方法的一些代码示例,展示了PDU.addAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PDU.addAll()
方法的具体详情如下:
包路径:org.snmp4j.PDU
类名称:PDU
方法名:addAll
[英]Adds a list of variable bindings to this PDU (see #add(VariableBinding vb)).
[中]将变量绑定列表添加到此PDU(请参见#添加(VariableBinding vb))。
代码示例来源:origin: org.jboss.jbossas/jboss-snmp
/** This utility method is used to construct an error PDU. This code
* was repeated so many times it was prudent to give it it's own method.
* @param response This PDU is the one being modified into an error PDU.
* @param oid The OID to contain the error Null instance.
* @param errorIndex the VariableBinding in the PDU that caused the error.
* @param err The error number defined in the PDU class that indicates a given failure
*/
private void makeErrorPdu(PDU response, PDU pdu, int errorIndex, int err){
response.clear();
response.addAll(pdu.toArray());
response.setErrorIndex(errorIndex);
response.setErrorStatus(err);
}
代码示例来源:origin: org.mobicents.tools.snmp.adaptor/core
/** This utility method is used to construct an error PDU. This code
* was repeated so many times it was prudent to give it it's own method.
* @param response This PDU is the one being modified into an error PDU.
* @param oid The OID to contain the error Null instance.
* @param errorIndex the VariableBinding in the PDU that caused the error.
* @param err The error number defined in the PDU class that indicates a given failure
*/
private void makeErrorPdu(PDU response, PDU pdu, int errorIndex, int err){
response.clear();
response.addAll(pdu.toArray());
response.setErrorIndex(errorIndex);
response.setErrorStatus(err);
}
代码示例来源:origin: fbacchella/jrds
requestPDU.addAll(vars);
代码示例来源:origin: org.snmp4j/snmp4j
public SnmpUriResponse browse(URI url) throws UnknownHostException {
SnmpUriResponse response = new SnmpUriResponse(PDU.genErr);
Request request = createSnmpRequest(url);
PDU pdu = request.getPdu();
switch (request.getType()) {
case GET:
pdu.setType(PDU.GET);
pdu.addAll(VariableBinding.createFromOIDs(request.getOIDs()));
response = sendSnmpRequest(request, pdu);
break;
case NEXT:
pdu.setType(PDU.GETNEXT);
pdu.addAll(VariableBinding.createFromOIDs(request.getOIDs()));
response = sendSnmpRequest(request, pdu);
break;
case SUBTREE:
TreeUtils treeUtils = new TreeUtils(snmp, pduFactory);
List<TreeEvent> treeEventList = treeUtils.walk(request.getTarget(), request.getOIDs());
List<VariableBinding[]> vbs = new ArrayList<VariableBinding[]>(treeEventList.size());
int errorStatus = PDU.noError;
for (TreeEvent treeEvent : treeEventList) {
vbs.add(treeEvent.getVariableBindings());
errorStatus = treeEvent.getStatus();
}
response = new SnmpUriResponse(vbs, errorStatus);
break;
}
return response;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
public SnmpUriResponse browse(URI url) throws UnknownHostException {
SnmpUriResponse response = new SnmpUriResponse(PDU.genErr);
Request request = createSnmpRequest(url);
PDU pdu = request.getPdu();
switch (request.getType()) {
case GET:
pdu.setType(PDU.GET);
pdu.addAll(VariableBinding.createFromOIDs(request.getOIDs()));
response = sendSnmpRequest(request, pdu);
break;
case NEXT:
pdu.setType(PDU.GETNEXT);
pdu.addAll(VariableBinding.createFromOIDs(request.getOIDs()));
response = sendSnmpRequest(request, pdu);
break;
case SUBTREE:
TreeUtils treeUtils = new TreeUtils(snmp, pduFactory);
List<TreeEvent> treeEventList = treeUtils.walk(request.getTarget(), request.getOIDs());
List<VariableBinding[]> vbs = new ArrayList<VariableBinding[]>(treeEventList.size());
int errorStatus = PDU.noError;
for (TreeEvent treeEvent : treeEventList) {
vbs.add(treeEvent.getVariableBindings());
errorStatus = treeEvent.getStatus();
}
response = new SnmpUriResponse(vbs, errorStatus);
break;
}
return response;
}
代码示例来源:origin: org.snmp4j/snmp4j
public void browse(URI url, SnmpUriCallback callback, Object userObject) throws UnknownHostException {
Request request = createSnmpRequest(url);
PDU pdu = request.getPdu();
switch (request.getType()) {
case GET:
pdu.setType(PDU.GET);
pdu.addAll(VariableBinding.createFromOIDs(request.getOIDs()));
sendSnmpRequest(request, pdu, url, callback, userObject);
break;
case NEXT:
pdu.setType(PDU.GETNEXT);
pdu.addAll(VariableBinding.createFromOIDs(request.getOIDs()));
sendSnmpRequest(request, pdu, url, callback, userObject);
break;
case SUBTREE:
TreeUtils treeUtils = new TreeUtils(snmp, pduFactory);
TreeListener treeListener = new AsyncTreeListener(url, callback);
treeUtils.walk(request.getTarget(), request.getOIDs(), userObject, treeListener);
break;
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
public void browse(URI url, SnmpUriCallback callback, Object userObject) throws UnknownHostException {
Request request = createSnmpRequest(url);
PDU pdu = request.getPdu();
switch (request.getType()) {
case GET:
pdu.setType(PDU.GET);
pdu.addAll(VariableBinding.createFromOIDs(request.getOIDs()));
sendSnmpRequest(request, pdu, url, callback, userObject);
break;
case NEXT:
pdu.setType(PDU.GETNEXT);
pdu.addAll(VariableBinding.createFromOIDs(request.getOIDs()));
sendSnmpRequest(request, pdu, url, callback, userObject);
break;
case SUBTREE:
TreeUtils treeUtils = new TreeUtils(snmp, pduFactory);
TreeListener treeListener = new AsyncTreeListener(url, callback);
treeUtils.walk(request.getTarget(), request.getOIDs(), userObject, treeListener);
break;
}
}
代码示例来源:origin: org.snmp4j/snmp4j-agent
translatedResponse.addAll(respPDU.toArray());
translatedResponse.setErrorIndex(respPDU.getErrorIndex());
translatedResponse.setErrorStatus(respPDU.getErrorStatus());
代码示例来源:origin: org.kaazing/snmp4j-agent
translatedResponse.addAll(respPDU.toArray());
translatedResponse.setErrorIndex(respPDU.getErrorIndex());
translatedResponse.setErrorStatus(respPDU.getErrorStatus());
代码示例来源:origin: org.kaazing/snmp4j
values[i].setOid(columnOID);
pdu.addAll(values);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
value.setOid(columnOID);
pdu.addAll(values);
代码示例来源:origin: org.snmp4j/snmp4j
value.setOid(columnOID);
pdu.addAll(values);
代码示例来源:origin: org.snmp4j/snmp4j-agent
sourceV1.getGenericTrap(),
sourceV1.getSpecificTrap())));
target.addAll(source.toArray());
target.add(new VariableBinding(SnmpConstants.snmpTrapAddress,
sourceV1.getAgentAddress()));
targetV1.setSpecificTrap(0);
target.addAll(source.toArray());
if (request.getCommandEvent().getPeerAddress() instanceof IpAddress) {
InetAddress agentAddress = ((IpAddress)
target.addAll(source.toArray());
代码示例来源:origin: org.kaazing/snmp4j-agent
sourceV1.getGenericTrap(),
sourceV1.getSpecificTrap())));
target.addAll(source.toArray());
target.add(new VariableBinding(SnmpConstants.snmpTrapAddress,
sourceV1.getAgentAddress()));
targetV1.setSpecificTrap(0);
target.addAll(source.toArray());
if (request.getCommandEvent().getPeerAddress() instanceof IpAddress) {
InetAddress agentAddress = ((IpAddress)
target.addAll(source.toArray());
代码示例来源:origin: org.snmp4j/snmp4j-agent
pdu.addAll(vbs);
pdu.setType((type == SnmpNotificationMIB.SnmpNotifyTypeEnum.inform) ?
PDU.INFORM : (mpModel.getValue() == MessageProcessingModel.MPv1)
代码示例来源:origin: org.kaazing/snmp4j-agent
pdu.addAll(vbs);
pdu.setType((type == SnmpNotificationMIB.SnmpNotifyTypeEnum.inform) ?
PDU.INFORM : (mpModel.getValue() == MessageProcessingModel.MPv1)
内容来源于网络,如有侵权,请联系作者删除!