SNMP Stack 5_1

uk.co.westhawk.snmp.stack
Class PassiveSnmpContextv2c

java.lang.Object
  |
  +--uk.co.westhawk.snmp.stack.AbstractSnmpContext
        |
        +--uk.co.westhawk.snmp.stack.SnmpContext
              |
              +--uk.co.westhawk.snmp.stack.SnmpContextv2c
                    |
                    +--uk.co.westhawk.snmp.stack.PassiveSnmpContextv2c
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, RawPduListener, java.lang.Runnable, SnmpContextBasisFace, SnmpContextFace, SnmpContextv2cFace

public class PassiveSnmpContextv2c
extends SnmpContextv2c

This class contains the SNMP v2c context that is needed by every Pdu to send a SNMP v2c request in environments where thread creation is unwanted.

This extends SnmpContextv2c so that it does not create any threads to send PDUs. It must be used with the PDU class PassiveTrapPduv2. The original purpose of the Passive classes is to allow the stack to be used in environments where thread creation is unwanted, eg database JVMs such as Oracle JServer. See SNMPv2-PDU.

See notes on how to send traps in an Oracle JServer environment.

Since:
4_12
Version:
$Revision: 3.8 $ $Date: 2006/03/23 14:54:10 $
Author:
Mike Waters, ERG Group
See Also:
PassiveTrapPduv2

Field Summary
 
Fields inherited from class uk.co.westhawk.snmp.stack.AbstractSnmpContext
anyPduExpectingResponse, bindAddr, hostname, hostPort, isDestroyed, maxRecvSize, pduSupport, trapSupport, typeSocket
 
Fields inherited from interface uk.co.westhawk.snmp.stack.SnmpContextv2cFace
version_id
 
Fields inherited from interface uk.co.westhawk.snmp.stack.SnmpContextFace
DEFAULT_COMMUNITY
 
Fields inherited from interface uk.co.westhawk.snmp.stack.SnmpContextBasisFace
DEFAULT_PORT, KVM_SOCKET, MAXPDU, MSS, NETSCAPE_SOCKET, STANDARD_SOCKET, TCP_SOCKET
 
Fields inherited from interface uk.co.westhawk.snmp.event.RawPduListener
version_id
 
Constructor Summary
  PassiveSnmpContextv2c(java.lang.String host, int port)
          Constructor.
  PassiveSnmpContextv2c(java.lang.String host, int port, java.lang.String typeSocketA)
          Constructor.
protected PassiveSnmpContextv2c(java.lang.String host, int port, java.lang.String bindAddress, java.lang.String typeSocketA)
          Constructor.
 
Method Summary
protected  void activate()
          Overrides the AbstractSnmpContext.activate() to do nothing.
 
Methods inherited from class uk.co.westhawk.snmp.stack.SnmpContextv2c
clone, encodePacket, getHashKey, getVersion, processIncomingPdu, processIncomingResponse, toString
 
Methods inherited from class uk.co.westhawk.snmp.stack.SnmpContext
encodePacket, getCommunity, setCommunity
 
Methods inherited from class uk.co.westhawk.snmp.stack.AbstractSnmpContext
addPdu, addRequestPduListener, addRequestPduListener, addRequestPduListener, addTrapListener, addTrapListener, addTrapListener, destroy, freeTransmitters, getBindAddress, getDebugString, getHost, getHostAddress, getMaxRecvSize, getPort, getReceivedFromHostAddress, getSendToHostAddress, getTypeSocket, isDestroyed, rawPduReceived, removePdu, removeRequestPduListener, removeRequestPduListener, removeRequestPduListener, removeTrapListener, removeTrapListener, removeTrapListener, run, sendPacket, setMaxRecvSize, stop
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface uk.co.westhawk.snmp.stack.SnmpContextFace
getCommunity, setCommunity
 
Methods inherited from interface uk.co.westhawk.snmp.stack.SnmpContextBasisFace
addPdu, addRequestPduListener, addRequestPduListener, addRequestPduListener, addTrapListener, addTrapListener, addTrapListener, destroy, getBindAddress, getHost, getPort, getReceivedFromHostAddress, getSendToHostAddress, getTypeSocket, isDestroyed, removePdu, removeRequestPduListener, removeRequestPduListener, removeRequestPduListener, removeTrapListener, removeTrapListener, removeTrapListener, sendPacket
 

Constructor Detail

PassiveSnmpContextv2c

public PassiveSnmpContextv2c(java.lang.String host,
                             int port)
                      throws java.io.IOException
Constructor.

Parameters:
host - The host to which the Pdu will be sent
port - The port where the SNMP server will be
See Also:
SnmpContextv2c.SnmpContextv2c(String, int)

PassiveSnmpContextv2c

public PassiveSnmpContextv2c(java.lang.String host,
                             int port,
                             java.lang.String typeSocketA)
                      throws java.io.IOException
Constructor.

Parameters:
host - The host to which the Pdu will be sent
port - The port where the SNMP server will be
typeSocketA - The type of socket to use.
See Also:
SnmpContextv2c.SnmpContextv2c(String, int, String), SnmpContextBasisFace.STANDARD_SOCKET, SnmpContextBasisFace.TCP_SOCKET, SnmpContextBasisFace.NETSCAPE_SOCKET, SnmpContextBasisFace.KVM_SOCKET

PassiveSnmpContextv2c

protected PassiveSnmpContextv2c(java.lang.String host,
                                int port,
                                java.lang.String bindAddress,
                                java.lang.String typeSocketA)
                         throws java.io.IOException
Constructor. If bindAddress is null, then the system will pick up a valid local address to bind the socket. The typeSocket will indicate which type of socket to use. This way different handlers can be provided for Netscape or Standard JVM. The Netscape implementation will make the necessary security calls to access hosts that are not the applet's webserver. The KVM version will be for small device support (e.g. Palm Pilot).

Parameters:
host - The host to which the Pdu will be sent
port - The port where the SNMP server will be
bindAddress - The local address the server will bind to
typeSocketA - The type of socket to use.
Throws:
java.io.IOException - Thrown when the socket cannot be created.
See Also:
SnmpContextBasisFace.STANDARD_SOCKET, SnmpContextBasisFace.TCP_SOCKET, SnmpContextBasisFace.NETSCAPE_SOCKET, SnmpContextBasisFace.KVM_SOCKET
Method Detail

activate

protected void activate()
Overrides the AbstractSnmpContext.activate() to do nothing. This prevents the creation of threads in the base class.

Overrides:
activate in class AbstractSnmpContext
See Also:
AbstractSnmpContext.activate()

SNMP Stack 5_1