The Advent SNMP package uses the SnmpAPI class to manage sessions created by the user application, manage the MIB modules that have been loaded, and store some key parameters for SNMP communication, e.g. SNMP ports to be used. An SNMP application (manager or agent) often needs to manage multiple sessions on account of interacting with multiple SNMP peers. The SnmpAPI class has a list of sessions attached to it and monitors each of the sessions for timeouts and retransmits via a separate thread. It enables a few methods across all sessions, e.g. checking if responses have come in on any of the sessions, etc. Multiple threads can work with a single SnmpAPI instance. The SnmpAPI class must be instantiated and started to use it.
The SnmpSession class is used to manage a session with an SNMP peer. More than one host can be accessed via a single session, but Advent recommends to use separate sessions for hosts that are often accessed inside an application. Each session runs as a separate thread (primarily to do receive tasks) and provides functions to:
An SnmpSession needs to be instantiated and opened before it can be used to communicate with an SNMP peer.
Interaction between the SNMP manager and the agent is done via SNMP protocol data units (PDUs). The SnmpPDU class will be used to provide the variables and methods to create and use the SNMP PDU.