Previous | Table of Contents | Next |
The TCP connection table that follows illustrates both the SEQUENCE and SEQUENCE OF:
tcpConnTable OBJECT-TYPE SYNTAX SEQUENCE OF TcpConnEntry ACCESS not-accessible STATUS mandatory DESCRIPTION A table containing TCP connection-specific information. ::= { tcp 13 } tcpConnEntry OBJECT-TYPE SYNTAX TcpConnEntry ACCESS not-accessible STATUS mandatory DESCRIPTION Information about a particular current TCP connection. An object of this type is transient; it ceases to exist when (or soon after) the connection makes the transition to the CLOSED state. INDEX { tcpConnLocalAddress, tcpConnLocalPort, tcpConnRemAddress, tcpConnRemPort } ::= { tcpConnTable 1 } TcpConnEntry ::= SEQUENCE { tcpConnState INTEGER, tcpConnLocalAddress IpAddress, tcpConnLocalPort INTEGER (0..65535), tcpConnRemAddress IpAddress, tcpConnRemPort INTEGER (0..65535) }
This example expands your ASN.1 grammar. The table name, tcpConnTable, ends with the suffix Table. The row name, tcpConnEntry, ends with the suffix Entry. The sequence name, TcpConnEntry, is the same as the row name, except that it begins with an uppercase letter. The INDEX clause defines the construction and order of the columns that make up the rows. Dave Perkins excellent article, How to Read and Use an SNMP MIB [2-11] explores table and row objects in greater detail.
The Internet Network Management Framework uses the Defined (or application-wide) types (described in RFC 1155). The Defined types include NetworkAddress, IpAddress, Counter, Gauge, TimeTicks, and Opaque. The examples that follow come from RFC 1213. For more information, refer to Section 2.7 and locate the defined types under the ApplicationSyntax definition section.
The NetworkAddress type was designed to represent an address from one of several protocol families. A CHOICE is a primitive type that provides alternatives between other types, and is found in several sections of the SMI definition given in Section 2.7. Currently, however, only one protocol family, the Internet family (called internet IpAddress in the SMI definition), has been defined for this CHOICE. Here is an example:
atNetAddress OBJECT-TYPE SYNTAX NetworkAddress ACCESS read-write STATUS deprecated DESCRIPTION The NetworkAddress (e.g., the IP address) corresponding to the media-dependent physical address. ::= { atEntry 3 }
Because it supports only IP addresses (hence the default choice), use of this type is discouraged.
IpAddress is an application-wide type that represents a 32-bit Internet address. It is represented as an OCTET STRING of length 4 (octets) in network byte-order (the order bytes are transmitted over the network):
tcpConnRemAddress OBJECT-TYPE SYNTAX IpAddress ACCESS read-only STATUS mandatory DESCRIPTION The remote IP address for this TCP connection. ::= {tcpConnEntry 4 }
The Counter is an application-wide type that represents a nonnegative integer that increases monotonically until it reaches a maximum value, then wraps around and increases again from zero. The maximum counter value is 232-1, or 4,294,967,295 decimal. In other words, the Counter is an unsigned 32-bit number. An INTEGER is a signed 32-bit value. By convention, you write the name of a Counter object as a plural; it ends in a lowercase s. Here is an example:
icmpInDestUnreachs OBJECT-TYPE SYNTAX Counter ACCESS read-only STATUS mandatory DESCRIPTION The number of ICMP Destination Unreachable messages received. ::= { icmp 3 }
A Gauge is an application-wide type that represents a nonnegative integer. It may increase or decrease, but it latches at a maximum value. The maximum counter value is 232-1 (4,294,967,295 decimal). Here is an example:
ifSpeed OBJECT-TYPE SYNTAX Gauge ACCESS read-only STATUS mandatory DESCRIPTION An estimate of the interfaces current bandwidth in bits per second. For interfaces that do not vary in bandwidth or for those where no accurate estimation can be made, this object should contain the nominal bandwidth. ::= { ifEntry 5 }
TimeTicks is an application-wide type that represents a nonnegative integer that counts the time in hundredths of a second since some epoch, or point in time. When the MIB defines object types that use this ASN.1 type, the description of the object type identifies the reference epoch. Here is an example:
sysUpTime OBJECT-TYPE SYNTAX TimeTicks ACCESS read-only STATUS mandatory DESCRIPTION The time (in hundredths of a since the network management portion of the system was last re-initialized. ::= { system 3 }
Opaque is an application-wide type that permits the passing of arbitrary ASN.1 syntax. The ASN.1 basic rules encode a value into a string of octets. This string, in turn, is encoded as an OCTET STRING, in effect double-wrapping the original ASN.1 value. SNMP does not currently use Opaque, although it may be found in some private MIBs.
Previous | Table of Contents | Next |