SNMP Manager Programmer's Guide

Reference Summary
SNMP Manager Programmer’s Guide–134249
9-7
Common Utility Functions
read_mib()
The read_mib() function loads the contents of a MIB compiler -readtree output file at
run time and converts it into an in-memory structure that string2oid() can parse. The in-
memory structure has the same format as the MIB compiler -nametree output.
string2oid()
The string2oid() function parses the in-memory structure created by a previous call to
read_mib() and returns information about the OID of a MIB object name in a structure
of type OBJ_ID_T.
#include "readmibh"
read_mib(readtree-filename);
int
read_mib(char* readtree-filename);
readtree-
filename
A pointer to the file containing the MIB compiler -readtree output.
SNMPWALK, the sample manager that uses read_mib(), presumes the
file is named mibrt.
include "rtutilsh"
num-components = string2oid(object-name, oid, oidlen);
int
string2oid(char *object-name, OIDC_T *oid, int oidlen);
num-
components
The number of components in the OID. For example, an OID of
1.4.6.0 contains four components. A value of 0 is returned if the
MIB name you pass to this function is not found in the in-
memory structure.
object-name
A pointer to the name and instance of the MIB object whose OID
you need.
oid
A pointer to a buffer for describing the OID.
oidlen
The number of bytes in the oid buffer.