Blame lib/smi_config.3.in

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