Java Dynamic Management Kit 5.1 Tools Reference Guide

1.6.5 Classes Representing SNMP Enumerated Types

The mibgen compiler generates a specific class for each enumerated type that is defined in the MIB. This class contains all the possible values defined in the enumerated type. The generated class extends the generic class Enumerated, defined in the com.sun.jdmk package. The HTML adaptor can use the Enumerated class to display all the labels that are contained in an enumeration. The mibgen compiler can handle enumerated types defined as part of a type definition or in-line definition.

Generated code representing SNMP enumerated types is prefixed with Enum followed by the type name or the variable name for inline definition.


Note –

The mibgen compiler has an option -p prefix that you can use to prefix the names of all generated files with a specific string.


For example, in MIB II, TCP connection states are represented by an enumeration containing all the possible states for a TCP connection. The mibgen compiler generates a Java class named EnumTcpConnState to represent the enumeration.