snmp
Class SNMPv1CommunicationInterface

java.lang.Object
  |
  +--snmp.SNMPv1CommunicationInterface

public class SNMPv1CommunicationInterface
extends java.lang.Object

The class SNMPv1CommunicationInterface defines methods for communicating with SNMP entities. The approach is that from version 1 of SNMP, using no encryption of data. Communication occurs via UDP, using port 161, the standard SNMP port.


Field Summary
static int MAXSIZE
           
 int requestID
           
static int SNMPPORT
           
 
Constructor Summary
SNMPv1CommunicationInterface(int version, java.net.InetAddress hostAddress, java.lang.String community)
          Construct a new communication object to communicate with the specified host using the given community name.
 
Method Summary
 void closeConnection()
          Close the "connection" with the devive.
 SNMPVarBindList getMIBEntry(java.lang.String itemID)
          Retrieve the MIB variable values corresponding to the object identifier given in itemID (in dotted-integer notation).
 SNMPVarBindList getNextMIBEntry(java.lang.String itemID)
          Retrieve the MIB variable value corresponding to the object identifier following that given in itemID (in dotted-integer notation).
 SNMPVarBindList retrieveAllMIBInfo(java.lang.String startID)
          Retrieve all MIB variable values subsequent to the starting object identifier given in startID (in dotted-integer notation).
 SNMPVarBindList setMIBEntry(java.lang.String itemID, SNMPObject newValue)
          Set the MIB variable value of the object identifier given in startID (in dotted-integer notation).
 void setSocketTimeout(int socketTimeout)
          Permits setting timeout value for underlying datagram socket (in milliseconds).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SNMPPORT

public static final int SNMPPORT

MAXSIZE

public static final int MAXSIZE

requestID

public int requestID
Constructor Detail

SNMPv1CommunicationInterface

public SNMPv1CommunicationInterface(int version,
                                    java.net.InetAddress hostAddress,
                                    java.lang.String community)
                             throws java.net.SocketException
Construct a new communication object to communicate with the specified host using the given community name. The version setting should be either 0 (version 1) or 1 (version 2, a la RFC 1157).
Method Detail

setSocketTimeout

public void setSocketTimeout(int socketTimeout)
                      throws java.net.SocketException
Permits setting timeout value for underlying datagram socket (in milliseconds).

closeConnection

public void closeConnection()
                     throws java.net.SocketException
Close the "connection" with the devive.

retrieveAllMIBInfo

public SNMPVarBindList retrieveAllMIBInfo(java.lang.String startID)
                                   throws java.io.IOException,
                                          SNMPBadValueException
Retrieve all MIB variable values subsequent to the starting object identifier given in startID (in dotted-integer notation). Return as SNMPVarBindList object. Uses SNMPGetNextRequests to retrieve variable values in sequence.
Throws:
java.io.IOException - Thrown when timeout experienced while waiting for response to request.
SNMPBadValueException -  

getMIBEntry

public SNMPVarBindList getMIBEntry(java.lang.String itemID)
                            throws java.io.IOException,
                                   SNMPBadValueException,
                                   SNMPGetException
Retrieve the MIB variable values corresponding to the object identifier given in itemID (in dotted-integer notation). Return as SNMPVarBindList object; if no such variable (either due to device not supporting it, or community name having incorrect access privilege), variable value will be SNMPNull object
Throws:
java.io.IOException - Thrown when timeout experienced while waiting for response to request.
SNMPBadValueException -  

getNextMIBEntry

public SNMPVarBindList getNextMIBEntry(java.lang.String itemID)
                                throws java.io.IOException,
                                       SNMPBadValueException,
                                       SNMPGetException
Retrieve the MIB variable value corresponding to the object identifier following that given in itemID (in dotted-integer notation). Return as SNMPVarBindList object; if no such variable (either due to device not supporting it, or community name having incorrect access privilege), variable value will be SNMPNull object
Throws:
java.io.IOException - Thrown when timeout experienced while waiting for response to request.
SNMPBadValueException -  

setMIBEntry

public SNMPVarBindList setMIBEntry(java.lang.String itemID,
                                   SNMPObject newValue)
                            throws java.io.IOException,
                                   SNMPBadValueException,
                                   SNMPSetException
Set the MIB variable value of the object identifier given in startID (in dotted-integer notation). Return SNMPVarBindList object returned by device in its response; can be used to check that setting was successful. Uses SNMPGetNextRequests to retrieve variable values in sequence.
Throws:
java.io.IOException - Thrown when timeout experienced while waiting for response to request.
SNMPBadValueException -