beautypg.com

Get routine – Compaq AAR04BCTE User Manual

Page 78

background image

eSNMP API Routines
*_get Routine

*_get Routine

The *_get routine is a method routine for the specified MIB item, which is

typically a MIB group (for example,

system

in MIB II) or a table entry (for

example,

ifEntry

in MIB II).

Format

int mib-group_get ( METHOD *method ) ;

Arguments

method

A pointer to a METHOD structure that contains the following fields:

Field Name

Description

action

One of ESNMP_ACT_GET, ESNMP_ACT_
GETNEXT, or ESNMP_ACT_GETBULK.

serial_num

An integer number that is unique to this SNMP
request. Each method routine called while
servicing a single SNMP request receives the
same value of serial_num. New SNMP requests
are indicated by a new value of serial_num.

repeat_cnt

Used for

GetBulk

only. This value indicates

the current iteration number of a repeating
VARBIND. This number increments from 1 to
max_repetitions and is 0 (zero) for nonrepeating
VARBIND structures.

max_repetitions

The maximum number of repetitions to
perform. Used for

GetBulk

only. This will be 0

(zero) for nonrepeating VARBIND structures.
You can optimize subsequent processing by
knowing the maximum number repeat calls will
be made.

varbind

A pointer to the VARBIND structure for
which you must fill in the OID and data
fields. Upon entry of the method routine,
the method->varbind->name field is the OID
that was requested.
Upon exit of the method routine, the
method->varbind field contains the requested
data, and the method->varbind->name field is
updated to reflect the actual instance OID for
the returned VARBIND structure.
The support routines (

o_integer

,

o_string

,

o_oid

, and

o_octet

) are generally used

to load data. The libsnmp

instance2oid

routine is used to update the OID in the
method->varbind->name field.

5–20 eSNMP API Routines