|
SNMP Stack 5_1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.co.westhawk.snmp.stack.AbstractSnmpContext | +--uk.co.westhawk.snmp.stack.SnmpContext | +--uk.co.westhawk.snmp.stack.SnmpContextv2c
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.
SnmpContextv2cFace
,
SnmpContextv2cPool
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 | |
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. |
Method Summary | |
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 the context. |
Pdu |
processIncomingPdu(byte[] message)
Processes an incoming PDU. |
protected void |
processIncomingResponse(java.io.ByteArrayInputStream in)
Processes an incoming SNMP v2c response. |
java.lang.String |
toString()
Returns a string representation of the object. |
Methods inherited from class uk.co.westhawk.snmp.stack.SnmpContext |
encodePacket, getCommunity, setCommunity |
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 |
public 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 beAbstractSnmpContext.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 toAbstractSnmpContext.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.AbstractSnmpContext.AbstractSnmpContext(String, int, String, String)
,
SnmpContextBasisFace.STANDARD_SOCKET
,
SnmpContextBasisFace.TCP_SOCKET
,
SnmpContextBasisFace.NETSCAPE_SOCKET
,
SnmpContextBasisFace.KVM_SOCKET
Method Detail |
public int getVersion()
SnmpContextBasisFace
getVersion
in interface SnmpContextBasisFace
getVersion
in class SnmpContext
SnmpConstants.SNMP_VERSION_1
,
SnmpConstants.SNMP_VERSION_2c
,
SnmpConstants.SNMP_VERSION_3
public byte[] encodePacket(byte msg_type, int rId, int errstat, int errind, java.util.Enumeration ve, java.lang.Object obj) throws java.io.IOException, EncodingException
SnmpContextBasisFace
encodePacket
in interface SnmpContextBasisFace
encodePacket
in class SnmpContext
msg_type
- The message typerId
- The message iderrstat
- The error statuserrind
- The error indexve
- The varbind listobj
- Additional object (only used in SNMPv3)
java.io.IOException
EncodingException
protected void processIncomingResponse(java.io.ByteArrayInputStream in) throws DecodingException, java.io.IOException
processIncomingResponse
in class SnmpContext
DecodingException
java.io.IOException
AbstractSnmpContext.run()
public Pdu processIncomingPdu(byte[] message) throws DecodingException, java.io.IOException
SnmpContextBasisFace
processIncomingPdu
in interface SnmpContextBasisFace
processIncomingPdu
in class SnmpContext
DecodingException
java.io.IOException
AbstractSnmpContext.rawPduReceived(uk.co.westhawk.snmp.event.RawPduEvent)
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in interface SnmpContextBasisFace
clone
in class SnmpContext
java.lang.CloneNotSupportedException
- Thrown when the constructor
generates an IOExceptionpublic java.lang.String getHashKey()
getHashKey
in interface SnmpContextBasisFace
getHashKey
in class SnmpContext
public java.lang.String toString()
toString
in class SnmpContext
|
SNMP Stack 5_1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |