beautypg.com

Cmp_oid_prefix – Compaq AAR04BCTE User Manual

Page 106

background image

eSNMP API Routines
cmp_oid_prefix

cmp_oid_prefix

Compares an OID against a prefix.

Format

int cmp_oid_prefix ( oid *q,

oid *prefix );

Description

A prefix could be the OID on an object in the object table. The elements beyond

the prefix are the instance information.

This routine does an element-by-element comparison, from the most significant
element (element 0) to the least significant element. If all elements of the prefix
OID match exactly with corresponding elements of the

OID q

structure, it is

considered an even match if the

OID q

structure contains additional elements.

The

OID q

structure is considered greater than the prefix if the first nonmatching

element is larger. It is considered smaller if the first nonmatching element is less.

Return Values

-1

The OID is less than the prefix.

0

The OID is in prefix.

1

The OID is greater than the prefix.

Example

#include
OID *q;
OBJECT *object;
if (cmp_oid_prefix(q, &object->oid) == 0)

printf("matches prefix\n");

5–48 eSNMP API Routines