1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
.TH libsnmpkit 3 "November 2000" "GNU snmpkit 0.4"
.SH NAME
snmpkit \- SNMP communication library
.SH SYNOPSIS
.nf
.B #include <snmpkit.h>
.sp
.BI "SNMPSTRUCTFILLER *new_snmpstructfiller(SNMPSESSION *" session ");"
.BI "void delete_snmpstructfiller(SNMPSTRUCTFILLER *" doomed ");"
.BI "void snmpstructfiller_append(SNMPSTRUCTFILLER *" sf ", const char *" oidstr ",Tags " tag ", unsigned int " offset ");"
.BI "void snmpstructfiller_remove(SNMPSTRUCTFILLER *" sf ",const char *" oidstr ");"
.BI "void *snmpstructfiller_get(SNMPSTRUCTFILLER *" sf ",void *" tobefilled ");"
.BI "void *snmpstructfiller_get_next(SNMPSTRUCTFILLER *" sf ", void *" tobefilled ");"
.sp
.BI "SNMPTABLE *new_snmptable(SNMPSESSION *" session ",unsigned int " structlen ");"
.BI "void delete_snmptable(SNMPTABLE *" doomed ");"
.BI "void snmptable_append(SNMPTABLE *" st ",const char *" oidstr ",Tags " tag ", unsigned int " offset ");"
.BI "void snmptable_remove(SNMPTABLE *" st ",const char *" oidstr ");"
.BI "void *snmptable_get(SNMPTABLE *" st ",unsigned int *" len ");"
.SH DESCRIPTION
snmpkit is a toolkit for doing SNMP queries of network connected
devices. Its design is quite different than other snmp libraries such
as those published by CMU and UC Davis. Those SNMP libraries largely
preserve the OSI model in their programming interfaces. In other words
words they expect that applications are going request objects by name
from the MIBs. This introduces quite a lot of overhead as the objects
are translated in and out of the textual representations each and
every time a request is done. They also assume that they are
communicating with only one host. snmpkit is different, because it
assumes that the program is going to do be querying a few well known
object on a large numbers of hosts. In other words the design of the
library is exactly the opposite of the traditional SNMP libraries. It
doesn't bother with all the MIB processing. It figures that the
objects that the programmer wants to query are well known at the time
of application development and therefore it is worth the time to read
the MIB by hand and figure out what the OID for the object is and hard
code that into the application. Since it assumes that you are going to
be communicating with a large number of hosts, it provides a mechanism
to allow many sessions on one socket.
.PP
For example, say you want to find out the page count on all the
printers you have enterprise wide. This amounts to 3500 different
printers. One approach to this would be to have a script sequentially
go through each and every printer and query it's page count. This
would take a very long time because the out of those 3500 printers
there would be a handful which are either turned off, broken, or for
which you have incorrect information. The queries would be reasonably
fast up until the point where you hit one which didn't respond and
then your script would pause for quite some time before giving up and
going onto the next one. One solution to this problem would be to
parallelize the task so that you start up several of the processes at
once. In this case, the problem is that each one of those queries
would consume one process as well as one socket per host. Care would
have to be execised so as not to not forkbomb the computer or run out
of open file descritors. This approach allows you to multiplex all the
SNMP queries on one socket.
.PP
The third thing that is different about snmpkit is that it is
optimized to fill structures with information. If you are fetching
individual objects, you basically specify the objects that you want in
a structure and tell the structure filler where within the structure
to put the object and then call the one of the get functions. If you
want to fetch all the rows in a table it is very similar. You specify
the what objects you want and their offsets into the structure and
then you specify the structure length and it will fetch all the rows
within the structure and return a vector of all the structures and the
number of structures that are fetched.
.SH AUTHOR
Ben Woodard <ben@users.sourceforge.net>
.SH BUGS
Interface bug -- The method of filling structures is really nasty
code. It does all sorts of really evil futzing with pointers. It
should probably be rewritten to call a function which puts the
variable in place. The thing is it took a long time to get right but
now it works and it is very efficient.
.sp
Interface bug -- The snmptable functions return a pointer to a
dynamically allocated vector of structures. It should probably return
some type of container instead.
.sp
Interface bug -- With this interface there is no way to perform any
sets. The snmpstructfiller and snmptable should include functions to
do sets.
.sp
The library can possibly throw different kinds of C++ execptions that
won't be caught by the glue code and therefore it can cause your
program to crash inexplicably.
.sp
The library is implemented using a lot of hand crafted data
structures. It should be rewritten to use many of the features
available in libstdc++.
.SH "SEE ALSO"
.BR snmpsock "(3), " snmpsession "(3), " snmpstructfiller "(3), " snmptable "(3)"
|