SNMP Subagent Programmer's Guide

Writing and Compiling MIBs
SNMP Subagent Programmer’s Guide—119728 3-11
Encoding MIBs
This MIB object is a DisplayString (meaning a printable string of ASCII characters) that
is defined to be between 1 and 255 characters long. The C_VARIABLE clause indicates
that a global variable holds the value of this MIB object.
The subagent may need to perform some processing before the run-time library accesses
the global variable. In this case, the subagent uses a locator function:
EXTEND OBJECT-TYPE helloOutputText
WITH C_VARIABLE helloText
C_LOCATOR_FUNC hello_text_locator
IN C
This definition requires that the subagent provide the function hello_text_locator(),
which would be called before accessing the global variable helloText.
You could also indicate that the subagent supplies functions to Get, Test, and Set the
value of the MIB object. This can be done as follows:
EXTEND OBJECT-TYPE helloOutputText
WITH C_ACCESS_FUNC hello_text
IN C
When the C_ACCESS_FUNC clause is used with a read-write object, you must provide
Get, Test, and Set functions. For read-only objects, only a Get function is required. To
handle operations on helloOutputText, a read-write object, the subagent code must
include these three functions:
GET_hello_text()
SET_hello_text()
TEST_hello_text()
Table Definitions
A table definition describes a table, an entry in the table, and each object in a table entry.
Each object in a table entry must be a scalar object.
Syntax
Encode a table definition for each table in your MIB. Extensions to the standard concise
MIB notation, shown in bold type, relate the abstract class defined in the MIB with how
your subagent implements it. Ways to encode MIB object definitions so that standard