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
-
client
- Defines the SnmpClient interface to be used for callbacks, etc.
-
COUNTER
- Counter SNMP Variable type.
-
DEBUG
- Defines whether debugging output should be generated
-
GAUGE
- Gauge SNMP Variable type.
-
GET_REQ_MSG
- Constant for SNMP get PDU type.
-
GET_RSP_MSG
- Constant for SNMP response PDU type.
-
GETNEXT_REQ_MSG
- Constant for SNMP get next PDU type.
-
INTEGER
- Integer SNMP Variable type.
-
IPADDRESS
- IP Address SNMP Variable type.
-
modules
- The MIB modules parsed by this API, e.g.
-
NOACCESS
- no access for anybody
-
NULLOBJ
- Null SNMP Variable type.
-
OBJID
- Object ID SNMP Variable type.
-
OPAQUE
- Opaque SNMP Variable type.
-
RONLY
- read access for everyone
-
RWRITE
- add write access for community
-
sessionList
- List of SNMP sessions managed under this SnmpAPI instance
-
SET_REQ_MSG
- Constant for SNMP set request PDU type.
-
SNMP_ERR_BADVALUE
- SNMP Error Constant: The value given has the wrong type or length
-
SNMP_ERR_GENERR
- SNMP Error Constant: A general failure occured
-
SNMP_ERR_NOERROR
- SNMP Error Constant: No Error
-
SNMP_ERR_NOSUCHNAME
- SNMP Error Constant: There is no such variable name in this MIB
-
SNMP_ERR_READONLY
- SNMP Error Constant: This variable is read only
-
SNMP_ERR_TOOBIG
- SNMP Error Constant: Response message would have been too large
-
SNMP_PORT
- The snmp port
-
SNMP_TRAP_PORT
- The trap port
-
Standard_Prefix
- Added to any Object ID string that does not begin with a .
-
STRING
- String SNMP Variable type.
-
TIMETICKS
- Timeticks SNMP Variable type.
-
TRP_REQ_MSG
- Constant for SNMP trap PDU type.
-
version
- Version number to help check for version requirements - this is 103
-
WONLY
- only write access for community
-
SnmpAPI()
-
-
authenticate(SnmpPDU, String)
-
Default authenticate which compares the PDU and Session community strings
-
callback(SnmpSession, SnmpPDU, int)
-
Null callback function that returns false
-
checkResponses()
-
Checks each session to see if there are any outstanding responses
Returns list of sessions with outstanding responses
-
checkTimeouts()
-
Checks each session to see if there are any outstanding Timeouts
Returns list of sessions with requests that have timed out
-
debugPrint(String)
-
The default debug function, which prints to stdout
-
genReqID()
- Generate a request ID for PDU.
-
run()
-
The run method
Monitors sessions and requests, including re-transmits
in case of timeouts.
version
public final int version
- Version number to help check for version requirements - this is 103
sessionList
public Vector sessionList
- List of SNMP sessions managed under this SnmpAPI instance
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.
DEBUG
public boolean DEBUG
- Defines whether debugging output should be generated
- See Also:
- debugPrint
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
SNMP_PORT
public int SNMP_PORT
- The snmp port
SNMP_TRAP_PORT
public int SNMP_TRAP_PORT
- The trap port
GET_REQ_MSG
public static final byte GET_REQ_MSG
- Constant for SNMP get PDU type. Used for SnmpPDU.command.
GETNEXT_REQ_MSG
public static final byte GETNEXT_REQ_MSG
- Constant for SNMP get next PDU type. Used for SnmpPDU.command.
GET_RSP_MSG
public static final byte GET_RSP_MSG
- Constant for SNMP response PDU type. Used for SnmpPDU.command.
SET_REQ_MSG
public static final byte SET_REQ_MSG
- Constant for SNMP set request PDU type. Used for SnmpPDU.command.
TRP_REQ_MSG
public static final byte TRP_REQ_MSG
- Constant for SNMP trap PDU type. Used for SnmpPDU.command.
SNMP_ERR_NOERROR
public static final byte SNMP_ERR_NOERROR
- SNMP Error Constant: No Error
SNMP_ERR_TOOBIG
public static final byte SNMP_ERR_TOOBIG
- SNMP Error Constant: Response message would have been too large
SNMP_ERR_NOSUCHNAME
public static final byte SNMP_ERR_NOSUCHNAME
- SNMP Error Constant: There is no such variable name in this MIB
SNMP_ERR_BADVALUE
public static final byte SNMP_ERR_BADVALUE
- SNMP Error Constant: The value given has the wrong type or length
SNMP_ERR_READONLY
public static final byte SNMP_ERR_READONLY
- SNMP Error Constant: This variable is read only
SNMP_ERR_GENERR
public static final byte SNMP_ERR_GENERR
- SNMP Error Constant: A general failure occured
INTEGER
public static final byte INTEGER
- Integer SNMP Variable type. Defined types (from the SMI, RFC 1065)
STRING
public static final byte STRING
- String SNMP Variable type. Defined types (from the SMI, RFC 1065)
OBJID
public static final byte OBJID
- Object ID SNMP Variable type. Defined types (from the SMI, RFC 1065)
NULLOBJ
public static final byte NULLOBJ
- Null SNMP Variable type. Defined types (from the SMI, RFC 1065)
IPADDRESS
public static final byte IPADDRESS
- IP Address SNMP Variable type. Defined types (from the SMI, RFC 1065)
COUNTER
public static final byte COUNTER
- Counter SNMP Variable type. Defined types (from the SMI, RFC 1065)
GAUGE
public static final byte GAUGE
- Gauge SNMP Variable type. Defined types (from the SMI, RFC 1065)
TIMETICKS
public static final byte TIMETICKS
- Timeticks SNMP Variable type. Defined types (from the SMI, RFC 1065)
OPAQUE
public static final byte OPAQUE
- Opaque SNMP Variable type. Defined types (from the SMI, RFC 1065)
RONLY
public static final int RONLY
- read access for everyone
WONLY
public static final int WONLY
- only write access for community
RWRITE
public static final int RWRITE
- add write access for community
NOACCESS
public static final int NOACCESS
- no access for anybody
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
SnmpAPI
public SnmpAPI()
run
public void run()
- The run method
Monitors sessions and requests, including re-transmits
in case of timeouts.
- Overrides:
- run in class Thread
genReqID
public int genReqID()
- Generate a request ID for PDU. Uses the random number generator.
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
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
authenticate
public boolean authenticate(SnmpPDU pdu,
String community)
- Default authenticate which compares the PDU and Session community strings
callback
public boolean callback(SnmpSession session,
SnmpPDU pdu,
int requestID)
- Null callback function that returns false
- See Also:
- callback
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