Lecture 22: Network Management #2


Basic Encoding Rules - Transfer Syntax for ASN.1

These rules describe how an entity, defined using ASN.1, is encoded for transmission. In ASN.1, it is said to "disambiguate" a stream of bytes arriving over a network, in that both the type and value of an entity can be determined immediately. BER specifies that an ASN.1 object is encoded as a TAG, followed by a LENGTH and then a VALUE -- ie, TLV encoding: thus:
TLV encoding
The TAG is (usually) encoded in a single octet, containing its value (see earlier) in binary in the low-order 5 bits and some other information in the remaining 3 bits[1].

The LENGTH can be encoded in two possible ways, definite (which usually only requires a single octet, and is the most common) and indefinite (which requires, at least, several more octets).

The VALUE field is encoded using a specified method which is appropriate to its type - for example, an INTEGER is sent as its binary 2's complement equivalent; an OCTET STRING is simply the appropriate octets.

[1] The CLASS (see slide 4) of the object (most significant 2 bits), and whether it is a simple or constructed (structured) data type (1 bit: 0 for simple, 1 for constructed).


BER Examples

A Boolean value of true would be encoded in ASN.1/BER as three octets, thus:
TLV-encoded BOOLEAN
A small-valued integer might be encoded as:
TLV-encoded INTEGER
An octet-string encodes just the bytes of the string, thus:
TLV-encoded OCTET STRING

Object Identifiers

ASN.1 might be of only passing interest were it not for the OBJECT IDENTIFIER data type. An OBJECT IDENTIFIER is a simple ASN.1 data type with special properties.

An OBJECT IDENTIFIER is a data type denoting an authoritatively named object, regardless of the type of the object which it names. The (somewhat hubristic) notion here is that provides a naming scheme allowing us to specify names of things, in a global sense, such that everything that there is in the universe[2] can have a globally-unique name.

It is written as a sequence of non-negative integer values which describe a traversal of a tree. The tree consists of a root connected to a number of labelled nodes via edges. Each label consists of a non-negative integer value and an optional brief textual description (or Object Descriptor associated with it). The most common format for writing down the value of an OBJECT IDENTIFIER is as a dotted sequence, thus:

1.0.8571.5.1
This identifies the object found by starting at the root, moving to the node with label 1, then moving to the node with label 0, and so on. The node found after traversing this list is the one being identified. Other formats for describing OBJECT IDENTIFIERS are also used, see later.

[2] More correctly, we should probably say every kind of thing in the universe has a unique name, instead of "every thing".


SNMP Basic Data Types

The SNMP MIB is defined in terms of only a few basic (ie, their tag types is UNIVERSAL) ASN.1 object types: the OBJECT IDENTIFIER, its associated Object Descriptor, the INTEGER and the OCTET STRING

SNMP additionally defines some new data types for use in the management framework:

IpAddress
A data type representing an IP address:
IpAddress ::=
    [APPLICATION 0]
    IMPLICIT OCTET STRING (SIZE (4))
Counter
A data type representing a non-negative integer which monotonically increases until it reaches a maximum value when it wraps to zero.
Counter ::=
    [APPLICATION 1]
    IMPLICIT INTEGER (0..4292967295)
Gauge
A data type representing a non-negative integer which may increase or decrease, but which latches at a maximum value.
Gauge ::=
    [APPLICATION 2]
    IMPLICIT INTEGER (0..4292967295)
TimeTicks
hundredths of a second
Opaque
arbitrary encoding


The SNMP SMI

The following diagram shows the local of the SNMP MIB in the context of the overall OBJECT IDENTIFIER (OID) tree:
SNMP MIB
Thus the "TCP" subtree of object identifiers in the MIB starts with the prefix (OBJECT IDENTIFIER):
1.3.6.1.2.1.6
whilst the "System" subtree starts at:
1.3.6.1.2.1.1
This could also be written as:
{ iso org dod internet mgmt mib system }
or in a "hybrid" format:
{ iso(1) org dod 1 mgmt(2) mib 1 }

Format Of MIB Entries

By convention, no object in the Internet standard MIB has a sub-identifer of zero (find out why in our next lecture). Thus, the first variable in the system group ("system OBJECT IDENTIFIER ::= { mib 1 }") of the MIB is: "{ system 1 }", or
1.3.6.1.2.1.1.1
The following is copied from the generic MIB description commonly found in the file "/etc/mib.txt" on Unix systems, and is the ASN.1 definition for this same MIB object:
sysDescr OBJECT-TYPE
	SYNTAX OCTET STRING
	ACCESS read-only
	STATUS mandatory
		::= { system 1 }
NB: The value of the SNMP type (variable?) "sysDescr" is a string of text which gives the manufacturer's type designation of the managed device, and commonly some other interesting facts such as firmware version numbers and build dates. Note that the abbreviation "{ system 1 }" is commonly allowed by SNMP software, since the OID path to the MIB is normally assumed.


Digression: Philosophy of MIB Contents

The MIB describes objects (data items) which are expected to be implemented by managed nodes -- ie, they contain interesting information about the node. For the original (1988) version of the MIB, the following rules were used in deciding on a minimum set of MIB objects:

La Trobe Uni Logo


Copyright © 2004 by Philip Scott, La Trobe University.
Valid HTML 3.2!