O_string – Compaq AAR04BCTE User Manual

Page 93

Advertising
background image

eSNMP API Routines

o_string

o_string

Loads a string value into the VARBIND structure with the appropriate type. This
function does not allocate the VARBIND structure.

Format

int o_string ( VARBIND *vb,

OBJECT *obj,
unsigned character *ptr,
int len );

Arguments

vb

A pointer to the VARBIND structure that is supposed to receive the data.

If the original value in the VARBIND structure is not null, this routine attempts
to free it. So if you dynamically allocate memory or issue the

malloc

command to

allocate your own VARBIND structure, fill the structure with zeros before using
it.

obj

A pointer to the OBJECT structure for the MIB variable associated with the

OID

in the VARBIND structure.

ptr

The pointer to the buffer containing data to be inserted into the VARBIND
structure as data.

len

The length of the data in buffer pointed to by ptr.

The real type as defined in the object structure must be one of the following;
otherwise, an error is returned.

ESNMP_TYPE_OCTET_
STRING

Octet string (ASN.1)

ESNMP_TYPE_IpAddress

Implicit octet string (4) (in octet form, network
byte order)

ESNMP_TYPE_DisplayString

DisplayString (textual convention)

ESNMP_TYPE_NsapAddress

Implicit octet string

ESNMP_TYPE_Opaque

Implicit octet string

ESNMP_TYPE_OBJECT_
IDENTIFIER

Object identifier (ASN.1) (in dot notation, for
example: 1.3.4.6.3)

Return Values

ESNMP_MTHD_noError

The routine completed successfully.

ESNMP_MTHD_genErr

An error occurred.

eSNMP API Routines 5–35

Advertising