SNMP Subagent Programmer's Guide
Encoding MIBs
3-4 119728—SNMP Subagent Programmer’s Guide
Writing and Compiling MIBs
The first elements in your MIB definition, SNMP type definitions, map the SNMP data
types to C data types. GDMOC requires that these definitions appear at the beginning of
your MIB definition because later definitions refer to them.
The Toolkit header file named typessmi contains SNMP type definitions for all the
SNMP data types. For example, here is how the SNMP data type for ASCII strings is
defined in typessmi:
DisplayString ::= OCTET STRING
You can explicitly encode type definitions your subagent needs, or you can use the
include directive to include typessmi:
#include "typessmi"
Object Name Definitions
The MIB definition contains an object name definition for your MIB and for each object
above it in the SNMP name hierarchy, starting with the iso node. If your MIB contains
groups, each group also requires an object name definition. Refer to the MIB definition
for MIB-II in RFC 1213 for examples of MIB groups, which are simply named
collections of objects within the MIB.
Syntax
You identify each group in your MIB, the MIB itself, and the objects above the MIB by
using the ASN.1 type OBJECT IDENTIFIER.
object-descriptor
is a logical name for the object.
object-name
consists of the name of the subtree in which the object resides, a space, and a
number identifying the object within the subtree:
{ mySubtreeOne 1 }
Numbers are assigned as follows:
•
The number for the subtree that represents a particular vendor is a registration
number obtained from the Internet Assigned Numbers Authority (IANA), as
described later in this subsection, under “MIB Information Resources.”
•
Numbers for objects within a vendor’s subtree (MIBs, products, groups of MIB
objects, individual MIB objects, and so forth) are assigned by the vendor.
object-descriptor OBJECT IDENTIFIER ::=
{ "{" object-name "}" |
"{" object-name-sequence "}" }