@Override public void setMaxRepetitions(int maxRepetitions) { m_bulkPdu.setMaxRepetitions(maxRepetitions); }
@Override public void setMaxRepetitions(int maxRepetitions) { m_bulkPdu.setMaxRepetitions(maxRepetitions); }
public void setMaxRepetitions(int maxRepetitions) { m_bulkPdu.setMaxRepetitions(maxRepetitions); }
/** * 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); } } } } }
/** * 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; }
/** * 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; }
trap.setMaxRepetitions(0); if (this.endpoint.getSnmpVersion() == SnmpConstants.version1) { trap.setType(PDU.V1TRAP);
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(); } }
request.setMaxRepetitions(maxRepetitions); request.setNonRepeaters(nonRepeaters);
pdu.setMaxRepetitions(0); pdu.setNonRepeaters(0);
pdu.setMaxRepetitions(0); pdu.setNonRepeaters(0);
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();
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();
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(); } }
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(); }
request.setMaxRepetitions(maxRepetitions); request.setNonRepeaters(nonRepeaters);
request.setMaxRepetitions(maxRepetitions);
request.setMaxRepetitions(maxRepetitions);
@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); }