Previous | Table of Contents | Next |
Since the OBJECT-TYPE macro seems cryptic to most people, a few words of explanation are in order. Each object has a number of attributes: SYNTAX, ACCESS, STATUS, DESCRIPTION, REFERENCE, INDEX, and DEFVAL. (David Perkins and Evan McGinnis book Understanding SNMP MIBs [3-4] provides all the details.)
SYNTAX defines the objects data structure. Simple data types such as INTEGER, OCTET STRING, or NULL are examples of these data structures. SYNTAX also defines special cases of the simple objects, including an enumerated integer that defines an integer value, and a DisplayString restricted to printable ASCII characters. Table objects use the SEQUENCE OF syntax.
ACCESS defines the minimum level of access to (or support of) an object. ACCESS may have values of read-only, read-write, not-accessible, or write-only. SNMP does not permit the write-only value. Table or row objects define ACCESS to be not-accessible.
STATUS defines the implementation support for the object, which may be mandatory, optional, deprecated (discouraged), or obsolete. When STATUS defines a level of support for a particular group, that level applies to all objects within the group. Objects that have been replaced by backwards-compatible objects are deprecated. Objects that are no longer supported are obsolete.
DESCRIPTION, which is not always present, provides a textual definition of an object type. REFERENCE, also not necessarily present, is a textual cross-reference to an object defined by another MIB module.
INDEX works only with row objects. It indexes the order in which objects appear in a row, that is, the column order.
Agents use DEFVAL, also optional, to populate values of columnar objects. For example, when an SNMP agent creates a new row, the DEFVAL clause assigns a default value to the objects within the row. For example, an OCTET STRING object may have a DEFVAL clause of FFFFFFFFFFFFH.
To put all of the information discussed in the previous sections in perspective, Definition 3-1 (taken from RFC 1213) dissects the elements of a table. The italicized text after each section is my explanation. Double hyphens (--) indicate a comment line within the table structure. The comment defines the purpose of the table.
Definition 3-1. Defining the UDP Listener table from RFC 1213
-- the UDP Listener table -- The UDP listener table contains information about this -- entitys UDP end-points on which a local application is -- currently accepting datagrams. udpTable OBJECT-TYPE SYNTAX SEQUENCE OF UdpEntry ACCESS not-accessible STATUS mandatory DESCRIPTION A table containing UDP listener information. ::= { udp 5 } The object name (or table name) udpTable identifies a table object. Note that this name begins with a lowercase letter. The SYNTAX defines a SEQUENCE OF UdpEntry. This refers to a type definition (listed below) that defines the objects that make up each row of the table. udpEntry OBJECT-TYPE SYNTAX UdpEntry ACCESS not-accessible STATUS mandatory DESCRIPTION Information about a particular current UDP listener. INDEX { udpLocalAddress, udpLocalPort } ::= { udpTable 1 } The object name (or row name) udpEntry defines each row of the table. The INDEX clause specifies instances for columnar objects in the table. The instance values determine the order in which the objects are retrieved. UdpEntry ::= SEQUENCE { udpLocalAddress IpAddress, udpLocalPort INTEGER (0..65535) } The type definition UdpEntry identifies the objects that make up the row. Note that the type definition, often called a sequence name, is the same as the row name except that it begins with an uppercase letter. Each row has two columns, the udpLocalAddress (an IpAddress type) and the udpLocalPort (an INTEGER type). udpLocalAddress OBJECT-TYPE SYNTAX IpAddress ACCESS read-only STATUS mandatory DESCRIPTION The local IP address for this UDP listener. A UDP listener willing to accept datagrams for any IP interface associated with the node, uses the value 0.0.0.0. ::= { udpEntry 1 } The notation { udpEntry 1 } indicates the first column in the table. The SYNTAX is a defined type, IpAddress. The description provides the address {0.0.0.0}. udpLocalPort OBJECT-TYPE SYNTAX INTEGER (0..65535) ACCESS read-only STATUS mandatory DESCRIPTION The local port number for this UDP listener. ::= { udpEntry 2 } The notation { udpEntry 2 } indicates the second column in the table. The SYNTAX is an INTEGER type, with values ranging from 0 to 65,535.
An example of this table would be:
Local Address | Local Port |
---|---|
0.0.0.0 | 69 (TFTP) |
0.0.0.0 | 161 (SNMP) |
0.0.0.0 | 520 (Router) |
In this example, the table contains three rows and two columns. All local addresses are [0.0.0.0], which indicates that the table is willing to accept IP datagrams from any address on this port.
Definition 3-2 is a second example of a table, the Ethernet Statistics table, which comes from the RMON MIB, RFC 1757.
Previous | Table of Contents | Next |