Package com.snmp4j.smi
Enum Class SmiManager.OIDFormat
- All Implemented Interfaces:
Serializable
,Comparable<SmiManager.OIDFormat>
,java.lang.constant.Constable
- Enclosing class:
- SmiManager
The OIDFormat defines the formatting of
OID
values.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionAccording to ITU-T X.680 the object identifier is formatted like the number format but for each number also the corresponding object name is provided and the number is enclosed in braces.Formats the OID as dotted number string, e.g.Formats the OID as combination of object (last) name and a formatted index, e.g.Fully formats the OID as object (last) name of (sub)index values.Formats the OID as combination of object (last) name and a numeric index, e.g. -
Method Summary
Modifier and TypeMethodDescriptionstatic SmiManager.OIDFormat
Returns the enum constant of this class with the specified name.static SmiManager.OIDFormat[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
Numbers
Formats the OID as dotted number string, e.g. "1.3.6.1.2.1.1.1.0" for the sysDescr object name. This format can be used with round-trip parsing. That is, an OID can be formatted and then parsed again using this format. This means also thatOID.toString()
andOID.format()
return the same formatted value. -
ObjectNameNumIndex
Formats the OID as combination of object (last) name and a numeric index, e.g.sysDescr.0
orsnmpNotifyTag.102.105.108.116.101.114.101.100
. This format can be used with round-trip parsing. That is, an OID can be formatted and then parsed again using this format. This means also thatOID.toString()
andOID.format()
return the same formatted value. -
ObjectNameAndDecodedIndex
Formats the OID as combination of object (last) name and a formatted index, e.g.sysDescr.0
orsnmpNotifyTag.filtered
. This format cannot be used with round-trip parsing. Thus, an OID cannot be formatted and then parsed again using this format. This means also thatOID.toString()
andOID.format()
return different values:OID.toString()
will return the same value as with {#ObjectNameNumIndex} (snmpNotifyTag.102.105.108.116.101.114.101.100
).OID.format()
will instead return the fully formatted value (e.g.snmpNotifyTag.filtered
).
ObjectNameAndDecodedIndex4RoundTrip
instead. -
ObjectNameAndDecodedIndex4RoundTrip
Fully formats the OID as object (last) name of (sub)index values. Each sub-index value is encoded as quoted string if one of the following is true:- the sub-index value contains dots ('.')
- the sub-index' base syntax is OCTET-STRING
- the sub-index has a variable length syntax
- the value is an enumerated value (INTEGER {..})
new OID("1.3.6.1.6.3.16.1.5.2.1.4.12.100.101.109.111.82.101.97.100.86.105.101.119.6.1.3.6.1.2.1").toString() .equals("vacmViewTreeFamilyType.\"demoReadView\".\"mib-2\"") == true;
new OID("vacmViewTreeFamilyMask.\"#x75:6e:00:65:73\".\"dod\"").equals( new OID("1.3.6.1.6.3.16.1.5.2.1.3.5.117.110.0.101.115.3.1.3.6")) == true;
-
OID vacmAccessContextMatch = new OID("1.3.6.1.6.3.16.1.4.1.4.7.118.51.103.114.111.117.112.0.3.1"); assertEquals("vacmAccessContextMatch.\"v3group\".\"\".3.'noAuthNoPriv(1)'", vacmAccessContextMatch.toString()); assertEquals("vacmAccessContextMatch.\"v3group\".\"\".3.'noAuthNoPriv(1)'", vacmAccessContextMatch.format()); assertEquals(vacmAccessContextMatch, new OID("vacmAccessContextMatch.\"v3group\".\"\".3.'noAuthNoPriv(1)'"));
- Since:
- 1.1
-
NameAndNumber
According to ITU-T X.680 the object identifier is formatted like the number format but for each number also the corresponding object name is provided and the number is enclosed in braces. If an object name is not known, only the number is provided without braces.SmiManager.OIDFormat defaultForm = smiManager.getOidFormat(); smiManager.setOidFormat(SmiManager.OIDFormat.NameAndNumber); OID oid = new OID("1.3.6.1.2.1.47.1.1"); assertEquals(oid, new OID("iso(1).org(3).dod(6).internet(1).mgmt(2).mib-2(1).entityMIB(47).entityMIBObjects(1).entityPhysical(1)")); assertEquals(oid, new OID("iso(1).org(3).dod(6).internet(1).mgmt(2).mib2(1).entityMIB(47).entityMIBObjects(1).entityPhysical(1)")); assertEquals("iso(1).org(3).dod(6).internet(1).mgmt(2).mib-2(1).entityMIB(47).entityMIBObjects(1).entityPhysical(1)", oid.toString()); smiManager.setOidFormat(defaultForm);
- Since:
- 1.7.1
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-