public JaxbSnmpValue(SnmpValue value) { type = value.getType(); bytes = value.getBytes(); }
/** * <p>getCdpCacheAddress</p> * * @return a {@link java.lang.String} object. */ public byte[] getCdpCacheAddress() { return getValue(CDP_CACHE_ADDRESS).getBytes(); }
public static Long getProtoCounter63Value(SnmpValue value) { Long retval = getProtoCounter63Value(value.getBytes()); if (retval != null && value.isDisplayable()) { LOG.info("Value '{}' is entirely displayable but still meets our other checks to be treated as a proto-Counter64. This may not be what you want.", new String(value.getBytes())); } return retval; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; SnmpResult other = (SnmpResult) obj; // Compare the type and byte contents to determine if two values are equal // Do not rely on the equals() method for this attribute if (m_value == null) { if (other.m_value != null) return false; } else if (m_value.getType() != other.m_value.getType() || !Arrays.equals(m_value.getBytes(), other.m_value.getBytes())) { return false; } return Objects.equals(this.m_base, other.m_base) && Objects.equals(this.m_instance, other.m_instance); } }
protected PDU buildPdu(Snmp4JAgentConfig agentConfig, int pduType, SnmpObjId[] oids, SnmpValue[] values) { PDU pdu = agentConfig.createPdu(pduType); if (values == null) { for (SnmpObjId oid : oids) { pdu.add(new VariableBinding(new OID(oid.toString()))); } } else { // TODO should this throw an exception? This situation is fairly bogus and probably signifies a coding error. if (oids.length != values.length) { Exception e = new SnmpException("PDU values do not match OIDs"); LOG.error("PDU to prepare has object values but not the same number as there are OIDs. There are {} OIDs and {} object values.", oids.length, values.length, e); return null; } for (int i = 0; i < oids.length; i++) { pdu.add(new VariableBinding(new OID(oids[i].toString()), new Snmp4JValue(values[i].getType(), values[i].getBytes()).getVariable())); } } // TODO should this throw an exception? This situation is fairly bogus. if (pdu.getVariableBindings().size() != oids.length) { Exception e = new SnmpException("PDU bindings do not match OIDs"); LOG.error("Prepared PDU does not have as many variable bindings as there are OIDs. There are {} OIDs and {} variable bindings.", oids.length,pdu.getVariableBindings(), e); return null; } return pdu; }
protected PDU buildPdu(Snmp4JAgentConfig agentConfig, int pduType, SnmpObjId[] oids, SnmpValue[] values) { PDU pdu = agentConfig.createPdu(pduType); if (values == null) { for (SnmpObjId oid : oids) { pdu.add(new VariableBinding(new OID(oid.toString()))); } } else { // TODO should this throw an exception? This situation is fairly bogus and probably signifies a coding error. if (oids.length != values.length) { Exception e = new SnmpException("PDU values do not match OIDs"); LOG.error("PDU to prepare has object values but not the same number as there are OIDs. There are {} OIDs and {} object values.", oids.length, values.length, e); return null; } for (int i = 0; i < oids.length; i++) { pdu.add(new VariableBinding(new OID(oids[i].toString()), new Snmp4JValue(values[i].getType(), values[i].getBytes()).getVariable())); } } // TODO should this throw an exception? This situation is fairly bogus. if (pdu.getVariableBindings().size() != oids.length) { Exception e = new SnmpException("PDU bindings do not match OIDs"); LOG.error("Prepared PDU does not have as many variable bindings as there are OIDs. There are {} OIDs and {} variable bindings.", oids.length,pdu.getVariableBindings(), e); return null; } return pdu; }
if (value.getBytes().length == 6) { encoding = EventConstants.XML_ENCODING_MAC_ADDRESS; } else {
protected PDU buildPdu(Snmp4JAgentConfig agentConfig, int pduType, SnmpObjId[] oids, SnmpValue[] values) { PDU pdu = agentConfig.createPdu(pduType); if (values == null) { for (SnmpObjId oid : oids) { pdu.add(new VariableBinding(new OID(oid.toString()))); } } else { // TODO should this throw an exception? This situation is fairly bogus and probably signifies a coding error. if (oids.length != values.length) { Exception e = new Exception("This is a bogus exception so we can get a stack backtrace"); log().error("PDU to prepare has object values but not the same number as there are OIDs. There are " + oids.length + " OIDs and " + values.length + " object values.", e); return null; } for (int i = 0; i < oids.length; i++) { pdu.add(new VariableBinding(new OID(oids[i].toString()), new Snmp4JValue(values[i].getType(), values[i].getBytes()).getVariable())); } } // TODO should this throw an exception? This situation is fairly bogus. if (pdu.getVariableBindings().size() != oids.length) { Exception e = new Exception("This is a bogus exception so we can get a stack backtrace"); log().error("Prepared PDU does not have as many variable bindings as there are OIDs. There are " + oids.length + " OIDs and " + pdu.getVariableBindings() + " variable bindings.", e); return null; } return pdu; }
syntaxvalues[i] = new JoeSnmpValue(values[i].getType(), values[i].getBytes()).getSnmpSyntax();
syntaxvalues[i] = new JoeSnmpValue(values[i].getType(), values[i].getBytes()).getSnmpSyntax();
syntaxvalues[i] = new JoeSnmpValue(values[i].getType(), values[i].getBytes()).getSnmpSyntax();