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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
.TH SNMP_structFiller 3 "November 2000" "GNU snmpkit 0.4"
.SH NAME
SNMP_structFiller \- C++ object to contain data for SNMP queries
.SH SYNOPSIS
.B #include <snmpkit>
.sp
.B SNMP_structFiller::SNMP_structFiller(SNMP_session &sess);
.sp
.B SNMP_structFiller::~SNMP_structFiller();
.sp
.B void SNMP_structFiller::append_int(const string &oidstr,void (*fp)(void*,long));
.sp
.B void SNMP_structFiller::append_counter(const string &oidstr, void (*fp)(void*,long));
.sp
.B void SNMP_structFiller::append_timetick(const string &oidstr, void (*fp)(void*,unsigned long));
.sp
.B void SNMP_structFiller::append_ipaddr(const string &oidstr, void (*fp)(void*,const unsigned char *));
.sp
.B void SNMP_structFiller::append_string(const string &oidstr, void (*fp)(void*,const char *));
.sp
.B void SNMP_structFiller::remove(const string &oidstr);
.sp
.B void *SNMP_structFiller::get(void *tobefilled);
.sp
.B void *SNMP_structFiller::get_next(void *tobefilled);
.sp
.SH "DESCRIPTION"
A \fBSNMP_structFiller\fP object takes a list of SNMP objects and
queries the \fBSNMP_session(3)\fP and fills in the structure based upon
that information.
.sp
The SNMP protocol is designed in a way where there is significant
overhead in process of encoding and exchanging a packet. Therefore it
is very inefficient and time consuming to exchange many variables in
individual request packets. The way around this is to bulk up a bunch
of SNMP requests into one packet. Since it is most likely that you will be
frequently fetching information which is related, the
\fBSNMP_structFiller\fP is designed to associate the SNMP objects and
data types with the offsets into the structure. That way when you do a
get or a get_next you will get back a completely filled in structure.
.sp
.SS "SNMP_structFiller::SNMP_structFiller(SNMP_session);"
You will need to create a new SNMP_structFiller instance for each different
set of SNMP objects you wish to fetch. The SNMP data structure is initially
empty. You can add request information via the SNMP_structFiller::append()
method.
.SS "~SNMP_structFiller::~SNMP_structFiller();"
Destructor for an SNMP_structFiller object
.SS "void SNMP_structFiller::append_int(const string &oidstr,void (*fp)(void*,long));"
.SS "void SNMP_structFiller::append_counter (const string &oidstr, void (*fp)(void*,long));"
.SS "void SNMP_structFiller::append_timetick (const string &oidstr, void (*fp)(void*,unsigned long));"
.SS "void SNMP_structFiller::append_ipaddr (const string &oidstr, void (*fp)(void*,const unsigned char *));"
.SS "void SNMP_structFilleri::append_string(const string &oidstr, void (*fp)(void*,const char *));"
All of the various append methods add an SNMP object to the end of
the SNMP_structFiller instance. Each method requires the OID of the SNMP
object to add and a function that will insert it into the associated
structure.
.sp
.B This library does not attempt to read MIBs. This means that you\
will need to look up the OID string before hand and hard code the OID\
string into your program.
.sp
The job of the function pointer is to insert whatever data it gets back
into the the data structure. This allows you to do any kind of munging
around you want with the data you get and therefore you can have much
more complicated receiving structure. See the example programs included
with the SNMPkit documentation (snmptest*.C) for examples
of various uses of this.
.sp
.B Exceptions
.sp
* BerOidBadSubOidException \- One of the OIDs could not be converted to a number.
.sp
* BerNoOidsException \- No OIDs were specified.
.sp
.SS void SNMP_structFiller::remove(const string &oidstr);
Delete an SNMP object from the SNMP_structFiller instance.
.sp
.B Exceptions
.sp
* FillerRemoveEmptyException \- An attempt was made to remove from
an empty SNMP_structFiller object; results from a programming error.
.sp
* FillerRemoveNotFoundException \- An attempt was made to remove
an item not currently in the container; results from a programming
error.
.sp
* FillerCorruptException \- The SNMP table entry was successfully
removed, however the OID sequence was NULL; results from a programming
error in the library.
.sp
* OidSeqRemoveNotFoundException \- A programming error resulted
in the attempt to remove something that was not there.
.sp
* OidSeqBadLayoutException \- The BER sequence did not follow
the layout of an OID sequence.
.sp
.SS void *SNMP_structFiller::get(void *tobefilled);
Send the SNMP get request to the SNMP Agent and fill the structure
tobefilled with the data returned using the previously defined
inserter functions.
.sp
.B Exceptions
.sp
* SNMPNoResponseException \- The SNMP_structFiller object did not
receive a response from the remote SNMP Agent. This can be caused by
many things, no agent running on destination, a firewall between you
and the destination.
.sp
* SNMPPacketNotSequenceException \- The response received was not
a valid SNMP response.
.sp
* SNMPRespNotSequenceException \- The packet received was a valid SNMP
response but the payload of the packet wasn't a sequence type.
.sp
* SNMPNotResponseTagException \- The type of the SNMP response received
was invalid (not 0xa2).
.sp
* SNMPSeqnoNotIntException \- The sequence number of the response was
not a classified as a number.
.sp
* SNMPStateNotIntException \- The SNMP device sent back an improperly
constructed response packet and the status was not classified as an
integer.
.sp
* SNMPFaultOidNotIntException \- A response was returned with an error
but the index to the problem OID was not classified as an integer.
.sp
* OidSeqBadLayoutException \- Within a SNMP packet there is a
substructure which is an OID sequence. If the packet was supposed to
have an OID sequence in a particular locaion but for some reason one
of the elements was not of the correct type, then this exception will
be thrown.
.sp
* SNMPBadOidException \- An OID in the SNMP response packet was invalid
.sp
* SocketSendShortExecption \- An error occurred while sending the SNMP
request resulting in an incomplete transmission of the query
.sp
* BerSequenceTagException, BerIntTagException, BerCounterTagException,
BerStringTagException, BerNullTagException, BerOidTagException,
BerTimeTickTagException \- Although this will result from a encoding
error, it is caused by calling a BER object constructor on
an invalid piece of data.
.sp
* BerLengthException, BerIntLengthExecption, BerCounterLengthExecption,
BerNullLengthExecption, BerTimeTickLengthExecption,
BerIPAddrLengthExecption \- The size of the data to be encoded
(BER) will not fit into an unsigned long data type.
.sp
.SS "void *SNMP_structFiller::get_next(void *tobefilled);"
Query the object which is next in the list of available objects from
the SNMP Agent.
.sp
.B Exceptions
.sp
Same as the \fBSNMP_structFiller::get()\fP method
.sp
.SH "SEE ALSO"
SNMP_structFiller(3), SNMP_table(3)
.sp
.SH AUTHOR
The SNMPkit C/C++ library was originally developed by Ben Woodard
<ben@users.sourceforge.net>. This man page was written by Gerald
Carter <gcarter@valinux.com>
|