Compaq TCP/IP Services for OpenVMS Programming And Reference Manual page 40

Tcp/ip services for openvms
Table of Contents

Advertisement

Creating a Subagent Using the eSNMP API
3.3 Creating a MIB Source File
2. Array of OBJECT Structures Section
The second section of the subtree_TBL.C file is an array of OBJECT structures.
Each MIB variable within the subtree has one OBJECT. The chess example
produces the following:
static OBJECT objects[] = {
{I_chessProductID
. . .
An OBJECT structure represents a MIB variable and has the following fields:
object_index
which identifies this variable (in the chess example,
oid
This variable is of type OID, which is a structure containing two elements:
the number of elements in the OID and a pointer to the correct starting place
in the array of elements (
In the chess example,
indicates that:
The OID has 12 integers separated by dots in the ASCII text
representation (
The integer with index 11 in the array
type
getfunc
no routine exists).
setfunc
no routine exists).
The master agent does not access object tables or MIB variables directly. It only
maintains a registry of subtrees. When a request for a particular MIB variable
arrives, it is processed as shown in the following steps (where the MIB variable is
mib_var
1. The master agent finds
in the register of subtrees. The authoritative region is determined as the
registered MIB subtree that has the longest prefix and the highest priority.
2. The master agent sends a message to the subagent that registered
3. The subagent consults its list of registered subtrees and locates
It searches the object table of
mib_var
The first object lexicographically after
4. The appropriate method routine is called. If the method routine completes
successfully, the data is returned to the master agent. If the method routine
fails when doing a
fails when doing a
object table of
the table is exhausted. In either case, a response is returned.
5. If the master agent detects that
routine, it recursively tries the subtree lexicographically after
a subagent returns a value or the registry of subtrees is exhausted.
3–10 Creating a Subagent Using the eSNMP API
,{12, &elems[ 11]}, ESNMP_TYPE_ObjectId
— The constant I_mib-variable from the subtree_TBL.H file,
— The variable's OID (points to a part of
elems[ ]
oid
is designated by
"1.3.6.1.4.1.36.2.15.2.99.2"
— The variable's eSNMP data type.
— The address of the method routine to call for
— The address of the method routine to call for
and the subtree is
subtree_1
subtree_1
(for
and
Get
Set
Get
or
Set
, the code keeps trying subsequent objects in the
GetNext
until either a method routine returns successfully or
subtree_1
I_chessProductID
elems[ ]
in the chess example).
{12, &elemens[ 11]}
)
is the first element.
elems[ ]
):
as the authoritative region for the
and locates the following:
subtree_1
routines)
(for
mib_var
, an error is returned. If the method routine
could not return data on a
subtree_1
,chess_get, NULL},
.)
).
. This
Get
requests (null if
requests (null if
Set
mib_var
.
subtree_1
.
subtree_1
or
routines)
Next
Bulk
Next
until
subtree_1

Advertisement

Table of Contents
loading

Table of Contents