本文整理了Java中org.snmp4j.PDU.setMaxRepetitions()
方法的一些代码示例,展示了PDU.setMaxRepetitions()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。PDU.setMaxRepetitions()
方法的具体详情如下:
包路径:org.snmp4j.PDU
类名称:PDU
方法名:setMaxRepetitions
[英]Sets the maximum repetitions of repeatable variable bindings in GETBULK requests.
[中]设置GETBULK请求中可重复变量绑定的最大重复次数。
代码示例来源:origin: OpenNMS/opennms
@Override
public void setMaxRepetitions(int maxRepetitions) {
m_bulkPdu.setMaxRepetitions(maxRepetitions);
}
代码示例来源:origin: org.opennms.core.snmp/org.opennms.core.snmp.implementations.snmp4j
@Override
public void setMaxRepetitions(int maxRepetitions) {
m_bulkPdu.setMaxRepetitions(maxRepetitions);
}
代码示例来源:origin: org.opennms.lib.snmp/org.opennms.lib.snmp.snmp4j
public void setMaxRepetitions(int maxRepetitions) {
m_bulkPdu.setMaxRepetitions(maxRepetitions);
}
代码示例来源:origin: org.kaazing/snmp4j
/**
* Checks outgoing messages for consistency between PDU and target used.
* @param transportAddress
* the target address.
* @param messageProcessingModel
* the message processing model to be used.
* @param pdu
* the PDU to be sent.
* @throws MessageException
* if unrecoverable inconsistencies have been detected.
*/
protected void checkOutgoingMsg(Address transportAddress,
int messageProcessingModel, PDU pdu)
throws MessageException
{
if (checkOutgoingMsg) {
if (messageProcessingModel == MessageProcessingModel.MPv1) {
if (pdu.getType() == PDU.GETBULK) {
logger.warn("Converting GETBULK PDU to GETNEXT for SNMPv1 target: "+
transportAddress);
pdu.setType(PDU.GETNEXT);
if (!(pdu instanceof PDUv1)) {
pdu.setMaxRepetitions(0);
}
}
}
}
}
代码示例来源:origin: org.snmp4j/snmp4j
/**
* Create a <code>PDU</code> instance for the supplied target.
*
* @param target the <code>Target</code> where the PDU to be created will be
* sent.
* @param pduType
* a PDU type as specified by {@link PDU}.
* @param maxRepetitions
* the maximum number of repetitions for GETBULK PDUs created
* by this factory.
* @param nonRepeaters
* the number of non-repeater variable bindings
* (processed like GETNEXT) for GETBULK PDUs created
* by this factory.
* @return PDU
* a PDU instance that is compatible with the supplied target.
* @since 2.2
*/
public static PDU createPDU(Target target, int pduType, int maxRepetitions, int nonRepeaters) {
PDU request = createPDU(target.getVersion());
request.setType(pduType);
if (pduType == PDU.GETBULK) {
request.setMaxRepetitions(maxRepetitions);
request.setNonRepeaters(nonRepeaters);
}
return request;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
/**
* Create a <code>PDU</code> instance for the supplied target.
*
* @param target the <code>Target</code> where the PDU to be created will be
* sent.
* @param pduType
* a PDU type as specified by {@link PDU}.
* @param maxRepetitions
* the maximum number of repetitions for GETBULK PDUs created
* by this factory.
* @param nonRepeaters
* the number of non-repeater variable bindings
* (processed like GETNEXT) for GETBULK PDUs created
* by this factory.
* @return PDU
* a PDU instance that is compatible with the supplied target.
* @since 2.2
*/
public static PDU createPDU(Target target, int pduType, int maxRepetitions, int nonRepeaters) {
PDU request = createPDU(target.getVersion());
request.setType(pduType);
if (pduType == PDU.GETBULK) {
request.setMaxRepetitions(maxRepetitions);
request.setNonRepeaters(nonRepeaters);
}
return request;
}
代码示例来源:origin: org.apache.camel/camel-snmp
trap.setMaxRepetitions(0);
if (this.endpoint.getSnmpVersion() == SnmpConstants.version1) {
trap.setType(PDU.V1TRAP);
代码示例来源:origin: org.kaazing/snmp4j-agent
private void correctRequestValues() {
PDU request = requestEvent.getPDU();
if (!(request instanceof PDUv1)) {
if (request.getMaxRepetitions() < 0) {
request.setMaxRepetitions(0);
}
if (request.getNonRepeaters() < 0) {
request.setNonRepeaters(0);
}
repeaterStartIndex = request.getNonRepeaters();
repeaterRowSize =
Math.max(request.size() - repeaterStartIndex, 0);
}
else {
repeaterStartIndex = 0;
repeaterRowSize = request.size();
}
}
代码示例来源:origin: org.kaazing/snmp4j
request.setMaxRepetitions(maxRepetitions);
request.setNonRepeaters(nonRepeaters);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
pdu.setMaxRepetitions(0);
pdu.setNonRepeaters(0);
代码示例来源:origin: org.snmp4j/snmp4j
pdu.setMaxRepetitions(0);
pdu.setNonRepeaters(0);
代码示例来源:origin: org.jboss.jbossas/jboss-snmp
pdu.add(new VariableBinding(new OID("1.3.6.1.2.1.1.0")));
pdu.add(new VariableBinding(new OID("1.3.1.1")));
pdu.setMaxRepetitions(7);
pdu.setNonRepeaters(1);
CommunityTarget target = new CommunityTarget();
代码示例来源:origin: org.mobicents.tools.snmp.adaptor/core
pdu.add(new VariableBinding(new OID("1.3.6.1.2.1.1.0")));
pdu.add(new VariableBinding(new OID("1.3.1.1")));
pdu.setMaxRepetitions(7);
pdu.setNonRepeaters(1);
CommunityTarget target = new CommunityTarget();
代码示例来源:origin: org.snmp4j/snmp4j-agent
private void correctRequestValues() {
PDU request = source.getPDU();
if (!(request instanceof PDUv1)) {
if (request.getMaxRepetitions() < 0) {
request.setMaxRepetitions(0);
}
if (request.getNonRepeaters() < 0) {
request.setNonRepeaters(0);
}
if (request.getNonRepeaters() > request.size()) {
request.setNonRepeaters(request.size());
}
repeaterStartIndex = request.getNonRepeaters();
repeaterRowSize =
Math.max(request.size() - repeaterStartIndex, 0);
}
else {
repeaterStartIndex = 0;
repeaterRowSize = request.size();
}
}
代码示例来源:origin: org.kaazing/snmp4j
private void walk(Target target, OID rootOID,
OID startOID, Object userObject,
TreeListener listener) {
PDU request = pduFactory.createPDU(target);
request.add(new VariableBinding(startOID));
if (target.getVersion() == SnmpConstants.version1) {
request.setType(PDU.GETNEXT);
}
else if (request.getType() != PDU.GETNEXT) {
request.setType(PDU.GETBULK);
request.setMaxRepetitions(maxRepetitions);
}
TreeRequest treeRequest =
new TreeRequest(listener, rootOID, target, userObject, request);
treeRequest.send();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
request.setMaxRepetitions(maxRepetitions);
request.setNonRepeaters(nonRepeaters);
代码示例来源:origin: org.openscada.atlantis/org.openscada.da.server.snmp
request.setMaxRepetitions ( 10 );
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j
request.setMaxRepetitions(maxRepetitions);
代码示例来源:origin: org.snmp4j/snmp4j
request.setMaxRepetitions(maxRepetitions);
代码示例来源:origin: org.apache.camel/camel-snmp
@Override
protected void doStart() throws Exception {
super.doStart();
this.targetAddress = GenericAddress.parse(this.endpoint.getAddress());
LOG.debug("targetAddress: {}", targetAddress);
this.usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0);
SecurityModels.getInstance().addSecurityModel(this.usm);
// setting up target
this.target = new CommunityTarget();
this.target.setCommunity(new OctetString(endpoint.getSnmpCommunity()));
this.target.setAddress(this.targetAddress);
this.target.setRetries(this.endpoint.getRetries());
this.target.setTimeout(this.endpoint.getTimeout());
this.target.setVersion(this.endpoint.getSnmpVersion());
this.pdu = new PDU();
for (OID oid : this.endpoint.getOids()) {
this.pdu.add(new VariableBinding(oid));
}
this.pdu.setErrorIndex(0);
this.pdu.setErrorStatus(0);
this.pdu.setMaxRepetitions(0);
this.pdu.setType(PDU.GET);
}
内容来源于网络,如有侵权,请联系作者删除!