mib_api man page on BSDi

Man page or keyword search:  
man Server   6284 pages
apropos Keyword Search (all sections)
Output format
BSDi logo
[printable version]



MIB_API(3)					       MIB_API(3)

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 - mib_api functions

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 vari-
       able_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_mib	 is a convenience function that handles all calls
       to  add_mibdir,	read_module  and  read_mib  for	 standard
       applications.   It  should be called before any other rou-
       tine that manipulates or accesses the MIB tree.	This rou-
       tine sets up various internal structures, as well as read-
       ing in the default MIB modules, as detailed below.

       add_mibdir is used to define the range of directory  loca-
       tions  which are searched for files containing MIB modules
       (one module per file).  By default, this will  be  set  to

			   18 Dec 1999				1

MIB_API(3)					       MIB_API(3)

       the  directory  DATADIR/mibs but this can be overridden by
       setting the environment variable MIBDIRS to a (colon-sepa-
       rated) list of directories to search.  Note that this does
       not actually load the MIB modules located in  that  direc-
       tory,  but  is  an initialisation step to make them avail-
       able.  This function returns a count of files found in the
       directory, or a -1 if there is an error.

       init_mib_internals   sets   up  the  internal  structures,
       preparatory to reading  in  MIB	modules.   It  should  be
       called after all calls to add_mibdir, and before and calls
       to read_module.	This is called automatically if	 init_mib
       is used.

       add_module_replacement  can  be used to allow new MIB mod-
       ules to obsolete older ones, without needing to amend  the
       imports	clauses	 of other modules.  It takes the names of
       the old and new modules, together with  an  indication  of
       which portions of the old module are affected.
	      tab(+); lb lb lb l  l  l.	 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 identi-
       fiers used in MIB import clauses	 (such	as  referring  to
       RFC1213 instead of RFC1213-MIB ).

       read_module  locates  and  parses  the  module  specified,
       together with any modules that it imports from,	and  adds
       the  contents  of  these	 modules  to the active MIB tree.
       Note that add_mibdir must  first	 be  called  to	 add  the
       directory  containing the file with the module 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 envi-
       ronment	variable MIBS to a (colon-separated) list of mod-
       ules to load.  If this variable starts with a plus charac-
       ter,  then  the specified modules are added to the default
       list.  Otherwise only  those  modules  listed  are  loaded
       (together  with	any others they import from).  If MIBS is
       set to ALL, read_all_mibs is called to load  all	 the  MIB
       files found in all the specified MIBDIRS.

       read_mib parses the file specified, together with any mod-
       ules that it imports from, and adds the	contents  to  the
       active  MIB  tree.   Such a file can contain more then one
       module, though care must be taken that any  imports  occur
       earlier	in  the file, if they are not to be read from the
       installed modules.  Note that the file specified does  not
       need  to	 be  in	 any  of  the  directories initialised by
       add_mibdir (or the default  setup),  though  any	 imported

			   18 Dec 1999				2

MIB_API(3)					       MIB_API(3)

       modules do.
       The  environment variable MIBFILES can be set to a (colon-
       separated) list of files containing mibs to load.

       read_objid takes a string containing a textual version  of
       an  object  identifier  (in  either  numeric or descriptor
       form), and transforms this into the corresponding list  of
       sub-identifiers.	  This	is returned in the output parame-
       ter, with  the  number  of  sub-identifiers  returned  via
       out_len.	  When	called,	 out_len  must	hold  the maximum
       length of the output array.  This function returns a value
       of 1 if it succeeds in parsing the string and 0 otherwise.

       get_module_node takes a descriptor and the name of a  mod-
       ule,  and  returns the corresponding oid list, in the same
       way as read_objid above.
       If the module name is specified as "ANY", then  this  rou-
       tine  will  assume  that	 the  descriptor  given is unique
       within the tree, and will return the matching  entry.   If
       this assumption is invalid, then the behaviour as to which
       variable is returned is implementation dependent.

       print_mib will print out a representation of the currently
       active MIB tree to the specified FILE pointer.

       print_variable will take an object identifier (as returned
       by read_objid or get_module_node ) and an instance of such
       a  variable, and prints out the textual form of the object
       identifier together with the value of the variable.
       A related routine sprint_variable takes an initial parame-
       ter  of	a  string buffer, in which to print this informa-
       tion.

       print_value and sprint_value do the same as the equivalent
       print_variable  routines, but only displaying the value of
       the variable, without the corresponding object identifier>

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

       print_description  takes	 an  object  identifier	 (as  for
       print_objid  above) and prints out the associated descrip-
       tion.   Note  that  there  is  no  corresponding	  routine
       sprint_description

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

       In  general  the parser is silent about what strangenesses

			   18 Dec 1999				3

MIB_API(3)					       MIB_API(3)

       it sees in the mib files. To get warnings  reported,  call
       snmp_set_mib_warnings with 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)

			   18 Dec 1999				4

[top]

List of man pages available for BSDi

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net