beautypg.com

Compaq AAR04BCTE User Manual

Page 68

background image

eSNMP API Routines
esnmp_register2

Example

#include
#define RESPONSE_TIMEOUT

0

/* use the default time set

in esnmp_init message */

#define REGISTRATION_PRIORITY

10

/* priority at which the MIB

subtree will register */

#define RANGE_SUBID

7

/* the identifier position in

oid->elements just after mib-2 */

#define RANGE_UPPER_BOUND

8

/* the identifier for egp,

under mib-2 */

int status
extern SUBTREE ip_subtree;
static ESNMP_REG esnmp_reg_for_ip2egp;

/* retain this structure for

a subsequent call to
esnmp_unregister2 */

/*

*

initialize the ESNMP_REG structure

*/

memset(&esnmp_reg_for_ip2egp, 0, sizeof(ESNMP_REG));
esnmp_reg_for_ip2egp.subtree

= &ip_subtree;

esnmp_reg_for_ip2egp.priority

= REGISTRATION_PRIORITY;

esnmp_reg_for_ip2egp.timeout

= RESPONSE_TIMEOUT;

esnmp_reg_for_ip2egp.range_subid

= RANGE_SUBID;

esnmp_reg_for_ip2egp.range_upper_bound = RANGE_UPPER_BOUND;

status = esnmp_register2( &esnmp_reg_for_ip2egp );
if (status != ESNMP_LIB_OK) {

printf("Could not queue the ’ipRouteEntry’ \n");
printf("subtree for registration\n");

}

5–10 eSNMP API Routines