MIB Smithy

  1. Up to Table of Contents

Scanning SNMP Data for Transmission

Because DISPLAY-HINTs are always reversible, object values returned by SNMP Get, Get-Next, and Get-Bulk requests are returned in raw form, unformatted for display. For example, OBJECT IDENTIFIER values are returned in dotted number form, enumerated integers in integer form, and OCTET STRINGs as raw binary strings (byte arrays in Tcl_Obj terms). With the exception of symbolic OIDs and enumerated integers these are also the only forms accepted for sending in a request.

MIB Smithy SDK does, however, provide limited facilities for inverting the formatting of values (where possible) to the raw form necessary for sending in a request. Inversion (scanning) is done according to the data type, enumerations, and DISPLAY-HINT, as applicable for a specified record and value.

The API can be called through either the SMI Database command or an SNMP Session command. In the latter case, the command is passed on to the SMI Database that is associated with the session.


  • % dbcmd scan ?options? record ?syntax? value
  • % dbcmd scan ?options? syntax value
  • % snmpcmd scan ?options? record ?syntax? value
  • % snmpcmd scan ?options? syntax value


is the name of any database;
is the name of any session;
is the name or OID of a record (generally an OBJECT-TYPE or TEXTUAL-CONVENTION);
is an ASN.1 type or TEXTUAL-CONVENTION (in lieu of, or in addition to, the search record); and
is a value (appropriate to the record's formatted type) to be scanned.

Using both record and syntax parameters is useful for applying default inversion rules for variables according to SNMP data type for which the OID.


  • For an enumeration label: the integer values associated with the label, such as 6 for RowStatus's destroy.
  • For OBJECT IDENTIFIER values: the full OID value including any subidentifiers in dotted numeric notation (as with $db get -fulloid), such as for sysDescr.0.
  • For other integer and OCTET STRING values: the raw value which, when formatted according to the appropriate DISPLAY-HINT, produces the input value (if possible to invert).
  • For all other cases, returns the input value or an error.


-enumformat format
Not currently used
Suppresses errors in cases such as the value not being valid according to type or DISPLAY-HINT for the record. If an error would have occurred, the format command will instead return the unmodified input value.
-oidformat format
Not currently used
-strformat format
Specifies the desired input format (in DISPLAY-HINT syntax) for OCTET STRING values where no DISPLAY-HINT is available, overriding the database defaults.
-ticksformat format
Specifies the desired input format (in DISPLAY-HINT syntax) for TimeTicks values where no DISPLAY-HINT is available, overriding the database defaults.

Example 1 - Enumerated Integer Value

% smilib scan RowStatus destroy

Example 2 - Integer with Decimal Offset (DISPLAY-HINT "d-3")

% smilib scan Hundredths 0.100


% smilib scan RowPointer sysDescr.0

Example 4 - OCTET STRING Value with DISPLAY-HINT

% smilib scan DateAndTime 2005-11-1,12:0:0

Example 5 - OCTET STRING Value without DISPLAY-HINT

% smilib scan "OCTET STRING" "\x07\xd5\x0b\x01\x0c\x00\x00"
  1. Up to Table of Contents