All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Snmp.SnmpAPI

java.lang.Object
   |
   +----java.lang.Thread
           |
           +----Snmp.SnmpAPI

public class SnmpAPI
extends Thread
implements SnmpClient
The SnmpAPI class needs to be instantiated to use the Snmp Package.

Manages SNMP Sessions, and contains SNMP Parameters. Extends Thread, to monitor sessions via a separate thread.

To use the API instantiate an SnmpAPI and run the start() method. From there, you can create SNMP sessions, and perform SNMP operations. You can create multiple SnmpAPI instances, though there is little reason to do so for most applications. Use multiple SnmpAPI instances when you need to have multiple callback and/or authentication functions.

This class implements the SnmpClient interface. To override the default callback, authenticate & debug functions, you need to implement this interface, and set the client variable to the instance that implements this interface.

See Also:
SnmpClient, SnmpSession

Variable Index

 o client
Defines the SnmpClient interface to be used for callbacks, etc.
 o COUNTER
Counter SNMP Variable type.
 o DEBUG
Defines whether debugging output should be generated
 o GAUGE
Gauge SNMP Variable type.
 o GET_REQ_MSG
Constant for SNMP get PDU type.
 o GET_RSP_MSG
Constant for SNMP response PDU type.
 o GETNEXT_REQ_MSG
Constant for SNMP get next PDU type.
 o INTEGER
Integer SNMP Variable type.
 o IPADDRESS
IP Address SNMP Variable type.
 o modules
The MIB modules parsed by this API, e.g.
 o NOACCESS
no access for anybody
 o NULLOBJ
Null SNMP Variable type.
 o OBJID
Object ID SNMP Variable type.
 o OPAQUE
Opaque SNMP Variable type.
 o RONLY
read access for everyone
 o RWRITE
add write access for community
 o sessionList
List of SNMP sessions managed under this SnmpAPI instance
 o SET_REQ_MSG
Constant for SNMP set request PDU type.
 o SNMP_ERR_BADVALUE
SNMP Error Constant: The value given has the wrong type or length
 o SNMP_ERR_GENERR
SNMP Error Constant: A general failure occured
 o SNMP_ERR_NOERROR
SNMP Error Constant: No Error
 o SNMP_ERR_NOSUCHNAME
SNMP Error Constant: There is no such variable name in this MIB
 o SNMP_ERR_READONLY
SNMP Error Constant: This variable is read only
 o SNMP_ERR_TOOBIG
SNMP Error Constant: Response message would have been too large
 o SNMP_PORT
The snmp port
 o SNMP_TRAP_PORT
The trap port
 o Standard_Prefix
Added to any Object ID string that does not begin with a .
 o STRING
String SNMP Variable type.
 o TIMETICKS
Timeticks SNMP Variable type.
 o TRP_REQ_MSG
Constant for SNMP trap PDU type.
 o version
Version number to help check for version requirements - this is 103
 o WONLY
only write access for community

Constructor Index

 o SnmpAPI()

Method Index

 o authenticate(SnmpPDU, String)
Default authenticate which compares the PDU and Session community strings
 o callback(SnmpSession, SnmpPDU, int)
Null callback function that returns false
 o checkResponses()
Checks each session to see if there are any outstanding responses Returns list of sessions with outstanding responses
 o checkTimeouts()
Checks each session to see if there are any outstanding Timeouts Returns list of sessions with requests that have timed out
 o debugPrint(String)
The default debug function, which prints to stdout
 o genReqID()
Generate a request ID for PDU.
 o run()
The run method Monitors sessions and requests, including re-transmits in case of timeouts.

Variables

 o version
 public final int version
Version number to help check for version requirements - this is 103

 o sessionList
 public Vector sessionList
List of SNMP sessions managed under this SnmpAPI instance

 o modules
 public Vector modules
The MIB modules parsed by this API, e.g. RFC-1155-SMI, RFC-1213. The name variable will indicate the module name.

 o DEBUG
 public boolean DEBUG
Defines whether debugging output should be generated

See Also:
debugPrint
 o client
 public SnmpClient client
Defines the SnmpClient interface to be used for callbacks, etc. By default it is the instance of this API class, and needs to be set by a client implementing the SnmpClient interface

See Also:
SnmpClient
 o SNMP_PORT
 public int SNMP_PORT
The snmp port

 o SNMP_TRAP_PORT
 public int SNMP_TRAP_PORT
The trap port

 o GET_REQ_MSG
 public static final byte GET_REQ_MSG
Constant for SNMP get PDU type. Used for SnmpPDU.command.

 o GETNEXT_REQ_MSG
 public static final byte GETNEXT_REQ_MSG
Constant for SNMP get next PDU type. Used for SnmpPDU.command.

 o GET_RSP_MSG
 public static final byte GET_RSP_MSG
Constant for SNMP response PDU type. Used for SnmpPDU.command.

 o SET_REQ_MSG
 public static final byte SET_REQ_MSG
Constant for SNMP set request PDU type. Used for SnmpPDU.command.

 o TRP_REQ_MSG
 public static final byte TRP_REQ_MSG
Constant for SNMP trap PDU type. Used for SnmpPDU.command.

 o SNMP_ERR_NOERROR
 public static final byte SNMP_ERR_NOERROR
SNMP Error Constant: No Error

 o SNMP_ERR_TOOBIG
 public static final byte SNMP_ERR_TOOBIG
SNMP Error Constant: Response message would have been too large

 o SNMP_ERR_NOSUCHNAME
 public static final byte SNMP_ERR_NOSUCHNAME
SNMP Error Constant: There is no such variable name in this MIB

 o SNMP_ERR_BADVALUE
 public static final byte SNMP_ERR_BADVALUE
SNMP Error Constant: The value given has the wrong type or length

 o SNMP_ERR_READONLY
 public static final byte SNMP_ERR_READONLY
SNMP Error Constant: This variable is read only

 o SNMP_ERR_GENERR
 public static final byte SNMP_ERR_GENERR
SNMP Error Constant: A general failure occured

 o INTEGER
 public static final byte INTEGER
Integer SNMP Variable type. Defined types (from the SMI, RFC 1065)

 o STRING
 public static final byte STRING
String SNMP Variable type. Defined types (from the SMI, RFC 1065)

 o OBJID
 public static final byte OBJID
Object ID SNMP Variable type. Defined types (from the SMI, RFC 1065)

 o NULLOBJ
 public static final byte NULLOBJ
Null SNMP Variable type. Defined types (from the SMI, RFC 1065)

 o IPADDRESS
 public static final byte IPADDRESS
IP Address SNMP Variable type. Defined types (from the SMI, RFC 1065)

 o COUNTER
 public static final byte COUNTER
Counter SNMP Variable type. Defined types (from the SMI, RFC 1065)

 o GAUGE
 public static final byte GAUGE
Gauge SNMP Variable type. Defined types (from the SMI, RFC 1065)

 o TIMETICKS
 public static final byte TIMETICKS
Timeticks SNMP Variable type. Defined types (from the SMI, RFC 1065)

 o OPAQUE
 public static final byte OPAQUE
Opaque SNMP Variable type. Defined types (from the SMI, RFC 1065)

 o RONLY
 public static final int RONLY
read access for everyone

 o WONLY
 public static final int WONLY
only write access for community

 o RWRITE
 public static final int RWRITE
add write access for community

 o NOACCESS
 public static final int NOACCESS
no access for anybody

 o Standard_Prefix
 public static String Standard_Prefix
Added to any Object ID string that does not begin with a . Since it's static, it can only be changed for all SnmpAPI instances used by the client application. Used primarily when creating an SnmpOID instance.

See Also:
SnmpOID

Constructors

 o SnmpAPI
 public SnmpAPI()

Methods

 o run
 public void run()
The run method Monitors sessions and requests, including re-transmits in case of timeouts.

Overrides:
run in class Thread
 o genReqID
 public int genReqID()
Generate a request ID for PDU. Uses the random number generator.

 o checkResponses
 public Vector checkResponses()
Checks each session to see if there are any outstanding responses Returns list of sessions with outstanding responses

See Also:
SnmpSession
 o checkTimeouts
 public Vector checkTimeouts()
Checks each session to see if there are any outstanding Timeouts Returns list of sessions with requests that have timed out

See Also:
SnmpSession
 o authenticate
 public boolean authenticate(SnmpPDU pdu,
                             String community)
Default authenticate which compares the PDU and Session community strings

 o callback
 public boolean callback(SnmpSession session,
                         SnmpPDU pdu,
                         int requestID)
Null callback function that returns false

See Also:
callback
 o debugPrint
 public void debugPrint(String debugOutput)
The default debug function, which prints to stdout

See Also:
debugPrint

All Packages  Class Hierarchy  This Package  Previous  Next  Index