Compaq TCP/IP Services for OpenVMS Programming And Reference Manual page 104

Tcp/ip services for openvms
Table of Contents

Advertisement

eSNMP API Routines
inst2ip
The search key consists of a number and two ipaddr values. These are
represented in the instance part of the OID as n.A.A.A.A.B.B.B.B, where:
If all elements are given, the total length of the search key is 9. In this
case, you perform the operation as follows:
#include <esnmp.h>
OID
OBJECT
int instLength;
unsigned int instance[9];
unsigned int ip_addrA;
unsigned int ip_addrB;
int
int
-- The instance is N.A.A.A.A.B.B.B.B --
instLength = oid2instance(incoming, object, instance, 9);
iface = (instLength < 1) ? 0 :(int) instance[0];
carry = inst2ip(&instance[1], instLength - 1, &ip_addrB, FALSE, 1);
carry = inst2ip(&instance[5], instLength - 5, &ip_addrA, FALSE, carry);
iface += carry;
if (iface > carry) {
-- a carry caused an overflow in the most significant element
return ESNMP_MTHD_noSuchInstance;
}
5–46 eSNMP API Routines
n is a single value integer.
The A.A.A.A portion makes up one IP address.
The B.B.B.B portion makes up a second IP address.
Convert the least significant part of the key (that is, the B.B.B.B
portion), by calling the
and (length - 5) for the length.
If the conversion of the B.B.B.B portion generates a carry (that is,
returns 1), you pass it to the next most significant part of the key.
Convert the A.A.A.A portion by calling the
(length - 1) for the length and the carry returned from the conversion
of the B.B.B.B portion.
The most significant element n is a number; therefore, add the carry
from the A.A.A.A conversion to the number. If the result overflows,
then the search key is not valid.
*incoming = &method->varbind->name;
*object
= method->object;
iface;
carry;
routine, passing it a 1 for the carry
inst2ip
inst2ip
routine, passing it

Advertisement

Table of Contents
loading

Table of Contents