beautypg.com

Cmp_oct – Compaq AAR04BCTE User Manual

Page 111

background image

eSNMP API Routines

cmp_oct

cmp_oct

Compares two octet strings.

Format

int cmp_oct ( oct *oct1,

oct *oct2 );

Arguments

oct1

Pointer to the first octet string.

oct2

Pointer to the second octet string.

Description

The two octet strings are compared byte-by-byte to determine the length of the

shortest octet string. If all bytes are equal, the lengths are compared. An octet
with a null pointer is considered the same as a zero-length octet.

Return Values

-1

The string pointed to by the first

oct

is less than

the second.

0

The string pointed to by the first

oct

is equal to

the second.

1

The string pointed to by the first

oct

is greater

than the second.

Example

#include
OCT abc, efg;

...abc and efg are initialized to something...

if (cmp_oct(&abc, &efg) > 0)

DPRINTF((WARNING,"octet abc is larger than efg...\n"));

eSNMP API Routines 5–53