Package uk.co.westhawk.snmp.stack
Class SnmpContextv2c
java.lang.Object
uk.co.westhawk.snmp.stack.AbstractSnmpContext
uk.co.westhawk.snmp.stack.SnmpContext
uk.co.westhawk.snmp.stack.SnmpContextv2c
- All Implemented Interfaces:
 Cloneable,Runnable,EventListener,RawPduListener,SnmpContextBasisFace,SnmpContextFace,SnmpContextv2cFace
- Direct Known Subclasses:
 PassiveSnmpContextv2c
This class contains the SNMP v2c context that is needed by every PDU to
 send a SNMP v2c request.
 
 destroy() should be called when the context is no longer
 used. This is the only way the threads will be stopped and garbage
 collected.
 
- Version:
 - $Revision: 3.16 $ $Date: 2009/03/05 12:54:04 $
 - Author:
 - Birgit Arkesteijn
 - See Also:
 
- 
Field Summary
Fields inherited from interface uk.co.westhawk.snmp.stack.SnmpContextBasisFace
DEFAULT_PORT, MAXPDU, MSS, STANDARD_SOCKET, TCP_SOCKETFields inherited from interface uk.co.westhawk.snmp.stack.SnmpContextFace
DEFAULT_COMMUNITY - 
Constructor Summary
ConstructorsConstructorDescriptionSnmpContextv2c(String host, int port) Constructor.SnmpContextv2c(String host, int port, String typeSocketA) Constructor.SnmpContextv2c(String host, int port, String bindAddress, String typeSocketA) Constructor. - 
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a clone of this SnmpContextv2c.byte[]encodePacket(byte msg_type, int rId, int errstat, int errind, Enumeration ve, Object obj) Encodes a PDU.Returns the hash key.intReturns the SNMP version of this context.processIncomingPdu(byte[] message) Processes an incoming pdu (but not a response).toString()Returns a string representation of the object.Methods inherited from class uk.co.westhawk.snmp.stack.SnmpContext
encodePacket, getCommunity, setCommunityMethods inherited from class uk.co.westhawk.snmp.stack.AbstractSnmpContext
addPdu, addRequestPduListener, addRequestPduListener, addRequestPduListener, addTrapListener, addTrapListener, addTrapListener, destroy, getBindAddress, getDebugString, getHost, getHostAddress, getMaxRecvSize, getPort, getReceivedFromHostAddress, getSendToHostAddress, getTypeSocket, isDestroyed, rawPduReceived, removePdu, removeRequestPduListener, removeRequestPduListener, removeRequestPduListener, removeTrapListener, removeTrapListener, removeTrapListener, run, sendPacket, setMaxRecvSize, stopMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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, sendPacketMethods inherited from interface uk.co.westhawk.snmp.stack.SnmpContextFace
getCommunity, setCommunity 
- 
Constructor Details
- 
SnmpContextv2c
Constructor.- Parameters:
 host- The host to which the PDU will be sentport- The port where the SNMP server will be- Throws:
 IOException- See Also:
 - 
AbstractSnmpContext(String, int)
 
 - 
SnmpContextv2c
Constructor. Parameter typeSocketA should be either STANDARD_SOCKET, TCP_SOCKET or a fully qualified classname.- Parameters:
 host- The host to which the Pdu will be sentport- The port where the SNMP server will betypeSocketA- The local address the server will bind to- Throws:
 IOException- See Also:
 - 
AbstractSnmpContext(String, int, String)
 
 - 
SnmpContextv2c
public SnmpContextv2c(String host, int port, String bindAddress, String typeSocketA) throws IOException Constructor. Parameter typeSocketA should be either STANDARD_SOCKET, TCP_SOCKET or a fully qualified classname.- Parameters:
 host- The host to which the PDU will be sentport- The port where the SNMP server will bebindAddress- The local address the server will bind totypeSocketA- The type of socket to use.- Throws:
 IOException- Since:
 - 4_14
 - See Also:
 - 
AbstractSnmpContext(String, int, String, String)SnmpContextBasisFace.STANDARD_SOCKETSnmpContextBasisFace.TCP_SOCKET
 
 
 - 
 - 
Method Details
- 
getVersion
public int getVersion()Description copied from class:AbstractSnmpContextReturns the SNMP version of this context. Has to be overload by each context.- Specified by:
 getVersionin interfaceSnmpContextBasisFace- Overrides:
 getVersionin classSnmpContext- Returns:
 - The version
 - See Also:
 
 - 
encodePacket
public byte[] encodePacket(byte msg_type, int rId, int errstat, int errind, Enumeration ve, Object obj) throws IOException, EncodingException Description copied from class:AbstractSnmpContextEncodes a PDU. This is for internal use only and should NOT be called by the developer. This is called by the the PDU itself and is added to the interface to cover the different kind of Contexts. Has to be overload by each context.- Specified by:
 encodePacketin interfaceSnmpContextBasisFace- Overrides:
 encodePacketin classSnmpContext- Parameters:
 msg_type- The message typerId- The message iderrstat- The error statuserrind- The error indexve- The varbind listobj- Additional object (only used in SNMPv3)- Returns:
 - The encoded packet
 - Throws:
 IOExceptionEncodingException
 - 
processIncomingPdu
Description copied from class:AbstractSnmpContextProcesses an incoming pdu (but not a response). Has to be overload by each context.- Specified by:
 processIncomingPduin interfaceSnmpContextBasisFace- Overrides:
 processIncomingPduin classSnmpContext- Throws:
 DecodingExceptionIOException- See Also:
 
 - 
clone
Returns a clone of this SnmpContextv2c.- Specified by:
 clonein interfaceSnmpContextBasisFace- Overrides:
 clonein classSnmpContext- Throws:
 CloneNotSupportedException- Thrown when the constructor generates an IOException
 - 
getHashKey
Returns the hash key. This key is built out of all properties. It serves as key for a hashtable of (v2c) contexts.- Specified by:
 getHashKeyin interfaceSnmpContextBasisFace- Overrides:
 getHashKeyin classSnmpContext- Returns:
 - The hash key
 - Since:
 - 4_14
 
 - 
toString
Returns a string representation of the object.- Overrides:
 toStringin classSnmpContext- Returns:
 - The string
 
 
 -