eSNMP API Routines
str2oid
str2oid
Converts a null-terminated string
OID
in dot notation to an
OID
structure. The
str2oid
routine does not allocate an
OID
structure.
Format
oid *str2oid ( oid *oid,
char *s );
Arguments
oid
The value to be inserted as data into the VARBIND structure. For more
information about OID length and values, see Chapter 3.
s
A null string or empty string returns an OID structure that has one element of
zero.
Description
The routine dynamically allocates the buffer and inserts its pointer into the
OID
structure passed in the call. The caller must explicitly free this buffer. The
OID
can have a maximum of 128 elements.
Return Values
null An error occurred. Otherwise, the pointer to the
OID
structure (its first argument) is returned.
Example
include <esnmp.h>
OID abc;
if (stroid (&abc, "1.2.5.4.3.6") == NULL
DPRINTF((WARNING, "It did not work...\n");
5–38 eSNMP API Routines