All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.snmp4j.smi.package.html Maven / Gradle / Ivy




org.snmp4j.smi




Provides classes for the representation of SMIv1/v2 data types (which also
includes some basic ASN.1 primitive data types).

The org.snmp4j.smi classes are capable of BER encoding and decoding themself to/from a byte stream. In addition, the SMI data type classes provide convenient functions for manipulating their content.

The VariantVariable is a special class that can be used in command responder applications to intercept access to a SMI value.

Variable Binding Examples

import org.snmp4j.smi.*;
...
VariableBinding vb = new VariableBinding(new OID("1.3.6.1.2.1.1.4.0"));
vb.setValue(new OctetString("SNMP4J Text"));
...
vb = new VariableBinding();
vb.setOid(new OID(new int[] { 1,3,6,1,2,1,1,2,0 }));
...
vb = new VariableBinding(vb.getOid(), new IpAddress("255.255.255.255"));
...
vb = new VariableBinding(vb.getOid(), new Gauge32(2^32-1));
int syntax = vb.getSyntax();
if (syntax != SMIConstants.SYNTAX_GAUGE32) {
  // never reached
}
else {
  long value = ((UnsignedInteger32)vb.getValue()).getValue();
  System.out.println(vb.getOid() + " = " + value);
  // prints: 1.3.6.1.2.1.1.2.0 = 4294967295
}
...

The following UML class diagram shows the most important classes of the org.snmp4j.smi package and their relationships (relationships to other packages are not shown):





© 2015 - 2025 Weber Informatics LLC | Privacy Policy