eSNMP API Routines
o_oid
o_oid
Loads an
OID
value into the VARBIND structure with the appropriate type. This
function does not allocate the VARBIND structure.
Format
int o_oid ( VARBIND *vb,
OBJECT *obj,
OID *oid );
Arguments
vb
A pointer to the VARBIND structure that is supposed to receive the data.
If the original value in the VARBIND structure is not null, this routine attempts
to free it. So if you dynamically allocate memory or issue the
malloc
command to
allocate your own VARBIND structure, fill the structure with zeros before using
it.
obj
A pointer to the OBJECT structure for the MIB variable associated with the
OID
in the VARBIND structure.
oid
The value to be inserted into the VARBIND structure as data. For more
information about OID length and values, see Chapter 3.
The real type as defined in the object structure must be ESNMP_TYPE_OBJECT_
IDENTIFIER.
Return Values
ESNMP_MTHD_noError
The routine completed successfully.
ESNMP_MTHD_genErr
An error occurred.
Example
#include <esnmp.h>
#include "ip_tbl.h"
<-- for ipNetToMediaEntry_type definition
VARBIND
*vb
= method->varbind;
OBJECT
*object
= method->object;
ipNetToMediaEntry_type *data;
:
: assume buffer and structure member assignments occur here
:
switch(arg) {
case I_atObjectID:
return o_oid(vb, object, &data->ipNetToMediaObjectID);
5–34 eSNMP API Routines