Connected: An Internet Encyclopedia
RFC 1212 - 4. Defining Objects

Top: Connected: An Internet Encyclopedia
Up: Requests For Comments
Up: RFC 1212
Prev: 3.2. Row Addition
Next: 4.1. Mapping of the OBJECT-TYPE macro

### 4. Defining Objects

The Internet-standard SMI employs a two-level approach towards object definition. A MIB definition consists of two parts: a textual part, in which objects are placed into groups, and a MIB module, in which objects are described solely in terms of the ASN.1 macro OBJECT-TYPE, which is defined by the SMI.

An example of the former definition might be:

              OBJECT:
              -------
                   sysLocation { system 6 }

              Syntax:
                   DisplayString (SIZE (0..255))

              Definition:
                   The physical location of this node (e.g., "telephone
                   closet, 3rd floor").

              Access:
                   read-only.

              Status:
                   mandatory.

An example of the latter definition might be:

                   sysLocation OBJECT-TYPE
                       SYNTAX  DisplayString (SIZE (0..255))
                       ACCESS  read-only
                       STATUS  mandatory
                       ::= { system 6 }

In the interests of brevity and to reduce the chance of editing errors, it would seem useful to combine the two definitions. This can be accomplished by defining an extension to the OBJECT-TYPE macro:

              IMPORTS
                  ObjectName
                      FROM RFC1155-SMI
                  DisplayString
                      FROM RFC1158-MIB;

              OBJECT-TYPE MACRO ::=
              BEGIN
                  TYPE NOTATION ::=
                                              -- must conform to
                                              -- RFC1155's ObjectSyntax
                                    "SYNTAX" type(ObjectSyntax)
                                    "ACCESS" Access
                                    "STATUS" Status
                                    DescrPart
                                    ReferPart
                                    IndexPart
                                    DefValPart
                  VALUE NOTATION ::= value (VALUE ObjectName)

                  Access ::= "read-only"
                                  | "read-write"
                                  | "write-only"
                                  | "not-accessible"
                  Status ::= "mandatory"
                                  | "optional"
                                  | "obsolete"
                                  | "deprecated"

                  DescrPart ::=
                             "DESCRIPTION" value (description DisplayString)
                                  | empty

                  ReferPart ::=
                             "REFERENCE" value (reference DisplayString)
                                  | empty

                  IndexPart ::=
                             "INDEX" "{" IndexTypes "}"
                                  | empty
                  IndexTypes ::=
                             IndexType | IndexTypes "," IndexType
                  IndexType ::=
                                      -- if indexobject, use the SYNTAX
                                      -- value of the correspondent
                                      -- OBJECT-TYPE invocation
                             value (indexobject ObjectName)
                                      -- otherwise use named SMI type
                                      -- must conform to IndexSyntax below
                                  | type (indextype)

                  DefValPart ::=
                             "DEFVAL" "{" value (defvalue ObjectSyntax) "}"
                                  | empty

              END

              IndexSyntax ::=
                  CHOICE {
                      number
                          INTEGER (0..MAX),
                      string
                          OCTET STRING,
                      object
                          OBJECT IDENTIFIER,
                      address
                          NetworkAddress,
                      ipAddress
                          IpAddress
                  }

4.1. Mapping of the OBJECT-TYPE macro

4.1.1. Mapping of the SYNTAX clause
4.1.2. Mapping of the ACCESS clause
4.1.3. Mapping of the STATUS clause
4.1.4. Mapping of the DESCRIPTION clause
4.1.5. Mapping of the REFERENCE clause
4.1.6. Mapping of the INDEX clause
4.1.7. Mapping of the DEFVAL clause
4.1.8. Mapping of the OBJECT-TYPE value

4.2. Usage Example

Next: 4.1. Mapping of the OBJECT-TYPE macro

Connected: An Internet Encyclopedia
RFC 1212 - 4. Defining Objects