Blame lib/smi_config.3.in

Packit 022b05
.\"
Packit 022b05
.\" $Id: smi_config.3.in 4432 2006-05-29 16:21:11Z strauss $
Packit 022b05
.\"
Packit 022b05
.TH smi_config 3  "August 22, 2001" "IBR" "SMI Management Information Library"
Packit 022b05
.SH NAME
Packit 022b05
.\" START OF MAN PAGE COPIES
Packit 022b05
smiInit,
Packit 022b05
smiExit,
Packit 022b05
smiSetErrorLevel,
Packit 022b05
smiGetFlags,
Packit 022b05
smiSetFlags,
Packit 022b05
smiLoadModule,
Packit 022b05
smiGetPath,
Packit 022b05
smiSetPath,
Packit 022b05
smiReadConfig
Packit 022b05
.\" END OF MAN PAGE COPIES
Packit 022b05
\- SMI library
Packit 022b05
configuration routines
Packit 022b05
.SH SYNOPSIS
Packit 022b05
.nf
Packit 022b05
.B #include <smi.h>
Packit 022b05
.RS
Packit 022b05
.RE
Packit 022b05
.sp
Packit 022b05
.BI 
Packit 022b05
.RE
Packit 022b05
.sp
Packit 022b05
.BI "int smiInit(const char *" tag );
Packit 022b05
.RE
Packit 022b05
.sp
Packit 022b05
.B "int smiExit();"
Packit 022b05
.RE
Packit 022b05
.sp
Packit 022b05
.BI "void smiSetErrorLevel(int " level );
Packit 022b05
.RE
Packit 022b05
.sp
Packit 022b05
.BI "int smiGetFlags();"
Packit 022b05
.RE
Packit 022b05
.sp
Packit 022b05
.BI "void smiSetFlags(int " userflags );
Packit 022b05
.RE
Packit 022b05
.sp
Packit 022b05
.BI "char *smiLoadModule(char *" module );
Packit 022b05
.RE
Packit 022b05
.sp
Packit 022b05
.BI "int smiIsLoaded(char *" module );
Packit 022b05
.RE
Packit 022b05
.sp
Packit 022b05
.BI "char *smiGetPath();"
Packit 022b05
.RE
Packit 022b05
.sp
Packit 022b05
.BI "int smiSetPath(char *" path );
Packit 022b05
.RE
Packit 022b05
.sp
Packit 022b05
.BI "int smiSetSeverity(char *" pattern ", int " severity );
Packit 022b05
.RE
Packit 022b05
.sp
Packit 022b05
.BI "int smiReadConfig(char *" filename ", const char *" tag );
Packit 022b05
.RE
Packit 022b05
.sp
Packit 022b05
.BI "void smiSetErrorHandler(SmiErrorHandler *" smiErrorHandler );
Packit 022b05
.RE
Packit 022b05
Packit 022b05
typedef void (SmiErrorHandler) (char *path, int line,
Packit 022b05
				int severity, char *msg, char *tag);
Packit 022b05
Packit 022b05
.fi
Packit 022b05
.SH DESCRIPTION
Packit 022b05
These functions provide some initialization and adjustment operations
Packit 022b05
for the SMI library.
Packit 022b05
.PP
Packit 022b05
The \fBsmiInit()\fP function should be the first SMI function called
Packit 022b05
in an application. It initializes its internal structures. If \fItag\fP is
Packit 022b05
not NULL, the global configuration file and (on UNIX systems)
Packit 022b05
a user configuration file are read implicitly, if existent. All
Packit 022b05
global statements and those statements with a tag (a ``tag: '' prefix) that
Packit 022b05
matches the \fBtag\fP argument are executed. 
Packit 022b05
(see also CONFIGURATION FILES below).
Packit 022b05
\fBsmiInit()\fP returns zero on success, or otherwise a negative value.
Packit 022b05
.PP
Packit 022b05
The \fBsmiInit()\fP function can also be used to support multiple sets
Packit 022b05
of MIB data. In this case, the \fBtag\fP argument may be prepended by
Packit 022b05
a colon and a name to differentiate the data sets. Any library
Packit 022b05
function call subsequent to an \fBsmiInit("tag:dataset")\fP call is
Packit 022b05
using the specified data set.
Packit 022b05
.PP
Packit 022b05
The \fBsmiExit()\fP function should be called when the application
Packit 022b05
no longer needs any SMI information to release any allocated SMI
Packit 022b05
resources.
Packit 022b05
.PP
Packit 022b05
The \fBsmiSetErrorLevel()\fP function sets the pedantic level (0-9) of
Packit 022b05
the SMI parsers of the SMI library, currently SMIv1/v2 and SMIng.
Packit 022b05
The higher the level, the louder it complains. Values up to 3
Packit 022b05
should be regarded as errors, higher level could be interpreted as
Packit 022b05
warnings.  But note that this classification is some kind of personal
Packit 022b05
taste.  The default level is 0, since usually only MIB checkers want
Packit 022b05
to tune a higher level.
Packit 022b05
.PP
Packit 022b05
The \fBsmiGetFlags()\fP and \fBsmiSetFlags()\fP functions allow to
Packit 022b05
fetch, modify, and set some \fIuserflags\fP that control the SMI
Packit 022b05
library's behaviour.  If \fBSMI_FLAG_ERRORS\fP is not set, no error messages
Packit 022b05
are printed at all to keep the SMI library totally quiet, which might
Packit 022b05
be mandatory for some applications. If \fBSMI_FLAG_STATS\fP is set, the
Packit 022b05
library prints some module statistics. If \fBSMI_FLAG_RECURSIVE\fP is set,
Packit 022b05
the library also complains about errors in modules that are read due
Packit 022b05
to import statements. If \fBSMI_FLAG_NODESCR\fP is set, no description
Packit 022b05
and references strings are stored in memory. This may save a huge amount
Packit 022b05
of memory in case of applications that do not need this information.
Packit 022b05
.PP
Packit 022b05
The \fBsmiSetSeverity()\fP function allows to set the severity of
Packit 022b05
all error that have name prefixed by \fBpattern\fP to the value \fBseverity\fP.
Packit 022b05
.PP
Packit 022b05
The \fBsmiLoadModule()\fP function specifies an additional MIB \fImodule\fP
Packit 022b05
that the application claims to know or an additional file path to read.
Packit 022b05
Only after a
Packit 022b05
module is made known through this function, iterating retrieval
Packit 022b05
functions and retrieval functions without fully qualified identifiers
Packit 022b05
will return results from this module. \fBsmiLoadModule()\fP returns the
Packit 022b05
name of the loaded module, of NULL if it could not be loaded.
Packit 022b05
.PP
Packit 022b05
The \fBsmiIsLoaded()\fP function returns a positive value if the
Packit 022b05
module named \fImodule\fP is already loaded, or zero otherwise.
Packit 022b05
.PP
Packit 022b05
The \fBsmiGetPath()\fP and \fBsmiSetPath()\fP functions allow to
Packit 022b05
fetch, modify, and set the path that is used to search MIB modules.
Packit 022b05
\fBsmiGetPath()\fP returns a copy of the current search path in the
Packit 022b05
form "DIR1:DIR2:...", or NULL if no path is set.
Packit 022b05
The application should free this string if it is
Packit 022b05
no longer needed. \fBsmiSetPath()\fP sets the search path to
Packit 022b05
\fIpath\fP.
Packit 022b05
.PP
Packit 022b05
The \fBsmiReadConfig()\fP function reads the configuration file \fIfilename\fP.
Packit 022b05
All global statements in the configuration file and those statements with
Packit 022b05
a tag (a ``tag: '' prefix) that matches the \fBtag\fP argument, if present,
Packit 022b05
are executed.
Packit 022b05
.PP
Packit 022b05
The \fBsmiSetErrorHandler()\fP function allows to set a callback function
Packit 022b05
that is called by the MIB parsers deviating from the builtin default
Packit 022b05
error handler, that prints error messages to stderr. The error handler
Packit 022b05
has to comply with the \fBSmiErrorHandler\fP function type. The \fBpath\fP,
Packit 022b05
\fBline\fP, \fBseverity\fP, \fBmsg\fP, and \fPtag\fP arguements carry the
Packit 022b05
module's pathname, the line number within the module, the error severity
Packit 022b05
level, a textual error message, and a short error name of the error being
Packit 022b05
reported.
Packit 022b05
.SH "MODULE LOCATIONS"
Packit 022b05
The SMI library may retrieve MIB modules from different kinds of
Packit 022b05
resources. Currently, SMIv1/v2 and SMIng module files are supported.
Packit 022b05
If in an \fBsmiLoadModule()\fP function call a module is specified by
Packit 022b05
a path name (identified by containing at least one dot or slash character),
Packit 022b05
this
Packit 022b05
is assumed to be the exact file to read. Otherwise, if a module is identified
Packit 022b05
by its plain module name, the correspondant file (either SMIv1/2 or
Packit 022b05
SMIng) is searched along a path. This path is initialized with @smipath@.
Packit 022b05
Afterwards the optional global and user configuration files are parsed for
Packit 022b05
`path' commands, and finally the optional \fBSMIPATH\fP environment variable
Packit 022b05
is evaluated. The `path' command argument and the environment variable
Packit 022b05
either start with a path separator character (`:' on UNIX-like systems, `;'
Packit 022b05
on MS-Windows systems) to append
Packit 022b05
to the path, or end with a path separator character to prepend to the path,
Packit 022b05
or otherwise completely replace the path.
Packit 022b05
The path can also be controlled by the \fBsmiGetPath()\fP 
Packit 022b05
and \fBsmiSetPath()\fP functions (see above).
Packit 022b05
.PP
Packit 022b05
When files are searched by a given module name, they might have no
Packit 022b05
extension or one of the extensions `.my', `.smiv2', `.sming', `.mib',
Packit 022b05
or `.txt'. However, the
Packit 022b05
MIB module language is identified by the file's content, not by its
Packit 022b05
file name extension.
Packit 022b05
.SH "CONFIGURATION FILES"
Packit 022b05
SMI library configuration files read at initialization and on demand
Packit 022b05
by \fBsmiReadConfig()\fP have a simple line oriented syntax. Empty lines
Packit 022b05
and those starting with `#' are ignored. Other lines start with an optional
Packit 022b05
tag (prepended by a colon),
Packit 022b05
followed by a command and options dependent on the command. Tags
Packit 022b05
are used to limit the scope of a command to those applications that are
Packit 022b05
using this tag. 
Packit 022b05
.PP
Packit 022b05
The \fBload\fP command is used to preload a given MIB module. If multiple
Packit 022b05
modules shall be preloaded, multiple \fBload\fP commands must be used.
Packit 022b05
.PP
Packit 022b05
The \fBpath\fP command allows to prepend or append components to the
Packit 022b05
MIB module search path or to modify it completely (see 
Packit 022b05
also MODULE LOCATIONS above).
Packit 022b05
.PP
Packit 022b05
The \fBcache\fP command allows to add an additional directory for
Packit 022b05
MIB module lookup as a last resort. The first argument specifies the
Packit 022b05
directory and the rest of the line starting from the second argument
Packit 022b05
specifies the caching method, which is invoked with the MIB module
Packit 022b05
name appended if the module is found neither in one of the regular directories
Packit 022b05
nor in the cache directory beforehand.
Packit 022b05
.PP
Packit 022b05
The \fBlevel\fP command sets the error level.
Packit 022b05
.PP
Packit 022b05
The \fBhide\fP command allows to tune the list of errors that are reported.
Packit 022b05
It raises all errors with names prefixed by the given pattern to severity
Packit 022b05
level 9. [Currently, there is no way to list the error names. RTFS: error.c.]
Packit 022b05
.PP
Packit 022b05
Example configuration:
Packit 022b05
.nf
Packit 022b05
Packit 022b05
  #
Packit 022b05
  # $HOME/.smirc
Packit 022b05
  #
Packit 022b05
Packit 022b05
  # add a private directory
Packit 022b05
  path :/usr/home/strauss/lib/mibs
Packit 022b05
 
Packit 022b05
  # don't show any errors by default
Packit 022b05
  level 0
Packit 022b05
 
Packit 022b05
  # preload some basic modules
Packit 022b05
  load SNMPv2-SMI
Packit 022b05
  load SNMPv2-TC
Packit 022b05
  load SNMPv2-CONF
Packit 022b05
 
Packit 022b05
  # want to make smilint shout
Packit 022b05
  smilint: level 8
Packit 022b05
 
Packit 022b05
  # but please don't claim about
Packit 022b05
  # any names longer than 32 chars
Packit 022b05
  smilint: hide namelength-32
Packit 022b05
   
Packit 022b05
  tcpdump: load DISMAN-SCRIPT-MIB
Packit 022b05
Packit 022b05
  smiquery: load IF-MIB
Packit 022b05
  smiquery: load DISMAN-SCRIPT-MIB
Packit 022b05
.fi
Packit 022b05
.SH "FILES"
Packit 022b05
.nf
Packit 022b05
@sysconfdir@/smi.conf    global configuration file
Packit 022b05
$HOME/.smirc               user configuration file
Packit 022b05
@includedir@/smi.h   SMI library header file
Packit 022b05
@mibdir@/     SMI module repository directory
Packit 022b05
.fi
Packit 022b05
.SH "SEE ALSO"
Packit 022b05
.BR libsmi "(3), "
Packit 022b05
.BR smi.h
Packit 022b05
.SH "AUTHOR"
Packit 022b05
(C) 1999-2001 Frank Strauss, TU Braunschweig, Germany <strauss@ibr.cs.tu-bs.de>
Packit 022b05
.br