SYNOPSIS

#include <snmpkit>

SNMP_table(SNMP_session &session, unsigned int slen);

void get(list<void*> &dest);

unsigned int stlen();

DESCRIPTION

A SNMP_table is a derivation of the SNMP_structFiller(3) class whose purpose is to automate fetching all the rows within a SNMP table. It does this by doing multiple get_next requests of a group of objects until it falls off the end of the table.

SNMP_table::SNMP_table(SNMP_session &session, void *(new_funct)());

Create a new SNMP_table object. The session parameter defines the SNMP enabled device to query and the new_funct is a function that allocate and initializes the underlying data structure returns a void* to it.

void SNMP_structFiller::append_int(const string &oidstr,void (*fp)(void*,long));

void SNMP_structFiller::append_counter (const string &oidstr, void (*fp)(void*,long));

void SNMP_structFiller::append_timetick (const string &oidstr, void (*fp)(void*,unsigned long));

void SNMP_structFiller::append_ipaddr (const string &oidstr, void (*fp)(void*,const unsigned char *));

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 underlying 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.

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.

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.

Exceptions

* BerOidBadSubOidException - One of the OIDs could not be converted to a number.

* BerNoOidsException - No OIDs were specified.

void SNMP_structFiller::remove(const string &oidstr);

Delete an SNMP object from the underlying SNMP_structFiller instance.

Exceptions

* FillerRemoveEmptyException - An attempt was made to remove from an empty SNMP_structFiller object; results from a programming error.

* FillerRemoveNotFoundException - An attempt was made to remove an item not currently in the container; results from a programming error.

* FillerCorruptException - The SNMP table entry was successfully removed, however the OID sequence was NULL; results from a programming error in the library.

* OidSeqRemoveNotFoundException - A programming error resulted in the attempt to remove something that was not there.

* OidSeqBadLayoutException - The BER sequence did not follow the layout of an OID sequence.

void SNMP_table::get(list<void*> &dest);

Method to read multiple rows of information from an SNMP device and insert them into the destination list.

Exceptions

* 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.

* SNMPPacketNotSequenceException - The response received was not a valid SNMP response.

* SNMPRespNotSequenceException - The packet received was a valid SNMP response but the payload of the packet wasn't a sequence type.

* SNMPNotResponseTagException - The type of the SNMP response received was invalid (not 0xa2).

* SNMPSeqnoNotIntException - The sequence number of the response was not a classified as a number.

* SNMPStateNotIntException - The SNMP device sent back an improperly constructed response packet and the status was not classified as an integer.

* SNMPFaultOidNotIntException - A response was returned with an error but the index to the problem OID was not classified as an integer.

* 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.

* SNMPBadOidException - An OID in the SNMP response packet was invalid

* SocketSendShortExecption - An error occurred while sending the SNMP request resulting in an incomplete transmission of the query

* 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.

* BerLengthException, BerIntLengthExecption, BerCounterLengthExecption, BerNullLengthExecption, BerTimeTickLengthExecption, BerIPAddrLengthExecption - The size of the data to be encoded (BER) will not fit into an unsigned long data type.

RELATED TO SNMP_table…

AUTHOR

SNMPkit C/C++ library was originally developed by Ben Woodard <[email protected]>. This man page was written by Gerald Carter <[email protected]>