SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

BotDetect - Real-Time Bot Detection API
 
 

MAN page from Old RedHat 5.X ucd-snmp-devel-3.5.3-2.i386.rpm

MIB_API

Section: C Library Functions (3)
Updated: 24 April, 1997
Index 

NAME

init_mib, add_mibdir, init_mib_internals,read_module, read_mib, read_all_mibs,read_objid, read_module_node,print_mib,print_variable, print_value, print_objid, print_description 

SYNOPSIS

#include <stdio.h>
#include <sys/types.h>
#include <ucd-snmp/asn1.h>
#include <ucd-snmp/mib.h>
#include <ucd-snmp/parse.h>

void init_mib( void )
int add_mibdir( char *dirname )
int add_module_replacement( char *old_module, char *new_module, char *tag, int len )
void init_mib_internals( void )
struct tree *read_module( char *name )
struct tree *read_mib( char *filename )
struct tree *read_all_mibs( void )

void print_mib( FILE *fp)

int read_objid( char *input, oid *output, int *out_len)
int get_module_node( char *name, char *module, oid *objid, int *objidlen )

void print_variable( oid *objid, int objidlen, struct variable_list *variable)
void print_value( oid *objid, int objidlen, struct variable_list *variable)
void print_objid( oid *objid, int objidlen);
void print_description( oid *objid, int objidlen);
void snmp_set_mib_warnings( int );
void snmp_set_save_descriptions( int );

 

DESCRIPTION

The functions dealing with MIB modules fall into four groups.Those dealing with initialisation, those that read in and parse MIB files,those that search the MIB tree, and various output routines.

init_mibis a convenience function that handles all calls toadd_mibdir, read_moduleandread_mibfor standard applications.It should be called before any other routine that manipulates or accesses theMIB tree. This routine sets up various internal structures, as well asreading in the default MIB modules, as detailed below.

add_mibdiris used to define the range of directory locations which are searched for filescontaining MIB modules (one module per file).By default, this will be set to the directoryDATADIR/mibsbut this can be overridden by setting the environmental variableMIBDIRSto a (colon-separated) list of directories to search.Note that this does not actually load the MIB modules locatedin that directory, but is an initialisation step to make them available.This function returns a count of files found in the directory, or a -1if there is an error.

init_mib_internalssets up the internal structures, preparatory to reading in MIB modules.It should be called after all calls toadd_mibdir,and before and calls toread_module.This is called automatically ifinit_mibis used.

add_module_replacementcan be used to allow new MIB modules to obsolete older ones, withoutneeding to amend the imports clauses of other modules.It takes the names of the old and new modules, together with an indicationof which portions of the old module are affected.

tag len load the new module when:
NULL 0 always (the old module is a strict subset of the new)
name 0 for the given tag only
name non-0 for any identifier with this prefix
It can also be used to handle errors in the module identifiers usedin MIB import clauses (such as referring toRFC1213instead ofRFC1213-MIB).

read_modulelocates andparses the module specified, together with any modules that it importsfrom, and adds the contents of these modules to the active MIB tree.Note thatadd_mibdirmust first be called to add the directory containing the file with themodule definition, if this is not in the standard path.
By default, the following mib modules will be loaded: IP-MIB, IF-MIB,TCP-MIB, UDP-MIB, SNMPv2-MIB, RFC1213-MIB, UCD-SNMP-MIB.This can be overridden by setting the environmental variableMIBSto a (colon-separated) list of modules to load.If this variable starts with a plus character, then the specified modulesare added to the default list. Otherwise only those modules listed areloaded (together with any others they import from).IfMIBSis set toALL,read_all_mibsis called to load all the MIB files found in all the specifiedMIBDIRS.

read_mibparses the file specified, together with any modules that it importsfrom, and adds the contents to the active MIB tree.Such a file can contain more then one module, though care must be takenthat any imports occur earlier in the file, if they are not to be readfrom the installed modules.Note that the file specified does not need to be in any of thedirectories initialised byadd_mibdir(or the default setup), though any imported modules do.
The environmental variableMIBFILEScan be set to a (colon-separated) list of files containing mibs to load.

read_objidtakes a string containing a textual version of an object identifier(in either numeric or descriptor form), and transforms this intothe corresponding list of sub-identifiers. This is returned in theoutputparameter, with the number of sub-identifiers returned viaout_len.When called, out_len must hold the maximum length of theoutputarray.This fuction returns a value of 0 if it succeeds in parsing the stringand 1 otherwise.

get_module_nodetakes a descriptor and the name of a module, and returns the correspondingoid list, in the same way asread_objidabove.
If the module name is specified as "ANY", then this routine will assumethat the descriptor given is unique within the tree, and will return thematching entry. If this assumption is invalid, then the behaviouras to which variable is returned is implementation dependant.

print_mibwill print out a representation of the currently active MIB tree tothe specified FILE pointer.

print_variablewill take an object identifier (as returned byread_objidorget_module_node) and an instance of such a variable, and prints outthe textual form of the object identifier together with the valueof the variable.
A related routinesprint_variabletakes an initial parameter of a string buffer, in which to print thisinformation.

print_valueandsprint_valuedo the same as the equivalentprint_variableroutines, but only displaying the value of the variable, withoutthe corresponding object identifier>

print_objidandsprint_objid
take an object identifier (without an accompanying variable instance)and print out the textual representation.
Note that identifiers lying within the mib-2, experimentalor private subtrees are listed from this point onwards,rather than with the full object identifier.

print_descriptiontakes an object identifier (as forprint_objidabove) and prints out the associated description.Note that there is no corresponding routinesprint_description

By default the parser does not save descriptions - they may be huge.In order to be able to print them, you must callsnmp_set_save_descriptions(1).

In general the parser is silent about what strangenesses it seesin the mib files. To get warnings reported, callsnmp_set_mib_warningswith a parameter of 1 (or 2 for even more warnings).

 

ENVIRONMENT VARIABLES

MIBDIRS
A colon separated list of directories to search for MIB modules.Default: LIBDIR/snmp/mibs
MIBFILES
A colon separated list of files to load.Default: (none)
MIBS
A colon separated list of MIB modules to load.Default: IP-MIB:IF-MIB:TCP-MIB:UDP-MIB:SNMPv2-MIB:RFC1213-MIB:UCD-SNMP-MIB.
 

SEE ALSO

snmp_api(3)


 

Index

NAME
SYNOPSIS
DESCRIPTION
ENVIRONMENT VARIABLES
SEE ALSO

This document was created byman2html,using the manual pages.
 
ICM Bot detect detector