public class SnmpContextv2c extends SnmpContext implements SnmpContextv2cFace, java.lang.Cloneable
destroy() should be called when the context is no longer
used. This is the only way the threads will be stopped and garbage
collected.
SnmpContextv2cFace,
SnmpContextv2cPoolanyPduExpectingResponse, bindAddr, hostname, hostPort, isDestroyed, maxRecvSize, pduSupport, trapSupport, typeSocketDEFAULT_COMMUNITYDEFAULT_PORT, MAXPDU, MSS, STANDARD_SOCKET, TCP_SOCKET| Constructor and Description |
|---|
SnmpContextv2c(java.lang.String host,
int port)
Constructor.
|
SnmpContextv2c(java.lang.String host,
int port,
java.lang.String typeSocketA)
Constructor.
|
SnmpContextv2c(java.lang.String host,
int port,
java.lang.String bindAddress,
java.lang.String typeSocketA)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
Returns a clone of this SnmpContextv2c.
|
byte[] |
encodePacket(byte msg_type,
int rId,
int errstat,
int errind,
java.util.Enumeration ve,
java.lang.Object obj)
Encodes a PDU.
|
java.lang.String |
getHashKey()
Returns the hash key.
|
int |
getVersion()
Returns the SNMP version of this context.
|
Pdu |
processIncomingPdu(byte[] message)
Processes an incoming pdu (but not a response).
|
protected void |
processIncomingResponse(java.io.ByteArrayInputStream in)
Processes an incoming SNMP v2c response.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
encodePacket, getCommunity, setCommunityactivate, 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, stopequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetCommunity, setCommunityaddPdu, addRequestPduListener, addRequestPduListener, addRequestPduListener, addTrapListener, addTrapListener, addTrapListener, destroy, getBindAddress, getHost, getPort, getReceivedFromHostAddress, getSendToHostAddress, getTypeSocket, isDestroyed, removePdu, removeRequestPduListener, removeRequestPduListener, removeRequestPduListener, removeTrapListener, removeTrapListener, removeTrapListener, sendPacketpublic SnmpContextv2c(java.lang.String host,
int port)
throws java.io.IOException
host - The host to which the PDU will be sentport - The port where the SNMP server will bejava.io.IOExceptionAbstractSnmpContext.AbstractSnmpContext(String, int)public SnmpContextv2c(java.lang.String host,
int port,
java.lang.String typeSocketA)
throws java.io.IOException
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 tojava.io.IOExceptionAbstractSnmpContext.AbstractSnmpContext(String, int, String)public SnmpContextv2c(java.lang.String host,
int port,
java.lang.String bindAddress,
java.lang.String typeSocketA)
throws java.io.IOException
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.java.io.IOExceptionAbstractSnmpContext.AbstractSnmpContext(String, int, String, String),
SnmpContextBasisFace.STANDARD_SOCKET,
SnmpContextBasisFace.TCP_SOCKETpublic int getVersion()
AbstractSnmpContextgetVersion in interface SnmpContextBasisFacegetVersion in class SnmpContextSnmpConstants.SNMP_VERSION_1,
SnmpConstants.SNMP_VERSION_2c,
SnmpConstants.SNMP_VERSION_3public byte[] encodePacket(byte msg_type,
int rId,
int errstat,
int errind,
java.util.Enumeration ve,
java.lang.Object obj)
throws java.io.IOException,
EncodingException
AbstractSnmpContextencodePacket in interface SnmpContextBasisFaceencodePacket in class SnmpContextmsg_type - The message typerId - The message iderrstat - The error statuserrind - The error indexve - The varbind listobj - Additional object (only used in SNMPv3)java.io.IOExceptionEncodingExceptionprotected void processIncomingResponse(java.io.ByteArrayInputStream in)
throws DecodingException,
java.io.IOException
processIncomingResponse in class SnmpContextDecodingExceptionjava.io.IOExceptionAbstractSnmpContext.run()public Pdu processIncomingPdu(byte[] message) throws DecodingException, java.io.IOException
AbstractSnmpContextprocessIncomingPdu in interface SnmpContextBasisFaceprocessIncomingPdu in class SnmpContextDecodingExceptionjava.io.IOExceptionAbstractSnmpContext.rawPduReceived(uk.co.westhawk.snmp.event.RawPduEvent)public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface SnmpContextBasisFaceclone in class SnmpContextjava.lang.CloneNotSupportedException - Thrown when the constructor
generates an IOExceptionpublic java.lang.String getHashKey()
getHashKey in interface SnmpContextBasisFacegetHashKey in class SnmpContextpublic java.lang.String toString()
toString in class SnmpContext