Module org.snmp4j
Package 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 themselves 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):

-
Interface Summary Interface Description Address TheAddressinterface serves as a base class for all SNMP transport addresses.AssignableFromByteArray TheAssignableFromByteArrayinterface describes objects whose value can be set from a byte array and converted back to a byte array.AssignableFromIntArray TheAssignableFromIntArrayinterface describes objects whose value can be set from an int array and converted back to an int array.AssignableFromInteger AssignableFromLong AssignableFromString SubIndexInfo TheSubIndexInfointerface represents the meta information of a SMI INDEX clause element (= sub-index) which are relevant for converting an OID index value to an INDEX object and vice versa.Variable TheVariableinterface defines common attributes of all SNMP variables.VariantVariableCallback TheVariantVariableCallbackcan be implemented by objects that want to intercept/monitor reading and writing of aVariantVariable's value. -
Class Summary Class Description AbstractVariable TheVariableabstract class is the base class for all SNMP variables.BitString TheBitStringclass represents the obsolete SMI type BIT STRING which has been defined in RFC 1442 (an SNMPv2 draft) but which has been obsoleteted by RFC 1902 and RFC 2578.Counter32 TheCounter32class allows all the functionality of unsigned integers but is recognized as a distinct SMI type, which is used for monotonically increasing values that wrap around at 2^32-1 (4294967295).Counter64 TheCounter64class represents a 64bit unsigned integer type.DtlsAddress TheTlsAddressrepresents a TLS transport addresses as defined by RFC 5953 SnmpTSLAddress textual convention.Gauge32 TheGauge32class is indistinguishable fromUnsignedInteger32.GenericAddress TheGenericAddressimplements the decorator and factory design pattern to provide a generic address type.Integer32 TheInteger32represents 32bit signed integer values for SNMP.IpAddress TheIpAddressclass represents an IPv4 address SNMP variable.Null TheNullclass represents SMI Null and the derived SMIv2 exception syntaxes.OctetString TheOctetStringclass represents the SMI type OCTET STRING.OID The Object Identifier Class.Opaque TheOpaqueclass represents the SMI type Opaque which is used to transparently exchange BER encoded values.ReadonlyVariableCallback This abstract class helps to implement aVariantVariableCallbackfor a read-only Variable.SMIAddress ASMIAddressis an address that is defined by the Structure of Management Information (SMI) and can be thereby serialized through the Basic Encoding Rules (BER) used by the SNMP protocol.SMIConstants TheSMIConstantsdefines the tag values for SMI syntax types.SubIndexInfoImpl TheSubIndexInfoImplclass represents the meta information of a SMI INDEX clause element (= sub-index) which are relevant for converting an OID index value to an INDEX object and vice versa.TcpAddress TheTcpAddressrepresents TCP/IP transport addresses.TimeTicks TheTimeTicksclass represents the time in 1/100 seconds since some epoch (which should be have been defined in the corresponding MIB specification).TlsAddress TheTlsAddressrepresents a TLS transport addresses as defined by RFC 5953 SnmpTSLAddress textual convention.TransportIpAddress TheTransportIpAddressis the abstract base class for all transport addresses on top of IP network addresses.UdpAddress TheUdpAddressrepresents UDP/IP transport addresses.UnsignedInteger32 UnsignedInteger32 type is an SNMP type that represents unsigned 32bit integer values (0 to 4294967295).VariableBinding VariantVariable TheVariantVariableprovides a decorator for any type of Variable instance, to be able to intercept or monitor variable value modification by using aVariantVariableCallback. -
Enum Summary Enum Description MaxAccess TheMaxAccessenumerates the MAX-ACCESS values of SMIv2 and the deprecatedMaxAccess.writeOnlyof SMIv1.