SNMP_MIB(3)SNMP_MIB(3)NAME
init_mib, load_mib, read_objid, print_objid, sprint_objid, print_vari‐
able, sprint_variable, print_value, sprint_value, print_variable_list,
print_variable_list_value, print_type, print_oid_nums - Functions
requiring an SNMP MIB
SYNOPSIS
cc [ flag ... ] file ... -lsnmp [ library ... ]
#include <sys/types.h>
#include <snmp/snmp.h>
int init_mib(void);
int load_mib(char * filename, int version);
int read_objid(char * input, oid * output, int * outlen);
void print_objid(oid * objid, int objidlen);
void sprint_objid(char * buf, oid * objid, int objidlen);
void print_variable(oid * ,objid, int objidlen, struct variable_list *
variable);
void sprint_variable(char * ,buf, oid * ,objid, int objidlen, struct
variable_list * variable);
void print_value(oid * ,objid, int objidlen, struct variable_list *
variable);
void sprint_value(char * ,buf, oid * ,objid, int objidlen, struct vari‐
able_list * variable);
void print_variable_list(struct variable_list *V);
void print_variable_list_value(struct variable_list *V);
void print_type(struct variable_list * V);
void print_oid_nums(oid * O, int len);
DESCRIPTIONinit_mib() loads the mib. Returns 1 upon success, 0 otherwise.
load_mib() reads the specified mibfile, assuming that the mibfile for‐
mat is the version supplied. Possible versions are OLD_CMU_SNMP_MIB
and SNMPV2_MIB.
read_objid() converts the input string (format ".iso.org." or ".1.3.6")
into an oid, and places the oid into the array output.
print_objid() prints the specified OID, replacing numbers with their
textual equivalents from the MIB whenever possible. sprint_objid()
does the same, but places the resulting text into buf.
print_variable() prints objid followed by the value of the vari‐
able_list variable to stdout, using any information / conversions spec‐
ified in the MIB. sprint_variable() does the same, but places the
resulting text into buf.
print_value() prints the value of the variable_list variable to stdout,
using any information / conversions specified in the MIB.
sprint_value() does the same, but places the resulting text into buf.
print_variable_list() is a shortcut for calling print_variable() on a
variable_list that contains the proper name.
print_variable_list_value() is a shortcut for calling print_vari‐
able_value() on a variable_list that contains the proper name.
print_type() prints the type of the specified variable_list.
print_oid_nums() prints the numeric value of O to stdout.
RETURN VALUESread_objid() returns 1 upon success, 0 otherwise.
ENVIRONMENT
MIBFILE: Location of the SNMP MIB.
FILES
mib.txt First MIB tried if env. var is not set
/etc/mib.txt Second MIB tried if env. var is not set
RFCS
Related RFCs: 1065, 1066, 1067
Related SNMPv2 RFCs: 1901, 1902, 1902, 1904, 1905, 1906, 1907, 1908,
1909
RELATED URLS
CMU Networking Group: http://www.net.cmu.edu/
CMU SNMP Home Page: http://www.net.cmu.edu/projects/snmp
SEE ALSOsnmp_api(3), snmp_api_errors(3), snmp_client(3), snmp_coexistance(3),
snmp_error(3), snmp_extra(3), snmp_mib(3), snmp_mibii(3),
snmp_mini_client(3), snmp_msg(3), snmp_packet_dump(3), snmp_pdu(3),
snmp_sess_api(3), snmp_vars(3), snmp_version_info(3), snmp_oid(5)snmp(3)4th Berkeley Distribution Tue Sep 24 11:13:15 2002SNMP_MIB(3)