| java.lang.Object snmp.SNMPv1AgentInterface
SNMPv1AgentInterface | public class SNMPv1AgentInterface implements Runnable(Code) | | The class SNMPv1AgentInterface implements an interface for responding to requests sent from a remote SNMP
manager. The agent simply listens for requests for information, and passes requested OIDs on to concrete
subclasses of SNMPRequestListener. These are expected to retrieve requested information from the system,
and return this to the agent interface for inclusion in a response to the manager.
The approach is that from version 1 of SNMP, using no encryption of data. Communication occurs
via UDP, using port 162, the standard SNMP trap port, as the destination port.
|
Constructor Summary | |
public | SNMPv1AgentInterface(int version) Construct a new agent object to listen for requests from remote SNMP managers. | public | SNMPv1AgentInterface(int version, int localPort) Construct a new agent object to listen for requests from remote SNMP managers. | public | SNMPv1AgentInterface(int version, PrintWriter errorReceiver) Construct a new agent object to listen for requests from remote SNMP managers. | public | SNMPv1AgentInterface(int version, int localPort, PrintWriter errorReceiver) Construct a new agent object to listen for requests from remote SNMP managers. |
SNMP_PORT | final public static int SNMP_PORT(Code) | | |
receiveBufferSize | public int receiveBufferSize(Code) | | |
SNMPv1AgentInterface | public SNMPv1AgentInterface(int version) throws SocketException(Code) | | Construct a new agent object to listen for requests from remote SNMP managers. The agent listens
on the standard SNMP UDP port 161.
|
SNMPv1AgentInterface | public SNMPv1AgentInterface(int version, int localPort) throws SocketException(Code) | | Construct a new agent object to listen for requests from remote SNMP managers. The agent listens
on the supplied port.
|
SNMPv1AgentInterface | public SNMPv1AgentInterface(int version, PrintWriter errorReceiver) throws SocketException(Code) | | Construct a new agent object to listen for requests from remote SNMP managers. The agent listens
on the supplied port, and sends error messages to the specified PrintWriter.
|
SNMPv1AgentInterface | public SNMPv1AgentInterface(int version, int localPort, PrintWriter errorReceiver) throws SocketException(Code) | | Construct a new agent object to listen for requests from remote SNMP managers. The agent listens
on the supplied port, and sends error messages to the specified PrintWriter.
|
getReceiveBufferSize | public int getReceiveBufferSize()(Code) | | Returns the current size of the buffer used to receive response packets.
|
run | public void run()(Code) | | The run() method for the agent interface's listener. Just waits for SNMP request messages to
come in on port 161 (or the port supplied in the constructor), then dispatches the retrieved
SNMPPDU and community name to each of the registered SNMPRequestListeners by calling their
processRequest() methods.
|
setErrorReceiver | public void setErrorReceiver(PrintWriter errorReceiver)(Code) | | Set the specified PrintWriter to receive error messages.
|
setReceiveBufferSize | public void setReceiveBufferSize(int receiveBufferSize)(Code) | | Set the size of the buffer used to receive response packets. RFC 1157 stipulates that an SNMP
implementation must be able to receive packets of at least 484 bytes, so if you try to set the
size to a value less than this, the receive buffer size will be set to 484 bytes. In addition,
the maximum size of a UDP packet payload is 65535 bytes, so setting the buffer to a larger size
will just waste memory. The default value is 512 bytes. The value may need to be increased if
get-requests are issued for multiple OIDs.
|
startReceiving | public void startReceiving()(Code) | | Start listening for requests from remote managers.
|
stopReceiving | public void stopReceiving() throws SocketException(Code) | | Stop listening for requests from remote managers.
|
|
|