/** * 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. * @return PDU a PDU instance that is compatible with the supplied target. */ public PDU createPDU(Target target) { return createPDU(target, pduType); }
public PDU createPDU ( final Target target, final int pduType ) { return DefaultPDUFactory.createPDU ( target, pduType ); }
/** * Create a <code>PDU</code> instance for the supplied target. For GETBULK * PDUs, the default max repetitions and non repeaters are used. See * {@link #GETBULK_DEFAULT_MAX_REPETITIONS} and * {@link #GETBULK_DEFAULT_NON_REPEATERS}. * * @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}. * @return PDU * a PDU instance that is compatible with the supplied target. */ public static PDU createPDU(Target target, int pduType) { return createPDU(target, pduType, GETBULK_DEFAULT_MAX_REPETITIONS, GETBULK_DEFAULT_NON_REPEATERS); }
/** * Create a <code>PDU</code> instance for the supplied target. For GETBULK * PDUs, the default max repetitions and non repeaters are used. See * {@link #GETBULK_DEFAULT_MAX_REPETITIONS} and * {@link #GETBULK_DEFAULT_NON_REPEATERS}. * * @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}. * @return PDU * a PDU instance that is compatible with the supplied target. */ public static PDU createPDU(Target target, int pduType) { return createPDU(target, pduType, GETBULK_DEFAULT_MAX_REPETITIONS, GETBULK_DEFAULT_NON_REPEATERS); }
/** * 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. * @return PDU a PDU instance that is compatible with the supplied target. */ public PDU createPDU(Target target) { PDU pdu = createPDU(target, pduType); applyContextInfoToScopedPDU(pdu); return pdu; }
/** * 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. * @return PDU a PDU instance that is compatible with the supplied target. */ public PDU createPDU(Target target) { PDU pdu = createPDU(target, pduType); applyContextInfoToScopedPDU(pdu); return pdu; }
@Override public PDU createPDU(MessageProcessingModel messageProcessingModel) { int type = getPduType(); PDU pdu = DefaultPDUFactory.createPDU(messageProcessingModel, type); configurePDU(type, pdu); return pdu; }
public PDU createPDU(Target target) { int type = getPduType(); PDU pdu = DefaultPDUFactory.createPDU(target, type); configurePDU(type, pdu); return pdu; }
@Override public PDU createPDU(MessageProcessingModel messageProcessingModel) { int type = getPduType(); PDU pdu = DefaultPDUFactory.createPDU(messageProcessingModel, type); configurePDU(type, pdu); return pdu; }
public PDU createPDU(Target target) { int type = getPduType(); PDU pdu = DefaultPDUFactory.createPDU(target, type); configurePDU(type, pdu); return pdu; }
/** * 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}. * @return PDU * a PDU instance that is compatible with the supplied target. */ public static PDU createPDU(Target target, int pduType) { PDU request = createPDU(target.getVersion()); request.setType(pduType); return request; }
public long readUptime(Set<OID> upTimesOids) { try { for(OID uptimeoid: upTimesOids) { PDU requestPDU = DefaultPDUFactory.createPDU(snmpTarget, PDU.GET); requestPDU.addOID(new VariableBinding(uptimeoid)); PDU response = request(requestPDU, snmpTarget); Object value = new SnmpVars(response).get(uptimeoid); if(value instanceof Number) { return ((Number) value).longValue(); } } } catch (Exception e) { log(Level.ERROR, e, "Unable to get uptime: %s", e); } return 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; }
PDU requestPDU = DefaultPDUFactory.createPDU(snmpTarget, PDU.GET); requestPDU.addOID(new VariableBinding(ping));
PDU pdu = DefaultPDUFactory.createPDU(target, reqPDU.getType()); setScope(request, pdu); try {
private static PDU createPdu(int snmpVersion) { PDU pdu = DefaultPDUFactory.createPDU(snmpVersion); if (snmpVersion == SnmpConstants.version1) { pdu.setType(PDU.V1TRAP); } else { pdu.setType(PDU.TRAP); } pdu.add(new VariableBinding(SnmpConstants.sysUpTime, new TimeTicks(1000))); pdu.add(new VariableBinding(SnmpConstants.snmpTrapOID, new OID(trapOid))); pdu.add(new VariableBinding(SnmpConstants.snmpTrapAddress, new IpAddress(ipAddress))); pdu.add(new VariableBinding(new OID(trapOid), new OctetString("Major"))); return pdu; }
if ((resp != null) && (resp.getResponse() != null)) { PDU respPDU = resp.getResponse(); PDU translatedResponse = DefaultPDUFactory.createPDU( request.getCommandEvent().getSecurityModel()); if (!translatedResponse.getClass().equals(respPDU.getClass())) {